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

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
	if(!b)return 1;	if(b&1)return modpow(a,b-1,m)*a%m;
	int memo = modpow(a,b>>1,m);
	return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a;
  cin>>a
    vector<int> b(a);
  rep(i,a)
    cin>>b[i];
  int c=0;
  rep(i,a-2){
  if(b[i+1]==mid(b[i],b[i+1],b[i+2]))
    c++;
  }
  out(c);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:90:9: error: expected ';' before 'vector'
   90 |   cin>>a
      |         ^
      |         ;
   91 |     vector<int> b(a);
      |     ~~~~~~
a.cc:93:10: error: 'b' was not declared in this scope
   93 |     cin>>b[i];
      |          ^
a.cc:96:6: error: 'b' was not declared in this scope
   96 |   if(b[i+1]==mid(b[i],b[i+1],b[i+2]))
      |      ^
Language: C++

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

int main() {
    int n;
    cin >> n;
    vector<int>p(n);
    int ans = 0;
    for(int i = 2; i < S.size(); i++) {
        if(p[i] != min(min(p[i],p[i-1]),p[i-2]) && p[i] != max(max(p[i],p[i-1]),p[i-2])) {
            ans++;
        }
    }
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: 'S' was not declared in this scope
    9 |     for(int i = 2; i < S.size(); i++) {
      |                        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int ctoi(const char c) {
    if ('0' <= c && c <= '9') return (c - '0');
    return -1;
}
vector<int> input(int n) {
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }
    return vec;
}
void output(vector<int> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    return;
}
vector<vector<int>> input(int n, int m) {
    vector<vector<int>> table(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> table. at(i).at(j);
        }
    }
    return table;
}
void output(vector<vector<int>> table) {
    for (int i = 0; i < table.size(); i++) {
        for (int j = 0; j < table.at(0).size(); j++) {
            cout << table.at(i).at(j) << " ";
        }
        cout << endl;
    }
}
long long perm(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long perm = 1;
    for (int i = n; i > n - r; i--) {
        perm *= i;
    }
    return perm;
}
long long comb(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long comb = perm(n,r);
    for (int i = r; i > 0; i--) {
        comb /= i;
    }
    return comb;
}
long long homo(int n, int r) {
    return comb(n + r - 1, n - 1);
}
long long fact(int n) {
    long long fact = 1;
    for (int i = n; i > 0; i--) {
        fact *= i;
    }
    return fact;
}
int gcd(int a, int b){
    if (a % b == 0){
        return(b);
    }else{
        return(gcd(b, a % b));
    }
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
bool isprime(int n){
    if (n < 2) return false;
    else if (n == 2) return true;
    else if (n % 2 == 0) return false;

    for (int i = 3; i <= sqrt(n); i += 2){
        if (n % i == 0){
            return false;
        }
    }
    return true;
}
void sayYes(bool f) {
    if (f) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}
void sayYES(bool f) {
    if (f) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

int main() {
  int n,ans=0;
  cin >>> n;
  vector<int> p=input(n);
  for(int i=2;i<n;i++){
    if(min(min(p[i],p[i-1]),p[i-2])==p[i-1]){
      ans++;
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:111:9: error: expected primary-expression before '>' token
  111 |   cin >>> n;
      |         ^
Language: C++

//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define minval -2e9
#define maxval 1e9
long double PI =3.14159265358979323846;
 
const ll M=1e12;
const ll inf=1e18;
const ll ms=10000000;
fast;
ll ans,n,m;
void solve()
{
    cin>>n;ll ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
    }
    for(int i=1;i<n-1;i++)
    {
        if(ar[i-1]<ar[i]&&ar[i]<ar[i+1])
            ans++;
        else if(ar[i-1]>ar[i]&&ar[i]>ar[i+1])
            ans++;
    }
   cout<<ans<<endl;
    
}


Compiler output:
a.cc:10:9: warning: "debug" redefined
   10 | #define debug cout<<"debugged\n";
      |         ^~~~~
a.cc:9:9: note: this is the location of the previous definition
    9 | #define debug(x) cout<<x<<"\n";
      |         ^~~~~
/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++

//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define minval -2e9
#define maxval 1e9
long double PI =3.14159265358979323846;
 
const ll M=1e12;
const ll inf=1e18;
const ll ms=10000000;
fast;
ll ans,n,m;
void solve()
{
    cin>>n;ll ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
    }
    for(int i=1;i<n-1;i++)
    {
        if(ar[i-1]<ar[i]&&ar[i]<ar[i+1])
            ans++;
        else if(ar[i-1]>ar[i]&&ar[i]>ar[i+1])
            ans++;
    }
   cout<<ans<<endl;
    
}

Compiler output:
a.cc:10:9: warning: "debug" redefined
   10 | #define debug cout<<"debugged\n";
      |         ^~~~~
a.cc:9:9: note: this is the location of the previous definition
    9 | #define debug(x) cout<<x<<"\n";
      |         ^~~~~
/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++

import sys
import math
import bisect

def main():
    n = int(input())
    A = list(map(int, input().split()))
    ans = 0
    for i in range(1, n - 1):
        if A[i] == sorted([A[i-1], A[i], A[i+1]])[1]:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

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


Compiler output:
a.cc:16:3: error: 'cout' does not name a type
   16 |   cout<<ans<<endl;
      |   ^~~~
a.cc:17:1: error: expected declaration before '}' token
   17 | }
      | ^
Language: C++

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

int main(){
  int n,ans=0;
  cin>>n;
  vector<int>a(n)
  for(int i=0;i<n-3;i++){
    cin>>a[i];
    if(a[i]<a[i+1]<a[i+2]||a[i+2]<a[i+1]<a[i]){
      ans++;
    }
  }
  cout<<ans<<endl;
}
  
    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: expected ',' or ';' before 'for'
    8 |   for(int i=0;i<n-3;i++){
      |   ^~~
a.cc:8:15: error: 'i' was not declared in this scope
    8 |   for(int i=0;i<n-3;i++){
      |               ^
Language: C

#include<stdio.h>
int main()
{
int a,i,b;
  b=0;
scanf("%d",&a);
  int num[a];
scanf("%d %d",&num[0],&num[1]);
  
  for(i=2;i<a;++i)
  {
  scanf("%d",&num[i]);
  if(num[i-2] < num[i-1] < num[i]) b+;;
  }

printf("%d",b);

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:38: error: expected expression before ';' token
   13 |   if(num[i-2] < num[i-1] < num[i]) b+;;
      |                                      ^
Language: C

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

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

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

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  for(int i;i<n;i++){
    cin >> v[i];
  }
  int r=0;
  for(int i=1;i<n-1;i++){
    if(v[i]==fmin(v[i],v[i-1]) && v[i]==fmax(v[i],v[i+1])){
      r++;
    }
    else if(v[i]==fmax(v[i],v[i-1]) && v[i]==fmin(v[i],v[i+1])){
      r++;
    }
    cout << r;
            
  return 0;
}


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

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

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  for(int i;i<n;i++){
    cin >> v[i];
  }
  return 0;
}

Compiler output:
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory
    1 | #include <bits\stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

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

Compiler output:
Main.java:11: error: variable x might not have been initialized
      if((N[j-1]<N[j])&&(N[j]<N[j+1])){x=x+1;}
                                         ^
Main.java:12: error: variable x might not have been initialized
      else if((N[j-1]>N[j])&&(N[j]>N[j+1])){x=x+1;}}
                                              ^
Main.java:13: error: variable x might not have been initialized
    System.out.println(x);
                       ^
3 errors
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 count = 0;
  for(int k=0;k<N-1;k++){
    if((P.at(k)-P.at(k-1))*(P.at(k+1)-P.at(k))>0){
      count++
    }
  }
  
  cout << count <<endl;
}


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

#include <iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  for (int i;i<n;i++){
    cin >> a[i];
  }
  int k;
  for(int i=1;i<n-1;i++){
    if(a[i]<a[i-1]){
      if(a[i]>a[i+1]){
        k++;
      }
    }
    else{
      if(a[i]<a[i+1]{
        k++;
      }
         }
         }
         return 0;
         }
       
      

Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: expected ')' before '{' token
   18 |       if(a[i]<a[i+1]{
      |         ~           ^
      |                     )
a.cc:21:10: error: expected primary-expression before '}' token
   21 |          }
      |          ^
Language: C++

#include <iostream>
#include <math.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i;i<n;i++){
    cin >> a[i];
  }
  int k;
  for(int 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)){
      k++;
    }
                                                              }
         return 0;
                                                              }
                                                            
            
      


