criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> p_int;
typedef pair<ll,ll> p_ll;
typedef tuple<ll,ll,ll> t3_ll;
int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1};
int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
const ll inf = 1000000007;

int main() {
	int n,k
	cin >> n >> k;
	p_int ss[n];
	bool use[100005];
	for (int i = 0;i < 100005;i++) {
		use[i] = false;
	}
	for (int i = 0;i < n;i++) {
		cin >> ss[i].second >> ss[i].first;
	}
	sort(ss,ss+n);
	reverse(ss,ss+n);
	vector<int> y0;
	vector<int> y1;
	for (int i = 0;i < n;i++) {
		if (!use[ss[i].second]) y1.push_back(ss[i].first);
		else y0.push_back(ss[i].first);
		use[ss[i].second] = true;
	}
	ll ans = 0;
	ll Y = max(0,k-y0.size());
	ll X = 0;
	for (int i = 0;i < Y;i++) X += y1[i];
	for (int i = 0;i < k - Y;i++) X += y0[i];
	while (1) {
		ans = max(ans, X + Y*Y);
		if (Y >= k || Y >= y1.size()) break;
		X+=y1[Y];
		X-=y0[k-Y-1];
		Y++;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: expected initializer before 'cin'
   14 |         cin >> n >> k;
      |         ^~~
a.cc:33:22: error: 'k' was not declared in this scope
   33 |         ll Y = max(0,k-y0.size());
      |                      ^
Language: C++

#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
//#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main(){
  int n,k;cin>>n>>k;pair<int,int> all[100000];rep(i,n)cin>>all[i].second>>all[i].first;
  sort(all,all+n,greater<pair<int,int>>());
  pair<int,int> em[100001];
  rep(i,100001){
    em[i].first = 0;em[i].second = i;
  }
  rep(i,n){
    em[all[i].second].first = max(em[all[i].second].first,all[i].first);
  }
  int netaCount = 0;
  rep(i,100001){
    if(em[i].first > 0){
      netaCount++;
    }
  }
  ll ans = 0, used = 0;stack<int> changable,unchangable;bool g[100001], gg[100001];rep(i,100001)g[i] = false;
  rep(i,k){
    ans += all[i].first;
    if(!g[all[i].second]){
      used++;g[all[i].second] = gg[all[i].second] = true;em[all[i].second].first = 0;
      unchangable.push(i);
    }else{
      changable.push(i);
    }
  }

  ans += used * used;
  sort(em,em+100001,greater<pair<int,int>>());
  int changeCount = 0;ll karians = ans;
  //cout << netaCount << " " << used << endl;
  int j = netaCount - used;
  rep(i,j+1){
    int Ind;
    if(!unchangable.emplace && changable.empty()){
      Ind = unchangable.top();unchangable.pop();
      karians = karians - all[Ind].first + em[i].first;
    }else{
      Ind = changable.top();changable.pop();
      karians = karians + 2 * used + 1 - all[Ind].first + em[i].first;
      used++;
    }
    //cout << all[Ind].first << " " << em[i].second << endl;
    ans = max(ans, karians);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:21: error: cannot resolve overloaded function 'emplace' based on conversion to type 'bool'
   46 |     if(!unchangable.emplace && changable.empty()){
      |                     ^~~~~~~
a.cc:46:21: error: in argument to unary !
   46 |     if(!unchangable.emplace && changable.empty()){
      |         ~~~~~~~~~~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class t, class u> void cmax(t& a, u b) { if (a<b) a = b; }
template<class t, class u> void cmin(t& a, u b) { if (a>b) a = b; }

bool comp(pllll l, pllll r) {
  if (l.second != b.second) return l.second < r.second;
  else return a.first < b.first;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(false);

  int n, k;
  cin >> n >> k;

  vector<pllll> sushi(n);

  vector<pllll> bests;
  vector<pllll> notbests;

  rep(i, n) {
    int a, b;
    cin >> a >> b;
    sushi[i] = pllll(a, b);
  }

  sort(sushi.rbegin(), sushi.rend(), comp);

  bool checked[100004] = {};
  rep(i, n) {
    if (checked[sushi[i].first] == 0) {
      bests.push_back(sushi[i]);
      checked[sushi[i].first] = 1;
    } else {
      notbests.push_back(sushi[i]);
    }
  }

  cerr << endl;
  rep(i, n) {
    cerr << sushi[i].first << " " << sushi[i].second << endl;
  }
  cerr << endl;
  for (auto&& i : bests) {
    cerr << i.first << " " << i.second << endl;
  }
  cerr << endl;
  for (auto&& i : notbests) {
    cerr << i.first << " " << i.second << endl;
  }

  vector<ll> bests_sum(bests.size()+1);
  vector<ll> notbests_sum(notbests.size()+1);
  
  rep(i, bests.size()) {
    bests_sum[i+1] = bests_sum[i]+bests[i].second;
  }
  rep(i, notbests.size()) {
    notbests_sum[i+1] = notbests_sum[i]+notbests[i].second;
  }

  // i種類でkこ食べる
  
  ll ans = 0;
  for (int i = 1; i <= k; i++) {
    ll cnt = 0;
    cnt += bests_sum[i];
    cnt += notbests_sum[k-i];
    cnt += i*i;
    cmax(ans, cnt);
  }

  cout << ans << endl;
}


Compiler output:
a.cc: In function 'bool comp(pllll, pllll)':
a.cc:11:19: error: 'b' was not declared in this scope
   11 |   if (l.second != b.second) return l.second < r.second;
      |                   ^
a.cc:12:15: error: 'a' was not declared in this scope
   12 |   else return a.first < b.first;
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n,k;
  cin>>n>>k;
  vector<ll> t(n),d(n),a[100005];
  vector<pair<ll,ll>> p;
  set<ll> s;
  for(int i=0;i<n;i++){
    cin>>t[i]>>d[i];
    s.insert(t[i]);
    p.push_back(make_pair(d[i],t[i]));
    a[t[i]].push_back(d[i]);
  }
  sort(p.begin(),p.end(),greater<pair<ll,ll>>());
  set<ll> se;
  ll c1=0;
  for(int i=0;i<k;i++){
    c1+=p[i].first;
    se.insert(p[i].second);
  }
  c1+=se.size()*se.size();
  for(int i=0;i<100001;i++){
    if(!a[i].empty()){
      sort(a[i].begin(),a[i].end(),greater<ll>());
    }
  }
  ll c2=0,cnt=0;
  set<ll> ss;
  vector<bool> bo(100005,true);
  for(int i=0;i<n;i++){
    if(k-cnt<s.size()-ss.size()){
      c2+=p[i].first;
      ss.insert(p[i].second);
      bo[p[i].second]=false;
cnt++;
    }else{
      if(bo[p[i].second]){
 cnt++;
      c2+=p[i].first;
      ss.insert(p[i].second);
      bo[p[i].second]=false;
      }
    }
    if(cnt==k)break;
  }
  cout<<max(c1,c2+ss.size()*ss.size());
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:48:12: error: no matching function for call to 'max(long long int&, long long unsigned int)'
   48 |   cout<<max(c1,c2+ss.size()*ss.size());
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:48:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   48 |   cout<<max(c1,c2+ss.size()*ss.size());
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:48:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   48 |   cout<<max(c1,c2+ss.size()*ss.size());
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001

int main(){
    ll N, K; cin >> N >> K;
    vector<PII> V;
    map<int, vector<int>> M;
    for(int i=0; i<N; i++){
        int a, b; cin >> a >> b;
        V.push_back(PII(b, a));
        M[a].push_back(b);
    }
    ll a1 = 0;
    sort(V.begin(), V.end(), greater<PII>());
    for(int i=0; i<K; i++)
        a1+=V[i].first;
    
    for(auto &m:M)
        sort(m.second.begin(), m.second.end(), greater<int>());
    
    ll a2 = 0;
    int j = 0;
    int k = 0;
    for(int i=0; i<M.size();){
        if(j==K) break;
        j++;
        a2 += M[i].second[k];
        if(i==M.size()-1){i = 0; k++;
    }
        
    
    
    
    
    cout << max(a1, a2)<< endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:20: error: 'std::map<int, std::vector<int> >::mapped_type' {aka 'class std::vector<int>'} has no member named 'second'
   43 |         a2 += M[i].second[k];
      |                    ^~~~~~
a.cc:52:2: error: expected '}' at end of input
   52 | }
      |  ^
a.cc:20:11: note: to match this '{'
   20 | int main(){
      |           ^
Language: C++

#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
bool cmp(ll a,ll b)
{
    return a>b;
}
struct P
{
    int t;
    ll d;
    P(){}
    P(int a,ll b)
    {
        t=a;
        d=b;
    }
    friend bool operator<(const P &p1,const P &p2)
    {
        return p1.d<p2.d;
    }
};
struct
{
    vector<ll>d;
    int p;
}T[100000+5];
priority_queue<P>q1;
priority_queue<P>q2;
map<int,int>mmp;
ll aaa[100000+5];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    int ans=1;
    for(int i=0;i<n;i++)
    {
        int t;
        ll d;
        scanf("%d%lld",&t,&d);
        if(mmp[t])
        {
            T[mmp[t]].d.push_back(d);
        }
        else
        {
            mmp[t]=ans++;
            T[mmp[t]].d.push_back(d);
        }
    }
    ll _max=0;
    for(int i=0;i<k;i++)
    {
        _max+=aaa[i];
    }
    for(int i=1;i<ans;i++)
    {
        T[i].p=0;
        sort(T[i].d.begin(),T[i].d.end(),cmp);
        /*for(vector<ll>::iterator it=T[i].d.begin();it!=T[i].d.end();it++)
        {
            cout<<(*it)<<" ";
        }
        cout<<endl;*/
        q1.push(P(i,T[i].d[0]));
        a[i]=T[i].d[0];
    }
    sort(aaa,aaa+ans-1,cmp);
    for(int i=0;i<min(k,ans-1);i++)
    {
        _max+=aaa[i];
    }
    ll sumd=0,x=0;
    while(k--)
    {
        if(!q1.empty()&&!q2.empty())
        {
            P p1=q1.top(),p2=q2.top();
            if(p1.d+(x+1)*(x+1)>x*x+p2.d||ans*ans>_max)
            {

                sumd+=p1.d;
                x++;
                q1.pop();
                q2.push(P(p1.t,T[p1.t].d[++T[p1.t].p]));
                //printf("1:%lld %lld\n",p1.d,x);

            }
            else
            {

                sumd+=p2.d;
                q2.pop();
                if(T[p2.t].p+1<T[p2.t].d.size())
                {
                    q2.push(P(p2.t,T[p2.t].d[++T[p2.t].p]));
                }
                //printf("2:%lld %lld\n",p2.d,x);
            }
        }
        else if(q1.empty()&&!q2.empty())
        {

            P p2=q2.top();
            sumd+=p2.d;
            q2.pop();
            if(T[p2.t].p+1<T[p2.t].d.size())
            {
                q2.push(P(p2.t,T[p2.t].d[++T[p2.t].p]));
            }
            //printf("22:%lld %lld\n",p2.d,x);
        }
        else if(!q1.empty()&&q2.empty())
        {

            P p1=q1.top();
            sumd+=p1.d;
            x++;
            q1.pop();
            q2.push(P(p1.t,T[p1.t].d[++T[p1.t].p]));
            //printf("11:%lld %lld\n",p1.d,x);
        }
    }
    printf("%lld\n",sumd+x*x);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:75:9: error: 'a' was not declared in this scope
   75 |         a[i]=T[i].d[0];
      |         ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001

int main(){
    ll N, K; cin >> N >> K;
    vector<PII> V;
    map<int, vector<int>> M;
    for(int i=0; i<N; i++){
        int a, b; cin >> a >> b;
        V.push_back(PII(b, a));
        M[a].push_back(b);
    }
    ll a1 = 0;
    sort(V.begin(), V.end(), greater<PII>());
    for(int i=0; i<K; i++)
        a1+=V[i].first;
    
    for(auto &m:M)
        sort(m.second.begin(), m.second.end(), greater<int>());
    
    ll a2 = 0;
    int j = 0;
    int k = 0;
    for(int i=0; i<M.size();){
        if(j==K) break;
        j++;
        a2 += M[i].second(k);
        if(i==M.size()-1){i = 0; k++;
    }
        
    
    
    
    
    cout << max(a1, a2)<< endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:20: error: 'std::map<int, std::vector<int> >::mapped_type' {aka 'class std::vector<int>'} has no member named 'second'
   43 |         a2 += M[i].second(k);
      |                    ^~~~~~
a.cc:52:2: error: expected '}' at end of input
   52 | }
      |  ^
a.cc:20:11: note: to match this '{'
   20 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<map>
using namespace std;

long long ans;
int n, k;
int t[100001], d[100001];

map<long long, bool> m;

void f(int dd, int e, long long s){
  //cout << dd << "*" << endl;
  if(dd == k + 1){
    ans = (ans < s + m.size() * m.size() ? s + m.size() * m.size() : ans);
    cout << s << " " << m.size() << " " << s + m.size() * m.size() << endl;
  }
  if(e >= n) return;
  
  int i=e;
  do{
    m[t[i]] = true;
    f(dd+1, i+1, s + d[i]);
    m[t[i]] = false;
    ++i;
  }while(i < n - k + 1)
}

int main(){
  cin >> n >> k;

  for(int i=0; i<n; ++i) cin >> t[i] >> d[i];

  f(1, 0, 0);

  cout << ans << endl;
}


Compiler output:
a.cc: In function 'void f(int, int, long long int)':
a.cc:27:24: error: expected ';' before '}' token
   27 |   }while(i < n - k + 1)
      |                        ^
      |                        ;
   28 | }
      | ~
Language: C++

#include<nits/stdc++.h>
using namespace std;

bool used[101010];
int main(){
    int n,k;
    cin>>n>>k;
    pair<int,int> a[n];
    for(int i=0;i<n;i++)cin>>a[i].second>>a[i].first;
    sort(a,a+n);
    reverse(a,a+n);

    priority_queue<int,vector<int>,greater<int>> que;
    long long cnt=0, sum=0;
    for(int i=0;i<k;i++){
        sum+=a[i].first;
        if(!used[a[i].second]){
            ++cnt;
            used[a[i].second]=true;
        }
        else que.push(a[i].first);
    }
    long long ans=sum+cnt*cnt;
    for(int i=k;i<n;++i){
        if(cnt>=k)break;
        if(used[a[i].second])continue;
        ++cnt;
        used[a[i].second]=true;
        int mini=que.top();que.pop();
        sum-=mini;
        sum+=a[i].first;
        ans=max(ans,sum+cnt*cnt);
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc:1:9: fatal error: nits/stdc++.h: No such file or directory
    1 | #include<nits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD 1000000007
using namespace std;

int main(void){
    int n,k,choice=0,l=0,select=0;
    long long ans=0,sum=0;
    cin >> n >> k;
    vector<int> t(n),,used(n+1,0),place(n,0);
    vector<long long> d(n);
    for(int i=0; i<n; i++){
        cin >> t[i] >> d[i];
    }
    for(int i=0; i<n; i++){
        int key=i,temp;
        for(int j=i+1; j<n; j++){
            if(d[j]>d[key])key=j;
        }
        temp=d[i];d[i]=d[key];d[key]=temp;
        temp=t[i];t[i]=t[key];t[key]=temp;
    }
    for(int i=0; i<n; i++){
        if(select<k){
            sum+=d[i];
            if(used[t[i]]==0){
                used[t[i]]++;
                choice++;
            }else {
                place[l]=i;l++;
            }
            select++;
            ans=max(ans,sum+choice*choice);
        }else if(used[t[i]]==0){
            sum-=d[place[--l]];
            sum+=d[i];
            used[t[i]]++;
            choice++;
            ans=max(ans,sum+choice*choice);
            if(l==0)break;
        }
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: expected unqualified-id before ',' token
   16 |     vector<int> t(n),,used(n+1,0),place(n,0);
      |                      ^
Language: C++

#include <bits/stdc++.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll N, K;
	cin >> N >> K;

	ll t[N], d[N];
	map<ll, ll> mp1;
	rep(i, N) {
		cin >> t[i] >> d[i];
	}

	vector<pll> v;

	rep(i, N) {
		v.push_back((pll){d[i], t[i]});
	};

	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());

	map<ll, ll> mp;
	ll ans = 0;
	ll typ = 0;
	vector<ll> w;
	for(ll i = 0; i < K; i++){
		pll p = v[i];
		auto it = mp.find(p.se);
		if(it == mp.end()){
			mp[p.se] = 0;
			typ++;
		}

		mp[p.se]++;
		if(mp[p.se] >= 2) w.push_back(p.fi);

		ans += p.fi;
	}

	ans += typ * typ;
	// cout << "first:" << ans << endl;
	ll ans2 = ans;
	ll anst = ans;

	for(int i = K; i < N; i++){
		pll p = v[i];
		// cout << i << " " << p.se << endl;
		auto it = mp.find(p.se);
		if(it != mp.end()) continue;

		mp[p.se] = 1;

		ans2 -= w[w.size()-1];
		ans2 += p.fi;
		ans2 -= typ * typ;
		ans2 += (typ+1) * (typ+1);
		
		w.pop_back();
		typ++;

		anst = max(anst, ans2)
		// cout << i << ":" << ans << " " << typ << endl;
	}

	cout << max(ans, anst) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:79:39: error: expected ';' before '}' token
   79 |                 anst = max(anst, ans2)
      |                                       ^
      |                                       ;
   80 |                 // cout << i << ":" << ans << " " << typ << endl;
   81 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define p pair<ll, ll>
using namespace std;

int used[100005];
int used2[100005];
int useId[100005];
int main(){
    int n, k;
    cin >> n >> k;
    vector<p> v;
    for(int i = 0; i < n; i++){
        ll t, d;
        cin >> t >> d;
        v.push_back(p(d, t));
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    int idx = 0, su = 0;
    ll sum = 0;
    // 別々のを食べたとき
    int su = 0;
    ll sum = 0;
    for(int i = 0; i < v.size(); i++){
        if(used[v[i].second]) continue;
        if(su == k) break;
        used[v[i].second] = 1;
        sum += v[i].first;
        useId[i] = 1;
        su++;
    }
    if(su < k){
        for(int i = 0; i < v.size(); i++){
            if(useId[i] == 0){
                sum += v[i].first;
                used[v[i].second] = 1;
                su++;
            }
            if(su == k) break;
        }
    }
    ll cnt = 0;
    for(int i = 0; i < 100005; i++){
        if(used[i]) cnt++;
    }

    // 重複ありで貪欲に
    ll sum2 = 0;
    for(int i = 0; i < k; i++){
        sum2 += v[i].first;
        used2[v[i].second] = 1;
    }
    ll cnt2 = 0;
    for(int i = 0; i < 100005; i++){
        if(used2[i]) cnt2++;
    }
    cout << max(sum + cnt * cnt, sum2 + cnt2 * cnt2) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: redeclaration of 'int su'
   23 |     int su = 0;
      |         ^~
a.cc:20:18: note: 'int su' previously declared here
   20 |     int idx = 0, su = 0;
      |                  ^~
a.cc:24:8: error: redeclaration of 'long long int sum'
   24 |     ll sum = 0;
      |        ^~~
a.cc:21:8: note: 'long long int sum' previously declared here
   21 |     ll sum = 0;
      |        ^~~
Language: C++

#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int N, K, t, d, s;
ll res[111111], S, RES;
set<int>st;
priority_queue<iP>q;

int main() {
	cin >> N >> K;
	for (int i = 0; i != N; ++i) {
		cin >> t >> d;
		st.insert(t);
		q.push(mkp(d, t));
	}
	s = max(st.size(), K);
	st.clear();
	for (int i = K - 1; i != -1; --i) {
		res[i] = res[i + 1] + q.top().first;
		st.insert(q.top().second);
		q.pop();
	}
	for (int i = s - 1; i != -1; --i)
		res[i] = res[max(i - (int)st.size() + 1, 0)];
	while (!q.empty()) {
		if (st.find(q.top().second) == st.end()) {
			st.insert(q.top().second);
			S += q.top().first;
			res[st.size() - 1] += S;
		}
		q.pop();
	}
	for (ll i = 0; i != s; ++i) {
		RES = max(RES, res[i] + (i + 1)*(i + 1));
	}
	cout << RES << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: no matching function for call to 'max(std::set<int>::size_type, int&)'
   25 |         s = max(st.size(), K);
      |             ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:25:16: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'int')
   25 |         s = max(st.size(), K);
      |             ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:25:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
   25 |         s = max(st.size(), K);
      |             ~~~^~~~~~~~~~~~~~
Language: Java

public class Main {
  static class P implements Comparable<P> {
   final int t, d;
    P(int t, int d) {
     this.t = t;
      this.d = d;
    }
    public int compareTo(P p) {
     return d == p.d ? t - t.p : -d + p.d;
    }
  }
 public static void main(String...args) {
  final java.util.Scanner sc = new java.util.Scanner(System.in);
   final int N = sc.nextInt();
   final int K = sc.nextInt();
   final P[] ps = new P[N];
   for(int i = 0; i < N; i++)
     ps[i] = new P(sc.nextInt(), sc.nextInt());
   java.util.Arrays.sort(ps);
   long ans = 0;
   long sum = 0;
   final boolean[] used = new boolean[N + 1];
   final java.util.PriorityQueue<P> que = new java.util.PriorityQueue<>(java.util.Collections.reverseOrder());
   int k = 0;
   long x = 0;
   for(final P p : ps) 
   if(k < K){
     sum += p.d;
     k++;
     if(!used[p.t])
       x++;
     else
       que.offer(p);
     ans = Math.max(ans, sum + x * x);
   } else if(!que.isEmpty() && !used[p.t]) {
     sum -= que.poll().d;
     sum += p.d;
     x++;
     ans = Math.max(ans, sum + x * x);
   }
   System.out.println(ans);
 }
}

Compiler output:
Main.java:9: error: int cannot be dereferenced
     return d == p.d ? t - t.p : -d + p.d;
                            ^
1 error
Language: Java

public class Main {
  static class P implements Comparable<P> {
   final int t, d;
    P(int t, int d) {
     this.t = t;
      this.d = d;
    }
    int compareTo(P p) {
     return d == p.d ? t - t.p : -d + p.d;
    }
  }
 public static void main(String...args) {
  final java.util.Scanner sc = new java.util.Scanner(System.in);
   final int N = sc.nextInt();
   final int K = sc.nextInt();
   final P[] ps = new P[N];
   for(int i = 0; i < N; i++)
     ps[i] = new P(sc.nextInt(), sc.nextInt());
   Arrays.sort(ps);
   long ans = 0;
   long sum = 0;
   final boolean[] used = new boolean[N + 1];
   final java.util.PriorityQueue<P> que = new java.util.PriorityQueue<>(java.util.Collections.reverseOrder());
   int k = 0;
   long x = 0;
   for(final P p : ps) 
   if(k < K){
     sum += p.d;
     k++;
     if(!used[p.t])
       x++;
     else
       que.offer(p);
     ans = Math.max(ans, sum + x * x);
   } else if(!que.isEmpty() && !used[p.t]) {
     sum -= que.poll().d;
     sum += p.d;
     x++;
     ans = Math.max(ans, sum + x * x);
   }
   System.out.println(ans);
 }
}

Compiler output:
Main.java:8: error: compareTo(P) in P cannot implement compareTo(T) in Comparable
    int compareTo(P p) {
        ^
  attempting to assign weaker access privileges; was public
  where T is a type-variable:
    T extends Object declared in interface Comparable
Main.java:9: error: int cannot be dereferenced
     return d == p.d ? t - t.p : -d + p.d;
                            ^
Main.java:19: error: cannot find symbol
   Arrays.sort(ps);
   ^
  symbol:   variable Arrays
  location: class Main
3 errors
Language: C++

#include<iostream>
#include<algorithm>
#include<functional>
#include<stdint>
using namespace std; // 575

const int MAX = 100000;
int main() {
	int K, N;
	static pair<int, int> sushi[MAX];
	cin >> N >> K;
	for (int i = 0;i < N;++ i) cin >> sushi[i].second >> sushi[i].first;
	sort(sushi, sushi+N, greater<pair<int, int> >());
	static int eatSushi[MAX]; // eatSushi[i]は第i種類目の寿司の食べた個数
	for (int i = 0;i < N;++ i) eatSushi[i] = 0;
	
	int64_t delicious = 0, ans;
	int kind = 0;
	for (int i = 0;i < K;++ i) { // まずまぁ美味しさ基礎だけK個上から
		delicious += sushi[i].first;
		if (!eatSushi[sushi[i].second]) ++ kind; // 種類数
		++ eatSushi[sushi[i].second];
	}
	ans = delicious + kind * kind;
	for (int i = K - 1, j = K;kind <= K;++ kind, -- i, ++ j) { // iが取り除く寿司、jが増やす寿司
		while(j < N && eatSushi[sushi[j].second]) ++ j; // まだ食べてない種類の寿司へ
		if (j >= N) break; // ここで寿司の種類が尽きた
		while(eatSushi[sushi[i].second] <= 1) -- i; // 2種類以上ある寿司へ
		delicious += sushi[j].first - sushi[i].first; // 寿司交換
		++ eatSushi[sushi[j].second];
		-- eatSushi[sushi[i].second];
		ans = max(ans, delicious + kind * kind);
	}
	
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、種類ボーナスが無ければ食べる寿司は自明です。
次に、食べる種類数を1個以上、種類ボーナスを1*1以上としてもまだ自明です。
次に、食べる種類数を2個以上、種類ボーナスを2*2以上とするとき、
K個が全て同じならばその中で一番美味しさが少なかった寿司(かつ2種類以上の奴)を、
その種類以外の中で最もおいしい寿司に取り換えるだけですね。
この試行を繰り返していけば、食べる種類数をK個にするまでO(NlogN+K)で求まりそうです(NlogNはソート)
で、実際にこれで求まるので終わり
*/

Compiler output:
a.cc:4:9: fatal error: stdint: No such file or directory
    4 | #include<stdint>
      |         ^~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<algorithm>
#include<functional>
#include<stdint>
using namespace std; // 575

const int MAX = 100000;
int main() {
	int K, N;
	static pair<int, int> sushi[MAX];
	cin >> N >> K;
	for (int i = 0;i < N;++ i) cin >> sushi[i].second >> sushi[i].first;
	sort(sushi, sushi+N, greater<pair<int, int> >());
	int eatSushi[MAX];
	for (int i = 0;i < N;++ i) eatSushi[i] = 0;
	
	int64_t delicious = 0, ans;
	int kind = 0;
	for (int i = 0;i < K;++ i) { // まずまぁ美味しさ基礎だけK個上から
		delicious += sushi[i].first;
		if (!eatSushi[sushi[i].second]) ++ kind;
		++ eatSushi[sushi[i].second];
	}
	ans = delicious + kind * kind;
	for (int i = kind + 1, j = K - 1, k = K;i <= K;++ i, -- j, ++ k) {
		while(eatSushi[sushi[k].second]) ++ k; // まだ食べてない種類の寿司へ
		while(eatSushi[sushi[j].second] <= 1) -- j; // 2種類以上ある寿司へ
		delicious += sushi[k].first - sushi[j].first; // 寿司交換
		++ eatSushi[sushi[k].second];
		-- eatSushi[sushi[j].second];
		ans = max(ans, delicious + i * i);
	}
	
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、種類ボーナスが無ければ食べる寿司は自明です。
次に、食べる種類数を1個以上、種類ボーナスを1*1以上としてもまだ自明です。
次に、食べる種類数を2個以上、種類ボーナスを2*2以上とするとき、
K個が全て同じならばその中で一番美味しさが少なかった寿司(かつ2種類以上の奴)を、
その種類以外の中で最もおいしい寿司に取り換えるだけですね。
この試行を繰り返していけば、食べる種類数をK個にするまでO(NlogN+K)で求まりそうです(NlogNはソート)
で、実際にこれで求まるので終わり
*/

Compiler output:
a.cc:4:9: fatal error: stdint: No such file or directory
    4 | #include<stdint>
      |         ^~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<ll, ll> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n, k; cin >> n >> k;
	vector<pii> v;
	REP(i, n)
	{
		int t, d; cin >> t >> d;
		v.emplace_back(d, t);
	}
	sort(v.rbegin(), v.rend());
	set<int> st;
	priority_queue<pii, vector<pii>, greater<pii> > que;
	ll tmp = 0;
	REP(i, k)
	{
		int t = v[i].second;
		ll d = v[i].first;
		tmp += v[i].first;
		if (st.count(t))
		{
			que.emplace(v[i].first, v[i].second);
		}
		else st.insert(t);
	}
	ll ans = tmp + st.size() * st.size();
	FOR(i, k, n)
	{
		ll d = v[i].first;
		int t = v[i].second;
		if (st.count(t) > 0) continue;
		pii p = que.top();
		que.pop();
		tmp -= p.first;
		tmp += d;
		st.insert(t);
		chmax(ans, tmp + st.size() * st.size());
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:22: error: no matching function for call to 'chmax(ll&, long long unsigned int)'
   70 |                 chmax(ans, tmp + st.size() * st.size());
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:22: note: candidate: 'template<class T> T& chmax(T&, const T&)'
   14 | template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
      |                      ^~~~~
a.cc:14:22: note:   template argument deduction/substitution failed:
a.cc:70:22: note:   deduced conflicting types for parameter 'const T' ('long long int' and 'long long unsigned int')
   70 |                 chmax(ans, tmp + st.size() * st.size());
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  int A, B,C,D;
  cin >> A >> B >> C >> D;
  #include<bits/stdc++.h>
using namespace std;

int main(){
  bool a=false,b=false,c=false,d=false;
  for(int i=0;i<4;i++){
    int A;
    cin >> A;
    if(A==1){
      a=true;
    }
    if(A==4){
      b=true;
    }
    if(A==7){
      c=true;
    }
    if(A==9){
      d=true;
    }
  }
  if(a && b && c && d){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   10 | int main(){
      |         ^~
a.cc:10:9: note: remove parentheses to default-initialize a variable
   10 | int main(){
      |         ^~
      |         --
a.cc:10:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:10:11: error: a function-definition is not allowed here before '{' token
   10 | int main(){
      |           ^
a.cc:34:2: error: expected '}' at end of input
   34 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

if(A>B){
    swap(A,B);
  }#include<bits/stdc++.h>
using namespace std;

int main(){
  int A, B,C,D;
  cin >> A >> B >> C >> D;
  if(A>B){
    swap(A,B);
  }
  if(B>C){
    swap(B,C);
  }
  if(C>D){
    swap(C,D);
  }
  if(B>C){
    swap(B,C);
  }
  if(A>B){
    swap(A,B);
  }
 if(A==1 && B==4 && C==7 && D==9){
   cout << "YES" << endl;
 }
  else{
    cout << "NO" << endl;
  }
}

Compiler output:
a.cc:3:4: error: stray '#' in program
    3 |   }#include<bits/stdc++.h>
      |    ^
a.cc:1:1: error: expected unqualified-id before 'if'
    1 | if(A>B){
      | ^~
a.cc:3:5: error: 'include' does not name a type
    3 |   }#include<bits/stdc++.h>
      |     ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope
    8 |   cin >> A >> B >> C >> D;
      |   ^~~
a.cc:10:5: error: 'swap' was not declared in this scope
   10 |     swap(A,B);
      |     ^~~~
a.cc:13:5: error: 'swap' was not declared in this scope
   13 |     swap(B,C);
      |     ^~~~
a.cc:16:5: error: 'swap' was not declared in this scope
   16 |     swap(C,D);
      |     ^~~~
a.cc:19:5: error: 'swap' was not declared in this scope
   19 |     swap(B,C);
      |     ^~~~
a.cc:22:5: error: 'swap' was not declared in this scope
   22 |     swap(A,B);
      |     ^~~~
a.cc:25:4: error: 'cout' was not declared in this scope
   25 |    cout << "YES" << endl;
      |    ^~~~
a.cc:25:21: error: 'endl' was not declared in this scope
   25 |    cout << "YES" << endl;
      |                     ^~~~
a.cc:28:5: error: 'cout' was not declared in this scope
   28 |     cout << "NO" << endl;
      |     ^~~~
a.cc:28:21: error: 'endl' was not declared in this scope
   28 |     cout << "NO" << endl;
      |                     ^~~~
Language: C++

#include <iostream>
#include <map>
using namespace std;
int main () {
  map<int,int> mp;
  for(int i=0;i<4;i++){
    int n;
    cin>>n;
    mp[n]++;
  }
  if (all_of(mp.begin(),mp.end(),[](auto &p){
    auto& [key,val]=p;
    return val==1&&(key==1||key==7||key==9||key==4);
  })) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: 'all_of' was not declared in this scope
   11 |   if (all_of(mp.begin(),mp.end(),[](auto &p){
      |       ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    map<int,int> mp;
    rep(i,4) {
        int x; cin >> x;
        mp[x]++;
    }
    if (mp[1] == 1 && mp[7] == 1 && mp[9] == 1 && mp[4] == 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:33:6: error: expected '}' at end of input
   33 |     }
      |      ^
a.cc:23:12: note: to match this '{'
   23 | int main() {
      |            ^
Language: C

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    vector<int> x{1,9,7,4};
    int count = 0;
    REP(i,4) {
        int n; cin >> n;
        REP(j,4) {
            if (x[j] == n) {
                count++;
                x[j] = 0;
                break;
            }
        }
    }

    CFYN(count == 4)

    return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

int main() {
    int a[4];
    rep(i,4)cin>>a[i];
    sort(a,a+4);
    ans= 1000 * a[0] + 100 * a[1] + 10 * a[2] + a[3];
    if(ans==1479)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

//    cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |     ans= 1000 * a[0] + 100 * a[1] + 10 * a[2] + a[3];
      |     ^~~
      |     abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
vector<ll> v(10);
for(int i = 0; i < n; ++i){
    int a; cin >> a;
    ++v[a];
}
string ans = "NO";
if(v[1]&&v[9]&&v[7] && v[4])ans = "YES";
cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: 'n' was not declared in this scope
   16 | for(int i = 0; i < n; ++i){
      |                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
vector<ll> v(10);
for(int i = 0; i < n; ++i){
    int a; cin >> a;
    ++v[a]
}
string ans = "NO";
if(v[1]&&v[9]&&v[7] && v[4])ans = "YES";
cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: 'n' was not declared in this scope
   16 | for(int i = 0; i < n; ++i){
      |                    ^
a.cc:18:11: error: expected ';' before '}' token
   18 |     ++v[a]
      |           ^
      |           ;
   19 | }
      | ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
#define EPS (1e-10)
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	VI a(4); rep(i,n) cin>>a[i]; sort(ALL(a));
	if(a[0]==1&&a[1]==4&&a[2]==7&&a[3]==9) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:24: error: 'n' was not declared in this scope
   37 |         VI a(4); rep(i,n) cin>>a[i]; sort(ALL(a));
      |                        ^
a.cc:5:39: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(int i=0; i<(int)(n); i++)
      |                                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  vector<int> y(4,0); cin>>y[0]>>y[1]>>y[2]>>y[3];
  sort(y.begin(),y.end);
  if(y[0]=1 && y[1]==4 && y[2] ==7 && y[3]== 9) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: no matching function for call to 'sort(std::vector<int>::iterator, <unresolved overloaded function type>)'
    6 |   sort(y.begin(),y.end);
      |   ~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:63: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<int*, std::vector<int> >'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |                                         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include<iostream>
using namespace std;
int main(void){
  vector<int>a(4);
  REP(i,4)cin >> a[i];
  sort(a.begin(),a.end());
  if(a[0]==1 and a[1] == 4 and a[2] == 7 and a[3] == 9)
    cout << "YES" << endl;
  else 
    cout << "NO" << endl;
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'vector' was not declared in this scope
    4 |   vector<int>a(4);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:4:10: error: expected primary-expression before 'int'
    4 |   vector<int>a(4);
      |          ^~~
a.cc:5:7: error: 'i' was not declared in this scope
    5 |   REP(i,4)cin >> a[i];
      |       ^
a.cc:5:3: error: 'REP' was not declared in this scope
    5 |   REP(i,4)cin >> a[i];
      |   ^~~
a.cc:6:8: error: 'a' was not declared in this scope
    6 |   sort(a.begin(),a.end());
      |        ^
a.cc:6:3: error: 'sort' was not declared in this scope; did you mean 'short'?
    6 |   sort(a.begin(),a.end());
      |   ^~~~
      |   short
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;

int main() {
  vector<int> vec(4);
  rep(i, 4) cin >> vec[i];
  sort(vec.begin(), vec.end());
  if (vec[0] == 1 && vec[1] == 4 && vec[i] == 7 && vec[i] == 9) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:41: error: 'i' was not declared in this scope
   11 |   if (vec[0] == 1 && vec[1] == 4 && vec[i] == 7 && vec[i] == 9) cout << "YES" << endl;
      |                                         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;

int main() {
  vector<int> vec(4);
  rep(i, 4) cin >> vec[i];
  sort(vec.begin(), vec.end());
  if (vec == {1, 4, 7, 9}) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: expected primary-expression before '{' token
   11 |   if (vec == {1, 4, 7, 9}) cout << "YES" << endl;
      |              ^
a.cc:11:13: error: expected ')' before '{' token
   11 |   if (vec == {1, 4, 7, 9}) cout << "YES" << endl;
      |      ~      ^~
      |             )
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;

int main() {
  vector<int> vec(4);
  rep(i, 4) cin >> vec[i];
  sort(vec.begin(), vec.end());
  if (vec == {1, 4, 7, 9}) cout << "YES" << endl;
  else cout << "NO" << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: expected primary-expression before '{' token
   11 |   if (vec == {1, 4, 7, 9}) cout << "YES" << endl;
      |              ^
a.cc:11:13: error: expected ')' before '{' token
   11 |   if (vec == {1, 4, 7, 9}) cout << "YES" << endl;
      |      ~      ^~
      |             )
a.cc:12:29: error: expected '}' at end of input
   12 |   else cout << "NO" << endl;
      |                             ^
a.cc:7:12: note: to match this '{'
    7 | int main() {
      |            ^