Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
typedef long long ll
using namespace std;

int main(){
	int n,m,k=0;cin>>n>>m;
  	ll ans=0;
  	vector<pair<ll,ll>> v(n);
  	for(int i=0;i<n;i++) cin>>v[i].first>>v[i].second;
  	sort(v.begin(),v.end());
  	while(m){
      	ll t=v[k].second;
    	if(m>=t)
        {m-=t;
      	ans+=t*v[k].first;}
      	else
        {m=0;ans+=m*v[k].first;}
      	k++;
    }
  	cout<<ans;
}

Compiler output:
a.cc:5:1: error: expected initializer before 'using'
    5 | using namespace std;
      | ^~~~~
a.cc: In function 'int main()':
a.cc:8:21: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |         int n,m,k=0;cin>>n>>m;
      |                     ^~~
      |                     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:9:9: error: 'll' was not declared in this scope
    9 |         ll ans=0;
      |         ^~
a.cc:10:9: error: 'vector' was not declared in this scope
   10 |         vector<pair<ll,ll>> v(n);
      |         ^~~~~~
a.cc:10:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:10:16: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   10 |         vector<pair<ll,ll>> v(n);
      |                ^~~~
      |                std::pair
In file included from /usr/include/c++/14/string:48,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stl_iterator.h:3013:12: note: 'std::pair' declared here
 3013 |     struct pair;
      |            ^~~~
a.cc:10:29: error: 'v' was not declared in this scope
   10 |         vector<pair<ll,ll>> v(n);
      |                             ^
a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   12 |         sort(v.begin(),v.end());
      |         ^~~~
      |         std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:14:11: error: expected ';' before 't'
   14 |         ll t=v[k].second;
      |           ^~
      |           ;
a.cc:15:15: error: 't' was not declared in this scope
   15 |         if(m>=t)
      |               ^
a.cc:17:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |         ans+=t*v[k].first;}
      |         ^~~
      |         abs
a.cc:19:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |         {m=0;ans+=m*v[k].first;}
      |              ^~~
      |              abs
a.cc:22:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   22 |         cout<<ans;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:22:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |         cout<<ans;
      |               ^~~
      |               abs