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

long a,v;main(){for(;v=a=v>>8|getchar()+1L<<56;v&72&&printf(a==0x5a564f4f4a454242?v=0,"AIZUNYAN":"%c",v-1))qsort(&a,8,1,strcmp);}

Compiler output:
main.c:1:10: error: return type defaults to 'int' [-Wimplicit-int]
    1 | long a,v;main(){for(;v=a=v>>8|getchar()+1L<<56;v&72&&printf(a==0x5a564f4f4a454242?v=0,"AIZUNYAN":"%c",v-1))qsort(&a,8,1,strcmp);}
      |          ^~~~
main.c: In function 'main':
main.c:1:31: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
    1 | long a,v;main(){for(;v=a=v>>8|getchar()+1L<<56;v&72&&printf(a==0x5a564f4f4a454242?v=0,"AIZUNYAN":"%c",v-1))qsort(&a,8,1,strcmp);}
      |                               ^~~~~~~
main.c:1:1: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
  +++ |+#include <stdio.h>
    1 | long a,v;main(){for(;v=a=v>>8|getchar()+1L<<56;v&72&&printf(a==0x5a564f4f4a454242?v=0,"AIZUNYAN":"%c",v-1))qsort(&a,8,1,strcmp);}
main.c:1:54: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | long a,v;main(){for(;v=a=v>>8|getchar()+1L<<56;v&72&&printf(a==0x5a564f4f4a454242?v=0,"AIZUNYAN":"%c",v-1))qsort(&a,8,1,strcmp);}
      |                                                      ^~~~~~
main.c:1:54: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:54: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:54: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:108: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration]
    1 | long a,v;main(){for(;v=a=v>>8|getchar()+1L<<56;v&72&&printf(a==0x5a564f4f4a454242?v=0,"AIZUNYAN":"%c",v-1))qsort(&a,8,1,strcmp);}
      |                                                                                                            ^~~~~
main.c:1:121: error: 'strcmp' undeclared (first use in this function)
    1 | long a,v;main(){for(;v=a=v>>8|getchar()+1L<<56;v&72&&printf(a==0x5a564f4f4a454242?v=0,"AIZUNYAN":"%c",v-1))qsort(&a,8,1,strcmp);}
      |                                                                                                                         ^~~~~~
main.c:1:1: note: 'strcmp' is defined in header '<string.h>'; this is probably fixable by adding '#include <string.h>'
  +++ |+#include <string.h>
    1 | long a,v;main(){for(;v=a=v>>8|getchar()+1L<<56;v&72&&printf(a==0x5a564f4f4a454242?v=0,"AIZUNYAN":"%c",v-1))qsort(&a,8,1,strcmp);}
main.c:1:121: note: each undeclared identifier is reported only once for each function it appears in
    1 | long a,v;main(){for(;v=a=v>>8|getchar()+1L<<56;v&72&&printf(a==0x5a564f4f4a454242?v=0,"AIZUNYAN":"%c",v-1))qsort(&a,8,1,strcmp);}
      |                                                                                                                         ^~~~~~
Language: C++

#include<bits/stdc++.h>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

const int LEN = 8;
const string correctWord = "AIZUNYAN";

int main(){
  set<string> S;
  string wrongWord = "AIDUNYAN";
  sort(wrongWord.begin(),wrongWord.end());
  do {
    S.insert(wrongWord);
  } while( next_permutation(wrongWord.begin(),wrongWord.end()) );

  string text;
  cin >> text;
  rep(i,text.size()){
    if( !find && i + LEN - 1 < text.size() ) {
      if( S.count(text.substr(i,LEN)) ) {
	cout << correctWord;
	i += ( LEN - 1 );
      }
    } else cout << text[i];
  } puts("");
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:10: error: cannot resolve overloaded function 'find' based on conversion to type 'bool'
   22 |     if( !find && i + LEN - 1 < text.size() ) {
      |          ^~~~
a.cc:22:10: error: in argument to unary !
Language: C++

#include <iostream>
#include <string>
#include <algorithm>

constexpr const char* azunyan = "AIDUNYAN";

std::string substr(const std::string& str, int x, int y){
	if(x < 0) x = 0;
	if(x > y) return "";
	if(y >= str.size()) y = str.size() - 1;

	return str.substr(x, y - x + 1);
}

bool check(const std::string& str){
	int cnt_a = 0, cnt_n = 0;
	for(auto& c : str){
		if(c == 'A') ++cnt_a;
	}
        for(auto& c : str){
                if(c == 'N') ++cnt_n;
        }

	return cnt == 2 && cnt_n == 2;
}

int main(){
	std::string str, out;

	std::cin >> str;

	int prev = 0;
	for(int i = 0; i < str.size(); ++i){
		const auto& newStr = substr(str, i, i + 7);
		if(i + 7 < str.size() && newStr.find_first_not_of(azunyan) == std::string::npos && check(newStr)){
			out += "AIZUNYAN";
			i += 7;
		}else out += str[i];
	}

	std::cout << out << std::endl;

}

Compiler output:
a.cc: In function 'bool check(const std::string&)':
a.cc:24:16: error: 'cnt' was not declared in this scope; did you mean 'int'?
   24 |         return cnt == 2 && cnt_n == 2;
      |                ^~~
      |                int
Language: C++

#include <iostream>
#include <string>
#include <map>

using namespace std;

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

	string A = "AIZUNYAN";
	string dA = "AIDUNYAN";
	int alen = (int)A.size();

	map<char, int> azu;
	for (int i=0; i<alen; i++) {
		map[dA[i]]++;
	}

	int len = (int)d.size();
	for (int i = 0; i<len-alen; i++) {
		map<char, int> dzu;
		for (int j=0; j<alen; j++) {
			dzu[d[i+j]]++;
		}

		bool ok = true;
		for (int j=0; j<26 && ok; j++) {
			if (azu['A'+j]!=dzu['A'+j]) ok = false;
		}

		if (ok) {
			for (int j=0; j<alen; j++) {
				d[i+j] = A[j];
			}
			i += alen;
		}
	}

	cout << d << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:23: error: expected ']' before '[' token
   17 |                 map[dA[i]]++;
      |                       ^
      |                       ]
a.cc:17:27: error: expected initializer before '++' token
   17 |                 map[dA[i]]++;
      |                           ^~
a.cc:17:27: error: expected ';' before '++' token
Language: C++

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

using namespace std;

void process(vector<int> &dp) {
    int N;
    cin >> N;
    while(N--) {
        string s;
        int v;
        cin >> s >> v;
        if(s == "D" || s == "DD") {
            const int cost = s.size();
            for(int i = (int)dp.size() - 1; i >= cost; --i) {
                if(dp[i-cost] != -1) {
                    dp[i] = max(dp[i], dp[i-cost] + v);
                }
            }
        }
    }
}

bool solve() {
    int D;
    if(!(cin >> D)) return false;

    vector<int> dp(D+1, -1);
    dp[0] = 0;
    process(dp);
    process(dp);
    cout << *max_element(begin(dp), end(dp)) << endl;
    return true;
}

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

    while(solve()) ;
    return 0;
}

