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

#include <iostream>
 
int main(){
    using namespace std;
 
    int n , res{};
    cin >> n;
 
    int arr[n];
    for(int i = 0 ; i < n ; i++)
        cin >> arr[i];
 
    for(int i = 1 ; i < n - 1 ; i++){
        int temp[3];
        for(int j = -1 ; j < 2 ; j++)
            temp[j + 1] = arr[i + j];
 
        for(int j = 0 ; j < 3 ; j++){
            for(int k = j + 1 ; k < 3 ; k++)
                if(temp[j] > temp[k])
                    swap(temp[j] , temp[k]);
        }
 
        if(arr[i] == temp[1])
            res++;
    }
 
    cout << res << endl;
}

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

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

int main (){
int n;
  cin >> n;
  
 int i;
  int c=0;
  for(i=0;i<n;i++){
    cin>>p[i];
  }
  for(i=1;i<n-1;i++){
    if(p[i]<p[i+1]&&p[i]>p[i+1]||p[i]<p[i-1]&&p[i]>p[i+1])
      c++;
  }
  cout<<c;
  return 0;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: 'p' was not declared in this scope
   11 |     cin>>p[i];
      |          ^
a.cc:14:8: error: 'p' was not declared in this scope
   14 |     if(p[i]<p[i+1]&&p[i]>p[i+1]||p[i]<p[i-1]&&p[i]>p[i+1])
      |        ^
Language: C++

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

int main (){
int n;
  cin >> n;
  
 int i;
  int c=0;
  for(i=1;i<n-1;i++){
    if(p[i]<p[i+1]&&p[i]>p[i+1]||p[i]<p[i-1]&&p[i]>p[i+1])
      c++;
  }
  cout<<c;
  return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: 'p' was not declared in this scope
   11 |     if(p[i]<p[i+1]&&p[i]>p[i+1]||p[i]<p[i-1]&&p[i]>p[i+1])
      |        ^
Language: C++

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

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

  for (int i = 0; i < N-3; i++) {
    if(a.at(i+2)>a.at(i+1)&&a.at(i)<a.at(i+1)){
      ans++;
    else if(a.at(i+2)<a.at(i+1)&&a.at(i)>a.at(i+1)){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: expected '}' before 'else'
   17 |     else if(a.at(i+2)<a.at(i+1)&&a.at(i)>a.at(i+1)){
      |     ^~~~
a.cc:15:47: note: to match this '{'
   15 |     if(a.at(i+2)>a.at(i+1)&&a.at(i)<a.at(i+1)){
      |                                               ^
Language: C++

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

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

  for (int i = 0; i < N-1; i++) {
    if((a.at(i+2)>a.at(i+1)&&a.at(i)<a.at(i+1)||(a.at(i+2)<a.at(i+1)&&a.at(i)>a.at(i+1))){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:90: error: expected ')' before '{' token
   15 |     if((a.at(i+2)>a.at(i+1)&&a.at(i)<a.at(i+1)||(a.at(i+2)<a.at(i+1)&&a.at(i)>a.at(i+1))){
      |       ~                                                                                  ^
      |                                                                                          )
a.cc:18:3: error: expected primary-expression before '}' token
   18 |   }
      |   ^
Language: C++

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

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

  for (int i = 0; i < N-1; i++) {
    if((a.at(i+2)>a.at(i+1)&&a.at(i)<a.at(i+1)||(a.at(i+2)<a.at(i+1)&&a.at(i)>a.at(i+1)){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:89: error: expected ')' before '{' token
   15 |     if((a.at(i+2)>a.at(i+1)&&a.at(i)<a.at(i+1)||(a.at(i+2)<a.at(i+1)&&a.at(i)>a.at(i+1)){
      |        ~                                                                                ^
      |                                                                                         )
a.cc:17:6: error: expected ')' before '}' token
   17 |     }
      |      ^
      |      )
   18 |   }
      |   ~   
a.cc:15:7: note: to match this '('
   15 |     if((a.at(i+2)>a.at(i+1)&&a.at(i)<a.at(i+1)||(a.at(i+2)<a.at(i+1)&&a.at(i)>a.at(i+1)){
      |       ^
a.cc:18:3: error: expected primary-expression before '}' token
   18 |   }
      |   ^
Language: C++

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

int main(void){
  int n;cin >> n;
  int p[n];rep(i,n)cin >> p[i];
  nint ans = 0;
  for(int i=1;i<n-1;i++){
    if(p[i-1] < p[i] && p[i] < p[i+1])ans += 1;
    else if(p[i-1] > p[i] && p[i] > p[i+1])ans += 1;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'nint' was not declared in this scope; did you mean 'uint'?
    8 |   nint ans = 0;
      |   ^~~~
      |   uint
a.cc:10:39: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |     if(p[i-1] < p[i] && p[i] < p[i+1])ans += 1;
      |                                       ^~~
      |                                       abs
a.cc:11:44: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |     else if(p[i-1] > p[i] && p[i] > p[i+1])ans += 1;
      |                                            ^~~
      |                                            abs
a.cc:13:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

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

int main(void){
  int n;cin >> n;
  int p[n];rep(i,n)cin >> p[i];
  nint ans = 0;
  for(int i=1;i<n-1;i++){
    if(p[i-1] < p[i]&&p[i] < p[i+1])ans += 1; 
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'nint' was not declared in this scope; did you mean 'uint'?
    8 |   nint ans = 0;
      |   ^~~~
      |   uint
a.cc:10:37: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |     if(p[i-1] < p[i]&&p[i] < p[i+1])ans += 1;
      |                                     ^~~
      |                                     abs
a.cc:12:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {

int a,b,c[110],d[110],e;
   cin >> a;
  
  for(int i=0;i<a;i++)
    cin >>c[i];
  
  b=0;
  
  for(int i=1 ;i<a-1;i++){
    if(((s[i-1]>s[i])&&(s[i]>s[i+1]))||((s[i-1]<s[i])&&(s[i]<s[i+1]))){
      b++;
    }
  }
  
  cout << b << endl;
  
  return 0;
}
   
  

Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 's' was not declared in this scope
   15 |     if(((s[i-1]>s[i])&&(s[i]>s[i+1]))||((s[i-1]<s[i])&&(s[i]<s[i+1]))){
      |          ^
Language: C++

#include<cstdio>
using namespace std; 

int main(){
	int n;
	int a[21];
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	
	int count=0;
	
	for(int i=2;i<=n-1;i++)
	{
		if(a[i]>a[i-1] && a[i]<a[i+1] || a[i]<a[i-1] && a[i]>a[i+1])
			count++;
	}
	
	cout<<count;
	
	return 0;
}

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

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

int main(){
    int n; cin >> n;
    vector<int> p(n);
    int ans=0;

    rep(i,N){
        cin >> p[i];
    }

    rep(i,n-2){
        if((p[i+1] > p[i]) && (p[i+1] > p[i])){
            ans++;
        }
    }

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:11: error: 'N' was not declared in this scope
   11 |     rep(i,N){
      |           ^
a.cc:2:33: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                                 ^
Language: C++

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

int main(){
    int n; cin >> n;
    vector<int> p(n);
    int ans=0;

    rep(i,n-2){
        if((n[i+1] > n[i]) && (n[i+1] > n[i])){
            ans++;
        }
    }

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: invalid types 'int[int]' for array subscript
   12 |         if((n[i+1] > n[i]) && (n[i+1] > n[i])){
      |              ^
a.cc:12:23: error: invalid types 'int[int]' for array subscript
   12 |         if((n[i+1] > n[i]) && (n[i+1] > n[i])){
      |                       ^
a.cc:12:33: error: invalid types 'int[int]' for array subscript
   12 |         if((n[i+1] > n[i]) && (n[i+1] > n[i])){
      |                                 ^
a.cc:12:42: error: invalid types 'int[int]' for array subscript
   12 |         if((n[i+1] > n[i]) && (n[i+1] > n[i])){
      |                                          ^
Language: C++

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

int main() {
  
  int N;
  int num = 0;
  
  cin >> N;
  
  vector<int> p(N);
  
  for(int i = 0;i < N;+;i){
    cin >> p[i];
  }
  
  for(int i = 0;i < N;++i){
    if(p[i - 1] > p[i] && p[i] > p[i + 1]){
      num++;
    }
    else if(p[i - 1] < p[i] && p[i] < p[i + 1]){
      num++;
    }
  }
  
  cout << num << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: expected primary-expression before ';' token
   13 |   for(int i = 0;i < N;+;i){
      |                        ^
a.cc:13:24: error: expected ')' before ';' token
   13 |   for(int i = 0;i < N;+;i){
      |      ~                 ^
      |                        )
a.cc:13:25: error: 'i' was not declared in this scope
   13 |   for(int i = 0;i < N;+;i){
      |                         ^
Language: C++

#include <iostream>
using namespace std ;

int main(){
  int n ;
  cin >> n ;
  vector<int> p(n) ;
  for(int i=0;i<n;i++) cin >> p[i] ;
  int ans = 0 ;
  for(int i=1;i<n-1;i++){
    if((p[i]>p[i-1]) && (p[i+1]>p[i])){
      ans++;
    }else if((p[i]<p[i-1]) && (p[i+1]<p[i])){
      ans++;
    }
  }
  cout << ans ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> p(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 | using namespace std ;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> p(n) ;
      |          ^~~
a.cc:8:31: error: 'p' was not declared in this scope
    8 |   for(int i=0;i<n;i++) cin >> p[i] ;
      |                               ^
a.cc:11:9: error: 'p' was not declared in this scope
   11 |     if((p[i]>p[i-1]) && (p[i+1]>p[i])){
      |         ^
Language: C++

#include <iostream>
using namespace std ;

int main(){
  int n ;
  cin >> n ;
  vector<int> p[n] ;
  for(int i=0;i<n;i++) cin >> p[i] ;
  int ans = 0 ;
  for(int i=1;i<n-1;i++){
    if((p[i]>p[i-1]) && (p[i+1]>p[i])){
      ans++;
    }else if((p[i]<p[i-1]) && (p[i+1]<p[i])){
      ans++;
    }
  }
  cout << ans ;
  return 0 ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> p[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 | using namespace std ;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> p[n] ;
      |          ^~~
a.cc:8:31: error: 'p' was not declared in this scope
    8 |   for(int i=0;i<n;i++) cin >> p[i] ;
      |                               ^
a.cc:11:9: error: 'p' was not declared in this scope
   11 |     if((p[i]>p[i-1]) && (p[i+1]>p[i])){
      |         ^
Language: C++

#include <iostream>
using namespace std ;

int main(){
  int n ;
  cin >> n ;
  vector<int> p(n) ;
  for(int i=0;i<n;i++) cin >> p[i] ;
  int ans = 0 ;
  for(int i=1;i<n-1;i++){
    if((p[i]>p[i-1]) && (p[i+1]>p[i])){
      ans++;
    }else if((p[i]<p[i-1]) && (p[i+1]<p[i])){
      ans++;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> p(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 | using namespace std ;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> p(n) ;
      |          ^~~
a.cc:8:31: error: 'p' was not declared in this scope
    8 |   for(int i=0;i<n;i++) cin >> p[i] ;
      |                               ^
a.cc:11:9: error: 'p' was not declared in this scope
   11 |     if((p[i]>p[i-1]) && (p[i+1]>p[i])){
      |         ^
Language: C++

#include <iostream>
using namespace std ;

int main(){
  int n ;
  cin >> n ;
  vector<int> p[n] ;
  for(int i=0;i<n;i++) cin >> p[i] ;
  int ans = 0 ;
  for(int i=1;i<n-1;i++){
    if((p[i]>p[i-1]) && (p[i+1]>p[i])){
      ans++;
    }else if((p[i]<p[i-1]) && (p[i+1]<p[i])){
      ans++;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> p[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 | using namespace std ;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> p[n] ;
      |          ^~~
a.cc:8:31: error: 'p' was not declared in this scope
    8 |   for(int i=0;i<n;i++) cin >> p[i] ;
      |                               ^
a.cc:11:9: error: 'p' was not declared in this scope
   11 |     if((p[i]>p[i-1]) && (p[i+1]>p[i])){
      |         ^
Language: C++

#include <cstdio>

#define min(a, b) ((a) < (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (a) : (b))

int main()
{
  int n;
  int p[20];
  scanf("%d %d %d", &n, p, p + 1);
  int ans = 0;
  for (int i = 2; i < n; ++i)
  {
    scanf("%d", p + i);
    if (max(p[i - 2], max(p[i - 1], p[i])) != p[i - 1] && min(p[i - 2], min(p[i - 1], p[i])) != p[i - 1])
    {
      ++ans;
    }
  }
  printf("%d\n", ans);
  return 0;
}


Compiler output:
a.cc:4:9: warning: "min" redefined
    4 | #define min(a, b) ((a) > (b) ? (a) : (b))
      |         ^~~
a.cc:3:9: note: this is the location of the previous definition
    3 | #define min(a, b) ((a) < (b) ? (a) : (b))
      |         ^~~
a.cc: In function 'int main()':
a.cc:15:23: error: 'max' was not declared in this scope
   15 |     if (max(p[i - 2], max(p[i - 1], p[i])) != p[i - 1] && min(p[i - 2], min(p[i - 1], p[i])) != p[i - 1])
      |                       ^~~
a.cc:15:9: error: 'max' was not declared in this scope
   15 |     if (max(p[i - 2], max(p[i - 1], p[i])) != p[i - 1] && min(p[i - 2], min(p[i - 1], p[i])) != p[i - 1])
      |         ^~~
Language: C

#include <stdio.h>

int main(void) {

	int n;
    int p[25];  
    int num;

    scanf("%d",&n);
  
    for(int i = 0;i < n;++i){
      scanf("%d",&p[i]);
    }
     
   for(int k = 0;k < n;++k){
     if(p[i] < p[i + 1] && p[i + 1] < p[i + 2]){
       num++;
     }
     else if(p[i] > p[i + 1] && p[i + 1] > p[i + 2]){
       num++;
     }
   }
  
  printf("%d",num);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:11: error: 'i' undeclared (first use in this function)
   16 |      if(p[i] < p[i + 1] && p[i + 1] < p[i + 2]){
      |           ^
main.c:16:11: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
#define SEKAI_NO_OWARI return 0;
#define INIT cin.tie(0); ios::sync_with_stdio(false);
#define rep(i, n) for(int i=0; i<n; i++)
 
using namespace std;
 
void solve() {
	int n; cin >> n;
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &p[i]);
	}
 
	int res = 0;
	for (int i = 1; i < n - 1; i++) {
		if ((p[i - 1] < p[i]) && (p[i] < p[i + 1])) {
			res++;
		}
		else if ((p[i - 1] > p[i]) && (p[i] > p[i + 1])) {
			res++;
		}
	}
	cout << res << 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: C++

#include <iostream>
using namespace std;

int main() {
 int n;
 cin >> n;
 vector<int> p(n);
 for(int i = 0; i < n; i++) cin >> p[i];
  int ans = 0;
 for(int i = 1; i < n - 1; i++) {
  if((p[i - 1] < p[i]) && (p[i] < p[i + 1])) ans++;
  else if((p[i - 1] > p[i]) && (p[i] > p[i + 1])) ans++;
 }
 cout << ans << endl;
 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:2: error: 'vector' was not declared in this scope
    7 |  vector<int> p(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 | using namespace std;
a.cc:7:9: error: expected primary-expression before 'int'
    7 |  vector<int> p(n);
      |         ^~~
a.cc:8:36: error: 'p' was not declared in this scope
    8 |  for(int i = 0; i < n; i++) cin >> p[i];
      |                                    ^
a.cc:11:7: error: 'p' was not declared in this scope
   11 |   if((p[i - 1] < p[i]) && (p[i] < p[i + 1])) ans++;
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin>>N;
  vector<int> vec(N);
  int count=0;
  for(int i=0;i<N;i++)
  {
    cin>>vec.at(i);
  }
  for(int i=1;i<N-1;i++)
  {
    if((vec.at(i-1)<vec.at(i)&&vec.at(i)<vec.at(i+1))||(vec.at(i-1)>vec.at(i)&&vec.at(i)>vec.at(i+1))
    {
       count++;
    }
  }
  cout<<count<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:102: error: expected ')' before '{' token
   15 |     if((vec.at(i-1)<vec.at(i)&&vec.at(i)<vec.at(i+1))||(vec.at(i-1)>vec.at(i)&&vec.at(i)>vec.at(i+1))
      |       ~                                                                                              ^
      |                                                                                                      )
   16 |     {
      |     ~                                                                                                 
a.cc:19:3: error: expected primary-expression before '}' token
   19 |   }
      |   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin>>N;
  vector<int> vec(N);
  int count=0;
  for(int i=0;i<N;i++)
  {
    cin>>vec.at(i);
  }
  for(int i=1;i<N-1;i++)
  {
    if(vec.at(i-1)<vec.at(i)&&vec.at(i)<vec(i+1))
    {
       count++;
    }
  }
  cout<<count<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:44: error: no match for call to '(std::vector<int>) (int)'
   15 |     if(vec.at(i-1)<vec.at(i)&&vec.at(i)<vec(i+1))
      |                                         ~~~^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin>>N;
  vector<int> vec(N);
  int count=0;
  for(i=0;i<N;i++)
  {
    cin>>vec.at(i);
  }
  for(i=1;i<N-1;i++)
  {
    if(vec.at(i-1)<vec.at(i)&&vec.at(i)<vec(i+1))
    {
       count++;
    }
  }
  cout<<count<<endl;
}

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

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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++){
        cin >> p[i];
    }
    int ans = 0;
    for (int i = 1; i < n-1; i++){
        if (p[i-1] < p[i] && p[i] < p[i+1]){
            ans ++;
        } else (p[i-1] > p[i] && p[i] > p[i+1]){
            ans ++;
        }
    }

    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:48: error: expected ';' before '{' token
   15 |         } else (p[i-1] > p[i] && p[i] > p[i+1]){
      |                                                ^
      |                                                ;
Language: C

#include<stdio.h>
int main(){
  int n,c=0;
  int a[20];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",a[i]);
  }
  for(i=1;i<n-1;i++){
    if((a[i-1]<=a[i]&&a[i]<=a[i+1])||(a[i-1]>=a[i]&&a[i]>=a[i+1])){
      c++;
    }
  }
  printf("%d",c);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:7: error: 'i' undeclared (first use in this function)
    9 |   for(i=1;i<n-1;i++){
      |       ^
main.c:9:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n,count=0;
  cin >> n;
  vector<int> p(n);
  for(int i=0;i<n;i++){
  	cin >> p[i];
  }
  for(int i=1;i<n-1;i++){
  	if(p[i-1]<p[i]<p[i+1] || p[i+1]<p[i]<p[i-1])
    {count++;}
  }
  cout << count;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> p(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 | using namespace std;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> p(n);
      |          ^~~
a.cc:9:16: error: 'p' was not declared in this scope
    9 |         cin >> p[i];
      |                ^
a.cc:12:12: error: 'p' was not declared in this scope
   12 |         if(p[i-1]<p[i]<p[i+1] || p[i+1]<p[i]<p[i-1])
      |            ^
Language: C++

#include <iosream>
using namespace std;

int main(){
  int n,count=0;
  cin >> n;
  vector<int> p(n);
  for(int i=0;i<n;i++){
  	cin >> p[i];
  }
  for(int i=1;i<n-1;i++){
  	if(p[i-1]<p[i]<p[i+1] || p[i+1]<p[i]<p[i-1])
    {count++;}
  }
  cout << count;
}

Compiler output:
a.cc:1:10: fatal error: iosream: No such file or directory
    1 | #include <iosream>
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
  
  int n;
  cin>>n;
  
  vector<int> p(N); 
for (int i = 0; i < N; i++) {
cin >> p.at(i);
}
  
  int ans=0;
  if(p[0]<p[1]&&p[1]<p[2]){
    ans++;
  }
  
  else if(p[0]>p[1]&&p[1]>p[2]){
    ans++;
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'N' was not declared in this scope
   11 |   vector<int> p(N);
      |                 ^
Language: Java

import java.util.*;
public class Main
{
	public static void main(String[] args) {
	    Scanner read = new Scanner(System.in);
	    int P = read.nextInt();
	    int Q = read.nextInt();
	    int R = read.nextInt();
	    int x[] = new int[n];
	    for(int i=0; i<n; i++){
	        x[i] = read.nextInt();
	    }
	    int c = 0;
	    for(int i=0; i<n; i++){
	        if (i == 0 || i == n-1){
	            continue;
	        }else if((x[i] < x[i-1] && x[i] > x[i+1]) || (x[i] < x[i+1] && x[i] > x[i-1])){
	            c++;
	        }
	    }
		System.out.println(c);
	}
}

Compiler output:
Main.java:9: error: cannot find symbol
	    int x[] = new int[n];
	                      ^
  symbol:   variable n
  location: class Main
Main.java:10: error: cannot find symbol
	    for(int i=0; i<n; i++){
	                   ^
  symbol:   variable n
  location: class Main
Main.java:14: error: cannot find symbol
	    for(int i=0; i<n; i++){
	                   ^
  symbol:   variable n
  location: class Main
Main.java:15: error: cannot find symbol
	        if (i == 0 || i == n-1){
	                           ^
  symbol:   variable n
  location: class Main
4 errors
Language: C++

#include"bits/stc++.h"
#include"math.h"
using namespace std;

int main(){
  int n; cin >> n;
  vector<tuple<string , int , int>> S;
  for(int i=0; i<n; i++){
    string s; int p;
     cin >> s >> p;
    S.push_back(s , 100-p , i+1);}
  sort(S.begin(),S.end());
  
  for(auto x:a)
  {cout << get<2>() << endl;}
    

Compiler output:
a.cc:1:9: fatal error: bits/stc++.h: No such file or directory
    1 | #include"bits/stc++.h"
      |         ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int N;
int arr[20];
int temp[3];

int main(){
  //inputs
  cin >> N;
  for (int i=0;i<N;i++){
    cin >> arr[i];
  }
  
  int count=0;
  for (int i=1;i<n-2;i++){
    temp = {arr[i-1],arr[i],arr[i+1]};
    sort(temp,temp+3);
    if (temp[1] == arr[i]){
      count += 1;
    }
  }
  cout << count;
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: 'n' was not declared in this scope
   16 |   for (int i=1;i<n-2;i++){
      |                  ^
a.cc:17:10: error: assigning to an array from an initializer list
   17 |     temp = {arr[i-1],arr[i],arr[i+1]};
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
 
#define REP(i, a, b) for (int i = (int)a; i <= (int)b; i++)
#define fi first
#define sc second
#define pb push_back
#define all(x) x.begin(), x.end()
 
using namespace std;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int>> vpii;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<int, int> pii;
typedef pair<i64, i64> pi64;
typedef vector<pi64> vpi64;
 
const i64 MOD = 1000000007;
const int INF = 2000000000;

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

    vi a(n);
    int ans = 0;
    REP(i, 0, n-1) {
		cin >> a[i];    	
    }

    REP(i, 1, n-2) {
    	if ( (a[i-1] <= a[i] && a[i] <= a[i+1]) || (a[i-1] >= a[i] && a[i] >= a[i+1]) ) ans++;
    }

    cout << ans << endl;c

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:25: error: 'c' was not declared in this scope
   42 |     cout << ans << endl;c
      |                         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int N;
	cin >> N;
	vector<int> P(N);
	for(int i = 0; i < N; i++) {
		cin >> P[i];
	}
	
	int cnt =0
    for(int i=1; i<N-1; i++){
        if(P[i-1]<P[i]<P[i+1]){
            cnt++;
        }
        else if(P[i+1]<P[i]<P[i-1]){
            cnt++;
        }
    }
    cout << cnt;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: expected ',' or ';' before 'for'
   13 |     for(int i=1; i<N-1; i++){
      |     ^~~
a.cc:13:18: error: 'i' was not declared in this scope
   13 |     for(int i=1; i<N-1; i++){
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int N;
	cin >> N;
	vector<int> L(N);
	for(int i = 0; i < N; i++) {
		cin >> P[i];
	}
	
	int cnt =0
    for(int i=1; i<N-1; i++){
        if(P[i-1]<P[i]<P[i+1]){
            cnt++;
        }
        else if(P[i+1]<P[i]<P[i-1]){
            cnt++;
        }
    }
    cout << cnt;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: 'P' was not declared in this scope
    9 |                 cin >> P[i];
      |                        ^
a.cc:13:5: error: expected ',' or ';' before 'for'
   13 |     for(int i=1; i<N-1; i++){
      |     ^~~
a.cc:13:18: error: 'i' was not declared in this scope
   13 |     for(int i=1; i<N-1; i++){
      |                  ^
Language: Java

import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int num = sc.nextInt();
      int[] array = new int[num];
      int count = 0;
      for(int i = 0;i < array.length;i++){
      	array[i] = sc.nextInt();
      }
      for(int j = 1;j < array.length-1;i++){
      	if((array[j-1] < array[j] && array[j] < array[j+1])||
           (array[j-1] > array[j] && array[j] > array[j+1])){
        count++;
        }
      }
      System.out.println(count);
    }
}

Compiler output:
Main.java:11: error: cannot find symbol
      for(int j = 1;j < array.length-1;i++){
                                       ^
  symbol:   variable i
  location: class Main
1 error
Language: Java

import java.util.ArrayList;
import java.util.Scanner;
class B132 {
    public static void main(String[]args){
        //System.out.println(second(1,3,5));
        int n ;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        int[] arr = new int[n];
        
        for(int i =0 ; i < n ;i++){
           arr[i] = scan.nextInt();
        }
        ArrayList a = new ArrayList() ;
        int count = 0;
        for(int i = 1 ; i<n-1 ; i++){
            if(second(arr[i-1],arr[i],arr[i+1]) == arr[i-1]){
                if(!a.contains(arr[i-1])){
                    a.add(arr[i-1]);
                    count++;
                }
            }else if(second(arr[i-1],arr[i],arr[i+1]) == arr[i]){
                if(!a.contains(arr[i])){
                    a.add(arr[i]);
                    count++;
                }
            } else {
                
                if(!a.contains(arr[i+1])){
                    a.add(arr[i+1]);
                    count++;
                }
            }
            
            
        }
        
        System.out.println(count);
               
    }
    
    static int second(int x , int y ,int z){
        if( (x<y && y<z ) || x>y && y>z){
            return y ;
        }else if((y<x && x<z) || y>x && x>z ){
            return x ;
        }else 
            return z ;
        }
    }
   
    
}


Compiler output:
Main.java:53: error: class, interface, enum, or record expected
}
^
1 error
Language: Java

import java.util.ArrayList;
import java.util.Scanner;
public class B132 {
    public static void main(String[]args){
        //System.out.println(second(1,3,5));
        int n ;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        int[] arr = new int[n];
        
        for(int i =0 ; i < n ;i++){
           arr[i] = scan.nextInt();
        }
        ArrayList a = new ArrayList() ;
        int count = 0;
        for(int i = 1 ; i<n-1 ; i++){
            if(second(arr[i-1],arr[i],arr[i+1]) == arr[i-1]){
                if(!a.contains(arr[i-1])){
                    a.add(arr[i-1]);
                    count++;
                }
            }else if(second(arr[i-1],arr[i],arr[i+1]) == arr[i]){
                if(!a.contains(arr[i])){
                    a.add(arr[i]);
                    count++;
                }
            } else {
                
                if(!a.contains(arr[i+1])){
                    a.add(arr[i+1]);
                    count++;
                }
            }
            
            
        }
        
        System.out.println(count);
               
    }
    
    static int second(int x , int y ,int z){
        if( (x<y && y<z ) || x>y && y>z){
            return y ;
        }else if((y<x && x<z) || y>x && x>z ){
            return x ;
        }else 
            return z ;
        }
    }
   
    
}


Compiler output:
Main.java:53: error: class, interface, enum, or record expected
}
^
1 error
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++) cin >> p[N];
  
  int res = 0;
  for (int i = 0; i < N - 2; i++) {
    if (p[i] < p[i+1] < p[i+2]) res++;
    else if (p[i] > p[i+1] > p[i+2]) res++;
  }
  
  cout << res << endl;
}

Compiler output:
a.cc:1:24: error: missing terminating > character
    1 | #include <bits/stdc++.h
      |                        ^
Language: C++

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

int main(){
  int n;
  cin>>n;
  vector<int> p(n);
  for(int i=0:i<n;i++) cin >> p.at(i);
  int ans=0;
  for(int i=1;i<n-1;i++){
    int minimum=min(p.at(i-1),p.at(i+1));
    int maximum=max(p.at(i-1),p.at(i+1));
    if((minimum<p.at(i)&&p.at(i)<maximum)) ans++;
  }
  
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:12: error: initializer in range-based 'for' loop
    8 |   for(int i=0:i<n;i++) cin >> p.at(i);
      |            ^
a.cc:8:18: error: expected ')' before ';' token
    8 |   for(int i=0:i<n;i++) cin >> p.at(i);
      |      ~           ^
      |                  )
a.cc:8:19: error: 'i' was not declared in this scope
    8 |   for(int i=0:i<n;i++) cin >> p.at(i);
      |                   ^
Language: C++

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

int main(){
  int n;
  cin>>n;
  vector<int> p(n);
  for(int i: p) cin >> p.at(i);
  int ans=0;
  for(int i=1;i<n-1;i++){
    int minimum=min(p.(i-1),p.(i+1));
    int maximum=max(p.(i-1),p.(i+1));
    if((minimum<p.(i)&&p.(i)<maximum)) ans++;
  }
  
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:23: error: expected unqualified-id before '(' token
   11 |     int minimum=min(p.(i-1),p.(i+1));
      |                       ^
a.cc:11:31: error: expected unqualified-id before '(' token
   11 |     int minimum=min(p.(i-1),p.(i+1));
      |                               ^
a.cc:12:23: error: expected unqualified-id before '(' token
   12 |     int maximum=max(p.(i-1),p.(i+1));
      |                       ^
a.cc:12:31: error: expected unqualified-id before '(' token
   12 |     int maximum=max(p.(i-1),p.(i+1));
      |                               ^
a.cc:13:19: error: expected unqualified-id before '(' token
   13 |     if((minimum<p.(i)&&p.(i)<maximum)) ans++;
      |                   ^
a.cc:13:26: error: expected unqualified-id before '(' token
   13 |     if((minimum<p.(i)&&p.(i)<maximum)) ans++;
      |                          ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < p.size(); i++) {
    cin >> p[i];
  }

  int ans = 0;
  for (int i = 1; i < n - 1; i++) {
    if (max(p[i - 1], p[i], p[i + 1]) > p[i] &&
        min(p[i - 1], p[i], p[i + 1]) < p[i])
      ans++;
  }

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

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:16:12:   required from here
   16 |     if (max(p[i - 1], p[i], p[i + 1]) > p[i] &&
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:17:12:   required from here
   17 |         min(p[i - 1], p[i], p[i + 1]) < p[i])
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

int main(){
	int N;
	cin >> N;
	vector<P(N);
	for(int i = 0; i < N; i++)cin >> P.at(i);
	int cnt = 0;
	for(int i = 1; i < N - 1; i++){
		int Pax = max(max(P.at(i - 1), P.at(i)), P.at(i + 1));
		int Pin = min(min(P.at(i - 1), P.at(i)), P.at(i + 1));
		if(P.at(i) != Pax && P.at(i) != Pin) cnt++;
	}
	cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:16: error: 'P' was not declared in this scope
    7 |         vector<P(N);
      |                ^
a.cc:7:19: error: template argument 1 is invalid
    7 |         vector<P(N);
      |                   ^
a.cc:7:19: error: template argument 2 is invalid
Language: C++

#include<iostream>
using namespace std;

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

	int res = 0;

	for (int i = 0;i < n - 2;++i) {
		if (p[i] < p[i + 1] < p[i + 2])++res;
		if (p[i + 2] < p[i + 1] < p[i])++res;

	}
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:37: error: 'p' was not declared in this scope
    7 |         for(int i=0;i<n;++i) cin >> p[i];
      |                                     ^
a.cc:12:21: error: 'p' was not declared in this scope
   12 |                 if (p[i] < p[i + 1] < p[i + 2])++res;
      |                     ^
a.cc:13:21: error: 'p' was not declared in this scope
   13 |                 if (p[i + 2] < p[i + 1] < p[i])++res;
      |                     ^
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>p(n);
	rep(i, n) cin >> p[i];

	int res = 0;

	rep(i, n-2) {
		if (p[i] < p[i + 1] < p[i + 2])++res;
		if (p[i + 2] < p[i + 1] < p[i])++res;

	}
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'vector' was not declared in this scope
    8 |         vector<int>p(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:8:16: error: expected primary-expression before 'int'
    8 |         vector<int>p(n);
      |                ^~~
a.cc:9:26: error: 'p' was not declared in this scope
    9 |         rep(i, n) cin >> p[i];
      |                          ^
a.cc:14:21: error: 'p' was not declared in this scope
   14 |                 if (p[i] < p[i + 1] < p[i + 2])++res;
      |                     ^
a.cc:15:21: error: 'p' was not declared in this scope
   15 |                 if (p[i + 2] < p[i + 1] < p[i])++res;
      |                     ^
Language: C++

#include<iostream>
#define rep(i,n) for(i=0;i<n;++i)
using namespace std;

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

	int res = 0;

	rep(i, n-2) {
		if (p[i] < p[i + 1] < p[i + 2])++res;
		if (p[i + 2] < p[i + 1] < p[i])++res;

	}
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'i' was not declared in this scope
    8 |         rep(i, n) cin >> p[i];
      |             ^
a.cc:2:22: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(i=0;i<n;++i)
      |                      ^
a.cc:8:26: error: 'p' was not declared in this scope
    8 |         rep(i, n) cin >> p[i];
      |                          ^
a.cc:12:13: error: 'i' was not declared in this scope
   12 |         rep(i, n-2) {
      |             ^
a.cc:2:22: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(i=0;i<n;++i)
      |                      ^
a.cc:13:21: error: 'p' was not declared in this scope
   13 |                 if (p[i] < p[i + 1] < p[i + 2])++res;
      |                     ^
a.cc:14:21: error: 'p' was not declared in this scope
   14 |                 if (p[i + 2] < p[i + 1] < p[i])++res;
      |                     ^
Language: C++

#include<iostream>
#define rep(i,n) for(i=0;i<n;++i)
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int>p(n);
	rep(i, n) cin >> p[i];

	int res = 0;

	rep(i, n-2) {
		if (p[i] < p[i + 1] < p[i + 2])++res;
		if (p[i + 2] < p[i + 1] < p[i])++res;

	}
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'vector' was not declared in this scope
    8 |         vector<int>p(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(i=0;i<n;++i)
a.cc:8:16: error: expected primary-expression before 'int'
    8 |         vector<int>p(n);
      |                ^~~
a.cc:9:13: error: 'i' was not declared in this scope
    9 |         rep(i, n) cin >> p[i];
      |             ^
a.cc:2:22: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(i=0;i<n;++i)
      |                      ^
a.cc:9:26: error: 'p' was not declared in this scope
    9 |         rep(i, n) cin >> p[i];
      |                          ^
a.cc:13:13: error: 'i' was not declared in this scope
   13 |         rep(i, n-2) {
      |             ^
a.cc:2:22: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(i=0;i<n;++i)
      |                      ^
a.cc:14:21: error: 'p' was not declared in this scope
   14 |                 if (p[i] < p[i + 1] < p[i + 2])++res;
      |                     ^
a.cc:15:21: error: 'p' was not declared in this scope
   15 |                 if (p[i + 2] < p[i + 1] < p[i])++res;
      |                     ^
Language: C++

#include<iostream>
#define rep(i,n) for(i=0;i<n;++i)
using namespace std;

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

	int res = 0;

	rep(i, n) {
		if (p[i] < p[i + 1] < p[i + 2])++res;
		if (p[i + 2] < p[i + 1] < p[i])++res;

	}
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'i' was not declared in this scope
    8 |         rep(i, n) cin >> p[i];
      |             ^
a.cc:2:22: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(i=0;i<n;++i)
      |                      ^
a.cc:8:26: error: 'p' was not declared in this scope
    8 |         rep(i, n) cin >> p[i];
      |                          ^
a.cc:12:13: error: 'i' was not declared in this scope
   12 |         rep(i, n) {
      |             ^
a.cc:2:22: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(i=0;i<n;++i)
      |                      ^
a.cc:13:21: error: 'p' was not declared in this scope
   13 |                 if (p[i] < p[i + 1] < p[i + 2])++res;
      |                     ^
a.cc:14:21: error: 'p' was not declared in this scope
   14 |                 if (p[i + 2] < p[i + 1] < p[i])++res;
      |                     ^
Language: C++

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

int main() {
  int n;
  cin>>n;
  vector<int> p(n);
  for (int i=0; i<n; i++)
    cin>>p.at(i);
  
  int z=0;
  for (int i=1; i<n-1; i++) {
    if (p.at(i-1)<p.at(i)<p.at(i+1) || p.at(i-1)>p.at(i)>p.at(i+1))
      z++
  }
  cout<< z <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: expected ';' before '}' token
   14 |       z++
      |          ^
      |          ;
   15 |   }
      |   ~
Language: C

#include <stdio.h>


int main(){
  int n,p[20],count,i;
  
  scanf("%d\n",&n);
  for(i=0; i<n; i++){
  scanf("%d\n",&p[i]);
  }
  
  count=0;
  
  for(i=1; i<n-1; i++){
  	if((a[i-1]<a[i])&&(a[i]<a[i+1])){count++;}
    if((a[i-1]>a[i])&&(a[i]>a[i+1])){count++;}  
  }
  
  printf("%d",count);
  
  return(0);
}


Compiler output:
main.c: In function 'main':
main.c:15:13: error: 'a' undeclared (first use in this function)
   15 |         if((a[i-1]<a[i])&&(a[i]<a[i+1])){count++;}
      |             ^
main.c:15:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>


int main(){
  int n,p[20],count,i;
  
  scanf("%d\n",&n);
  for(i=0; i<N; i++){
  scanf("%d\n",&p[i]);
  }
  
  count=0;
  
  for(i=1; i<N-1; i++){
  	if((a[i-1]<a[i])&&(a[i]<a[i+1])){count++;}
    if((a[i-1]>a[i])&&(a[i]>a[i+1])){count++;}  
  }
  
  printf("%d",count);
  
  return(0);
}

Compiler output:
main.c: In function 'main':
main.c:8:14: error: 'N' undeclared (first use in this function)
    8 |   for(i=0; i<N; i++){
      |              ^
main.c:8:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:13: error: 'a' undeclared (first use in this function)
   15 |         if((a[i-1]<a[i])&&(a[i]<a[i+1])){count++;}
      |             ^
Language: C++

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

int main() {
  int n, count = 0;
  cin >> n;
  vector<int> p(n);
  for(int i = 0; i < n; i++){
    cin >> p(i);
  }
  for(int i = 1; i < n - 1; i++){
    if((p(i - 1) < p(i) && p(i) < p(i + 1))||
       (p(i - 1) > p(i) && p(i) > p(i + 1))){
      count++;
    }
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: no match for call to '(std::vector<int>) (int&)'
    9 |     cin >> p(i);
      |            ~^~~
a.cc:12:10: error: no match for call to '(std::vector<int>) (int)'
   12 |     if((p(i - 1) < p(i) && p(i) < p(i + 1))||
      |         ~^~~~~~~
a.cc:12:21: error: no match for call to '(std::vector<int>) (int&)'
   12 |     if((p(i - 1) < p(i) && p(i) < p(i + 1))||
      |                    ~^~~
a.cc:12:29: error: no match for call to '(std::vector<int>) (int&)'
   12 |     if((p(i - 1) < p(i) && p(i) < p(i + 1))||
      |                            ~^~~
a.cc:12:36: error: no match for call to '(std::vector<int>) (int)'
   12 |     if((p(i - 1) < p(i) && p(i) < p(i + 1))||
      |                                   ~^~~~~~~
a.cc:13:10: error: no match for call to '(std::vector<int>) (int)'
   13 |        (p(i - 1) > p(i) && p(i) > p(i + 1))){
      |         ~^~~~~~~
a.cc:13:21: error: no match for call to '(std::vector<int>) (int&)'
   13 |        (p(i - 1) > p(i) && p(i) > p(i + 1))){
      |                    ~^~~
a.cc:13:29: error: no match for call to '(std::vector<int>) (int&)'
   13 |        (p(i - 1) > p(i) && p(i) > p(i + 1))){
      |                            ~^~~
a.cc:13:36: error: no match for call to '(std::vector<int>) (int)'
   13 |        (p(i - 1) > p(i) && p(i) > p(i + 1))){
      |                                   ~^~~~~~~
Language: C++

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

int main() {
  int n, count = 0;
  cin >> n;
  vector<int> p(n);
  for(int i = 0; i < n; i++){
    cin >> p(i);
  }
  for(int i = 1; i < n - 1; i++){
    if((p(i - 1) < p(i) && p(i) < p(i + 1))||
       (p(i - 1) > p(i) && p(i) > p(i + 1))){
      count++;
    }
  }
  cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: no match for call to '(std::vector<int>) (int&)'
    9 |     cin >> p(i);
      |            ~^~~
a.cc:12:10: error: no match for call to '(std::vector<int>) (int)'
   12 |     if((p(i - 1) < p(i) && p(i) < p(i + 1))||
      |         ~^~~~~~~
a.cc:12:21: error: no match for call to '(std::vector<int>) (int&)'
   12 |     if((p(i - 1) < p(i) && p(i) < p(i + 1))||
      |                    ~^~~
a.cc:12:29: error: no match for call to '(std::vector<int>) (int&)'
   12 |     if((p(i - 1) < p(i) && p(i) < p(i + 1))||
      |                            ~^~~
a.cc:12:36: error: no match for call to '(std::vector<int>) (int)'
   12 |     if((p(i - 1) < p(i) && p(i) < p(i + 1))||
      |                                   ~^~~~~~~
a.cc:13:10: error: no match for call to '(std::vector<int>) (int)'
   13 |        (p(i - 1) > p(i) && p(i) > p(i + 1))){
      |         ~^~~~~~~
a.cc:13:21: error: no match for call to '(std::vector<int>) (int&)'
   13 |        (p(i - 1) > p(i) && p(i) > p(i + 1))){
      |                    ~^~~
a.cc:13:29: error: no match for call to '(std::vector<int>) (int&)'
   13 |        (p(i - 1) > p(i) && p(i) > p(i + 1))){
      |                            ~^~~
a.cc:13:36: error: no match for call to '(std::vector<int>) (int)'
   13 |        (p(i - 1) > p(i) && p(i) > p(i + 1))){
      |                                   ~^~~~~~~
Language: C

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

int main()
{
    int n,i,c=0;
    cin>>n;
    int arr[n];

    for(i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(i=1;i<n-1;i++)
    {
        if((arr[i]>arr[i+1] && arr[i]<arr[i-1]) || (arr[i]<arr[i+1] && arr[i]>arr[i-1]))
        {
            c++;
        }
    }
    cout<<c<<endl;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.