def helper(cand, occupied_len): if occupied_len>T: return res.add(occupied_len) for i in range(len(cand)): helper(cand[i+1:], occupied_len + cand[i]) while True: arr = [int(i) for i in raw_input().split(' ')] if len(arr)==1: break T = arr[0] N = arr[1] T_arr = arr[2:] T_arr.sort() ...