Compiler output:
a.cc: In function 'bool solve()':
a.cc:33:14: error: 'max_element' was not declared in this scope
   33 |     cout << *max_element(begin(dp), end(dp)) << endl;
      |              ^~~~~~~~~~~
Language: C++

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

int rep = 0;
bool list[2^20][20];



void rec(int n){
	for (int i = 0; i < 20; ++i){
		list[n][i] = true;
		rec(n + 1);
	}
}


int main() {
	

	int D;
	cin >> D;
	int x;
	cin >> x;
	
	vector<int> permutation;

	for (int i = 0; i < x; ++i){
		char ans; int points;
		cin >> ans >> points;
		if (ans == (int)'D'){
			permutation.push_back(points);
		}
		else{
			permutation.push_back(0);
		}
	}
	
	int y;
	cin >> y;
	for (int i = 0; i < y; ++i){
		char ans1, ans2; int points;
		cin >> ans1 >> ans2 >> points;
	
		if (ans1 == (int)'D' && ans2==(int)'D'){
			permutation.push_back(points + 1000);
		}
		else{
			permutation.push_back(0);
		}
	}
	
	
	
	do{
		int score = 0, j = 0, max_score = 0;
		while (D >=0){
			if (permutation[j] >= 1000){
				D -= 2;
				score += (permutation[j] - 1000);
			}
			else{
				D -= 1;
				score += permutation[j];
			}
		}
		if (D == 0 && score >= max_score){
			max_score = score;
		}
		
	} while (next_permutation(permutation.begin(), permutation.end()));

	cout << score << endl;
	return 0;
}

Compiler output:
a.cc:8:12: warning: result of '2^20' is 22; did you mean '1 << 20' (1048576)? [-Wxor-used-as-pow]
    8 | bool list[2^20][20];
      |            ^
      |           --
      |           1<<
a.cc:8:11: note: you can silence this warning by using a hexadecimal constant (0x2 rather than 2)
    8 | bool list[2^20][20];
      |           ^
      |           0x2
a.cc: In function 'int main()':
a.cc:75:17: error: 'score' was not declared in this scope
   75 |         cout << score << endl;
      |                 ^~~~~
Language: C++

#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int d, n, m, x, y, z, p[50], q[50]; string s:
int main() {
	cin >> d >> n;
	for(int i = 0; i < n; i++) {
		cin >> s >> z;
		if(s == "D") p[x++] = z;
	}
	sort(p, p + x);
	cin >> m;
	for(int i = 0; i < m; i++) {
		cin >> s >> z;
		if(s == "DD") q[y++] = z;
	}
	sort(q, q + y);
	int ret = 0;
	for(int i = 0; i <= x; i++) {
		for(int j = 0; j <= y; j++) {
			if(i + 2 * j <= d) {
				int sum = 0;
				for(int k = 0; k < i; k++) sum += p[k];
				for(int k = 0; k < j; k++) sum += q[k];
				ret = max(ret, sum);
			}
		}
	}
	cout << ret << endl;
}

Compiler output:
a.cc:5:45: error: expected initializer before ':' token
    5 | int d, n, m, x, y, z, p[50], q[50]; string s:
      |                                             ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int ans = 0;
vector<string> a;
vector<int> p;
int D, x, y;

void dfs(int now, int d, int point) {
	if (now >= x+y || d >= D) {
		ans = max(ans, point);
		return;
	}

	bool usable1 = false;
	bool usable2 = false;
	if (now < x) {
		if (a[now]=="D") usable1 = true;
	} else {
		if (a[now]=="DD") usable2 = true;
	}

	if (usable1) {
		dfs(now + 1, d + 1, point + p[now]);
		dfs(now + 1, d, point);
	} else if (usable2) 
		dfs(now + 1, d + 2, point + p[now]);
		dfs(now + 1, d, point);
	} else {
		dfs(now + 1, d, point);
	}
}

