problem in the code of "Download File"

What is the problem in the code,even though the answers are correct as per the examples given??(Problem : Download File (beginner))

//CC Download file (Beginner)
#include <stdio.h>
#include <stdlib.h>

int main()
{
int j,i,k,t,n,a;
scanf(" %d",&t);
for (j=0;j<t;j++)
{
scanf(" %d%d",&n,&k);
int b[n];
int c[n];

	for (i=0;i<n;i++)
	{
		scanf("%d%d",&b[i],&c[i]);
	}
	int s=0;
	for (i=0;i<n;i++)
	{
		a=b[i]*c[i];
		s=s+a;
		
	}
	int m=0,l=0,f,g,v;
	for (i=0;i<n;i++)
	{
		m=m+b[i];
		if (m<=k)
		{
			v=c[i]*b[i];
			l=l+v;
		}
		if (m>k)
		{
			f=k-m+b[i];
			g=f*c[i];
			break;
		}
	}
	s=s-g-l;
	printf("%d\n",s);
}
	
return 0;

}