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

using namespace std;
#define rep(i, N) for(int i = 0; i < (int)N; i++)

int main() {
 
  int N ;
  cin >>N ;
  int i;
  vector<int>p(N);
  rep(i, N) cin >> p[i]; 
  int k = 0;
  rep(i, N) if(p[i+1]-p[i]<0) k++; 
  if(k > 2)cout <<" No"<< endl;
  else if(p[i+1]-p[i]>p[i+2]-p[i])cout <<" No"<< endl;
  else cout <<" Yes"<< endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >>N ;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<int>p(N);
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int>p(N);
      |          ^~~
a.cc:10:20: error: 'p' was not declared in this scope
   10 |   rep(i, N) cin >> p[i];
      |                    ^
a.cc:12:16: error: 'p' was not declared in this scope
   12 |   rep(i, N) if(p[i+1]-p[i]<0) k++;
      |                ^
a.cc:13:12: error: 'cout' was not declared in this scope
   13 |   if(k > 2)cout <<" No"<< endl;
      |            ^~~~
a.cc:13:12: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:27: error: 'endl' was not declared in this scope
   13 |   if(k > 2)cout <<" No"<< endl;
      |                           ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:14:11: error: 'p' was not declared in this scope
   14 |   else if(p[i+1]-p[i]>p[i+2]-p[i])cout <<" No"<< endl;
      |           ^
a.cc:14:35: error: 'cout' was not declared in this scope
   14 |   else if(p[i+1]-p[i]>p[i+2]-p[i])cout <<" No"<< endl;
      |                                   ^~~~
a.cc:14:35: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:50: error: 'endl' was not declared in this scope
   14 |   else if(p[i+1]-p[i]>p[i+2]-p[i])cout <<" No"<< endl;
      |                                                  ^~~~
a.cc:14:50: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:15:8: error: 'cout' was not declared in this scope
   15 |   else cout <<" Yes"<< endl;
      |        ^~~~
a.cc:15:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:24: error: 'endl' was not declared in this scope
   15 |   else cout <<" Yes"<< endl;
      |                        ^~~~
a.cc:15:24: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C

#include<stdio.h>
#define MAX 100000
//void Show(int H[],int num);
int main(void){
  int N;
  int H[MAX];
  int i;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&H[i]);
  }

  for(i=0;i<N-1;i++){
    if(H[i]>H[i+1]){
      H[i]--;
    }
  }
  Show(H,N);

  for(i=0;i<N-1;i++){
    if(H[i]>H[i+1]){
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}

/* void Show(int H[],int num){
  int i;
  for(i=0;i<num;i++){
    printf("%d\n",H[i]);
  }
}*/

Compiler output:
main.c: In function 'main':
main.c:18:3: error: implicit declaration of function 'Show' [-Wimplicit-function-declaration]
   18 |   Show(H,N);
      |   ^~~~
Language: C++

#include<cstdio>
#include<cstring>
 using namespace std;
 long long a[100003];
 int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	 scanf("%lld",&a[i]);

	for(int i=2;i<=n;i++)
	 if(a[i]<a[i-1])a[i-1]--;
	 else (a[i]==a[i-1]&&a[i-1]>1)a[i-1]--;
	for(int i=2;i<=n;i++)
	 if(a[i]<=0||a[i]<a[i-1]||a[1]<=0){
	 	printf("No");
	 	return 0;
	 }
	printf("Yes");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:39: error: expected ';' before 'a'
   14 |          else (a[i]==a[i-1]&&a[i-1]>1)a[i-1]--;
      |                                       ^
      |                                       ;
Language: C

#include <stdio.h>

int main(){
    int n;
    scanf("%d",&n);
    int masu[n];
    int i;
    for(i = 0;i<n;i++){
        scanf("%d",&masu[i]);
    }
    int prev = 0;
    int margin = 0;
    for (i = 1; i < n; i++)
    {
        int ret;
        if ((ret = masu[i] - masu[i - 1]) < 0)
        {
            margin += ret;
        }
        else if (ret > 0)
        {
            margin++;
            
        }
        if(ret != 0){
            prev = ret;
        }
        if(margin < 0 || ret < -2 || /*(ret < 0 && prev < 0)*/){
            printf("No");
            return 0;
        }
    }
    printf("Yes");
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:28:63: error: expected expression before ')' token
   28 |         if(margin < 0 || ret < -2 || /*(ret < 0 && prev < 0)*/){
      |                                                               ^
Language: C++

using namespace std ;
int main(){
   int n, a, b, c;
   cin >> n ;
   int d = 0 ;
   vector<int> hi(n);
   for(int i = 0; i < n; i++) cin >> hi.at(i) ;
   for(int i = 0; i < n - 1; i++){
       if(hi.at(i) <= hi.at(i + 1)){
        d = d + 1 ;
       }
       else{
        b = hi.at(i) ;
        c = hi.at(i-1) ;
       }
   }
      if(d == n - 1){
    cout << "Yes" << endl ;
   }
   else if(d == n - 2){
      if(b - c == 1){
          cout << "Yes" << endl ;
      }
   }
   else if(d <= n - 3){
       cout << "No" << endl ;
   }

   return 0;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:4: error: 'cin' was not declared in this scope
    4 |    cin >> n ;
      |    ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std ;
a.cc:6:4: error: 'vector' was not declared in this scope
    6 |    vector<int> hi(n);
      |    ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std ;
a.cc:6:11: error: expected primary-expression before 'int'
    6 |    vector<int> hi(n);
      |           ^~~
a.cc:7:38: error: 'hi' was not declared in this scope; did you mean 'i'?
    7 |    for(int i = 0; i < n; i++) cin >> hi.at(i) ;
      |                                      ^~
      |                                      i
a.cc:9:11: error: 'hi' was not declared in this scope; did you mean 'i'?
    9 |        if(hi.at(i) <= hi.at(i + 1)){
      |           ^~
      |           i
a.cc:18:5: error: 'cout' was not declared in this scope
   18 |     cout << "Yes" << endl ;
      |     ^~~~
a.cc:18:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:22: error: 'endl' was not declared in this scope
   18 |     cout << "Yes" << endl ;
      |                      ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std ;
a.cc:22:11: error: 'cout' was not declared in this scope
   22 |           cout << "Yes" << endl ;
      |           ^~~~
a.cc:22:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:22:28: error: 'endl' was not declared in this scope
   22 |           cout << "Yes" << endl ;
      |                            ^~~~
a.cc:22:28: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:26:8: error: 'cout' was not declared in this scope
   26 |        cout << "No" << endl ;
      |        ^~~~
a.cc:26:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:26:24: error: 'endl' was not declared in this scope
   26 |        cout << "No" << endl ;
      |                        ^~~~
a.cc:26:24: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	    int buildcnt = sc.nextInt();
        int hights[]= new int[buildcnt];
            boolean reach =false;
      String answer = "Yes";
        for(int i=0 ; i<buildcnt ; i++){
         hights[i]=sc.nextInt(); 
        }
//      List<Integer> numlist = new ArrayList<Integer>();
//      while(sc.hasnext()){
  //      numlist.add(sc.nextInt());
    //  }
      for(int i=buildcnt-1 ; i<1 ; i--){

          if(hights[i-1] - hights[i] >1 ){
            answer = "No";
            break;
          }else if(hights[i-1]-hights[i]=1 && !reach){
            reach=true;
          }else if(hights[i-1]-hights[i]=1 && reach){
            answer="No";
            break;
          }else{
            reach=false;
          }
      }

//      int now = sc.nextInt();
//      while(sc.hasNext()){
//       int next = sc.nextInt();
       //今-次が2以上ならNG
 //      if(now - next >= 2){
//         answer="NO";
  //       break;
  //     }else if(now - next == 1){
        
  //       if(reach == true){
  //        answer ="NO";
  //         break;
  //       }else{
  //         reach=true;
  //         now = next;
  //       }
  //     }else{
  //      now = next;
  //      reach=false;
  //     }
   //   }
        // 出力 
		System.out.println(answer);
	}
}


Compiler output:
Main.java:21: error: unexpected type
          }else if(hights[i-1]-hights[i]=1 && !reach){
                              ^
  required: variable
  found:    value
Main.java:21: error: bad operand types for binary operator '&&'
          }else if(hights[i-1]-hights[i]=1 && !reach){
                                           ^
  first type:  int
  second type: boolean
Main.java:23: error: unexpected type
          }else if(hights[i-1]-hights[i]=1 && reach){
                              ^
  required: variable
  found:    value
Main.java:23: error: bad operand types for binary operator '&&'
          }else if(hights[i-1]-hights[i]=1 && reach){
                                           ^
  first type:  int
  second type: boolean
4 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	    int buildcnt = sc.nextInt();
        int hights[]= new int[buildcnt];
            boolean reach =false;
      String answer = "Yes";
        for(int i=0 ; i<buildcnt ; i++){
         hights[i]=sc.nextInt(); 
        }
//      List<Integer> numlist = new ArrayList<Integer>();
//      while(sc.hasnext()){
  //      numlist.add(sc.nextInt());
    //  }
      for(int i=buildcnt-1 ; i<1 ; i--){

          if(hights[i-1] - hights[i] >1 ){
            answer = "No";
            break;
          }else if(hights[i-1]-hights[i]=1 && reach=false){
            reach=true;
          }else if(hights[i-1]-hights[i]=1 && reach=true){
            answer="No";
            break;
          }else{
            reach=false;
          }
      }

//      int now = sc.nextInt();
//      while(sc.hasNext()){
//       int next = sc.nextInt();
       //今-次が2以上ならNG
 //      if(now - next >= 2){
//         answer="NO";
  //       break;
  //     }else if(now - next == 1){
        
  //       if(reach == true){
  //        answer ="NO";
  //         break;
  //       }else{
  //         reach=true;
  //         now = next;
  //       }
  //     }else{
  //      now = next;
  //      reach=false;
  //     }
   //   }
        // 出力 
		System.out.println(answer);
	}
}


Compiler output:
Main.java:21: error: unexpected type
          }else if(hights[i-1]-hights[i]=1 && reach=false){
                              ^
  required: variable
  found:    value
Main.java:21: error: bad operand types for binary operator '&&'
          }else if(hights[i-1]-hights[i]=1 && reach=false){
                                           ^
  first type:  int
  second type: boolean
Main.java:23: error: unexpected type
          }else if(hights[i-1]-hights[i]=1 && reach=true){
                              ^
  required: variable
  found:    value
Main.java:23: error: bad operand types for binary operator '&&'
          }else if(hights[i-1]-hights[i]=1 && reach=true){
                                           ^
  first type:  int
  second type: boolean
4 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	    int buildcnt = sc.nextInt();
        int hights[]= new int[buildcnt];
            boolean reach =false;
      String answer = "Yes";
        for(int i=0 ; i<buildcnt ; i++){
         hights[i]=sc.nextInt(); 
        }
//      List<Integer> numlist = new ArrayList<Integer>();
//      while(sc.hasnext()){
  //      numlist.add(sc.nextInt());
    //  }
      for(int i=buildcnt-1 ; i<1 ; i--){

          if(hights[i-1] - hights[i] >1 ){
          answer = "No";
            break;
          }else if(hights[i-1]-hights[i]=1 && reach=false){
            reach=true;
          }else if(hights[i-1]-hights[i]=1 && reach=true){
            answer="No";
            break;
          }else{
            reach=false;
      }  

//      int now = sc.nextInt();
//      while(sc.hasNext()){
//       int next = sc.nextInt();
       //今-次が2以上ならNG
 //      if(now - next >= 2){
//         answer="NO";
  //       break;
  //     }else if(now - next == 1){
        
  //       if(reach == true){
  //        answer ="NO";
  //         break;
  //       }else{
  //         reach=true;
  //         now = next;
  //       }
  //     }else{
  //      now = next;
  //      reach=false;
  //     }
   //   }
        // 出力 
		System.out.println(answer);
	}
}