int main() {
	cin >> D;

	a.assign(25, "");
	p.assign(25, 0);

	cin >> x;
	for (int i=0; i<x; i++) {
		cin >> a[i] >> p[i];
	}

	cin >> y;
	for (int i=0; i<y; i++) {
		cin >> a[x+i] >> p[x+i];
	}

	dfs(0, 0, 0);

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc:33:11: error: expected unqualified-id before 'else'
   33 |         } else {
      |           ^~~~
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

#define loop(n) for(int lp=0; lp<(n); lp++)
#define ascent(i, a, b)  for(int (i)=(a); (i)<(b); (i)++)
#define descent(i, a, b) for(int (i)=(a); (i)<(b); (i)--)

int main() {
  int D, x, y;
  vector<int> p, pp;
  
  cin >> D;
  cin >> x;
  
  string stmp;
  int itmp;

  loop(x) {
    cin >> stmp >> itmp;
    if(stmp == "D") {
      p.push_back(itmp);
    }
  }

  cin >> y;
  loop(y) {
    stmp.clear();
    cin >> stmp >> itmp;
    if( stmp == "DD") {
      pp.push_back(itmp);
    }
  }



  if(p.size())  sort(p.begin(), p.end(), greater<int>());
  if(pp.size()) sort(pp.begin(), pp.end(), greater<int>());

  int i = 0, j = 0;
  vector<int> ans;
  while(D > 0) {
    if(i >= p.size() && j >= pp.size()) break;

    if(i >= p.size()) {
      while(D >= 2) {
	ans.push_back(pp[j]);
	j ++;
	D -= 2;
      }
      break;
    }
    else if(j >= pp.size()) {
      while(D) {
	ans.push_back(p[i]);
	i ++;
	D --;
      }
      break;
    }

    int ptmp;
    if(i == p.size()-1) {
      ptmp = p[i];
      //ptmp = 2*p[i];
    }
    else {
      //ptmp = 2*p[i];
      ptmp = p[i] + p[i+1];
    }

    if(D == 1) {
      ans.push_back(p[i]);
      break;
    }

    if(ptmp < pp[j]) {
      ans.push_back(pp[j]);
      j ++;
      D -= 2;
    }
    else if(ptmp => pp[j]) {
      ans.push_back(p[i]);
      i ++;
      D --;
    }    
  }
  
  int sum = 0;
  ascent(i, 0, ans.size()) {
    sum += ans[i];
  }
  cout << sum << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:86:19: error: expected primary-expression before '>' token
   86 |     else if(ptmp => pp[j]) {
      |                   ^
Language: C++

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(T) (T).begin(), (T).end()

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;

int h,w,d,n;

const int inf=1;

char b[55][55];
int dis[15];

int cnt[55][55];

bool used[55][55];
int sx,sy;
int gx,gy;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

bool bfs(){
	pii init;
	init.first=sy;init.first=sx;
	used[init.first][init.second]=true;
	queue<pii> q;
	q.push(init);
	while(!q.empty()){
		
		pii cur=q.front();q.pop();
		if(cur.first==gy &&cur.second==gx)
			return true;  
		rep(i,4){
			pii next=cur;
			next.first+=dy[i]; next.second+=dx[i];
			if(0<=next.first&&next.first<h&&0<=next.second&&next.second<w&&!used[next.first][next.second] &&b[next.first][next.second]!='#'){
				used[next.first][next.second]=true;
				q.push(next);
			} 
		}
	}
	return false;
}


int main(void){
	cin >> h >> w >> d >> n;
	rep(i,h)rep(j,w){
		 cin >> b[i][j];
		 if(b[i][j]=='D'){
		 	sy=i,sx=j;
		 	
		 }
	}
	rep(i,d) cin >> dis[i];
	
	rep(loop,n){
		int x,y,s;
		cin >> x >> y >> s;
		int from=-1;
		int to=55;
		if(s!=0)
			from=dis[s-1];;
		if(s!=d)A
			to=dis[s];
		
		for(int i=y-to;i<=y+to;i++){
			for(int j=x-to;j<=x+to;j++){
				if(0<=i&&i<h&&0<=j&&j<w){
					if( (from+1<=abs(i-y)&&abs(i-y)<=to)||(from+1<=abs(j-x)&&abs(j-x)<=to))
						cnt[i][j]++;
				}
			}
		}	
	}
	int res=0;
	rep(i,h)rep(j,w) {
		if(cnt[i][j]==n && b[i][j]!='#'){
			gy=i,gx=j;
			res++;
		}
	}
	
	if(res>=2)
		cout << "Unknown"<< endl;
	else if(res==1){
		if(bfs())
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}else
		cout << "Broken" << endl;	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:74:25: error: 'A' was not declared in this scope
   74 |                 if(s!=d)A
      |                         ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;

#include "../geometry.h"
int main(){
    const double W = 50;
    const double H = 94;
    int N, D;
    cin >> N >> D;
    vector<C> c(N);
    REP(i, N){
        double x, y, r;
        cin >> x >> y >> r;
        c[i] = {{x, y}, r};
    }
    const P start(W / 2, 0);
    const P goal (W / 2, H);
    vector<L> st, gt;
    for(int i = 0; i < N; i++){
        vector<L> sv = tangents_through_point(c[i], start);
        vector<L> gv = tangents_through_point(c[i], goal );
        st.insert(st.end(), sv.begin(), sv.end());
        gt.insert(gt.end(), gv.begin(), gv.end());
    }
    const double INF = 1e9;
    double ans = INF;

    // 直線で進んだとき
    {
        L shortest(start, goal);
        int cnt = 0;
        for(int i = 0; i < N; i++){
            if(iCS(c[i], shortest)) cnt++;
        }
        if(cnt <= D){
            ans = abs(shortest.vector());
        }
    }

    // 円を接するときの経路
    for(L sl : st){
        for(L gl : gt){
            if(paralell(sl, gl)) continue;
            P cp = pLL(sl, gl);
            if(!(sign(0, cp.real()) <= 0 && sign(cp.real() ,W) <= 0)) continue;
            if(!(sign(0, cp.imag()) <= 0 && sign(cp.imag(), H) <= 0)) continue;
            L sm(start, cp);
            L gm(cp, goal);
            // cout << sm[0] << " -> " << sm[1] << endl;
            // cout << gm[0] << " -> " << gm[1] << endl;
            int cnt = 0;
            for(int i = 0; i < N; i++){
                if(iCS(c[i], sm) && sign(dSP(sm, c[i].p), c[i].r) != 0) cnt++;
                if(iCS(c[i], gm) && sign(dSP(gm, c[i].p), c[i].r) != 0) cnt++;
                if(contains(c[i], cp) == IN) cnt--;
            }
            if(cnt <= D){
                double d = abs(sm.vector()) + abs(gm.vector());
                ans = min(ans, d);
            }
        }
    }

    if(ans == INF) {
        printf("-1\n");
    } else {
        printf("%.12f\n", ans);
    }
    return 0;
}

Compiler output:
a.cc:6:10: fatal error: ../geometry.h: No such file or directory
    6 | #include "../geometry.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while (true) {
			int n = sc.nextInt();
			if (n == 0) {
				break;
			}

			char[] upOrDown = new char[n];
			for (int i = 0; i < n; i++) {
				upOrDown[i] = sc.next().charAt(1);
			}

			int count = 0;
			for (int i = 0; i < n / 2; i++) {
				if (upOrDown[2 * i] == upOrDown[2 * i + 1]) {
					count++;
				}
			}

			System.out.println(count);
		}
		sc.close();
	}
}
/*
 * 4 lu ru ld rd 4 lu ld lu ru 1 lu 10 ru lu ld rd ru rd ru lu rd ld 0
 */

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

class Main{           
  
   public static void main(String[] args){
         Scanner sc = new Scanner(System.in);  
         
         while(true){
             
             int n = sc.nextInt();
             int count = 0;
             if(n == 0){
                 break;
             }
             
             String S = "";
             for(int i = 0;i < n;i++){
                 S += sc.next();
             }
             S = S.replace("luru","h");
             S = S.replace("ldrd","h");
             S = S.replace("rulu","h");
             S = S.replace("rdld","h");
                  
             char s[]= S.toCharArray();
             
             for(int i = 0;i < s.length;i++){
                 if(s[i] == 'h'){
                     count++;
                 }
             }
             System.out.println(count);
         }
         
         
   }         
         
 }
  

Compiler output:
Main.java:4: error: cannot find symbol
         Scanner sc = new Scanner(System.in);  
         ^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
         Scanner sc = new Scanner(System.in);  
                          ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main1 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ans = 0;

		while (true) {

			int n = sc.nextInt();
			if (n == 0) {
				break;
			}
			List<String> step = new ArrayList<>();
			for (int i = 0; i < n; i++) {
				step.add(sc.next());
			}

			for (int i = 0; i < n; i++) {
				if ((ans == 0 || ans % 2 == 0) && (step.get(i).substring(1).equals("u")
						&& step.get(i + 1).substring(1).equals("u"))) {
					ans++;
				} else if (ans % 2 == 1 && (step.get(i).substring(1).equals("d")
						&& step.get(i + 1).substring(1).equals("d"))) {
					ans++;
				}
			}

		}
		System.out.println(ans);
	}
}


