Help Ramu input problem error

2
1 3 7 19
2 3
2 5
4 4 4
4 3 2 1
1 3
798
1 2 3

For the above sample input the output should be
12
1

but my code is showing
12
2

also i think that there is some error in taking input but i am not able to debug it, please help

Sorry to disturb sir, but i debugged it.