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

/*
   DP*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
const long long MaxN = 1e5;

long long a[55],b[55],piu[55];
int n,vis;
long long ans;

struct bbb
{
	int w;
	long long b;
}biu[55];

bool cmp(bbb x,bbb y)
{
	return x.b < y.b;
}

bool gb()
{
	int piu1 = 0,xxx = 0;
	biu[1].b = -1;
	for(int i = 1;i <= n;i++)
	{
		xxx = 1;
		if(a[i]!=b[i])
		{
			xxx = 0;
			for(int j = 1;j <= a[i];j++)
			{
				if(a[i] % j == b[i])
				{
					biu[++piu1].w = i;
					biu[piu1].b = j;
					//	printf("x%lld %d\n",biu[piu1].b,piu1);
					xxx = 1;
					break;;
				}
			}
		}
		if(xxx == 0) return 1;
	}
	if(biu[1].b == -1) return 0;
	sort(biu + 1,biu + 1 + piu1,cmp);
	ans += pow(2,biu[1].b);
	//	printf("%lld %lld\n",ans,biu[1].b);
	for(int i = 1;i <= n;i++)
	{
		if(a[i] % biu[1].b >= b[i]) a[i] %= biu[1].b;
	}
	xxx = 0;
	for(int i = 1;i <= n;i++)
	{
		if(a[i] != b[i])
		{
			xxx = 1;
			break;
		}
	}
	if(xxx == 1) return gb();
	else return 0;
}

int main()
{
	while(~scanf("%d",&n))
	{
		vis = 0;
		ans = 0;
		for(int i = 1;i <= n;i++) scanf("%lld",&a[i]);
		for(int i = 1;i <= n;i++) scanf("%lld",&b[i]);
		vis = gb();
		if(vis == 1) printf("-1\n");
		else printf("%lld\n",ans);
	}
	return 0;
}
/*
   D

Compiler output:
a.cc:87:1: error: unterminated comment
   87 | /*
      | ^
Language: C++

/*
DP*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
const long long MaxN = 1e5;

long long a[55],b[55],piu[55];
int n,vis;
long long ans;

struct bbb
{
	int w;
	long long b;
}biu[55];

bool cmp(bbb x,bbb y)
{
	return x.b < y.b;
}

bool gb()
{
	int piu1 = 0,xxx;
	for(int i = 1;i <= n;i++)
	{
		xxx = 1;
		if(a[i]!=b[i])
		{
			xxx = 0;
			for(int j = 1;j <= a[i];j++)
			{
				if(a[i] % j == b[i])
				{
					biu[++piu1].w = i;
					biu[piu1].b = j;
				//	printf("x%lld %d\n",biu[piu1].b,piu1);
					xxx = 1;
					break;;
				}
			}
		}
		if(xxx == 0) return 1;
	}
	sort(biu + 1,biu + 1 + piu1,cmp);
	ans += pow(2,biu[1].b);
//	printf("%lld %lld\n",ans,biu[1].b);
	for(int i = 1;i <= n;i++)
	{
		if(a[i] % biu[1].b >= b[i]) a[i] %= biu[1].b;
	}
	xxx = 0;
	for(int i = 1;i <= n;i++)
	{
		if(a[i] != b[i])
		{
			xxx = 1;
			break;
		}
	}
	if(xxx == 1) return gb();
	else return 0;
}

int main()
{
	while(~scanf("%d",&n))
	{
		vis = 0;
		ans = 0;
		for(int i = 1;i <= n;i++) scanf("%lld",&a[i]);
		for(int i = 1;i <= n;i++) scanf("%lld",&b[i]);
		vis = gb();
		if(vis == 1) printf("-1\n");
		else printf("%lld\n",ans);
	}
	return 0;
}
/*
D

Compiler output:
a.cc:85:1: error: unterminated comment
   85 | /*
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>

int main(){
  int N;
  std::cin >> N;
  std::vector<std::vector<int> > input(N,std::vector<int>(2,0));
  for(int i = 0; i < N; ++i){
    std::cin >> input[i][0];
  }
  for(int i = 0; i < N; ++i){
    std::cin >> input[i][1];
  }
  std::sort(input.begin(),input.end(),[](const std::vector<int>& lhs, const std::vector<int>& rhs){ return (lhs[0] < rhs[0]); });
  std::vector<int> denomi;
  for(int i = 0; i < input.size(); ++i){
    if(input[i][1] == input[i][0]){
      input.erase(input.begin());
    }
    else if(input[i][1]*2 > input[i][0]){
      std::cout << "-1" << std::endl;
      return 0;
    }
    for(int j = 1; j < input[i][0]; ++j){
      if(input[i][0] % j == input[i][1]){
	input.erase(input.begin());
	for(int k = 0; k < input.size(); ++k){
	  if(input[k][0]%j == input[k][1]){
	    input.erase(input.begin()+k);
	  }else if(input[k][0]%j > input[k][1]*2){
	    input[k][0] = input[k][0]%j;
	  }
	}
	std::sort(input.begin(),input.end(),[](const std::vector<int>& lhs, const std::vector<int>& rhs){ return (lhs[0] < rhs[0]); });
	denomi.push_back(j);
	break;
      }      
    }
  }
  unsigned long long int answer = 0;
  for(int i = 0; i < denomi.size(); ++i){
    answer += pow(2,denomi[i]);
  }
  std::cout << answer << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:15: error: 'pow' was not declared in this scope
   44 |     answer += pow(2,denomi[i]);
      |               ^~~
Language: C++

import java.util.*;
public class Main {

    static public int n;
    static int[] A = new int[50];
    static int[] B = new int[50];

    public Boolean fun(Long bit){
        boolean[][] arr = new boolean[51][51];
        for(int i = 0; i <= 50; i++) {
                arr[i][i] = true;
        }
        for(int i = 0;i <= 50; i++){
            if((bit & (1<<i)) != 0){
                for(int j = 0;j <= 50;j++){
                    arr[j][j%i] = true;
                }
            }
        }

        for(int k = 0;k <= 50;k++){
            for(int i = 0;i <= 50;i++){
                for(int j = 0;j <= 50;j++){
                    arr[i][j] |= arr[i][k] & arr[k][j];
                }
            }
        }

        Boolean flag = true;

        for(int i = 0;i < n;i++){
            if(!arr[A[i]][B[i]])flag = false;
        }

        return flag;

    }

    public void solve(){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();

        for(int i = 0;i < n;i++) {
            A[i] = sc.nextInt();
        }
        for(int i = 0;i < n;i++) {
            B[i] = sc.nextInt();
        }

        Long ans = (1L << 50) - 1;

        if(!fun(ans)) {
            System.out.println(-1);
            return;
        }

        for(int i = 50;i >= 0;i--){
            Long tmp = ans & ~(1L << i);
            if(fun(tmp))ans = tmp;
        }

        System.out.println(ans);

    }

    public static void main(String[] args){
        new Main().solve();
    }
};

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: expected unqualified-id before 'public'
    2 | public class Main {
      | ^~~~~~
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 60
using namespace std;
typedef long long ll;
int a[MAXN],n;
int b[MAXN];
bool dp[MAXN][MAXN][MAXN];
ll ans;
void prepare(){
	for(int i=0;i<=50;i++)
		for(int j=0;j<=50;j++)
			for(int k=1;k<=50;k++){
				if(i==j)
					dp[i][j][k]=1;
				for(int l=1;l<=k;l++)
					if(dp[i%l][j][k]==1)
						dp[i][j][k]=1;
			}
}
vector<int> used;
int main(){
	prepare();
	SF("%d",&n);
	for(int i=0;i<n;i++)
		SF("%d",&a[i]);
	for(int i=0;i<n;i++)
		SF("%d",&b[i]);
	for(int k=50;k>0;k--){
		/*for(int i=0;i<n;i++)
			PF("[%d %d]",a[i],b[i]);
		PF("\n");*/
		used.clear();
		for(int i=0;i<n;i++){
			if(a[i]==b[i])
				continue;
			if(dp[a[i]][b[i]][k]==0){
				//PF("[%d %d %d]\n",a[i],b[i],k);
				PF("-1");
				return 0;
			}
			if(dp[a[i]][b[i]][k]==1&&dp[a[i]][b[i]][k-1]==0)
				used.push_back(i);
		}
		if(used.size()){
			ans+=(1ll<<k);
			for(int i=0;i<n;i++)
				if(dp[a[i]%k][b[i]][k-1]==1)
					a[i]%=k;
		}
	}
	PF("%lld",ans);
}

