Nowhere in the problem there is stated how many tests there will be/when to stop
Mykolakola you need to read input file until the end, for example like this
while(cin>>a) { ... }