#include
#include
using namespace std;
int main()
{
//int cases;
//cin>>cases;
//while(cases–)
int p1,p2,round=5,sump1=0,sump2=0;
int mx=INT_MIN;
int winner=0;
for(int i=1;i<=round;i++)
{
cin>>p1>>p2;
sump1=sump1+p1;
sump2=sump2+p2;
int lead=0;
if(sump1>sump2)
{
lead=sump1-sump2;
if(lead>mx)
{
mx=lead;
winner=1;
}
//mx=max(mx,lead);
}
else
{
lead=sump2-sump1;
if(lead<mx)
{
mx=lead;
winner=2;
}
}
//cout<<lead<<endl;
}
cout<<winner<<endl;
cout<<mx<<endl;
return 0;
}
whenever i run this code it print 2 (winner) and 1(mx) but it should have to 1 58 please help me to solve this problem and what is the problem in my code.