Compiler output:
a.cc:25:1: error: 'vector' does not name a type
   25 | vector<int> used;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:37:17: error: 'used' was not declared in this scope
   37 |                 used.clear();
      |                 ^~~~
Language: C++

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

int a[55], b[55], n, dp[55][55]; long long cost = 0; vector<int>vec;

bool solve(int p) {
	for (int i = 1; i <= n; i++) {
		vector<int>vec2 = vec;
		for (int j = p; j >= 1; j--) vec2.push_back(j);

		for (int j = vec2.size() + 1; j >= 0; j--) {
			for (int k = 0; k <= a[i]; k++) dp[j][k] = 0;
		}
		int s = a[i]; dp[vec2.size()][a[i]] = 1;

		reverse(vec2.begin(), vec2.end());

		for (int j = vec2.size(); j >= 1; j--) {
			int G = vec2[j - 1];
			for (int k = 0; k <= s; k++) {
				if (dp[j][k] == 0) continue;
				dp[j - 1][k] = true;
				dp[j - 1][k%G] = true;
			}
		}
		if (dp[0][b[i]] == 0) return false;
	}
	return true;
}

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) cin >> b[i];
	int V = 52;
	while (true) {
		int cnt = 0;
		for (int i = 1; i <= n; i++) {
			if (a[i] == b[i]) cnt++;
		}
		if (cnt == n) break;
		int s = -1;
		for (int i = 0; i <= V - 1; i++) {
			bool I = solve(i);
			if (I == true) { s = i; break; }
		}
		if (s == 0) break;
		if (s == -1) {
			cout << "-1" << endl;
			return 0;
		}
		cost += (1LL << s); vec.push_back(s);
		V = s;
	}
	cout << cost << endl;
	return 0;
}

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

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
#include<time.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep2(i,a,b)for(int i=a;i<b;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
//#define ll long long
const ll M=1000000007;

int n;
int a[100];
int b[100];
int w[51][51];
int w2[51][51];
vector<int>du;
ll ans;
const int INF=10000000;


int main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>b[i];

	

	for(int i=50;i>=1;i--){
		rep2(j,0,51)rep2(k,0,51){w[j][k]=(j==k)?0:INF;w2[j][k]=w[j][k];}

		for(int j=50;j>=0;j--){
			for(int k=50;k>=1;k--){
				//if(j%k==j)continue;
				bool ok=1;
				rep(z,du.size())if(du[z]==k)ok=0;
				if(!ok)continue;

				w[j][j%k]=1;
				if(k!=i)w2[j][j%k]=1;
			}
		}

		rep2(j,0,51){
			rep2(k,0,51){
				rep2(z,0,51){
					w[k][z]=min(w[k][z],w[k][j]+w[j][z]);
					w2[k][z]=min(w2[k][z],w2[k][j]+w2[j][z]);
				}
			}
		}
		
		bool o1=1,o2=2;
		rep(j,n)if(w[a[j]][b[j]]==INF)o1=0;
		rep(j,n)if(w2[a[j]][b[j]]==INF)o2=0;
		//cout<<i<<" "<<o1<<" "<<o2<<endl;
		if(o1&&!o2){
			ll one=1;
			ans+=(one<<i);
		}
		else if(o1&&o2)du.push_back(i);
	}

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


Compiler output:
a.cc:18:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   18 | #define ll __int64
      |            ^~~~~~~
a.cc:20:7: note: in expansion of macro 'll'
   20 | const ll M=1000000007;
      |       ^~
a.cc:18:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   18 | #define ll __int64
      |            ^~~~~~~
a.cc:28:1: note: in expansion of macro 'll'
   28 | ll ans;
      | ^~
a.cc: In function 'int main()':
a.cc:18:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   18 | #define ll __int64
      |            ^~~~~~~
a.cc:68:25: note: in expansion of macro 'll'
   68 |                         ll one=1;
      |                         ^~
a.cc:69:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   69 |                         ans+=(one<<i);
      |                         ^~~
      |                         abs
a.cc:69:31: error: 'one' was not declared in this scope
   69 |                         ans+=(one<<i);
      |                               ^~~
a.cc:74:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   74 |         cout<<ans<<endl;
      |               ^~~
      |               abs
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

long long j;
long long f[50][500];

void h(long long a, long long b, long long c, long long i){
  long long k,l;
  for (k=b+1;k<a-b+1;++k) {
    if (a%k==b) {
      ++j;
      f[i][j]=pow(2,k)+c;
      f[i][0]=j;
      //cout << i << " " << j << " " << pow(2,k)+c << endl;
    } else {
      l=1;
      while (b+k*l<a) {
        h(a, b+k*l, c+pow(2, k), i);
        l++;
      }
    }
  }
}

