Geting runtime error on codechef.

,

#include<stdio.h>
int main()
{
int t,i,n,m,j,l,b,r[100000],small;
int k,s,z,ans[100000];
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d %d",&n,&m);
for(j=0;j<n;j++)
{
scanf("%d %d",&l,&b);
r[j]=l*b;
}
small=r[0];
if(m==n)m–;
for(k=0;k<m;k++)
{
s=0;
for(j=0;j<n;j++)
{
if(small>r[j])
{
small=r[j];
s=j;
}
}
for(z=s;z<n-1;z++)
{
r[z]=r[z+1];
}
small=r[0];
n–;
}
small=r[0];
for(j=0;j<n;j++)
{
if(small>r[j])
{
small=r[j];
}
}
ans[i]=small;
}
for(i=0;i<t;i++)
printf("%d\n",ans[i]);
return 0;
}

Put your code in proper blocks, or give an ideone link.