Compiler output:
Main.java:5: error: class Main1 is public, should be declared in a file named Main1.java
public class Main1 {
       ^
1 error
Language: Java

import sun.jvm.hotspot.utilities.StreamMonitor;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
    public enum pattern {
        lu, //左足を踏み台に上げる
        ru, //右足を踏み台に上げる
        ld, //左足を踏み台に下げる
        rd, //右足を踏み台に下げる
        ;
    }

    static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
        while ((line = br.readLine().trim()) != null && !"0".equals(line)) {
            int ans = 0;
            String[] input = line.split(" ");
            if(Stream.of(pattern.values()).map(e->e.name()).anyMatch(code->code.equals(input[0]))) {
                for(int i = 0 ; i < input.length; i++) {
                    if(i < input.length -1 && input[i].substring(1).equals("u") == input[i+1].substring(1).equals("u")) ans ++;
                    if(i < input.length -1 && input[i].substring(1).equals("d") == input[i+1].substring(1).equals("d")) ans ++;
                }
                System.out.println(ans/2);
            }
        }
    }
}



Compiler output:
Main.java:1: error: package sun.jvm.hotspot.utilities is not visible
import sun.jvm.hotspot.utilities.StreamMonitor;
                      ^
  (package sun.jvm.hotspot.utilities is declared in module jdk.hotspot.agent, which is not in the module graph)
