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

import java.io.*;

public class Main{
	public static void main(String[] args){
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = BufferedReader(is);
		
		String str = br.readLine();
		int kosuu = Integer.perseInt(str);
		int[] A = new int[kosuu];//配列の宣言の仕方自信なし
		int m = 2000000000, M = 0;
		int kei = 0;
		int kei1 = 0, kei2 = 0, kei3 = 0;//3つの切り分けた領域の合計を表す
		
		for(int i = 0; i < kosuu; i++){
			str = br.readLine()
			A[i] = Integer.perseInt(str)//引数に戻り値のあるメソッドを指定してよいかわからない
		}
		
		for(int i = 1; i < kosuu; i++){
			for(int j = i + 1; j < kosuu + 1; j++){
				for(int k = j + 1; k < kosuu + 2; k++){
					for(int i2 = 0; i2 < i; i2++) kei1 = kei1 + A[i2];
					if(m > kei1) m = kei1;
					for(int j2 = i; j2 < j; j2++) kei2 = kei2 + A[j2];
					if(m > kei2) m = kei2;
					for(int k2 = j; k2 < k; k2++) kei3 = kei3 + A[k2];
					if(m > kei3) m = kei3;
			
					if(m > M) M = m;
				}
			}
		}
		System.out.println(M);
	}
}


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

import java.io.*;

public class Main{
	public static void main(String[] args){
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = BufferedReader(is);
		
		String str = br.readLine();
		int kosuu = Integer.perseInt(str);
		int[] A = new int[kosuu];//配列の宣言の仕方自信なし
		int m = 2000000000, M = 0;
		int kei = 0;
		int kei1 = 0, kei2 = 0, kei3 = 0;//3つの切り分けた領域の合計を表す
		
		for(int i = 0; i < kosuu; i++){
			str = br.readLine();
			A[i] = Integer.perseInt(str);//引数に戻り値のあるメソッドを指定してよいかわからない
		}
		
		for(int i = 1; i < kosuu; i++){
			for(int j = i + 1; j < kosuu + 1; j++){
				for(int k = j + 1; k < kosuu + 2; k++){
					for(int i2 = 0; i2 < i; i2++) kei1 = kei1 + A[i2];
					if(m > kei1) m = kei1;
					for(int j2 = i; j2 < j; j2++) kei2 = kei2 + A[j2];
					if(m > kei2) m = kei2;
					for(int k2 = j; k2 < k; k2++) kei3 = kei3 + A[k2];
					if(m > kei3) m = kei3;
			
					if(m > M) M = m;
				}
			}
		}
		System.out.println(M);
	}
}


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

import java.io.*;

public class Main{
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);
		
		String str = br.readLine();
		int N = Integer.parseInt(str);
		int[] A = new int[N];
		int m = 2000000000, M = 0;
		int kei = 0;
		int kei1 = 0, kei2 = 0, kei3 = 0;//3つの切り分けた領域の合計を表す
		int tmp;
		
		for(int i = 0; i < N; i++){
			str = br.readLine();
			A[i] = Integer.parseInt(str);
		}
		
		//主処理
		for(int n = 0; n < N; n++){
			for(int i = 1; i < N; i++){
				for(int j = i + 1; j < N + 1; j++){
						for(int i2 = 1; i2 <= i; i2++) kei1 = kei1 + A[i2 - 1];
						if(m > kei1) m = kei1;
						for(int j2 = i + 1; j2 <= j; j2++) kei2 = kei2 + A[j2 - 1];
						if(m > kei2) m = kei2;
						for(int k2 = j + 1; k2 <= N; k2++) kei3 = kei3 + A[k2 - 1];
						if(m > kei3) m = kei3;
						
						if(m > M) M = m;
						
						kei1 = 0;
						kei2 = 0;
						kei3 = 0;
						m = 2000000000;
				}
			}
			//1番目に切れ込みを入れるパターンしか計算されないので、バウムクーヘンを回す(配列を循環させる）
			tmp = A[0];
			for(int n2 = 0; n2 < N - 1; n2++) A[n2] = A[n2 + 1];
			A[N - 1] =tmp;
		}
		System.out.println(M);
	}
}


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

import java.io.*;

public class Main{
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);
		
		String str = br.readLine();
		int N = Integer.parseInt(str);
		int[] A = new int[N];
		long m = 200000000000, M = 0;
		int kei = 0;
		int kei1 = 0, kei2 = 0, kei3 = 0;//3つの切り分けた領域の合計を表す
		int tmp;
		
		for(int i = 0; i < N; i++){
			str = br.readLine();
			A[i] = Integer.parseInt(str);
		}
		
		//主処理
		for(int n = 0; n < N; n++){
			for(int i = 1; i < N; i++){
				for(int j = i + 1; j < N + 1; j++){
						for(int i2 = 1; i2 <= i; i2++) kei1 = kei1 + A[i2 - 1];
						if(m > kei1) m = kei1;
						for(int j2 = i + 1; j2 <= j; j2++) kei2 = kei2 + A[j2 - 1];
						if(m > kei2) m = kei2;
						for(int k2 = j + 1; k2 <= N; k2++) kei3 = kei3 + A[k2 - 1];
						if(m > kei3) m = kei3;
						
						if(m > M) M = m;
						
						kei1 = 0;
						kei2 = 0;
						kei3 = 0;
						m = 200000000000;
				}
			}
			//1番目に切れ込みを入れるパターンしか計算されないので、バウムクーヘンを回す(配列を循環させる）
			tmp = A[0];
			for(int n2 = 0; n2 < N - 1; n2++) A[n2] = A[n2 + 1];
			A[N - 1] =tmp;
		}
		System.out.println(M);
	}
}


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

import java.io.*;

public class Main{
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);
		
		String str = br.readLine();
		int N = Integer.parseInt(str);
		int[] A = new int[N];
		long m = 20000000000, M = 0;
		int kei = 0;
		int kei1 = 0, kei2 = 0, kei3 = 0;//3つの切り分けた領域の合計を表す
		int tmp;
		
		for(int i = 0; i < N; i++){
			str = br.readLine();
			A[i] = Integer.parseInt(str);
		}
		
		//主処理
		for(int n = 0; n < N; n++){
			for(int i = 1; i < N; i++){
				for(int j = i + 1; j < N + 1; j++){
						for(int i2 = 1; i2 <= i; i2++) kei1 = kei1 + A[i2 - 1];
						if(m > kei1) m = kei1;
						for(int j2 = i + 1; j2 <= j; j2++) kei2 = kei2 + A[j2 - 1];
						if(m > kei2) m = kei2;
						for(int k2 = j + 1; k2 <= N; k2++) kei3 = kei3 + A[k2 - 1];
						if(m > kei3) m = kei3;
						
						if(m > M) M = m;
						
						kei1 = 0;
						kei2 = 0;
						kei3 = 0;
						m = 20000000000;
				}
			}
			//1番目に切れ込みを入れるパターンしか計算されないので、バウムクーヘンを回す(配列を循環させる）
			tmp = A[0];
			for(int n2 = 0; n2 < N - 1; n2++) A[n2] = A[n2 + 1];
			A[N - 1] =tmp;
		}
		System.out.println(M);
	}
}


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

