Please tell me how to solve runtime error in my code

#include
using namespace std;

int main() {int n,a,b,lead[100],playera=0,playerb=0,sum=0;
cin>>n;
for(int i=0;i<n;i++)
{cin>>a>>b;
if(a>b)
{playera++;
lead[i]=a-b;
}
if(b>a)
{playerb++;
lead[i]=b-a;
}
}
for(int i=0;i<n;i++)
{
if(lead[i]>=sum)
sum=lead[i];}
if(playera>playerb)
cout<<1;
else
cout<<2;
cout<<" "<<sum;

// your code goes here
return 0;

}

Mention the given constraints.

1 ≤ Si ≤ 1000 and 1 ≤ Ti ≤ 1000.
where Si and Ti are the scores of player 1 and 2
problem - https://www.codechef.com/problems/TLG

u created array of size 100
what if n is greater than 100
then i will exceed size of array