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_2 : List [ int ] ) -> List [ int ] :
      var_5 = len ( var_2 )
      var_7 = 0
      var_9 = - 1
      for var_11 in range ( 1 << var_5 ) :
          var_13 = var_12 = 0
          for var_15 , var_16 in enumerate ( var_2 ) :
              if ( var_11 >> var_15 ) & 1 :
                  var_13 += var_16 + 1
                  var_12 += var_15
          if var_13 <= var_0 and var_9 < var_12 :
              var_7 = var_11
              var_9 = var_12
      var_17 = [ 0 ] * var_5
      for var_15 , var_16 in enumerate ( var_2 ) :
          if ( var_7 >> var_15 ) & 1 :
              var_17 [ var_15 ] = var_16 + 1
              var_0 -= var_17 [ var_15 ]
      var_17 [ 0 ] = var_0
      return var_17
  