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

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<vector>
#include<string>
#define int long long
using namespace std;

signed main() {
	int n, q; cin >> n >> q;
	for (int i = 0; i < q; i++) {
		int a, b; cin >> a >> b;
		if (n == 1) { cout << a << endl; continue; }
		vector<int>x, y;
		while (a!=0) {
			int sum = 0;
			for (int i = 0;; i++) {
				if (sum + pow(n, i) >= a) {
					x.push_back(a - sum- 1);
					int k = a - sum - 1;
					a = sum - pow(n, i - 1) + k / n + 1;
					break;
				}
				sum += pow(n, i);
			}
		}
		
		reverse(x.begin(), x.end());
		reverse(y.begin(), y.end());
		x.push_back(LLONG_MAX);
		y.push_back(LLONG_MAX - 1);
		int sum = 0;
		for (int i = 0; i < min(x.size(), y.size()); i++) {
			if (x[i] != y[i]) {
				sum -= pow(n, i - 1);
				cout << sum + x[i - 1] + 1 << endl;
				goto l;
			}
			sum += pow(n, i);
		}
	l:;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:43: error: 'pow' was not declared in this scope
   21 |                                 if (sum + pow(n, i) >= a) {
      |                                           ^~~
a.cc:27:40: error: 'pow' was not declared in this scope
   27 |                                 sum += pow(n, i);
      |                                        ^~~
a.cc:38:40: error: 'pow' was not declared in this scope
   38 |                                 sum -= pow(n, i - 1);
      |                                        ^~~
a.cc:42:32: error: 'pow' was not declared in this scope
   42 |                         sum += pow(n, i);
      |                                ^~~
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<vector>
#include<string>
#define int long long
using namespace std;

signed main() {
	int n, q; cin >> n >> q;
	for (int i = 0; i < q; i++) {
		int a, b; cin >> a >> b;
		if (n == 1) { cout << a << endl; continue; }
		vector<int>x, y;
		while (a!=0) {
			int sum = 0;
			for (int i = 0;; i++) {
				if (sum + pow(n, i) >= a) {
					x.push_back(a - sum- 1);
					int k = a - sum - 1;
					a = sum - pow(n, i - 1) + k / n + 1;
					break;
				}
				sum += pow(n, i);
			}
		}
		while (b != 0) {
			int sum = 0;
			for (int i = 0;; i++) {
				if (sum + pow(n, i) >= b) {
					y.push_back(b - sum - 1);
					int k = b - sum - 1;
					b = sum - pow(n, i - 1) + k / n + 1;
					break;
				}
				sum += pow(n, i);
			}
		}
		reverse(x.begin(), x.end());
		reverse(y.begin(), y.end());
		x.push_back(LLONG_MAX);
		y.push_back(LLONG_MAX - 1);
		int sum = 0;
		for (int i = 0; i < min(x.size(), y.size()); i++) {
			if (x[i] != y[i]) {
				sum -= pow(n, i - 1);
				cout << sum + x[i - 1]+1 << endl;
				goto l;
			}
			sum += pow(n, i);
		}
		
	l:;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:43: error: 'pow' was not declared in this scope
   21 |                                 if (sum + pow(n, i) >= a) {
      |                                           ^~~
a.cc:27:40: error: 'pow' was not declared in this scope
   27 |                                 sum += pow(n, i);
      |                                        ^~~
a.cc:33:43: error: 'pow' was not declared in this scope
   33 |                                 if (sum + pow(n, i) >= b) {
      |                                           ^~~
a.cc:39:40: error: 'pow' was not declared in this scope
   39 |                                 sum += pow(n, i);
      |                                        ^~~
a.cc:49:40: error: 'pow' was not declared in this scope
   49 |                                 sum -= pow(n, i - 1);
      |                                        ^~~
a.cc:53:32: error: 'pow' was not declared in this scope
   53 |                         sum += pow(n, i);
      |                                ^~~
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<vector>
#include<string>
using namespace std;

signed main() {
	int n, q; cin >> n >> q;
	for (int i = 0; i < q; i++) {
		int a, b; cin >> a >> b;
		while (a != b) {
			if (a > b)swap(a, b);
			double c = (double)b / n; c += 0.5;
			b = floor(c);
		}
		cout << a << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:29: error: 'floor' was not declared in this scope
   18 |                         b = floor(c);
      |                             ^~~~~
Language: C++

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

int main() {
    long long n, k; cin >> n >> k;
    vector<int> w(n), d(n);
    for (int i=0; i<n; ++i) {
        cin >> w[i] >> d[i];
    }
    // f(x) = \sum_i (k-w_i) / d_i + 1
    long long l = 0, r = 1e12;
    while (r - l > 1) {
        long long mid = (l + r) / 2;
        long long cnt = 0;
        for (int i=0; i<n; ++i) {
            if (w[i] <= mid) cnt += 1+(mid-w[i])/d[i];
            if (cnt < k) l = mid;
            else r = mid;
        }
    }
    cout << mid << endl;
    return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
int n,k,a[111111],b[111111];
int ok=0,ng=1000000000000000000;
bool solve(int x){
	int cnt=0;
	rep(i,n){
		
	}
	cnt++;
	return cnt<=x;
}
int main(){
	cin>>n>>k;
	rep(i,n)cin>>a[i]>>b[i];
	while(ng-ok>1){
		int mid=(ok+ng)/2;
		if(solve(mid))ok=mid;
		else ng=mid;
	}
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <limits.h>

using namespace std;

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/12/04  Problem: codefestival2017_team_relay C / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----

同時ににぶたん？

----解説ここまで---- */

LL N,K;

LL ans = 0LL;

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

	cin >> N >> K;
	VL w(N,0),d(N,0);
	FOR(i,0,N){
		cin>> w[i]>> d[i];
	}
	LL L = 0;LL R = LLONG_MAX;//  座標
	FOR(kim,0,70){
		LL ret = 0;
		
		LL mid = (L+R)/2LL;
		FOR(i,0,N){
			LL p = (mid-w[i])/d[i];
			if(p>0)ret += p;
			if(mid>=w[i])ret++;
			if(ret>K)break;
		}
		if(ret>=K){R = mid;}
		else L = mid;
	}
	
	ans=R;
	cout << ans << "\n";

	return 0;
}


Compiler output:
a.cc:26:65: error: 'acos' was not declared in this scope
   26 | const LL MOD = 1000000007;                    const double PI = acos(-1.0);
      |                                                                 ^~~~
Language: C++

#include <bits/stdc++.h>
 
#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl
 
using namespace std;
using ll = long long;
 
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}
 
template <typename T>
istream& operator>>(istream& is, vector<T>& v)
{
    for (auto& e : v) {
        is >> e;
    }
    return is;
}
 
template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}
 
 
constexpr ll MOD = (ll)1e9 + 7LL;
 
template <typename T>
constexpr T INF = 1LL << 62;
 
 
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    ll K;
    cin >> N >> K;
    vector<ll> w(N);
    vector<ll> d(N);
    for (int i = 0; i < N; i++) {
        cin >> w[i] >> d[i];
    }
 
    ll inf = 0;
    ll sup = INF<ll>;
    auto check = [=](const ll mid) {
        unsinged long long n = 0;
        for (int i = 0; i < N; i++) {
            n += (mid < w[i]) ? 0LL : (ll)((mid - w[i]) / d[i] + 1);
        }
        return n >= K;
    };
    while (inf < sup - 1) {
        const ll mid = (inf + sup) / 2;
        if (check(mid)) {
            sup = mid;
        } else {
            inf = mid;
        }
    }
    if (check(sup - 1)) {
        cout << sup - 1 << endl;
    } else {
        cout << sup << endl;
    }
    return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:60:9: error: 'unsinged' was not declared in this scope; did you mean 'unsigned'?
   60 |         unsinged long long n = 0;
      |         ^~~~~~~~
      |         unsigned
a.cc:62:13: error: 'n' was not declared in this scope
   62 |             n += (mid < w[i]) ? 0LL : (ll)((mid - w[i]) / d[i] + 1);
      |             ^
a.cc:64:16: error: 'n' was not declared in this scope
   64 |         return n >= K;
      |                ^
Language: C++

#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>

struct UnionFind {
  size_t size_;
  std::vector<int> tree;
  UnionFind(size_t n): size_(n), tree(n, -1) {}
  bool unite(size_t u, size_t v) {
    u = find_root(u);
    v = find_root(v);
    if (u == v) return false;
    if (-tree[u] < -tree[v]) std::swap(u, v);

    tree[u] += tree[v];
    tree[v] = u;
    return true;
  }
  size_t find_root(size_t u) {
    if (tree[u] < 0) return u;
    return (u = find_root(tree[u]));
  }
  bool connected(size_t u, size_t v) {
    return find_root(u) == find_root(v);
  }
  int rank(size_t u) {
    return -tree[find_root(u)];
  }
};

int main() {
  int N, M;
  scanf("%d %d", &N, &M);

  UnionFind uf1(N);

  std::vector<std::pair<int, int>> ab(M);
  for (int i=0; i<M; ++i) {
    scanf("%d %d", &ab[i].first, &ab[i].second);
    --ab[i].first;
    --ab[i].second;
    uf1.unite(ab[i].first, ab[i].second);
  }

  intmax_t mini=std::min(uf1.rank(0), uf1.rank(1));
  intmax_t rest=N-mini;
  intmax_t full=mini*(mini-1)/2+rest*(rest-1)/2;
  printf("%jd\n", full-M);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:3: error: 'intmax_t' was not declared in this scope; did you mean 'int8_t'?
   46 |   intmax_t mini=std::min(uf1.rank(0), uf1.rank(1));
      |   ^~~~~~~~
      |   int8_t
a.cc:47:11: error: expected ';' before 'rest'
   47 |   intmax_t rest=N-mini;
      |           ^~~~~
      |           ;
a.cc:48:11: error: expected ';' before 'full'
   48 |   intmax_t full=mini*(mini-1)/2+rest*(rest-1)/2;
      |           ^~~~~
      |           ;
a.cc:49:19: error: 'full' was not declared in this scope
   49 |   printf("%jd\n", full-M);
      |                   ^~~~
Language: C++

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,P> PP;

//-----------------------------------------------------------------------------

int n,p;
vector<ll> v;

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

	cin>>n>>p;
	ll sum=0;
	REP(i,n) {
		ll w,b;cin>>w>>b;
		sum+=(-p)*b;
		v.pb(w*(100-p)+p*b));
	}
	sort(ALL(v));reverse(ALL(v));
	REP(i,n) {
		sum+=v[i];
		if(sum>=0) {
			cout<<i+1<<endl;
			return 0;
		}
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:36: error: expected ';' before ')' token
   35 |                 v.pb(w*(100-p)+p*b));
      |                                    ^
      |                                    ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 7;

int w[N];
int b[N];
int ind[N];
int n, p;

ll function(int ind)
{
    return 1LL * w[ind] * (100 - p) + 1LL * b[ind] * p;
}

bool cmp(int x, int y)
{
    return function(x) < function(y);
}

int main()
{
    ios::sync_with_stdio(false);

    cin >> n >> p;
    for (int i=0; i<n; i++)
        cin >> w[i] >> b[i];
    ll sum = 0;
    for (int i=0; i<n; i++)
        sum += 1LL * w[i] * (100 - p);
    for (int i=0; i<n; i++)
        ind[i] = i;
    sort(ind, ind+n, cmp);
    int ans = n;
    for (int i=0; i<n; i++)
        if (sum - function(ind[i]) >= 0)
            sum -= function(ind[i]), ans--;
    cout << ans << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'bool cmp(int, int)':
a.cc:18:12: error: reference to 'function' is ambiguous
   18 |     return function(x) < function(y);
      |            ^~~~~~~~
In file included from /usr/include/c++/14/functional:59,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/std_function.h:111:11: note: candidates are: 'template<class _Signature> class std::function'
  111 |     class function;
      |           ^~~~~~~~
a.cc:11:4: note:                 'll function(int)'
   11 | ll function(int ind)
      |    ^~~~~~~~
a.cc:18:26: error: reference to 'function' is ambiguous
   18 |     return function(x) < function(y);
      |                          ^~~~~~~~
/usr/include/c++/14/bits/std_function.h:111:11: note: candidates are: 'template<class _Signature> class std::function'
  111 |     class function;
      |           ^~~~~~~~
a.cc:11:4: note:                 'll function(int)'
   11 | ll function(int ind)
      |    ^~~~~~~~
a.cc: In function 'int main()':
a.cc:36:19: error: reference to 'function' is ambiguous
   36 |         if (sum - function(ind[i]) >= 0)
      |                   ^~~~~~~~
/usr/include/c++/14/bits/std_function.h:111:11: note: candidates are: 'template<class _Signature> class std::function'
  111 |     class function;
      |           ^~~~~~~~
a.cc:11:4: note:                 'll function(int)'
   11 | ll function(int ind)
      |    ^~~~~~~~
a.cc:37:20: error: reference to 'function' is ambiguous
   37 |             sum -= function(ind[i]), ans--;
      |                    ^~~~~~~~
/usr/include/c++/14/bits/std_function.h:111:11: note: candidates are: 'template<class _Signature> class std::function'
  111 |     class function;
      |           ^~~~~~~~
a.cc:11:4: note:                 'll function(int)'
   11 | ll function(int ind)
      |    ^~~~~~~~
Language: C

/*
cat <<EOF >mistaken-paste
*/

#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

#define MOD 1000000007
typedef unsigned long long ull;
typedef   signed long long sll;

#define N_MAX 200000

ull n;
sll a[N_MAX];
sll b[M_MAX];
sll dp[N_MAX];

sll smax(sll x, sll y){
	return (x > y) ? x : y;
}


ull solve(){
	int i;
	sll result;

	for (i = 0; i < n; i++) {
		if (i == 0) {
			dp[0] = b[0];
			continue;
		}

		dp[i] = b[i] + smax(0, dp[i - 1] - (a[i] - a[i - 1]));
	}

	result = 0;
	for (i = 0; i < n; i++) {
		result = smax(result, dp[i]);
	}

	printf("%lld\n", result);

	return 0;
}

int main(void){
	int i;

	scanf("%llu", &n);
	for (i = 0; i < n; i++) {
		scanf("%lld%lld", &a[i], &b[i]);
	}

	solve();
  
	return 0;
}


Compiler output:
main.c:21:7: error: 'M_MAX' undeclared here (not in a function); did you mean 'N_MAX'?
   21 | sll b[M_MAX];
      |       ^~~~~
      |       N_MAX
Language: C++

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

string solve(int N,string a,string b){
    int A = a.size();
    int B = b.size();
    int r = 0;
    while(!(r<=N && (N-r)%A==0)) r += B;
    string res;
    while(res.size() < N-r) res += a;
    while(res.size() < N)   res += b;
    return res;
}

int main(){
    ll L;
    string s,t;
    cin>>L>>s>>t;
    cout<<min(solve(L,s,t),solve(L,t,s))<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'll' was not declared in this scope
   16 |     ll L;
      |     ^~
a.cc:18:10: error: 'L' was not declared in this scope
   18 |     cin>>L>>s>>t;
      |          ^
Language: C++

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<functional>
#include<vector>
#include<queue>
using namespace std;
#define f(i,n) for(int i=0;i<(int)n;i++)
#define MOD 1000000009
 
int main(void){
	char a[200001];
	char b[200001];
f(i,200001){
a[i]=0;
b[i]=0;
}
	int n, k;
	int p, q;
	int x, y;
	int z = 0;
	scanf("%d", &n);
	scanf("%s", a);
	scanf("%s", b);
	p = strlen(a);
	q = strlen(b);
	f(i, n){
		x = i % p;
		y = i % q;
		if (a[x] != b[y]){
			if (a[x] > b[y])z = 1;
			break;
		}
	}
	k = n;
	if (z == 0){
		while (z == 0){
			if (k%p == 0){
				z = 2;
				for (int i = 0; i < k / p; i++){
					for (int j = 0; j<p; j++)printf("%c", a[j]);
				}
				for (int i = 0; i < (n - k) / q; i++){
					for (int j = 0; j<q; j++)printf("%c", b[j]);
				}
			}
			k -= q;
		}
	}
	else{
		while (z == 1){
			if (k%q == 0){
				z = 2;
				for (int i = 0; i < k / q; i++){
					for (int j = 0; j<q; j++)printf("%c", b[j]);
				}
				for (int i = 0; i < (n - k) / p; i++){
					for (int j = 0; j<p; j++)printf("%c", a[j]);
				}
			}
			k -= p;
		}
	}
 
	return 0;
}

Compiler output:
a.cc:12:1: error: extended character   is not valid in an identifier
   12 |  
      | ^
a.cc:66:1: error: extended character   is not valid in an identifier
   66 |  
      | ^
a.cc:12:1: error: '\U000000a0' does not name a type
   12 |  
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 200010
#define inf 0x7fffffff
/*------------------------------------------------------------*/
string a,b;
int la,lb;
bool pd(){
	int l=min(la,lb);
	if(la>lb){
		FOR(i,lb,l-1){
			b[i]=b[i-lb];
		}
	}
	if(la<lb){
		FOR(i,la,l-1){
			a[i]=a[i-la];
		}
	}
	FOR(i,0,l-1){
		if(a[i]!=b[i])return a[i]>b[i];
	}
}
int main(){
	int n;
	in(n);
	cin>>a>>b;
	la=a.length(),lb=b.length();
	aa=a,bb=b;
	if(pd())swap(a,b),swap(la,lb),swap(aa,bb);
	FORD(i,n,0){
		if(n-la*i<0)continue;
		if((n-la*i)%lb==0){
			int j=(n-la*i)/lb;
			FOR(k,1,i)cout<<aa;
			FOR(k,1,j)cout<<bb;
			return 0;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:9: error: 'aa' was not declared in this scope; did you mean 'la'?
   69 |         aa=a,bb=b;
      |         ^~
      |         la
a.cc:69:14: error: 'bb' was not declared in this scope; did you mean 'lb'?
   69 |         aa=a,bb=b;
      |              ^~
      |              lb
a.cc: In function 'bool pd()':
a.cc:63:1: warning: control reaches end of non-void function [-Wreturn-type]
   63 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 200010
#define inf 0x7fffffff
/*------------------------------------------------------------*/
string a,b;
int la,lb;
bool pd(){
	int l=min(la,lb);
	if(la>lb){
		FOR(i,lb,l-1){
			b[i]=b[i-lb];
		}
	}
	if(la<lb){
		FOR(i,la,l-1){
			a[i]=a[i-la];
		}
	}
	FOR(i,0,l-1){
		if(a[i]!=b[i])return a[i]>b[i];
	}
}
int main(){
	int n;
	in(n);
	cin>>a>>b;
	la=a.length(),lb=b.length();
	aa=a,bb=b;
	if(pd())swap(a,b),swap(la,lb);
	FORD(i,n,0){
		if(n-la*i<0)continue;
		if((n-la*i)%lb==0){
			int j=(n-la*i)/lb;
			FOR(k,1,i)cout<<aa;
			FOR(k,1,j)cout<<bb;
			return 0;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:9: error: 'aa' was not declared in this scope; did you mean 'la'?
   69 |         aa=a,bb=b;
      |         ^~
      |         la
a.cc:69:14: error: 'bb' was not declared in this scope; did you mean 'lb'?
   69 |         aa=a,bb=b;
      |              ^~
      |              lb
a.cc: In function 'bool pd()':
a.cc:63:1: warning: control reaches end of non-void function [-Wreturn-type]
   63 | }
      | ^
Language: C++

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

typedef long long ll;

int main() {
    scanf("%d", &n);
    for (int i=1; i<=n; i++) scanf("%d", &p[i]);
    //calc i=[0, 2n) i*pi/(2n-1)
    ll x = 0;
    for (int i=0; i<2*n; i++) x += (ll)p[i] * i;
    ll y = 2*n - 1;
    double ans = (double)x/y;
    printf("%lf\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:18: error: 'n' was not declared in this scope
    9 |     scanf("%d", &n);
      |                  ^
a.cc:10:43: error: 'p' was not declared in this scope
   10 |     for (int i=1; i<=n; i++) scanf("%d", &p[i]);
      |                                           ^
a.cc:13:40: error: 'p' was not declared in this scope
   13 |     for (int i=0; i<2*n; i++) x += (ll)p[i] * i;
      |                                        ^
Language: C++

#include<bits/stdc++.h >
using namespace std;
long long ans,n,a[100001];
int main() {
	cin>>n;
	for(int i=0; i<n*2; i++) {
		cin>>a[i];
	}
	sort(a,a+n*2);
	for(int i=0; i<2*n; i++) {
		ans+=i*a[i];
	}
	printf("%.12lf\n",1.0*ans/(2*n-1));
	return 0;
}

Compiler output:
a.cc:1:9: 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;
long long ans,n,a[100001];
int main() {
	cin>>n;
	for(int i=0; i<n*2; i++) {
		cin>>a[i];
	}
	sort(a,a+n*2);
	for(int i=0; i<2*n; i++) {
		ans+=(i)*a[i];
	}
	printf("%.12lf\n",1.0*ans/(2*n-1));
	return 0;
}

Compiler output:
a.cc:1:9: 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,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

struct UnionFind{
   vector<int> par;
   UnionFind(int n):par(n,-1){}
   int find(int x){
       if(par[x]<0)return x;
       return par[x]=find(par[x]);
   }
   bool unite(int x,int y){
       x=find(x);
       y=find(y);
       if(x==y)return false;
       if(par[x]>par[y]){
           par[y]+=par[x];
           par[x]=y;
       }
       else{
           par[x]+=par[y];
           par[y]=x;
       }
       return true;
   }

   bool same(int x,int y){
       return find(x)==find(y);
   }
   int size(int x){
       return -par[find(x)];
   }
};
int main(){
    int n,m,k;
    cin>>n>>m>>k;
    int c[n];
    int cnt=0;
    vector<int> cost;
    UnionFind uf(n+k);
    rep(i,n){
        cin>>c[i];
        --c[i];
        if(c[i]==-1)++cnt;
        else {
            uf.unite(i,c[i]+n);
            cost.push_back(0);
        }
    }
    int a[m],b[m],z[m];
    rep(i,m){
        cin>>a[i]>>b[i]>>z[i];
        --a[i];
        --b[i];
    }
    vector<int> ord(m);
    iota(ord.begin(),ord.end(),0);
    sort(ord.begin(),ord.end(),[&](auto x,auto y){
        return z[x]<z[y];
    });
    for(auto i : ord){
        if(uf.unite(a[i],b[i])){
            cost.push_back(z[i]);
        }
    }
    int s=cost.size();
    if(s+cnt<n+k-1){
        cout<<-1<<endl;
        return 0;
    }
    else {
        ll sum=0;
        rep(i,n+k-1-cnt){
            sum+=cost[i];
        }
        cout<<sum<<endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:63:32: error: use of deleted function 'main()::<lambda(auto:28, auto:29)>::~<lambda>()'
   63 |     sort(ord.begin(),ord.end(),[&](auto x,auto y){
      |                                ^~~~~~~~~~~~~~~~~~~
   64 |         return z[x]<z[y];
      |         ~~~~~~~~~~~~~~~~~       
   65 |     });
      |     ~                           
a.cc:63:34: note: 'main()::<lambda(auto:28, auto:29)>::~<lambda>()' is implicitly deleted because the default definition would be ill-formed:
   63 |     sort(ord.begin(),ord.end(),[&](auto x,auto y){
      |                                  ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

struct UnionFind{
   vector<int> par;
   UnionFind(int n):par(n,-1){}
   int find(int x){
       if(par[x]<0)return x;
       return par[x]=find(par[x]);
   }
   bool unite(int x,int y){
       x=find(x);
       y=find(y);
       if(x==y)return false;
       if(par[x]>par[y]){
           par[y]+=par[x];
           par[x]=y;
       }
       else{
           par[x]+=par[y];
           par[y]=x;
       }
       return true;
   }

   bool same(int x,int y){
       return find(x)==find(y);
   }
   int size(int x){
       return -par[find(x)];
   }
};
int main(){
    int n,m,k;
    cin>>n>>m>>k;
    int c[n];
    int cnt=0;
    vector<int> cost;
    UnionFind uf(n+k);
    rep(i,n){
        cin>>c[i];
        --c[i];
        if(c[i]==-1)++cnt;
        else {
            uf.unite(i,c[i]+n);
            cost.push_back(0);
        }
    }
    int a[m],b[m],z[m];
    rep(i,m){
        cin>>a[i]>>b[i]>>z[i];
        --a[i];
        --b[i];
    }
    vector<int> ord(m);
    iota(ord.begin(),ord.end(),0);
    sort(ord.begin(),ord.end(),[&](auto x,auto y){
        return z[x]<z[y];
    });
    for(auto i : ord){
        if(uf.unite(a[i],b[i])){
            cost.push_back(z[i]);
        }
    }
    int s=cost.size();
    if(s+cnt<n+k-1){
        cout<<-1<<endl;
        return 0;
    }
    else {
        ll sum=0;
        rep(i,n+k-1-cnt){
            sum+=cost[i];
        }
        cout<<sum<<endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:32: error: use of deleted function 'main()::<lambda(auto:1, auto:2)>::~<lambda>()'
   78 |     sort(ord.begin(),ord.end(),[&](auto x,auto y){
      |                                ^~~~~~~~~~~~~~~~~~~
   79 |         return z[x]<z[y];
      |         ~~~~~~~~~~~~~~~~~       
   80 |     });
      |     ~                           
a.cc:78:34: note: 'main()::<lambda(auto:1, auto:2)>::~<lambda>()' is implicitly deleted because the default definition would be ill-formed:
   78 |     sort(ord.begin(),ord.end(),[&](auto x,auto y){
      |                                  ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

class UnionFind {
private:
    int sz;
    vector<int> par, nrank;
public:
    UnionFind(){}
    UnionFind(int node_size) : sz(node_size), par(sz), nrank(sz, 0){
        iota(par.begin(), par.end(), 0);
    }
    int find(int x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }
    void unite(int x,int y){
        x = find(x), y = find(y);
        if(x == y) return;
    	if(nrank[x] < nrank[y]) swap(x,y);
        par[y] = x;
        if(nrank[x] == nrank[y]) nrank[x]++;
    }
    bool same(int x,int y){
        return find(x) == find(y);
    }
};

int main(){
    int n,m,k;
    cin >> n >> m >> k;
    priority_queue<pair<ll,pair<int,int> >,vector<pair<ll,pair<int,int> > >,greater<pair<ll,pair<int,int> > > > pq;
    int cnt = 0;
    rep(i,n){
        int c;
        cin >> c;
        if(c==0){
            cnt++;
        }else{
            pq.push(MP(0LL,MP(i,n+c-1)));
        }
    }
    rep(i,m){
        int a,b;
        ll w;
        cin >> a >> b >> w;
        a--;b--;
        pq.push(MP(w,MP(a,b)));
    }
    UnionFind uf(n+k);
    ll res = 0;
    int s = n+k;
    while(!pq.empty()){
        auto x = pq.top();
        pq.pop();
        ll w = x.first;
        int a = x.second.first;
        int b = x.second.second;
        if(!uf.same(a,b)){
            uf.unite(a,b);
            res += w;
            s--;
            if(s<=cnt+1)break;
        }
    }
    cerr << s << " " << cnt << endl;
    if(s<=cnt+1){
        cout << res << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}　

Compiler output:
a.cc:96:2: error: extended character 　 is not valid in an identifier
   96 | }　
      |  ^
a.cc:96:2: error: '\U00003000' does not name a type
   96 | }　
      |  ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
#define N 210
int n, a[N];
vector<int> A;

void rot(int k) {
	if (k == 0) return;
	A.pb(k);
	for (int i = k; i < n; i ++) swap(a[i], a[i-k]);
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i ++) cin >> a[i];
	while (true) {
		bool F = false;
		for (int i = 0; i < n; i ++) {
			if (a[0] != 0 && a[n-1] > a[0]) {
				F = true;
				rot(n-1);
			}
			rot(1);
		}
		if (!F) break;
	}
	while (a[0] != 0) rot(1);
	printf ("%d\n", (int) A.size());
	for (int i = 0; i < (int) A.size(); i ++)
		cout << A[i] << endl;
	for (int i = 0; i < n; i ++) assert(a[i] == i);
	return 0;
}


Compiler output:
a.cc: In function 'void rot(int)':
a.cc:11:11: error: 'class std::vector<int>' has no member named 'pb'
   11 |         A.pb(k);
      |           ^~
Language: Java

import java.util.*;

class Main {
    static final long I=1L<<40;
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n=Integer.parseInt(scan.next());
        int q=Integer.parseInt(scan.next());
        long[]a=new long[2*n],b=new long[2*n];
        for(int i=0;i<2*n;++i)a[i]=Integer.parseInt(scan.next());
        for(int i=0;i<2*n;++i)b[i]=Integer.parseInt(scan.next());
        long t=0;
        MaxSegmentTree sd=new MaxSegmentTree();
        MaxSegmentTree sdp=new MaxSegmentTree();
        long tpos=0;
        int cpos=0;
        for(int i=0;i<2*n;++i)t+=a[i];
        for(int i=1;i<2*n-1;++i){
            long c=b[i]-a[i];
            tpos+=Math.max(c,0);
            if(c>=0)cpos++;
            sd.update(i,c>=0?-I:c);
            sdp.update(i,c<0?-I:-c);
        }
        for(int i=0;i<q;++i){
            int p=Integer.parseInt(scan.next())-1;
            long x=Integer.parseInt(scan.next());
            long y=Integer.parseInt(scan.next());
            long c=b[p]-a[p];
            t-=a[p];
            if(1<=p<=2*n-2&&c>=0){
                tpos-=c;
                cpos--;
            }
            a[p]=x;
            b[p]=y;
            c=b[p]-a[p];
            t+=a[p];
            if(1<=p<=2*n-2&&c>=0){
                tpos+=c;
                cpos++;
            }
            if(1<=p<=2*n-2) {
                sd.update(p,c>=0?-I:c);
                sdp.update(p,c<0?-I:-c);
            }
            long ans;
            if(cpos%2==0)
                ans=tpos;
            else{
                ans=Math.max(tpos+sd.query(1,2*n-1),tpos+sdp.query(1,2*n-1));
            }
            System.out.println(ans+t);
        }
    }
}
class MaxSegmentTree {
    static final int SIZE = 1 << 18;
    static final long INFINITY = (1L << 62) - 1;
    long[] seg;
    MaxSegmentTree() {
	this.seg = new long[2 * SIZE];
    }
    void update(int x, long value) {
	x += SIZE - 1;
	this.seg[x] = value;
	while (x > 0) {
	    x = (x - 1) / 2;
	    this.seg[x] = Math.max(this.seg[2 * x + 1], this.seg[2 * x + 2]);
	}
    }
    long query(int l, int r) {
	l += SIZE - 1;
	r += SIZE - 1;
        long y = -INFINITY;
	while (l < r) {
	    if ((l & 1) == 0) {
		y = Math.max(y, this.seg[l]);
	    }
	    if ((r & 1) == 0) {
		y = Math.max(y, this.seg[r - 1]);
	    }
	    l /= 2;
	    r = (r - 1) / 2;
	}
	return y;
    }
}


Compiler output:
Main.java:31: error: bad operand types for binary operator '<='
            if(1<=p<=2*n-2&&c>=0){
                   ^
  first type:  boolean
  second type: int
Main.java:39: error: bad operand types for binary operator '<='
            if(1<=p<=2*n-2&&c>=0){
                   ^
  first type:  boolean
  second type: int
Main.java:43: error: bad operand types for binary operator '<='
            if(1<=p<=2*n-2) {
                   ^
  first type:  boolean
  second type: int
3 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int N,K;
    cin>>N>>K;
    map<int,int> A;
 
    for(int i = 0;i < N;i++) {
        int a;
        cin>>a;
        A[a]++;
    }
 
    vector<int> V;
    for(map<int,int>::iterator it = A.begin();it != A.end();it++) {
        V.push_back(it ->second);
    }
 
    sort(V.begin(),V.end(),greater<int>());
    long long int sum = 0;
    for(int i = K;i < V.size();i++) {
        sum += V[i+];
    }
 
    cout<<sum<<endl;
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: error: expected primary-expression before ']' token
   23 |         sum += V[i+];
      |                    ^
Language: C++

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int g[2100];
int sz[2100];
long long dp[2][2100];
long long dp2[3][2100][2100];
long long fact[3100];
void solve(int a){
	int n=g[a].size()
	dp2[0][0][0]=1;
	for(int i=0;i<g[a].size();i++){
		solve(g[a][i]);
		int T=sz[a];
		sz[a]+=sz[g[a][i]];
		for(int j=0;j<=sz[a];j++){
			dp2[0][i+1][j]=dp2[1][i+1][j]=dp2[2][i+1][j]=0;
		}
		for(int j=0;j<=F;j++){
			for(int k=0;k<=sz[g[a][i]];k++){
				dp2[0][i+1][j+k]=(dp2[0][i+1][j+k]+dp2[0][i][j]*dp[0][k])%mod;
				dp2[1][i+1][j+k]=(dp2[0][i+1][j+k]+dp2[0][i][j]*dp[1][k])%mod;
				dp2[1][i+1][j+k]=(dp2[0][i+1][j+k]+dp2[1][i][j]*dp[0][k])%mod;
				dp2[2][i+1][j+k]=(dp2[0][i+1][j+k]+dp2[1][i][j]*dp[1][k])%mod;
				dp2[2][i+1][j+k]=(dp2[0][i+1][j+k]+dp2[2][i][j]*dp[0][k])%mod;
			}
		}
	}
	for(int i=0;i<=sz[g[a][i]];i++){
		dp[0][i]=(dp2[0][n][i]+dp2[1][n][i]*2+dp2[2][n][i])%mod;
		dp[1][i+1]=dp2[1][n][i]%mod;
	}
	sz[a]++;
}
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a-1;i++){
		int p;scanf("%d",&p);
		p--;
		g[p].push_back(i+1);
	}
	solve(0);
	long long ret=0;
	fact[0]=1;
	for(int i=1;i<3100;i++)fact[i]=fact[i-1]*i%mod;

	for(int i=0;i<=a;i++){
		if(i%2==0)ret=(ret+dp[0][i]*fact[a-i]%mod)%mod;
		else ret=(ret+mod-dp[0][i]*fact[a-i]%mod)%mod;
	}
	printf("%lld\n",ret);
}

Compiler output:
a.cc: In function 'void solve(int)':
a.cc:28:20: error: request for member 'size' in 'g[a]', which is of non-class type 'int'
   28 |         int n=g[a].size()
      |                    ^~~~
a.cc:30:28: error: request for member 'size' in 'g[a]', which is of non-class type 'int'
   30 |         for(int i=0;i<g[a].size();i++){
      |                            ^~~~
a.cc:31:27: error: invalid types 'int[int]' for array subscript
   31 |                 solve(g[a][i]);
      |                           ^
a.cc:33:31: error: invalid types 'int[int]' for array subscript
   33 |                 sz[a]+=sz[g[a][i]];
      |                               ^
a.cc:37:32: error: 'F' was not declared in this scope
   37 |                 for(int j=0;j<=F;j++){
      |                                ^
a.cc:38:47: error: invalid types 'int[int]' for array subscript
   38 |                         for(int k=0;k<=sz[g[a][i]];k++){
      |                                               ^
a.cc:47:31: error: invalid types 'int[int]' for array subscript
   47 |         for(int i=0;i<=sz[g[a][i]];i++){
      |                               ^
a.cc: In function 'int main()':
a.cc:58:22: error: request for member 'push_back' in 'g[p]', which is of non-class type 'int'
   58 |                 g[p].push_back(i+1);
      |                      ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int N=2e5+5;
int n,m,a[N],b[N],tree[4*N],tree2[4*N],lazy[4*N];
ll ans;
void initseg(int nd,int l,int r)
{
    if(l==r){ tree[nd]=b[l]; tree2[nd]=l; return; }
    int m=(l+r)/2;
    initseg(nd*2,l,m);
    initseg(nd*2+1,m+1,r);
    tree[nd]=tree[nd*2];
    tree2[nd]=l;
}
void pushdown(int nd,int l,int r)
{
    if(l!=r){
        lazy[nd*2]+=lazy[nd];
        lazy[nd*2+1]+=lazy[nd];
    }
    tree[nd]+=lazy[nd];
    lazy[nd]=0;
}
P query(int nd,int l,int r,int s,int e)
{
    if(r<s||e<l) return P(2e9,2e9);
    pushdown(nd,l,r);
    if(s<=l&&r<=e) return P(tree[nd],tree2[nd]);
    int m=(l+r)/2;
    P p1=query(nd*2,l,m,s,e);
    P p2=query(nd*2+1,m+1,r,s,e);
    if(p1.first>=p2.first) return p2;
    return p1;
}
void update(int nd,int l,int r,int s,int e)
{
    if(r<s||e<l) return;
    pushdown(nd,l,r);
    if(s<=l&&r<=e){
        lazy[nd]++;
        pushdown(nd,l,r);
        return;
    }
    int m=(l+r)/2;
    update(nd*2,l,m,s,e);
    update(nd*2+1,m+1,r,s,e);
    if(tree[nd*2]>=xtree[nd*2+1]){
        tree[nd]=tree[nd*2+1];
        tree2[nd]=tree2[nd*2+1];
    }
    else{
        tree[nd]=tree[nd*2];
        tree2[nd]=tree2[nd*2];
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){ cin>>a[i]; b[i]=a[i]; }
    sort(b+1,b+1+n);
    m=unique(b+1,b+1+n)-b-1;
    initseg(1,1,m);
    for(int i=1;i<=n;i++){
        P tp=query(1,1,m,lower_bound(b+1,b+1+m,a[i])-b,m);
        ans+=(ll)tp.first-a[i];
        if(tp.second==1) continue;
        update(1,1,m,1,tp.second-1);
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'void update(int, int, int, int, int)':
a.cc:49:20: error: 'xtree' was not declared in this scope; did you mean 'tree'?
   49 |     if(tree[nd*2]>=xtree[nd*2+1]){
      |                    ^~~~~
      |                    tree
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  string w="AKIHABARA";
  for(int mask=0;mask<(1<<9);mask++;){
    bool t=true;
    string p="";
    for(int i=0;i<9;i++){
      if(mask &(1<<i)){
        p+=w[i];
      }else{
        t&=w[i]=='A';
      }
    }
    if(!t)continue;
    if(s==p){
      cout << "YES" << endl;
      return 0;
    }
    
  }
  cout << "NO" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:36: error: expected ')' before ';' token
    7 |   for(int mask=0;mask<(1<<9);mask++;){
      |      ~                             ^
      |                                    )
a.cc:7:37: error: expected primary-expression before ')' token
    7 |   for(int mask=0;mask<(1<<9);mask++;){
      |                                     ^
Language: Java

import java.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
		String s = next();
		if(s.matches("A?KIHA?BA?RA?")){
			myout("YES");
		}else{
			myotu("NO");
		}
	}
	//Method addition frame start



	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}


Compiler output:
Main.java:8: error: cannot find symbol
			myotu("NO");
			^
  symbol:   method myotu(String)
  location: class Main
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

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

int main() {
	string s;
	cin >> s;

	int szs = s.size();

	bool st1 = true, st2 = false, st3 = false, st4 = false;

	bool ok = true;
	for (int i = 0; i < szs; i++) {
		if (st1) {
			if (s.substr(i, 3) == "KIH") {
				i += 2;
				st1 = false;
				st2 = true;
				continue;
			}
			else if (s.substr(i, 4) == "AKIH") {
				i += 3;
				st1 = false;
				st2 = true;
				continue;
			}
			else {
				ok = false;
				break;
			}
		}
		if (st2) {
			if (s.substr(i, 1) == "B") {
				st2 = false;
				st3 = true;
				continue;
			}
			else if (s.substr(i, 2) == "AB") {
				i++;
				st2 = false;
				st3 = true;
				continue;
			}
			else {
				ok = false;
				break;
			}
		}
		if (st3) {
			if (s.substr(i, 1) == "R") {
				st3 = false;
				st4 = true;
				continue;
			}
			else if (s.substr(i, 2) == "AR") {
				i++;
				st3 = false;
				st4 = true;
				continue;
			}
			else {
				ok = false;
				break;
			}
		}
		if (st4) {
			if (s[i] != 'A' || i != sz - 1) ok = false;
		}
	}

	cout << (ok ? "YES" : "NO") << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:49: error: 'sz' was not declared in this scope; did you mean 'szs'?
   67 |                         if (s[i] != 'A' || i != sz - 1) ok = false;
      |                                                 ^~
      |                                                 szs
Language: C++

#include<bits/stdc++.h>
#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define per(i,n,j) for(int i=(n);i>=(j);i--)
using ll=long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF=1LL<<60;

string s;

int main(){
    cin>>s;
    int cnt=0;
    if(s=="KIHABARA") cout<<"YES"<<"\n";
    else if(s=="AKIHBARA") cout<<"YES"<<"\n";
    else if(s=="AKIHABRA") cout<<"YES"<<"\n";
    else if(s=="AKIHABAR") cout<<"YES"<<"\n";
    else if(s=="KIHBARA") cout<<"YES"<<"\n";
    else if(s=="KIHABRA") cout<<"YES"<<"\n";
    else if(s=="KIHABAR") cout<<"YES"<<"\n";
    else if(s=="AKIHBRA") cout<<"YES"<<"\n";
    else if(s=="AKIHBR") cout<<"YES"<<"\n";
    else if(s=="AKIHABR") cout<<"YES"<<"\n";
    eles cout<<"NO"<<"\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'eles' was not declared in this scope
   25 |     eles cout<<"NO"<<"\n";
      |     ^~~~