import java.io.*;

public class Main{
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);
		
		String str = br.readLine();
		int N = Integer.parseInt(str);
		long[] A = new long[N];
		long m = 1000000000000L, M = 0L;
		long tmp;
		long kei1 = 0L, kei2 = 0L, kei3 = 0L;//3つの切り分けた領域の合計を表す
		
		for(int i = 0; i < N; i++){
			str = br.readLine();
			A[i] = Integer.parseInt(str);
		}
		
		//主処理
		for(int n = 0; n < N; n++){
			for(int i = 1; i < N; i++){
				for(int j = i + 1; j < N + 1; j++){
						for(int i2 = 1; i2 <= i; i2++) kei1 = kei1 + A[i2 - 1];
						if(m > kei1) m = kei1;
						for(int j2 = i + 1; j2 <= j; j2++) kei2 = kei2 + A[j2 - 1];
						if(m > kei2) m = kei2;
						for(int k2 = j + 1; k2 <= N; k2++) kei3 = kei3 + A[k2 - 1];
						if(m > kei3) m = kei3;
						
						if(m > M) M = m;
						
						kei1 = 0;
						kei2 = 0;
						kei3 = 0;
						m = 2000000000000L;
				}
			}
			//1番目に切れ込みを入れるパターンしか計算されないので、バウムクーヘンを回す(配列を循環させる）
			tmp = A[0];
			for(int n2 = 0; n2 < N - 1; n2++) A[n2] = A[n2 + 1];
			A[N - 1] =tmp;
		}
		System.out.println(M);
	}
}


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

#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <queue>
#include <tuple>
#include <utility>
using namespace std;
using int64 = long long int;
const int64 INF = 1LL << 60;

int64 N, M, X, H[100010];
vector< pair<int64, int64> > G[100010];
int64 dist[100010][2];

struct Elem {
  int64 cur, f, cost;
  Elem() {}
  Elem(int64 a, int64 b, int64 c) : cur(a), f(b), cost(c) {}
  bool operator<(const Elem & e) const {
    return cost > e.cost;
  }
};

int main() {
  cin >> N >> M >> X;
  for(int i=0; i<N; i++) cin >> H[i];
  for(int i=0; i<M; i++) {
    int64 u, v, d; cin >> u >> v >> d;
    u--; v--;
    G[u].emplace_back(v, d);
    G[v].emplace_back(u, d);
  }

  fill(dist[0], dist[N], INF);
  dist[0][0] = abs(H[0] - X);
  dist[0][1] = X;
  priority_queue<Elem> que;
  que.emplace(0, 0, dist[0][0]);
  que.emplace(0, 1, dist[0][1]);

  while(que.size()) {
    auto e = que.top(); que.pop();
    fprintf(stderr, "%lld %lld %lld\n", e.cur, e.f, e.cost);
    if(dist[e.cur][e.f] < e.cost) continue;
    for(auto edge : G[e.cur]) {
      int64 to, cost; tie(to, cost) = edge;
      int cur = e.cur;
      int64 dh = H[cur] - H[to];
      if(H[cur] - cost < 0) continue;
      {
        int64 nc = e.cost + cost;
        // go down
        if(dh > cost) {
          int64 sub = dh - cost;
          nc -= sub;
        }
        else {
          nc += H[to] - H[cur] + cost;
        }

        if(dist[to][0] > nc) {
          dist[to][0] = nc;
          que.emplace(to, 1, nc);
        }
      }
      {
        // climb (cost)
        int64 nc = e.cost;
        if(dist[to][1] > nc) {
          dist[to][1] = nc;
          que.emplace(to, 1, nc);
        }
      }
    }
  }
  if(dist[N-1][0] == INF) cout << -1 << endl;
  else cout << dist[N-1][0] << endl;
  return 0;
}

#error "uku"


Compiler output:
a.cc:82:2: error: #error "uku"
   82 | #error "uku"
      |  ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
struct EDGE {
	int to;
	LL time;
	bool operator < (const EDGE &t) const {
		return time > t.time;
	}
};
const LL INF = 1LL << 60;
int n, m; LL x;
LL h[100000];
vector<EDGE> g[100000];
LL d[100000];

LL search(LL x)
{
	for (int i = 0; i < n; i++) d[i] = INF;
	
	priority_queue<EDGE> que;
	que.push((EDGE){0, 0});
	while (!que.empty()){
		EDGE e = que.top(); que.pop();
		if (d[e.to] <= e.time) continue;
		d[e.to] = e.time;
		
		LL nowh = max(0LL, x - d[e.to]);
		
		for (int i = 0; i < g[e.to].size(); i++){
			EDGE &ee = g[e.to][i];
			if (nowh - ee.time > h[ee.to]){
				LL diff = nowh - ee.time - h[ee.to];
				que.push((EDGE){ee.to, e.time + ee.time + /*diff*/});
			}
			else if (nowh >= ee.time){
				que.push((EDGE){ee.to, e.time + ee.time});
			}
			if (nowh - ee.time < 0){
				LL tmph = - (nowh - ee.time);
				if (tmph <= h[e.to]){
					que.push((EDGE){ee.to, e.time /*+ (tmph - nowh)*/ + ee.time});
				}
			}
		}
	}
	
	if (d[n - 1] == INF) return -1;
	return d[n - 1] + h[n - 1] - max(0LL, x - d[n - 1]);
	//return d[n - 1] * 2 + h[n - 1];
}

int main()
{
	scanf("%d %d %lld", &n, &m, &x);
	
	for (int i = 0; i < n; i++){
		scanf("%lld", &h[i]);
	}
	
	for (int i = 0; i < m; i++){
		int a, b; LL t;
		scanf("%d %d %lld", &a, &b, &t);
		a--; b--;
		g[a].push_back((EDGE){b, t});
		g[b].push_back((EDGE){a, t});
	}
	
	printf("%lld\n", search(x));
	
	return 0;
}

Compiler output:
a.cc: In function 'LL search(LL)':
a.cc:34:47: error: expected primary-expression before ')' token
   34 |                                 que.push((EDGE){ee.to, e.time + ee.time + /*diff*/});
      |                                               ^
Language: C++

#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,-1,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<27
#define MAX 
using namespace std;

int n,m,x,h[101010],d[101010];
vector<pii> G[101010];

