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

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

using int64 = long long;

int main() {
    int64 N, L, T;
    cin >> N >> L >> T;

    vector<int64> X(N), Y(N);
    vector<int> W(N);
    for (int i = 0; i < N; i++) {
        cin >> X[i] >> W[i];
        W[i] = (W[i] == 1 ? 1 : (-1));

        Y[i] = (X[i] + (T % L) * (W[i] + L)) % L;
    }

    for (int i = 0; i < N; i++) {
        cerr << "Y: " << Y[i] << endl;
    }

    int64 diff = 0;
    int64 lap = (2 * T) / L;
    for (int i = 1; i < N; i++) {
        if (W[i] == W[0]) continue;
        (diff += ((N + W[0]) * lap) % N) %= N;
        if (X[0] + (2 * T) % L >= X[i]) {
            (diff += W[0] + N) %= N;
        }
    }

    vector<int64> ans(N);

    if (N == 2) {
        ans[diff] = Y[0];
        ans[(diff + 1) % N] = Y[1];
    } else {
        int64 start = Y[0];
        sort(Y.begin(), Y.end());
        int idx = 0;
        // while ((Y[idx] != start) or (Y[(idx + 1) % N] == start)) {
        while (Y[idx] != start) {
            idx++;
        }
        for (int i = 0; i < N; i++) {
            ans[(diff + i) % N] = Y[(idx + i) % N];
        }
    }

    for (int i = 0; i < N; i++) {
        cout << ans[i] << endl;
    }


    return 0;
}

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

#include<bits/stdc++.h>
#define N 300005
#define int long long
using namespace std;

