comefrom: <doocs>2212.Maximum Points in an Archery Competition_1.py
code: def maximumBobPoints( numArrows: int, aliceArrows: List[int]) -> List[int]:
      n = len(aliceArrows)
      state = 0
      mx = -1
      for mask in range(1 << n):
          cnt = points = 0
          for i, alice in enumerate(aliceArrows):
              if (mask >> i) & 1:
                  cnt += alice + 1
                  points += i
          if cnt <= numArrows and mx < points:
              state = mask
              mx = points
      ans = [0] * n
      for i, alice in enumerate(aliceArrows):
          if (state >> i) & 1:
              ans[i] = alice + 1
              numArrows -= ans[i]
      ans[0] = numArrows
      return ans
masked: def sample_funcname ( var_0 : int , var_1 : List [ int ] ) -> List [ int ] :
      var_2 = len ( var_1 )
      var_3 = 0
      var_4 = - 1
      for var_5 in range ( 1 << var_2 ) :
          var_7 = var_6 = 0
          for var_8 , var_9 in enumerate ( var_1 ) :
              if ( var_5 >> var_8 ) & 1 :
                  var_7 += var_9 + 1
                  var_6 += var_8
          if var_7 <= var_0 and var_4 < var_6 :
              var_3 = var_5
              var_4 = var_6
      var_10 = [ 0 ] * var_2
      for var_8 , var_9 in enumerate ( var_1 ) :
          if ( var_3 >> var_8 ) & 1 :
              var_10 [ var_8 ] = var_9 + 1
              var_0 -= var_10 [ var_8 ]
      var_10 [ 0 ] = var_0
      return var_10
  