The Lead Game- Wrong Answer is coming again and again

#include<stdio.h>

#include<stdlib.h>
int main()
{
int i, x, y, n, max = 0, w, sumx=0, sumy=0 ;
scanf("%d", &n);

for (i = 0; i < n; i++)
{
	scanf("%d%d", &x, &y);
	sumx += x;
	sumy += y;

	if (abs(sumx-sumy)>abs(max))
		max = sumx-sumy;
}
if (max > 0)
	w = 1;
else
	w = 2;
printf("%d%d\n", w, abs(max));
return 0;

}

while printing the answer there should be space between the player who won and his lead so just change printf("%d%d\n", w, abs(max)); to printf("%d %d\n", w, abs(max)); and it will AC

2 Likes

don’t u have time to run your code on at least one test cases?

//