Compiler output:
a.cc: In function 'int main()':
a.cc:13:66: error: expected ']' before ')' token
   13 |     if((a[i-1]<a[i] && a[i]<a[i+1]) || (a[i-1]>a[i] && a[i]>a[i+1)){
      |                                                                  ^
      |                                                                  ]
Language: C++

#include <iostream>
#include <math.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i;i<n;i++){
    cin >> a[i];
  }
  int k;
  for(int i=1;i<n-1;i++){
    if(a[i]==fmin(a[i],a[i-1])){
      if(a[i]==fmax(a[i],a[i+1])){
        k++;
      }
    }
    else if((a[i]==fmax(a[i],a[i-1])){
      if(a[i]==fmin(a[i],a[i+1])){
        k++;
      }
    }
  }
  return 0;
}
    
            
      


Compiler output:
a.cc: In function 'int main()':
a.cc:18:38: error: expected ')' before '{' token
   18 |     else if((a[i]==fmax(a[i],a[i-1])){
      |            ~                         ^
      |                                      )
a.cc:23:3: error: expected primary-expression before '}' token
   23 |   }
      |   ^
Language: C++

#include <iostream>
#include <math.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i;i<n;i++){
    cin >> a[i];
  }
  int k;
  for(int i=1;i<n-1;i++){
    if(a[i]==fmin(a[i],a[i-1])){
      if(a[i]==fmax(a[i],a[i+1])){
        k++;
      }
    }
    else if((a[i]==fmax(a[i],a[i-1])){
      if(a[i]==fmin(a[i],a[i+1])){
        k++;
      }
    }
            }
            return 0;
            }
            
      


