what is the problem with this code ?

/This is the solution of the problem “the lead game” (beginner level). This works fine on Dev C++ compiler but showing “Wrong Answer” on submission in Codechef.
Please help
/

    #include<stdio.h>
    int main(void)
    {
	int nr,i,d,e=0,w,player1,player2;
	scanf("%d",&nr);
	if(nr>0 && nr<=10000)
	{
		for(i=0;i<nr;i++)
		{
			scanf("%d %d",&player1,&player2);
			if(player1>=1 && player1<=1000 && player2>=1 && player2<=1000)
			{
				if(player1>player2)
				{
					d=player1-player2;
					if(e<d)
					{
						e=d;
						w=1;
					}
				}
				else
				{
					d=player2-player1;
					if(e<d)
					{
						e=d;
						w=2;
					}
				}
			}
		}
		printf("%d %d",w,e);
		return 0;
	}
    }

Search the forums. Use the search feature, type your problem code. Its been answered mutiple times before.