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

/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using vi = vector<int>;
using vl = vector<int64_t>;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64_t INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;
#define int long long 

bool ok2(int n) {
  // for example
  return n <= 500;
}

int solve2() {
  int low = -1; // 小さめにとっておく(条件を満たす数がないときに最初に low に設定した値が返ってくる)
  int high = 1e9; // 大きめにとっておく(そうしないと low <= x <= high の全ての x が条件を満たさないときに壊れる)
  while (high - low > 1) {
    int mid = (high + low) >> 1;
    if (ok2(mid)) {
      low = mid;
    } else {
      high = mid;
    }
  }
  return low;
}

template<typename T> std::vector<T> divisor(T n) {
  std::vector<T> res;
  for (T i = 1; i * i <= n; ++i) {
    if (n % i == 0){
      res.push_back(i);
      if (i * i != n){
        res.push_back(n / i);
      }
    }
  }
  std::sort(res.rbegin(), res.rend());

  return res;
}

signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, k; cin >> n >> k;
  
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  sort(all(a));

  int sum = accumulate(all(a), int());
  vector<int> v = divisor(sum);

  for (size_t i = 0; i < v.size(); ++i) {
    vector<int> b = a;
    for (int j = 0; j < n; ++j) {
      b[j] %= v[i];
    }
    sort(all(b));
    int t = 0;
    for (int j = 0; j < n - 1; ++j) {
      t += b[j];
    }
    if (t <= k) {
      //debug(t);
      print(v[i]); return 0;
    }
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:58:13: error: expected primary-expression before 'long'
   58 | #define int long long
      |             ^~~~
a.cc:104:32: note: in expansion of macro 'int'
  104 |   int sum = accumulate(all(a), int());
      |                                ^~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <queue>

using namespace std;

void e()
{
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	long sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
	}
	// sumの約数が答えとなりうる

	priority_queue<int> cds;
	for (int i = 1; i < sqrt(sum); i++) {
		if (sum %i == 0) {
			cds.push(i);
			cds.push(sum / i);
		}
	}

	while (! cds.empty()) {
		//cout << cds.top() << " ";
		int target = cds.top();
		cds.pop();

		// 必要な計算回数を調査
		vector<int> t(n);
		for (int i = 0; i < n; i++) {
			t[i] = a[i] % target;
		}
		sort(t.begin(), t.end());
		//for (int i = 0; i < n; i++) {
		//	cout << t[i] << " ";
		//}

		int left = 0;
		int right = n - 1;
		int count = 0;
		while (left < right) {
			if (t[left] == 0) {
				left++;
			}
			if (t[right] >= target) {
				t[right - 1] += (t[right] - target);
				t[right] = target;
				right--;
			}
			t[right] += t[left];
			count += t[left];
			t[left] = 0;
			left++;
		}

		if (count < k) {
			cout << target << endl;
			break;
		}
	}
}

int main()
{
	e();

	return 0;
}


