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

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

using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: expected primary-expression before ')' token
   15 |     for(){
      |         ^
a.cc:24:1: error: expected primary-expression before '}' token
   24 | }
      | ^
a.cc:23:28: error: expected ')' before '}' token
   23 |     cout << result << endl;
      |                            ^
      |                            )
   24 | }
      | ~                           
a.cc:15:8: note: to match this '('
   15 |     for(){
      |        ^
a.cc:24:1: error: expected primary-expression before '}' token
   24 | }
      | ^
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:6: 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>
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

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

  int count;
  for(int i=0; i<N-2; i++)
    {
      if(p[i]<p[i+1] && p[i+1]<p[i+2])
	count++;
      if(p[i+2]<p[i+1] && p[i+1]<p[i])
	count++;
      
    }

  cout << count << endl;


  return 0;
}


//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find
//vector.count



Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: 'N' was not declared in this scope
   16 |   for(int i=0; i<N; i++)
      |                  ^
a.cc:20:18: error: 'N' was not declared in this scope
   20 |   for(int i=0; i<N-2; i++)
      |                  ^
Language: Java

import java.util.*;

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

        int n = sc.nextInt();
        int[] p = new int[n];
        int ans = 0;

        for(int i=0; i<n; i++){
            p[i] = sc.nextInt();
        }
        for(int i=0; i<n-2; i++){
            if(p[i]<p[i+1] && p[i+1]<p[i+2]){
                ans += 1;
            }
            else if(p[i]>p[i+1] && p[i+1]>p[i+2]){
                ans += 1;
            }
        }
        System.out.println(ans);
    }
}

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

#include<iostream>
using namespace std;

int main()
{int n, count=0;
 cin>>n;
 int a[n];
 
 for(int i=0; i<n; i++)
 {cin>>a[i];}
 
 for(int i=1; i<(n-1); i++)
 { if(a[i]>a[i-1]&&a[i]<a[i+1])
   counter++;
  
  else if(a[i]<a[i-1]&&a[i]>a[i+1])
    counter++;
  
  else
    continue;}
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:14:4: error: 'counter' was not declared in this scope; did you mean 'count'?
   14 |    counter++;
      |    ^~~~~~~
      |    count
a.cc:17:5: error: 'counter' was not declared in this scope; did you mean 'count'?
   17 |     counter++;
      |     ^~~~~~~
      |     count
Language: C++

#include <iostream>

using namespace std;

int main(void) {
    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]) > 0) {
            ++ans;
        }
    }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: 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 | 
a.cc:8:12: error: expected primary-expression before 'int'
    8 |     vector<int> p(n);
      |            ^~~
a.cc:10:16: error: 'p' was not declared in this scope
   10 |         cin >> p[i];
      |                ^
a.cc:15:13: error: 'p' was not declared in this scope
   15 |         if((p[i]-p[i-1]) * (p[i+1]-p[i]) > 0) {
      |             ^
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;
        std::cin >> n;
        std::vector<int> p(n);
        rep(i, n) std::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++;

        }
        std::cout << ans << "\n";
        return 0;
        
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:18:56: error: expected ';' before 'ans'
   18 |             else((p[i - 1] > p[i]) && (p[i] <  p[i+1])) ans++;
      |                                                        ^~~~
      |                                                        ;
Language: C++

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

