Language: C++

#include <bits/stdc++.h>
int main()
{
	//int n,m,t1,t2;
	//int z;
	//int sum=0;
	unsigned __int64 a[10010],n,m,t1,t2;
	unsigned __int64 ans=0,z,sum=0;
    unsigned __int64 b[10010];
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&a[i],&b[i]);
	}
	for(int i=1;i<n;i++)
	{
		for(int j=i;j<=n;j++)
		{
			if(a[i]>a[j])
			{
				t1=a[i];t2=b[i];
				a[i]=a[j];b[i]=b[j];
				a[j]=t1;b[j]=t2;
			}
		}
	}
	for(z=1;z<=m;z++)
	{
		sum+=b[z];
		if(sum<=m)
		ans+=a[z]*b[z];
		else
		break;
		
	}
	sum-=b[z];
	if(sum<m)
		ans+=(m-sum)*a[z];
	printf("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:26: error: expected initializer before 'a'
    7 |         unsigned __int64 a[10010],n,m,t1,t2;
      |                          ^
a.cc:8:26: error: expected initializer before 'ans'
    8 |         unsigned __int64 ans=0,z,sum=0;
      |                          ^~~
a.cc:9:22: error: expected initializer before 'b'
    9 |     unsigned __int64 b[10010];
      |                      ^
a.cc:10:23: error: 'n' was not declared in this scope; did you mean 'yn'?
   10 |         scanf("%d%d",&n,&m);
      |                       ^
      |                       yn
a.cc:10:26: error: 'm' was not declared in this scope; did you mean 'tm'?
   10 |         scanf("%d%d",&n,&m);
      |                          ^
      |                          tm
a.cc:13:31: error: 'a' was not declared in this scope
   13 |                 scanf("%d%d",&a[i],&b[i]);
      |                               ^
a.cc:13:37: error: 'b' was not declared in this scope
   13 |                 scanf("%d%d",&a[i],&b[i]);
      |                                     ^
a.cc:19:28: error: 'a' was not declared in this scope
   19 |                         if(a[i]>a[j])
      |                            ^
a.cc:21:33: error: 't1' was not declared in this scope; did you mean 'y1'?
   21 |                                 t1=a[i];t2=b[i];
      |                                 ^~
      |                                 y1
a.cc:21:41: error: 't2' was not declared in this scope; did you mean 'tm'?
   21 |                                 t1=a[i];t2=b[i];
      |                                         ^~
      |                                         tm
a.cc:21:44: error: 'b' was not declared in this scope
   21 |                                 t1=a[i];t2=b[i];
      |                                            ^
a.cc:27:13: error: 'z' was not declared in this scope
   27 |         for(z=1;z<=m;z++)
      |             ^
a.cc:29:17: error: 'sum' was not declared in this scope
   29 |                 sum+=b[z];
      |                 ^~~
a.cc:29:22: error: 'b' was not declared in this scope
   29 |                 sum+=b[z];
      |                      ^
a.cc:31:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |                 ans+=a[z]*b[z];
      |                 ^~~
      |                 abs
a.cc:31:22: error: 'a' was not declared in this scope
   31 |                 ans+=a[z]*b[z];
      |                      ^
a.cc:36:9: error: 'sum' was not declared in this scope
   36 |         sum-=b[z];
      |         ^~~
a.cc:36:14: error: 'b' was not declared in this scope
   36 |         sum-=b[z];
      |              ^
a.cc:36:16: error: 'z' was not declared in this scope
   36 |         sum-=b[z];
      |                ^
a.cc:38:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   38 |                 ans+=(m-sum)*a[z];
      |                 ^~~
      |                 abs
a.cc:38:30: error: 'a' was not declared in this scope
   38 |                 ans+=(m-sum)*a[z];
      |                              ^
a.cc:39:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   39 |         printf("%d",ans);
      |                     ^~~
      |                     abs