# Re: [gcj] Re: KickStart 2020 simple problem. Code runs locally, but gets WA on Google's machine

```Thanks a Lot <3 <3 Actually single House was returning NONE, and also it
had some problems with house list like [25,25] with a budget of 50. I fixed
them, but still it gets WA..... Ohh..gosh !```
```
def findSol(arr, budget):
if len(arr) == 1 and sum(arr) <= budget:
return 1
arr.sort()
total = 0
count = 0
for i in range(0, len(arr)):
total += arr[i]
#if the total exactly matches budget and there are no more elements
# ex : [25, 25] with budget 50
if total == budget:
count += 1
return count
elif total < budget:
count += 1
else:
return count

def main():
t = int(input())
output = []
while t > 0:
num_and_budget = input().split()
num_and_budget = list(map(int, num_and_budget))
budget = num_and_budget[1]
items = input().split()
items = list(map(int, items))
output.append(findSol(items, budget))
t -= 1
for i in range(len(output)):
print("Case #" + str(i+1) + ": " + str(output[i]))

main()

--
You received this message because you are subscribed to the Google Groups