w = list(map(int,input().split())) limit = int(input()) sum = 0 weight = [] for i in w: if i <= limit: weight.append(i) while weight: m = max(weight) n = min(weight) try: if (m + n) <= limit: sum += 1 weight.pop(weight.index(m)) ...