[quote="thakur_sahab"]
#include<iostream>
using namespace std;
int main()
{
int i,j,n,flag=0;
long long int t=0,mid=0,diff=0,sum=0,x,y;
cin>>n;
int a[n][2];
for(i=0;i<n;i++)
{
for(j=0;j<2;j++)
{ cin>>a[i][j];
}
}
for(i=0;i<n;i++)
{
t=t+a[i][0]*a[i][1];
}
mid=t/2;
for(i=0;i<n;i++)
{
for(j=0;j<a[i][0];j++)
{ y=sum;
sum=sum+a[i][1];
if(sum>mid)
{
x=abs(t-(2*sum));
y=abs(t-(2*y));
diff=x<y?x:y;
flag=1;
break;
}
}
if(flag==1)
break;
}
cout<<diff;
}
plz help getting wa[/quote]
Dear Mr. thakur_sahab!
1. Please use code tags. Did you ever try to use this little button labeled "code", situated just above the text window where you entered your post?
2. This is the python forum. Do you expect readers of this forum to be able to analyse and improve your c-whatever code? 
cheers daft