comefrom: <doocs>0798.Smallest Rotation with Highest Score_1.py
code: def bestRotation( nums: List[int]) -> int:
      n = len(nums)
      mx, ans = -1, n
      d = [0] * n
      for i, v in enumerate(nums):
          l, r = (i + 1) % n, (n + i + 1 - v) % n
          d[l] += 1
          d[r] -= 1
      s = 0
      for k, t in enumerate(d):
          s += t
          if s > mx:
              mx = s
              ans = k
      return ans
masked: def sample_funcname ( var_0 : List [ int ] ) -> int :
      var_1 = len ( var_0 )
      var_2 , var_3 = - 1 , var_1
      var_4 = [ 0 ] * var_1
      for var_5 , var_6 in enumerate ( var_0 ) :
          var_7 , var_8 = ( var_5 + 1 ) % var_1 , ( var_1 + var_5 + 1 - var_6 ) % var_1
          var_4 [ var_7 ] += 1
          var_4 [ var_8 ] -= 1
      var_9 = 0
      for var_10 , var_11 in enumerate ( var_4 ) :
          var_9 += var_11
          if var_9 > var_2 :
              var_2 = var_9
              var_3 = var_10
      return var_3
  