void solve(){
 cin>>n>>m>>x;
 FOR(i,n) cin>>h[i];
 int a,b,t;
 FOR(i,m){
  cin>>a>>b>>t;
  a--; b--;
  if(t<=h[a]) G[a].pb(mp(b,t));
  if(t<=h[b]) G[b].pb(mp(a,t));
 }
 dijkstra(0);
 if(d[n-1]>=INF){
  cout<<"-1"<<endl;
  return;
 }
 cout<<d[n-1]+h[n-1]-x<<endl;
}

void dijkstra(int s){
 priority_queue<ti,vector<ti>,greater<ti>> que;
 fill(d,d+n,INF);
 d[s]=0;
 que.push(mp(0,s));
 while(!que.empty()){
  pii p=que.top(); que.pop();
  int v=p.second;
  if(d[v]<p.first) continue;
  int to,cost;
  FOR(i,G[v].size()){
   to=G[v][i].first;
   cost=G[v][i].second;
   if(d[to]>d[v]+cost){
    d[to]=d[v]+cost;
    que.push(mp(d[to],to));
   }
  }
 }
}

int main(){
 solve();
 return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:29:2: error: 'dijkstra' was not declared in this scope
   29 |  dijkstra(0);
      |  ^~~~~~~~
a.cc: In function 'void dijkstra(int)':
a.cc:38:17: error: 'ti' was not declared in this scope; did you mean 'tm'?
   38 |  priority_queue<ti,vector<ti>,greater<ti>> que;
      |                 ^~
      |                 tm
a.cc:38:29: error: template argument 2 is invalid
   38 |  priority_queue<ti,vector<ti>,greater<ti>> que;
      |                             ^
a.cc:38:41: error: template argument 1 is invalid
   38 |  priority_queue<ti,vector<ti>,greater<ti>> que;
      |                                         ^~
a.cc:38:41: error: template argument 2 is invalid
a.cc:38:41: error: template argument 3 is invalid
a.cc:41:6: error: request for member 'push' in 'que', which is of non-class type 'int'
   41 |  que.push(mp(0,s));
      |      ^~~~
a.cc:42:13: error: request for member 'empty' in 'que', which is of non-class type 'int'
   42 |  while(!que.empty()){
      |             ^~~~~
a.cc:43:13: error: request for member 'top' in 'que', which is of non-class type 'int'
   43 |   pii p=que.top(); que.pop();
      |             ^~~
a.cc:43:24: error: request for member 'pop' in 'que', which is of non-class type 'int'
   43 |   pii p=que.top(); que.pop();
      |                        ^~~
a.cc:52:9: error: request for member 'push' in 'que', which is of non-class type 'int'
   52 |     que.push(mp(d[to],to));
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,-1,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<27
#define MAX 
using namespace std;

int n,m,x,h[101010],d[101010];
vector<pii> G[101010];

void solve(){
 cin>>n>>m>>x;
 FOR(i,n) cin>>h[i];
 int a,b,t;
 FOR(i,m){
  cin>>a>>b>>t;
  a--; b--;
  if(t<=h[a]) G[a].pb(mp(b,t));
  if(t<=h[b]) G[b].pb(mp(a,t));
 }
 dijkstra(0);
 if(d[n-1]>=INF){
  cout<<"-1"<<endl;
  return;
 }
 cout<<d[n-1]+h[n-1]-x<<endl;
}

void dijkstra(int s){
 priority_queue<pii,vector<pii>,greater<pii>> que;
 fill(d,d+n,INF);
 d[s]=0;
 que.push(mp(0,s));
 while(!que.empty()){
  pii p=que.top(); que.pop();
  int v=p.second;
  if(d[v]<p.first) continue;
  int to,cost;
  FOR(i,G[v].size()){
   to=G[v][i].first;
   cost=G[v][i].second;
   if(d[to]>d[v]+cost){
    d[to]=d[v]+cost;
    que.push(mp(d[to],to));
   }
  }
 }
}

int main(){
 solve();
 return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:29:2: error: 'dijkstra' was not declared in this scope
   29 |  dijkstra(0);
      |  ^~~~~~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, int> pl;
typedef pair<ll, pl> pll;

#define fir first
#define sec second.first;
#define thr second.second;
#define INF (1ll << 60)

int n,m;
ll h[100800],dist[100800],ah[100800];
vector<pl> g[100800];

void dijkstra(ll height){
	int i,from,to;
	ll hi,d,l,nw;
	pll tmp;
	priority_queue<pll, vector<pll>, greater<pll> > pq;
	fill(dist,dist+n,INF);
	fill(ah,ah+n,0ll);
	dist[0] = 0ll;
	ah[i] = x;
	pq.push(pll(dist[0],pl(height,0)));
	while(!pq.empty()){
		tmp = pq.top();
		pq.pop();
		from = tmp.thr;
		hi = tmp.sec;
		d = tmp.fir;
		for(i=(g[from].size()-1); i>=0; i--){
			to = g[from][i].second;
			l = g[from][i].first;
			if(l<=hi){
				nw = d+l;
				if(dist[to]>=nw && h[to] >= hi-l){
					if(dist[to]==nw){
						ah[to] = max(ah[to],hi-l);
					}else{
						ah[to] = hi-l;
					}
					dist[to] = nw;
					pq.push(pll(dist[to],pl(ah[to],to)));
				}else if(dist[to]>=nw){
					nw += hi-l-h[to];
					if(dist[to]>nw){
						dist[to] = nw;
						ah[to] = h[to];
						pq.push(pll(dist[to],pl(ah[to],to)));
					}else if(dist[to]==nw){
						dist[to] = nw;
						ah[to] = max(ah[to],h[to]);
						pq.push(pll(dist[to],pl(ah[to],to)));
						
					}
				}
			}else if(l<=h[from]){
				nw = d+l-hi+l;
				if(dist[to]>=nw){
					if(dist[to]!=nw){
						ah[to] = 0ll;
					}
					dist[to] = nw;
					pq.push(pll(dist[to],pl(ah[to],to)));
				}
			}
		}
	}
}

int main(void){
	int i,a,b;
	ll x,t;
	cin >> n >> m >> x;
	for(i=0; i<n; i++){
		cin >> h[i];
	}
	for(i=0; i<m; i++){
		cin >> a >> b >> t;
		a--;
		b--;
		g[a].push_back(pl(t,b));
		g[b].push_back(pl(t,a));
	}
	dijkstra(x);
	if(dist[n-1]==INF){
		dist[n-1] = -1;
	}else{
		dist[n-1] += h[n-1] - ah[n-1];
	}
	cout << dist[n-1] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void dijkstra(ll)':
a.cc:26:17: error: 'x' was not declared in this scope
   26 |         ah[i] = x;
      |                 ^
Language: C++

#include <iostream>
using namespace std;

int main() {
	int n,m,mn=0,a[300001],b[300001];
	int ain,binp;
	long long int h[100001],t[300001],mt[100001],mh[100001],tin,x,t2,h2;
	bool check_tree[100001];
	cin >> n >> m >> x;
	for(int i=1;i<=n;i++){
		cin >> h[i];
		mt[i]=-1;
		check_tree[i]=false;
	}
	for(int i=1;i<=m;i++){
		cin >> ain >> binp >> tin;
		if(h[ain]>=tin){
			a[mn]=ain;
			b[mn]=binp;
			t[mn]=tin;
			mn++;
		}
		if(h[binp]>=tin){
			a[mn]=binp;
			b[mn]=ain;
			t[mn]=tin;
			mn++;
		}
	}
	check_tree[1]=true;
	mt[1]=0;
	mh[1]=x;
	bool f=true;
	while(f){
		f=false;
		for(int i=1;i<=n;i++){
			if(check_tree[i]){
				for(int j=0;j<mn;j++){
					if(a[j]==i){
						if(h[b[j]]<mh[i]-t[j]){
							t2=mt[i]+mh[i]-h[b[j]];
							h2=h[b[j]];
						}else{
							if(mh[i]<t[j]){
								t2=mt[i]+t[j]*2-mh[i];
								h2=0;
							}else{
								t2=mt[i]+t[j];
								h2=mh[i]-t[j];
							}
						}
						if(mt[b[j]]==-1 || mt[b[j]]-mh[b[j]]>t2-h2*"" || (mt[b[j]]-mh[b[j]]*2==t2-h2 && mh[b[j]]<h2)){
							f=true;
							check_tree[b[j]]=true;
							mt[b[j]]=t2;
							mh[b[j]]=h2;
						}
					}
				}
				check_tree[i]=false;
			}
		}
	}
	if(mt[n]==-1){
		cout << -1 << endl;
	}else{
		cout << mt[n]+h[n]-mh[n] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:91: error: invalid operands of types 'long long int' and 'const char [1]' to binary 'operator*'
   52 |                                                 if(mt[b[j]]==-1 || mt[b[j]]-mh[b[j]]>t2-h2*"" || (mt[b[j]]-mh[b[j]]*2==t2-h2 && mh[b[j]]<h2)){
      |                                                                                         ~~^~~
      |                                                                                         |  |
      |                                                                                         |  const char [1]
      |                                                                                         long long int
Language: C++

#include <iostream>
using namespace std;

int main() {
	int n,m,mm=0,b[600001],first_a[100001],last_a[100001],next_a[600001],a_in,b_in;
	long long int x,h[100001],tt[600001],mh[100001],mt[100001],t2,h2,t_in;
	bool check_a[100001],f=true;
	cin >> n >> m >> x;
	for(int i=1;i<=n;i++){
		cin >> h[i];
		first_a[i]=-1;
		last_a[i]=-1;
		mt[i]=-1;
		check_a[i]=false;
	}
	for(int i=0;i<m;i++){
		cin >> a_in >> b_in >> t_in;
		if(h[a_in]>=t_in){
			b[mm]=b_in;
			tt[mm]=t_in;
			next_a[mm]=-1;
			if(last_a[a_in]==-1){
				first_a[a_in]=mm;
			}else{
				next_a[last_a[a_in]]=mm;
			}
			last_a[a_in]=mm;
			mm++;
		}
		if(h[b_in]>=t_in){
			b[mm]=a_in;
			tt[mm]=t_in;
			next_a[mm]=-1;
			if(last_a[b_in]==-1){
				first_a[b_in]=mm;
			}else{
				next_a[last_a[b_in]]=mm;
			}
			last_a[b_in]=mm;
			mm++;
		}
	}
	check_a[1]=true;
	mt[1]=0;
	mh[1]=x;
	while(f){
		f=false;
		for(int i=1;i<=n;i++){
			if(check_a[i]){
				check_a[i]=false;
				int j=first_a[i];
				while(j!=-1){
					if(mh[i]>h[b[j]]+t[j]){
						t2=mt[i]+mh[i]-h[b[j]];
						h2=h[b[j]];
					}else{
						if(mh[i]<t[j]){
							t2=mt[i]+t[j]*2-mh[i];
							h2=0;
						}else{
							t2=mt[i]+t[j];
							h2=mh[i]-t[j];
						}
					}
					if(mt[b[j]]==-1 || mt[b[j]]-mh[b[j]]>t2-h2 || (mt[b[j]]-mh[b[j]]==t2-h2 && mh[b[j]]<h2)){
						mt[b[j]]=t2;
						mh[b[j]]=h2;
						check_a[b[j]]=true;
						f=true;
					}
					j=next_a[j];
				}
			}
		}
	}
	if(mt[n]==-1){
		cout << -1 << endl;
	}else{
		cout << mt[n]+h[n]-mh[n] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:58: error: 't' was not declared in this scope
   53 |                                         if(mh[i]>h[b[j]]+t[j]){
      |                                                          ^
Language: C++

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

struct st { int p, h; ll c; };
bool operator<(st a, st b) { return a.c > b.c; }

int h[100000], cnt[100000], s[100000];
unordered_map<int, ll>d[100000];
vector<P>E[100000];
bool b[100000];

int main() {
	int n, m, x; scanf("%lld%lld%lld", &n, &m, &x);
	rep(i, n)scanf("%lld", &h[i]);
	rep(i, m) {
		int a, b, t; scanf("%lld%lld%lld", &a, &b, &t);
		a--; b--;
		if (t <= h[a])E[a].push_back(P(t, b));
		if (t <= h[b])E[b].push_back(P(t, a));
	}
	priority_queue<st>que;
	d[0][x] = 0;
	que.push({ 0,x,0 });
	while (!que.empty()) {
		st s = que.top(); que.pop();
		if (d[s.p][s.h] != s.c)continue;
		for (P u : E[s.p]) {
			if (b[u.second])continue;
			if (u.first > h[s.p])continue;
			int t = 0, k = s.h - u.first;
			if (k < 0)t = 0 - k, k = 0;
			if (k > h[u.second])t = k - h[u.second], k = h[u.second];
			if ((d[u.second].find(k) == d[u.second].end()) || (d[u.second][k] > s.c + u.first + t)) {
				d[u.second][k] = s.c + u.first + t;
				que.push({ u.second,k,d[u.second][k] });
			}
		}
	}
	ll Min = LLONG_MAX;
	for (auto p : d[n - 1]) {
		Min = min(Min, p.second + h[n - 1] - p.first);
	}
	if (Min == LLONG_MAX)puts("-1");
	else printf("%lld\n", Min);
}

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

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

struct st { int p, h; ll c; };
bool operator<(st a, st b) { return a.c > b.c; }

int h[100000], s[100000];
ll d[100000][1000];
vector<P>E[100000];
int main() {
	int n, m, x; scanf("%d%d%d", &n, &m, &x);
	rep(i, n)scanf("%d", &h[i]);
	rep(i, m) {
		int a, b, t; scanf("%d%d%d", &a, &b, &t);
		a--; b--;
		if (t <= h[a])E[a].push_back(P(t, b));
		if (t <= h[b])E[b].push_back(P(t, a));
	}
	priority_queue<st>que;
	d[0][0] = 0;
	que.push({ 0,x,0 });
	while (!que.empty()) {
		st s = que.top(); que.pop();
		if (s.c < 0)abort();
		if (d[s.p][s.h] != s.c)continue;
		for (P u : E[s.p]) {
			int t = 0, k = s.h - u.first;
			if (k < 0)t = 0 - k, k = 0;
			if (k > h[u.second])t = k - h[u.second], k = h[u.second];
			if (d[u.second][k] > s.c + u.first + t) {
				d[u.second][k] = s.c + u.first + t;
				que.push({ u.second,k,d[u.second][k] });
			}
		}
	}
	ll Min = LLONG_MAX;
	for (auto p : d[n - 1]) {
		Min = min(Min, p.second + h[n - 1] - p.first);
	}
	if (Min == LLONG_MAX)puts("-1");
	else printf("%lld\n", Min);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:34: error: request for member 'second' in 'p', which is of non-class type 'long long int'
   41 |                 Min = min(Min, p.second + h[n - 1] - p.first);
      |                                  ^~~~~~
a.cc:41:56: error: request for member 'first' in 'p', which is of non-class type 'long long int'
   41 |                 Min = min(Min, p.second + h[n - 1] - p.first);
      |                                                        ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#define INF 1e+18
#define int long long
using namespace std;

struct edge{ int to,cost; };
typedef pair<int,int> P;

signed main(){
	int n,m,x,h[100000];
	int d[100000];
	vector<edge> G[100000];
	cin >> n >> m >> x;
	for(int i = 0;i < n;i++) {
		cin >> h[i];
		d[i] = INF;
	}
	d[0] = 0;
	for(int i = 0;i < m;i++){
		int a,b,c;
		cin >> a >> b >> c;
		if(h[a - 1] >= c) G[a - 1].push_back({b - 1,c});
		if(h[b - 1] >= c) G[b - 1].push_back({a - 1,c});
	}
	priority_queue<P,vector<P>,greater<P> > que;
	que.push(P(0,0));
	while(!que.empty()){
		P p = que.top();que.pop();
		int v = p.second,nowh = x - d[v];
		if(d[v] < p.first) continue;
		for(int i = 0;i < G[v].size();i++){
			edge e = G[v][i];
			if(h[e.to] + e.cost < nowh){
				if(x - h[e.to] < d[e.to]){
					d[e.to] = x - h[e.to];
					que.push(P(d[e.to],e.to));
				}
			}
			else if(nowh > 0 && nowh < e.cost){
				if(d[v] + e.cost - nowh + e.cost < d[e.to]){
					d[e.to] = d[v] + e.cost - nowh + e.cost;
					que.push(P(d[e.to],e.to));
				}
			}else if(nowh >= e.cost){
				if(d[v] + e.cost < d[e.to]){
					d[e.to] = d[v] + e.cost;
					que.push(P(d[e.to],e.to));
				}
			}
			else{
				if(d[v] + e.cost * 2 < d[e.to]){
					d[e.to] = d[v] + e.cost * 2;
					que.push(P(d[e.to],e.to));
				}
			}
		}
	}
	if(d[n - 1] == INF) cout << -1 << endl;
	else cout << d[n - 1] + h[n - 1] - max(0,x - d[n - 1]) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:47: error: no matching function for call to 'max(int, long long int)'
   61 |         else cout << d[n - 1] + h[n - 1] - max(0,x - d[n - 1]) << endl;
      |                                            ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:61:47: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   61 |         else cout << d[n - 1] + h[n - 1] - max(0,x - d[n - 1]) << endl;
      |                                            ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <stdio.h>
#include <vector>
#include <utility>
#include <queue>
#include <bitset>
using namespace std;
typedef pair<int,long long int> pi;
typedef pair<long long int,pi> plpi;
#define F first
#define S second
#define PB push_back
const int N=1e5+10;
const long long int INF=1LL<<60;
int main(){
    int n,m,l,r;
    long long int ans=INF,dis[N],d,h[N],x;
    bitset<N>went;
    queue<plpi>q;
    priority_queue<plpi,vector<plpi>,greater<plpi>>pq;
    plpi nxt;
    vector<pi> graph[N];
    scanf("%d%d%lld",&n,&m,&x);
    for(int i=1;i<=n;i++){
        scanf("%lld",&h[i]);
        dis[i]=INF;
    }
    while(m--){
        scanf("%d%d%lld",&l,&r,&d);
        if(h[l]-d>=0)graph[l].PB({r,d});
        if(h[r]-d>=0)graph[r].PB({l,d});
    }
    went.reset();
    pq.push({0LL,{1,x}});
    while(!pq.empty()){
        nxt=pq.top();
        pq.pop();
        if(nxt.F>=ans)continue;
        if(nxt.S.F==n){
            ans=min(ans,nxt.F+h[n]-nxt.S.S);
            break;
        }
        else if(nxt.S.S==0){
            if(!went[nxt.S.F]&&dis[nxt.S.F]>=nxt.F){
                went[nxt.S.F]=true;
                for(pi i:graph[nxt.S.F])if(nxt.F+i.S*2<dis[i.F]){
                    dis[i.F]=nxt.F+i.S*2;
                    pq.push({nxt.F+i.S*2,{i.F,0}});
                }
            }
        }
        else if(!went[nxt.S.F]){
            for(pi i:graph[nxt.S.F])if({
                if(nxt.S.S-i.S<0){
                    if(dis[i.F]>nxt.F-nxt.S.S+i.S*2){
                        dis[i.F]=nxt.F-nxt.S.S+i.S*2;
                        pq.push({nxt.F-nxt.S.S+i.S*2,{i.F,0}});
                    }
                }
                else if(nxt.S.S-i.S>h[i.F]){
                    if(dis[i.F]>nxt.F+nxt.S.S-h[i.F]*2){
                        dis[i.F]=min(dis[i.F],nxt.F+nxt.S.S);
                        pq.push({nxt.F+nxt.S.S-h[i.F],{i.F,h[i.F]}});
                    }
                }
                else {
                    if(dis[i.F]>nxt.F+i.S*2-nxt.S.S){
                        dis[i.F]=min(dis[i.F],nxt.S.S+nxt.F);
                        pq.push({nxt.F+i.S,{i.F,nxt.S.S-i.S}});
                    }
                }
            }
        }
    }
    if(ans==INF)printf("-1\n");
    else printf("%lld\n",ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:40: error: expected primary-expression before '{' token
   52 |             for(pi i:graph[nxt.S.F])if({
      |                                        ^
a.cc:52:40: error: expected ')' before '{' token
   52 |             for(pi i:graph[nxt.S.F])if({
      |                                       ~^
      |                                        )
a.cc:72:9: error: expected primary-expression before '}' token
   72 |         }
      |         ^
Language: C++

#include <stdio.h>
#include <vector>
#include <utility>
#include <queue>
#include <bitset>
using namespace std;
typedef pair<int,long long int> pi;
typedef pair<long long int,pi> plpi;
#define F first
#define S second
#define PB push_back
const int N=1e5+10;
const long long int INF=1LL<<60;
int main(){
    int n,m,l,r;
    long long int ans=INF,dis[N],d,h[N],x;
    bitset<N>went;
    queue<plpi>q;
    priority_queue<plpi,vector<plpi>,greater<plpi>>pq;
    plpi nxt;
    vector<pi> graph[N];
    scanf("%d%d%lld",&n,&m,&x);
    for(int i=1;i<=n;i++){
        scanf("%lld",&h[i]);
        dis[i]=INF;
    }
    while(m--){
        scanf("%d%d%lld",&l,&r,&d);
        if(h[l]-d>=0)graph[l].PB({r,d});
        if(h[r]-d>=0)graph[r].PB({l,d});
    }
    went.reset();
    pq.push({0LL,{1,x}});
    while(!pq.empty()){
        nxt=pq.top();
        pq.pop();
        if(nxt.F>=ans)continue;
        if(nxt.S.F==n){
            ans=min(ans,nxt.F+h[n]-nxt.S.S);
            break;
        }
        else if(nxt.S.S==0){
            if(!went[nxt.S.F]&&dis[nxt.S.F]>=nxt.F){
                went[nxt.S.F]=true;
                for(pi i:graph[nxt.S.F])if(nxt.F+i.S*2<dis[i.F]){
                    dis[i.F]=nxt.F+i.S*2;
                    pq.push({nxt.F+i.S*2,{i.F,0}});
                }
            }
        }
        else if(!went[nxt.S.F]){
            for(pi i:graph[nxt.S.F])
                if(nxt.S.S-i.S<0){
                    if(dis[i.F]>nxt.F-nxt.S.S+i.S*2){
                        dis[i.F]=nxt.F-nxt.S.S+i.S*2;
                        pq.push({nxt.F-nxt.S.S+i.S*2,{i.F,0}});
                    }
                }
                else if(nxt.S.S-i.S>h[i.F]){
                    if(dis[i.F]>nxt.F+nxt.S.S-h[i.F]*2){
                        dis[i.F]=min(dis[i.F],nxt.F+nxt.S.S);
                        pq.push({nxt.F+nxt.S.S-h[i.F],{i.F,h[i.F]}});
                    }
                }
                else {
                    if(dis[i.F]>nxt.F+i.S*2-nxt.S.S){
                        dis[i.F]=min(dis[i.F],nxt.S.S+nxt.F);
                        pq.push({nxt.F+i.S,{i.F,nxt.S.S-i.S}});
                    }
                }
            }
        }
    }
    if(ans==INF)printf("-1\n");
    else printf("%lld\n",ans);
}


Compiler output:
a.cc:74:5: error: expected unqualified-id before 'if'
   74 |     if(ans==INF)printf("-1\n");
      |     ^~
a.cc:75:5: error: expected unqualified-id before 'else'
   75 |     else printf("%lld\n",ans);
      |     ^~~~
a.cc:76:1: error: expected declaration before '}' token
   76 | }
      | ^
Language: C++

#include <stdio.h>
#include <vector>
#include <utility>
#include <queue>
#include <bitset>
using namespace std;
typedef pair<int,long long int> pi;
typedef pair<long long int,pi> plpi;
#define F first
#define S second
#define PB push_back
const int N=1e5+10;
const long long int INF=1LL<<60;
int main(){
    int n,m,l,r;
    long long int ans=INF,dis[N],d,h[N],x;
    bitset<N>went;
    queue<plpi>q;
    priority_queue<plpi,vector<plpi>,greater<plpi>>pq;
    plpi nxt;
    vector<pi> graph[N];
    scanf("%d%d%lld",&n,&m,&x);
    for(int i=1;i<=n;i++){
        scanf("%lld",&h[i]);
        dis[i]=INF;
    }
    while(m--){
        scanf("%d%d%lld",&l,&r,&d);
        if(h[l]-d>=0)graph[l].PB({r,d});
        if(h[r]-d>=0)graph[r].PB({l,d});
    }
    went.reset();
    pq.push({0LL,{1,x}});
    while(!pq.empty()){
        nxt=pq.top();
        pq.pop();
        if(nxt.F>=ans)continue;
        if(nxt.S.F==n){
            ans=min(ans,nxt.F+h[n]-nxt.S.S);
            break;
        }
        else if(nxt.S.S==0){
            if(!went[nxt.S.F]&&dis[nxt.S.F]>=nxt.F){
                went[nxt.S.F]=true;
                for(pi i:graph[nxt.S.F])if(nxt.F+i.S*2<dis[i.F]){
                    dis[i.F]=nxt.F+i.S*2;
                    pq.push({nxt.F+i.S*2,{i.F,0}});
                }
            }
        }
        else if(!went[nxt.S.F]){
            went[nxt.S.F]=true;
            for(pi i:graph[nxt.S.F])if({
                if(nxt.S.S-i.S<0){
                    if(dis[i.F]>nxt.F-nxt.S.S+i.S*2){
                        dis[i.F]=nxt.F-nxt.S.S+i.S*2;
                        pq.push({nxt.F-nxt.S.S+i.S*2,{i.F,0}});
                    }
                }
                else if(nxt.S.S-i.S>h[i.F]){
                    if(dis[i.F]>nxt.F+nxt.S.S-h[i.F]*2){
                        dis[i.F]=min(dis[i.F],nxt.F+nxt.S.S);
                        pq.push({nxt.F+nxt.S.S-h[i.F],{i.F,h[i.F]}});
                    }
                }
                else {
                    if(dis[i.F]>nxt.F+i.S*2-nxt.S.S){
                        dis[i.F]=min(dis[i.F],nxt.S.S+nxt.F);
                        pq.push({nxt.F+i.S,{i.F,nxt.S.S-i.S}});
                    }
                }
            }
        }
    }
    if(ans==INF)printf("-1\n");
    else printf("%lld\n",ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:40: error: expected primary-expression before '{' token
   53 |             for(pi i:graph[nxt.S.F])if({
      |                                        ^
a.cc:53:40: error: expected ')' before '{' token
   53 |             for(pi i:graph[nxt.S.F])if({
      |                                       ~^
      |                                        )
a.cc:73:9: error: expected primary-expression before '}' token
   73 |         }
      |         ^
Language: C++

#include<iostream>

#define MAX_N 100000
int N;
int a[MAX_N]; //??¶???
int p[MAX_N]; //?????????, a[i] = a[i + 1]??????i???????´?
int p_tail; //p????????????????´?

int main()
{
  scanf("%d", &N);
  p[0] = -1;
  p_tail = 0;
  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
    if(i > 0 && a[i] == a[i - 1]) {
      p[tail + 1] = i - 1;
      p_tail++;
    }
  }
  p[p_tail + 1] = N - 1;
  p_tail++;
  //a[i + 3] - a[i]????????§????????§?????????????????¢???
  if(p_tail < 2) {
    printf("%d\n", N);
  }
  else {
    int ans = 0;
    for(int i = 0; i <= p_tail - 3; i++) {
      if(ans < a[i + 3] - a[i]) {
        ans = a[i + 3] - a[i];
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'tail' was not declared in this scope; did you mean 'p_tail'?
   17 |       p[tail + 1] = i - 1;
      |         ^~~~
      |         p_tail
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int a[100010];

int main(){
	int n;
	cin>>n;
	rep(i, n) cin>>a[i];
	vi s(n+1), t(1);
	for(int i = 1; i < n; i++){
		if(a[i] != a[i-1]) s[i] = s[i-1]+1;
		else t.pb(i);
	}
	if(t.size()==1) ans = n;
	t.pb(n);
	int ans = 2;
	for(int i = 0; i + 1 < t.size(); i++){
		int tmp = t[i+1]-t[i];
		//cout<<" "<<i<<" "<<tmp;
		if(i + 2 < t.size()) tmp += t[i+2]-t[i+1];
		if(i + 3 < t.size()) tmp += t[i+3]-t[i+2];
		//cout<<" "<<tmp<<endl;
		ans = max(tmp, ans);
	}
	cout<<ans<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   57 |         if(t.size()==1) ans = n;
      |                         ^~~
      |                         abs
Language: C++

#include<iostream>
#include<cstdio>
#include<math.h>
#include<algorithm>
using namespace std;	
	int N,M;
	char S[2001],T[2001];
	int dp[2000][2000][2];
int main() {

	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			dp[i][j][1] = -INT_MAX;
			dp[i][j][0] = 0;
		}
	}
	scanf("%s", S + 1);
	scanf("%s", T + 1);
	int MAX = 0;
	for (int s = 0; s < N; s++) {
		for (int t = 0; t < M; t++) {
			if (s < N&&S[s + 1] == 'I') {
				dp[s + 1][t][1] = max(dp[s + 1][t][1], dp[s][t][0] + 1);
				MAX = max(MAX, dp[s+1][t][1]);
			}
			if (t < M&&T[t + 1] == 'I') { 
				dp[s][t + 1][1] = max(dp[s][t + 1][1], dp[s][t][0] + 1); 
				MAX = max(MAX, dp[s][t+1][1]);
			}
			if (s < N&&S[s + 1] == 'O') {
				dp[s + 1][t][0] = max(dp[s + 1][t][0], dp[s][t][1] + 1);
				MAX = max(MAX, dp[s+1][t][0]);
			}
			if (t < M&&T[t + 1] == 'O') {
				dp[s][t + 1][0] = max(dp[s][t + 1][0], dp[s][t][1] + 1);
				MAX = max(MAX, dp[s][t+1][0]);
			}
		}
	}
	cout << MAX - ((MAX + 1) % 2) << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:40: error: 'INT_MAX' was not declared in this scope
   14 |                         dp[i][j][1] = -INT_MAX;
      |                                        ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<algorithm>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include<iostream>
#include<cstdio>
#include<math.h>
#include<algorithm>
using namespace std;	
	int N,M;
	char S[2001],T[2001];
	int dp[2000][2000][2];
int main() {

	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			dp[i][j][1] = -INT_MAX;
			dp[i][j][0] = 0;
		}
	}
	scanf("%s", S + 1);
	scanf("%s", T + 1);
	int MAX = 0;
	for (int s = 0; s < N; s++) {
		for (int t = 0; t < M; t++) {
			if (s < N&&S[s + 1] == 'I') {
				dp[s + 1][t][1] = max(dp[s + 1][t][1], dp[s][t][0] + 1);
				MAX = max(MAX, dp[s+1][t][1]);
			}
			if (t < M&&T[t + 1] == 'I') { 
				dp[s][t + 1][1] = max(dp[s][t + 1][1], dp[s][t][0] + 1); 
				MAX = max(MAX, dp[s][t+1][1]);
			}
			if (s < N&&S[s + 1] == 'O') {
				dp[s + 1][t][0] = max(dp[s + 1][t][0], dp[s][t][1] + 1);
				//MAX = max(MAX, dp[s+1][t][0]);
			}
			if (t < M&&T[t + 1] == 'O') {
				dp[s][t + 1][0] = max(dp[s][t + 1][0], dp[s][t][1] + 1);
				//MAX = max(MAX, dp[s][t+1][0]);
			}
		}
	}
	cout << MAX << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:40: error: 'INT_MAX' was not declared in this scope
   14 |                         dp[i][j][1] = -INT_MAX;
      |                                        ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<algorithm>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

int s[2000];
int t[2000];


int main(){
	char hoge;
	int m,n;
	cin>>m>>n;

	for(int i=0;i<m;i++){
		cin>>hoge;
		if(hoge=='I'){s[i]=1;}
		else{s[i]=0;}
	}
	for(int i=0;i<n;i++){
		cin>>hoge;
		if(hoge=='I'){t[i]=1;}
		else{t[i]=0;}
	}
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			bool loop = true;
			int ci=i;
			int cj=j;
			int cans=0;
			while(loop==true){
				if(s[ci]!=1 and t[cj]!=1){loop=false;}
				else{
					if(s[ci]==1 and t[cj]==0){
						ci++;
						cans++;
					}
					else if(s[ci]==0 and t[cj]==1){
						cj++;
						cans++;
					}
					else if(s[ci]==0 and t[si]==0){loop = false;}
					else{
						if(ci+1<n and s[ci+1]==0){
							ci++;
							cans++;
						}
						else if(cj+1<n){
							cj++;
							cans++;
						}
						else{loop=false;}
					}
					
					
					if(ci+1<n and s[ci]==0 and t[cj]==1){
						ci++;
						cans++;
					}
					else if(cj+1<n and s[ci]==1 and t[cj]==0){
						cj++;
						cans++;
					}
					else if(s[ci]==1 and t[cj]==1){loop=false;}
					else{
						if(ci+1<n and s[ci+1]==1){
							ci++;
							cans++;
						}
						else if(cj+1<n){
							cj++;
							cans++;
						}
						else{loop=false;}
					}
				}
			}
			
			ans=max(ans,cans);
		}
	}
	if(ans%2==0){ans--;}
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:64: error: 'si' was not declared in this scope; did you mean 'ci'?
   43 |                                         else if(s[ci]==0 and t[si]==0){loop = false;}
      |                                                                ^~
      |                                                                ci
Language: C++

#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,-1,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 
using namespace std;

int n,m,dp[2020][2020];
string s,t;

int dfs(int o,int d){
 if(dp[o][d]>=0) return dp[o][d];
 int ma=0;
 if((n+m-o-d)&1){
  if(o&&s[o-1]=='O') ma=max(ma,dfs(o-1,d)+1);
  if(d&&t[d-1]=='O') ma=max(ma,dfs(o,d-1)+1);
 }
 else{
  if(o&&s[o-1]=='I') ma=max(ma,dfs(o-1,d)+1);
  if(d&&t[d-1]=='I') ma=max(ma,dfs(o,d-1)+1);
 }
 return dp[o][d]=ma;
}

void solve(){
 cin>>n>>m;
 cin>>s;
 cin>>t;
 FOR(i,n+1) FOR(j,m+1) dp[i][j]=-1;
 dfs(n,m);
 int ma=0;
 FOR(i,n+1){
  FOR(j,m+1){
   if((n+m-o-d)&1) ma=max(ma,dp[i][j]);
  }
 }
 cout<<ma<<endl;
}

int main(){
 solve();
 return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:42:12: error: 'o' was not declared in this scope
   42 |    if((n+m-o-d)&1) ma=max(ma,dp[i][j]);
      |            ^
a.cc:42:14: error: 'd' was not declared in this scope
   42 |    if((n+m-o-d)&1) ma=max(ma,dp[i][j]);
      |              ^
Language: C++

#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,-1,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 
using namespace std;

int n,m,dp[2020][2020];
string s,t;

int dfs(int o,int d){
 if(dp[o][d]>=0) return dp[o][d];
 int ma=0;
 if((n+m-o-d)&1){
  if(o&&s[o-1]=='O') ma=max(ma,dfs(o-1,d)+1);
  if(d&&t[d-1]=='O') ma=max(ma,dfs(o,d-1)+1);
 }
 else{
  if(o&&s[o-1]=='I') ma=max(ma,dfs(o-1,d)+1);
  if(d&&t[d-1]=='I') ma=max(ma,dfs(o,d-1)+1);
 }
 return dp[o][d]=ma;
}

void solve(){
 cin>>n>>m;
 cin>>s;
 cin>>t;
 FOR(i,n+1) FOR(j,m+1) dp[i][j]=-1;
 int p=dfs(n,m);
 if(!p||(p&1)){
  cout<<p<<endl;
  return;
 }
 p--;
 else cout<<p<<endl;
}

int main(){
 solve();
 return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:44:2: error: 'else' without a previous 'if'
   44 |  else cout<<p<<endl;
      |  ^~~~
Language: C++


#include <stdio.h>
#include <algorithm>

using namespace std;

char s[2001], t[2001];
int dp[2001][2001][2];

int m, n;

int main()
{
	scanf("%d %d", &m, &n);
	scanf("%s", s); scanf("%s", t);
	int ans = 0;
	memset(dp, 0, sizeof(dp));
	for (int i = m; i >= 0; --i)
	{
		for (int j = n; j >= 0; --j)
		{
			dp[i][j][0] = max((s[i] == 'O') ? dp[i + 1][j][1] + 1 : 0, (t[j] == 'O') ? dp[i][j + 1][1] + 1 : 0);
			dp[i][j][1] = max((s[i] == 'I') ? dp[i + 1][j][0] + 1 : 0, (t[j] == 'I') ? dp[i][j + 1][0] + 1 : 0);
			if (s[i] == 'I' || t[i] == 'I')
			{
				dp[i][j][0] = max(dp[i][j][0], 1);
				dp[i][j][1] = max(dp[i][j][1], 1);
			}
			ans = max(dp[i][j][0], ans);
			ans = max(dp[i][j][1], ans);
		}
	}
	printf("%d\n", (ans - 1) / 2 * 2 + 1);
	return 0;
}

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

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

char s[2001], t[2001];
int n, m;
int dp[2001][2001][2];

int dfs(int is, int it, bool I) {
	if (dp[is][it][I] != INF) return dp[is][it][I];
	
	int res = 0;
	if (is < m) {
		if (s[is] == 'I' && !I) res = max(res, dfs(is + 1, it, true) + 1);
		if (s[is] == 'O' && I) res = max(res, dfs(is + 1, it, false) + 1);
	}
	
	if (it < n) {
		if (t[it] == 'I' && !I) res = max(res, dfs(is, it + 1, true) + 1);
		if (t[it] == 'O' && I) res = max(res, dfs(is, it + 1, false) + 1);
	}
	return dp[is][it][I?1:0] = res;
}

int main() {
	cin >> m >> n;
	cin >> s >> t;
	
	fill(dp[0][0], dp[m][0], INF);a
	
	int ans = 0;
	REP(i, m) REP(j, n) {
		int res = dfs(i, j, false);
		if (res % 2 == 1) ans = max(ans, res);
	}
	
	cout << ans << endl;
	return 0;
}
/*


dp[i][j][k] = -1;
if (s[i] == 'I') dp[i + 1][j][1] = 1;
if (t[i] == 'I') dp[i][j + 1][1] = 1;
dp[0][0][0] = 0;

dp[i][j][k] = S??????i????????\???, T??????j??????????????§??????????????¨??£?????????k(I:1,O:0)?????¨??????????????????????????§

if (s[i] == 'I') dp[i + 1][j][1] = max(dp[i + 1][j][1], dp[i][j][0] + 1);
else dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][1] + 1);

if (t[i] == 'O') dp[i][j + 1][0] = max(dp[i][j + 1][0], dp[i][j][1] + 1);
else dp[i][j + 1][1] = max(dp[i][j + 1][1], dp[i][j][0] + 1);

ans	:	max(dp[i][j][1])

*/

Compiler output:
a.cc: In function 'int main()':
a.cc:35:39: error: 'a' was not declared in this scope
   35 |         fill(dp[0][0], dp[m][0], INF);a
      |                                       ^
a.cc:40:35: error: 'ans' was not declared in this scope; did you mean 'abs'?
   40 |                 if (res % 2 == 1) ans = max(ans, res);
      |                                   ^~~
      |                                   abs
a.cc:43:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   43 |         cout << ans << endl;
      |                 ^~~
      |                 abs