Compiler output:
a.cc: In function 'int main()':
a.cc:18:38: error: expected ')' before '{' token
   18 |     else if((a[i]==fmax(a[i],a[i-1])){
      |            ~                         ^
      |                                      )
a.cc:23:13: error: expected primary-expression before '}' token
   23 |             }
      |             ^
Language: C++

#include <iostream>
#include <math.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i;i<n;i++){
    cin >> a[i];
  }
  int k;
  for(int i=1;i<n-1;i++){
    if(a[i]==fmin(a[i],a[i-1])){
      if(a[i]==fmax(a[i],a[i+1])){
        k++;
      }
    }
    else if((a[i]==fmax(a[i],a[i-1])){
      if(a[i]==fmin(a[i],a[i+1])){
        k++;
      }
    }
            return 0;
            }
            
      

Compiler output:
a.cc: In function 'int main()':
a.cc:18:38: error: expected ';' before '{' token
   18 |     else if((a[i]==fmax(a[i],a[i-1])){
      |                                      ^
      |                                      ;
a.cc:23:13: error: expected primary-expression before 'return'
   23 |             return 0;
      |             ^~~~~~
a.cc:22:6: error: expected ')' before 'return'
   22 |     }
      |      ^
      |      )
   23 |             return 0;
      |             ~~~~~~
a.cc:18:12: note: to match this '('
   18 |     else if((a[i]==fmax(a[i],a[i-1])){
      |            ^
a.cc:24:14: error: expected '}' at end of input
   24 |             }
      |              ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>
#include<math.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
 for(int i; i<n;i++){
   cin>> a[i];
 }
  int k=0;
  for(int i=1;i<n-1;i++){
    if((a[i]==fmin(a[i],a[i-1]) && (a[i]==fmax(a[i],a[i+1])) || (a[i]==fmax(a[i],a[i-1]) && a[i]==fmin(a[i],a[i+1]))){
      k++;
    }
        }
   cout << k;
    return 0;
        }                                                                 
                                                                 


Compiler output:
a.cc: In function 'int main()':
a.cc:13:118: error: expected ')' before '{' token
   13 |     if((a[i]==fmin(a[i],a[i-1]) && (a[i]==fmax(a[i],a[i+1])) || (a[i]==fmax(a[i],a[i-1]) && a[i]==fmin(a[i],a[i+1]))){
      |       ~                                                                                                              ^
      |                                                                                                                      )
a.cc:16:9: error: expected primary-expression before '}' token
   16 |         }
      |         ^
Language: C++

#include <iostream>
#include<math.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
 for(int i; i<n;i++){
   cin>> a[i];
 }
  int k=0;
  for(int i=1;i<n-1;i++){
    if((a[i]==fmin(a[i],a[i-1]) && (a[i]==fmax(a[i],a[i+1])) || (a[i]==fmax(a[i],a[i-1]) && (a[i]==fmin(a[i],a[i+1]))){
      k++;
    }
        }
   cout << k;
    return 0;
        }                                                                 
                                                                 


Compiler output:
a.cc: In function 'int main()':
a.cc:13:119: error: expected ')' before '{' token
   13 |     if((a[i]==fmin(a[i],a[i-1]) && (a[i]==fmax(a[i],a[i+1])) || (a[i]==fmax(a[i],a[i-1]) && (a[i]==fmin(a[i],a[i+1]))){
      |        ~                                                                                                              ^
      |                                                                                                                       )
a.cc:15:6: error: expected ')' before '}' token
   15 |     }
      |      ^
      |      )
   16 |         }
      |         ~
a.cc:13:7: note: to match this '('
   13 |     if((a[i]==fmin(a[i],a[i-1]) && (a[i]==fmax(a[i],a[i+1])) || (a[i]==fmax(a[i],a[i-1]) && (a[i]==fmin(a[i],a[i+1]))){
      |       ^
a.cc:16:9: error: expected primary-expression before '}' token
   16 |         }
      |         ^
Language: C++

#include <iostream>
#include<math.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
 for(int i; i<n;i++){
   cin>> a[i];
 }
  int k=0;
  for(int i=1;i<n-1;i++){
    if((a[i]==fmin(a[i],a[i-1]) && (a[i]==fmax(a[i],a[i+1])) || (a[i]==fmax(a[i],a[i-1]) && (a[i]==fmin(a[i],a[i+1])){
      k++;
    }
   cout << k;
    return 0;
                                                                 }
                                                                 
                                                                 

Compiler output:
a.cc: In function 'int main()':
a.cc:13:118: error: expected ')' before '{' token
   13 |     if((a[i]==fmin(a[i],a[i-1]) && (a[i]==fmax(a[i],a[i+1])) || (a[i]==fmax(a[i],a[i-1]) && (a[i]==fmin(a[i],a[i+1])){
      |                                                                 ~                                                    ^
      |                                                                                                                      )
a.cc:15:6: error: expected ')' before 'cout'
   15 |     }
      |      ^
      |      )
   16 |    cout << k;
      |    ~~~~
a.cc:13:8: note: to match this '('
   13 |     if((a[i]==fmin(a[i],a[i-1]) && (a[i]==fmax(a[i],a[i+1])) || (a[i]==fmax(a[i],a[i-1]) && (a[i]==fmin(a[i],a[i+1])){
      |        ^
a.cc:16:13: error: expected ')' before ';' token
   16 |    cout << k;
      |             ^
      |             )
a.cc:13:7: note: to match this '('
   13 |     if((a[i]==fmin(a[i],a[i-1]) && (a[i]==fmax(a[i],a[i+1])) || (a[i]==fmax(a[i],a[i-1]) && (a[i]==fmin(a[i],a[i+1])){
      |       ^
a.cc:18:67: error: expected '}' at end of input
   18 |                                                                  }
      |                                                                   ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,count=0,p[n];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>p[i];
  }
  for(int i=1;i<n-1;i++){
    if(p[i]!=min(p[i-1],p[i],p[i+1])&&p[i]!=max(p[i-1],p[i],p[i+1])){
      count++;
    }
    else{
      continue;
    }
  }
  cout<<count;
  return 0;
}


Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/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:10:17:   required from here
   10 |     if(p[i]!=min(p[i-1],p[i],p[i+1])&&p[i]!=max(p[i-1],p[i],p[i+1])){
      |              ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
/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:10:48:   required from here
   10 |     if(p[i]!=min(p[i-1],p[i],p[i+1])&&p[i]!=max(p[i-1],p[i],p[i+1])){
      |                                             ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,count=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=1;i<n-1;i++){
    if(p[i]!=min(p[i-1],p[i],p[i+1])&&p[i]!=max(p[i-1],p[i],p[i+1])){
      count++;
    }
    else{
      continue;
    }
  }
  cout<<count;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'a' was not declared in this scope
    7 |     cin>>a[i];
      |          ^
a.cc:10:8: error: 'p' was not declared in this scope
   10 |     if(p[i]!=min(p[i-1],p[i],p[i+1])&&p[i]!=max(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> p(n);
  for(int i=0;i<n;i++){
    cin>>p[i];
  }
  int t=0;
  for(int i=0;i<n-2;i++){
    if(max(p[i],max(p[i+1],p[i+2]))==p[i+1]){
      t++;
    }
  }
  cout<t<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   17 |   cout<t<<endl;
      |        ~^~~~~~
Language: C++

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

int n;
vector<int> p;

int main() {
    cin>>n;
    p.resize(n);
    int cnt=0;
    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])) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


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

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a[n];
  	for(int i = 0; i < n; i++)
     	cin >> a[i];
    int cnt = 0;
    for(int i = 1; i < n - 1; i++)
    {
        if(a[i] > a[i - 1] && a[i + 1] > a[i])
            cnt++;
        else if(a[i] > a[i + 1] && a[i] < a[i - 1])
            cnt++;
    }
    cout << cnt << endl;
    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 | using namespace std;
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> a[n];
      |            ^~~
a.cc:9:16: error: 'a' was not declared in this scope
    9 |         cin >> a[i];
      |                ^
a.cc:13:12: error: 'a' was not declared in this scope
   13 |         if(a[i] > a[i - 1] && a[i + 1] > a[i])
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define dl double long
const int INF=0x3fffffff;
const ll MOD=1000000007;
const ll MODD=998244353;
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;
 
    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };
 
    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }
 
    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }
 
    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
 
    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }
 
    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

int main() {
  	ll N, ans=0;
    cin >> N;
  	vector<ll> p(N);
  	rep(i, N) cin >> p[i];
	rep(i, N-2){
    	if(p[i] < p[i+1] && p[i+1] < p[i+2] ||
           p[i+2] < p[i+1] && p[i+1] < p[i]){
          ++cnt;
        }
    }
    cout << cnt << "\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:77:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   77 |           ++cnt;
      |             ^~~
      |             int
a.cc:80:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   80 |     cout << cnt << "\n";
      |             ^~~
      |             int
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
int main() {
  int n; cin >> n;
  vector<int>p(n);
  for(int i; i<n; i++) cin >> p[i];
  int ans =0;
  for(int i; i<n-2; i++){
    if(p[i]<p[i+1]&&p[i+1]<p[i+2]) ans++;
    else if(p[i]>p[i+1]&&p[i+1]>p[i+2]) ans++;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int>p(n);
      |   ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <cmath>
  +++ |+#include <vector>
    4 | #define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int>p(n);
      |          ^~~
a.cc:9:31: error: 'p' was not declared in this scope
    9 |   for(int i; i<n; i++) cin >> p[i];
      |                               ^
a.cc:12:8: error: 'p' was not declared in this scope
   12 |     if(p[i]<p[i+1]&&p[i+1]<p[i+2]) ans++;
      |        ^
Language: C++

fn input() -> i32 {
    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };
    let mut integers = s.split_whitespace();
    let integer: i32 = integers.next().unwrap().parse().unwrap();
    integer
}
fn main() {
    let n:i32 = input();
    let p: Vec<i32> = {
        let s = {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            s.trim_right().to_owned()
        };
        let integers: Vec<&str> = s.split_whitespace().collect();
        let mut vector = Vec::new();
        let mut tmp: i32;
        for element in integers {
            tmp = element.parse().unwrap();
            vector.push(tmp);
        }
        vector
    };
    // dbg!(p);
    
    let mut can: bool;
    let mut cnt = 0;
    let mut a: i32;
    let mut b: i32;
    let mut c: i32;
    
    for i in 0..(n-2) as usize {
        // dbg!(i);
        can = false;
        a = p[i];
        b = p[i+1];
        c = p[i+2];
        if a < b && b <= c {
            can = true;
        }
        if c < b && b <= a {
            can = true;
        }
        if can {
            cnt += 1;
        }
    }

    println!("{}", cnt);
}


Compiler output:
a.cc:36:14: error: too many decimal points in number
   36 |     for i in 0..(n-2) as usize {
      |              ^~~
a.cc:1:1: error: 'fn' does not name a type
    1 | fn input() -> i32 {
      | ^~
a.cc:11:1: error: 'fn' does not name a type
   11 | fn main() {
      | ^~
Language: C++


fn input() -> i32 {
    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };
    let mut integers = s.split_whitespace();
    let integer: i32 = integers.next().unwrap().parse().unwrap();
    integer
}
fn input_char() -> char {
    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };
    let ch: char = {
        let mut tmp: char = 'a';
        for c in s.chars() {
            tmp = c
        }
        tmp
    };
    ch
}

fn main() {
    let n:i32 = input();
    let p: Vec<i32> = {
        let s = {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            s.trim_right().to_owned()
        };
        let integers: Vec<&str> = s.split_whitespace().collect();
        let mut vector = Vec::new();
        let mut tmp: i32;
        for element in integers {
            tmp = element.parse().unwrap();
            vector.push(tmp);
        }
        vector
    };
    // dbg!(p);
    
    let mut can: bool;
    let mut cnt = 0;
    let mut a: i32;
    let mut b: i32;
    let mut c: i32;
    
    for i in 0..(n-2) as usize {
        // dbg!(i);
        can = false;
        a = p[i];
        b = p[i+1];
        c = p[i+2];
        if a < b && b <= c {
            can = true;
        }
        if c < b && b <= a {
            can = true;
        }
        if can {
            cnt += 1;
        }
    }

    println!("{}", cnt);
}


Compiler output:
a.cc:53:14: error: too many decimal points in number
   53 |     for i in 0..(n-2) as usize {
      |              ^~~
a.cc:2:1: error: 'fn' does not name a type
    2 | fn input() -> i32 {
      | ^~
a.cc:12:1: error: 'fn' does not name a type
   12 | fn input_char() -> char {
      | ^~
a.cc:28:1: error: 'fn' does not name a type
   28 | fn main() {
      | ^~
Language: C++

#include<iostream>
using namespace std;
int main(){
int n;
  cin>>n;
  int p[n];
  for (int i=0; i<n; i++) cin>>p[i];
  int counter=0;
  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] )counter++;
  }
  cout<<counter<<endl;}
                               

Compiler output:
a.cc:10:17: error: extended character 　 is not valid in an identifier
   10 |  if (p[i-1]<p[i]　&& p[i]<p[i+1] || p[i+1]<p[i] && p[i]<p[i-1] )counter++;
      |                 ^
a.cc: In function 'int main()':
a.cc:10:17: error: expected ')' before '\U00003000'
   10 |  if (p[i-1]<p[i]　&& p[i]<p[i+1] || p[i+1]<p[i] && p[i]<p[i-1] )counter++;
      |     ~           ^~
      |                 )
Language: C++

#include<iostream>
using namespace std;
int main(){
int n;
  cin>>n;
  int p[n];
  for (int i=0; i<n; i++) cin>>p[i];
  int counter=0;
  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] )counter++;
  }
  cout<<counter<<endl;}
                               

Compiler output:
a.cc:10:20: error: extended character 　 is not valid in an identifier
   10 |     if (p[i-1]<p[i]　&& p[i]<p[i+1] || p[i+1]<p[i] && p[i]<p[i-1] )counter++;
      |                    ^
a.cc: In function 'int main()':
a.cc:10:20: error: expected ')' before '\U00003000'
   10 |     if (p[i-1]<p[i]　&& p[i]<p[i+1] || p[i+1]<p[i] && p[i]<p[i-1] )counter++;
      |        ~           ^~
      |                    )
Language: C++

#include<iostream>
using namespace std;
int main(){
int n;
  cin>>n;
  int p[n];
  for (int i=0; i<n; i++) cin>>p[i];
  int counter=0;
  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]) )counter++;
  }
  cout<<counter<<endl;}
                               

Compiler output:
a.cc:10:21: error: extended character 　 is not valid in an identifier
   10 |     if ((p[i-1]<p[i]　&& p[i]<p[i+1] )|| (p[i+1]<p[i] && p[i]<p[i-1]) )counter++;
      |                     ^
a.cc: In function 'int main()':
a.cc:10:21: error: expected ')' before '\U00003000'
   10 |     if ((p[i-1]<p[i]　&& p[i]<p[i+1] )|| (p[i+1]<p[i] && p[i]<p[i-1]) )counter++;
      |         ~           ^~
      |                     )
a.cc:10:81: error: expected ')' before ';' token
   10 |     if ((p[i-1]<p[i]　&& p[i]<p[i+1] )|| (p[i+1]<p[i] && p[i]<p[i-1]) )counter++;
      |        ~                                                                        ^
      |                                                                                 )
Language: C++

#include<iostream>
using namespace std;
int main(){
int n;
  cin>>n;
  int P[24];
  for (int i=1; i<n+1; i++) cin>>p[i];
  int counter=0;
  for (int i=2; i<n; i++) {
    if (p[i-1]<p[i]<p[i+1] || p[i+1]<p[i]<p[i-1]) counter++;
  }
  cout<<counter<<endl;}
                               

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

nclude <iostream>

using namespace std;

int main()
{
	int n, c = 0;
	cin >> n;
	int* p = new int[n];
	for (int i = 0; i < n; i++)
	{
		cin >> p[i];
	}
	for (int 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 << endl;
}


Compiler output:
a.cc:1:1: error: 'nclude' does not name a type
    1 | nclude <iostream>
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin >> n;
      |         ^~~
a.cc:21:9: error: 'cout' was not declared in this scope
   21 |         cout << c << endl;
      |         ^~~~
a.cc:21:22: error: 'endl' was not declared in this scope
   21 |         cout << c << endl;
      |                      ^~~~
Language: C++

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

using ll=long long;
const ll MOD=1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int cnt=0;
  for(int i=1;i<n-1;i++){
    if((a[i]-a[i-1])*(a[i]-a[i+1])<0)){
    cnt++;
    }
  }
  cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:38: error: expected primary-expression before ')' token
   16 |     if((a[i]-a[i-1])*(a[i]-a[i+1])<0)){
      |                                      ^
Language: C++

#include<iostream>
using namespace std;
int main(){
int n;
  cin>>n;
  int a[n],i;
  for(i=0;i<n;i++){
    a[i]=i+1;
  }
  for(i=2;i<n;i++){
    if((a[i-2]<a[i-1]&&a[i-1]<a[i])||(a[i-2]>a[i-1]&&a[i-1]>a[i])) ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:68: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |     if((a[i-2]<a[i-1]&&a[i-1]<a[i])||(a[i-2]>a[i-1]&&a[i-1]>a[i])) ans++;
      |                                                                    ^~~
      |                                                                    abs
a.cc:13:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |   cout<<ans<<endl;
      |         ^~~
      |         abs
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 = 0; i < N; 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;
  
 
}

Compiler output:
a.cc:18:1: error: 'cout' does not name a type
   18 | cout << ans << endl;
      | ^~~~
a.cc:21:1: error: expected declaration before '}' token
   21 | }
      | ^
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 = 0; i < N; 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;
  

}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:44: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 | if((p[i - 1] < p[i]) && (p[i] < p[i + 1])) ans++;
      |                                            ^~~
      |                                            abs
a.cc:14:49: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 | else if((p[i - 1] > p[i]) && (p[i] > p[i + 1])) ans++;
      |                                                 ^~~
      |                                                 abs
a.cc: At global scope:
a.cc:18:1: error: 'cout' does not name a type
   18 | cout << ans << endl;
      | ^~~~
a.cc:21:1: error: expected declaration before '}' token
   21 | }
      | ^