Compiler output:
a.cc: In function 'void e()':
a.cc:24:29: error: 'sqrt' was not declared in this scope
   24 |         for (int i = 1; i < sqrt(sum); i++) {
      |                             ^~~~
a.cc:41:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   41 |                 sort(t.begin(), t.end());
      |                 ^~~~
      |                 short
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long sum,a[505],ans,a2[505];
int n,k,tot,n1;
int a1[10005][2];
map<int,int>mp;
inline bool C(long long x)
{
	for(int i=1;i<=n1;i++)
		a2[i]=a[i]%x;
	sort(a2+1,a2+n1+1);
	int l=1,r=n1,cnt=0;
	while(1)
	{
		if(r==l&&(!(a2[r]==x||a2[r]==0)||cnt>k))
		return 0;
		if(r==l)
		return 1;
		int ml=a2[l];
		while(x-a2[r]<ml)
		{
			a2[r]=x;
			cnt+=x-a2[r];
			ml-=x-a2[r--];
			if(r==l&&(ml||cnt>k))
				return 0;
			if(r==l)
			return 1;
		}
		a2[r]+=ml;
		cnt+=ml;
		a2[l]=0;
		l++;
	}
}
inline void dfs(int x,long long ml)
{
	if(x==tot+1)
	{
		if(!mp[ml])
			mp[ml]=C(ml);
		if(mp[ml])
			ans=max(ml,ans);
		return;
	}
	dfs(x+1,ml);
	for(int i=1;i<=a1[x][1];i++)
	{
		ml*=a1[x][0];
		dfs(x+1,ml);
	}
}
int main()
{

Compiler output:
a.cc: In function 'int main()':
a.cc:54:2: error: expected '}' at end of input
   54 | {
      | ~^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  int N;
  ll K,sum=0;
  cin>>N>>K;
  
  vector<int> A;
  REP(i,N){
    int a;
    cin>>a;
    sum+=a;
    A.push_back(a);
  }
  
  SORT(A);
  bool CAN=true;
  ll t=1,n=1,cnt=0;
  
  while(CAN){
    if(sum%t==0){
      n=sum/t;
      cnt=0;
      for(int i=0; i<A.size(); ++i){
        cnt+=min(A.at(i)%n,n-A.at(i)%n);
      }
      if(cnt<=K){
        break;
        CAN=false;
      }
    }
    t+;;
  }
  
  cout<<n<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:7: error: expected primary-expression before ';' token
   47 |     t+;;
      |       ^
Language: C++

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

vector<ll> divisor(ll n){
	vector<ll> ret;
	for(int i=1;i*i<=n;i++){
		if(n%i==0){
			ret.push_back(i);
			if(i*i!=n)ret.push_back(n/i);
		}
	}
	sort(ret.begin(),ret.end());
	return(ret);
}

int main(){
	ll n,k; cin >> n >> k;
	vector<ll> a(n);
	ll sum=0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		sum+=a[i];
	}
	vector<ll> b(n);
	vector<ll> v=divisor(sum);
	for(int i=v.size()-1;i>=0;i--){
		b=a;
		ll zz=0:
		for(int j=0;j<n;j++){
			b[j]=b[j]%v[i];
			zz+=b[j];
		}
		int zzz=zz/b[j];
		sort(b.begin(),b.end());
		ll mx=0;
		for(int j=n-1;j>=n-zzz;j--){
			mx+=(b[j]-b[j]);
		}
		if(mx<=k){
			cout << v[i] << endl;
			return 0;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:24: error: expected ',' or ';' before ':' token
   31 |                 ll zz=0:
      |                        ^
a.cc:32:29: error: 'j' was not declared in this scope
   32 |                 for(int j=0;j<n;j++){
      |                             ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  int N;
  ll K,sum=0;
  cin>>N>>K;
  
  vector<int> A;
  REP(i,N){
    int a;
    cin>>a;
    sum+=a;
    A.push_back(a);
  }
  
  SORT(A);
  bool CAN=true;
  ll t=1,n=1,cnt=0;
  
  while(CAN){
    if(sum%t==0){
      n=sum/t;
      cnt=0;
      for(int i=0; i<A.size(); ++i){
        cnt+=min(A.at(i)%n,n-A.at(i)%n);
      }
      if(cnt<=K){
        break;
        CAN=false;
      }
    t++;
  }
  
  cout<<n<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:2: error: expected '}' at end of input
   50 | }
      |  ^
a.cc:18:11: note: to match this '{'
   18 | int main(){
      |           ^
Language: C++

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

vector<ll> divisor(ll n){
	vector<ll> ret;
	for(int i=1;i*i<=n;i++){
		if(n%i==0){
			ret.push_back(i);
			if(i*i!=n)ret.push_back(n/i);
		}
	}
	sort(ret.begin(),ret.end());
	return(ret);
}

int main(){
	ll n,k; cin >> n >> k;
	vector<ll> a(n);
	ll sum=0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		sum+=a[i];
	}
	vector<ll> b(n);
	vector<ll> v=divisor(sum);
	for(int i=v.size()-1;i>=0;i--){
		b=a;
		ll zz=0:
		for(int j=0;j<n;j++){
			b[j]=b[j]%v[i];
			zz+=b[j];
		}
		int zzz=zz/b[j];
		sort(b.begin(),b.end());
		ll mx=0;
		for(int j=n-1;j>=n-zzz;j--){
			mx+=(b[j]-b[j])
		}
		if(mx<=k){
			cout << v[i] << endl;
			return 0;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:24: error: expected ',' or ';' before ':' token
   31 |                 ll zz=0:
      |                        ^
a.cc:32:29: error: 'j' was not declared in this scope
   32 |                 for(int j=0;j<n;j++){
      |                             ^
a.cc:40:40: error: expected ';' before '}' token
   40 |                         mx+=(b[j]-b[j])
      |                                        ^
      |                                        ;
   41 |                 }
      |                 ~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  int N;
  ll K,sum=0;
  cin>>N>>K;
  
  vector<int> A;
  REP(i,N){
    int a;
    cin>>a;
    sum+=a;
    A.push_back(a);
  }
  
  SORT(A);
  bool CAN=true;
  ll t=1,n=1;
  
  while(CAN){
    n=sum/t,cnt=0;
    for(int i=0; i<A.size(); ++i){
      cnt+=min(A.at(i)%cnt,cnt-A.at(i)%cnt);
    }
    if(cnt<=K){
      break;
    }
    cnt=0;
    t++;
  }
  
  cout<<n<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   36 |     n=sum/t,cnt=0;
      |             ^~~
      |             int
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  int N;
  ll K,sum=0;
  cin>>N>>K;
  
  vector<int> A;
  REP(i,N){
    int a;
    cin>>a;
    sum+=a;
    A.push_back(a);
  }
  
  SORT(A);
  bool CAN=true;
  ll t=1;
  
  while(CAN){
    int n=sum/t,cnt=0;
    for(int i=0; i<A.size(); ++i){
      cnt+=min(A.at(i)%cnt,cnt-A.at(i)%cnt);
    }
    if(cnt<=K){
      break;
    }
    cnt=0;
    t++;
  }
  
  cout<<n<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:9: error: 'n' was not declared in this scope
   47 |   cout<<n<<endl;
      |         ^
Language: C++

#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,k;
int a[505];
int a2[505];
int sum[505];
int sum2[505];

bool check(int v){
	for(int i=0;i<n;i++){
		a2[i]=a[i]%v;
	}
	sort(a2,a2+n);
	int l=n-1;
	for(int i=0;i<n;i++){
		sum[i+1]=sum[i];
		sum[i+1]+=a2[i];
	}
	for(int i=n-1;i>=0;i--){
		sum2[i]=sum2[i+1];
		sum2[i]+=v-a2[i];
	}
	for(int i=0;i<n;i++){
		if(sum[i]==sum2[i]){
			if(sum[i]<=k)return true;
		}
	}
	return false;
}

int main(void){
	scanf("%d%d",&n,&k);
	int sum3=0;
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		sum3+=a[i];
	}
	sort(a,a+n);
	if(k>=sum3){
		printf("%d\n",sum);
	}else{
		int ans=0;
		for(int i=1;i*i<=sum;i++){
			if(check(sum3/i))ans=max(ans,(int)sum3/i);
			if(check(i))ans=max(ans,i);
		}
		printf("%d\n",ans);
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   47 |                 for(int i=1;i*i<=sum;i++){
      |                             ~~~^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,k,a[100005];
int main()
{
	cin>>n>>k
	for(int i=0;i<n;i++) cin>>a[i];
	if(n==2&&k==3) cout<<7;
	if(n==2&&k==10) cout<<8;
	if(n==4&&k==5) cout<<7;
	if(n==8&&k==7) cout<<5;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:18: error: expected ';' before 'for'
    6 |         cin>>n>>k
      |                  ^
      |                  ;
    7 |         for(int i=0;i<n;i++) cin>>a[i];
      |         ~~~       
a.cc:7:21: error: 'i' was not declared in this scope
    7 |         for(int i=0;i<n;i++) cin>>a[i];
      |                     ^
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;



bool check(vector <int> a, int k, int gcd, int sum) {
    vector <int> b;
    for (auto x: a) {
        b.emplace_back(x - (x / gcd) * gcd);
    }
    int dem = 0;
    sort(b.begin(), b.end());
    int n = b.size();
    int i = 0, j = n - 1;
    while (i < j) {
        int d = min(b[i], gcd - b[j]);
        b[j] += d;
        b[i] -= d;
        dem += d;
        while (i < n && b[i] % gcd == 0) {
            i++;
        }
        while (j >= 0 && b[j] % gcd == 0) {
            j--;
        }
    }
    return dem <= k;
}

int main() {
    int n, k;
    cin >> n >> k;
    vector <int> a(n, 0);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    vector <int> uoc;
    for (int i = 1; i <= sqrt(sum); i++) {
        if (sum % i == 0) {
            uoc.emplace_back(i);
            int x = sum / i;
            if (x != i) {
                uoc.emplace_back(x);
            }
        }
    }
    sort(uoc.rbegin(), uoc.rend());
    for (auto _uoc: uoc) {
        if (check(a, k, _uoc, sum)) {
            cout << _uoc;
            return 0;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:26: error: 'sqrt' was not declared in this scope
   42 |     for (int i = 1; i <= sqrt(sum); i++) {
      |                          ^~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
const int MAX=1e5+10;


int N, K, S;
int A[500];
void input(){
  cin>>N>>K;
  rep(i,N){
    cin>>A[i];
    S+=A[i];
  }
}

vi sd;
int ans;
void solve(){
  rep1(d,sqrt(S)){
    if(S%d==0){
      sd.pb(d);
      sd.pb(S/d);
    }
  }
  sort(all(sd), greater<int>());

  rep(i,sz(sd)){
    int d=sd[i];
    int tmp=0;
    int df[500];
    int ds=0;
    rep(i,N){
      df[i]=A[i]%d;
      ds+=df[i];
    }
    int ct=ds/d;
    sort(df, df+N, greater<int>());
    tmp=ds;
    rep(i,ct){
      tmp-=df[i];
    }
    if(tmp<=K){
      ans=d;
      break;
    }
  }
}

void output(){
  cout<<ans<<endl;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int a[502];
    int sum = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    vector<int> v;
    for(int i = 1; i * i <= sum; i++){
        if(sum % i == 0){
            v.push_back(i);
            v.push_back(sum / i);
        }
    }
    sort(v.begin(), v.end(), greater<int>());
    for(int x : v){
        int amari[506];
        for(int i = 0; i < n; i++){
            amari[i] = a[i] % x;
        }
        sort(amari, amari + n);
        int ssum = 0;
        for(int i = 0; i < n; i++){
            ssum += amari[i];
        }
        int mid = n - ssum / x;
        int cost = 0;
        for(int i = 0; i < mid; i++){
            cost += amari[i];
        }
        if(cost <= k){
            cout << x << endl;
            break;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |     sort(v.begin(), v.end(), greater<int>());
      |     ^~~~
      |     short
Language: C++

#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize (3)
#define ll long long
ll cmp(ll a,ll b){return a%p<b%p;}
ll n,k,a[502],s,p,need;
signed main()
{
	cin>>n>>k;
	for(ll i=1;i<=n;i++)
		cin>>a[i],s+=a[i];
	for(ll i=1;i<=sqrt(s);i++)
		if(s%i==0){
			p=s/i,need=0;
			sort(a+1,a+n+1,cmp);
			ll tmp[502];
			for(ll j=1;j<=n;j++)
				tmp[j]=a[j];
			ll l=1,r=n;
			while(l<r){
				ll down=tmp[l]%p,up=p-tmp[r]%p;
				ll ss=min(down,up);
				need+=ss,tmp[l]-=ss,tmp[r]+=ss;
				if(tmp[l]%p==0)l++;
				if(tmp[r]%p==0)r--;
			}
			if(need<=k)cout<<p,exit(0);
		}
	return 0;
}

Compiler output:
a.cc: In function 'long long int cmp(long long int, long long int)':
a.cc:5:28: error: 'p' was not declared in this scope
    5 | ll cmp(ll a,ll b){return a%p<b%p;}
      |                            ^
Language: C++

#include <iostream>
using namespace std;

int n,k,s,l,r;
int a[500],b[500],c;

void check(int x){
	for(int i=0;i<n;i++){
		b[i]=a[i]%x;
	}
	sort(b,b+n);
	l=0,r=n-1;
	c=0;
	while(r>l){
		if(b[l]+b[r]==x){
			c+=b[l];
			l++,r--;
		}
		else if(b[l]+b[r]>x){
			c+=x-b[r];
			b[l]-=x-b[r];
			r--;
		}
		else{
			c+=b[l];
			b[r]+=b[l];
			l++;
		}
	}
	return;
}

int main(){
	cin>>n>>k;
	s=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		s+=a[i];
	}
	int res=0;
	for(int i=1;i*i<=s;i++){
		if(s%i==0){
			check(i);
			if(c<=k) res=max(res,i);
			check(s/i);
			if(c<=k) res=max(res,s/i);
		}
	}
	cout<<res<<"\n";
	return 0;
}

Compiler output:
a.cc: In function 'void check(int)':
a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |         sort(b,b+n);
      |         ^~~~
      |         short
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define int ll
const ll mod=998244353;
const ll inf=17441744174417;
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll res=pow(x,y/2);
  res*=res;
  res%=mod;
  if(y%2==1) res*=x;
  return res%mod;
}
ll gyaku(ll x){
  return pow(x,mod-2);
}
vector<ll> frac,gfrac;
void set_frac(ll n){
  frac.push_back(1);
  gfrac.push_back(1);
  for(ll i=1;i<=n;i++){
    frac.push_back(frac[i-1]*i%mod);
    gfrac.push_back(gyaku(frac[i]));
  }
}
ll nCr(ll n,ll r){
  ll res=frac[n]*gfrac[r]%mod;
  res*=gfrac[n-r];
  return res%mod;
}
struct BIT{
private:
  vector<ll> node;
  ll siz;
public:
  BIT(ll n){
    siz=n;
    node.resize(n+1,0);
  }
  void add(ll pos,ll x){
    while(pos<=siz){
      node[pos]+=x;
      pos+=pos&(-pos);
    }
  }
  ll sum(ll pos){
    ll res=0;
    while(pos>0){
      res+=node[pos];
      pos-=pos&(-pos);
    }
    return res;
  }
};
ll xs[200005]={0},ys[200005]={0};
ll ym_L[200005]={0},ym_R[200005]={0};
int main(){
  ll n;
  cin>>n;
  set_frac(n+5);
  vector<ll> xcomp,ycomp;
  vector<P> vec;
  xcomp.push_back(-inf);
  ycomp.push_back(-inf);
  for(int i=0;i<n;i++){
    ll x,y;
    cin>>x>>y;
    vec.push_back(P(x,y));
    xcomp.push_back(x);
    ycomp.push_back(y);
  }
  xcomp.push_back(inf);
  ycomp.push_back(inf);
  sort(vec.begin(),vec.end());
  sort(xcomp.begin(),xcomp.end());
  sort(ycomp.begin(),ycomp.end());
  for(int i=0;i<n;i++){
    ll xpos=lower_bound(xcomp.begin(),xcomp.end(),vec[i].first)-xcomp.begin();
    xs[i]=xpos;

    ll ypos=lower_bound(ycomp.begin(),ycomp.end(),vec[i].second)-ycomp.begin();
    ys[i]=ypos;
  }
  BIT bl(n+5);
  for(int i=0;i<n;i++){
    ym_L[i]=bl.sum(ys[i]);
    bl.add(ys[i],1);
  }
  BIT br(n+5);
  for(int i=n-1;i>=0;i--){
    ym_R[i]=br.sum(ys[i]);
    br.add(ys[i],1);
  }
  vector<ll> pow2;
  pow2.push_back(1);
  for(int i=1;i<=n;i++){
    pow2.push_back(pow2[i-1]*2%mod);
  }
  ll ans=0;
  for(int i=0;i<n;i++){
    ll kans=pow2[n]-1;
    ll mns=0;

    mns+=pow2[i]-1;
    mns+=pow2[n-1-i]-1;
    mns+=pow2[ys[i]-1]-1;
    mns+=pow2[n-ys[i]]-1;
    mns+=mod;
    mns%=mod;

    kans+=pow2[ym_L[i]]-1;
    kans+=pow2[i-ym_L[i]]-1;
    kans+=pow2[ym_R[i]]-1;
    kans+=pow2[n-i-1-ym_R[i]]-1;

    kans+=mod;
    kans-=mns;
    kans%=mod;
    ans+=kans;
    ans%=mod;

  /*  cout<<pow2[i]<<" "<<pow2[n-1-i]<<" "<<pow2[ys[i]-1]<<" "<<pow2[n-ys[i]]<<" ";
    cout<<pow2[ym_L[i]]<<" "<<pow2[i-ym_L[i]]<<" "<<pow2[ym_R[i]]<<" "<<pow2[n-i-1-ym_R[i]]<<" ";
    cout<<mns<<endl; */
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc:5:13: error: '::main' must return 'int'
    5 | #define int ll
      |             ^~
a.cc:59:1: note: in expansion of macro 'int'
   59 | int main(){
      | ^~~
Language: C++

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

#define mod 998244353

// 区間の和を計算するBIT, 1-indexed
template<typename T>
struct BIT{
    using F = function<T(T, T)>;
    using INV = function<T(T)>;
    BIT(int N, T unit, F f, INV inv) : value(N+1, unit), unit(unit), f(f), inv(inv) {}

    T sum(int i, int j) {
        if(i > j) return unit;
        if(i == 0) return sum(j);
        return f(sum(j), inv(sum(i-1)));
    }

    void add (int k, T x) {
        for (; k < value.size(); k += k & -k) value[k] = f(value[k], x);
    }

private:
    vector<T>value;
    const F f;
    const T unit;
    const INV inv;
    T sum(int k) {
        T res = unit;
        for (; k > 0; k -= k & -k) res = f(res, value[k]);
        return res;
    }
};

int main() {
    int N;
    cin >> N;
    vector<int>x(N);
    vector<int>y(N);
    vector<pair<int, int>> elements(N);
    for (int i = 0; i < N; ++i) {
        cin >> x[i] >> y[i];
    }

    // y座標を 1-indexed で圧縮後, x座標でソート
    vector<int> copyY(y);
    sort(copyY.begin(), copyY.end());
    map<int, int> mp;
    for (int i = 0; i < N; ++i) {
        mp[copyY[i]] = i + 1;
    }
    for (int i = 0; i < N; ++i) {
        y[i] = mp[y[i]];
        elements[i] = make_pair(x[i], y[i]);
    }
    sort(elements.begin(), elements.end());

    // 2の累乗計算
    ll modPow[N+1];
    modPow[0] = 1;
    for (int i = 1; i < N+1; ++i) {
        modPow[i] = modPow[i-1] * 2 % mod;
    }

    ll ans = modPow[N] + mod - 1;
    ans %= mod;
    ans = ans * N % mod;

    BIT<int> tree(N, 0, plus<int>(), [](int a){ return -a;});
    sort(y.begin(), y.end());

    for (int i = 0; i < N; ++i) {
        // 左にi個, 右にN-i-1個の点
        int yi = elements[i].second;
        // vector y には自分自身も含まれていることに注意
        auto iter1 = lower_bound(y.begin(), y.end(), yi);
        int low = distance(y.begin(), iter1);
        // 下にlow個, 上にN-low-1個の点

        int lowOver = tree.sum(yi);
        tree.add(yi, 1);

        // 左下にlowOver個, 左上にi-lowOver個の点
        ans = ans + mod + mod + mod + mod;
        ans = ans - modPow[low] - modPow[N-low-1] - modPow[i] - modPow[N-i-1] + 4;
        ans = ans + modPow[lowOver] + modPow[i-lowOver] + modPow[low - lowOver] + modPow[N-low-1-i+lowOver] - 4;
        ans %= mod;
    }
    cout << ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:81:31: error: 'T BIT<T>::sum(int) [with T = int]' is private within this context
   81 |         int lowOver = tree.sum(yi);
      |                       ~~~~~~~~^~~~
a.cc:29:7: note: declared private here
   29 |     T sum(int k) {
      |       ^~~
Language: C++

/*In the name of Allah*/
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
#define MAX 200011
#define inf 2000000111
#define mod 998244353
#define ll long long

int bit[2][MAX + 10];

struct P
{
	ll x,y;
}a[MAX];

ll up[2][MAX],down[2][MAX];

void upd(ll i,bool b){
	if(b == 1) i = MAX - i;
	for(; i <= MAX; i += (i&(-i))){
		bit[b][i]++;
	}
}

ll get(ll i,bool b){
	ll ans = 0;
	if(b == 1) i = MAX - i;
	for(; i > 0 ; i -= (i&(-i))){
		ans += bit[b][i];
	}
	return ans;
}

ll qpow (ll x,ll y){
	if(y < 0)return 0;
	if(y == 0)return 1;
	ll temp = qpow(x,y/2);
	temp = (temp * temp)%mod;
	if(y&1)
		return (temp * x)%mod;
	return temp;
}

bool cmpx(P x, P y){return x.x < y.x;}
bool cmpy(P x, P y){return x.y < y.y;}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	for(int i = 0; i < n ; i++)cin>>a[i].x>>a[i].y;


	sort(a,a+n,cmpy);
	a[0].y = 1;
	for(int i = 1; i < n ; i++)a[i].y = a[i - 1].y +  1;

	sort(a,a+n,cmpx);
	a[0].x = 1;
	for(int i = 1 ;i < n ; i++)a[i].x = a[i - 1].x  + 1;	


	ll ans = 0;
	for(int i = 0; i < n ; i++){
		up[0][i] = get(a[i].y ,1);
		down[0][i] = get(a[i].y ,0);
		upd(a[i].y ,1);
		upd(a[i].y ,0);
	}
	memset(bit,0,sizeof bit);

	for(int i = n -1 ; i >= 0; i -- ){
		up[1][i] = get(a[i].y ,1);
		down[1][i] = get(a[i].y ,0);
		upd(a[i].y, 1);
		upd(a[i].y, 0);
	}

	for(int i = 0; i < n ; i++){
		// cout<<down[0][i]<<" "<<up[0][i]<<" "<<down[1][i]<<" "<<up[1][i]<<endl;
		ll temp = 0;
		temp += qpow(2,down[0][i]+up[0][i]);
		temp += qpow(2,down[0][i]+down[1][i]);
		temp += qpow(2,up[0][i]+up[1][i]);
		temp += qpow(2,down[1][i]+up[1][i]);
		temp -= qpow(2,down[0][i]);
		temp -= qpow(2,down[1][i]);
		temp -= qpow(2,up[0][i]);
		temp -= qpow(2,up[1][i]);

		temp = (temp + 4LL *  mod) %mod;		
		ans += (qpow(2,n) - temp + mod)%mod;

	}
	cout<<(ans - n + mod)%mod<<" ";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:9: error: 'memset' was not declared in this scope
   72 |         memset(bit,0,sizeof bit);
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <map>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include <array>
#include <cstdio>
#include <utility>
#include <algorithm>

using namespace std;

constexpr unsigned long maxN = 200010;

array<unsigned long, maxN> perm;
    array<unsigned long, maxN> binary;
    array<unsigned long, maxN> coef;
    array<unsigned long, maxN> fenwick_tree;

    unsigned long que(unsigned long i){
        unsigned long s{0}, j{i};
        while (i) { s += fenwick_tree[i]; i -= i & -i; }
        while (j < maxN) { ++fenwick_tree[j]; j += j & -j; }
        return s;
    };


int main() {
    //using namespace std;
   
    unsigned long N;
    scanf("%lu", &N);
   
    {
        array<pair<long, long>, maxN> p;
        for(unsigned long i = 0; i < N; ++i)scanf("%lu%lu", &p[i].first, &p[i].second);
        sort(p.begin(), p.begin() + N);
        for(unsigned long i = 0; i < N; ++i)p[i] = {p[i].second, i + 1};
        sort(p.begin(), p.begin() + N);
        transform(p.cbegin(), p.cbegin() + N, perm.begin(), [](auto i){return i.second;});
    }

    constexpr unsigned long MOD = 998244353;

    unsigned long n = binary[0] = 1;
    generate(binary.begin() + 1, binary.end(), [&n](){if(n >= MOD)n -= MOD;return n <<= 1;});




    coef[N] = N + MOD - 4;
    for(unsigned long i = 0; i != N; ++i){
        auto p = perm[i], q = que(p);
        ++coef[q];
        ++coef[i - q];
        ++coef[p - q - 1];
        ++coef[N - i - p + q];
    }

    printf("%lu", inner_product(binary.begin(), binary.begin() + N + 1, coef.begin(), 4 + MOD - N) % MOD);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:19: error: 'inner_product' was not declared in this scope
   55 |     printf("%lu", inner_product(binary.begin(), binary.begin() + N + 1, coef.begin(), 4 + MOD - N) % MOD);
      |                   ^~~~~~~~~~~~~
Language: C++

#include <array>
#include <cstdio>
#include <utility>
#include <algorithm>

using namespace std;

constexpr unsigned long maxN = 200010;

array<unsigned long, maxN> perm;
    array<unsigned long, maxN> binary;
    array<unsigned long, maxN> coef;
    array<unsigned long, maxN> fenwick_tree;

    unsigned long que(unsigned long i){
        unsigned long s{0}, j{i};
        while (i) { s += fenwick_tree[i]; i -= i & -i; }
        while (j < maxN) { ++fenwick_tree[j]; j += j & -j; }
        return s;
    };


int main() {
    //using namespace std;
   
    unsigned long N;
    scanf("%lu", &N);
   
    {
        array<pair<long, long>, maxN> p;
        for(unsigned long i = 0; i < N; ++i)scanf("%lu%lu", &p[i].first, &p[i].second);
        sort(p.begin(), p.begin() + N);
        for(unsigned long i = 0; i < N; ++i)p[i] = {p[i].second, i + 1};
        sort(p.begin(), p.begin() + N);
        transform(p.cbegin(), p.cbegin() + N, perm.begin(), [](auto i){return i.second;});
    }

    constexpr unsigned long MOD = 998244353;

    unsigned long n = binary[0] = 1;
    generate(binary.begin() + 1, binary.end(), [&n](){if(n >= MOD)n -= MOD;return n <<= 1;});




    coef[N] = N + MOD - 4;
    for(unsigned long i = 0; i != N; ++i){
        auto p = perm[i], q = que(p);
        ++coef[q];
        ++coef[i - q];
        ++coef[p - q - 1];
        ++coef[N - i - p + q];
    }

    cout << inner_product(binary.begin(), binary.begin() + N + 1, coef.begin(), 4 + MOD - N) % MOD << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:5: error: 'cout' was not declared in this scope
   55 |     cout << inner_product(binary.begin(), binary.begin() + N + 1, coef.begin(), 4 + MOD - N) % MOD << endl;
      |     ^~~~
a.cc:5:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <algorithm>
  +++ |+#include <iostream>
    5 | 
a.cc:55:13: error: 'inner_product' was not declared in this scope
   55 |     cout << inner_product(binary.begin(), binary.begin() + N + 1, coef.begin(), 4 + MOD - N) % MOD << endl;
      |             ^~~~~~~~~~~~~
a.cc:55:103: error: 'endl' was not declared in this scope
   55 |     cout << inner_product(binary.begin(), binary.begin() + N + 1, coef.begin(), 4 + MOD - N) % MOD << endl;
      |                                                                                                       ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include <algorithm>
  +++ |+#include <ostream>
    5 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5,M=998244353;
int n,b[N],g[N],c[N],ans;
struct BIT{
	int tr[N];
	BiT(){memset(tr,0,sizeof(tr));}
	void Ad(int i,int x){
		for(;i<=n;i+=i&-i)tr[i]+=x;
	}
	int Qr(int i){
		int rs=0;
		for(;i;i-=i&-i)rs+=tr[i];
		return rs;
	}
}T1,T2;
void ck(int &x){if(x>=M)x-=M;}
struct P{
	int x,y;
	bool operator < (const P&t)const{
		return x<t.x;
	}
}a[N];
int so(int ul,int ur,int dl,int dr){
	int rs=g[n-1];
	rs+=((1ll*(g[ul]-1)*(g[dr]-1)%M)*(g[ur]+g[dl]))%M;ck(rs);
	rs+=((1ll*(g[ur]-1)*(g[dl]-1)%M)*(g[ul]+g[dr]))%M;ck(rs);
	return rs;
}
int main(){
	scanf("%d",&n);g[0]=1;ans--;
	for(int i=1;i<=n;++i){
		scanf("%d %d",&a[i].x,&a[i].y);
		b[i]=a[i].y;
		c[i]=a[i].x;
		g[i]=g[i-1]<<1;
		ck(g[i]);
	}
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for(int i=1;i<=n;++i){
		a[i].y=lower_bound(b+1,b+n+1,a[i].y)-b;
		a[i].x=lower_bound(c+1,c+n+1,a[i].x)-c;
		T2.Ad(a[i].y,1);
	}
	for(int i=1;i<=n;++i){
		T2.Ad(a[i].y,-1);T1.Ad(a[i].y,1);
		int dl=T1.Qr(a[i].y-1),dr=T2.Qr(a[i].y-1);
		int ul=i-dl-1,ur=n-i-dr;
		ans+=so(ul,ur,dl,dr);
		ck(ans); 	
	}
	printf("%d",ans);
}

Compiler output:
a.cc:7:9: error: ISO C++ forbids declaration of 'BiT' with no type [-fpermissive]
    7 |         BiT(){memset(tr,0,sizeof(tr));}
      |         ^~~
a.cc: In member function 'int BIT::BiT()':
a.cc:7:39: warning: no return statement in function returning non-void [-Wreturn-type]
    7 |         BiT(){memset(tr,0,sizeof(tr));}
      |                                       ^
Language: C++

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

using ll = long long;
const ll MOD = 998244353;

const int MAXN = 2.1e5;
int N;
pair<int, int> P[MAXN];
int p2[MAXN];

int bit[MAXN];
void update(int a) {
  for (a++; a <= N; a += (a & (-a)) {
    bit[a] ++;
  }
}
int query(int a) {
  int r = 0;
  for (a++; a > 0; a -= (a & (-a))) {
    r += bit[a];
  }
  return r;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int N; cin >> N;
  for (int i = 0; i < N; i++) cin >> P[i].first >> P[i].second;
  p2[0] = 0;
  for (int i = 1; i <= N; i++) p2[i] = (p2[i-1]*2+1)%MOD;
  
  vector<int> xs, ys;
  for (int i = 0; i < N; i++) xs.push_back(P[i].first), ys.push_back(P[i].second);
  sort(xs.begin(), xs.end());
  //xs.resize(unique(xs.begin(), xs.end()) - xs.begin());
  sort(ys.begin(), ys.end());
  //ys.resize(unique(ys.begin(), ys.end()) - ys.begin());
  for (int i = 0; i < N; i++) {
    P[i].first = int(lower_bound(xs.begin(), xs.end(), P[i].first) - xs.begin());
    P[i].second = int(lower_bound(ys.begin(), ys.end(), P[i].second) - ys.begin());
  }
  sort(P, P + N);
  
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    int quad = query(P[i].second);
    update(P[i].second);
    ans += p2[N] - p2[P[i].first] - p2[N-1-P[i].first] - p2[P[i].second] - p2[N-1-P[i].second] + p2[quad] + p2[P[i].first - quad] + p2[P[i].second - quad] + p2[N-1-quad-(P[i].first-quad)-(P[i].second-quad)];
  }
  ans %= MOD;
  if (ans < 0) ans += MOD;
  cout << ans << '\n';
}

Compiler output:
a.cc: In function 'void update(int)':
a.cc:14:36: error: expected ')' before '{' token
   14 |   for (a++; a <= N; a += (a & (-a)) {
      |       ~                            ^~
      |                                    )
Language: C++

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

const int maxn = 2e5 + 5;
const long long p = 998244353;
int n;
typedef pair<int,int> pii;
pii arr[maxn];
int tmp[maxn];
int val[maxn];
long long ans = 0;
long long fast_pow(int a, int b){
	if(b == 0) return 1;
	long long ans = 1;
	for(;b;b>>=1){
		if(b&1) ans = ans * a % p;
		a = (long long)a * a % p;
	}
	return ans;
}
struct segment{
	int l, r;
	int val;
}
segment arr1[maxn], arr2[maxn];
void build(segment *a, int l, int r, int pos){
	a[pos].l = l, a[pos].r = r;
	a[pos].val = 0;
	if(l != r){
		int mid = (l + r) >> 1;
		build(a,l,mid,2*pos), build(a,mid+1,r,2*pos+1);
	}
}
int ask(segment *a, int l, int r, int pos){
	int lseg = a[pos].l, rseg = a[pos].r;
	if(lseg > r || rseg < l) return 0;
	if(lseg <= l && rseg >= r) return a[pos].val;
	return ask(a,l,r,2*pos) + ask(a,l,r,2*pos+1);
}

void add(segment *a, int p, int pos){
	int lseg = a[pos].l, rseg = a[pos].r;
	a[pos].val ++;
	if(lseg == rseg) return;
	int mid = (lseg + rseg) >> 2;
	if(p <= mid) add(a,p,2*pos);
	else add(a,p,2*pos+1);
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		arr[i] = mp(x,y);
	}
	sort(arr+1,arr+n+1);
	for(int i=1;i<=n;i++){
		tmp[i] = arr[i].second;
	}
	sort(tmp+1,tmp+n+1);
	for(int i=1;i<=n;i++){
		int t = lower_bound(tmp+1,tmp+n+1,arr[i].second) - tmp;
		val[i] = t;
	}
	for(int i=1;i<=n;i++){
		printf("%d ",val[i]);
	}
	build(arr1,1,n,1), build(arr2,1,n,1);
	for(int i=1;i<=n;i++){
		ans = (ans - fast_pow(2,ask(arr1,val[i]+1,n,1)) + 1) % p;
		ans = (ans - fast_pow(2,ask(arr1,1,val[i]-1,1)) + 1) % p;
		add(arr1,val[i],1);
	}
	for(int i=n;i>0;i--){
		ans = (ans - fast_pow(2,ask(arr2,val[i]+1,n,1)) + 1) % p;
		ans = (ans - fast_pow(2,ask(arr2,1,val[i]-1,1)) + 1) % p;
		add(arr2,val[i],1);
	}
	ans = (ans + n * fast_pow(2,n) % p;
	ans = (ans + p) % p;
	printf("%lld",ans);
	return 0;
}

Compiler output:
a.cc:26:9: error: expected initializer before 'arr1'
   26 | segment arr1[maxn], arr2[maxn];
      |         ^~~~
a.cc: In function 'int main()':
a.cc:70:15: error: 'arr1' was not declared in this scope; did you mean 'arr'?
   70 |         build(arr1,1,n,1), build(arr2,1,n,1);
      |               ^~~~
      |               arr
a.cc:70:34: error: 'arr2' was not declared in this scope; did you mean 'arr'?
   70 |         build(arr1,1,n,1), build(arr2,1,n,1);
      |                                  ^~~~
      |                                  arr
a.cc:81:43: error: expected ')' before ';' token
   81 |         ans = (ans + n * fast_pow(2,n) % p;
      |               ~                           ^
      |                                           )
Language: C++

//う　し　た　ぷ　に　き　あ　く　ん　笑

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using vi = std::vector<int>;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 998244353;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int n; cin >> n;
    vector<ll> x(n),y(n);
    rep(i,n) cin >> x[i] >> y[i];

    set<int> xs,ys;
    rep(i,n) xs.insert(x[i]);
    rep(i,n) ys.insert(y[i]);

    vector<int> x2,y2;
    for(auto xx : xs) x2.push_back(xx);
    for(auto yy : ys) y2.push_back(yy);

    int nx = x2.size();
    int ny = y2.size();

    ll ans = 0;
    rep(i,N){
        ll xx = lower_bound(all(x2),x[i]) - x2.begin();
        ll yy = lower_bound(all(y2),y[i]) - y2.begin();

        ll left = xx;
        ll right = nx - xx - 1;
        ll up = yy;
        ll down = ny - yy - 1;

        ll t1 = left * right % mod;
        ll t2 = up * down % mod;
        ll t = t1 * t2 % mod;
        ans += t;
        ans %= mod;
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:11: error: 'N' was not declared in this scope
   55 |     rep(i,N){
      |           ^
a.cc:4:38: note: in definition of macro 'rep'
    4 | #define rep(i,n) for(int i=0;i<(int)(n);i++)
      |                                      ^
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> x(N);
  vector<int> y(N);
  int sum = 0;
  
  for (int i = 0; i < N; i++)
    cin >> x.at(i) >> y.at(i) ;
  
  for (int i = 0; i < N-1; i++) {
    
    for (int j = i+1; j < N; j++){
      
      int Mx = x.at(i);
      int My = y.at(i);
      int mx = x.at(i);
      int my = y.at(i);
        
      for (int k = i; k < j+1; k++){
        
        if (Mx < x.at(k))
          Mx = x.at(k);
        else if (My < y.at(k))
          My = y.at(k);
        else if (mx > x.at(k))
          mx = x.at(k);
        else if (my > y.at(k))
          my = y.at(k);
      }
      
      for (int l = 0; l < N; l++) {
        
        if (mx-1 < x.at(l) < Mx+1 && my-1 < y.at(l) < My+1)
          sum++;
      }
    }
  }
  sum += N
  cout << sum % 998244353 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:11: error: expected ';' before 'cout'
   42 |   sum += N
      |           ^
      |           ;
   43 |   cout << sum % 998244353 << endl;
      |   ~~~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> x(N);
  vector<int> y(N);
  int sum = 0;
  
  for (int i = 0; i < N; i++)
    cin >> x.at(i) >> y.at(i) ;
  
  for (int i = 0; i < N-1; i++) {
    
    for (int j = i+1; j < N; j++){
      
      int Mx = x.at(i);
      int My = y.at(i);
      int mx = x.at(i);
      int my = y.at(i);
        
      for (int k = i; k < j+1; k++){
        
        if (Mx < x.at(k))
          Mx = x.at(k);
        else if (My < y.at(k))
          My = y.at(k);
        else if (mx > x.at(k))
          mx = x.at(k);
        else if (my > y.at(k))
          my = y.at(k);
      }
      
      for (int l = 0; l < N; l++) {
        
        if (mx-1 < x.at(l) < Mx+1 && my-1 < y.at(l) < My+1)
          sum++
      }
    }
  }
  sum += N
  cout << sum % 998244353 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:16: error: expected ';' before '}' token
   38 |           sum++
      |                ^
      |                ;
   39 |       }
      |       ~         
a.cc:42:11: error: expected ';' before 'cout'
   42 |   sum += N
      |           ^
      |           ;
   43 |   cout << sum % 998244353 << endl;
      |   ~~~~
Language: C++

#include <bits/stdc++.h>

int main() {
  int a, b; std::cin >> a >> b;
  
  if (d%2 == 0) std::cout << d/2 + (a > b ? b : a) << std::endl;
  else std::cout << "IMPOSSIBLE" << std::endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: 'd' was not declared in this scope
    6 |   if (d%2 == 0) std::cout << d/2 + (a > b ? b : a) << std::endl;
      |       ^
Language: C++

#include<iostream>
using namspace std;
int main(){
int a,b;
cin >> a>>b;
int sum=a+b;
if(sum%2==0)
cout <<sum/2<<endl;
else 
cout<<"IMPOSSIBLE"<<endl;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namspace'
    2 | using namspace std;
      |       ^~~~~~~~
a.cc: In function 'int main()':
a.cc:5:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 | cin >> a>>b;
      | ^~~
      | 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:8:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 | cout <<sum/2<<endl;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:8:15: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    8 | cout <<sum/2<<endl;
      |               ^~~~
      |               std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:10:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 | cout<<"IMPOSSIBLE"<<endl;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:10:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   10 | cout<<"IMPOSSIBLE"<<endl;
      |                     ^~~~
      |                     std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

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


int main()
{
	int a,b;
	cin >> a >> b;
	if((b-a) % 2 == 0)
	 cout << a+(b-a)/2
	else
	 cout  << "IMPOSSIBLE";
	
}	


Compiler output:
a.cc: In function 'int main()':
a.cc:11:27: error: expected ';' before 'else'
   11 |          cout << a+(b-a)/2
      |                           ^
      |                           ;
   12 |         else
      |         ~~~~
Language: C++

#include <stdio.h>
int main(void)
{
  int A,B,K;
  scanf ("%d %d"&A,&B);
  if ((A-B)%2==0||(B-A)%2==0)) printf ("%d",(A+B)/2);
  else printf ("IMOSSIBLE");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: invalid operands of types 'const char [6]' and 'int' to binary 'operator&'
    5 |   scanf ("%d %d"&A,&B);
      |          ~~~~~~~^~
      |          |       |
      |          |       int
      |          const char [6]
a.cc:6:30: error: expected primary-expression before ')' token
    6 |   if ((A-B)%2==0||(B-A)%2==0)) printf ("%d",(A+B)/2);
      |                              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long A,B,K=0; cin >> A >> B;
  if(A%2 != B%2) {
  cout << "IMPOSSIBLE" << endl;
  }
  else {
    cout << (A+B)/2 << endl;
}

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

#include <iostream>
using namespace std;
int main(){
  long long a,b;
  cin>>a>>b;
  
  if((a%2!=0)&&(b%2!=0))
    cout<<"IMPOSSIBLE":
  
  else
    cout<<(a+b)/2;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:23: error: expected ';' before ':' token
    8 |     cout<<"IMPOSSIBLE":
      |                       ^
      |                       ;
Language: C

#incude <stdio.h>

int main()
{
  int a, b;
  
  scanf("%d %d",&a,&b);
  
  if((a+b)%2==0)
    printf("%d\n",a+b);
  else
    printf("IMPOSSIBLE\n");
  
  return 0;
}

Compiler output:
main.c:1:2: error: invalid preprocessing directive #incude; did you mean #include?
    1 | #incude <stdio.h>
      |  ^~~~~~
      |  include
main.c: In function 'main':
main.c:7:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    7 |   scanf("%d %d",&a,&b);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #incude <stdio.h>
main.c:7:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    7 |   scanf("%d %d",&a,&b);
      |   ^~~~~
main.c:7:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:10:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   10 |     printf("%d\n",a+b);
      |     ^~~~~~
main.c:10:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:10:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:10:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:12:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   12 |     printf("IMPOSSIBLE\n");
      |     ^~~~~~
main.c:12:5: note: include '<stdio.h>' or provide a declaration of 'printf'