TLG: Code running fine Locally, but codechef compiler shows strange behaviour

Here is my code -
#include<bits/stdc++.h>
using namespace std;
int main()
{
int rounds;
int p1, p2, p1_c, p2_c = 0;
int leader = 0, lead = 0;
cin>>rounds;
while(rounds–)
{
cin>>p1>>p2;
p1_c+=p1;
p2_c+=p2;
int tmp_p1 = p1_c-p2_c; // p1 lead
int tmp_p2 = p2_c-p1_c; // p2 lead
if(tmp_p1 > lead)
{
leader = 1;
lead = tmp_p1;
}
if(tmp_p2 > lead)
{
leader = 2;
lead = tmp_p2;
}
}
cout<<leader<<" "<<lead<<endl;
}
It runs fine and gives correct results locally (vscode+gcc on linux). But online codechef compiler shows wrong results. And when i tried to debug by displaying all values after each calculation, i found that int tmp_p1, int tmp_p2 hold strange values if one of the comment lines are commented!. Please help!!!

Link to my solution - https://www.codechef.com/viewsolution/40050966

Thank you!