1 error
Language: Java

public class Main {
    public enum pattern {
        lu, //左足を踏み台に上げる
        ru, //右足を踏み台に上げる
        ld, //左足を踏み台に下げる
        rd, //右足を踏み台に下げる
        ;
    }

    static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
        while ((line = br.readLine().trim()) != null && !"0".equals(line)) {
            int ans = 0;
            String[] input = line.split(" ");
            if(Stream.of(pattern.values()).map(e->e.name()).anyMatch(code->code.equals(input[0]))) {
                for(int i = 0 ; i < input.length; i++) {
                    if(i < input.length -1 && input[i].substring(1).equals("u") == input[i+1].substring(1).equals("u")) ans ++;
                    if(i < input.length -1 && input[i].substring(1).equals("d") == input[i+1].substring(1).equals("d")) ans ++;
                }
                System.out.println(ans/2);
            }
        }
    }
}


Compiler output:
Main.java:10: error: cannot find symbol
    static Scanner scan = new Scanner(System.in);
           ^
  symbol:   class Scanner
  location: class Main
Main.java:10: error: cannot find symbol
    static Scanner scan = new Scanner(System.in);
                              ^
  symbol:   class Scanner
  location: class Main
Main.java:13: error: cannot find symbol
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ^
  symbol:   class BufferedReader
  location: class Main
Main.java:13: error: cannot find symbol
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                                ^
  symbol:   class BufferedReader
  location: class Main
Main.java:13: error: cannot find symbol
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                                                   ^
  symbol:   class InputStreamReader
  location: class Main
