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

#include<stdio.h>
#include<stdlib.h>


int main(void){

int sort=0;
int min,max;
int Min,Max;
int min_bef=-1;
int Def;
int x;
int k_n;
int *k_p;
int n;
int i,j,k;
int *p;
int *p_s

(void)scanf("%d %d",&n,&k_n);
p = malloc((sizeof(*p)*n);
p_s = p;
	for(i=0;i<n;i++,p++){
	(void)scanf("%d",p);
	}
k_p = p_s;

	for(i=0;i<n-k_n+1;i++){
		for(j=0;j<k_n-1;j++){
		min = k_p[0];
		max = k_p[k_n-1];
			if(k_p[i]<k_p[i+1]){
			Min=k_p[i];
			Max=k_p[i+1];
			sort++;
			}else{

			Min=k_p[i+1];
			Max=k_p[i];
			}
		if(min>Min)	
		min=-1;

		if(max<Max)
		max=-1;
		}

		if(sort+1 == k_n){
		x++;
			if(Def==0){
			Def=-1;	
			}else {
			x--;
			}
		}else if((min_bef!=-1) && (Max != -1)){
		x--;
		}
	min_bef=min;
	}
printf("%d",x);

return 0;

}

Compiler output:
main.c: In function 'p_s':
main.c:20:7: error: expected declaration specifiers before 'scanf'
   20 | (void)scanf("%d %d",&n,&k_n);
      |       ^~~~~
main.c:21:1: error: expected declaration specifiers before 'p'
   21 | p = malloc((sizeof(*p)*n);
      | ^
main.c:22:1: error: expected declaration specifiers before 'p_s'
   22 | p_s = p;
      | ^~~
main.c:23:9: error: expected declaration specifiers before 'for'
   23 |         for(i=0;i<n;i++,p++){
      |         ^~~
main.c:23:17: error: expected declaration specifiers before 'i'
   23 |         for(i=0;i<n;i++,p++){
      |                 ^
main.c:23:21: error: expected declaration specifiers before 'i'
   23 |         for(i=0;i<n;i++,p++){
      |                     ^
main.c:26:1: error: expected declaration specifiers before 'k_p'
   26 | k_p = p_s;
      | ^~~
main.c:28:9: error: expected declaration specifiers before 'for'
   28 |         for(i=0;i<n-k_n+1;i++){
      |         ^~~
main.c:28:17: error: expected declaration specifiers before 'i'
   28 |         for(i=0;i<n-k_n+1;i++){
      |                 ^
main.c:28:27: error: expected declaration specifiers before 'i'
   28 |         for(i=0;i<n-k_n+1;i++){
      |                           ^
main.c:60:1: error: expected declaration specifiers before 'printf'
   60 | printf("%d",x);
      | ^~~~~~
main.c:62:1: error: expected declaration specifiers before 'return'
   62 | return 0;
      | ^~~~~~
main.c:64:1: error: expected declaration specifiers before '}' token
   64 | }
      | ^
main.c:65: error: expected '{' at end of input
main.c: In function 'main':
main.c:64:1: error: expected declaration or statement at end of input
   64 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,k;
const int N = 2e5+5;
bool in[N];int a[N];
int sz=0;
set<int> st;

int main()
{
	cin >> n >> k;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=k;i++){
		st.insert(a[i]);
		if(i<k)sz+=a[i]<a[i+1];
	}
	bool t=0;
	int ans = 0;
	if(sz!=k-1)ans++;
	else t=1;
	for(int i=2,j=k+1;j<=n;i++,j++){
		sz -= a[i-1]<a[i];sz += a[j-1]<a[j];
		int s = 0;
		if(*st.begin()==a[i-1])s++;
		st.erase(a[i-1]),st.insert(a[j]);
		if(a[j]==*st.rbegin())s++;
		if(s<2 && sz != k-1){
			ans ++ ;
		}
		if(sz==k-1) t=1;''
		// cout << i << ":" << j << ":" << ans << endl;
	}
	if(t)ans++;
	cout << ans << endl;
}

Compiler output:
a.cc:32:33: error: empty character constant
   32 |                 if(sz==k-1) t=1;''
      |                                 ^~
a.cc: In function 'int main()':
a.cc:32:35: error: expected ';' before '}' token
   32 |                 if(sz==k-1) t=1;''
      |                                   ^
      |                                   ;
   33 |                 // cout << i << ":" << j << ":" << ans << endl;
   34 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define mp make_pair
const int mx=2e6+5;
#define int long long
int a[mx],c[mx],tmx[mx*5],t[mx*5];
void build(int n,int l,int r){
	if(l==r){
		t[n]=a[l];
		tmx[n]=a[l];
		return;
	}
	else if(l>r)return;
	int mid=(l+r)/2;
	build(n*2,l,mid);
	build(n*2+1,mid+1,r);
	t[n]=min(t[n*2],t[n*2+1]);
	tmx[n]=max(tmx[n*2],tmx[n*2+1]);
}
int rmq(int v,int l,int r,int ll,int rr){	
	if(rr<l or ll>r)return 1e18;
	if(ll<=l and rr>=r)return t[v];
	int mid=(l+r)/2;
	int bir=rmq(v*2,l,mid,ll,rr);
	int iki=rmq(v*2+1,mid+1,r,ll,rr);
	return min(bir,iki);
}
int rmx(int v,int l,int r,int ll,int rr){	
	if(rr<l or ll>r)return 0;
	if(ll<=l and rr>=r)return tmx[v];
	int mid=(l+r)/2;
	int bir=rmx(v*2,l,mid,ll,rr);
	int iki=rmx(v*2+1,mid+1,r,ll,rr);
	return max(bir,iki);
}
signed main(){
	/*freopen(".gir", "r", stdin);
	freopen(".cik", "w", stdout); 
    */ios_base::sync_with_stdio(false);cin.tie(NULL);
	int n,k;cin >> n >> k;
	for(int i=1;i<=n;++i){
		cin >> a[i];
	}
	build(1,1,n);
	int say=1,cik=0,ans=1;
	for(int i=1;i<k;++i){
		if(a[i]<a[i+1]){c[i]=1;++say;}
	}
	if(say==k)++cik;
	for(int i=k;i<=n;++i){
		if(i!=n){
			if(a[i]<a[i+1]){c[i]=1;++say;}
			say-=c[i-k+1];
			if(say==k)++cik;
		}
		if(i!=k){
			if(a[i]!=rmx(1,1,n,i-k,i))++ans;
			else if(a[i-k]!=rmq(1,1,n,i-k,i))++ans;
		}
	}
	//cout << cik << endl;
	/*if(cik>1){
		if(ans-(cik-1)<1)cout << 1 <<endl;
		else cout << ans-(cik-1) << endl;
	}*/
	 cout << ans << endl;
	//cout << ans << endl;
	//cout << ans-(cik-1) << endl;
}
/*
6 3
1 3 2 4 5 6

Compiler output:
a.cc:76:1: error: unterminated comment
   76 | /*
      | ^
Language: C++

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

// 解説を読んで
// Pの文字列を線形探索していく
// まったくソートできてない場合は「n - k + 1」となり
// 昇順にソートしている場合は上記数値をカウントダウンする。

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

    vector<int> P(n);
    set<int> S;
    int count;
    int last;
    int answer = n - k + 1;
    bool sorted = false;

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

        if (P[i] > last) {
            count++;
        } else {
            count = 1;
        }
        last = P[i];

        if (i >= k) {
            S.erase(p[i - k]);
        }

        if (count >= k) {
            sorted = true;
            answer--;
        } else if (i >= k
        && P[i - k] < *S.begin() 
        && P[i] > *S.rbegin()) {
            answer--;
        }
        S.insert(P[i]);
    }
    if (sorted) answer++;
    cout << answer << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:21: error: 'p' was not declared in this scope
   32 |             S.erase(p[i - k]);
      |                     ^
Language: C++

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

#define REP(i, n) for (int i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

int main() { 
    int N,k;
    cin >> N >> k;
    vector <int> p(N);

    //各区間の最大値がほしい i == 0のときの最大
    // i == p のときの最大 -> p - (k-1) ~ p の 区間
    REP(i,N)
    {
        cin >> p[i];
    }
    //i とi+1の差 < ならtrue
    int equi[N] = {};

    REP(i,N-1)
    {
        if(p[i] < p[i+1])equi[i] = 1;
    }

    //REP(i,N-1)
    //{
    //    cout << equi[i] << endl;
    //}

    ll sa = 0;

    REP(i,k-1)
    {
        sa += equi[i];
    }

    ll cnt = 0;
    if(sa < k-1)++cnt;

    for(int i = k; i < N-1; ++i)
    {
        sa -= equi[i-k];
        sa += equi[i];

        if(sa < k-1)++cnt;
    }
        
    cout << max(1,cnt) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:16: error: no matching function for call to 'max(int, ll&)'
   55 |     cout << max(1,cnt) << endl;
      |             ~~~^~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:55:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   55 |     cout << max(1,cnt) << endl;
      |             ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:55:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   55 |     cout << max(1,cnt) << endl;
      |             ~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<20,INF=1<<30;

int bit[MAX+1],M;

//1-indexed

int sum(int i){
    int s=0;
    while(i>0){
        s+=bit[i];
        i-=i&-i;
    }
    return s;
}

//sからtの和=sum(t)-sum(s-1)

void add(int i,int x){
    while(i<=M){
        bit[i]+=x;
        i+=i&-i;
    }
}

int main(){
    
    int N,K;cin>>N>>K;
    M=N*2;
    vector<pair<int,int>> P(N);
    vector<int> A(M,0),B(M,0),C(M,0),done(M,0);
    for(int i=0;i<N;i++){
        cin>>P[i].first;
        P[i].second=i;
    }
    
    for(int i=0;i<N;i++){
        if(P[i]>P[i+1]) C[i]=1;
        else C[i]=0;
    }
    C[N]=0;
    
    sort(all(P));
    
    for(int i=0;i<N;i++){
        int a=P[i].first,b=P[i].second;
        int s=sum(b+K)-sum(b);
        if(s>0) A[b]=1;
        add(b+1,1);
    }
    
    for(int i=0;i<=MAX;i++){
        bit[i]=0;
    }
    
    reverse(all(P));
    
    
    
    for(int i=0;i<N;i++){
        int a=P[i].first,b=P[i].second;
        //cout<<a<<" "<<b<<endl;
        int s=sum(b+N+1)-sum(b+N-(K-1));
        if(s>0) B[b]=1;
        add(b+N+1,1);
    }
    
    int sum=1;
    
    init(N-K+1);
    
    for(int i=0;i<N-K;i++){
        if(A[i]||B[i+(K)]){
            sum++;
        }
        //cout<<sum<<endl;
    }
    
    vector<int> S(N+1);
    
    for(int i=0;i<N;i++){
        S[i+1]=S[i]+C[i];
        //cout<<S[i+1]<<endl;
    }
    
    int cnt=0;
    
    for(int i=0;i<=N-K;i++){
        if(S[i+K-1]-S[i]==0) cnt++;
    }
    
    //cout<<sum<<" "<<cnt<<endl;
    
    if(cnt>=2) sum-=(cnt-1);
    
    if(sum==0) sum++;
    cout<<sum<<endl;
    
}



Compiler output:
a.cc: In function 'int main()':
a.cc:73:5: error: 'init' was not declared in this scope; did you mean 'int'?
   73 |     init(N-K+1);
      |     ^~~~
      |     int
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long INF = 100000000; // 十分大きい値
 
int main () {
  
  long long N, K;
  cin >> N >> K;
  
  vector<long long> P(N);
  
  for (long long i = 0; i < N; i++) {
    cin >> P[i];
  }
  
  set<long long> S;
  
  for (long long i = 0; i < K; i++) {
    S.insert(P[i]);
  }
  
  long long ans = 1;
  
  for (long long i = 0; i < N - K; i++) {
    
    if (*begin(S) == P[i] && *rbegin(S) < P[i + K]) ans += 0;
    else ans++;
    
    S.erase(P[i]);
    S.insert(P[i + K]);
    
  }
  
  // はじめと同じ形になる場合の個数
  
  reverse(P.begin(), P.end());
  int flag = 0;
  long long memo = -1000000;
  
  
  stack<pair<int,int> > st;
    st.push({INF, 0}); // 番兵
    for (long long i = 0; i < N; ++i) {
        // 条件を満たすまで pop し続ける
        while (P[i] > st.top().first) st.pop();
 
        // 答えを出力
        if (i -  st.top().second + 1 >= K && i - memo > K) {
          if (flag = 0) {
            flag = 1;
          }
          else ans--;
          memo = i;
        }
          
 
        // 新たに push
        st.push({P[i], i+1});
    }
  
  cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:61:23: error: expected '}' at end of input
   61 |   cout << ans << endl;
      |                       ^
a.cc:5:13: note: to match this '{'
    5 | int main () {
      |             ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> Pa;
typedef pair<int, pair<int, int> > PP;
const int MAX=2e5+10;

template <typename T>
struct SegmentTree{
  using F = function<T(T,T)>;
  int n;
  F f;
  T ti;
  vector<T> dat;
  SegmentTree(){};
  SegmentTree(F f,T ti):f(f),ti(ti){}
  void init(int n_){    
    n=1;
    while(n<n_) n<<=1;
    dat.assign(n<<1,ti);
  }
  void build(const vector<T> &v){
    int n_=v.size();
    init(n_);
    for(int i=0;i<n_;i++) dat[n+i]=v[i];
    for(int i=n-1;i;i--)
      dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
  }
  void set_val(int k,T x){
    dat[k+=n]=x;
    while(k>>=1)
      dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);    
  }
  T query(int a,int b){
    T vl=ti,vr=ti;
    for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
      if(l&1) vl=f(vl,dat[l++]);
      if(r&1) vr=f(dat[--r],vr);
    }
    return f(vl,vr);
  }
  template<typename C>
  int find(int a,int b,C &check,int k,int l,int r){
    if(!check(dat[k])||r<=a||b<=l) return -1;
    if(k>=n) return k-n;
    int m=(l+r)>>1;
    int vl=find(a,b,check,(k<<1)|0,l,m);
    if(~vl) return vl;
    return find(a,b,check,(k<<1)|1,m,r);
  }
  template<typename C>
  int find(int a,int b,C &check){
    return find(a,b,check,1,0,n);
  }
};

int N,K;
vi P;
void input(){
	cin>>N>>K;
	rep(i,N){
		int x;
		cin>>x;
		P.pb(x);
	}
}

bool sam[MAX];
void solve(){
	int ac=0;
	rep(i,K-1)if(P[i]<P[i+1])ac++;
	if(ac==K-1)sam[0]=true;
	rep1(i,N-K){
		if(P[i-1]<P[i])ac--;
		if(P[K+i-2]<P[K+i-1])ac++;
		if(ac==K-1)sam[i]=true;
	}
	//rep(i,N-K+1)cout<<sam[i]<<" ";
  

	auto f=[](int a,int b){
		return min(a,b);
	};
	auto g=[](int a,int b){
		return max(a,b);
	};
	int ti=100000007;
	int ui=0;

	SegmentTree<int> segmin(f,ti);
	SegmentTree<int> segmax(g,ui);
	segmin.build(P);
	segmax.build(P);
	int ans=N-K+1;
  	bool allsam=false;
	rep(i,N-K){
      	//cout<<segmin.query(i,i+K)<<" ";
		int xmin=segmin.query(i,i+K);
		int xmax=segmax.query(i+1,i+K+1);
      	//cout<<xmin<<" "<<xmax<<endl;

		if(sam[i]){ans--;allsam=true;}
		else if(xmin==P[i] && xmax==P[i+K])ans--;
	}
  	if(sam[N-K]){ans--;allsam=true;}
  	if(allsam)ans++;
	cout<<ans<<endl;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
	long int i, j;
	long int n, k;
	long int count = 0;
	long int max, min;
	long int index_max, index_min;
	long int work;
	long int p[200000] = {0};
	
	scanf("%ld%ld", &n, &k);
	
	max = 0;
	min = n;
	
	for(i = 0; i < n; i++) {
		scanf("%ld", &p[i]);
	}
	
	for(i = 0; i < k; i++) {
		if(p[i] > max) {
			max = p[i];
			index_max = i;
		}
		if(p[i] < min) {
			min = p[i];
			index_min = i;
		}
	}
	
	count = 1;
	
	work = p[0];
	
	for(i = 1; i < k; i++) {
		if(work > p[i]) {
			//count = 0;
			break;
		}
		work = p[i];
	}
	
	
	for(i = k; i < n; i++) {
		if( (index_min == i - k) && (max < p[i]) ) {
			;
		} else {
			count++;
		}
		min = 200000;
		for(j = 0; j < k; j++) {
			if(min > p[i - k + 1 +j]) {
				min = p[i - k + 1 +j];
				index = i - k + 1 +j;
			}
		}
	}
	
	
	
	printf("%ld\n", count);
	
	return 0;
}

// 02/14/3
// 04/23/1 02431 02341 04123

Compiler output:
main.c: In function 'main':
main.c:61:39: error: lvalue required as left operand of assignment
   61 |                                 index = i - k + 1 +j;
      |                                       ^
Language: C++

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

static int ps[200001];
int main(){
    int n, k;
    int p0,p1;
    p1 = -1;
    cin >> n >> k;
    cin >> p1;
    for(int i=0;i<n-1;i++){
        cin >> p0;
       	if(p1 > p0){
            ps[i] = 1;
        }else{
        	ps[i] = 0;
        }
        p1 = p0;
    }
    int left_pre = 0;
    int right;
    int ans=1; 
    int s = 0;
    int o_counts=0;
    for(int i=0;i<k-2;i++){
    	if(ps[i]==0){
        	o_counts++;
        }
    }
    for(int i=0;i<n-k+1;i++){
      	right = ps[i+k-2];
        o_counts+=1-right;
        if((left_pre==1 || right==1) && o_counts>0){
           ans++;
        }
        if(o_counts == 0 && s == 0){
          s=1;
        }
        if(left_pre==1){
        	left_pre = ps[i];
        }else{
        	left_pre = ps[i]
			o_counts--;
        }
    }
    cout << ans + s;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:33: error: expected ';' before 'o_counts'
   43 |                 left_pre = ps[i]
      |                                 ^
      |                                 ;
   44 |                         o_counts--;
      |                         ~~~~~~~~
Language: C++

#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>

typedef long long ll;
using std::vector;
using std::string;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

//////////////////////////////////////



//////////////////////////////////////

int main() {
    //std::ifstream in("0_normal_2");
    //std::cin.rdbuf(in.rdbuf());
    
    int N, K;
    std::cin >> N >> K;
    vector<int> v(N);
    vector<bool> flip(N);
    bool f1 = false;
    int before = -1;
    for (int i = 0; i < N; i++) {
        int p;
        std::cin >> p;
        v[i] = p;
        if (before > p) flip[i] = true;
        before = p;
    }
    int mae = v[0];
    int ato = v[K-1];
    int flipcnt = 0;
    for (int i = 1; i <= K-1; i++) {
        if (flip[i]) flipcnt += 1;
    }
    
    int ans = N - K + 1;
    bool f3 = false;
    for (int i = 0; i <= N - K; i++) {
        //std::cout << flipcnt << " ";
        //不変な場合がダブればマイナス1
        bool f2 = false;
        if (flipcnt == 0) {
            //std::cout << "unchi" << std::endl;
            if (f1) ans -= 1;
            f1 = true;
            f2 = true;
        }
        
        //同じ並べ替えをする場合、不変な場合を除く
        if (mae < v[i+1] && ato < v[i+K]) {
            //std::cout << "chin" << std::endl;
            if (f3 && !f2) ans -= 1;
            f3 = true
        } else {
            f3 = false;
        }
        if (flip[i+1]) flipcnt -= 1;
        if (flip[i+K]) flipcnt += 1;
        mae = v[i+1];
        ato = v[i+K];
    }
    std::cout << ans << std::endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:22: error: expected ';' before '}' token
   68 |             f3 = true
      |                      ^
      |                      ;
   69 |         } else {
      |         ~
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define REPS(i,s,n) for(ll (i)=(s);(i)<(n);++(i))
#define REP(i,n) reps(i,0,n)
#define REPTR(i,n) for(ll (i)=(n);(i)>=0;--(i))
#define ALL(x) (x).begin(),(x).end()
#define MAX 1005
#define KEY 10007
using namespace std;


int main() {
	int n,k;
	cin >> n >> k;
	vector<ll> p(n);
	for(int i=0;i<n;i++) {
		cin >> p[i];
	}
	vector<pair<bool,bool> > b(n);
	if(p[0] > p[1]) {
		b[0] = {0, 1};
	}else {
		b[0] = {0, 0};
	}
	for(int i=1;i<n-1;i++) {
		bool left = false, right = false;
		if(p[i-1] >  p[i]) left = true;
		if(p[i] >  p[i+1]) right = true;
		b[i] = {left, right};
	}	
	if(p[n-2] > p[n-1]) {
		b[n-1] = {1, 0};
	}else {
		b[n-1] = {0, 0};
	}
	int ans = 0;
	int left = 1, right = k-2;
	int cnt = 0;
	for(int i=left;i<=right;i++) {
		if(b[i].first) cnt++;
		if(b[i].second) cnt++;
	}
	for(int i=0;i<n-k+1;i++) {
		if(cnt>=1) {
			if(b[left].second == 0 and b[right].first == 0)
			else ans++;
		}
		if(b[left].first==1) cnt--;
		if(b[left].second==1) cnt--;
		left++;
		right++;
		if(b[right].first==1) cnt++;
		if(b[right].second==1) cnt++;
	}

	cout << 1 + ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:25: error: expected primary-expression before 'else'
   47 |                         else ans++;
      |                         ^~~~
Language: C

#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
	long int i, j;
	long int n, k;
	long int count = 0;
	long int max, min;
	long int index_max, index_min;
	long int work;
	long int p[200000] = {0};
	
	scanf("%ld%ld", &n, &k);
	
	max = 0;
	min = n;
	
	for(i = 0; i < n; i++) {
		scanf("%ld", &p[i]);
	}
	
	for(i = 0; i < k; i++) {
		if(p[i] > max) {
			max = p[i];
			index_max = i;
		}
		if(p[i] < min) {
			min = p[i];
			index_min = i;
		}
	}
	
	count = 1;
	
	work = p[0];
	
	for(i = 1; i < k; i++) {
		if(work > p[i]) {
			//count = 0;
			break;
		}
		work = p[i];
	}
	
	
	for(i = k; i < n; i++) {
		if( (index_min == i - k) && (max < p[i]) ) {
			min = 200000;
			for(j = 0; j < k; j++) {
				if(min > p[i - k + 1 +j]) {
					min = p[i - k + 1 +j];
				}
		} else {
			count++;
		}
	}
	
	
	
	printf("%ld\n", count);
	
	return 0;
}

// 02/14/3
// 04/23/1 02431 02341 04123

Compiler output:
main.c: In function 'main':
main.c:58:19: error: expected '}' before 'else'
   58 |                 } else {
      |                   ^~~~
Language: C

#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
	long int i, j;
	long int n, k;
	long int count = 0;
	long int max, min;
	long int index_max, index_min;
	long int work;
	long int p[200000] = {0};
	
	scanf("%ld%ld", &n, &k);
	
	max = 0;
	min = n;
	
	for(i = 0; i < n; i++) {
		scanf("%ld", &p[i]);
	}
	
	for(i = 0; i < k; i++) {
		if(p[i] > max) {
			max = p[i];
			index_max = i;
		}
		if(p[i] < min) {
			min = p[i];
			index_min = i;
		}
	}
	
	count = 1;
	
	work = p[0];
	
	for(i = 1; i < k; i++) {
		if(work > p[i]) {
			//count = 0;
			break;
		}
		work = p[i];
	}
	
	
	for(i = k; i < n; i++) {
		if( (index_min == i - k) && (max < p[i]) ) {
			min = 200000;
			for(j = 0; j < k; j++) {
				if(min > p[i - k + 1 +j]) {
					min = pi - k + 1 +j];
				}
		} else {
			count++;
		}
	}
	
	
	
	printf("%ld\n", count);
	
	return 0;
}

// 02/14/3
// 04/23/1 02431 02341 04123

Compiler output:
main.c: In function 'main':
main.c:56:47: error: 'pi' undeclared (first use in this function); did you mean 'p'?
   56 |                                         min = pi - k + 1 +j];
      |                                               ^~
      |                                               p
main.c:56:47: note: each undeclared identifier is reported only once for each function it appears in
main.c:56:60: error: expected ';' before ']' token
   56 |                                         min = pi - k + 1 +j];
      |                                                            ^
      |                                                            ;
main.c:56:60: error: expected statement before ']' token
main.c:58:19: error: expected '}' before 'else'
   58 |                 } else {
      |                   ^~~~
Language: C++

#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N];
int32_t main(){_

   cin>>n;

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

   
   int ans = n - k;  
   
   set<int> s;
   for (int i = 0; i < k; ++i)
   {
      s.insert(a[i]);
   }

   for (int i = k; i < n; ++i)
   {
      s.erase(a[i-k]);
      if(a[i] > *s.begin())
         --ans;
      s.insert(a[i]);
   }

   cout<<ans;

   return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:33:18: error: 'k' was not declared in this scope
   33 |    int ans = n - k;
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin >> N >> K;
  vector<int> P;
  for (int i = 0; i < N; i++){
    int p;
    cin >> p;
    P.push_back(p);
  }
  int count = N-K+1;
  for (int i = 0; i < N-K; i++){
    int prev = P.at(i);
    int next = P.at(i+K);
    //Find min and max
    int min = N+1;
    int max = -1;
    for (int j = i+1; j < i+K; j++){
      min = min(min,P.at(j));
      max = max(max,P.at(j));
      if (prev >= min || max >= next){
        break;
      }
    }
    if (prev < min && max < next){
      count--;
    }
  }
  int scount = 0;
  int CC = 1;
  for (int i = 0; i < N-1; i++){
    if (P.at(i) < P.at(i+1)){
      CC++;
      if (CC==K){
        scount++;
      }
    } else {
      CC = 1;
    }
  }
  if (scount>=1){
    count=count-scount+1;
  }
  cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:16: error: 'min' cannot be used as a function
   20 |       min = min(min,P.at(j));
      |             ~~~^~~~~~~~~~~~~
a.cc:21:16: error: 'max' cannot be used as a function
   21 |       max = max(max,P.at(j));
      |             ~~~^~~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
	int n,k;
	int p[200001];
	cin >> n >> k;
	for(int i=1; i<=n; i++){
		cin >> p[i];
	}
	int ans = 0;
	int streat = 0;
	int a = 0;
	int b = 0;
	for(int i=k; i<=n; i++){
		if(a == 0){
			ans += 1;
			a = 1;
			for(int j = i-k+2; j<=i; j++){
				if(p[i-k+1] > p[j] || (p[i+1] < p[j] && 0 <= p[i+1] < 200001)){
					a = 0;
					break;
				}
			}
			if(a == 0){
				b = 0;
				for(int j = i-k+1; j!=i; j++){
					if(p[j] > p[j+1]){
						b = 1;
						break;
					}
				}
				if(b == 0){
					streat += 1;
				}
            }
		}
		}else{
			a = 1;
			for(int j = i-k+2; j<=i; j++){
				if(p[i-k+1] > p[j] || (p[i+1] < p[j] && 0 <= p[i+1] < 200001)){
					a = 0;
					break;
				}
			}
			if(a == 0){
				b = 0;
				for(int j = i-k+1; j!=i; j++){
					if(p[j] > p[j+1]){
						b = 1;
						break;
					}
				}
				if(b == 0){
					streat += 1;
				}
            }
		}
	}
	if(streat == 0){
		cout << ans << '\n';
		return 0;
	}
	cout << ans - streat + 1 << '\n';
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:18: error: 'else' without a previous 'if'
   38 |                 }else{
      |                  ^~~~
a.cc:40:37: error: 'i' was not declared in this scope
   40 |                         for(int j = i-k+2; j<=i; j++){
      |                                     ^
a.cc:48:45: error: 'i' was not declared in this scope
   48 |                                 for(int j = i-k+1; j!=i; j++){
      |                                             ^
a.cc: At global scope:
a.cc:60:9: error: expected unqualified-id before 'if'
   60 |         if(streat == 0){
      |         ^~
a.cc:64:9: error: 'cout' does not name a type
   64 |         cout << ans - streat + 1 << '\n';
      |         ^~~~
a.cc:65:9: error: expected unqualified-id before 'return'
   65 |         return 0;
      |         ^~~~~~
a.cc:66:1: error: expected declaration before '}' token
   66 | }
      | ^
Language: C++

#include <stdio.h>
#include <iostream>
#include<array>
#include<vector>
#include <algorithm>
using namespace std;


int maini(){
    int N,K;
    cin>>N,K;


    array<int,200000> p;
    vector<int> temp1;
    vector<int> temp2;

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

    int count = 1;
    for(int i = 0;i < N + 1;i++){
        temp1.push_back(p[i]);
        temp2.push_back(p[i]);
    }

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

    for(int i = 1;i < N - K + 1;i++){
        temp1 = temp2;
        
        temp2.clear();
        for(int j = 0; j < K + 1;j++){
            temp2.push_back(p[j]);
        }
        sort(temp2.begin() + i,temp2.begin() + i + K - 1);
        for(int k = i - 1;k <K + i ;k++){
            if(temp1[k]!= temp2[k]){
                count += 1;
                break;
            } 
        }
    }
    cout<<count<<endl;
 
}

Compiler output:
a.cc: In function 'int maini()':
a.cc:47:1: warning: no return statement in function returning non-void [-Wreturn-type]
   47 | }
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include"pch.h"
#include <stdio.h>
#include <iostream>
#include<array>
#include<vector>
#include <algorithm>

using namespace std;


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


	std::array<int, 20000> p;
	std::vector<int> temp1;
	std::vector<int> temp2;

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

	int count = 1;
	for (int i = 0; i < K + 1; i++) {
		temp1.push_back(p[i]);
		temp2.push_back(p[i]);
	}

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

	for (int i = 1; i < N - K + 1; i++) {
		temp1 = temp2;

		temp2.clear();
		for (int j = i - 1; j < K + i; j++) {
			temp2.push_back(p[j]);
		}
		sort(temp2.begin() + 1, temp2.end());
		for (int k = 1; k < K + 1; k++) {
			if (temp1[k] != temp2[k - 1]) {
				count += 1;
				break;
			}
		}
	}
	cout << count << endl;

}

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

#include <iostream>
#include <vector>

using namespace std;

void copy(vector<int> &dst, vector<int> &src, int from, int size)
{
    for (int i = 0; i < size; ++i)
    {
        dst[i] = src[i + from];
    }
}

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

    vector<int> P(N);
    for (int &n : P) cin >> n;

    vector<int> partial(K);
    copy(partial, P, 0, K);
    sort(partial.begin(), partial.end());
    vector<int> partialPre = partial;

    int count = 1;
    for (int i = 0; i < N - K; ++i)
    {
        copy(partial, P, i, K);
        sort(partial.begin(), partial.end());

        if (
            (partial[0] != P[i] && partialPre[1] != partial[0]) || partial[K - 1] != P[i + K - 1]
        )
        {
            ++count;
        }

        partialPre = partial;
    }

    cout << count << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   24 |     sort(partial.begin(), partial.end());
      |     ^~~~
      |     short
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, K;
  cin >> N >> K;
  vector<int> P(N);
  vector<int> Q(N);
  int ans=0;
  
  rep(i,N){
    cin >> P[i];
    Q[i] = P[i];
    R[i] = P[i];
  }
  
  rep(i,N-K){
    sort(P.begin()+i , P.begin()+i+K+1);
    if(Q != P){
      ans++;
      rep(j,K){
        Q[i+j] = P[i+j];
      }
      sort(P.begin()+i , P.begin()+i+K+1);
    }
    else{
       sort(P.begin()+i , P.begin()+i+K+1);
    }
  }
  cout << ans << endl;
}
        
        


Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'R' was not declared in this scope
   16 |     R[i] = P[i];
      |     ^
Language: C++

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

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

	int* p = new int[n];
	int* buff1 = new int[n];
	int* buff2 = new int[n];

	for (int i = 0; i < n; i++)
	{
		cin >> p[i];
	//	cout << p[i] << endl;
	}

	int cnt = 0;

	memcpy(buff1, p, sizeof(int) * n);
	memcpy(buff2, p, sizeof(int) * n);

	priority_queue<int> queue;
	for (int i = 0; i < n - k + 1; i++)
	{
		memcpy(buff1, p, sizeof(int) * n);
		for (int j = 0; j < k; j++)
		{
			queue.push(p[i+j]);
		}
		for (int j = k-1; j >= 0; j--)
		{
			buff1[i+j] = queue.top();
			queue.pop();
		}
		
		//check
		for (int j = 0; j < k; j++)
		{
			if (buff1[i + j] != buff2[i + j])
			{
				cnt++;
				memcpy(buff2, buff1, sizeof(int) * n);
				break;
			}
		}
	}
	
	cout << cnt << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'memcpy' was not declared in this scope
   24 |         memcpy(buff1, p, sizeof(int) * n);
      |         ^~~~~~
a.cc:5:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <iostream>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> P(N);
    for (int &n : P) cin >> n;

    vector<int> partial(K);
    memcpy(&partial[0], &P[0], sizeof(int) * K);
    sort(partial.begin(), partial.end());
    vector<int> partialPre = partial;

    int count = 1;
    for (int i = 0; i < N - K; ++i)
    {
        memcpy(&partial[0], &P[i], sizeof(int) * K);
        sort(partial.begin(), partial.end());

        if (
            (partial[0] != P[i] && partialPre[1] != partial[0]) || partial[K - 1] != P[i + K - 1]
        )
        {
            ++count;
        }

        partialPre = partial;
    }

    cout << count << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'memcpy' was not declared in this scope
   15 |     memcpy(&partial[0], &P[0], sizeof(int) * K);
      |     ^~~~~~
a.cc:3:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 | 
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |     sort(partial.begin(), partial.end());
      |     ^~~~
      |     short
Language: C++

#include <stdio.h>
#include <iostream>
#include<array>
#include<vector>
#include <algorithm>
using namespace std;


int maini(){
    int N,K;
    cin>>N,K;


    array<int,20000> p;
    vector<int> temp1;
    vector<int> temp2;

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

    int count = 1;
    for(int i = 0;i < K + 1;i++){
        temp1.push_back(p[i]);
        temp2.push_back(p[i]);
    }

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

    for(int i = 1;i < N - K + 1;i++){
        temp1 = temp2;
        
        temp2.clear();
        for(int j = i - 1; j<K + i;j++){
            temp2.push_back(p[j]);
        }
        sort(temp2.begin() + 1,temp2.end());
        for(int k = 1;k <K + 1 ;k++){
            if(temp1[k]!=temp2[k -1]){
                count +=1;
                break;
            } 
        }
    }
    cout<<count<<endl;
 
}

Compiler output:
a.cc: In function 'int maini()':
a.cc:47:1: warning: no return statement in function returning non-void [-Wreturn-type]
   47 | }
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cstring>
#include <tuple>
#include <vector>
#include <set>
#include <map>
#include <iterator>
#include <cmath>

using namespace std;
using lint = long long int;


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

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

	set<pair<int, int>> s;

	for (int i=0; i<=n-k; i++) {
		// コピー
		int* copyP = new int[n];
		memcpy_s(copyP, sizeof(int)*n, p, sizeof(int) * n);
		
		// そーと
		sort(copyP + i, copyP + i + k);

		// 値が変更された最小インデックスを探す
		int min = -1;
		for (int j = 0; j < n; j++) {
			if (copyP[j] != p[j]) {
				min = j;
				break;
			}
		}

		int max = -1;
		if (min != -1) {
			for (int j = n - 1; j >= 0; j--) {
				if (copyP[j] != p[j]) {
					max = j;
					break;
				}
			}
		}

		s.insert(make_pair(min, max));
	}

	cout << s.size();

	delete[] p;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: 'memcpy_s' was not declared in this scope; did you mean 'memcpy'?
   31 |                 memcpy_s(copyP, sizeof(int)*n, p, sizeof(int) * n);
      |                 ^~~~~~~~
      |                 memcpy
Language: C++

// #include <bits/stdc++.h>
#include <iostream>
#include <set>

using namespace std;

int main(){
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	set<int> s;
	for(int i=0;i<k;i++){
		s.insert(i);
	}
	int res=1,flag=1;
	int b[n],c=1;
	memset(b,0,sizeof(b));
	for(int i=1;i<n;i++){
		if(a[i]>a[i-1]) c++;
		else c=1;
		if(c>=k) b[i-k+1]=1;
	}
	if(b[0]) flag=0;
	for(int i=0;i<n-k;i++){
		if(a[i]!=*(s.begin()) || a[i+k]<*(s.rbegin())){
			if(b[i+1]){
				if(flag){
					res++;
					flag=0;
				}
			}
			else res++;
		}
		s.erase(a[i]);
		s.insert(a[i+k]);
	}
	cout<<res<<"\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'memset' was not declared in this scope
   20 |         memset(b,0,sizeof(b));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <set>
  +++ |+#include <cstring>
    4 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int MAXBITSIZE=2e5+1;
struct BIT
{
	long long it[MAXBITSIZE];
	void con(long long &x,long long &y)
	{
		x+=y;
	}
	void update(long long x,long long u)
	{
		while(x<MAXBITSIZE)
		{
			con(it[x],u);
			x+=x&(-x);
		}
	}
	long long query(long long x)
	{
		long long ans=0;
		while(x)
		{
			con(ans,it[x]);
			x-=x&(-x);
		}
		return ans;
	}
}T;
int main()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
     long long n,k,i,a;
     cin>>n>>k;
	 deque<long long>d;
	 long long inv=0;
	 for(i=0;i<k;i++)
	 {
		 cin>>a;
		 a++;
		 T.update(a,1);
		 inv+=d.size()-T.query(a-1);
		 d.push_back(a);
	 }
	 long long ans=0,x,ans2=0;
	 long long l=0;
	 for(;i<n;i++)
	 {
		 cin>>a;
		 a++;
		 x=T.query(d.front()-1);
		 inv-=x;
		 l=0;
		 if(x!=0)l=1;
		 T.update(d.front(),-1);
		 d.pop_front();
		 x=d.size()-T.query(a-1);
		 inv+=x;
		 if(x!=0)l=1;
		 T.update(a,1);
		 d.push_back(a);
		 if(inv==0)ans++;
		 else if(l==0)ans2++;
	 }
	 cout<<n-k+1-max(0,ans-1)-ans2<<'\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:66:25: error: no matching function for call to 'max(int, long long int)'
   66 |          cout<<n-k+1-max(0,ans-1)-ans2<<'\n';
      |                      ~~~^~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:66:25: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   66 |          cout<<n-k+1-max(0,ans-1)-ans2<<'\n';
      |                      ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:66:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   66 |          cout<<n-k+1-max(0,ans-1)-ans2<<'\n';
      |                      ~~~^~~~~~~~~
Language: C

#include <cstdio>
#include <set>

int n, k;
int P[200000];


int main(){
  int i, r;
  std::set<int> s;
  scanf("%d%d", &n, &k);
  for(i=0;i<n;i++) scanf("%d", P+i);
  int sort = 0;
  for(i=0;i<k;i++){
    s.insert(P[i]);
    sort += (i!=0&&P[i] > P[i-1]);
  }
  r = 1;
  int m = sort == k-1;
  for(i=k;i<n;i++){
    if(P[i-k] == *s.begin() && P[i] > *s.rbegin()) ;
    else r++;
    sort = sort - (P[i-k+1] > P[i-k]) + (P[i] > P[i-1]);
    m += (sort == k-1);

    s.erase(P[i-k]);
    s.insert(P[i]);
  }
  printf("%d\n", r - (m?m-1:0));

  return 0;
}


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

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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, K;
  cin >> N >> K;

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

  vector<int> cum(N, 0);
  for ( int i = 1; i < N; i++ ) {
    if ( P[i] < P[i-1] ) cum[i] = 1;
    cum[i] += cum[i-1];    
  }

  int ans = 0;
  for ( int i = 1; i < N; i++ ) {
    if ( i+K-1 >= N ) break;    
    if ( cum[i+K-1] - cum[i-1] > 0 ) ans++;    
  }

  cout << max(1, ans) << endl;  
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:14: error: no matching function for call to 'max(int, long long int&)'
   31 |   cout << max(1, ans) << endl;
      |           ~~~^~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:31:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   31 |   cout << max(1, ans) << endl;
      |           ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:31:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   31 |   cout << max(1, ans) << endl;
      |           ~~~^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 998244353;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

ll power(ll x, ll y) {
	if (y==0) return 1;
	else if (y==1) return x%MOD;
	else if (y%2==0) { ll pow=power(x,y/2); return (pow*pow)%MOD; } 
	else { ll pow=power(x,y/2); return ((pow*pow)%MOD)*x%MOD; }
}
ll divid(ll x, ll y) {
	return ((x%MOD)*power(y,MOD-2))%MOD;
}

const int mx=1000000;

int main(){
	int n; scanf("%d",&n);
	VI v(mx+1,0);
	int a;
	REP(i,n){
		scanf("%d",&a[i]);
		v[a]++;
	}
	VI w(mx+1); w[1]=1;
	for(int i=2;i<=mx;i++){
		ll sum=0;
		for(int j=1;j<=sqrt(i);j++){
			if(i%j==0){
				if(j==sqrt(i)||j==1)
					sum+=w[j];
				else{
					sum+=w[j];
					sum%=MOD;
					sum+=w[i/j];
				}
				sum%=MOD;
			}	
		}
		w[i]=(divid(1,i)-sum+MOD)%MOD;
	}
	ll ans=0;
	for(int i=1;i<=mx;i++){
		ll sum=0;
		for(int j=i;j<=mx;j+=i){
			sum+=(j*v[j])%MOD;
			sum%=MOD;
		}
		ll p=0;
		for(int j=i;j<=mx;j+=i){
			p+=(v[j]*(j*(sum-j+MOD)%MOD))%MOD;
			p%=MOD;
		}
		ans+=p*w[i];
		ans%=MOD;
	}
	ans=divid(ans,2);
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:30: error: invalid types 'int[int]' for array subscript
   29 |                 scanf("%d",&a[i]);
      |                              ^
Language: C++


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<map>
#include<unordered_map>
#include<io.h>
#ifdef LOCAL
#include<ctime>
#include<random>
#include"file.h"
#endif

#define y1 zyy_orz
#define hash sto_zyy

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL>pLL;
typedef pair<int, int>pii;
const double eps = 1e-5;
const double Pi = 3.1415926535897932;
const int dir[4][2] = { -1,0,0,-1,1,0,0,1 };
//const int dir[8][2] = { -2,-1,-2,1,2,-1,2,1,-1,2,-1,-2,1,2,1,-2 };



const int maxn = 1e6 + 5;
const int MOD = 998244353;
int n;
int A[maxn];
LL C[maxn];
LL f[maxn];

LL inv[maxn];

int prime[maxn], miu[maxn];
bool is_prime[maxn];
int pn = 0;


int main() {
#ifdef LOCAL
	fileopen();
#endif
	scanf("%d", &n);
	int mx = -1;
	for (int i = 1; i <= n; i++)scanf("%d", &A[i]), mx = max(mx, A[i]), C[A[i]]++;
	memset(is_prime, true, sizeof(is_prime));
	miu[1] = 1;
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= mx; i++) {
		if (is_prime[i]) {
			prime[++pn] = i;
			miu[i] = -1;
		}
		for (int j = 1; j <= pn && i*prime[j] <= mx; j++) {
			is_prime[i*prime[j]] = false;

			if (i%prime[j] == 0) {
				miu[i*prime[j]] = 0;
				break;
			}
			else {
				miu[i*prime[j]] = -miu[i];
			}
		}
	}

	inv[1] = 1;
	for (int i = 2; i <= maxn - 3; i++) {
		inv[i] = (MOD - MOD / i * inv[MOD%i] % MOD) % MOD;
	}
	for (int i = 1; i <= mx; i++) {
		for (int j = i; j <= mx; j += i) {
			f[i] = (f[i] + C[j] * j) % MOD;
		}
	}

	LL ans = 0;
	for (int d = 1; d <= mx; d++) {
		for (int q = 1; q <= mx / d; q++)if (miu[q]) {
			LL t = (f[q*d] * f[q*d]) % MOD;
			ans = (ans + miu[q] * inv[d] % MOD*t%MOD) % MOD;
		}
	}
	for (int i = 1; i <= n; i++) {
		ans = (ans - A[i]) % MOD;
	}
	ans = ans * inv[2] % MOD;
	ans = (ans + MOD) % MOD;
	printf("%lld\n", ans);
#ifdef LOCAL
	fileclose();
#endif
	return 0;
}


Compiler output:
a.cc:15:9: fatal error: io.h: No such file or directory
   15 | #include<io.h>
      |         ^~~~~~
compilation terminated.