Language: Java


public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = in.nextInt();
        }
        int way = 0;
        for (int i = 0; i < n - 2; i++) {
            if ((arr[i] > arr[i + 1] && arr[i + 1] > arr[i + 2]) || (arr[i] < arr[i + 1] && arr[i + 1] < arr[i + 2])) {
                way++;
            }
        }
        System.out.println(way);
    }

}

Compiler output:
Main.java:5: error: cannot find symbol
        Scanner in = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
        Scanner in = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
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] > min(p[i-1],p[i+1]) && p[i] < max(p[i-1],p[i+1])){
            ans ++;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: no match for call to '(std::vector<int>) (int&)'
    9 |         cin >> p(i);
      |                ~^~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: expected unqualified-id before '=' token
    9 |   for(int =i;i<n;i++){
      |           ^
a.cc:9:10: error: expected ';' before '=' token
    9 |   for(int =i;i<n;i++){
      |          ^~
      |          ;
a.cc:9:11: error: expected primary-expression before '=' token
    9 |   for(int =i;i<n;i++){
      |           ^
a.cc:9:12: error: 'i' was not declared in this scope
    9 |   for(int =i;i<n;i++){
      |            ^
a.cc:9:17: error: expected ')' before ';' token
    9 |   for(int =i;i<n;i++){
      |      ~          ^
      |                 )
a.cc:9:18: error: 'i' was not declared in this scope
    9 |   for(int =i;i<n;i++){
      |                  ^
a.cc:14:44: error: 'a' was not declared in this scope
   14 |     else if(p.at(i+1)>p.at(i) && p.at(i) > a.at(i-1)){ans++;}
      |                                            ^
Language: C++

#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a;
  cin>>a;
  e=0;
  int b[a];
  rep(i,a)cin>>b[i];
  rep(i,a-2){
    int c,d;
    c=min(b[i],min(b[i+1],b[i+2]));
    d=max(b[i],max(b[i+1],b[i+2]));
    if(b[i+1]!=c&&b[i+1]!=d)e++;
  }
  cout<<e;
}


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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a
  for(int i=0;i<n;i++){
    cin>>a.at(i);
  }
  int count=0;
  for(int i=0;i<n-2;i++){
    if((a[1]-a[0])*(a[1]-a[2])<0)
      count++;
  }
  cout<<count<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected initializer before 'for'
    7 |   for(int i=0;i<n;i++){
      |   ^~~
a.cc:7:15: error: 'i' was not declared in this scope
    7 |   for(int i=0;i<n;i++){
      |               ^
a.cc:12:9: error: 'a' was not declared in this scope
   12 |     if((a[1]-a[0])*(a[1]-a[2])<0)
      |         ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll n;
    cin >> n;
    ll p[n];
    for(i=0;i<n;i++){
        cin >> p[i];
    }
    ll ans =0;
    for(i=1;i<n-1;i++){
        if(p[i-1]<p[i]&&p[i]<p[i+1])ans++;
        if(p[i-1]>p[i]&&p[i]>p[i+1])ans++;
    }
    cout << ans;
    return 0;
}

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

#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
   int n;
  scanf("%d",&n);
  int p[n],i;
  for(i=0;i<n;++i)
      scanf("%d",&a[i]);
  
  int cnt=0;
  for(i=1;i<n-1;++i)
  {
    if(a[i]>a[i-1] && a[i]<a[i+1])
        cnt++;
    
    else if(a[i]>a[i+1] && a[i]<a[i-1])
        cnt++;
  }
  
  printf("%d",cnt);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: 'a' was not declared in this scope
   11 |       scanf("%d",&a[i]);
      |                   ^
a.cc:16:8: error: 'a' was not declared in this scope
   16 |     if(a[i]>a[i-1] && a[i]<a[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);
    }

    int count = 0;
    for (i = 0; i < n - 2; i++){
        if (data.at(i) > data.at(i + 1) && data.at(i + 1) >= data.at(i + 2)){
            count++;
        }
        else if (data.at(i + 2) > data.at(i + 1) && data.at(i + 1) >= data.at(i)){
            count++;
        }
    }

    cout << count << endl;
}


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

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

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

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

    int count = 0;
    for (i = 0; i < n - 3; i++){
        if (data.at(i) > data.at(i + 1) && data.at(i + 1) >= data.at(i + 2)){
            count++;
        }
        else if (data.at(i + 2) > data.at(i + 1) && data.at(i + 1) >= data.at(i)){
            count++;
        }
    }

    cout << count << endl;
}


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

 #include<bits/stdc++.h>

using namespace std;

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

  for(int i = 1; i < n - 1; i++){
   if(p[i - 1] < p[i + 1]){
     if(p[i] > p[i - 1] && p[i] < p[i + 1]) count++;
   }
   if(p[i - 1] > p[i + 1]){
     if(p[i] < p[i - 1] && p[i] > p[i + 1]) count++;
   }
  }

  cout
  return 0;
}






Compiler output:
a.cc: In function 'int main()':
a.cc:21:7: error: expected ';' before 'return'
   21 |   cout
      |       ^
      |       ;
   22 |   return 0;
      |   ~~~~~~
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n){
    cin >> a.at(i);
  }
  int count = 0;
  rep(i, n-2){
    int A = a.a(i+1) - a.at(i);
    int B = a.at(i+2) - a.at(i+1);
    if(A*B>0){
      count++;
    }
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: 'class std::vector<int>' has no member named 'a'; did you mean 'at'?
   15 |     int A = a.a(i+1) - a.at(i);
      |               ^
      |               at