long long main(){
  long long N,i,k,l;
  cin >> N;
  long long a[N],b[N],C=0,S=0;
  for (i=0;i<N;++i) {
    cin >> a[i];
    for (j=0;j<500;++j) {
      f[i][j]=0;
    }
  }
  for (i=0;i<N;++i) {
    cin >> b[i];
    /*if (a[i] < b[i]) {
      cout << -1;
      return 0;
    }*/
    j=0;
    h(a[i], b[i], 0, i);
  }

  long long fl[51];
  for (j=0;j<51;++j) {
    fl[j]=0;
  }
  long long minj[N];
  long long maxi;

  for (k=0;k<N;++k) {
    for (i=0;i<N;++i) {
      minj[i]=1;
      for (j=2;j<1+f[i][0];++j){
        if (f[i][minj[i]]>f[i][j]) minj[i]=j;
      }
    }
    maxi=0;
    for (i=1;i<N;++i) {
      if (f[maxi][minj[maxi]]<f[i][minj[i]]) maxi=i;
    }
    //cout << f[maxi][minj[maxi]] << endl;
    S+=f[maxi][minj[maxi]];
    l=0;
    while (f[maxi][minj[maxi]]>0){
      if (f[maxi][minj[maxi]]%2==1) {
        fl[l]=1;
        for (i=0;i<N;++i) {
          for (j=1;j<1+f[i][0];++j){
            if ((f[i][j]/ long long(pow(2,l)))%2==1) f[i][j]-=pow(2,l);
          }
        }
      }
      f[maxi][minj[maxi]]/=2;
      ++l;
    }
    for (j=1;j<1+f[maxi][0];++j){
      f[maxi][j]=0;
    }
  }
  if (S==0){
    for(i=0;i<N;++i) {
      if (a[i]!=b[i]) {
        cout << -1;
        return 0;
      }
    }
  }
  cout << S << endl;
  return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:73:27: error: expected primary-expression before 'long'
   73 |             if ((f[i][j]/ long long(pow(2,l)))%2==1) f[i][j]-=pow(2,l);
      |                           ^~~~
a.cc:73:26: error: expected ')' before 'long'
   73 |             if ((f[i][j]/ long long(pow(2,l)))%2==1) f[i][j]-=pow(2,l);
      |                 ~        ^~~~~
      |                          )
a.cc:73:71: error: expected ')' before ';' token
   73 |             if ((f[i][j]/ long long(pow(2,l)))%2==1) f[i][j]-=pow(2,l);
      |                ~                                                      ^
      |                                                                       )
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <deque>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL;

using namespace std;

bool can[51];
vector<int> a, b;

bool dp[51][51], flag[51][51];

bool memo(int a, int b) {
	if (a < b)
		return false;
	if (a == b)
		return true;
	if (flag[a][b])
		return dp[a][b];
	bool &ret = dp[a][b];
	ret = false;
	flag[a][b] = true;
	ffor (i, 1, 51)
		if (can[i])
			ret |= memo(a % i, b);
	return ret;
}

int N;

int main() {
	cin >> N;
	a.clear();
	b.clear();
	int x;
	FOR (i, N) {
		cin >> x;
		a.pb(x);
	}
	FOR (i, N) {
		cin >> x;
		b.pb(x);
	}

	bool ok = true;
	FOR (i, 51)
		can[i] = true;
	SET(flag, 0);
	FOR (i, N)
		ok &= memo(a[i], b[i]);
	if (!ok) {
		cout << "-1" << endl;
		return 0;
	}
	LL ret = 0LL;
	for (int i = 50; i > -1; i--) {
		SET(flag, 0);
		ok = true;
		can[i] = false;
		FOR (j, N)
			ok &= memo(a[j], b[j]);
		if (!ok) {
			can[i] = true;
			ret |= 1LL << i;
		}
	}
	cout << ret << endl;
  return 0;
}

Compiler output:
a.cc:18:1: error: 'vector' does not name a type
   18 | vector<int> a, b;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:42:9: error: 'a' was not declared in this scope
   42 |         a.clear();
      |         ^
a.cc:43:9: error: 'b' was not declared in this scope
   43 |         b.clear();
      |         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

constexpr int MOD = 1000000007;

using Long = long long;
template<typename T>
using V = vector<T>;
template<typename T>
using Vv = V<V<T>>;
using Vb = V<bool>;
using Vvb = V<Vb>;
using Vi = V<int>;
using Vvi = V<Vi>;
using Vl = V<Long>;
using Vvl = V<Vl>;
using Vd = V<double>;
using Vvd = V<Vd>;
using Vs = V<string>;

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (auto& x : v) {
        is >> x;
    }
    return is;
}

template <typename First, typename Second>
istream& operator>>(istream& is, pair<First, Second>& v) {
    for (auto& x : v) {
        is >> v.first >> v.second;
    }
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    for (const auto& x : v) {
        os << x << ' ';
    }
    return os;
}

// *** SOLUTION BEGIN ***

Long f(vector<int>& a, vector<int>& b) {
    int n = a.size();
    int mat[51][51] = {};
    for (int d = 0; d <= 50; ++d) {
        for (int s = d + 1; s <= 50; ++s) {
            for (int k = 1; k <= 50; ++k) {
                if (s % k == d || mat[s % k][d] > 0) {
                    mat[s][d] = k;
                    break;
                }
            }
        }
    }
    for (int i = 0; i < n; ++i) {
        if (a[i] != b[i] && !mat[a[i]][b[i]]) {
            return -1;
        }
    }
    set<int> used;
    while (true) {
        int maxK = 0;
        for (int i = 0; i < n; ++i) {
            if (a[i] != b[i]) {
                maxK = max(maxK, mat[a[i]][b[i]]);
            }
        }
        if (!maxK) {
            break;
        }
        for (int i = 0; i < n; ++i) {
            if (a[i] != b[i]) {
                if (minK == maxK) {
                    a[i] %= minK;
                }
            }
        }
        used.insert(maxK);
    }
    Long ans = 0;
    for (int k : used) {
        ans += 1ll << k;
    }
    return ans;
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    cin >> a >> b;
    cout << f(a, b);
}

