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

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

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

Compiler output:
a.cc:46:3: error: expected unqualified-id before 'if'
   46 |   if (ans == 0) {
      |   ^~
a.cc:49:3: error: expected unqualified-id before 'else'
   49 |   else {
      |   ^~~~
a.cc:53:3: error: expected unqualified-id before 'return'
   53 |   return 0;
      |   ^~~~~~
a.cc:54:1: error: expected declaration before '}' token
   54 | }
      | ^
Language: C++

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

int main(){
  int N;
  cin >> N;
  
  vector<int> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  
  int ans = 0;
  
  for (int i = 0; i < N - 1; i++) {
    if (H.at(i) > H.at(i + 1)) {
      if (H.at(i + 1) - H.at(i) != 1){
        break;
      }
    }
    
    if (i == N - 2) {
      ans = 1;
    }
  }
  #include<bits/stdc++.h>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   29 | int main(){
      |         ^~
a.cc:29:9: note: remove parentheses to default-initialize a variable
   29 | int main(){
      |         ^~
      |         --
a.cc:29:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:29:11: error: a function-definition is not allowed here before '{' token
   29 | int main(){
      |           ^
Language: C++


#include <bits/stdc++.h>
using namespace std;
 
int main (){
int N;
  cin >>N;
  vector<int>data(N);
  bool flag;
  flag=true
  for (int i=0;i<N;i++){
    cin >>data.at(i);
  }
  for (int i=0;i<N;i++){
   if (data.(i+1)-data.(i)+1<0){
   flag=false;
     break
   }
  }
  if (flag==true){
    cout <<"YES"<<endl;
  }
  else {
    cout <<"NO"<<endl;
  }
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: expected ';' before 'for'
   10 |   flag=true
      |            ^
      |            ;
   11 |   for (int i=0;i<N;i++){
      |   ~~~       
a.cc:11:16: error: 'i' was not declared in this scope
   11 |   for (int i=0;i<N;i++){
      |                ^
a.cc:15:13: error: expected unqualified-id before '(' token
   15 |    if (data.(i+1)-data.(i)+1<0){
      |             ^
a.cc:15:24: error: expected unqualified-id before '(' token
   15 |    if (data.(i+1)-data.(i)+1<0){
      |                        ^
a.cc:17:11: error: expected ';' before '}' token
   17 |      break
      |           ^
      |           ;
   18 |    }
      |    ~
Language: C++

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

int main() {
  int n ;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int pre = -999;
  rep(i, n) {
    if (pre <= a[i]-1) [
      pre = a[i]-1;
      }else if(pre <=a[i]) {
        pre = a[i];
      }else{
        puts("No");
        return 0;
      }
      }
      puts("Yes");
  return 0;
}

Compiler output:
a.cc:4:9: error: 'Long' does not name a type; did you mean 'long'?
    4 | typedef Long Long il;
      |         ^~~~
      |         long
a.cc: In function 'int main()':
a.cc:14:19: error: expected ',' before ';' token
   14 |       pre = a[i]-1;
      |                   ^
      |                   ,
a.cc:14:19: error: expected identifier before ';' token
a.cc:14:19: error: expected ']' before ';' token
   14 |       pre = a[i]-1;
      |                   ^
      |                   ]
a.cc: In lambda function:
a.cc:14:19: error: expected '{' before ';' token
a.cc: In function 'int main()':
a.cc:15:8: error: 'else' without a previous 'if'
   15 |       }else if(pre <=a[i]) {
      |        ^~~~
a.cc:15:24: error: 'i' was not declared in this scope
   15 |       }else if(pre <=a[i]) {
      |                        ^
a.cc: At global scope:
a.cc:22:11: error: expected constructor, destructor, or type conversion before '(' token
   22 |       puts("Yes");
      |           ^
a.cc:23:3: error: expected unqualified-id before 'return'
   23 |   return 0;
      |   ^~~~~~
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: Java


import java.io.*;
import java.util.*;

public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
		String []s=br.readLine().split(" ");
		
		int a[]=new int[n];
		
		for(int i=0;i<n;i++)
			a[i]=Integer.parseInt(s[i]);
					
		boolean flag=true;
		
		for(int i=n-2;i>=0;i--)
		{
			if(a[i] > a[i+1]))
				a[i]--;	
		}
		
		for(int i=1;i<n;i++)
		{
			if(a[i]-a[i-1]<0)
			{
				flag=false;
				break;
			}
		}
		
		if(flag == true)
			System.out.println("Yes");	
		else
			System.out.println("No");		
	}
}




Compiler output:
Main.java:23: error: illegal start of expression
			if(a[i] > a[i+1]))
			                 ^
1 error
Language: C++

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

int N;

int main(){
  cin>>N;
  int H[N+1]=0;
  rep(i, N) cin>>H[i];
  bool flg=true;
  for(int i=N-2; i>=0; i--) {
    if (H[i]==H[i+1]+1) H[i]=H[i]-1;
    if(H[i]>H[i+1]+1) {
      flg = false;
      break;
    }
  }
  cout<<((flg==true) ? "YES":"NO")<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: array must be initialized with a brace-enclosed initializer
    9 |   int H[N+1]=0;
      |              ^
Language: C++

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

int N, H[1000000001]=0;

int main(){
  cin>>N;
  rep(i, N) cin>>H[i];
  bool flg=true;
  for(int i=N-2; i>=0; i--) {
    if (H[i]==H[i+1]+1) H[i]=H[i]-1;
    if(H[i]>H[i+1]+1) {
      flg = false;
      break;
    }
  }
  cout<<((flg==true) ? "YES":"NO")<<endl;
}


Compiler output:
a.cc:5:22: error: array must be initialized with a brace-enclosed initializer
    5 | int N, H[1000000001]=0;
      |                      ^
Language: C

#include<stdio.h>

int main(void)
{
   int n,i,s;

   scanf("%d",&n);

   int h[n];

   for(i=0;i<n;i++){
      scanf("%d",&h[i]);
   }

   s=0;
   for(i=1;i<n;i++){
      if(h[i-1]>h[i]){
        h[i-1]--;
      }
      if(h[i-1]-h[i]==1){
        s++;
      }
   }

   if(s==0)
     printf("YES");
   else
     printf("NO");
   

   return 0;


Compiler output:
main.c: In function 'main':
main.c:31:4: error: expected declaration or statement at end of input
   31 |    return 0;
      |    ^~~~~~
Language: C

#include<stdio.h>

int main(void)
{
   int n,h[],i,s;

   scanf("%d",&n);
   for(i=0;i<n;i++){
      scanf("%d",&h[i]);
   }

   s=0;
   for(i=1;i<n;i++){
      if(h[i-1]>h[i]){
        h[i-1]--;
      }
      if(h[i-1]>h[i]){
        s++;
      }
   }

   if(s==0)
     printf("YES\n");
   else
     printf("NO\n");


   return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:10: error: array size missing in 'h'
    5 |    int n,h[],i,s;
      |          ^
Language: C++

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

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

}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   10 |   char ans = "Yes";
      |              ^~~~~
      |              |
      |              const char*
a.cc:14:15: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   14 |         ans = "No";
      |               ^~~~
      |               |
      |               const char*
Language: C

#include<stdio.h>

int main(void)
{
   int n,h[10000],i,s;

   scanf("%d",&n);
   for(i=0;i<n;i++){
      scanf("%d",&h[i]);
   }

   s=0;
   for(i=1;i<n;i++){
      if(h[i-1]>h[i]){
        h[i-1]--;
      }
   }
 
   for(i=1;i<n;i++){
      if(h[i-1]>h[i])
        s++;
   }

   if(s==0)
     printf("YES\n");
   else
     printf("NO\n");
   

   return 0;


Compiler output:
main.c: In function 'main':
main.c:30:4: error: expected declaration or statement at end of input
   30 |    return 0;
      |    ^~~~~~
Language: C++

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

int main() {
  int N;
  vector<int> H(N);
  cin >> N;
  for (int i = 0; i < N; i++) cin >> H[i];
  
  string ans = "Yes";
  if (N == 1) {
    break;
  }
  else {
    for (int i = 0; i < N - 1; i++) {
      if (H[i] > H[i+1] + 1) {
        ans = "No";
        break;
      }
    }
  }
  
  cout << ans << endl;
  

}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: break statement not within loop or switch
   12 |     break;
      |     ^~~~~
Language: C++

#include<iostream>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int pre = -999;
    rep(i,n){
        if(pre <= a[i]-1){
            pre = a[i]-1;
        }else if(pre <= a[i]){
            pre = a[i];
        }else{
            puts("No");
            return 0;
        }
    } 
    puts("Yes");
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int> a(n);
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | #define rep(i,n) for(int i = 0; i < (n); ++i)
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> a(n);
      |            ^~~
a.cc:8:21: error: 'a' was not declared in this scope
    8 |     rep(i,n) cin >> a[i];
      |                     ^
a.cc:11:19: error: 'a' was not declared in this scope
   11 |         if(pre <= a[i]-1){
      |                   ^
Language: C++

#include<iostream>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int pre = -999;
    rep(i,n){
        if(pre <= a[-1]){
            pre = a[i]-1;
        }else if(pre <= a[i]){
            pre = a[i];
        }else{
            puts("No");
            return 0;
        }
    } 
    puts("Yes");
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int> a(n);
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | #define rep(i,n) for(int i = 0; i < (n); ++i)
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> a(n);
      |            ^~~
a.cc:8:21: error: 'a' was not declared in this scope
    8 |     rep(i,n) cin >> a[i];
      |                     ^
a.cc:11:19: error: 'a' was not declared in this scope
   11 |         if(pre <= a[-1]){
      |                   ^
Language: C++

#include<iostream>
#define rep(i,n) for(int i = 0; i < n; ++i)
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int pre = -999;
    rep(i,n){
        if(pre <= a[-1]){
            pre = a[i]-1;
        }else if(pre <= a[i]){
            pre = a[i];
        }else{
            puts("No");
            return 0;
        }
    } 
    puts("Yes");
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int> a(n);
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | #define rep(i,n) for(int i = 0; i < n; ++i)
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> a(n);
      |            ^~~
a.cc:8:21: error: 'a' was not declared in this scope
    8 |     rep(i,n) cin >> a[i];
      |                     ^
a.cc:11:19: error: 'a' was not declared in this scope
   11 |         if(pre <= a[-1]){
      |                   ^
Language: C++

#include<iostream>
#define rep(i,n) for(int i = 0; i < n; ++i);
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a;
    rep(i,n) cin >> a[i];
    int pre = -999;
    rep(i,n){
        if(pre <= a[-1]){
            pre = a[i]-1;
        }else if(pre <= a[i]){
            pre = a[i];
        }else{
            puts("No");
            return 0;
        }
    } 
    puts("Yes");
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int> a;
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | #define rep(i,n) for(int i = 0; i < n; ++i);
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> a;
      |            ^~~
a.cc:8:21: error: 'a' was not declared in this scope
    8 |     rep(i,n) cin >> a[i];
      |                     ^
a.cc:8:23: error: 'i' was not declared in this scope
    8 |     rep(i,n) cin >> a[i];
      |                       ^
Language: C++

#include <bits/stdc++.h>
void rep(int N) 
{for (int i=0;i<N;i++)
  return ;
}
                      
using namespace std;


main(){
int N;
  cin>>N;
  vector<int> H(N);
 rep(N); cin>>H[i];
  
  int pre =-999;
  rep(N); {
    if(pre<=H[i]-1){
      pre=H[i]-1;
    }
    else if(pre<=H[i]){
      pre=H[i];
    }
    else{
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}

        

      



Compiler output:
a.cc:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:14:17: error: 'i' was not declared in this scope
   14 |  rep(N); cin>>H[i];
      |                 ^
Language: C++

#include <bits/stdc++.h>
void rep(int N) 
{for (int i=0;i<N;i++)
  return ;
}
                      
using namespace std;


main(){
int N;
  cin>>N;
  vector<int> H(N);
 rep(N) cin>>H[i];
  
  int pre =-999;
  rep(N) {
    if(pre<=H[i]-1){
      pre=H[i]-1;
    }
    else if(pre<=H[i]){
      pre=H[i];
    }
    else{
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}
        

      



Compiler output:
a.cc:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:14:8: error: expected ';' before 'cin'
   14 |  rep(N) cin>>H[i];
      |        ^~~~
      |        ;
a.cc:17:9: error: expected ';' before '{' token
   17 |   rep(N) {
      |         ^~
      |         ;
Language: C++

#include <bits/stdc++.h>
void rep(int i,int N) 
{for (int i=0;i<N;i++)
  return ;
}
                      
using namespace std;


main(){
int N;
  cin>>N;
  vector<int> H(N);
 rep(i.N) cin>>H[i];
  
  int pre =-999;
  rep(i,N) {
    if(pre<=H[i]-1){
      pre=H[i]-1;
    }
    else if(pre<=H[i]){
      pre=H[i];
    }
    else{
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}
        

      



Compiler output:
a.cc:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:14:6: error: 'i' was not declared in this scope
   14 |  rep(i.N) cin>>H[i];
      |      ^
Language: C++

#include <bits/stdc++.h>
void rep(int i,int N) {for (int i=0;i<N;i++)}
using namespace std;


main(){
int N;
  cin>>N;
  vector<int> H(N);
 rep(i.N) cin>>H[i];
  
  int pre =-999;
  rep(i,N) {
    if(pre<=H[i]-1){
      pre=H[i]-1;
    }
    else if(pre<=H[i]){
      pre=H[i];
    }
    else{
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}
        

      



Compiler output:
a.cc: In function 'void rep(int, int)':
a.cc:2:45: error: expected primary-expression before '}' token
    2 | void rep(int i,int N) {for (int i=0;i<N;i++)}
      |                                             ^
a.cc: At global scope:
a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:10:6: error: 'i' was not declared in this scope
   10 |  rep(i.N) cin>>H[i];
      |      ^
Language: C++

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

main(){
int N;
  cin>>N;
  vector<int> H(N);
 rep(i.N) cin>>H[i];
  
  int pre =-999;
  rep(i,N) {
    if(pre<=H[i]-1){
      pre=H[i]-1;
    }
    else if(pre<=H[i]){
      pre=H[i];
    }
    else{
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}
        

      



Compiler output:
a.cc:10:9: error: macro "rep" requires 2 arguments, but only 1 given
   10 |  rep(i.N) cin>>H[i];
      |         ^
a.cc:2:9: note: macro "rep" defined here
    2 | #define rep(i,N) for (int i=0;i<N;i++)
      |         ^~~
a.cc:4:19: error: expected unqualified-id before numeric constant
    4 | typedef long long 11;
      |                   ^~
a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:10:2: error: 'rep' was not declared in this scope
   10 |  rep(i.N) cin>>H[i];
      |  ^~~
Language: C++

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

main(){
int N;
  cin>>N;
  vector<int> H(N);
 rep(i.N) cin>>H.at(i);
  
  int pre =-999;
  rep(i,N) {
    if(pre<=H[i]-1){
      pre=H[i]-1;
    }
    else if(pre<=H[i]){
      pre=H[i];
    }
    else{
      cout<<"NO"<<endl;
      retun 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}
        

      



Compiler output:
a.cc:10:9: error: macro "rep" requires 2 arguments, but only 1 given
   10 |  rep(i.N) cin>>H.at(i);
      |         ^
a.cc:2:9: note: macro "rep" defined here
    2 | #define rep(i,N) for (int i=0;i<N;i++)
      |         ^~~
a.cc:4:9: error: 'Long' does not name a type; did you mean 'long'?
    4 | typedef Long Long 11;
      |         ^~~~
      |         long
a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:10:2: error: 'rep' was not declared in this scope
   10 |  rep(i.N) cin>>H.at(i);
      |  ^~~
a.cc:22:7: error: 'retun' was not declared in this scope
   22 |       retun 0;
      |       ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
main(){
int N;
  cin>>N;
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin>>H.at(i);
  }
  int pre =-999;
  for(int i=0;i<N;i++){
    if(pre<=H[i]-1){
      pre=H[i];
    }
    else if(pre<=H[i]){
      pre=H[i];
    }
    else{
      cout<<"NO"<<endl;
      retun 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}
        

      



Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:20:7: error: 'retun' was not declared in this scope
   20 |       retun 0;
      |       ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
main(){
int N;
  cin>>N;
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin>>H.at(i);
  }
  int pre =-999;
  for(int i=0;i<N;i++){
    if(pre<=H[i]-1){
      pre=H.[i];
    }
    else if(pre<=H[i]){
      pre=H[i];
    }
    else{
      cout<<"NO"<<endl;
      retun 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}
        

      



Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:13:13: error: expected unqualified-id before '[' token
   13 |       pre=H.[i];
      |             ^
a.cc:20:7: error: 'retun' was not declared in this scope
   20 |       retun 0;
      |       ^~~~~
Language: Java

import java.io.*; 
import java.util.*; 

public class Main{ 
	
	static class FastReader{ 
		BufferedReader br; 
		StringTokenizer st; 

		public FastReader() 
		{ 
			br = new BufferedReader(new
					InputStreamReader(System.in)); 
		} 

		String next() 
		{ 
			while (st == null || !st.hasMoreElements()) 
			{ 
				try
				{ 
					st = new StringTokenizer(br.readLine()); 
				} 
				catch (IOException e) 
				{ 
					e.printStackTrace(); 
				} 
			} 
			return st.nextToken(); 
		} 

		int nextInt() 
		{ 
			return Integer.parseInt(next()); 
		} 

		long nextLong() 
		{ 
			return Long.parseLong(next()); 
		} 

		double nextDouble() 
		{ 
			return Double.parseDouble(next()); 
		} 

		String nextLine() 
		{ 
			String str = ""; 
			try
			{ 
				str = br.readLine(); 
			} 
			catch (IOException e) 
			{ 
				e.printStackTrace(); 
			} 
			return str; 
		} 
	}
     
	public static void main(String[] args) 
	{ 
		FastReader sc = new FastReader(); 
		int n = sc.nextInt();
      	long arr[] = new long[n];
		for(int i=0;i<n;i++)
			arr[i] = sc.nextLong();
      	for(int i=n-2;i>=0;i--){
            if(arr[i]-arr[i+1]>1){
              System.out.println("No");
              return;
            }
		System.out.println("Yes"); 
	} 
} 


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

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

int main() {
  int N; cin >> N;
  vector<int> H(N);
  bool ans = true;
  for(int i = 0; i < N; ++i) cin >> H[i];
  reverse(H.begin(), H.end());
  for(int i = 0; i < H.size()-1; ++i) {
    if(H[i] >= H[i+1]) continue;
    else if(H[i] + 1 == H[i+1]) H[i+1] = H[i+1] - 1;
    else {
      ans = false;
    }
  }
  std::cout << (ans ? "Yes" : "No") << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'reverse' was not declared in this scope
   10 |   reverse(H.begin(), H.end());
      |   ^~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
 
int main() {
  int n = 0;
  cin >> n;
  
  vector<int> v;
  for(int i = 0; i < n; i++) {
   int tmp;
   cin >> tmp;
   v.push_back(tmp); 
  }
  
  bool ans = true;
  for(i = 1; i < n-1; i++) {
    
	if (v[i-1] < v[i] < v[i+1]) {
      
    } else if (v[i-1] < v[i]+1 < v[i+1]) {
      v[i] = v[i] + 1;
    } else if (v[i-1] < v[i]-1 < v[i+1]) {
      v[i] = v[i] - 1;
    } else {
      ans = false;
      break;
    }
  }
  
  if(ans) {
    cout << "Yes" << endl;;
  } else {
   	cout << "False" << endl;; 
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: 'i' was not declared in this scope
   17 |   for(i = 1; i < n-1; i++) {
      |       ^
Language: C++

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

int main() {
  int n = 0;
  cin >> n;
  
  vector<int> v;
  for(int i = 0; i < n; i++) {
   int tmp;
   cin >> tmp;
   v.push_back(tmp); 
  }
  
  bool ans = false;
  for(i = 1; i < n-1; i++) {
	if((v[i-1] < v[i] < v[i+1]) || (v[i-1] < v[i]+1 < v[i+1]) || (v[i-1] < v[i]-1 < v[i+1])) {
      ans = true;
    }else {
      ans = false;
      break;
    }
  }
  
  if(ans) {
    cout << "Yes" << endl;;
  } else {
   	cout << "False" << endl;; 
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: 'i' was not declared in this scope
   17 |   for(i = 1; i < n-1; i++) {
      |       ^
Language: C++

#include<std/bitsc++.h>
using namespace std;
int main(){
	int n;cin>>n;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	int f=1;
	a[0]=a[0]-1;
	for(int i=1;i<n;i++){
		if(a[i-1]<a[i])a[i]=a[i]-1;
	}
	for(int i=1;i<n;i++){
		if(a[i-1]<=a[i]);
		else f=0;
	}
	if(f)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Compiler output:
a.cc:1:9: fatal error: std/bitsc++.h: No such file or directory
    1 | #include<std/bitsc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>

using namespace std;

int n = 0;
int h[100000] = {};

int main() {

	int n = 0;
	int now = 1e9;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}

	for (int i = n - 1; i >= 0; i--) {

		if (now > h[i]) {
			now = h[i];
		}

		if (h[i] > now + 1) {
			cout << "No" << endl;
			return 0;
		}


	}
	cout << "Yes" << endl;
	return 0;

}#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>

using namespace std;

int n = 0;
int h[100000] = {};

int main() {

	int n = 0;
	int now = 1e9;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}

	for (int i = n - 1; i >= 0; i--) {

		if (now > h[i]) {
			now = h[i];
		}

		if (h[i] > now + 1) {
			cout << "No" << endl;
			return 0;
		}


	}
	cout << "Yes" << endl;
	return 0;

}

Compiler output:
a.cc:39:2: error: stray '#' in program
   39 | }#include <iostream>
      |  ^
a.cc:39:3: error: 'include' does not name a type
   39 | }#include <iostream>
      |   ^~~~~~~
a.cc:47:5: error: redefinition of 'int n'
   47 | int n = 0;
      |     ^
a.cc:9:5: note: 'int n' previously defined here
    9 | int n = 0;
      |     ^
a.cc:48:5: error: redefinition of 'int h [100000]'
   48 | int h[100000] = {};
      |     ^
a.cc:10:5: note: 'int h [100000]' previously defined here
   10 | int h[100000] = {};
      |     ^
a.cc:50:5: error: redefinition of 'int main()'
   50 | int main() {
      |     ^~~~
a.cc:12:5: note: 'int main()' previously defined here
   12 | int main() {
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
main(){
int N;
  cin>.N;
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin>>H.at(i);
  }
  int T=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      if((H.at(i)>H.at(j))&&(H.at(i)-1==H.at(j))){
        int T=0;
      }
      if((H.at(i)>H.at(j))&&(H.at(i)-1>H.at(j))){
        int T=1;
        break;
      }
      if(H.at(i)<=H.at(j)){
        int T=0;
      }
    }
    if(T==1){
      break;
    }
  }
  if(T==0){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}
    

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:5:7: error: expected primary-expression before '.' token
    5 |   cin>.N;
      |       ^
Language: C++


#include "stdafx.h"
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include<cmath>
#include <limits>
using namespace std;
typedef long long ll;

typedef pair<ll, ll> P;
const int INF = 100000000;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

#define REP(i, a,b) for(i=a;i<b;i++) 
#define REP1(i,b,a) for(i=b-1;i>=a;i--)
#define output(x) cout<<x<<endl;
#define pb(x) push_back(x);
const int MOD = 1000000007;


int main() {
	int N,i,j;
	cin >> N;
	vector<ll>H(N);
	REP(i, 0, N) {
		cin >> H[i];
	}
	reverse(H.begin(), H.end());
	for (i = 0; i < N - 1; i++) {
		if (H[i + 1] > H[i]+1) {
			output("No");
			return 0;
		}
		else if (H[i + 1] == H[i]+1) {
			H[i + 1]--;
		}
	}
	output("Yes");
	return 0;
	return 0;
}



Compiler output:
a.cc:2:10: fatal error: stdafx.h: No such file or directory
    2 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C


#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include<cmath>
#include <limits>
using namespace std;
typedef long long ll;

typedef pair<ll, ll> P;
const int INF = 100000000;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

#define REP(i, a,b) for(i=a;i<b;i++) 
#define REP1(i,b,a) for(i=b-1;i>=a;i--)
#define output(x) cout<<x<<endl;
#define pb(x) push_back(x);
const int MOD = 1000000007;


int main() {
	int N,i,j;
	cin >> N;
	vector<ll>H(N);
	REP(i, 0, N) {
		cin >> H[i];
	}
	reverse(H.begin(), H.end());
	for (i = 0; i < N - 1; i++) {
		if (H[i + 1] > H[i]+1) {
			output("No");
			return 0;
		}
		else if (H[i + 1] == H[i]+1) {
			H[i + 1]--;
		}
	}
	output("Yes");
	return 0;
	return 0;
}



Compiler output:
main.c:2:10: fatal error: iostream: No such file or directory
    2 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

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

using namespace std;

int main()
{
  int n;
  int h_i;
  vector<int> h;
  cin >> n;
  for(int i = 0; i < n; i++)
  {
    cin >> h_i;
  	h.push_back(h_i);
  }
  
  bool flg = false;
  int tmp = 0;
  for(int i = 0; i < h.size(); i++)
  {
    tmp = max(tmp, h[i]);
    if(i != 0 && tmp > h[i] && (tmp - h[i-2] > 1 || tmp - h[i] > 1))
    {
      flg = false;
      break;
    }
    else
    {
      flg = true;
      continue;
    }
  }
  
  if(flg)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
  
  bool flg = false;
  for(int i = 0; i < h.size(); i++)
  {
    if(i != 0 && h[i - 1] - h[i] < 1)
    {
      flg = false;
      break;
    }
    else
    {
      flg = true;
      continue;
    }
  }
  
  if(flg)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}

Compiler output:
a.cc:44:3: error: expected unqualified-id before 'for'
   44 |   for(int i = 0; i < h.size(); i++)
      |   ^~~
a.cc:44:18: error: 'i' does not name a type
   44 |   for(int i = 0; i < h.size(); i++)
      |                  ^
a.cc:44:32: error: 'i' does not name a type
   44 |   for(int i = 0; i < h.size(); i++)
      |                                ^
a.cc:58:3: error: expected unqualified-id before 'if'
   58 |   if(flg)
      |   ^~
a.cc:60:3: error: expected unqualified-id before 'else'
   60 |   else
      |   ^~~~
a.cc:62:3: error: expected unqualified-id before 'return'
   62 |   return 0;
      |   ^~~~~~
a.cc:63:1: error: expected declaration before '}' token
   63 | }
      | ^
Language: C++

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

int main(){
	int N;
	cin >> N;
	if(N == 1){
		cout << "Yes" << endl;
		return 0;
	}
	vector<int> H(N);
	for(int i = 0; i < N; i++)cin >> H.at(i);
	bool jdg = true;
	
	for(int i = N - 1; i > 1; i--){
		if(H.at(i) < H.at(i - 1)){
			H.at(i - 1)--;
		} else {
			continue;
		}
		if(H.at(i) < H.at(i - 1)){
			jdg = false;
			break;
		}
	}
	
	if(jdg) cout << "Yes" endl;
	else cout << "No" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:30: error: expected ';' before 'endl'
   27 |         if(jdg) cout << "Yes" endl;
      |                              ^~~~~
      |                              ;
Language: C++

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

int main(){
  int i,n;
  bool ans = true;
  cin >> n;
  vector<int> height(n);
  vector<int> flag(n);
  flag.at(0) = 0;
  rec(i,n) {cin >> height.at(i);}
  rec(i,n-1){
    if(height.at(i) - 1 == height.at(i+1) && flag.at(i) == 0){
      flag.at(i+1) = 1;
    }
    else if(height.at(i) > height.at(i+1)){
      ans = false;
    }
    else if(height.at(i) == height.at(i+1)){
      flag.at(i+1) = flag.at(i);
    else flag.at(i+1) = 0;
  }
  if(ans == true)cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: expected '}' before 'else'
   22 |     else flag.at(i+1) = 0;
      |     ^~~~
a.cc:20:44: note: to match this '{'
   20 |     else if(height.at(i) == height.at(i+1)){
      |                                            ^
Language: C++

#include <stdio.h>

int main(){
  int N,i,ans=0;
  scanf("%d",&N);
  int H[N];
  for(i=0;i<N;i++){
    scanf("%d",&H[i]);
  }
  for(i=0;i<N-1;i++){
    if(H[i]<H[i+1]+1)
    else if(H[i]==H[i+1]+1){
      H[i+1] += 1;
    }else if(H[i]>H[i+1]+1){
      ans = 1;
    }
  }
  if(ans == 1){
    printf("NO");
  } else {
    printf("YES");
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: expected primary-expression before 'else'
   12 |     else if(H[i]==H[i+1]+1){
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
using name
space std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  	//freopen("INP.txt", "r", stdin);
    //freopen("OUT.txt", "w", stdout);
    ll n;
    cin >> n;
    vector<ll> hold(n);
    for (ll i = 0; i < n; i++) {
        cin >> hold[i];
    }
    for (ll i = n - 1; i >= 0; i++) {
        if (hold[i] > hold[i + 1]) {
            if (hold[i] - 1 <= hold[i + 1]) {
                hold[i]--;
            }
            else {
                cout << "No" << '\n';
            }
        }
    }
    cout << "Yes" << '\n';
    return 0;
}


Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'name'
    3 | using name
      |       ^~~~
a.cc: In function 'int main()':
a.cc:7:5: error: 'ios' has not been declared
    7 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:8:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |     cin.tie(NULL);
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:9:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    9 |     cout.tie(NULL);
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:14:5: error: 'vector' was not declared in this scope
   14 |     vector<ll> hold(n);
      |     ^~~~~~
a.cc:14:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:2:12: error: expected primary-expression before 'long'
    2 | #define ll long long
      |            ^~~~
a.cc:14:12: note: in expansion of macro 'll'
   14 |     vector<ll> hold(n);
      |            ^~
a.cc:16:16: error: 'hold' was not declared in this scope
   16 |         cin >> hold[i];
      |                ^~~~
a.cc:19:13: error: 'hold' was not declared in this scope
   19 |         if (hold[i] > hold[i + 1]) {
      |             ^~~~
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);
  }

  bool is_able = true;
  for (int i=n-2; i>0; i--) {
    if (data.at(i) - 1 == data.at(i+1)) {
      data.at(i)--;
    }
    else if (data.at(i) - 1 > data.at(i+1) {
      is_able = false;
      break;
    }
  }

  if (is_able) {
    cout << "Yes";
  }
  else {
    cout << "No";
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:43: error: expected ')' before '{' token
   17 |     else if (data.at(i) - 1 > data.at(i+1) {
      |             ~                             ^~
      |                                           )
a.cc:21:3: error: expected primary-expression before '}' token
   21 |   }
      |   ^
Language: Java

import java.util.Scanner;

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

        int n = sc.nextInt();
        int[] h = new int[n];

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

        boolean isAns = true;
        if (n >= 2) {
            for (int i = n - 2; i >= 0; i--) {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            }
        }

        System.out.println(isAns ? "Yes" : "No");
    }
}

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

#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    int n;
    highlow = 0;

    cin >> n;
    vector<int> high(n);
    for(int i=0;i<n;i++){
    cin >> high[i];
    }

    for(int i=n-1;i>=0;i--){
       if(high[i] < high[i-1]){
          if(high[i] <= high[i-1]-1){
            high[i-1]--;
          }else{
            highlow = 0;
          }
        }
    }
 if(highlow != 0){
   cout << "No" << endl;
 }else{
   cout << "Yes" << endl;
 }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'highlow' was not declared in this scope
   13 |     highlow = 0;
      |     ^~~~~~~
Language: C++

#include<bits/stdc++.h>

int main(){
    
    int N;
    std::cin >> N;
    
    int H[N];
    for (int i = 0 ; i < N ; i++){
        std::cin >> H[i];
        if (N == 1){
        std:: cout << "Yes" << std::endl;
        return 0;
        }
        if (i == 0){
            H[i]--;
        }else{
            if (H[i]  > H[i-1] ) H[i]--;
            else if (H[i] == H[i-1]) continue;
            else{
                std ::cout << "No" << std::endl;
                return 0;
            }
        }
    }


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

#include<bits/stdc++.h>

using namespace std;

int main() {
  	int n;
 	cin >> a;
  	vector<int> a(n + 1);
  	for (int i = 1; i <= n; i++) {
      	cin >> a[i];
    }
  	for (int i = 1; i < n; i++) {
     	if (a[i] > a[i+1]) {
          	a[i]--;
        }
    }
  	for (int i = 1; i < n; i++) {
      	if (a[i] > a[i+1]) {
          	cout << "NO";
          	return 0;
        }
    }
  	cout << "YES";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:16: error: 'a' was not declared in this scope
    7 |         cin >> a;
      |                ^
Language: Java

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		ArrayList<Long> List = new ArrayList<Long>();
		long n = scan.nextLong();
		for(int i = 0; i < n; i++) {
			List.add(scan.nextLong());
		}
		List.add(Long.valueOf(1999999999));
//		System.out.println(List);
		for (int i = 0; i < n; i++) {
			if (List.get(i) > List.get(i + 1)) {
				List.set(i, List.get(i) - 1);
			}
		} 
		System.out.println(List);
		ArrayList<Long> List2 = new ArrayList<Long>(List);
		Collections.sort(List2);
		System.out.println(List2);
		if (List.equals(List2)) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

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

#include<bits/stdc++.h>
using namespace std;
const long long INF=1000000000;
typedef long long ll;
int main(){
    int n;
    cin>>n;
    ll h[n],d=0;
    for (int i = 0; i < n;i++){
        cin>>h[i];
    }
    if(n>1){
        for (int i = n - 1; i > 0;i--){
            if(h[i]>=h[i-1]){

            }else if(h[i]+1==h[i-1]){
                h[i - 1]--;
            }else{
                cout << "No" << endl;
                break;
            }
            if(i==1){
                cout << "Yes" << endl;
            }
    }else{
        cout << "Yes" << endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:6: error: expected '}' before 'else'
   25 |     }else{
      |      ^~~~
a.cc:12:12: note: to match this '{'
   12 |     if(n>1){
      |            ^
Language: Java

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

public class Build_Stairs_Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		ArrayList<Long> List = new ArrayList<Long>();
		long n = scan.nextLong();
		for(int i = 0; i < n; i++) {
			List.add(scan.nextLong());
		}
		List.add(Long.valueOf(1000000000));
//		System.out.println(List);
		for (int i = 0; i < n; i++) {
			if (List.get(i) > List.get(i+1)) {
				List.set(i, List.get(i) - 1);
			}
		}
//		System.out.println(List);
		boolean ans = true;
		for (int i = 0; i < n; i++) {
			if (List.get(i) > List.get(i+1)) {
				ans = false;
				break;
			}
		}
		if(ans) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}


Compiler output:
Main.java:4: error: class Build_Stairs_Main is public, should be declared in a file named Build_Stairs_Main.java
public class Build_Stairs_Main {
       ^
1 error
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: expected ';' before ')' token
   15 |   for(int i=N-2;i<=0,i++){
      |                         ^
      |                         ;
Language: C++

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

int main() {
	int N;
	cin >> N;
	vector<int>H(N);
	for (int i = 0;i < N;++i)cin >> H[i];
	int pre = -999;
	for (int i = 0;i < N;++i) {
		if (pre <= a[i] - 1)pre = a[i] - 1;
		else if (pre = a[i])pre = a[i];
		else cout << "No" << endl;
	}
	cout << "Yes" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:28: error: 'a' was not declared in this scope
   12 |                 if (pre <= a[i] - 1)pre = a[i] - 1;
      |                            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int judge;
  long long N, H[100000];
  cin >> N;
  rep(i,N) cin >> H[i];
  
  for (i = N-2; i>=0; i--){
    if (H[i] >= H[i+1] + 2) {
      judge++;
      break;
    }
    else if (H[i] == H[i+1] + 1) {
      H[i]--;
    }
    else{}
  }
  if (judge >= 1)
  	cout << "No" << endl;
   if (judge == 0)
  	cout << "Yes" << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: 'i' was not declared in this scope
   11 |   for (i = N-2; i>=0; i--){
      |        ^
Language: C++

#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<limits.h>
#include<cmath>
using namespace std;

int main(){
  
  int n; cin >> n;
  vector<int> h(n);
  for(int i=0; i<n; i++) cin >> h[i]5;
  string ans="No";

  for (int i=0; i<n; i++){
    int flag=1;
    h[i]--;
    for (int j=0; j<n-1; j++){
      if (h[j]>h[j+1]){
        flag=0;
        break;
      }
    }
    if (flag==1){
      ans="Yes";
      break;
    }
    h[i]++;
  }

  cout << ans << endl;

 
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:37: error: expected ';' before numeric constant
   14 |   for(int i=0; i<n; i++) cin >> h[i]5;
      |                                     ^
      |                                     ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,flag=1;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<n-1;i++)
	{
		if(abs(a[i]-a[i-1])<=1)
		{
			flag=flag*1;
		}
		else{flag=flag*0;}
	}
	if(a[n-1]>=a[n-2]){flag=flag*1;}
	else{flag=flag*0;}
	if(flag) cout<<"Yes";
	else cout<<"No";

Compiler output:
a.cc: In function 'int main()':
a.cc:23:25: error: expected '}' at end of input
   23 |         else cout<<"No";
      |                         ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

int main() {
    int n;
    cin >> n;
    int h[n];
    //rep(i,n)cin >> h[i];
    rep(i,n)scanf("%d",&h[i]);

    int now = h[0]-1;

    srep(i,1,n){
        if(h[i]<now){
            cout << "No" << endl;
            return 0;
        }else if(now<h[i]){
            now = h[i]-1;
        }
    }
    cout << "Yes" << endl;
    return 0;
}
 
 
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

int main() {
    int n;
    cin >> n;
    int h[n];
    //rep(i,n)cin >> h[i];
    rep(i,n)scanf("%d",&h[i]);

    int now = h[0]-1;

    srep(i,1,n){
        if(h[i]<now){
            cout << "No" << endl;
            return 0;
        }else if(now<h[i]){
            now = h[i]-1;
        }
    }
    cout << "Yes" << endl;
    return 0;
}
 
 


Compiler output:
a.cc:53:5: error: redefinition of 'int main()'
   53 | int main() {
      |     ^~~~
a.cc:16:5: note: 'int main()' previously defined here
   16 | int main() {
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep_r(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i)
#define FOR_R(i,m,n) for(int i=((int)(m)-1);i>=(int)(n);--i)
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define INF 2e9
#define LLINF 11e16
 
using namespace std;
 
typedef long long ll;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:29:39: error: expected ']' before ')' token
   29 |                 else if(v[i] < v[i + 1){
      |                                       ^
      |                                       ]