comefrom: <doocs>1395.Count Number of Teams_1.py
code: def numTeams( rating: List[int]) -> int:
      n, ans = len(rating), 0
      for j in range(1, n - 1):
          ia = ib = ka = kb = 0
          for i in range(j):
              if rating[i] < rating[j]:
                  ia += 1
              elif rating[i] > rating[j]:
                  ib += 1
          for k in range(j + 1, n):
              if rating[j] < rating[k]:
                  ka += 1
              elif rating[j] > rating[k]:
                  kb += 1
          ans += ia * ka + ib * kb
      return ans
masked: def sample_funcname ( var_0 : List [ int ] ) -> int :
      var_4 , var_6 = len ( var_0 ) , 0
      for var_9 in range ( 1 , var_4 - 1 ) :
          var_13 = var_10 = var_11 = var_12 = 0
          for var_14 in range ( var_9 ) :
              if var_0 [ var_14 ] < var_0 [ var_9 ] :
                  var_13 += 1
              elif var_0 [ var_14 ] > var_0 [ var_9 ] :
                  var_10 += 1
          for var_15 in range ( var_9 + 1 , var_4 ) :
              if var_0 [ var_9 ] < var_0 [ var_15 ] :
                  var_11 += 1
              elif var_0 [ var_9 ] > var_0 [ var_15 ] :
                  var_12 += 1
          var_6 += var_13 * var_11 + var_10 * var_12
      return var_6
  