int main() {
  int N; cin >> N;
  int p[N];
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }
  int ans = 0;
  for (int i = 0; i < N-2; i++) {
    if ((a[i] < a[i+1] && a[i+1] < a[i+2]) || (a[i] > a[i+1] && a[i+1] > a[i+2])) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

//我是菜鸡
#include<bits/stdc++.h>
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _defor(i,a,b) for((i) = (a);(i)<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto p:st)
#define debug(q,x) cout<<q<<x<<endl
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7;
const double ext = 1e-6;
void deprint() {
	//ofstream cout("E:\\acm dream\\debug.txt");
	return;
}
int main() {
	//ifstream cin("E:\\acm dream\\in.txt");5
	//ofstream cout("E:\\acm dream\\out.txt");
	//srand((unsigned)time(nullptr));
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int a[100], n, so[3];
	while (cin >> n) {
		set<int>p;
		memset(a, 0, sizeof(a));
		_for(i, 0, n)cin >> a[i];
		_for(i, 0, n - 2) {
			so[0] = a[i], so[1] = a[i + 1], so[2] = a[i + 2];
			sort(so, so + 3);
			if (so[0] == so[1] && so[1] == so[2])continue;
			else if (so[0] != so[1] && so[0] != so[2] && s[1] != s[2]) p.insert(so[1]);
			else p.insert(so[2]);
		}
		cout << p.size() << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:70: error: 's' was not declared in this scope
   32 |                         else if (so[0] != so[1] && so[0] != so[2] && s[1] != s[2]) p.insert(so[1]);
      |                                                                      ^
Language: C++

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

 int main() {
   int ;
   int p[30];
   cin >> N ;
   int res = 0;
   for (int i = 0; i < N; i++) {
     cin >> p[i];
     if ((p[i-2] < p[i-1] && p[i-1] < p[i]) || (p[i-2] > p[i-1] && p[i-1] > p[i])) {
       res++;
     }
   }
   cout << res << '\n';
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:5:4: error: declaration does not declare anything [-fpermissive]
    5 |    int ;
      |    ^~~
a.cc:7:11: error: 'N' was not declared in this scope
    7 |    cin >> N ;
      |           ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:93: error: expected ')' before '{' token
   12 |     if((a.at(i+1)<a.at(i+2)&&a.at(i)<(a.at(i+1))||(a.at(i+1)<a.at(i)&&a.at(i+2)<(a.at(i+1))){
      |        ~                                                                                    ^
      |                                                                                             )
a.cc:14:6: error: expected ')' before 'cout'
   14 |     }
      |      ^
      |      )
   15 |   cout << ans << endl;
      |   ~~~~
a.cc:12:7: note: to match this '('
   12 |     if((a.at(i+1)<a.at(i+2)&&a.at(i)<(a.at(i+1))||(a.at(i+1)<a.at(i)&&a.at(i+2)<(a.at(i+1))){
      |       ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

n = int(input())
p = list(map(int,(input().split(' ')) ))
c = 0
for i in range(n-2):
    if (p[i] <= p[i+1] and p[i+1] < p[i+2]) or (p[i] > p[i+1] >= p[i+2]):
        c += 1
print(c)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
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 (max(p[i - 1],p[i + 1]) > p[i] && min(p[i - 1],p[i + 1]) < p[i]) ans++;
  }
  cout << ans;
}

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

#include <iostream>
#include <cmath>
#include <valarray>

using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'vector' was not declared in this scope
   10 |     vector<int> a(n);
      |     ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <valarray>
  +++ |+#include <vector>
    4 | 
a.cc:10:12: error: expected primary-expression before 'int'
   10 |     vector<int> a(n);
      |            ^~~
a.cc:12:14: error: 'a' was not declared in this scope
   12 |       cin >> a[i];
      |              ^
a.cc:16:11: 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>

#define ll long long
#define pi pair<int,int>
#define ppi pair<pi,pi>
#define mp make_pair
using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "



int p[2000020];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0) , cout.tie(0);

    int n; cin >> n;
    for(int i = 1;i <= n;i++)
        cin >> p[i];
        int cnt = 0;
    for(int i = 2;i <= n - 1;i++)
    {
        vector<int> m;
        m.push_back(p[i]);
        m.push_back(p[i + 1]);
        m.push_back(p[i - 1]);
        sort(m.begin(),m.end());
        if(m[1] == p[i])
            cnt++;
    }
    cout << cnt << '\n';
    return 0;
}


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

#include<iostream>
using namespace std;
bool second(int a,int b,int c)
{
if(a>b&& b>c)
  return true;
  else if(b>a && b<c)
    return true;
  else
    return false;
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:18:7: error: 'i' was not declared in this scope
   18 |   for(i=1;i<n;i++)
      |       ^
a.cc:20:15: error: 'a' was not declared in this scope
   20 |     if(second(a[i-1],a[i],a[i+1]))
      |               ^
Language: C++

#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;

}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    int N;
    cin >> N;
    vl a(N);
    rep(i, 0, N) {
        cin >> a[i];
    }

    ll ans;
    rep(i, 1, N-1) {
　　vl b;
           b.push_back(a[i-1]);
                b.push_back(a[i]);
        b.push_back(a[i+1]);

    sort(b.begin(), b.end());
if (a[i] == b[1]) ++and;
            }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc:57:1: error: extended character 　 is not valid in an identifier
   57 | 　　vl b;
      | ^
a.cc:57:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:57:1: error: '\U00003000\U00003000vl' was not declared in this scope
   57 | 　　vl b;
      | ^~~~~~
a.cc:58:12: error: 'b' was not declared in this scope
   58 |            b.push_back(a[i-1]);
      |            ^
a.cc:63:24: error: expected identifier before ';' token
   63 | if (a[i] == b[1]) ++and;
      |                        ^
Language: C++

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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n;
	cin >> n;
	VI p(n + 1);
	FOR(i, 1, n + 1) cin >> p[i];
	int ans = 0;
	
	FOR(i, 2, n)
	{

		if (p[i] < p[i + 1] && p[i] > p[i - 1]) ans++;
		if (p[i] < p[i - 1] && p[i] > p[i + 1]) ans++;
	}
	
	cout << ans << endl;
	
	return 0;
}



Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
a.cc:5:9: error: 'pair' does not name a type
    5 | typedef pair<int, int> PII;
      |         ^~~~
a.cc:6:9: error: 'vector' does not name a type
    6 | typedef vector<int> VI;
      |         ^~~~~~
a.cc:19:19: error: 'acos' was not declared in this scope
   19 | const double PI = acos(-1.0);
      |                   ^~~~
a.cc:22:1: error: 'mt19937' does not name a type
   22 | mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:26:9: error: 'ios_base' has not been declared
   26 |         ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
      |         ^~~~~~~~
a.cc:26:39: error: 'cin' was not declared in this scope
   26 |         ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
      |                                       ^~~
a.cc:26:51: error: 'cout' was not declared in this scope
   26 |         ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
      |                                                   ^~~~
a.cc:30:9: error: 'VI' was not declared in this scope; did you mean 'PI'?
   30 |         VI p(n + 1);
      |         ^~
      |         PI
a.cc:31:33: error: 'p' was not declared in this scope
   31 |         FOR(i, 1, n + 1) cin >> p[i];
      |                                 ^
a.cc:37:21: error: 'p' was not declared in this scope
   37 |                 if (p[i] < p[i + 1] && p[i] > p[i - 1]) ans++;
      |                     ^
a.cc:38:21: error: 'p' was not declared in this scope
   38 |                 if (p[i] < p[i - 1] && p[i] > p[i + 1]) ans++;
      |                     ^
a.cc:41:24: error: 'endl' was not declared in this scope
   41 |         cout << ans << endl;
      |                        ^~~~
Language: C++

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

#define vi vector<int>
#define vii vector<int, int>
#define ll long long
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
#else
#define trace(...) 42
#endif

const int MOD = 1000000007;

int main(){
    IOS;
    int n;
    cin >> n;
    int a[n];

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

    int count = 0;
    for (int i = 1; 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 << endl;

    #ifdef LOCAL
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif

    return 0;
}

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

#define vi vector<int>
#define vii vector<int, int>
#define ll long long
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
#else
#define trace(...) 42
#endif

const int MOD = 1000000007;

int main(){
    IOS;
    int n;
    cin >> n;
    int a[n];

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

    int count = 0;
    for (int i = 1; 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 << endl;

    #ifdef LOCAL
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif

    return 0;
}



Compiler output:
a.cc:80:11: error: redefinition of 'const int MOD'
   80 | const int MOD = 1000000007;
      |           ^~~
a.cc:27:11: note: 'const int MOD' previously defined here
   27 | const int MOD = 1000000007;
      |           ^~~
a.cc:82:5: error: redefinition of 'int main()'
   82 | int main(){
      |     ^~~~
a.cc:29:5: note: 'int main()' previously defined here
   29 | int main(){
      |     ^~~~
Language: C++

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

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

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:27: error: no match for call to '(std::vector<int>) (int&)'
    9 |                 cin >> vec(i);
      |                        ~~~^~~
a.cc:15:30: error: expected ';' before '}' token
   15 |                         ans++
      |                              ^
      |                              ;
   16 |                 }
      |                 ~
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;
 


Compiler output:
a.cc: In function 'int main()':
a.cc:7:1: 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:8: error: expected primary-expression before 'int'
    7 | vector<int> p(n);
      |        ^~~
a.cc:8:37: error: 'p' was not declared in this scope
    8 |   for(int i = 0; i < n; i++) cin >> p[i];
      |                                     ^
a.cc:11:5: error: 'p' was not declared in this scope
   11 | if((p[i - 1] < p[i]) && (p[i] < p[i + 1])) ans++;
      |     ^
a.cc:14:21: error: expected '}' at end of input
   14 | cout << ans << endl;
      |                     ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <iostream>
 using namespace std;

4int 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;
 

Compiler output:
a.cc:4:1: error: expected unqualified-id before numeric constant
    4 | 4int main() {
      | ^~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> X(N);
    for(int i=0;i<N;i++)
    cin >> X[N];
    int ans=0;
    for(int i=1;1<N-1;i++){
        if(X[i-1]<X[i]&&X[i]<X[i+1])
        ans++;
        else if(X[i-1]>X[i]&&X[i]>X[i+1])
        ans++;
    }
    cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     vector<int> X(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:6:12: error: expected primary-expression before 'int'
    6 |     vector<int> X(N);
      |            ^~~
a.cc:8:12: error: 'X' was not declared in this scope
    8 |     cin >> X[N];
      |            ^
a.cc:11:12: error: 'X' was not declared in this scope
   11 |         if(X[i-1]<X[i]&&X[i]<X[i+1])
      |            ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: expected primary-expression before '}' token
   14 |     }
      |     ^
Language: C++

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

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> k(N);
  for(int i=0;i<N;i++)cin>>k.at(i);
  int cnt=0;
  for(int j=1;j<N-1;j++){
    if(k.at(j-1)+k.at(j)+k.at(j+1)-max(k.at(j-1),max(k.at(j),k.at(j+1)))-min(k.at(j-1),min(k.at(j),k.at(j+1)))==k.at(j))cnt++
  }
  cout<<cnt<<endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:10:126: error: expected ';' before '}' token
   10 |     if(k.at(j-1)+k.at(j)+k.at(j+1)-max(k.at(j-1),max(k.at(j),k.at(j+1)))-min(k.at(j-1),min(k.at(j),k.at(j+1)))==k.at(j))cnt++
      |                                                                                                                              ^
      |                                                                                                                              ;
   11 |   }
      |   ~
Language: C++

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

int three_min(int a,int b,int c) {
  if (((a < b) && (b < c)) || (a > b) && (b > c)) {
    return 1;
  }
  else {
    return 0;
  }
}


int main() {
  int n;
  int P[20];
  for (int i = 0 ; i < n; i++) {
    cin >> P[i];
  }
  
  for (int i = 2; i < n; i++) {
    ans += three_min(P[i-2],P[i-1],P[i])
  }
  cout << ans << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |     ans += three_min(P[i-2],P[i-1],P[i])
      |     ^~~
      |     abs
a.cc:24:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long

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

  ll N,ans = 0; cin >> N;
  vector<ll> vec(N);
  for (ll i = 0; i < N; ++i) cin >> vec[i];
  
  for (ll i = 0; i < N-2; ++i) {
    int a = vec[i];
    int b = vec[i+1];
    int c = vec[i+2];
    if (max(a,b,c)!=b && min(a,b,c)!=b) ans++;
  }
  cout << ans << endl;
  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:2:
/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:18:12:   required from here
   18 |     if (max(a,b,c)!=b && min(a,b,c)!=b) ans++;
      |         ~~~^~~~~~~
/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:18:29:   required from here
   18 |     if (max(a,b,c)!=b && min(a,b,c)!=b) ans++;
      |                          ~~~^~~~~~~
/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++

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long

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

  ll N,ans = 0; cin >> N;
  vector<ll> vec(N);
  for (ll i = 0; i < N; ++i) cin >> vec[i];
  
  for (ll i = 0; i < N-2; ++i) {
    ll a = vec[i];
    ll b = vec[i+1];
    ll c = vec[i+2];
    if (max(a,b,c)!=b && min(a,b,c)!=b) ans++;
  }
  cout << ans << endl;
  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:2:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:18:12:   required from here
   18 |     if (max(a,b,c)!=b && min(a,b,c)!=b) ans++;
      |         ~~~^~~~~~~
/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 = long long int; _Compare = long long int]':
a.cc:18:29:   required from here
   18 |     if (max(a,b,c)!=b && min(a,b,c)!=b) ans++;
      |                          ~~~^~~~~~~
/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<iostream>
using namespace std;
int main(){
  int n,sum=0;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(i=2;i<n;i++){
    if(a[i]>a[i-1] and a[i-1]>a[i-2])
      sum++;
  }
  cout<<sum;
  return 0;
}

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

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
#define rep(i,n) for(int i=1;i<n-1;i++)
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector<int> s(n);
  int ans = 0;
  rep(i,n){
    cin >> s[i];
  }
  rep(i,n){#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
#define rep(i,n) for(int i=1;i<n-1;i++)
typedef long long ll;

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

    if((s[i]<s[i+1])&&(s[i-1]<s[i]))ans++;
    else if((s[i]>s[i+1])&&(s[i-1]>s[i]))ans++;
  }
  cout << ans << endl;
}


Compiler output:
a.cc:18:12: error: stray '#' in program
   18 |   rep(i,n){#include <bits/stdc++.h>
      |            ^
a.cc: In function 'int main()':
a.cc:18:13: error: 'include' was not declared in this scope
   18 |   rep(i,n){#include <bits/stdc++.h>
      |             ^~~~~~~
a.cc:18:22: error: 'bits' was not declared in this scope
   18 |   rep(i,n){#include <bits/stdc++.h>
      |                      ^~~~
a.cc:18:27: error: 'stdc' was not declared in this scope; did you mean 'std'?
   18 |   rep(i,n){#include <bits/stdc++.h>
      |                           ^~~~
      |                           std
a.cc:23:1: error: expected primary-expression before 'using'
   23 | using namespace std;
      | ^~~~~
a.cc:27:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   27 | int main(){
      |         ^~
a.cc:27:9: note: remove parentheses to default-initialize a variable
   27 | int main(){
      |         ^~
      |         --
a.cc:27:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:27:11: error: a function-definition is not allowed here before '{' token
   27 | int main(){
      |           ^
Language: C++

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


void solve(long long N, long long D, std::vector<std::vector<long long>> X){
    int a=0;
    rep(i,N-1){
        if(p[i-1]<p[i] and p[i]<p[i+1]){
            a++;
        }
    }
    cout<<a<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long D;
    scanf("%lld",&D);
    std::vector<std::vector<long long>> X(N, std::vector<long long>(D));
    for(int i = 0 ; i < N ; i++){
        for(int j = 0 ; j < D ; j++){
            scanf("%lld",&X[i][j]);
        }
    }
    solve(N, D, std::move(X));
    return 0;
}


Compiler output:
a.cc: In function 'void solve(long long int, long long int, std::vector<std::vector<long long int> >)':
a.cc:10:12: error: 'p' was not declared in this scope
   10 |         if(p[i-1]<p[i] and p[i]<p[i+1]){
      |            ^
Language: C++

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

int main() {
    int N;
    cin >> N;
    vector<int> V(N);
    int ans=0;
    for (int i=0 ; i<N ; i++)
        cin >> V.at(i);
    for (int i=1 ; i<N-1 ; i++)
        vector<int> Z={
        {V.at(i-1),V.at(i),V.at(i+1)}
    	};
        sort(Z.begin(),Z.end());
        if(Z.at(1)==V.at(i))
        ans++;
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: 'Z' was not declared in this scope
   15 |         sort(Z.begin(),Z.end());
      |              ^
a.cc:16:26: error: 'i' was not declared in this scope
   16 |         if(Z.at(1)==V.at(i))
      |                          ^
Language: C++

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

int main() {
    int N;
    cin >> N;
    vector<int> V(N);
    int ans=0;
    for (int i=0 ; i<N ; i++)
        cin >> V.at(i);
    for (int i=1 ; i<N-1 ; i++)
        vector<int> Z={
        {V.at(i-1),V.at(i),V,at(i+1)}
    	};
        sort(Z.begin(),Z.end());
        if(Z.at(1)==V.at(i))
        ans++;
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:30: error: 'at' was not declared in this scope
   13 |         {V.at(i-1),V.at(i),V,at(i+1)}
      |                              ^~
a.cc:14:9: error: could not convert '{{V.std::vector<int>::at(((std::vector<int>::size_type)(i - 1))), V.std::vector<int>::at(((std::vector<int>::size_type)i)), V, <expression error>}}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   14 |         };
      |         ^
      |         |
      |         <brace-enclosed initializer list>
a.cc:15:14: error: 'Z' was not declared in this scope
   15 |         sort(Z.begin(),Z.end());
      |              ^
a.cc:16:26: error: 'i' was not declared in this scope
   16 |         if(Z.at(1)==V.at(i))
      |                          ^
Language: C++

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

int main() {
    int N;
    cin >> N;
    vector<int> V(N);
    int ans=0;
    for (int i=0 ; i<N ; i++)
        cin >> V.at(i);
    for (int i=1 ; i<N-1 ; i++)
        vector<int> Z(3);
        Z={V.at(i-1),V.at(i),V,at(i+1)};
        sort(Z.begin(),Z.end());
        if(Z.at(1)==V.at(i))
        ans++;
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'Z' was not declared in this scope
   13 |         Z={V.at(i-1),V.at(i),V,at(i+1)};
      |         ^
a.cc:13:17: error: 'i' was not declared in this scope
   13 |         Z={V.at(i-1),V.at(i),V,at(i+1)};
      |                 ^
a.cc:13:32: error: 'at' was not declared in this scope
   13 |         Z={V.at(i-1),V.at(i),V,at(i+1)};
      |                                ^~
Language: C++

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

int main() {
    int N;
    cin >> N;
    vector<int> V(N);
    int ans=0;
    for (int i=0 ; i<N ; i++)
        cin >> V.at(i);
    for (int i=1 ; i<N-1 ; i++)
        Vector<int> Z(3);
        Z={V.at(i-1),V.at(i),V,at(i+1)};
        sort(Z.begin(),Z.end());
        if(Z.at(1)==V.at(i))
        ans++;
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'Vector' was not declared in this scope
   12 |         Vector<int> Z(3);
      |         ^~~~~~
a.cc:12:16: error: expected primary-expression before 'int'
   12 |         Vector<int> Z(3);
      |                ^~~
a.cc:13:9: error: 'Z' was not declared in this scope
   13 |         Z={V.at(i-1),V.at(i),V,at(i+1)};
      |         ^
a.cc:13:17: error: 'i' was not declared in this scope
   13 |         Z={V.at(i-1),V.at(i),V,at(i+1)};
      |                 ^
a.cc:13:32: error: 'at' was not declared in this scope
   13 |         Z={V.at(i-1),V.at(i),V,at(i+1)};
      |                                ^~
Language: C++

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

}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: expected ';' before ')' token
   10 |   for (int i=1;i<n-1){
      |                     ^
      |                     ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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 main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i,n) cin>>p[i];
  int cnt=0;
  for(int i=1;i<n-1;i++;){
    if(p[i-1]<p[i] && p[i]<p[i+1])cnt++;
  }
  cout<<cnt<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:24:24: error: expected ')' before ';' token
   24 |   for(int i=1;i<n-1;i++;){
      |      ~                 ^
      |                        )
a.cc:24:25: error: expected primary-expression before ')' token
   24 |   for(int i=1;i<n-1;i++;){
      |                         ^
Language: C++

//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

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



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

int main(){
  int n;
  bool up=false;
  int ans=0;
  int p[20];
  cin>>n;
  for(int i=0;i<n;i++)cin>>p[i];
  if(p[0]<p[1])up=true;
  for(int i=2;i<n;i++){
    if(p[i-1]<p[i]){
      up?ans++:up=true;
    }else{
      up?up=false:ans++;
    }
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin>>n;
      |   ^~~
a.cc:16:3: error: 'cout' was not declared in this scope
   16 |   cout<<ans;
      |   ^~~~
Language: C++

// Compiled with: g++ -Wall -std=c++14 -pthread

#include <bits/stdc++.h>

using namespace std;
const int N = 20+5;

int n;
int a[N];
int main(){
    cin >> 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]) || (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:17:77: error: expected ']' before ')' token
   17 |         if ((a[i]>a[i-1] && a[i] < a[i+1]) || (a[i] < a[i-1] && a[i] > a[i+1)) {
      |                                                                             ^
      |                                                                             ]
Language: C

#include <stdio.h>
int main(void)
{
  int n, p[20], i, count=0;
  
  scanf("%d", &n);
  for(i=0; i<n; i++)
    scanf("%d", &p[i]);
  
  for(i=1; i<n-1; i++){
    if(a[i-1]<a[i]&&a[i]<a[i+1])
      count++;
    else 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:11:8: error: 'a' undeclared (first use in this function)
   11 |     if(a[i-1]<a[i]&&a[i]<a[i+1])
      |        ^
main.c:11:8: 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,p[20];
  int a,b,c;
  
  cin>>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]){
      cnt++;
    }else if(p[i-1]<p[i]&&p[i]>p[i+1]){
      cnt++;
    }
  }
  cout<<cnt<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: 'cnt' was not declared in this scope; did you mean 'int'?
   11 |       cnt++;
      |       ^~~
      |       int
a.cc:13:7: error: 'cnt' was not declared in this scope; did you mean 'int'?
   13 |       cnt++;
      |       ^~~
      |       int
a.cc:16:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 |   cout<<cnt<<endl;
      |         ^~~
      |         int
Language: C++

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

int main(){
  int n;
  cin >> n;
  int cnt=0;
  vector<int> v(n);
  for (int i=0; i < n ; i++){
    cin >> v.at(i);
  }
  for (int j=1; j < n-1; j++){
    int pre=v.at(i-1);
    int now=v.at(i);
    int next=v.at(i+1);
    if ((pre < now && now < next) ||(next < now && now < pre)) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:18: error: 'i' was not declared in this scope
   14 |     int pre=v.at(i-1);
      |                  ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    cin >> n;
    vector<ll> p(n);
    for(i=0;i<n;i++){
        cin >> p[i];
    }
    ll cnt = 0;
    for(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]}){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:42: error: expected ')' before '&&' token
   18 |         if(p[i]!=min({p[i-1],p[i],p[i+1]} && p[i]!=max({p[i-1],p[i],p[i+1]}){
      |                     ~                    ^~~
      |                                          )
a.cc:20:10: error: expected ')' before '}' token
   20 |         }
      |          ^
      |          )
   21 |     }
      |     ~     
a.cc:18:11: note: to match this '('
   18 |         if(p[i]!=min({p[i-1],p[i],p[i+1]} && p[i]!=max({p[i-1],p[i],p[i+1]}){
      |           ^
a.cc:21:5: error: expected primary-expression before '}' token
   21 |     }
      |     ^
Language: C++

n=input()
l=[map(int,input().strip().split())]
ans=0
for i in range(1,len(l)-2):
  gc=0;
  lc=0;
  if(l[i] >l[i-1] or l[i]>l[i+1]):
    gc=1
  if(l[i] <l[i-1] or l[i]<l[i+1]):
    lc=1
   ans+=gc & lc

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n=input()
      | ^
a.cc:6:3: error: 'lc' does not name a type
    6 |   lc=0;
      |   ^~
a.cc:7:3: error: expected unqualified-id before 'if'
    7 |   if(l[i] >l[i-1] or l[i]>l[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 count=0;
  for(int i=0;i<n;i++){
    if(p[i]<p[i+1] && p[i+1]<p[i+2]) count++;
    else if(p[i+2]<p[i+1] && p[i+1]<p[i]) count++;
    
    cout << count << endl;
    return 0;
  }

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

#include<cstdio>
int aa[30];
int main()
{
	int n;
	while(~scanf("%d",&n))
	{
		int i;
		for(i=0;i<n;i++)
		{
			scanf("%d",&aa[i]);
		}
		int num=0;
		for(i=1;i<=n-2;i++)
		{
			if(aa[i]>aa[i-1]&&aa[i]<aa[i+1]||aa[i]<aa[i-1]&&aa[i]>aa[i+1])
			num++;
		}
		printf("%d\n",num);
		
	}
	return 0;
}

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

#include<cstdio>
int aa[30];
main()
{
	int n;
	while(~scanf("%d",&n))
	{
		int i;
		for(i=0;i<n;i++)
		{
			scanf("%d",&aa[i]);
		}
		int num=0;
		for(i=1;i<=n-2;i++)
		{
			if(aa[i]>aa[i-1]&&aa[i]<aa[i+1]||aa[i]<aa[i-1]&&aa[i]>aa[i+1])
			num++;
		}
		printf("%d\n",num);
		
		
		
	}
}

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

#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

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

    int n; cin >> n;
    std::vector<int> p(n);
    rep(i,n) cin >> p[i];

    int cnt = 0;

    for(int i =1; i<n-1; ++i){
        if(p[i]!= max(a[i-1], max(p[i],a[i+1])) && p[i]!= min(a[i-1], min(p[i],a[i+1]))) cnt++;
    }
    
    cout << cnt << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:23: error: 'a' was not declared in this scope
   40 |         if(p[i]!= max(a[i-1], max(p[i],a[i+1])) && p[i]!= min(a[i-1], min(p[i],a[i+1]))) cnt++;
      |                       ^