// *** SOLUTION END ***

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(10);
    cout << fixed;
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'Long f(std::vector<int>&, std::vector<int>&)':
a.cc:79:21: error: 'minK' was not declared in this scope
   79 |                 if (minK == maxK) {
      |                     ^~~~
Language: C++

#include <iostream>
#define llint long long
#define inf (llint)(1e18)

using namespace std;

llint N;
llint a[55], b[55];
llint cost[55][55];

llint calc(llint i, llint j)
{
	if(cost[i][j] != -1) return cost[i][j];
	if(i == j) return cost[i][j] = 0;
	if(i < j) return cost[i][j] = inf;
	
	llint ret = inf;
	for(llint k = 1; k < i; k++){
		llint res = calc(i%k, j);
		if(res < inf) ret = min(ret, calc(i%k, j) + (1LL<<k));
	}
	return cost[i][j] = ret;
}

int main(void)
{
	cin >> N;
	for(llint i = 1; i <= N; i++) cin >> a[i];
	for(llint i = 1; i <= N; i++) cin >> b[i];
	
	for(int i = 0; i <= 50; i++){
		for(int j = 0; j <= 50; j++){
			cost[i][j] = -1;
		}
	}
	
	llint ans = 0;
	for(int i = 1; i <= N; i++){
		if(calc(a[i], b[i]) == inf){
			cout << -1 << endl;
			return 0;
		}
		ans |= calc(a[i]], b[i]]);
	}
	
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:33: error: expected ')' before ']' token
   43 |                 ans |= calc(a[i]], b[i]]);
      |                            ~    ^
      |                                 )
Language: C++

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

#define llong long long
#define inf 999999999
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<PP, int> PPP;
typedef struct data{
	int now;
	int cost;
}data;
int nh[4] = {1, 0, -1, 0};
int nw[4] = {0, 1, 0, -1};

int n, a[50], b[50], c[50];
vector<vector<int>> task[50];
unsigned llong int nijo[51];
void nj(){
	nijo[1]  = 2;
	for(int i = 2; i <= 50; i++){
		nijo[i] = nijo[i-1] * 2;
	}
	return;
}

int main(){
	nj();
	unsigned llong int sum = 0;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	vector<P> c;
	for(int i = 0; i < n; i++){
		cin >> b[i];
		c.pb(mp(b[i], i));
	}
	sort(c.begin(), c.end());
	int index = 0;
	while(++index){
		bool check = true;
		for(int i = 0; i < n; i++){
			if(a[i] != b[i]) check = false;
		}
		if(check){
			cout << sum << endl;
			return 0;
		}
		P use = c[index-1];
		if(a[use.second] == b[use.second]) continue;
		if(b[use.second] == 0){
			c.pb(use)
		}
		bool check2 = false;
		for(int i = b[use.second]+1; i < a[use.second]; i++){
			if(a[use.second]%i == b[use.second]){
				check2 = true;
				for(int j = 0; j < n; j++){
					if(a[j]%i >= b[j]){
						a[j] = a[j]%i;
					}
				}
				sum += nijo[i];
				break;
			}
		}
		if(check2 == false){
			cout << -1 << endl;
			return 0;
		}

	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:34: error: expected ';' before '}' token
   54 |                         c.pb(use)
      |                                  ^
      |                                  ;
   55 |                 }
      |                 ~
Language: C++

#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#define MAXN 50
using namespace std;
typedef long long ll;

int N;
int a[MAXN], b[MAXN];
pair<int, int> ab[MAXN];
ll ans;
vector<int> kset;
int minTemp;


bool bsort(pair<int, int> lhs, pair<int, int> rhs) {
	return lhs.second > rhs.second;
}

void calcCost(int a, int b, int n) {
	if (n >= kset.size()) {
		for (int i = b + 1; i < a; i++) {
			if ((a - b) % i == 0) {
				if (i < minTemp) {
					minTemp = i;
				}
			}
		}
	}
	else if (kset[n] <= b) {
		calcCost(a, b, n + 1);
	}
	else if (kset[n] >= a) {
		for (int i = b + 1; i < a; i++) {
			if ((a - b) % i == 0) {
				if (i < minTemp) {
					minTemp = i;
				}
			}
		}
	}
	else {
		if (a%kset[n] == b) {
			minTemp = 0;
			return;
		}
		else if (a%kset[n] > b) {
			calcCost(a%kset[n], b, n + 1);
		}
		calcCost(a, b, n + 1);
	}
}

bool getCost(int a, int b) {
	if (a == b) return true;
	minTemp = 999;
	sort(kset.begin(), kset.end());
	calcCost(a, b, 0);
	if (minTemp != 999) {
		if(minTemp!=0) kset.push_back(minTemp);
		return true;
	}
	else {
		return false;
	}
}

int main() {
	cin >> N;
	ans = 0;

	for (int i = 0; i < N; i++) {
		cin >> ab[i].first;
	}
	for (int i = 0; i < N; i++) {
		cin >> ab[i].second;
	}

	sort(ab, ab + N, bsort);

	for (int i = 0; i < N; i++) {
		if (!getCost(ab[i].first, ab[i].second)) {
			cout << -1 << endl;
			return 0;
		}
	}

	for (int i = 0; i < kset.size(); i++) {
		ans += pow(2, kset[i]);
	}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:90:24: error: 'pow' was not declared in this scope
   90 |                 ans += pow(2, kset[i]);
      |                        ^~~
Language: C++

#include <iostream>
#define llint long long
#define inf (llint)(1e18)

using namespace std;

llint N;
llint a[55], b[55];
llint cost[55][55];

llint calc(llint i, llint j)
{
	if(cost[i][j] != -1) return cost[i][j];
	if(i == j) return cost[i][j] = 0;
	if(i < j) return cost[i][j] = inf;
	
	llint ret = inf;
	for(llint k = 1; k < i; k++){
		llint res = calc(i%k, j);
		if(res < inf) ret = min(ret, calc(i%k, j) + (1LL<<k));
	}
	return cost[i][j] = ret;
}

int main(void)
{
	cin >> N;
	for(llint i = 1; i <= N; i++) cin >> a[i];
	for(llint i = 1; i <= N; i++) cin >> b[i];
	
	for(int i = 0; i <= 50; i++){
		for(int j = 0; j <= 50; j++){
			cost[i][j] = -1;
		}
	}
	
	llint ans = 0;
	for(int i = 1; i <= N; i++){
		if(calc(a[i], b[i]) == inf){
			cout << -1 << endl;
			return 0;
		}
		ans |= calc(a[i]], [b[i]]);
	}
	
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:33: error: expected ')' before ']' token
   43 |                 ans |= calc(a[i]], [b[i]]);
      |                            ~    ^
      |                                 )
Language: C++