Compiler output:
Main.java:54: error: reached end of file while parsing
}
 ^
1 error
Language: C++

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

int main(){
    long long int n, cnt, max;
    cin >> n;
    long long int h[n];
    int grad[n-1];
    vector<int> dist;
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    max = 0;
    cnt = 0;
    if(n == 1) cout << "Yes" << endl;
    else {
        for(int i = 0; i < n-1; ++i){
            if(h[i] <= h[i+1]) grad[i] = 1;
            else grad[i] = -1;
            max = max(max, h[i]);
        }
        for(int i = 0; i < n-1; ++i){
            if(grad[i] == -1) {
                cnt++;
                dist.push_back(i);
            }
        }

        if(cnt == 0) cout << "Yes" << endl;
        else if(cnt == 1) {
            if(h[dist[0]] - h[dist[0]+1] > 1) cout << "No" << endl;
            else cout << "Yes" << endl;
        } else {
            if(max - h[n-1] > 1)cout << "No" << endl;
            else cout << "Yes" << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: 'max' cannot be used as a function
   20 |             max = max(max, h[i]);
      |                   ~~~^~~~~~~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
 
int main(void) {
 
	int a, b, c, sum, n, a[n];
	a = b = c = n = sum = 0;
	scanf("%d", &a);
	
	for(int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}

	int evl = a[0];
	int max = 0;

	int flag = 0;

	for (int j = 0; j < n; j++) {
		if (a[j] < max) {
			flag =1;
		 	continue;
		} else {
			continue;
		} 
	}

	(flag == 0) ? printf("Yes") : printf("No");

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:30: error: conflicting types for 'a'; have 'int[n]'
    6 |         int a, b, c, sum, n, a[n];
      |                              ^
main.c:6:13: note: previous declaration of 'a' with type 'int'
    6 |         int a, b, c, sum, n, a[n];
      |             ^
Language: C

#include <stdio.h>
#include <stdlib.h>
 
int main(void) {
 
	int a, b, c, sum, n, a[n];
	a = b = c = n = sum = 0;
	scanf("%d", &a);
	
	for(int i = 0; i < n; i++) {
		scanf("%d", &a[i])
	}

	int evl = a[0];
	int max = 0;

	int flag = 0;

	for (int j = 0; j < n; j++) {
		if (a[j] < max) {
			flag =1;
		 	continue;
		} else {
			continue;
		} 
	}

	(flag == 0) ? printf("Yes") : printf("No");

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:30: error: conflicting types for 'a'; have 'int[n]'
    6 |         int a, b, c, sum, n, a[n];
      |                              ^
main.c:6:13: note: previous declaration of 'a' with type 'int'
    6 |         int a, b, c, sum, n, a[n];
      |             ^
main.c:11:35: error: expected ';' before '}' token
   11 |                 scanf("%d", &a[i])
      |                                   ^
      |                                   ;
   12 |         }
      |         ~
Language: C

#include <stdio.h>
#include <stdlib.h>
 
int main(void) {
 
	int a[n], b, c, sum, n;
	a = b = c = n = sum = 0;
	scanf("%d", &a);
	
	for(int i = 0; i < n; i++) {
		scanf("%d", &a[i])
	}

	int evl = a[0];
	int max = 0;

	int flag = 0;

	for (int j = 0; j < n; j++) {
		if (a[j] < max) {
			flag =1;
		 	continue;
		} else {
			continue;
		} 
	}

	(flag == 0) ? printf("Yes") : printf("No");

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:15: error: 'n' undeclared (first use in this function)
    6 |         int a[n], b, c, sum, n;
      |               ^
main.c:6:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:35: error: expected ';' before '}' token
   11 |                 scanf("%d", &a[i])
      |                                   ^
      |                                   ;
   12 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
  int n;
  cin >> n;
  int arr[n];
  for (i=0;i<n;i++)
  {cin >> arr[i];}
  
  for (j=0; j<n; j++)
  {if (arr[j]> arr[j+1] +1)
  {    cout << "no";
  return 0;}
   
   else { cout << "yes"}
   return 0;}
   
   

Compiler output:
a.cc: In function 'int main()':
a.cc:10:8: error: 'i' was not declared in this scope
   10 |   for (i=0;i<n;i++)
      |        ^
a.cc:13:8: error: 'j' was not declared in this scope
   13 |   for (j=0; j<n; j++)
      |        ^
a.cc:18:24: error: expected ';' before '}' token
   18 |    else { cout << "yes"}
      |                        ^
      |                        ;
a.cc:19:14: error: expected '}' at end of input
   19 |    return 0;}
      |              ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> H(n);
    for(int i=0; i<n; i++){
        cin >> H[i];
    }

    for(int i=1; i<n; i++){
        if(H[i-1]==H[i] && t>1) {H[i-1]-=1; H[i]-=1;}
        else if(H[i-1]-1==H[i]){H[i-1]-=1;}
        else if(H[i-1]== H[i]-1) H[i]-=1;
        else if(H[i-1]<=H[i]) continue;
        else {cout << "No" << endl; return 0;}
    }
    cout << "Yes" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: 't' was not declared in this scope
   16 |         if(H[i-1]==H[i] && t>1) {H[i-1]-=1; H[i]-=1;}
      |                            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long int i,j,n,ans;
    ans=0;
    cin >> n;
    vector<long long int> vec(n);
    for(i=0;i<n;i++){
    cin >> vec.at(i);
    }
    if(vec(0)>1){vec.at(0)=vec.at(0)-1;}
    for(i=0;i<n-1;i++){
        if(vec.at(i)==vec.at(i+1)){
            vec.at(i+1)=vec.at(i+1);
        }
        else if(vec.at(i)<vec.at(i+1)){
            vec.at(i+1)=vec.at(i+1)-1;
        }
        else {
            ans=1;
        }
    }
    if(ans==1){
        cout<<"No"<<endl;
    }else
    {
        cout<<"Yes"<<endl;
    }
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: no match for call to '(std::vector<long long int>) (int)'
   12 |     if(vec(0)>1){vec.at(0)=vec.at(0)-1;}
      |        ~~~^~~
Language: C

#include <stdio.h>

int main(void) {
int N;
int count=0;
int decount=0
int i,j;
scanf("%d", &N);
int H[N];

for(i=0;i<N;i++){
	scanf("%lld",&H[i]);
}
for(i=0;i<N-1;i++){

		if(H[i]-H[i+1]>1){
			count=count+2;
		}else if(H[i]-H[i+1]==1){
			decount=decount+1;
		}else if(H[i]-H[i+1]<1){
			count=count;
		}
	}
if(count<2){
	printf("Yes");
}else{
	printf("No");
}

return 0;

}


Compiler output:
main.c: In function 'main':
main.c:7:1: error: expected ',' or ';' before 'int'
    7 | int i,j;
      | ^~~
main.c:11:5: error: 'i' undeclared (first use in this function)
   11 | for(i=0;i<N;i++){
      |     ^
main.c:11:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> deta(N);
  for (int i = 1; i < N; i++) {
    cin >> data.at(i);
  }
  bool ans = false;
  
  for (int i = 1; i < (N-1); i++) {
  if (data.at(i) <= data.at(i+1) +1) {
     ans = true;
  }  
}
  if (ans) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: overloaded function with no contextual type information
    9 |     cin >> data.at(i);
      |                 ^~
a.cc:14:12: error: overloaded function with no contextual type information
   14 |   if (data.at(i) <= data.at(i+1) +1) {
      |            ^~
a.cc:14:26: error: overloaded function with no contextual type information
   14 |   if (data.at(i) <= data.at(i+1) +1) {
      |                          ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int MAX=10100;
string ans="Yes"
int main()
{
	int n;
	int h[MAX];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
		if(h[i]<h[i-1]&&i!=0)
		h[i]--;
		if(h[i]<h[i-1])ans="No";
	}
	cout<<ans<<endl;
	return 0;
 } 

Compiler output:
a.cc:5:1: error: expected ',' or ';' before 'int'
    5 | int main()
      | ^~~
Language: Java

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class AtcoderBeginner136C {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean flg = true;
        ArrayList<Integer> points = new ArrayList<Integer>();
        Long[] Hs = new Long[N+1];
        for (int i = 1; i <= N; i++) {
            long H = sc.nextLong();
            Hs[i] = H;
            if (Hs[i - 1] > H) {
                Hs[i - 1] = Hs[i - 1] - 1;
                points.add(i - 1);
                for (Integer point : points) {
                    if (Hs[point] > H) {
                        flg = false;
                        break;
                    }
                }
            }
        }
        if (flg) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Hi = new int[N];
   for(int i =0;i<N;i++)
   {
   Hi[i] = sc.nextInt();
   }
   int outcount=0;
   for(int k=1;k<N;k++)
   {
    if( Hi[k-1] =< Hi[k] )
    {
    outcount=0;
    }
    else
    {
    if(Hi[k-1] == Hi[k]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   }
    if(outcount==2) System.out.println("No");
    else System.out.println("Yes");
 }
}

Compiler output:
Main.java:14: error: ']' expected
    if( Hi[k-1] =< Hi[k] )
                      ^
Main.java:14: error: ';' expected
    if( Hi[k-1] =< Hi[k] )
                       ^
Main.java:18: error: 'else' without 'if'
    else
    ^
3 errors
Language: C++

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

int done(int a){
  if(a==1){
  cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}


int main(){
  int n; cin>>n;
  if(n==1) return done(1);
  
  vector<int> h(n);
  for(int i=0; i<n; i++){
    cin>>h[i];
  }
  
  bool canr=true;
  for(int i=0;i<n-1;i++){
    if(h[i+1]+1<h[i]){return done(0);}
    else if(h[i+1]+1==h[i]){
      if(!canr) return done(0);
      canr = false;
    }else if(h[i+1]==h[i]){
      canr =false;
    }else canr=true;
  
  }
  
  done(1);
  


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

//include
//----------
#include<bits/stdc++.h>
//----------

//repetition
//----------
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
//----------

using namespace std;

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

    int n;
    cin>>n;
    vector<int> h(n);
    vector<int> v(n);
    REP(i,n){
        cin >> h[i];
    }
    if(n==1){
        cout << "Yes" << endl;
    }else if(n==2){
        h[0]--;
        if(h[0]<=h[1]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        for (int i = 0; i < n - 2;i++){
            if(h[i+1]-h[i]<0&&h[i+2]-h[i+1]<0){
                cout << "No" << endl;
                return 0;
            }
            if(h[i]>h[i+1]&&abs(h[i+1]-h[i])>1){
                cout << "No" << endl;
                return 0;
            }
            
        }
        if(h[n-2]>h[n-1]abs(h[n-1]-h[n-2])>1){
            cout << "No" << endl;
            return 0;
        }
        cout << "Yes" << endl;
    }
    
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:25: error: expected ')' before 'abs'
   46 |         if(h[n-2]>h[n-1]abs(h[n-1]-h[n-2])>1){
      |           ~             ^~~
      |                         )
Language: C++

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

/* #pragma */
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int GCD(int a,int b){return b?GCD(b,a%b):a;}
long long GCD(long long a, long long b){return b ? GCD(b, a%b) : a;}
int LCM(int a, int b){return a * b / GCD(a, b);}
long long LCM(long long a, long long b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

/*global*/




signed main()
{
	int n; cin >> n;
	vector<int> h(n);
	for(int i = 0, i_len = (int)n; i < i_len; ++i) cin >> h[i];
	
	for(int i = n-1; i > 0; --i){
		int r = h[i];
		int l = h[i-1];
		if(l-r > 1){
			cout << "No" << endl;
			return 0;
		}
		if(i > 1){
		if(l-r == 1){
			h[l]-=1;
		}
		else if(a[i-2] - l == 1){
			h[l] -= 1;
		}
		}
		if(i == 1){
			if(l-r == 1){
			h[l]-=1;
		}
		}
	}
	
	cout << "Yes" << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:77:25: error: 'a' was not declared in this scope
   77 |                 else if(a[i-2] - l == 1){
      |                         ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
using namespace std;

int main()
{
	long N;
	string A = "Yes";
	vector<long> H,S;
	cin >> N;

	for (int i = 0; i < N; i++)
	{
		long a;
		cin >> a;
		H.push_back(a);
		S.push_back(a);
	}

	sort(S.begin(), S.end());

	for (int i = 0; i < H.size(); i++)
	{
		if (H[i] == S.back) {
			for (int j = i; j < H.size(); j++)
			{
				if (H[i] - 1 > H[j]) { A = "No"; }
			}
		}
	}
	cout << A << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:26: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} and '<unresolved overloaded function type>' to binary 'operator=='
   32 |                 if (H[i] == S.back) {
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  puts("No);
       }

Compiler output:
a.cc:5:8: warning: missing terminating " character
    5 |   puts("No);
      |        ^
a.cc:5:8: error: missing terminating " character
    5 |   puts("No);
      |        ^~~~~
a.cc: In function 'int main()':
a.cc:6:8: error: expected primary-expression before '}' token
    6 |        }
      |        ^
Language: Java

import java.util.Scanner;

public class Mai {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] h = new int[n];
		int[] kk = new int[n];
		for(int i=0;i<n;i++) {
			h[i] = sc.nextInt();
			kk[i] = 0;
		}
		boolean f = true;
		for(int i=0;i<n-1;i++) {
			if(h[i+1]-h[i]==1) {
				h[i+1]--;
				kk[i+1]=1;
			}
			if(h[i]>h[i+1]) {
				if(h[i]-h[i+1]==1 && kk[i] ==0) {
					//OK
					kk[i+1]=1;
				}else {
					f=false;
					break;
				}
			}
			if(h[i]==h[i+1]) {
				kk[i+1]=1;
			}
		}
		if(f) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

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

import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Hi = new int[N];
   for(int i =0;i<N;i++)
   {
   Hi[i] = sc.nextInt();
   }
   int outcount=0;
   for(int k=0;k<N-1;k++)
   {
    if( Hi[k] =< Hi[k+1] ){outcount=0;}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   }
    if(outcount==2) System.out.println("No");
    else System.out.println("Yes");
 }
}

Compiler output:
Main.java:14: error: ']' expected
    if( Hi[k] =< Hi[k+1] ){outcount=0;}
                    ^
Main.java:14: error: not a statement
    if( Hi[k] =< Hi[k+1] ){outcount=0;}
                     ^
Main.java:14: error: ';' expected
    if( Hi[k] =< Hi[k+1] ){outcount=0;}
                       ^
Main.java:15: error: 'else' without 'if'
    else
    ^
4 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
  int n;
  cin>>n; 
  if(n==1){
    cout<<"Yes"<<endl;
    return 0;
  }
  vector<long long>h(n);
  for(int i=0;i<n;i++)cin>>h[i];
  
 
  bool f=true;
  for(int i=0;i<n-1;i++){
    if(h[i+1]-h[i]==-1){
      h[i+1]++;
    }
    else if(h[i+1]-h[i]>-1)){
      continue;
    }
    else{
      f=false;
      break;
    }
  }
  if(f)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:28: error: expected primary-expression before ')' token
   29 |     else if(h[i+1]-h[i]>-1)){
      |                            ^
Language: Java

import java.util.Scanner;

public class A003 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.nextLine());
		String[] spl = sc.nextLine().split(" ");
		int[] h = new int[N];
		for(int i = 0;i < N;i++){
			h[i] = Integer.parseInt(spl[i]);
		}
		sc.close();

		for(int i = 1;i < N;i++){
			if(h[i] - h[i-1] < 0){
				h[i-1] = h[i-1] - 1;
				if(h[i] - h[i-1] < 0){
					System.out.println("No");
					return;
				}
			}
		}
		System.out.println("Yes");
	}
}

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

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(Ssystem.in);
    int n = sc.nextInt();
    long[] arr = new long[n];
    for(int i=0;i<n;i++){
      arr[i]=sc.nextLong();
    }
    Arrays.sort(arr);
    int flag=0;
    for(int i=1;i<n-1;i++){
      if((arr[i]-arr[i-1])>1 && arr[i]-arr[i+1]>0){
        flag=1; 
      }
      else if((arr[i]-arr[i-1])>0 && arr[i]-arr[i+1]>1){
        flag=1;
      }
      else if((arr[i]-arr[i-1])>1 && arr[i]-arr[i+1]>1){
        flag=1;
      }
    }
    if(flag==1){
      System.out.println("No");
    }
    else{
      System.out.println("Yes");
    }
  }
}

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

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(Ssystem.in);
    int n = sc.nextInt();
    long[] arr = new long[n];
    for(int i=0;i<n;i++){
      arr[i]=sc.nextLong();
    }
    Arrays.sort(arr);
    int flag=0;
    for(int i=1;i<n-1;i++){
      if((arr[i]-arr[i-1])>1 && arr[i]-arr[i+1]>0){
        flag=1; 
      }
      else if((arr[i]-arr[i-1])>0 && arr[i]-arr[i+1]>1){
        flag=1;
      }
      else if((arr[i]-arr[i-1])>1 && arr[i]-arr[i+1]>1){
        flag=1;
      }
    }
    if(flag=1){
      System.out.println("No");
    }
    else{
      System.out.println("Yes");
    }
  }
}

Compiler output:
Main.java:4: error: cannot find symbol
    Scanner sc = new Scanner(Ssystem.in);
                             ^
  symbol:   variable Ssystem
  location: class Main
Main.java:23: error: incompatible types: int cannot be converted to boolean
    if(flag=1){
           ^
2 errors
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n,cnt=0,flag=0;
  cin>>n;
  if(n==1) { 
    cout<<"Yes";
    return 0;
  }
  int arrheight[n];
  for(int i=0;i<n;i++) cin>>arrheight[i];
  for(int i=0;i<n-1;i++){
    if(arrheight[i+1]>=arrheight[i]&&flag<2) cnt++;
    else if((arrheight[i+1]+1)=arrheight[i]) {
      flag++;
      cnt++;
    }
    else {
      cout<<"No";
      return 0;
    }
  }
  if(cnt==n-1) cout<<"Yes";
  else cout<<"No";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:28: error: lvalue required as left operand of assignment
   14 |     else if((arrheight[i+1]+1)=arrheight[i]) {
      |             ~~~~~~~~~~~~~~~^~~
Language: C++

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

long long a[100011];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i]
	}
	int t=0;
	for(int i=1;i<n;i++){
		if(a[i+1]<a[i]){
			if(a[i+1]>=(a[i]/2)){
				t++;
				a[i]/=2;
			}
			else{
				puts("No");
		    	return 0;
			}
		}
		if(t>1){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:26: error: expected ';' before '}' token
    9 |                 cin>>a[i]
      |                          ^
      |                          ;
   10 |         }
      |         ~
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	    int buildcnt = sc.nextInt();
        int hights[]= new int[buildcnt];
            boolean reach =false;
      String answer = "YES";
        for(int i=0;i++;i<buildcnt){
         hights[i]=sc.nextInt(); 
        }
//      List<Integer> numlist = new ArrayList<Integer>();
//      while(sc.hasnext()){
  //      numlist.add(sc.nextInt());
    //  }
      for(int i=0;i<buildcnt;i++){
        for(int j=i;j<buildcnt;j++){
          if(hights[i] - hights[i+j]>j){
          answer = "NO";
          }
        }
      }

//      int now = sc.nextInt();
//      while(sc.hasNext()){
//       int next = sc.nextInt();
       //今-次が2以上ならNG
 //      if(now - next >= 2){
//         answer="NO";
  //       break;
  //     }else if(now - next == 1){
        
  //       if(reach == true){
  //        answer ="NO";
  //         break;
  //       }else{
  //         reach=true;
  //         now = next;
  //       }
  //     }else{
  //      now = next;
  //      reach=false;
  //     }
   //   }
        // 出力 
		System.out.println(answer);
	}
}

Compiler output:
Main.java:9: error: not a statement
        for(int i=0;i++;i<buildcnt){
                         ^
1 error
Language: Java

import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Hi = new int[N];
   for(int i =0;i<N;i++)
   {
   Hi[i] = sc.nextInt();
   }
   int outcount=0;
   for(int i=0;i<N-1;i++)
   {
    if(Hi[i]=<Hi[i+1]){outcount=0;}
    else
    {
    if(Hi[i] == Hi[i+1]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   }
    if(outcount==2) System.out.println("No");
    else System.out.println("Yes");
 }
}

Compiler output:
Main.java:14: error: ']' expected
    if(Hi[i]=<Hi[i+1]){outcount=0;}
                 ^
Main.java:14: error: not a statement
    if(Hi[i]=<Hi[i+1]){outcount=0;}
                  ^
Main.java:14: error: ';' expected
    if(Hi[i]=<Hi[i+1]){outcount=0;}
                    ^
Main.java:15: error: 'else' without 'if'
    else
    ^
4 errors
Language: Java

import java.util.Scanner;

public class App {
    public static void main(String[] args)  {
       Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int arr[] = new int[n];
        boolean found = false;
        for(int i = 0;i< n;i++){
            arr[i] = sc.nextInt();
        }
        sc.close();
        int max = 0;
        for(int i = 0;i < n - 1;i++){
            max = Math.max(max,arr[i]);
        }
        int maxIndex = 0;
        for(int i = 0;i < n;i++){
            if(max == arr[i]){
                maxIndex = i;
                break;
            }
        }
        
        if(maxIndex == n){
            found = true;
            System.out.println("Yes");
        }
        for(int i = maxIndex + 1;;i++){
            if(i+1== n) {break;}
            if(max - arr[i] >= 2 ){
                System.out.println("No"); found = true;break;
                
            }
            
        }
        if(found == false){
            System.out.println("Yes");
        }
    }
}

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

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	    int buildcnt = sc.nextInt();
        int hights[]= new int[buildcnt];
            boolean reach =false;
      String answer = "YES";
        for(int i=0;i++;i<buildcnt){
         hights[i]=sc.nextInt(); 
        }
//      List<Integer> numlist = new ArrayList<Integer>();
//      while(sc.hasnext()){
  //      numlist.add(sc.nextInt());
    //  }
      for(int i=0;i++;i<buildcnt){
        for(int j=i;j++;j<buildcnt){
          if(hights[i] - hights[i+j]>j){
          answer = "NO";
          }
        }
      }

//      int now = sc.nextInt();
//      while(sc.hasNext()){
//       int next = sc.nextInt();
       //今-次が2以上ならNG
 //      if(now - next >= 2){
//         answer="NO";
  //       break;
  //     }else if(now - next == 1){
        
  //       if(reach == true){
  //        answer ="NO";
  //         break;
  //       }else{
  //         reach=true;
  //         now = next;
  //       }
  //     }else{
  //      now = next;
  //      reach=false;
  //     }
   //   }
        // 出力 
		System.out.println(answer);
	}
}

Compiler output:
Main.java:9: error: not a statement
        for(int i=0;i++;i<buildcnt){
                         ^
Main.java:16: error: not a statement
      for(int i=0;i++;i<buildcnt){
                       ^
Main.java:17: error: not a statement
        for(int j=i;j++;j<buildcnt){
                         ^
3 errors
Language: C++

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

int main() {
	int n; cin >> n;
	int height[n];
	for (int i = 0; i < n; i++) cin >> arr[i];
	int able = 1;
	for (int i = 0; i < n - 1; i++) {
		if (arr[i] - arr[i + 1] < -1) {
			able = 0;
			break;
		}
	}
	if (able) cout << "Yes";
	else cout << "No";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:44: error: 'arr' was not declared in this scope
    7 |         for (int i = 0; i < n; i++) cin >> arr[i];
      |                                            ^~~
a.cc:10:21: error: 'arr' was not declared in this scope
   10 |                 if (arr[i] - arr[i + 1] < -1) {
      |                     ^~~
Language: C++

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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::vector<long long> H){
    std::vector<long long> dH((int)N, 0);
    dH[0] = H[0] - 0;
    for(int i = 0; i < (int)N; ++i) dH[i+1] = H[i+1] - H[i];
    //for(int i = 0; i < (int)N; ++i) cout << dH[i] << endl;
    bool ans = false;
    bool cont = false;
    for(int i = 0; i < (int)N; ++i){
        if(dH[i] < -1) ans = true;
        else if(dH[i] == -1){
            if(!cont) cont = true;
            else ans = true;
        }
        else cont = false;
        if(ans) break;
    }
    if(ans) cout << NO << endl;
    else cout << YES << endl;
}

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: Java

import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      long[] h= new int[n];
      long[] buff= new int[n];
      boolean f=true;
      for (int i=0; i<n; i++){
      	h[i]=sc.nextInt();
        if (i>0 && f) {
          int diff = h[i-1]-h[i];
          buff[i]+=diff;
          if (h[i]<h[i-1]) {
            if (Math.abs(diff)>1) f=false;
            else {
              buff[i-1]++;
              if (buff[i-1]>0) f=false;
            }
          }
        }
      }
      if (f) System.out.println("Yes");
      else System.out.println("No");
    }
}

Compiler output:
Main.java:8: error: incompatible types: int[] cannot be converted to long[]
      long[] h= new int[n];
                ^
Main.java:9: error: incompatible types: int[] cannot be converted to long[]
      long[] buff= new int[n];
                   ^
Main.java:14: error: incompatible types: possible lossy conversion from long to int
          int diff = h[i-1]-h[i];
                           ^
3 errors
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> data(N);
  for (int i = 0; i < N; i++) {
    cin >> data.at(i);
  }

  int counter = 0;

  if(N == 1){
      cout << "YES" << endl;
  } else{
  for (int i = 0; i < N; i++) {

    if (data.at(i) > data.at(i+1) && data.at(i) - 1 >= data.at(i+1) > data.at(i+2) ) {
      counter++;
    }
   }
  }

  }

	if(counter >= 1){
	cout << "YES" << endl;
	}
	else{
	cout << "NO" << endl;
	}
}


Compiler output:
a.cc:27:9: error: expected unqualified-id before 'if'
   27 |         if(counter >= 1){
      |         ^~
a.cc:30:9: error: expected unqualified-id before 'else'
   30 |         else{
      |         ^~~~
a.cc:33:1: error: expected declaration before '}' token
   33 | }
      | ^
Language: C++

#include<iostream>
using namespace std;

int main(){
    int N;
    cin >> N;

    long int H[N];
    for(int i=0; i<N; i++) cin >> H[i];

    int key
    long int max=0;
    for(int i=0; i<N; i++){
        if(max < H[i]){
            max = H[i];
            key = i;
        }
    }

    int flag = 0;
    for(int i=key+1; i<N; i++){
        if(H[key] - H[i] >= 2 && flag==0){
                cout << "No";
                flag = 1;
                break;
        }
    }
    if(flag == 0){
        cout << "Yes";
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: expected initializer before 'long'
   12 |     long int max=0;
      |     ^~~~
a.cc:14:12: error: parse error in template argument list
   14 |         if(max < H[i]){
      |            ^~~~~~~~~~
a.cc:14:22: error: cannot resolve overloaded function 'max' based on conversion to type 'bool'
   14 |         if(max < H[i]){
      |                      ^
a.cc:15:22: error: overloaded function with no contextual type information
   15 |             max = H[i];
      |                      ^
a.cc:16:13: error: 'key' was not declared in this scope; did you mean 'key_t'?
   16 |             key = i;
      |             ^~~
      |             key_t
a.cc:21:15: error: 'key' was not declared in this scope; did you mean 'key_t'?
   21 |     for(int i=key+1; i<N; i++){
      |               ^~~
      |               key_t
Language: C++

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

int main() {
  int N;
  cin>>N;
  vector<int> vec(N);
  int ans=0;
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  for(int i=0;i<N-1;i++){
    if(vec.at(i)>vec.at(i)+1){
      ans=1;
        break;
    }
  }
  for(int i=0;i<N-2;i++){
    if(vec.at(i)>vec.at(i+1)>vec.at(i+2)){
      ans=1;
      break;
    }
  if(ans==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


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

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	    int buildcnt = sc.nextInt();
      List<Integer> numlist = new ArrayList<Integer>();
      while(sc.hasNext()){
        numlist.add(sc.nextInt());
      }
      
      
        
        
        
        
      }
        
      boolean reach =false;
      String answer = "YES";
      int now = sc.nextInt();
      while(sc.hasNext()){
       int next = sc.nextInt();
       //今-次が2以上ならNG
       if(now - next >= 2){
         answer="NO";
         break;
       }else if(now - next == 1){
        
         if(reach == true){
          answer ="NO";
           break;
         }else{
           reach=true;
           now = next;
         }
       }else{
        now = next;
        reach=false;
       }
      }
        // 出力 
		System.out.println("YES");
	}
}

Compiler output:
Main.java:21: error: illegal start of type
      while(sc.hasNext()){
      ^
Main.java:21: error: <identifier> expected
      while(sc.hasNext()){
                      ^
Main.java:21: error: ';' expected
      while(sc.hasNext()){
                        ^
Main.java:42: error: <identifier> expected
		System.out.println("YES");
		                  ^
Main.java:42: error: illegal start of type
		System.out.println("YES");
		                   ^
Main.java:44: error: class, interface, enum, or record expected
}
^
6 errors
Language: C++

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

int main() {
  int N;
  cin>>N;
  vector<int> vec(N);
  int ans=0
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  for(int i=0;i<N-1;i++){
    if(vec.at(i)>vec.at(i)+1){
      ans=1;
        break;
    }
  }
  for(int i=0;i<N-2;i++){
    if(vec.at(i)>vec.at(i+1)>vec.at(i+2)){
      ans=1;
      break;
    }
  if(ans==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'for'
    9 |   for(int i=0;i<N;i++){
      |   ^~~
a.cc:9:15: error: 'i' was not declared in this scope
    9 |   for(int i=0;i<N;i++){
      |               ^
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^