Main.java:18: error: cannot find symbol
            if(Stream.of(pattern.values()).map(e->e.name()).anyMatch(code->code.equals(input[0]))) {
               ^
  symbol:   variable Stream
  location: class Main
6 errors
Language: C

#include <stdio.h>
 
int main() {
	int n;
	int i;
	int cnt;
	char s[100][3];
	int a[100];
 
	while(scanf("%d",&n),n){
		for(i = 0;i < n;i++){
			scanf("%s",s[i]);
		}
		cnt = 0;
 
		for(i = 0;i < n;i++){
			switch(s[i][0]){
				case 'l':
					if(s[i][1] == 'u'){
						a[i] = 0;
					}else if(s[i][1] == 'd'){
						a[i] = 2;
					break;
				case 'r':
					if(s[i][1] == 'u'){
						a[i] = 1;
					}else if(s[i][1] == 'd'){
						a[i] = 3;
					}
					break;
			}
		}

		for(i = 0;i < n-1;i++){
			if(a[i] == 0 && a[i+1] == 1 || a[i] == 1 && a[i+1] == 0
			 ||a[i] == 2 && a[i+1] == 3 || a[i] == 3 && a[i+1] == 2)cnt++;
		}
		
		printf("%d\n",cnt);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:42:1: error: expected declaration or statement at end of input
   42 | }
      | ^
Language: C

#include <stdio.h>
 
int main() {
	int n;
	int i;
	int cnt;
	char s[100][3];
	int a[100];
 
	while(scanf("%d",&n),n){
		for(i = 0;i < n;i++){
			scanf("%s",s[i]);
		}
		cnt = 0;
 
		for(i = 0;i < n;i++){
			switch(s[i][0]){
				case 'l':
					if(s[i][1] == 'u'){
						a[i] = 0;
					}else if(s[i][1] == 'd'){
						a[i] = 2;
					break;
				case 'r':
					if(s[i][1] == 'u'){
						a[i] = 1;
					}else if(s[i][1] == 'd'){
						a[i] = 3;
					}
					break;
			}
		}

		for(i = 0;i < n-1;i++){
			if(a[i] == 0 && a[i+1] == 1 || a[i] == 1 && a[i+1] == 0||a[i] == 2 && a[i+1] == 3 || a[i] == 3 && a[i+1] == 2)cnt++;
		}
		
		printf("%d\n",cnt);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:41:1: error: expected declaration or statement at end of input
   41 | }
      | ^
Language: C++

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int n;
        cin >> n;
        if(n == 0) return;

        vector<string> vs(n);
        rep(i, 0, n) cin >> vs[i];

        int l = 0, r = 0;
        int state = 0;
        int ans = 0;

        for (int i = 0; i < n; ++i) {
            int nl = l, nr = r, nstate = state;
            if (vs[i] == "lu") {
                nl = 1;
            }
            if (vs[i] == "ld") {
                nl = 0;
            }
            if (vs[i] == "ru") {
                nr = 1;
            }
            if (vs[i] == "rd") {
                nr = 0;
            }
            if(nr == nl){
                nstate = nr;
            }
            if(nstate != state){
                ans++;
            }
            l = nl;
            r = nr;
            state = nstate;
        }
        cout << ans << endl;

        if (n != 0) solve();
    }
};


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

char s[9];a,b[9],c;main(n){for(;scanf("%d",&n),n;printf("%d\n",c),a=b[0]=b[1]=c=0)for(;n--;){scanf("%s",s);b[s[0]/109]=s[1]&1;if(b[0]==b[1]&&a-b[0])c++,a=b[0];}}

Compiler output:
a.cc:1:11: error: 'a' does not name a type
    1 | char s[9];a,b[9],c;main(n){for(;scanf("%d",&n),n;printf("%d\n",c),a=b[0]=b[1]=c=0)for(;n--;){scanf("%s",s);b[s[0]/109]=s[1]&1;if(b[0]==b[1]&&a-b[0])c++,a=b[0];}}
      |           ^
a.cc:1:24: error: expected constructor, destructor, or type conversion before '(' token
    1 | char s[9];a,b[9],c;main(n){for(;scanf("%d",&n),n;printf("%d\n",c),a=b[0]=b[1]=c=0)for(;n--;){scanf("%s",s);b[s[0]/109]=s[1]&1;if(b[0]==b[1]&&a-b[0])c++,a=b[0];}}
      |                        ^
Language: C++


  cin>>bef;num--;

Compiler output:
a.cc:2:3: error: 'cin' does not name a type
    2 |   cin>>bef;num--;
      |   ^~~
a.cc:2:12: error: 'num' does not name a type; did you mean 'enum'?
    2 |   cin>>bef;num--;
      |            ^~~
      |            enum
Language: C++

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

vector<string> action;
int N;
int ans;

int main(void){
  while(ture){
    cin >> N;
    if(N == 0) break;
    ans = 0;
    action.clear();
    for(int i = 0; i < N; i++){
      string tmp;
      cin >> tmp;
      action.push_back(tmp);
    }

    for(int i = 0; i < N; i += 2){
      if(action[i] == "lu" && action[i+1] == "ru") ans++;
      else if(action[i] == "ru" && action[i+1] == "lu") ans++;
      else if(action[i] == "ld" && action[i+1] == "rd") ans++;
      else if(action[i] == "rd" && action[i+1] == "ld") ans++;
    }
    
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'ture' was not declared in this scope
   11 |   while(ture){
      |         ^~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
  int n,count;
  char ch[201];

  while(cin>>n){
    if(n==0)break;
    n=2*n;
    count=0;
    for(int i=0;i<n;i++)
      cin>>ch[i];

    for(int i=0;i+3<n;i+=4)
      if((ch[i]!=ch[i+2])count++;
    cout<<count<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:26: error: expected ';' before 'count'
   16 |       if((ch[i]!=ch[i+2])count++;
      |                          ^~~~~
      |                          ;
a.cc:17:22: error: expected ')' before ';' token
   17 |     cout<<count<<endl;
      |                      ^
      |                      )
a.cc:16:9: note: to match this '('
   16 |       if((ch[i]!=ch[i+2])count++;
      |         ^
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main(){
  int i,n,a;
  string asi;
  while(1){
    cin>>n;
    if(n==0) break;
    else {
      for(i=0;i<n;i++){
	cin>>asi[i];
      }
      a=0;
      asi[100]="ii";
      for(i=0;i<n;i++){

	  if(asi[i]=="lu"){
	    if(asi[i+1]=="ru"){
	      a++;
	    
	    }
	  }
	  if(asi[i]=="ru"){
	    if(asi[i+1]=="lu"){
	      a++;
	     
	    }
	  }
	
	
	  if(asi[i]=="ld"){
	    if(asi[i+1]=="rd"){
	      a++;
	    }
	  }
	  if(asi[i]=="rd"){
	    if(asi[i+1]=="ld"){
	      a++;
	    }
	  }
	
      }
      cout<<a<<endl;
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   15 |       asi[100]="ii";
      |                ^~~~
      |                |
      |                const char*
a.cc:18:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   18 |           if(asi[i]=="lu"){
a.cc:19:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |             if(asi[i+1]=="ru"){
a.cc:24:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   24 |           if(asi[i]=="ru"){
a.cc:25:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   25 |             if(asi[i+1]=="lu"){
a.cc:32:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   32 |           if(asi[i]=="ld"){
a.cc:33:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   33 |             if(asi[i+1]=="rd"){
a.cc:37:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   37 |           if(asi[i]=="rd"){
a.cc:38:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   38 |             if(asi[i+1]=="ld"){
Language: C++

#include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{int i=0,j,k;
  int counter[MAX];
  char str[MAX][MAX];

  while{
    scanf("%d",&num[i]);
    scanf("%s",str[i][]);
    if(num[i] == 0)
      break;
    i++;

}
  for(j=0;j<i;j++){
    for(k=0;k<num[i]*3;num[i]+=0){

Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: 'MAX' was not declared in this scope
   12 |   int counter[MAX];
      |               ^~~
a.cc:15:8: error: expected '(' before '{' token
   15 |   while{
      |        ^
      |        (
a.cc:15:8: error: expected primary-expression before '{' token
a.cc:15:8: error: expected ')' before '{' token
   15 |   while{
      |        ^
      |        )
a.cc:16:17: error: 'num' was not declared in this scope; did you mean 'enum'?
   16 |     scanf("%d",&num[i]);
      |                 ^~~
      |                 enum
a.cc:17:16: error: 'str' was not declared in this scope; did you mean 'std'?
   17 |     scanf("%s",str[i][]);
      |                ^~~
      |                std
a.cc:17:23: error: expected primary-expression before ']' token
   17 |     scanf("%s",str[i][]);
      |                       ^
a.cc:24:15: error: 'num' was not declared in this scope; did you mean 'enum'?
   24 |     for(k=0;k<num[i]*3;num[i]+=0){
      |               ^~~
      |               enum
a.cc:24:35: error: expected '}' at end of input
   24 |     for(k=0;k<num[i]*3;num[i]+=0){
      |                                  ~^
a.cc:24:35: error: expected '}' at end of input
a.cc:23:19: note: to match this '{'
   23 |   for(j=0;j<i;j++){
      |                   ^
a.cc:24:35: error: expected '}' at end of input
   24 |     for(k=0;k<num[i]*3;num[i]+=0){
      |                                   ^
a.cc:11:1: note: to match this '{'
   11 | {int i=0,j,k;
      | ^
Language: C++


#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    while(cin>>n,n){
        string str,a="rldu";
        bool leg[2]={};
        int ans=0,now=1,num[2]={0,1};
        for(;n>0;n--){
            cin>>str;
            for(int i=0;i<2;i++)if(str[0]==a[i])for(int j=0;j<2;j++)if(str[1]==a[2+j])leg[i]=num[j];
            if(now==leg[0]&&now==leg[1]){
                ans++;
                now=(now+1)%2;
            }
        }
        cout<<ans<<endl;
    }

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

#include <iostream>
#include <fstream>
#include<string>
using namespace std;

int main(){
	while (1) {
		int steps, count=0;
		cin >> steps;
		string leg1, leg2;
		if (steps == 0){ break; }
		int loops;
		if (steps % 2 == 1) { loops = (steps + 1) / 2; }
		else { loops = steps / 2; }
		for (int i = 0; i < loops; i++)
		{
			if (loops - i == 1) {
				if (steps % 2 == 1) {
					cin >> leg1;
					break;
				}
			}
				cin >> leg1 >> leg2;
			if (leg1=="lu"&&leg2=="ru")
			{	count = count + 1;}
			if (leg1 == "ru"&&leg2 == "lu")
			{count = count + 1;}
			if (leg1 == "ld"&&leg2 == "rd")
			{count = count + 1;}
			if (leg1 == "rd"&&leg2 == "ld")
			{count = count + 1;}
		}
		cout << count<<endl;
	};
	return 0;

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

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main(){
	while (1) {
		int steps, count=0;
		cin >> steps;
		string leg1, leg2;
		if (steps == 0){ break; }
		int loops;
		if (steps % 2 == 1) { loops = (steps + 1) / 2; }
		else { loops = steps / 2; }
		for (int i = 0; i < loops; i++)
		{
			if (loops - i == 1) {
				if (steps % 2 == 1) {
					cin >> leg1;
					break;
				}
			}
				cin >> leg1 >> leg2;
			if (leg1=="lu"&&leg2=="ru")
			{	count = count + 1;}
			if (leg1 == "ru"&&leg2 == "lu")
			{count = count + 1;}
			if (leg1 == "ld"&&leg2 == "rd")
			{count = count + 1;}
			if (leg1 == "rd"&&leg2 == "ld")
			{count = count + 1;}
		}
		cout << count<<endl;
	};
	return 0;

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

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<stack>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX  999999
int main(){
	while(true){
	int ans =0;
	int n; cin >> n; if(!n) break;
	stack<int>stl;
	stack<int>str;
	char s[2]; scanf("%s",s);
	int lastsize = 0;
	rep(i,n){ 
	if(i != 0) scanf("%s",s);
	if(strcmp(s,"lu") == 0) stl.push(1); 
	if(strcmp(s,"ld") == 0)	stl.pop(); 
	if(strcmp(s,"ru") == 0) str.push(1);
	if(strcmp(s,"rd") == 0) str.pop();
	int lsize = stl.size();
	int rsize = str.size();
	if(lsize ==rsize && lsize != lastsize){ans++;lastsize = lsize;}
		}
	cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:12: error: 'strcmp' was not declared in this scope
   40 |         if(strcmp(s,"lu") == 0) stl.push(1);
      |            ^~~~~~
a.cc:13:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   12 | #include<complex>
  +++ |+#include <cstring>
   13 | #define vi vector<int>
a.cc:41:12: error: 'strcmp' was not declared in this scope
   41 |         if(strcmp(s,"ld") == 0) stl.pop();
      |            ^~~~~~
a.cc:41:12: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:42:12: error: 'strcmp' was not declared in this scope
   42 |         if(strcmp(s,"ru") == 0) str.push(1);
      |            ^~~~~~
a.cc:42:12: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:43:12: error: 'strcmp' was not declared in this scope
   43 |         if(strcmp(s,"rd") == 0) str.pop();
      |            ^~~~~~
a.cc:43:12: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include<string>
using namespace std;
int main(){
  while(1){
    int n,a=0,b=0,kai=0;
    string asi;
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin>>asi;
      if(asi[0]=='r'){
        if(asi[1]=='u')a++;
        else a--;
      }
      if(asi[0]=='l'){
        if(asi[1]=='u')b++;
        else b--;
      }
      if(kai%2==0&&a+b==2)kai++;
      if(kai%2==1&&a+b==0)kai++;
    }
    printf("%d\n",kai);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin>>n;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<string>
  +++ |+#include <iostream>
    2 | using namespace std;
Language: C++

#include <iostream>
#include <string>
#include <cstdio>
#include <cctype>
#include <cstring>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

int main(){
    int n;
    while(cin>>n && n){
        static char g[2000][2000];
        memset(g,0,sizeof(g));
        rep(i,n){
            cin >> g[i];
            for(int j=0; g[i][j]=='.'; j++){
                if(g[i][j+1]=='.'){
                    g[i][j] = ' ';
                }else{
                    g[i][j] = '+';
                    break;
                }
            }
        }
        for(int i=1; i<n; i++){
            int j=0;
            for(g[i][j]!='+'; j++);
            int ii=i+1;
            for(;g[ii][j]==' '; ii++);
            if(g[ii][j]!='+') continue;
            for(int y=i+1;y<ii; y++){
                g[y][j]='|';
            }
        }

        rep(i,n){
            cout << g[i]<<endl;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:34: error: expected ';' before ')' token
   30 |             for(g[i][j]!='+'; j++);
      |                                  ^
      |                                  ;
Language: C++

#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};


int main(){
  int total_lines;
  while(~scanf("%d",&total_lines)){
    if(total_lines == 0) break;

    char responses[1024][64];
    int parent[1024];
    int depth_log[1024];
    memset(parent,-1,sizeof(parent));

    for(int line_idx = 0; line_idx < total_lines; line_idx++){
      char buf[64];
      scanf("%s",buf);
      strcpy(responses[line_idx],buf);
      int depth = count(buf,buf + strlen(buf),'.');
      depth_log[line_idx] = depth;
      for(int prev_idx = line_idx - 1; prev_idx >= 0; prev_idx--){
        if(depth_log[prev_idx] < depth){
          parent[line_idx] = prev_idx;
          break;
        }
      }
    }

    int connect[1024];
    memset(connect,-1,sizeof(connect));
    for(int first_idx = 0; first_idx < total_lines; first_idx++){
      for(int last_idx = first_idx + 1; last_idx < total_lines; last_idx++){
        if(parent[first_idx] == parent[last_idx]){
          connect[first_idx] = last_idx;
          break;
        }
      }
    }
    for(int line_idx = 0; line_idx < total_lines; line_idx++){
      if(depth_log[line_idx] != 0){
        responses[line_idx][depth_log[line_idx] - 1] = '+';
      }

      if(connect[line_idx] != -1){
        int last_idx = connect[line_idx];
        for(int i = line_idx + 1; i < last_idx; i++){
          if(responses[i][depth_log[line_idx] - 1] != '+'){
            responses[i][depth_log[line_idx] - 1] = '|';
          }
        }
      }
    }

    for(int line_idx = 0; line_idx < total_lines; line_idx++){
      for(int i = 0; i < (int)strlen(responses[line_idx]); i++){
        if(responses[line_idx][i] == '.'){
          responses[line_idx][i] = ' ';
        }
      }
      printf("%s",esponses[line_idx]);
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:90:19: error: 'esponses' was not declared in this scope; did you mean 'responses'?
   90 |       printf("%s",esponses[line_idx]);
      |                   ^~~~~~~~
      |                   responses
Language: C++

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while(cin >> n && n){
        string post[1000];
        int depth[1000];
        fill(depth, depth+n, 0);
        for(int x = 0; x < n; x++){
            cin >> post[x];
        }
        for(int x = 0; x < n; x++){
            string::iterator ub = upper_bound(post[x].begin(), post[x].end(), 'A');
            depth[x] = ub - post[x].begin();
            if(!depth[x]) continue;
            int y;
            for(y = 0; y < depth[x]; y++){
                post[x][y] = ' ';
            }
            *--ub = '+';
            for(y = x-1; y >= 0; y--){
                if(depth[y] <= depth[x]) break;
            }
            if(depth[y] == depth[x]){
                int d = depth[x]-1;
                for(int z = y+1; z < x; z++){
                    post[z][d] = '|';
                }
            }
        }
        for(int x = 0; x < n; x++){
            cout << post[x] << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:35: error: 'upper_bound' was not declared in this scope
   17 |             string::iterator ub = upper_bound(post[x].begin(), post[x].end(), 'A');
      |                                   ^~~~~~~~~~~
Language: C++

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

int main() {

  while( true ) {

    long long int n;
    cin >> n;
    if ( n == 0 ) break;

    vector< string > v;

    long long int m = 0;

    for ( long long int i = 0; i < n; i++ ) {

      string in;
      cin >> in;
      for ( long long int j = 0; j < in.size(); j++ ) {
	if ( in[j] == '.' ) {
	  in[j] = ' ';
	}else {
	  if ( j != 0 ) in[j-1] = '+';
	  break;
	}
      }
      v.push_back( in );
      m = max( m, 1LL * in.size() );

    }

    for ( long long int x = 0; x < m; x++ ) {
      bool f = false;
      for ( long long int i = n - 1; i >= 0; i-- ) {
	if ( x < v[i].size() ) {
	  if ( v[i][x] == '+' ) {
	    f = true;
	  }else if ( v[i][x] == ' ' ) {
	    if ( f == true ) {
	      v[i][x] = '|';
	    }
	  }else {
	    f = false;
	  }
	}
      }
    }

    for ( long long int i = 0; i < n; i++ ) {
      cout << v[i] << endl;
    }

  }

  return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:14: error: no matching function for call to 'max(long long int&, long long unsigned int)'
   31 |       m = max( m, 1LL * in.size() );
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~
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:31:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   31 |       m = max( m, 1LL * in.size() );
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~
/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