#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <memory.h>
#include <algorithm>
#include <cassert>

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define ford(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define all(c) (c).begin(), (c).end()
#define sz(c) int((c).size())
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
#define fst first
#define snd second

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using ull = unsigned long long;

#define FNAME "a"

#ifdef LOCAL
#define eprintf(args...) fprintf(stderr, args), fflush(stderr);
#else
#define eprintf(args...) ;
#endif

int n;
vi a;
vi b;

bool read() {
    if  (!(cin >> n)) {
        return 0;
    }
    a.resize(n);
    b.resize(n);
    forn(i, n) {
        cin >> a[i];
    }
    forn(i, n) {
        cin >> b[i];
    }
    return 1;
}

const int MAX = 50;

bool bit(ull mask, int i) {
    return (mask >> i) & 1;
}

bool can(int from, int to, ull mask) {
    bitset<MAX + 1> dp;
    dp[from] = 1;
    for (int k = MAX; k >= 1; --k) {
        if  (!bit(mask, k)) {
            continue;
        }
        for (int val = MAX; val >= to; --val) {
            if  (dp[val]) {
                dp[val % k] = 1;
            }
        }
    }
    return dp[to];
}

bool can(ull mask) {
    forn(i, n) {
        if  (!can(a[i], b[i], mask)) {
            return 0;
        }
    }
    return 1;
}

ull go(ull have) {
    if  (can(have)) {
        return have;
    }
    forn(i, MAX + 1) {
        assert(!bit(have, i));

        ull cand = have;
        forn(j, i + 1) {
            cand ^= 1ull << j;
        }
        if  (can(cand)) {
            have ^= 1ull << i;
            return go(have);
        }
    }
    return -1;
}

void solve() {
    ull ans = go(1ull << (MAX + 1));

    if  (ans == -1) {
        cout << -1 << endl;
        return;
    }

    ull cost = 0;
    for (int k = 1; k <= MAX; ++k) {
        if  (bit(ans, k)) {
            cost += 1ull << k;
        }
    }

    cout << cost << endl;
}

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

#ifdef LOCAL
    freopen(FNAME ".in", "r", stdin);
    freopen(FNAME ".out", "w", stdout);
#endif

    while (read()) {
        solve();
    }

    return 0;
}


Compiler output:
a.cc: In function 'bool can(int, int, ull)':
a.cc:64:5: error: 'bitset' was not declared in this scope
   64 |     bitset<MAX + 1> dp;
      |     ^~~~~~
a.cc:12:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   11 | #include <cassert>
  +++ |+#include <bitset>
   12 | 
a.cc:64:21: error: 'dp' was not declared in this scope; did you mean 'mp'?
   64 |     bitset<MAX + 1> dp;
      |                     ^~
      |                     mp
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
int n = 0, l = 0, pos[300500], tim[300500], ans = 0;
bool delt[300500], fir[300500], sec[300500];
signed main() {
	ios::sync_with_stdio(false);
	cin >> n >> l; ans = n + 1;
	for(int i = 1; i <= n; i++) {
		cin >> pos[i];
	} for(int i = 1; i <= n; i++) {
		cin >> tim[i];
		ans += (tim[i] / (l * 2)) , tim[i] %= (l * 2);
		if(tim[i] == 0) {
			ans--, del[i] = true;
			continue;
		}
		fir[i] = (2 * (l - pos[i]) >= t[i]);
		sec[i] = (2 * pos[i] >= t[i]);
		del[i] = not (fir[i] or sec[i]);
	}
	ans -= lef[n];
	int sum = 0, top = 0, pos = n;
	for(int i = 1; i < n; i++) {
		if(del[i]) continue;
		if(not fir[i]) {
			pos = i;
			break;
		}
		if(sec[i]) {
			top++;
		} else {
			if(top) {
				top--, ans--;
			}
		}
	}
	sum += top, top = 0;
	for(int i = n - 1, i >= pos; i--) {
		if(del[i]) continue;
		if(not sec[i]) break;
		if(fir[i]) {
			top++;
		} else {
			if(top) {
				top--, ans--;
			}
		}
	}
	ans -= (sum + top) / 2;
	cout << 2 * l * ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:32: error: 'del' was not declared in this scope; did you mean 'delt'?
   15 |                         ans--, del[i] = true;
      |                                ^~~
      |                                delt
a.cc:18:47: error: 't' was not declared in this scope
   18 |                 fir[i] = (2 * (l - pos[i]) >= t[i]);
      |                                               ^
a.cc:20:17: error: 'del' was not declared in this scope; did you mean 'delt'?
   20 |                 del[i] = not (fir[i] or sec[i]);
      |                 ^~~
      |                 delt
a.cc:22:16: error: 'lef' was not declared in this scope
   22 |         ans -= lef[n];
      |                ^~~
a.cc:25:20: error: 'del' was not declared in this scope; did you mean 'delt'?
   25 |                 if(del[i]) continue;
      |                    ^~~
      |                    delt
a.cc:39:29: error: expected ';' before '>=' token
   39 |         for(int i = n - 1, i >= pos; i--) {
      |                             ^~~
      |                             ;
a.cc:39:30: error: expected primary-expression before '>=' token
   39 |         for(int i = n - 1, i >= pos; i--) {
      |                              ^~
a.cc:40:20: error: 'del' was not declared in this scope; did you mean 'delt'?
   40 |                 if(del[i]) continue;
      |                    ^~~
      |                    delt
Language: C++

#include<cstdio>
#include<iostream>
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long LL;
const int maxn=300000+50;
int n,L;
int t[maxn];
int x[maxn];
bool mark[maxn];
int solve()
{
	int an=n;
	for(int i=1;i<=n;++i)
	{
		an+=t[i]/(L<<1);
		t[i]%=(L<<1);
		if(t[i]==0)
		{
			--an;
			mark[i]=1;
		}
		else
		{
			le[i]=(x[i]<<1)>=t[i];
			ri[i]=((L-x[i])<<1)>=t[i];
			if(!le[i]&&!ri[i])
			{
				mark[i]=1;
			}
		}
	}
	int p=1;
	while(p<n&&!(le[p]==1&&ri[p]==0))
	{
		++p;
	} 
	int tot=0,top=0;
	for(int i=1;i<p;++i) if(!mark[i])
	{
		if(!le[i])
		{
			if(top)
			{
				--top,--an;
			}
		}
		else
		{
			++top;
		}
	}
	tot+=top,top=0;
	for(int i=n-1;i>=p;--i) if(!mark[i])
	{
		if(!ri[i])
		{
			if(top)
			{
				--top,--an;
			}
		}
		else
		{
			++top;
		}
	}
	tot+=top;
	an-=tot>>1;
	if(!ri[n]) ++an;
	return an;
}
int main()
{
	scanf("%d%d",&n,&L);
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&x[i]);
	}
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&t[i]);
	}
	printf("%lld\n",(LL)solve()*(L<<1));
	return 0;
} 

Compiler output:
a.cc: In function 'int solve()':
a.cc:25:25: error: 'le' was not declared in this scope
   25 |                         le[i]=(x[i]<<1)>=t[i];
      |                         ^~
a.cc:26:25: error: 'ri' was not declared in this scope; did you mean 'i'?
   26 |                         ri[i]=((L-x[i])<<1)>=t[i];
      |                         ^~
      |                         i
