Language: C++

#include<bits/stdc++.h>
#define pii pair<__int32,__int32>
using namespace std;
pii mx[100100];
vector<pii> v,x;
int main()
{
	int N,K;
	cin>>N>>K;
	for(int i=0;i<N;i++)
	{
		int sstype,ssdeli;
		cin>>sstype>>ssdeli;
		mx[sstype-1].first=max(mx[sstype-1].first,ssdeli);
		mx[sstype-1].second=sstype;
		v.push_back(make_pair(ssdeli,sstype));
	}
	sort(mx,mx+N);
	reverse(mx,mx+N);
	sort(v.rbegin(),v.rend());
	for(int i=0;i<K;i++)
		x.push_back(mx[i]),
		v.erase(find(v.begin(),v.end(),mx[i]));
	reverse(x.begin(),x.end());
	long long sssize=x.size();
	for(int i=0;i<x.size();i++)
		if(v[0].first-x[i].first>sssize*2-1)
		{
			x[i]=v[0];
			v.erase(v.begin());
			sssize--;
		}
	long long ans=0;
	for(int i=0;i<x.size();i++)
		ans+=x[i].first;
	cout<<ans+sssize*sssize<<endl;
	return 0;
}


Compiler output:
a.cc:2:18: error: '__int32' was not declared in this scope; did you mean '__ynf32'?
    2 | #define pii pair<__int32,__int32>
      |                  ^~~~~~~
a.cc:4:1: note: in expansion of macro 'pii'
    4 | pii mx[100100];
      | ^~~
a.cc:2:26: error: '__int32' was not declared in this scope; did you mean '__ynf32'?
    2 | #define pii pair<__int32,__int32>
      |                          ^~~~~~~
a.cc:4:1: note: in expansion of macro 'pii'
    4 | pii mx[100100];
      | ^~~
a.cc:2:33: error: template argument 1 is invalid
    2 | #define pii pair<__int32,__int32>
      |                                 ^
a.cc:4:1: note: in expansion of macro 'pii'
    4 | pii mx[100100];
      | ^~~
a.cc:2:33: error: template argument 2 is invalid
    2 | #define pii pair<__int32,__int32>
      |                                 ^
a.cc:4:1: note: in expansion of macro 'pii'
    4 | pii mx[100100];
      | ^~~
a.cc:2:18: error: '__int32' was not declared in this scope; did you mean '__ynf32'?
    2 | #define pii pair<__int32,__int32>
      |                  ^~~~~~~
a.cc:5:8: note: in expansion of macro 'pii'
    5 | vector<pii> v,x;
      |        ^~~
a.cc:2:26: error: '__int32' was not declared in this scope; did you mean '__ynf32'?
    2 | #define pii pair<__int32,__int32>
      |                          ^~~~~~~
a.cc:5:8: note: in expansion of macro 'pii'
    5 | vector<pii> v,x;
      |        ^~~
a.cc:2:33: error: template argument 1 is invalid
    2 | #define pii pair<__int32,__int32>
      |                                 ^
a.cc:5:8: note: in expansion of macro 'pii'
    5 | vector<pii> v,x;
      |        ^~~
a.cc:2:33: error: template argument 2 is invalid
    2 | #define pii pair<__int32,__int32>
      |                                 ^
a.cc:5:8: note: in expansion of macro 'pii'
    5 | vector<pii> v,x;
      |        ^~~
a.cc:5:11: error: template argument 1 is invalid
    5 | vector<pii> v,x;
      |           ^
a.cc:5:11: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:14:30: error: request for member 'first' in 'mx[(sstype - 1)]', which is of non-class type 'int'
   14 |                 mx[sstype-1].first=max(mx[sstype-1].first,ssdeli);
      |                              ^~~~~
a.cc:14:53: error: request for member 'first' in 'mx[(sstype - 1)]', which is of non-class type 'int'
   14 |                 mx[sstype-1].first=max(mx[sstype-1].first,ssdeli);
      |                                                     ^~~~~
a.cc:15:30: error: request for member 'second' in 'mx[(sstype - 1)]', which is of non-class type 'int'
   15 |                 mx[sstype-1].second=sstype;
      |                              ^~~~~~
a.cc:16:19: error: request for member 'push_back' in 'v', which is of non-class type 'int'
   16 |                 v.push_back(make_pair(ssdeli,sstype));
      |                   ^~~~~~~~~
a.cc:20:16: error: request for member 'rbegin' in 'v', which is of non-class type 'int'
   20 |         sort(v.rbegin(),v.rend());
      |                ^~~~~~
a.cc:20:27: error: request for member 'rend' in 'v', which is of non-class type 'int'
   20 |         sort(v.rbegin(),v.rend());
      |                           ^~~~
a.cc:22:19: error: request for member 'push_back' in 'x', which is of non-class type 'int'
   22 |                 x.push_back(mx[i]),
      |                   ^~~~~~~~~
a.cc:23:19: error: request for member 'erase' in 'v', which is of non-class type 'int'
   23 |                 v.erase(find(v.begin(),v.end(),mx[i]));
      |                   ^~~~~
a.cc:23:32: error: request for member 'begin' in 'v', which is of non-class type 'int'
   23 |                 v.erase(find(v.begin(),v.end(),mx[i]));
      |                                ^~~~~
a.cc:23:42: error: request for member 'end' in 'v', which is of non-class type 'int'
   23 |                 v.erase(find(v.begin(),v.end(),mx[i]));
      |                                          ^~~
a.cc:24:19: error: request for member 'begin' in 'x', which is of non-class type 'int'
   24 |         reverse(x.begin(),x.end());
      |                   ^~~~~
a.cc:24:29: error: request for member 'end' in 'x', which is of non-class type 'int'
   24 |         reverse(x.begin(),x.end());
      |                             ^~~
a.cc:25:28: error: request for member 'size' in 'x', which is of non-class type 'int'
   25 |         long long sssize=x.size();
      |                            ^~~~
a.cc:26:25: error: request for member 'size' in 'x', which is of non-class type 'int'
   26 |         for(int i=0;i<x.size();i++)
      |                         ^~~~
a.cc:27:21: error: invalid types 'int[int]' for array subscript
   27 |                 if(v[0].first-x[i].first>sssize*2-1)
      |                     ^
a.cc:27:32: error: invalid types 'int[int]' for array subscript
   27 |                 if(v[0].first-x[i].first>sssize*2-1)
      |                                ^
a.cc:29:26: error: invalid types 'int[int]' for array subscript
   29 |                         x[i]=v[0];
      |                          ^
a.cc:29:31: error: invalid types 'int[int]' for array subscript
   29 |                         x[i]=v[0];
      |                               ^
a.cc:30:27: error: request for member 'erase' in 'v', which is of non-class type 'int'
   30 |                         v.erase(v.begin());
      |                           ^~~~~
a.cc:30:35: error: request for member 'begin' in 'v', which is of non-class type 'int'
   30 |                         v.erase(v.begin());
      |                                   ^~~~~
a.cc:34:25: error: request for member 'size' in 'x', which is of non-class type 'int'
   34 |         for(int i=0;i<x.size();i++)
      |                         ^~~~
a.cc:35:23: error: invalid types 'int[int]' for array subscript
   35 |                 ans+=x[i].first;
      |                       ^