int n,l,t;
int x[N],w[N];
int v[N];
signed main()
{
    scanf("%lld%lld%lld",&n,&l,&t);
    l*=2;t*=2;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld%lld",&x[i],&w[i]);
        x[i]*=2;
        if(w[i]==2)w[i]=-1;
        v[i]=((x[i]+1LL*w[i]*t%l)%l+l)%l;
    }int kk=v[1];
    sort(v+1,v+n+1);
    for(int i=n+1;i<=3*n;i++)v[i]=v[i-n];

    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        if(w[i]!=w[1])
        {
            int rst=t;
            int dis;
            if(w[1]==1)dis=x[i]-x[1];
            else dis=x[1]+(l-x[i]);


            if(rst>=dis/2)
            {
                rst-=dis/2;cnt++;
                if(rst)cnt+=(rst-1)/(l/2);
            }
        }
    }
    cnt%=n;
    int now=1;
    if(w[1]==-1)
    {
        for(int i=1;i<=cnt;i++)
        {
            now--;
            if(!now)now=n;
        }
    }
    else
    {
        for(int i=1;i<=cnt;i++)
        {
            now++;
            if(now==n+1)now=1;
        }
    }
    int pos=0;
    if(w[i]==1)
    {
        for(int i=1;i<=n;i++)
        {
            if(v[i]==kk)
            {
                pos=i;break;
            }
        }
    }
    else
    {
        for(int i=n;i>=1;i--)
        {
            if(v[i]==kk)
            {
                pos=i;break;
            }
        }
    }

    for(int i=1;i<=n;i++)
    {
        printf("%lld\n",v[n+i-now+1+pos-1]/2);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:10: error: 'i' was not declared in this scope
   60 |     if(w[i]==1)
      |          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
#define w1 first
#define w2 second
#define ls (x<<1)
#define rs (x<<1|1)
#define pb push_back
#define mid ((l+r)>>1)
#define SZ(x) ((x).size())
#define All(x) (x).begin(),(x).end()
#define rep(i,a,b) for(ll (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(ll (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(ll (p)=head[(x)];(p);(p)=nxt[(p)])
template<class T>void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
const ll maxn=5e5+5;
ll n,l,t;
ll x[maxn],cnt[maxn][2],w[maxn],ans[maxn];
ll calc(ll L,ll c){
	ll res=(L/l)*cnt[n][c];
	L%=l;
	ll i=lower_bound(x+1,x+n+1,L)-x;
	if(x[i]>L)i--;
	return (res+cnt[i][c])%n;
}
int main(){
	read(n);read(l);read(t);
	rep(i,1,n){
		read(x[i]);
		read(w[i]);
		w[i]--;
		cnt[i][w[i]]=cnt[i-1][w[i]]+1;
		cnt[i][!w[i]]=cnt[i-1][!w[i]];
	}
	x[n+1]=1e9+19;
	rep(i,1,n)if(!w[i]){
		ll cnt=calc(x[i]+2*t,1)-calc(x[i],1);
		ans[(i+cnt-1)%n+1]=(x[i]+t)%l;
	}
	rep(i,1,n)if(w[i]){
		ll ub=(2*t+l-1)/l*l;
		ll dlt=ub-2*t;
		ub--;
		ll cnt=calc(ub,0)-(calc(x[i]+dlt-1,0)-calc(x[i],0));
		ans[(i-cnt+n-1)%n+1]=((x[i]-t)%l+l)%l;
	}
	rep(i,1,n)prllf("%d\n",ans[i]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:19: error: 'prllf' was not declared in this scope
   54 |         rep(i,1,n)prllf("%d\n",ans[i]);
      |                   ^~~~~
Language: C++

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

const int MAX_N = 100005;

int id[MAX_N], X[MAX_N], W[MAX_N];

bool cmp(int a, int b) {
  if (X[a] != X[b]) return X[a] < X[b];
  return W[a] > W[b];
}

int main() {
  int N, L, T;
  scanf("%d%d%d", &N, &L, &T);
  int tot = 0;
  
  for (int i = 0, num; i < N; ++i) {
    scanf("%d%d", &X[i], &W[i]);
    if (W[i] == 1) {
      num = (X[i] + T) / L;
      X[i] = (X[i] + T) % L;
    } else {
      num = (X[i] - T - L + 1) / L;
      X[i] = (X[i] - T) % L;
      if (X[i] < 0) X[i] += L;
    }
    
    id[i] = i;
    tot = (tot + num) % N;
  }

  sort(id, id + N, cmp);
  
  int i = (tot + N) % N;
  do {
    printf("%d\n", X[id[i]]);
    i = (i + 1) % N;
  } while (i != (tot + N) % N);
  
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:43:12: error: expected '}' at end of input
   43 |   return 0;
      |            ^
a.cc:15:12: note: to match this '{'
   15 | int main() {
      |            ^
Language: C++

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

int main()
{
	ll N, L, T; cin >> N >> L >> T;
	vector<ll>X(N), W(N);
	for (int i = 0; i < N; i++) {
		cin >> X[i] >> W[i];
	}

	vector<pair<double,int>>Y(N);
	for (int i = 0; i < N; i++) {
		ll y = X[i];
		if (W[i] == 1) {
			y += T;
			y %= L;
		}
		else {
			y -= T%L;
			y = (y + L) % L;
		}
		Y[i].first = y + 0.1*(3-W[i]);
		Y[i].second = i;
	}
	sort(Y.begin(), Y.end());

	int cnt = 0;
	for (int i = 1; i < N; i++) {
		if (W[0] != W[i]) {
			cnt += 2 * (T/L);

			int D;
			if (W[0] == 1) {
				if (X[0] > X[i])D = X[i] + L - X[0];
				else D = X[i] - X[0];
			}
			else {
				if (X[0] < X[i])D = X[0] + L - X[i];
				else D = X[0] - X[i];
			}

			int tmpT = T%L;
			if (D <= 2 * tmpT)cnt++;
			tmpT -= ceil(D / 2.);
			D = L - D % 2;
			if (D <= 2 * tmpT)cnt++;
		}
	}

	cnt %= N;
	for (int i = 0; i < N; i++) {
		if (Y[i].second == 0) {
			cnt = (N + i + (W[0] == 1 ? -cnt : cnt)) % N;
			break;
		}
	}

	for (int i = cnt; i < N; i++) {
		cout << (int)Y[i].first << endl;
	}
	for (int i = 0; i < cnt; i++) {
		cout << (int)Y[i].first << endl;
	}

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:49:33: error: 'ceil' was not declared in this scope
   49 |                         tmpT -= ceil(D / 2.);
      |                                 ^~~~
Language: C++

n,l,t=map(int,input().split())
a,cs=[0]*n,0
for i in range(n):
	x,y=map(int,input().split())
	x+=(t if y==1 else -t)
	cs=(cs+x//l)%n
	x%=l
	if x<0:
		x+=l
		cs-=1
	a[i]=x
a.sort()
print('\n'.join([str(a[(i+cs+n)%n]) for i in range(n)]))

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,l,t=map(int,input().split())
      | ^
Language: C++

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

const int N = 1e5 + 2;

int n, l, t, pos[N], dir[N];
vector<int>pos_set;

long long int0(int idx) {#include <bits/stdc++.h>
#define int long long
using namespace std;

const int N = 1e5 + 2;

int n, l, t, pos[N], dir[N];
vector<int>pos_set;

long long int0(int idx) {
	int diff, res;
	if (dir[0] == 1) {
		diff = pos[idx] - pos[0];
		if (dir[idx] == -1) {
			int val = 2 * t - diff;
			if (val >= 0)
				return (1 + val / l) % n;
		}

	}
	else {
		if(dir[idx] == 1) {
		diff = l - pos[idx] + pos[0];
		int val = 2 * t - diff;
		res = 1 + val / l;
		if (val >= 0) {
			return -(res % n);
		}}
	}
	return 0;
}

int32_t main() {
	//freopen("oj.in", "r", stdin);
	cin >> n >> l >> t;
	for (int i = 0; i < n; ++i) {
		cin >> pos[i] >> dir[i];
		if (dir[i] == 2)dir[i] = -1;
		int ad = (pos[i] + (t % l) * dir[i]) % l;
		pos_set.push_back(ad);
	}
	int shift = 0;
	for (int i = 1; i < n; ++i) {
		int cnt = int0(i);
		shift = (shift + cnt + n) % n;
	}
	vector<int>ans(n);
	for (int i = 0; i < n; ++i)
		ans[(i + shift + n) % n] = pos_set[i];
	for (int i = 0; i < n; ++i) {
		cout << ans[i] << '\n';
	}
}


Compiler output:
a.cc:10:26: error: stray '#' in program
   10 | long long int0(int idx) {#include <bits/stdc++.h>
      |                          ^
a.cc: In function 'long long int int0(long long int)':
a.cc:10:27: error: 'include' was not declared in this scope
   10 | long long int0(int idx) {#include <bits/stdc++.h>
      |                           ^~~~~~~
a.cc:10:36: error: 'bits' was not declared in this scope
   10 | long long int0(int idx) {#include <bits/stdc++.h>
      |                                    ^~~~
a.cc:10:41: error: 'stdc' was not declared in this scope; did you mean 'std'?
   10 | long long int0(int idx) {#include <bits/stdc++.h>
      |                                         ^~~~
      |                                         std
a.cc:12:1: error: expected primary-expression before 'using'
   12 | using namespace std;
      | ^~~~~
a.cc:19:25: error: a function-definition is not allowed here before '{' token
   19 | long long int0(int idx) {
      |                         ^
a.cc:42:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   42 | int32_t main() {
      |             ^~
a.cc:42:13: note: remove parentheses to default-initialize a variable
   42 | int32_t main() {
      |             ^~
      |             --
a.cc:42:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:42:16: error: a function-definition is not allowed here before '{' token
   42 | int32_t main() {
      |                ^
a.cc:62:2: error: expected '}' at end of input
   62 | }
      |  ^
a.cc:10:25: note: to match this '{'
   10 | long long int0(int idx) {#include <bits/stdc++.h>
      |                         ^
a.cc:62:2: warning: no return statement in function returning non-void [-Wreturn-type]
   62 | }
      |  ^
Language: C++

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

int x[100000], w[100000], y[100000];
int ans[100000];
signed main() {
	int n, l, t; scanf("%lld%lld%lld", &n, &l, &t);
	int X;
	rep(i, n) {
		scanf("%lld%lld", &x[i], &w[i]);
		if (w[i] == 1)y[i] = (x[i] + t) % l;
		else {
			if (x[i] >= t)y[i] = x[i] - t;
			else y[i] = (l - (t - x[i]) % l) % l;
		}
		if (i == 0)X = y[i];
	}
	int cnt = 0;
	for (int i = 1; i < n; i++) {
		if (w[0] == 1 && w[i] == 2) {
			double d = (x[i] - x[0]) / 2.;
			if (t >= d)(cnt += long long((t - d) / (l / 2.)) + 1) %= n;
		}
		if (w[0] == 2 && w[i] == 1) {
			double d = (l - (x[i] - x[0])) / 2.;
			if (t >= d)(cnt += long long((t - d) / (l / 2.)) + 1) %= n;
		}
	}
	if (w[0] == 2)cnt = (n - cnt) % n;
	sort(y, y + n);
	int a = lower_bound(y, y + n, X) - y;
	rep(i, n) {
		ans[(cnt + i) % n] = y[(a + i) % n];
	}
	rep(i, n)printf("%lld\n", ans[i]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:44: error: expected primary-expression before 'long'
   24 |                         if (t >= d)(cnt += long long((t - d) / (l / 2.)) + 1) %= n;
      |                                            ^~~~
a.cc:24:43: error: expected ')' before 'long'
   24 |                         if (t >= d)(cnt += long long((t - d) / (l / 2.)) + 1) %= n;
      |                                    ~      ^~~~~
      |                                           )
a.cc:28:44: error: expected primary-expression before 'long'
   28 |                         if (t >= d)(cnt += long long((t - d) / (l / 2.)) + 1) %= n;
      |                                            ^~~~
a.cc:28:43: error: expected ')' before 'long'
   28 |                         if (t >= d)(cnt += long long((t - d) / (l / 2.)) + 1) %= n;
      |                                    ~      ^~~~~
      |                                           )
Language: C++

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

int x[100000], w[100000], y[100000];
int ans[100000];
signed main() {
	int n, l, t; scanf("%lld%lld%lld", &n, &l, &t);
	int X;
	rep(i, n) {
		scanf("%lld%lld", &x[i], &w[i]);
		if (w[i] == 1)y[i] = (x[i] + t) % l;
		else {
			if (x[i] >= t)y[i] = x[i] - t;
			else y[i] = (l - (t - x[i]) % l) % l;
		}
		if (i == 0)X = y[i];
	}
	int cnt = 0;
	for (int i = 1; i < n; i++) {
		if (w[0] == 1 && w[i] == 2) {
			double d = (x[i] - x[0]) / 2.;
			if (t >= d)(cnt += int((t - d) / (l / 2.)) + 1) %= n;
		}
		if (w[0] == 2 && w[i] == 1) {
			double d = (l - (x[i] - x[0])) / 2.;
			if (t >= d)(cnt += int((t - d) / (l / 2.)) + 1) %= n;
		}
	}
	if (w[0] == 2)cnt = (n - cnt) % n;
	sort(y, y + n);
	int a = lower_bound(y, y + n, X) - y;
	rep(i, n) {
		ans[(cnt + i) % n] = y[(a + i) % n];
	}
	rep(i, n)printf("%lld\n", ans[i]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:13: error: expected primary-expression before 'long'
    2 | #define int long long
      |             ^~~~
a.cc:24:44: note: in expansion of macro 'int'
   24 |                         if (t >= d)(cnt += int((t - d) / (l / 2.)) + 1) %= n;
      |                                            ^~~
a.cc:24:43: error: expected ')' before 'long'
   24 |                         if (t >= d)(cnt += int((t - d) / (l / 2.)) + 1) %= n;
      |                                    ~      ^
      |                                           )
a.cc:2:13: error: expected primary-expression before 'long'
    2 | #define int long long
      |             ^~~~
a.cc:28:44: note: in expansion of macro 'int'
   28 |                         if (t >= d)(cnt += int((t - d) / (l / 2.)) + 1) %= n;
      |                                            ^~~
a.cc:28:43: error: expected ')' before 'long'
   28 |                         if (t >= d)(cnt += int((t - d) / (l / 2.)) + 1) %= n;
      |                                    ~      ^
      |                                           )
Language: C++

#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
const int maxn = 100010;
using namespace std;
int N, L, T, X[maxn];

int bSearch(int value, int low, int high, vector<int> b, int t)
{
	int mid, ret = 0;
	while (low <= high)
	{
		mid = (low + high);
		if ( (2 * T - (b[mid] - value)) / L + 1 == t)
		{
			low = mid + 1;
			ret = mid;
		}
		else
			high = mid - 1;
	}
	return ret;
}

vector <int> solve(vector<int> a, vector<int> b, int flag)
{
	int i, j;
	int n = a.size();
	int m = b.size();
	vector<int> ans;
	if (flag)
	{
		for (i = 0; i < n; i ++)
			a[i] = L - a[i];
		reverse(a.begin(), a.end());
		for (i = 0; i < m; i ++)
			b[i] = L - b[i];
		reverse(b.begin(), b.end());
	}
	for (int i = 0; i < m; i ++)
		b.push_back(b[i] + L);
	for (i = j = 0; i < n; i ++)
	{
		for( ; b[j] < a[i]; j ++);
		if (b[j] - a[i] > 2 * T)
		{
			ans.push_back(0);
			continue;
		}
		int t1, t2;
		t1 = (2 * T - (b[j] - a[i])) / L + 1;
		if (b[j + m - 1] - a[i] <= 2 * T)
			t2 = (2 * T - (b[j + m - 1] - a[i])) / L + 1;
		else
			t2 = 0;
		if (t1 == t2)
			ans.push_back((int)((1LL * t1 * m) % N));
		else
		{
			int pivot = bSearch(a[i], j, j + m - 1, b, t1);
			ans.push_back((int)((1LL * (pivot - j) * t1 + 1LL * (j + m - 1 - pivot) * t2) % N));
		}
	}
	return ans;
}
int ans[maxn];
int main()
{
	int i, j, k, n, m, w;
	vector<int> a, b, sa, sb;
	cin >> N >> L >> T;
	for (k = 0; k < N; k ++)
	{
		cin >> X[k] >> w;
		if (w == 1)
			a.push_back(X[k]);
		else
			b.push_back(X[k]);
	}
	sa = solve(a, b, 0);
	sb = solve(b, a, 1);
	n = a.size();
	m = b.size();
	for (k = i = j = 0; k < N; k ++)
		if (i < n && X[k] == a[i])
		{
			ans[(k + sa[i] + N) % N] = (X[k] + T) % L;
			i ++;
		}
		else if (j < m && X[k] == b[j])
		{
			ans[(k - sb[j] + N) % N] = ((X[k] - T) % L + L) % L;	
			j ++;
		}
	for (k = 0; k < N; k ++)
		cout << ans[k] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'std::vector<int> solve(std::vector<int>, std::vector<int>, int)':
a.cc:36:17: error: 'reverse' was not declared in this scope
   36 |                 reverse(a.begin(), a.end());
      |                 ^~~~~~~
Language: C++

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

long long int n, l, t, f, m, k;
vector<long long int> x[2];
vector<long long int> y;

int main(){
	scanf("%lld %lld %lld", &n, &l, &t);
	for(int i=0; i<n; ++i){
		long long int a, b;
		scanf("%lld %lld", &a, &b);
		x[b-1].push_back(a);
		y.push_back(((3-2*b)*(t%l)+a+l)%l);
		if(i==0 && b==1) f=1;
	}
	k=y[0];
	sort(y.begin(), y.end());
	for(int i=0; i<x[f].size(); ++i)
		if((-f*(x[f][i]-x[1-f][0])+l)%l<2*t) ++m;
	for(int i=0; i<n; ++i)
		if(y[i]==k){
			for(int j=0; j<n; ++j)
				printf("%lld\n", y[(i+j+(1-2*f)*m+n)%n]);
			break;
		}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'scanf' was not declared in this scope
   10 |         scanf("%lld %lld %lld", &n, &l, &t);
      |         ^~~~~
a.cc:25:33: error: 'printf' was not declared in this scope
   25 |                                 printf("%lld\n", y[(i+j+(1-2*f)*m+n)%n]);
      |                                 ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <algorithm>
  +++ |+#include <cstdio>
    3 | using namespace std;
Language: C++

#include <iostream>

using namespace std;

struct ant {
    int x;
    int zekken;
};

int main() {
    int N, L, T;
    int antX[100000];
    int antW[100000];
    cin >> N >> L >> T;
    for (int i = 0; i < N; ++i) {
        cin >> antX[i] >> antW[i];
    }
//    srand(0);
//    N = rand() % 100000 + 1;
//    L = rand() % 1000000000 + 1;
//    T = rand() % 1000000000 + 1;
//    cout << N << " " << L << " " << T << endl;
//    for (int i = 0; i < N; ++i) {
//        antX[i] = i;
//        antW[i] = 1;
//    }


    ant ants[100000];
    int suretigai[100000];
    for (int i = 0; i < N; ++i) {
        if (antW[i] == 1) {
            ants[i].x = antX[i] + T;
        } else {
            ants[i].x = antX[i] - T;
        }
        if (ants[i].x >= L) {
            ants[i].x = ants[i].x % L;
        } else if (ants[i].x < 0) {
            ants[i].x = (L + ants[i].x) % L;
        }
        for (int j = 0; j < N; ++j) {
            if (i == j) {
                continue;
            }
            if (antW[i] != antW[j]) {
                double firstTime;
                double diff = antX[i] - antX[j];
                if (diff < 0) {
                    diff += L;
                }
                firstTime = diff / 2.0;
                if (firstTime > 0) {
                    suretigai[i] += 1;
                }
                suretigai[i] += (int) (2 * (T - firstTime)) / L;
            }
        }
        if (antW[i] == 1) {
            ants[i].zekken = i + suretigai[i];
        } else {
            ants[i].zekken = i - suretigai[i];
            if (ants[i].zekken < 0) {
                ants[i].zekken = (N + ants[i].zekken) % N;
            }
        }
        ants[i].zekken = ants[i].zekken % N;
    }

    sort(ants, ants + N, [](const ant& x, const ant& y) { return x.zekken < y.zekken;});

    for (int i = 0; i < N; ++i) {
        cout << ants[ants[i].zekken].x << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   70 |     sort(ants, ants + N, [](const ant& x, const ant& y) { return x.zekken < y.zekken;});
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<bits/stdc++.h>
#define pq priority_queue
using namespace std;
#define MZ 1000000007
int num[200005];
int w[200005];
int n,l,t;
struct GG
{
    int dis,no;
}nums[100005];
bool cmp(GG x1,GG x2)
{
    return x1.dis<x2.dis;
}
int main()
{
    int gg=0,gl;
    int cnt=0,ct,wtf;
    scanf("%d%d%d",&n,&l,&t);
    for(int i=0;i<n;i++)
    {
        scanf("%d%d",num+i,w+i);
        num[i+n]=num[i]+l;
        w[i+n]=w[i];
    }
    for(int i=0;i<n;i++)
    {
        if(w[i]!=w[0])
            cnt++;
    }
    ct=t%l;
    gg=int((1LL*(t/l)*2*cnt)%n);
    if(w[0]==1)
    {
        for(int i=0;i<2*n;i++)
        {
            if(w[i]!=w[0] && ct*2>=num[i]-num[0])
                gg++;
        }
    }
    else
    {
        for(int i=0;i<2*n;i++)
        {
            if(w[i]!=w[0] && ct*2>=num[0]-num[i]+2*l)
                gg++;
        }
    }
    gg%=n;
    if(w[0]==2)
        gg=(n-gg)%n;
    nums[0].no=gg;
    for(int i=0;i<n;i++)
    {
        if(w[i]==1)
            nums[i].dis=(num[i]+t)%l;
        else
            nums[i].dis=((num[i]-t)%l+l)%l;
    }
    sort(nums,nums+n,cmp);
    for(int i=0;i<n;i++)
    {
        if(num[i].no==gg)
            gl=i;
    }
    for(int i=0;i<n;i++)
    {
        wtf=(gl+l-gg+i)%l;
        printf("%d\n",gg[wtf].dis);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:65:19: error: request for member 'no' in 'num[i]', which is of non-class type 'int'
   65 |         if(num[i].no==gg)
      |                   ^~
a.cc:71:25: error: invalid types 'int[int]' for array subscript
   71 |         printf("%d\n",gg[wtf].dis);
      |                         ^
Language: C++

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

#define MAX 100002
int n;
int l;
int t;

struct st{
	int X;
	int dir;
	int id;
	int nex(int tim){
		tim %= l;
		if (dir == 1){
			
		}
		else{
			tim = l - tim;
		}
		X += tim;
		X %= l;
		return X;
	}
};

deque<st> v;

deque<int> pos;

bool cmp(st a, st b){
	return a.X < b.X;
}
int dist(int a, int b){
	b += l;
	b -= a;
	b %= l;
	if (b == 0)return l;
	return b;
}

vector<st> V1;
vector<st> V2;

int ans[MAX];

void outt(){
	for (int i = 0; i < n; i++){
		printf("%d\n", ans[i]);
	}
}
int main(){
	cin >> n >> l >> t;
	int cnt1 = 0;
	int cnt2 = 0;
	for (int i = 0; i < n; i++){
		int x, w;
		scanf("%d%d", &x, &w);
		v.push_back({ x, w, i });
		if (w == 1)cnt1++;
		else cnt2++;
	}
	if (cnt1 == 0 || cnt2 == 0){
		for (int i = 0; i < v.size(); i++){
			printf("%d\n", v[i].nex(t));
		}
		return 0;
	}
	sort(pos.begin(), pos.end());
	sort(v.begin(), v.end(), cmp);
	int cur = 0;
	t *= 2;
	while (v[0].dir == 2){
		v.push_back(v.front());
		v.pop_front();
		pos.push_back(pos.front());
		pos.pop_front();
	}
	int nex = 0;
	for (int i = 0; i < v.size(); i++){
		if (v[i].dir == 1){
			V1.push_back(v[i]);
		}
		if (v[i].dir == 2){
			V2.push_back(v[i]);
		}
	}
	int mini = INT_MAX;
	for (int i = 0; i < V2.size(); i++){
		if (dist(V1[cur].X, V2[i].X) < mini){
			mini = dist(V1[cur].X, V2[cur].X);
			nex = i;
		}
	}
	t -= dist(V1[0].X,V2[nex].X);
	if (t < 0){
		for (int i = 0; i < pos.size(); i++){
			ans[v[i].id] = pos[i];
		}
		outt();
		return 0;
	}
	bool flag = false;
	int op = 0;
	while (t>=0){
		if (flag==false){
			int go = cur + V1.size() - 1;
			go %= V1.size();
			t -= dist(V1[go].X, V1[cur].X);
			if (t < 0)break;
			op++;
			cur = go;
		}
		else{
			int go = nex + 1;
			go %= V2.size();
			t -= dist(V2[nex].X, V2[go].X);
			if (t < 0)break;
			op++;
			nex = go;
		}
		flag ^= true;
	}
	int ans = 0;
	if (op % 2){
		ans=
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:130:9: error: expected primary-expression before '}' token
  130 |         }
      |         ^
Language: C++

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

int main(void){
    int N,T,L;
    int X[100000] = {};
    int W[100000] = {};
    int i;
    cin >> N >> L >> T;
    //cout << N << L << T << endl;
    for(i=0;i<N;i++){
        cin >> X[i] >> W[i];
        //cout << X[i] << W[i] << endl;
    }

    vector<int> v;
    for(i=0;i<N;i++){
        if(W[i]==1){
            v.push_back((X[i] + T) % L);
        }
        if(W[i]==2){
            v.push_back((((X[i] - T) % L) + L) % L);
        }
        //cout << v[i] << endl;
    }
    int cross = 0;
    if(W[0]==1){
        for(i=1;i<N;i++){
            if(W[i]==2){
                if((X[i] - X[0])/2.0 - 0.001 < T){cross++;}
                cross += (int)((T - (X[i] - X[0])/2.0 - 0.001)/L);
            }
        }
    }
    if(W[0]==2){
        for(i=1;i<N;i++){
            if(W[i]==1){
                if((L - X[i] + X[0])/2.0-0.001 < T){cross++;}
                cross += (int)((T - (L - X[i] + X[0])/2.0 - 0.001)/L);
            }
        }
    }
    cross %= N;
    int tmp = v[0];
    sort(v.begin(), v.end());
    vector<int>::iterator iter = find(v.begin(), v.end(), tmp);
    int index = distance(v.begin(), iter);
    for(i=0;i<N;i++){
        cout << v[index-cross+i] << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   46 |     sort(v.begin(), v.end());
      |     ^~~~
      |     short
a.cc:47:38: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   47 |     vector<int>::iterator iter = find(v.begin(), v.end(), tmp);
      |                                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:47:38: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   47 |     vector<int>::iterator iter = find(v.begin(), v.end(), tmp);
      |                                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

struct Ant {
  int X;
  int W;
};

int mod2L(int n, int L) {
  return (n + L * 2) % (L * 2);
}

int main() {
  int N, L, T;
  cin >> N >> L >> T;

  int tog = 0;
  vector<vector<int>> A(L * 2);
  fill(A[0].begin(), A[0].end(), 0);
  fill(A[1].begin(), A[1].end(), 0);

  int f;
  
  for (int i = 0; i < N; i++) {
    int X, W;
    cin >> X >> W;
    A1[X * 2] = W;

    if (i == 0) {
      f = X;
    }
  }

  for (int i = 0; i < T * 2; i++) {
    int got = 1 - tog;

    bool flg;
    for (int j = f; j < f + L * 2; j++) {
      flg = false;
      int jj = mod2L(j);
      if (A[tog][jj] | 1) {
	A[got][mod2L(j + 1, L)] += 1;
	if (!flg) {
	  flg = true;
	  f = mod2L(f - 1);
	}
      }
      if (A[tog][jj] | 2) {
	A[got][mod2L(j - 1, L)] += 2;
	if (!flg) {
	  flg = true;
	  f = mod2L(f + 1);
	}
      }
    }
    fill(A[tog].begin(), A[tog].end(), 0);
    tog = got;
  }

  for (int i = f; i < f + L * 2; i++) {
    int ii = mod2L(i);
    if (A[tog][ii] != 0) {
      cout << A[tog][ii] << endl;
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: 'A1' was not declared in this scope; did you mean 'A'?
   28 |     A1[X * 2] = W;
      |     ^~
      |     A
a.cc:41:21: error: too few arguments to function 'int mod2L(int, int)'
   41 |       int jj = mod2L(j);
      |                ~~~~~^~~
a.cc:10:5: note: declared here
   10 | int mod2L(int n, int L) {
      |     ^~~~~
a.cc:46:20: error: too few arguments to function 'int mod2L(int, int)'
   46 |           f = mod2L(f - 1);
      |               ~~~~~^~~~~~~
a.cc:10:5: note: declared here
   10 | int mod2L(int n, int L) {
      |     ^~~~~
a.cc:53:20: error: too few arguments to function 'int mod2L(int, int)'
   53 |           f = mod2L(f + 1);
      |               ~~~~~^~~~~~~
a.cc:10:5: note: declared here
   10 | int mod2L(int n, int L) {
      |     ^~~~~
a.cc:62:19: error: too few arguments to function 'int mod2L(int, int)'
   62 |     int ii = mod2L(i);
      |              ~~~~~^~~
a.cc:10:5: note: declared here
   10 | int mod2L(int n, int L) {
      |     ^~~~~
Language: C++

#include <iostream>
#include <stdlib.h>
#define FOR(i,a,b) for(long long i = (a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

x#define debug(x) cout << #x << " = " << x << endl;

#define N 100001

using namespace std;

pair <int,int> ant[N];
int loc[N];

int main(void){


    int n,l,t;
    cin >> n >> l >> t;

    REP(i,n){
        loc[i] = i;
    }

    REP(i,n){
        int coordinate;
        int direction;
        cin >> coordinate >> direction;
        ant[i] = make_pair(coordinate,direction);
    }
    int collideCnt = 0;
    REP(i,t){
        REP(k,n){
            FOR(h,k+1,n){
                if(ant[k].second == 1 && ant[h].second == 2){
                    if(ant[h].first - ant[k].first <=1 || (ant[h].first+1  == n &&ant[k].first == 0) ){
                        swap(loc[k],loc[h]);
                        collideCnt++;
                        break;
                    }
                }
            }
            if(ant[k].second == 1){
                ant[k].first++;
                ant[k].first = ant[k].first % l;
            }else{
                ant[k].first--;
                if(ant[k].first < 0){
                    ant[k].first = ant[k].first + l;
                }
            }
        }
    }
    REP(i,n){
        if(collideCnt % 2 == 1){
            loc[i]--;
            if(loc[i] < 0)
                loc[i] = loc[i]+n;
        }else{
            loc[i]++;
            loc[i] %= n;
        }
    }

    REP(i,n){
        REP(k,n){
            if(i == loc[k]){
                cout << ant[k].first << endl;
            }
        }
    }
    return 0;
}


Compiler output:
a.cc:6:2: error: stray '#' in program
    6 | x#define debug(x) cout << #x << " = " << x << endl;
      |  ^
a.cc:6:27: error: stray '#' in program
    6 | x#define debug(x) cout << #x << " = " << x << endl;
      |                           ^
a.cc:6:1: error: 'x' does not name a type
    6 | x#define debug(x) cout << #x << " = " << x << endl;
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

int main(){
  long n,l,t;
  cin>>n>>l>>t;
  vector<long> x(n), w(n);
  rep(i,n) cin>>x[i]>>w[i];

  vector<long> v(n);
  rep(i,n){
    if(w[i]==1) v[i] = (x[i] + t)%l;
    else v[i] = (x[i] - t%l + l) % l;
  }
  sort(all(v));

  int init = 0;
  if(w[0]==1){
    int cnt = 0;
    repl(i,1,n) if(w[i]==2) cnt++;
    cnt *= (2*t)/l;

    int q = (x[0] + 2*t)%l;
    for(int i=0; (i<n)&&(x[i]<q); i++) if(w[i]==2) cnt++;

    int id = lower_bound(all(v), (x[0]+t)%l) - v.begin();
    init = (id - cnt%n + n)%n;

  } else {
    int cnt = 0;
    repl(i,1,n) if(w[i]==1) cnt++;
    cnt *= (2*t)/l;

    int q = (x[0] - 2*t%l + l)%l; // q = (x[0]-2*t)%l;
    for(int i=n-1; (i>=0)&&(x[i]>q; i--) if(w[i]==1) cnt++;
//    dbg(cnt);
    int id = lower_bound(all(v), (x[0]-t%l+l)%l) - v.begin();
    if(v[id]==v[id+1]) id = id+1;
    init = (id + cnt%n)%n;

  }

  rep(i,n) cout << v[(init+i)%n] << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:35: error: expected ')' before ';' token
   48 |     for(int i=n-1; (i>=0)&&(x[i]>q; i--) if(w[i]==1) cnt++;
      |                            ~      ^
      |                                   )
Language: C++

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

const int N = 300011;
typedef long long intl;

int s[N], d[N];
int e[N];
pair <int, int> p[N];

int ans[N];

int main()
{
        ios :: sync_with_stdio(false);
        int n, m;
        intl t;
        cin >> n >> m >> t;
        for(int i = 0; i < n; i ++)
        {
                char c;
                cin >> s[i] >> c;
                d[i] = (c == '2');
                p[i] = {s[i], i};
        }
        intl shift = 0;
        for(int i = 0; i < n; i ++)
        {
                if(d[i] == 1)
                {
                        e[i] = ((s[i] - t) % m + m) % m;
                        shift += (s[i] - t - e[i]) / m;
                }
                else
                {
                        e[i] = (s[i] + t) % m;
                        shift += (s[i] + t - e[i]) / m;
                }
                shift = (shift % n + n) % n;
        }

        sort(p, p + n);
        sort(e, e + n);
        for(int i = 0; i < n; i ++)
                ans[p[i].second] = e[(i + shift) % n];
        for(int i = 0; i < n; i ++)
                cout << ans[i] << '\n‘;

        return 0;
}


Compiler output:
a.cc:48:35: warning: missing terminating ' character
   48 |                 cout << ans[i] << '\n‘;
      |                                   ^
a.cc:48:35: error: missing terminating ' character
   48 |                 cout << ans[i] << '\n‘;
      |                                   ^~~~~
a.cc: In function 'int main()':
a.cc:50:9: error: expected primary-expression before 'return'
   50 |         return 0;
      |         ^~~~~~
Language: C++

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

inline int read()
{
	int x=0,f=1,c=getchar();
	while(c<48) c=='-'&&(f=-1),c=getchar();
	while(c>47) x=x*10+c-'0',c=getchar();
	return x*f;
}

const int MAXN = 5005;
const int mod = 1e9+7;
int f[MAXN][MAXN];
int n,m;

inline int dp(int x,int y,int ret=0)
{
	memset(f,0,sizeof(f));
	for(int i=0;i<=x;++i) f[0][i]=1;
	for(int i=1;i<=y;++i)
		for(int j=0;j<=x;++j)
		{
			if(j<x) (f[i][j]+=f[i-1][j+1])%=mod,(f[i][j]+=f[i-1][j])%=mod;
			if(j) (f[i][j]+=f[i-1][j])%=mod,(f[i][j]+=f[i-1][j-1])%=mod;
		}
	for(int i=0;i<=x;++i) (ret+=f[y][i])%=mod;
	return ret;
}

int main(int argc, char const *argv[])
{
	n=read(); m=read();`
	printf("%d\n", (dp(n,m)-dp(n-1,m)+mod)%mod);
	return 0;
}



Compiler output:
a.cc:33:28: error: stray '`' in program
   33 |         n=read(); m=read();`
      |                            ^
Language: C++

#include<bits/stdc++.h>
#define mo 1000000007 
using namespace std;
long long n,m,i,j,k,ans,f[3005][3005][2];
int main(){
    cin >> n >> m;
    f[0][0][1]=1;
   	for(i=1;i<=n;i++)
   		f[0][i][0]=1;
   	for(i=1;i<=m;i++)
   		for(j=0;j<=n;j++)
   			for(k=0;k<=1;k++){
				if(j!=0){
					f[i][j][k|(j==1)]=(f[i][j][k|(j==1)]+f[i-1][j][k])%mo;
					f[i][j-1][k|(j==1)]=(f[i][j-1][k|(j==1)]+f[i-1][j][k])%mo;	
				}
				if(n-j!=0){
					f[i][j+1][k]=(f[i][j+1][k]+f[i-1][j][k])%mo;
					f[i][j][k]=(f[i][j][k]+f[i-1][j][k])%mo;
				}
			}
	for(i=0;i<=n;i++)
		ans=(ans+f[m][i][1])%mo;
	pus(ans,2);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'pus' was not declared in this scope; did you mean 'puts'?
   24 |         pus(ans,2);
      |         ^~~
      |         puts
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int n,m;
int dp[2][3010][2];
int ans;
const int md=1e9+7;
void add(int &a,int b)
{
	a+=b;
	if(a>=md)a-=md;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<=n;i++)dp[0][i][0]=1;
	for(int i=1;i<=m;i++)
	{
		int ii=i&1;
		memset(dp[ii],0,sizeof(dp[ii]));
		for(int j=0;j<=n;j++)
		{
			for(int st=0;st<2;st++)
			{
				int nst;
				if(j>=1)
				{
					nst=st;
					if(j==1)nst=1;
					add(dp[ii][j-1][nst],dp[ii^1][j][st]);//rr
					add(dp[ii][j][nst],dp[ii^1][j][st]);//rb
				}
				if(j<n)
				{
					nst=st;
					if(!j)nst=1;
					add(dp[ii][j+1][nst],dp[ii^1][j][st]);//bb
					add(dp[ii][j][nst],dp[ii^1][j][st]);//br
				}
			}
		}
	}
	for(int i=0;i<=n;i++)add(ans,dp[m&1][i][1]);
	printf("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'memset' was not declared in this scope
   20 |                 memset(dp[ii],0,sizeof(dp[ii]));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

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

const int mod = 1000000007;
int N, M;

vector<vector<vector<int> > > cc;
int dp(int m, int r, int z) {
    int &ret = cc[m][r][z];
    if(ret != -1) return ret;

    if(m == 0) return ret = z | (r == 0);

    ret = 2 * dp(m - 1, r, z | (r == 0)) % mod;
    if(r != 0) ret = (ret + dp(m - 1, r - 1, z | (r == 0))) % mod;
    if(r != N) ret = (ret + dp(m - 1, r + 1, z | (r == 0))) % mod;
    return ret;
}

int main() {
    scanf("%d %d", &N, &M);
    N--;
    M--;
    cc = vector<vector<vector<int> > >(M + 1, vector<vector<int> >(N + 1, vector<int>(2, -1)));
    ll ans = 0;
    for(int i = 0; i <= N; i++) {
        ans += dp(M, i, 0);
        ans %= mod;
    }
    ans = ans * 4 % mod;
    printf("%lld", ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'll' was not declared in this scope
   25 |     ll ans = 0;
      |     ^~
a.cc:27:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |         ans += dp(M, i, 0);
      |         ^~~
      |         abs
a.cc:30:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |     ans = ans * 4 % mod;
      |     ^~~
      |     abs
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<iostream>
const long long mod=1000000007;
using namespace std;
long long pos[100003];
long long n,m;
struct node{
	long long x[3][3];	
	inline void operator *=(const node &a){
		long long c[3][3]={0};
		for(int i=0;i<=2;i++){
			for(int j=0;j<=2;j++){
				for(int k=0;k<=2;k++){
					c[i][j]=(c[i][j]+x[i][k]*a.x[k][j]%mod)mod;
				}
			}
		}
		for(int i=0;i<=2;i++){
			for(int j=0;j<=2;j++){
				x[i][j]=c[i][j];
			}
		}
	}
}e,a,e1,e2;
inline void fsp(node &x,node y,long long t){
	node y1=y;
	for(;t;t>>=1){
		if(t&1){
			x*=y1;
		}
	}
}
long long A[3],B[3];
int main(){
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>pos[i];
	}
	e.x[0][0]=e.x[1][1]=e.x[2][2]=e.x[1][2]=e.x[0][2]=1;
	e.x[0][1]=2;
	e2.x[0][0]=e2.x[1][1]=e2.x[2][2]=e2.x[2][0]=1;
	e1=e;
	e1*=e2;
	pos[m+1]=n;
	B[0]=1;
	for(int l=1;l<=m+1;l++){
		int s=pos[l]-pos[l-1]-1;
		memset(a.x,0,sizeof(a.x));
		for(int i=0;i<3;i++){
			a.x[i][i]=1;
		}
		fsp(a,e1,s);
		a*=e;
		for(int i=0;i<=2;i++){
			A[i]=0;
			for(int j=0;j<=2;j++){
				A[i]=(A[i]+B[j]*a.x[j][i])%mod;
			}
		}
		for(int i=0;i<=2;i++){
			B[i]=A[i];
		}
	}
	cout<<B[2]<<endl;
	return 0;
}
/*

in:
10 9
1 2 3 4 5 6 7 8 9

out:
100

*/
//f[i][0]=f[i-1][0];
//f[i][1]=f[i-1][0]+f[i-1][1];
//f[i][2]=2*f[i-1][1]+f[i-1][2]+f[i-1][0];  i-1到i无隔板

//f[i][0]=f[i-1][2];
//f[i][1]=f[i-1][2];
//f[i][2]=f[i-1][2];   i-1到i有隔板 

Compiler output:
a.cc: In member function 'void node::operator*=(const node&)':
a.cc:18:80: error: expected ';' before 'mod'
   18 |                                         c[i][j]=(c[i][j]+x[i][k]*a.x[k][j]%mod)mod;
      |                                                                                ^~~
Language: C++

#include <stdio.h>

const long long mod = 1000000007;

struct mat {
	long long a[3][3];

	mat operator -(mat t) {
		mat r;
		for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++){
			r.a[i][j] = (a[i][j] + mod - t.a[i][j]) % mod;
		}
		return r;
	}

	mat operator *(mat t){
		mat r;
		for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++){
			r.a[i][j] = 0;
			for (int k = 0; k < 3; k++) {
				r.a[i][j] = (r.a[i][j] + a[i][k] * t.a[k][j]) % mod;
			}
		}
		return r;
	}
};

mat pow(mat a, int p)
{
	mat r;
	for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) r.a[i][j] = 0;
	for (int i = 0; i < 3; i++) r.a[i][i] = 1;
	while (p) {
		if (p & 1) r = r * a;
		a = a * a;
		p /= 2;
	}
	return r;
}

int N, M, X[100100];
long long D[100100];

long long get(mat &t) {
	return (t.a[2][0] * 5 + t.a[2][1]) % mod;
}

int main()
{
	scanf("%d %d", &N, &M);
	for (int t = 1; t <= M; t++) scanf("%d", &X[t]);
	X[M + 1] = N;

	mat base = { 4,mod - 2,1,1,0,0,0,1,0 };
	mat sum = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };

	for (int i = 1; i <= M + 1; i++) {
		sum = sum * pow(base, X[i] - X[i-1]);
		D[i] = get(pow(base, X[i]) - sum);
		for (int k = 0; k < 3; k++) sum.a[k][k] = (sum.a[k][k] + D[i]) % mod;
	}

	printf("%lld\n", D[M+1]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:44: error: cannot bind non-const lvalue reference of type 'mat&' to an rvalue of type 'mat'
   59 |                 D[i] = get(pow(base, X[i]) - sum);
      |                            ~~~~~~~~~~~~~~~~^~~~~
a.cc:44:20: note:   initializing argument 1 of 'long long int get(mat&)'
   44 | long long get(mat &t) {
      |               ~~~~~^
Language: C++

#include <stdio.h>

const long long mod = 1000000007;

struct mat {
	long long a[3][3];

	mat operator -(const mat& t) const {
		mat r;
		for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++){
			r.a[i][j] = (a[i][j] + mod - t.a[i][j]) % mod;
		}
		return r;
	}

	mat operator *(const mat& t) const {
		mat r;
		for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++){
			r.a[i][j] = 0;
			for (int k = 0; k < 3; k++) {
				r.a[i][j] = (r.a[i][j] + a[i][k] * t.a[k][j]) % mod;
			}
		}
		return r;
	}
};

mat pow(mat a, int p)
{
	mat r;
	for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) r.a[i][j] = 0;
	for (int i = 0; i < 3; i++) r.a[i][i] = 1;
	while (p) {
		if (p & 1) r = r * a;
		a = a * a;
		p /= 2;
	}
	return r;
}

int N, M, X[100100];
long long D[100100];

long long get(mat &t) {
	return (t.a[2][0] * 5 + t.a[2][1]) % mod;
}

int main()
{
	scanf("%d %d", &N, &M);
	for (int t = 1; t <= M; t++) scanf("%d", &X[t]);
	X[M + 1] = N;

	mat base = { 4,mod - 2,1,1,0,0,0,1,0 };
	mat sum = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };

	for (int i = 1; i <= M + 1; i++) {
		sum = sum * pow(base, X[i] - X[i-1]);
		D[i] = get(pow(base, X[i]) - sum);
		for (int k = 0; k < 3; k++) sum.a[k][k] = (sum.a[k][k] + D[i]) % mod;
	}

	printf("%lld\n", D[M+1]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:44: error: cannot bind non-const lvalue reference of type 'mat&' to an rvalue of type 'mat'
   59 |                 D[i] = get(pow(base, X[i]) - sum);
      |                            ~~~~~~~~~~~~~~~~^~~~~
a.cc:44:20: note:   initializing argument 1 of 'long long int get(mat&)'
   44 | long long get(mat &t) {
      |               ~~~~~^
Language: C++

// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef int LL;
typedef unsigned int uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);
 
const LL mod=1e9+7;
struct matrix
{
	int a[3][3];
	void clear(int x=0)
	{
		for(int i=0;i<3;i++)for(int j=0;j<3;j++)a[i][j]=(i==j)*x;
	}
	matrix(){clear();}
	int *operator [](int x)
	{
		return a[x];
	}
}sum,tran;
matrix operator *(matrix a,matrix b)
{
	matrix ret;
	ret.clear(0);
	for(int i=0;i<3;i++)for(int j=0;j<3;j++)for(int k=0;k<3;k++)
		ret[i][j]=(ret[i][j]+1ll*a[i][k]*b[k][j])%mod;
	return ret;
}
matrix power(matrix x,int y)
{
	matrix ret;ret.clear(1);
	while(y)
	{
		if(y&1)ret=ret*x;
		x=x*x;
		y>>=1;
	}
	return ret;
}
 
int calc(int x)
{
	matrix t;t.clear();t[0][0]=0;t[1][0]=1;t[2][0]=5;
	t=power(tran,x)*t;
	return t[0][0];
}
int f[100111],n,x[100111],m;
int main()
{
	sum.clear();tran.clear();tran[0][1]=1;tran[1][2]=1;tran[2][0]=1;tran[2][1]=mod-2;tran[2][2]=4;
	get2(n,m);
	for(int i=1;i<=m;i++)get1(x[i]);
	x[++m]=n;
	for(int i=1;i<=m;i++)
	{
		sum=power(tran,x[i]-x[i-1])*sum;
		f[i]=calc(x[i])-sum[0][0];
		if(f[i]<
		
		sum[1][0]=(sum[1][0]+f[i])%mod;
		sum[2][0]=(sum[2][0]+5ll*f[i])%mod;
	}
	printendl(f[m]);
	return 0;
}

Compiler output:
a.cc:48:18: warning: overflow in conversion from 'long long int' to 'LL' {aka 'int'} changes value from '2305843009213693952' to '0' [-Woverflow]
   48 | const LL Linf=1ll<<61;
      |               ~~~^~~~
a.cc: In function 'int main()':
a.cc:102:24: error: lvalue required as left operand of assignment
  102 |                 if(f[i]<
      |                    ~~~~^
  103 | 
      |                         
  104 |                 sum[1][0]=(sum[1][0]+f[i])%mod;
      |                 ~~~~~~~~~
a.cc:105:51: error: expected ')' before ';' token
  105 |                 sum[2][0]=(sum[2][0]+5ll*f[i])%mod;
      |                                                   ^
      |                                                   )
a.cc:102:19: note: to match this '('
  102 |                 if(f[i]<
      |                   ^
Language: C++

#include <cstring>
#include <utility>
#include <cstdio>
#include <queue>
std::priority_queue<std::pair<int, int> > que;
int a[100005], b[100005], c[100005], pre[100005], lst[100005];
int ans[100005], flg[100005];
bool up[100005];
int main()
{
	// freopen("AGC013-F.in", "r", stdin);
	memset(lst, -1, sizeof(lst));
	int n, q, lazy = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d%d", a + i, b + i);
	for (int i = 1; i <= n + 1; i++)
		scanf("%d", c + i);
	scanf("%d", &q);
	std::sort(c + 1, c + n + 2);
	for (int i = 0; i < n; i++)
	{
		a[i] = std::lower_bound(c + 1, c + n + 2, a[i]) - c;
		b[i] = std::lower_bound(c + 1, c + n + 2, b[i]) - c;
		flg[a[i] - 1]--;
		if (b[i] < a[i])
		{
			pre[i] = lst[a[i] - 1];
			lst[a[i] - 1] = i;
		}
		up[i] = true;
	}
	for (int i = n + 1, cur = -1; i; i--, cur++)
	{
		cur += flg[i];
		for (int j = lst[i]; ~j; j = pre[j])
			que.push({-b[j], j});
		while (cur < -1)
		{
			if (que.empty() || -que.top().first > i)
			{
				while (q--)
				{
					puts("-1");
					return 0;
				}
			}
			up[que.top().second] = false;
			flg[-que.top().first - 1]--;
			que.pop();
			cur++;
			lazy++;
		}
	}
	memset(flg, 0, sizeof(flg));
	memset(lst, -1, sizeof(lst));
	while (!que.empty())
		que.pop();
	for (int i = 0; i < n; i++)
	{
		flg[up[i] ? a[i] : b[i]]++;
		if (up[i])
		{
			pre[i] = lst[b[i]];
			lst[b[i]] = i;
		}
	}
	for (int i = 1, en = 0; i <= n + 1; i++)
	{
		flg[i] += flg[i - 1];
		ans[i] = ans[i - 1];
		for (int j = lst[i]; ~j; j = pre[j])
			que.push({a[j] - 1, j});
		if (flg[i] - i == -1 && en < i)
		{
			if (que.empty() || que.top().first < i)
				ans[i] = 1e9;
			else
			{
				en = que.top().first;
				que.pop();
				ans[i]++;
			}
		}
	}
	while (q--)
	{
		int l, r;
		scanf("%d%d", &l, &r);
		l = std::lower_bound(c + 1, c + n + 2, l) - c;
		r = std::lower_bound(c + 1, c + n + 2, r) - c;
		int res = std::min(ans[l - 1], ans[r - 1] + 1) + lazy;
		if (res > n + 1)
			puts("-1");
		else
			printf("%d\n", n + 1 - res);
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:14: error: 'sort' is not a member of 'std'
   20 |         std::sort(c + 1, c + n + 2);
      |              ^~~~