a.cc:34:22: error: 'le' was not declared in this scope
   34 |         while(p<n&&!(le[p]==1&&ri[p]==0))
      |                      ^~
a.cc:34:32: error: 'ri' was not declared in this scope
   34 |         while(p<n&&!(le[p]==1&&ri[p]==0))
      |                                ^~
a.cc:41:21: error: 'le' was not declared in this scope
   41 |                 if(!le[i])
      |                     ^~
a.cc:56:21: error: 'ri' was not declared in this scope; did you mean 'i'?
   56 |                 if(!ri[i])
      |                     ^~
      |                     i
a.cc:70:13: error: 'ri' was not declared in this scope
   70 |         if(!ri[n]) ++an;
      |             ^~
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;
int n, L, D[301000], ee, TD[301000];
long long S;
struct point {
	int x, t;
}w[301000];
int main() {
	int i, j;
	scanf("%d%d", &n, &L)
      if(n>3000)return 0;
	for (i = 1; i <= n; i++) scanf("%d", &w[i].x);
	for (i = 1; i <= n; i++) scanf("%d", &w[i].t);
	for (i = 1; i <= n; i++) {
		int tt = (w[i].t-1) / (2 * L) * (2 * L);
		S += tt;
		w[i].t -= tt;
		int ck = 0;
		if (w[i].t <= w[i].x * 2)ck |= 1;
		if (w[i].t <= (L - w[i].x) * 2)ck |= 2;
		for (j = 0; j <= ee + 4; j++)TD[j] = 1e9;
		if (ck != 2) {
			for (j = 0; j <= ee; j++) {
				TD[j + 2] = min(TD[j + 2], D[j] + 2);
			}
		}
		if (ck == 0) {
			ee+=2;
			for (j = 0; j <= ee; j++) {
				D[j] = TD[j];
				TD[j] = 1e9;
			}
		}
		if (ck == 1) {
			ee += 2;
			for (j = 0; j <= ee; j++) {
				D[j] = TD[j];
			}
		}
		for (j = 0; j <= ee; j++) {
			TD[j] = min(TD[j], D[j] + 1);
			if(j)TD[j - 1] = min(TD[j - 1], D[j]);
			if (j >= 3)TD[j - 2] = min(TD[j - 2], D[j] - 1);
		}
		int te = 0;
		for (j = 0; j <= ee + 2; j++) {
			D[j] = TD[j];
			if (D[j] < 1e9)te = j;
		}
		ee = te;
	}
	int M = 1e9;
	for (i = 0; i <= ee; i++)M = min(M, D[i]);
	S += 1ll * M * 2 * L;
	printf("%lld\n", S);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:30: error: expected ';' before 'if'
   11 |         scanf("%d%d", &n, &L)
      |                              ^
      |                              ;
   12 |       if(n>3000)return 0;
      |       ~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=301000;
int n,L;
int x[N],t[N];
ll val[N][2][2],nc[N];
int dp[N][N],ret,v0[N],v1[N];
int main() {
	scanf("%d%d",&n,&L);
//	n=1000; L=100000;
	rep(i,1,n+1) scanf("%d",x+i);
	rep(i,1,n+1) scanf("%d",t+i);
//	rep(i,1,n+1) x[i]=rand()%L+1; sort(x+1,x+n+1);
//	rep(i,1,n+1) t[i]=rand()%1000000+1;
	rep(i,1,n+1) rep(p1,0,2) rep(p2,0,2) {
		ll r1=p1==0?x[i]:2*L-x[i];
		ll r2=p2==0?x[i]:2*L-x[i];
		r1=(r1+t[i])%(2*L);
		val[i][p1][p2]=t[i]+((r1<=r2)?r2-r1:r2+2*L-r1);
	}
	rep(i,1,n+1) {
		nc[i]=min(val[i][0][0],val[i][1][1]);
		val[i][1][0]-=2*x[i];
		val[i][0][1]+=2*x[i];
		nc[i]/=(2*L); val[i][1][0]/=(2*L); val[i][0][1]/=(2*L);
	}
	ret+=val[n][0][1];
	rep(i,1,n+1) {
		ret+=val[i][1][0];
		v0[i]=nc[i]-val[i][1][0];
		v1[i]=val[i][0][1]-val[i][1][0];
//		printf("%lld %lld\n",val[i][0][1],nc[i]);
	}
//	printf("%d\n",ret);
	rep(i,0,n+1) rep(j,0,i+1) dp[i][j]=1<<30;
	dp[0][0]=0;
	int p1=-1,p2=-1;;
	rep(i,0,n-1) {
		if (v0[i]==1&&v1[i]==2) p1++,p2++;
		else if (v0[i]==1&&v1[i]==1) p1=-1,p2++;
		else if (v0[i]==0&&v1[i]==0) p1=-1,p2=-1;
	}
	if (p2>=0) ret+=2; else if (p1>=0) ret+=1;
	printf("%lld\n",ret*2ll*L);
}

Compiler output:
/tmp/ccCN3X44.o: in function `main':
a.cc:(.text+0x5b1): relocation truncated to fit: R_X86_64_PC32 against symbol `ret' defined in .bss section in /tmp/ccCN3X44.o
a.cc:(.text+0x5b9): relocation truncated to fit: R_X86_64_PC32 against symbol `ret' defined in .bss section in /tmp/ccCN3X44.o
a.cc:(.text+0x5e4): relocation truncated to fit: R_X86_64_PC32 against symbol `ret' defined in .bss section in /tmp/ccCN3X44.o
a.cc:(.text+0x5ec): relocation truncated to fit: R_X86_64_PC32 against symbol `ret' defined in .bss section in /tmp/ccCN3X44.o
a.cc:(.text+0x639): relocation truncated to fit: R_X86_64_PC32 against symbol `v0' defined in .bss section in /tmp/ccCN3X44.o
a.cc:(.text+0x688): relocation truncated to fit: R_X86_64_PC32 against symbol `v1' defined in .bss section in /tmp/ccCN3X44.o
a.cc:(.text+0x72e): relocation truncated to fit: R_X86_64_PC32 against symbol `v0' defined in .bss section in /tmp/ccCN3X44.o
a.cc:(.text+0x74a): relocation truncated to fit: R_X86_64_PC32 against symbol `v1' defined in .bss section in /tmp/ccCN3X44.o
a.cc:(.text+0x773): relocation truncated to fit: R_X86_64_PC32 against symbol `v0' defined in .bss section in /tmp/ccCN3X44.o
a.cc:(.text+0x78f): relocation truncated to fit: R_X86_64_PC32 against symbol `v1' defined in .bss section in /tmp/ccCN3X44.o
a.cc:(.text+0x7b8): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<stdio.h>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long ll;

const ll mod=1e9+7;
const int maxn=300050;

char a[maxn];
ll f[maxn][4][4];
int s[maxn],tail;


int main()
{
	gets(a);
	f[0][0][0]=1;
	int n=strlen(a);
	for(register int i=1;i<=n;++i)
		if(a[i-1]=='1')
		{
			f[i][1][0]+=f[i-1][0][0]+f[i-1][1][1],f[i][1][0]%=mod;
			f[i][0][0]+=f[i-1][0][1],f[i][0][0]%=mod;
			f[i][2][0]+=f[i-1][2][1]+f[i-1][1][0]+f[i-1][2][0],f[i][2][0]%=mod;
			f[i][2][1]+=f[i-1][2][2],f[i][2][1]%=mod;
			f[i][1][1]+=f[i-1][1][2],f[i][1][1]%=mod;
			f[i][0][1]+=f[i-1][0][2],f[i][0][1]%=mod;
		}
		else if(a[i-1]=='0')
		{
			f[i][0][1]+=f[i-1][0][0]+f[i-1][0][2],f[i][0][1]%=mod;
			f[i][0][2]+=f[i-1][0][1],f[i][0][2]%=mod;
			f[i][1][1]+=f[i-1][1][0]+f[i-1][1][2],f[i][1][1]%=mod;
			f[i][2][1]+=f[i-1][2][0]+f[i-1][2][2],f[i][2][1]%=mod;
			f[i][1][2]+=f[i-1][1][1],f[i][1][2]%=mod;
			f[i][2][2]+=f[i-1][2][1],f[i][2][2]%=mod;
		}
		else 
		{
			f[i][1][0]+=f[i-1][0][0]+f[i-1][1][1],f[i][1][0]%=mod;
			f[i][0][0]+=f[i-1][0][1],f[i][0][0]%=mod;
			f[i][2][0]+=f[i-1][2][1]+f[i-1][1][0]+f[i-1][2][0],f[i][2][0]%=mod;
			f[i][2][1]+=f[i-1][2][2],f[i][2][1]%=mod;
			f[i][1][1]+=f[i-1][1][2],f[i][1][1]%=mod;
			f[i][0][1]+=f[i-1][0][2],f[i][0][1]%=mod;
			f[i][0][1]+=f[i-1][0][0]+f[i-1][0][2],f[i][0][1]%=mod;
			f[i][0][2]+=f[i-1][0][1],f[i][0][2]%=mod;
			f[i][1][1]+=f[i-1][1][0]+f[i-1][1][2],f[i][1][1]%=mod;
			f[i][2][1]+=f[i-1][2][0]+f[i-1][2][2],f[i][2][1]%=mod;
			f[i][1][2]+=f[i-1][1][1],f[i][1][2]%=mod;
			f[i][2][2]+=f[i-1][2][1],f[i][2][2]%=mod;

		}	
	printf("%lld\n",(f[n][1][1]+f[n][2][2]+f[n][0][0]+f[n][1][0]+f[n][2][0]+f[n][2][1])%mod);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   19 |         gets(a);
      |         ^~~~
      |         getw
a.cc:22:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |         for(register int i=1;i<=n;++i)
      |                          ^
Language: C++

#include <bits/stdc++.h>
#define N 300010
#define mod 1000000007
const int t[2][9]={{1,3,4,1,6,7,4,8,7},{2,0,5,1,2,5,4,5,7}};
int dp[N][10];
char s[N];
void dec(int &x){
	x+=x>>31&mod;
}
signed main(){
	scanf("%s",s+1);
	int len=strlen(s+1);
	dp[0][0]=1;
	for (int i=1;i<=len;++i){
		for (int j=0;j<=8;++j){
			if (s[j]!='1') dec(dp[i][t[0][j]]+=dp[i-1][j]-mod);
			if (s[j]!='0') dec(dp[i][t[1][j]]+=dp[i-1][j]-mod);
		}
	}
	dec(dp[len][5]+=dp[len][7]-mod);
	dec(dp[len][5]+=dp[len][8]-mod);
	dec(dp[len][5]+=dp[len][2]-mod);
	cout<<dp[len][5]<<endl;
	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   23 |         cout<<dp[len][5]<<endl;
      |         ^~~~
      |         std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:23:27: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   23 |         cout<<dp[len][5]<<endl;
      |                           ^~~~
      |                           std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: Java

package codes;

import FastIO.InputReader;
import FastIO.OutputWriter;

public class EMedianReplace {
	static int MOD = 1000000007;
	public void solve(int testNumber, InputReader in, OutputWriter out) {
		String s = in.nextString();
		int n = s.length();

		int[] suf = new int[n + 1];
		for(int i = n - 1; i >= 0; --i) {
			suf[i] = suf[i + 1];
			if(s.charAt(i) == '?') suf[i]++;
		}

		int[] pw2 = new int[n + 1];

		pw2[0] = 1;
		for(int i = 1; i <= n; ++i) {
			pw2[i] = (pw2[i - 1] * 2) % MOD;
		}

		long ans = 0;
		long[][][][] dp = new long[n + 1][3][3][3];

		dp[0][0][0][0] = 1;
		for(int i = 0; i < n; ++i) {
			/// first take out all the countone = 2 shit
			for(int countZero = 0; countZero < 3; ++countZero) {
				for(int countOne = 0; countOne < 3; ++countOne) {
					ans += dp[i][2][countZero][countOne] * pw2[suf[i]] % MOD;
					ans %= MOD;
					dp[i][2][countZero][countOne] = 0;
				}
			}
			for(int prefix = 0; prefix < 2; ++prefix) {
				for (int countZero = 0; countZero < 3; ++countZero) {
					for (int countOne = 0; countOne + countZero < 3; ++countOne) {
						if (dp[i][prefix][countZero][countOne] == 0) continue;


						if (s.charAt(i) == '1' || s.charAt(i) == '?') {
							int newprefix = prefix;
							int newCountZero = countZero;
							int newCountOne = countOne + 1;
							if (newCountOne + newCountZero == 3) {
								newCountOne--;
								newCountZero--;
							}
							if(newCountOne == 1 && newCountZero == 0) {
								newprefix++;
								newCountOne = 0;
								newCountZero = 0;



							}

							dp[i + 1][newprefix][newCountZero][newCountOne] += dp[i][prefix][countZero][countOne];
							dp[i + 1][newprefix][newCountZero][newCountOne] %= MOD;
						}
						if (s.charAt(i) == '0' || s.charAt(i) == '?') {
							int newCountZero = countZero + 1;
							int newCountOne = countOne;
							if (newCountOne + newCountZero == 3) {
								if (newCountZero == 3) {
									newCountZero = 1;
								} else {
									newCountOne--;
									newCountZero--;
								}
							}
							dp[i + 1][prefix][newCountZero][newCountOne] += dp[i][prefix][countZero][countOne];
							dp[i + 1][prefix][newCountZero][newCountOne] %= MOD;
						}
					}
				}
			}
		}


		ans += dp[n][1][0][0];
		ans %= MOD;

		ans += dp[n][1][1][1];
		ans %= MOD;

		out.println(ans);
	}
}


Compiler output:
Main.java:6: error: class EMedianReplace is public, should be declared in a file named EMedianReplace.java
public class EMedianReplace {
       ^
Main.java:3: error: package FastIO does not exist
import FastIO.InputReader;
             ^
Main.java:4: error: package FastIO does not exist
import FastIO.OutputWriter;
             ^
Main.java:8: error: cannot find symbol
	public void solve(int testNumber, InputReader in, OutputWriter out) {
	                                  ^
  symbol:   class InputReader
  location: class EMedianReplace
Main.java:8: error: cannot find symbol
	public void solve(int testNumber, InputReader in, OutputWriter out) {
	                                                  ^
  symbol:   class OutputWriter
  location: class EMedianReplace
5 errors
Language: C++

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
using namespace std;
const int N=1e6+11,mod=1e9+7;
int go[8][2]={{2,1},{4,3},{6,5},{3,3},{7,1},{2,1},{2,2},{4,4}};
int f[N][9];
char s[N];
int n;
inline void inc(int &x,int y){
	x+=y;
	if(x>=mod)
		x-=mod;
}
int main(){
	f[0][0]=1;
	gets(s+1);
	n=strlen(s+1);
	rep(i,1,n){
		rep(j,0,8){
			if(s[i]!='0')
				inc(f[i][go[j][1]],f[i-1][j]);
			if(s[i]!='1')
				inc(f[i][go[j][0]],f[i-1][j]);
		}
	}
	printf("%d\n",(f[n][1]+f[n][3])%mod);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   19 |         gets(s+1);
      |         ^~~~
      |         getw
a.cc:21:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |         rep(i,1,n){
      |             ^
a.cc:5:37: note: in definition of macro 'rep'
    5 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
a.cc:22:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |                 rep(j,0,8){
      |                     ^
a.cc:5:37: note: in definition of macro 'rep'
    5 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
Language: C++

#include<cstdio>
#include<algorithm>
#include<cstring>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
using namespace std;
const int N=1e6+11,mod=1e9+7;
int go[8][2]={{2,1},{4,3},{6,5},{3,3},{7,1},{2,1},{2,2},{4,4}};
int f[N][9];
char s[N];
int n;
inline void inc(int &x,int y){
	x+=y;
	if(x>=mod)
		x-=mod;
}
int main(){
	f[0][0]=1;
	gets(s+1);
	n=strlen(s+1);
	rep(i,1,n){
		rep(j,0,8){
			if(s[i]!='0')
				inc(f[i][go[j][1]],f[i-1][j]);
			if(s[i]!='1')
				inc(f[i][go[j][0]],f[i-1][j]);
		}
	}
	printf("%d\n",(f[n][1]+f[n][3])%mod);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   18 |         gets(s+1);
      |         ^~~~
      |         getw
a.cc:20:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         rep(i,1,n){
      |             ^
a.cc:4:37: note: in definition of macro 'rep'
    4 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
a.cc:21:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |                 rep(j,0,8){
      |                     ^
a.cc:4:37: note: in definition of macro 'rep'
    4 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
Language: C++

16
1 39877
1 76497
2
1 6377
5
1 89598
2
4
1 19134
1 9735
1 95248
1 95239
4
1 46204
1 13054
1 78838

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 16
      | ^~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <sstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define SZ(x) (int)(x.size())
#define F0(i,n) for(int i=0;i<n;i++)
#define F1(i,n) for(int i=1;i<=n;i++)
const int MOD = 1000000007;
const double pi = atan(1.0)*4.0;
const double eps = 1e-8;
ll gcd(ll x, ll y) { return y ? gcd(y, x%y) : x; }
int bc(int n) { return n ? bc((n - 1)&n) + 1 : 0; }

const int N = 300001;
int i, j, k, m, n, l;

void upd(int& x, int y) {
	x += y;
	if (x >= MOD) x -= MOD;
}
bool ok(char c, int x) {
	return c == '?' || c == x + '0';
}
string s;
int dp[N][2][2];
int o0[2][2][2][2], o1[2][2][2][2];
int q[N], p[N];
int ans;

int main() {
	//freopen("x.in", "r", stdin);

	vector<string> pre = { "00", "01", "00", "01", "00", "01", "01", "11", "10", "01", "10", "11", "10", "11", "11", "11" };
	int k = 0;
	F0(i0, 2) F0(i1, 2) F0(j0, 2) F0(j1, 2) {
		o0[i0][i1][j0][j1] = pre[k][0] - '0';
		o1[i0][i1][j0][j1] = pre[k][1] - '0';
		k++;
	}

	p[0] = 1;
	F1(i, N - 1) p[i] = (p[i - 1] * 2) % MOD;
	while (cin >> s) {
		n = SZ(s);
		memset(dp, 0, sizeof(dp));
		memset(q, 0, sizeof(q));

		F1(i, n) q[i] = q[i - 1] + (s[i - 1] == '?');

		if (n == 1) {
			ans = s[0] != '0';
		}
		else {
			ans = 0;
			F0(j0, 2) F0(j1, 2) if (ok(s[n - 2], j0) && ok(s[n - 1], j1)) upd(dp[n - 2][j0][j1], 1);
			for (int i = n - 2; i >= 1; i -= 2) F0(j0, 2) F0(j1, 2) if (dp[i][j0][j1]) {
				int v = dp[i][j0][j1];
				if (i == 1) continue;
				if (j0 && j1) {
					upd(ans, 1LL * p[q[i]] * v % MOD);
					continue;
				}
				F0(i0, 2) F0(i1, 2) if (ok(s[i - 2], i0) && ok(s[i - 1], i1)) {
					upd(dp[i - 2][o0[i0][i1][j0][j1]][o1[i0][i1][j0][j1]], v);
				}
			}
			F0(i, 2) if (ok(s[0], i)) F0(i0, 2) F0(i1, 2) if (i + i0 + i1 >= 2) upd(ans, dp[1][i0][i1]);
		}
		cout << ans << endl;
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:17: error: 'memset' was not declared in this scope
   55 |                 memset(dp, 0, sizeof(dp));
      |                 ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include <sstream>
  +++ |+#include <cstring>
   12 | using namespace std;