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

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

struct Lazseg{
  static const int MAX=1<<18;
  int n;
  int dat[2*MAX-1],laz[2*MAX-1];
  Lazseg(){}
  Lazseg(int n_){
    init(n_);
  }
  void init(int n_){
    n=1;
    while(n<n_)n*=2;
    for(int i=0;i<2*n-1;i++)
      dat[i]=laz[i]=0;
  }
  inline void eval(int len,int k){
    if(k*2-1<n*2-1){
      laz[k*2+1]+=laz[k];
      laz[k*2+2]+=laz[k];
    }
    dat[k]+=laz[k]*len;
    laz[k]=0;
  }
  void update(int a,int b,int x,int k,int l,int r){
    /*
    if(r<=a||b<=l)return;
    if(a<=l&&r<=b){
      laz[k]+=x;
      return;
    }
    update(a,b,x,k*2+1,l,(l+r)/2);
    update(a,b,x,k*2+2,(l+r)/2,r);
    return;
    */
    
      eval(r-l,k);
      if(r<=a||b<=l) return dat[k]+laz[k]*(r-l);
      if(a<=l&&r<=b) return dat[k]+(laz[k]+=x)*(r-l);
      eval(r-l,k);
      return dat[k]=update(a,b,x,k*2+1,l,(l+r)/2)+update(a,b,x,k*2+2,(l+r)/2,r);
    
  }
  int query(int a,int b,int k,int l,int r){
    eval(r-l,k);
    if(r<=a||b<=l) return 0;
    if(a<=l&&r<=b) return dat[k];
    int vl=query(a,b,k*2+1,l,(l+r)/2);
    int vr=query(a,b,k*2+2,(l+r)/2,r);
    return vl+vr;
  }
};

signed main(){
  int n,q;
  cin>>n>>q;
  Lazseg ls(n);
  for(int i=0;i<q;i++){
    int c,s,t,x;
    cin>>c;
    if(c){
      cin>>s>>t;
      cout<<ls.query(s-1,t,0,0,ls.n)<<endl;
    }else{
      cin>>s>>t>>x;
      ls.update(s-1,t,x,0,0,ls.n);
    }
  }
  return 0;
}



Compiler output:
a.cc: In member function 'void Lazseg::update(long long int, long long int, long long int, long long int, long long int, long long int)':
a.cc:40:35: error: return-statement with a value, in function returning 'void' [-fpermissive]
   40 |       if(r<=a||b<=l) return dat[k]+laz[k]*(r-l);
      |                             ~~~~~~^~~~~~~~~~~~~
a.cc:41:35: error: return-statement with a value, in function returning 'void' [-fpermissive]
   41 |       if(a<=l&&r<=b) return dat[k]+(laz[k]+=x)*(r-l);
      |                             ~~~~~~^~~~~~~~~~~~~~~~~~
a.cc:43:50: error: invalid operands of types 'void' and 'void' to binary 'operator+'
   43 |       return dat[k]=update(a,b,x,k*2+1,l,(l+r)/2)+update(a,b,x,k*2+2,(l+r)/2,r);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                           |                             |
      |                           void                          void
Language: C++

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

/*Starry Sky Tree*/
/*Range Add Min(Max) Query*/
/*区間加算、区間Min,区間Max*/

class RMAQ{
public: 
  
  //遅延用の型  
  struct T{
    bool type; //0 - empty   , 1 - update
    int value;
    T():type(0),value(0){}
    T(bool type,int value):type(type),value(value){}
  };

  //比較可能な主データ型
  struct D{
    int value;
    D():value(0){} /*適切な値にする!!!!!!*/
    D(int value):value(value){}
    bool operator < (D a)const {return value < a.value;} //merge用
  };
  
  D INF = D(1LL<<55); /*!!!!!!!!!!!!!!!!!!!!!!!!*/

  int n;
  vector<D> dat;
  vector<T> td;
  int toMax; //0 -> RangeMin, 1 -> RangeMax
  
  RMAQ(){n=-1;}
  RMAQ(int n_,int toMax = 0){
    this->toMax = toMax;
    n=1;
    while(n<n_)n*=2;
    td.resize(2*n-1,T());
    dat.resize(2*n-1,D());
  }
  
  D merge(D a,D b){return min(a,b);}
  
  void delay(int k){
    if(td[k].type==0) return;
    int v = td[k].value;
    td[k].type = 0;
    td[k].value = 0;
    
    int l = k*2+1,r = k*2+2;
    dat[l].value += v; td[l].type = 1; td[l].value += v;
    dat[r].value += v; td[r].type = 1; td[r].value += v;
  }

  D update(int k,int x){
    td[k].type = 1;
    td[k].value += x;
    dat[k].value += x;
    return dat[k];
  }
  
  //[a,b)の値をx加算　add(a,b,x)
  D add(int a,int b,int x,bool flg=true,int k=0,int l=0,int r=-1){
    if(r==-1 && toMax) x *= -1; 
    if(r==-1) r=n, assert(a < n && b <= n);
    if(r<=a||b<=l) return flg? dat[k]:INF;
    if(a<=l&&r<=b) return flg? update(k,x):dat[k];
    
    delay(k);
    D vl = add(a,b,x,flg,k*2+1,l,(l+r)/2);
    D vr = add(a,b,x,flg,k*2+2,(l+r)/2,r);
    if(flg) dat[k] = merge(vl,vr);
    return merge(vl,vr);
  }
  
  //[a,b)の最小値を得る　find(a,b);
  int find(int a,int b){
    D res = add(a,b,0,false);
    if(toMax) res.value *= -1; 
    return res.value;
  }
};


int main(){
    int n,q;
    cin>>n>>q;
    RMAQ A(n);
while(q--){
int o,s,t;
cin>>o>>s>>t;
    if(o == 0) 
}
return 0;
}


Compiler output:
a.cc:27:16: warning: overflow in conversion from 'long long int' to 'int' changes value from '36028797018963968' to '0' [-Woverflow]
   27 |   D INF = D(1LL<<55); /*!!!!!!!!!!!!!!!!!!!!!!!!*/
      |             ~~~^~~~
a.cc: In function 'int main()':
a.cc:94:1: error: expected primary-expression before '}' token
   94 | }
      | ^
Language: C++

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

/*Starry Sky Tree*/
/*Range Add Min(Max) Query*/
/*区間加算、区間Min,区間Max*/

class RMAQ{
public: 
  
  //遅延用の型  
  struct T{
    bool type; //0 - empty   , 1 - update
    int value;
    T():type(0),value(0){}
    T(bool type,int value):type(type),value(value){}
  };

  //比較可能な主データ型
  struct D{
    int value;
    D():value(0){} /*適切な値にする!!!!!!*/
    D(int value):value(value){}
    bool operator < (D a)const {return value < a.value;} //merge用
  };
  
  D INF = D(1LL<<55); /*!!!!!!!!!!!!!!!!!!!!!!!!*/

  int n;
  vector<D> dat;
  vector<T> td;
  int toMax; //0 -> RangeMin, 1 -> RangeMax
  
  RMAQ(){n=-1;}
  RMAQ(int n_,int toMax = 0){
    this->toMax = toMax;
    n=1;
    while(n<n_)n*=2;
    td.resize(2*n-1,T());
    dat.resize(2*n-1,D());
  }
  
  D merge(D a,D b){return min(a,b);}
  
  void delay(int k){
    if(td[k].type==0) return;
    int v = td[k].value;
    td[k].type = 0;
    td[k].value = 0;
    
    int l = k*2+1,r = k*2+2;
    dat[l].value += v; td[l].type = 1; td[l].value += v;
    dat[r].value += v; td[r].type = 1; td[r].value += v;
  }

  D update(int k,int x){
    td[k].type = 1;
    td[k].value += x;
    dat[k].value += x;
    return dat[k];
  }
  
  //[a,b)の値をx加算　add(a,b,x)
  D add(int a,int b,int x,bool flg=true,int k=0,int l=0,int r=-1){
    if(r==-1 && toMax) x *= -1; 
    if(r==-1) r=n, assert(a < n && b <= n);
    if(r<=a||b<=l) return flg? dat[k]:INF;
    if(a<=l&&r<=b) return flg? update(k,x):dat[k];
    
    delay(k);
    D vl = add(a,b,x,flg,k*2+1,l,(l+r)/2);
    D vr = add(a,b,x,flg,k*2+2,(l+r)/2,r);
    if(flg) dat[k] = merge(vl,vr);
    return merge(vl,vr);
  }
  
  //[a,b)の最小値を得る　find(a,b);
  int find(int a,int b){
    D res = add(a,b,0,false);
    if(toMax) res.value *= -1; 
    return res.value;
  }
};


int main(){
    int n,q;
    cin>>n>>q;
    RMAQ A(n);
while(q--){
int o,s,t;
cin>>o>>s>>t;
    if(o == 0) 
}
return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:95:1: error: expected primary-expression before '}' token
   95 | }
      | ^
Language: C++

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

struct query{
  int type;//0=empty, 1=add-sum ,2=set-min
  ll value;
  query(int a=0,ll b=0):type(a),value(b) {}
};



ll INF=(1LL<<60);


struct segtree{
  int SIZE;
  vector<query> s;
  vector<ll> t// sum-add
  vector<ll> u;// min-set

  segtree(int n=1){
    SIZE=1;
    while(SIZE<n)SIZE*=2;
    s.clear();
    t.clear();
    u.clear();
    s.resize(SIZE*2, query());
    t.resize(SIZE*2, 0);
    u.resize(SIZE*2, 0);
  }
  
  void func(int k,int l,int r,query q){
    if(q.type==1){
      if(s[k].type==0)s[k]=q;
      else s[k].value+=q.value;
      t[k]+=q.value*(r-l);
      u[k]+=q.value;
    }
    if(q.type==2){
      s[k]=q;
      t[k]=q.value*(r-l);
      u[k]=q.value;
    }
  }

  void compute(int k,int l,int r){
    query q=s[k];
    s[k]=query();
    if(q.type==0||r-l==1)return;
    int m=(l+r)/2;
    func(k*2+1,l,m,q);
    func(k*2+2,m,r,q);
  }

  void Update(int a,int b,query x,int k,int l,int r){
    if(b<=l || r<=a)return;
    compute(k,l,r);
    if(a<=l && r<=b){
      func(k,l,r,x);
    }else{
      int m=(l+r)/2;
      Update(a,b,x,k*2+1,l,m);
      Update(a,b,x,k*2+2,m,r);
      t[k]=t[k*2+1]+t[k*2+2];
      u[k]=min(u[k*2+1],u[k*2+2]);
    }
  }

  ll Dfs(int type,int a,int b,int k,int l,int r){
    if(b<=l || r<=a){
      if(type==1)return 0; //add
      if(type==2)return INF; // min
    }
    compute(k,l,r);
    if(a<=l && r<=b){
      if(type==1)return t[k];
      if(type==2)return u[k];
    }else{
      int m=(l+r)/2;
      ll lv=Dfs(type,a,b,k*2+1,l,m);
      ll rv=Dfs(type,a,b,k*2+2,m,r);
      if(type==1)return lv+rv; // add
      if(type==2)return min(lv,rv); // min
    }
  }

  void Add(int a,int b,ll x){
    Update(a,b,query(1,x), 0,0,SIZE);
  }
  void Set(int a,int b,ll x){
    Update(a,b,query(2,x), 0,0,SIZE);
  }
  ll Getsum(int a,int b){
    return Dfs(1,a,b, 0,0,SIZE);
  }

  ll Getmin(int a,int b){
    return Dfs(2,a,b, 0,0,SIZE);
  }
  
};



int main(){
  
  int n,q;
  scanf("%d %d",&n,&q);
  segtree T(n);
  
  for(int i=0;i<q;i++){
    int type,a,b,c;
    scanf("%d %d %d",&type,&a,&b);
    if(type==0){
      scanf("%d",&c);
      T.Add(a,b+1,c);
    }else{
      printf("%lld\n", T.Getmin(a,b+1) );
    }
  }
  return 0;
}



Compiler output:
a.cc:19:14: error: expected ';' at end of member declaration
   19 |   vector<ll> t// sum-add
      |              ^
      |               ;
a.cc: In member function 'll segtree::Dfs(int, int, int, int, int, int)':
a.cc:86:3: warning: control reaches end of non-void function [-Wreturn-type]
   86 |   }
      |   ^
Language: Java

import java.util.Scanner;

public class SmallestWindow {
    //http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_3_A
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int S = in.nextInt();//target
        int a[] = new int[n+1];
        for(int i = 0; i<n ;i++){
            a[i] = in.nextInt();
        }
        //use two pointer
        int p1 = 0, p2 = 0;
        int min = n+1;//smallest size
        for(p1  =0; p1<n ;p1++){
            //p2 = p1;
            int sum = 0;
            while(sum<S){
                if(p2==n) break;
                sum+= a[p2];
                p2++;
            }
            if(sum>=S)
                if(min>(p2-p1)) min  = p2-p1;
        }
        if(min == n+1) System.out.println(0);
        else System.out.println(min-1);

    }

}



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

#include<stdio.h>
//#define min(a,b) ((a)<(b)?(a):(b))
#define INF 10000000
int a[100000];

int main(void)
{
	int N, S,sum=0;
	int res=INF;
	int i,j=0;
	scanf("%d %d",&N,&S);
	for (i = 0; i < N; i++) {
		scanf("%d", &a[i]);
		sum += a[i];

		while (sum - a[j] >= S) {
			sum -= a[j];
			j++;
		}
		if (sum >= S)res = min(res, i - j + 1);
	}
	if (res == INF)res = 0;
		printf("%d\n", res);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:20:36: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
   20 |                 if (sum >= S)res = min(res, i - j + 1);
      |                                    ^~~
      |                                    main
Language: C

int main(void){
  SimSelSort(a,N,S);
  
  

}



void SimSelSort(int num[ ], int n,int S)
{
  int i, j, k, min, temp;
  int time=0;
  int sum=0;

    for (i = 0; i < n - 1; i++) {
        min = num[i];                
        k = i;                       
        for (j = i + 1; j < n; j++) {
            if (num[j] < min) {      
                min = num[j];        
                k = j;                
            }
        }                             
        temp = num[i];                
        num[i] = num[k];
        num[k] = temp;
    }
  
    for(n; 0<n; --n){
      
      time++;

      sum += num[n];

      printf("%d,",sum);

      if(S<sum){
	printf("\n%d times succes\n",time);
	break;
      }else if(n==0){

      printf("0\n");


      }    
       
    }  
       
     if(n==0){

      printf("\n0\n");


      }   

}

Compiler output:
main.c: In function 'main':
main.c:2:3: error: implicit declaration of function 'SimSelSort' [-Wimplicit-function-declaration]
    2 |   SimSelSort(a,N,S);
      |   ^~~~~~~~~~
main.c:2:14: error: 'a' undeclared (first use in this function)
    2 |   SimSelSort(a,N,S);
      |              ^
main.c:2:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:2:16: error: 'N' undeclared (first use in this function)
    2 |   SimSelSort(a,N,S);
      |                ^
main.c:2:18: error: 'S' undeclared (first use in this function)
    2 |   SimSelSort(a,N,S);
      |                  ^
main.c: At top level:
main.c:10:6: warning: conflicting types for 'SimSelSort'; have 'void(int *, int,  int)'
   10 | void SimSelSort(int num[ ], int n,int S)
      |      ^~~~~~~~~~
main.c:2:3: note: previous implicit declaration of 'SimSelSort' with type 'void(int *, int,  int)'
    2 |   SimSelSort(a,N,S);
      |   ^~~~~~~~~~
main.c: In function 'SimSelSort':
main.c:36:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   36 |       printf("%d,",sum);
      |       ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | int main(void){
main.c:36:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   36 |       printf("%d,",sum);
      |       ^~~~~~
main.c:36:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:52:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   52 |       printf("\n0\n");
      |       ^~~~~~
main.c:52:7: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

int main(void){
  a[100000]={};
  int N;
  int S;


  SimSelSort(a,N,S);
  
  

}



void SimSelSort(int num[ ], int n,int S)
{
  int i, j, k, min, temp;
  int time=0;
  int sum=0;

    for (i = 0; i < n - 1; i++) {
        min = num[i];                
        k = i;                       
        for (j = i + 1; j < n; j++) {
            if (num[j] < min) {      
                min = num[j];        
                k = j;                
            }
        }                             
        temp = num[i];                
        num[i] = num[k];
        num[k] = temp;
    }
  
    for(n; 0<n; --n){
      
      time++;

      sum += num[n];

      printf("%d,",sum);

      if(S<sum){
	printf("\n%d times succes\n",time);
	break;
      }else if(n==0){

      printf("0\n");


      }    
       
    }  
       
     if(n==0){

      printf("\n0\n");


      }   

}

Compiler output:
main.c: In function 'main':
main.c:2:3: error: 'a' undeclared (first use in this function)
    2 |   a[100000]={};
      |   ^
main.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:2:13: error: expected expression before '{' token
    2 |   a[100000]={};
      |             ^
main.c:7:3: error: implicit declaration of function 'SimSelSort' [-Wimplicit-function-declaration]
    7 |   SimSelSort(a,N,S);
      |   ^~~~~~~~~~
main.c: At top level:
main.c:15:6: warning: conflicting types for 'SimSelSort'; have 'void(int *, int,  int)'
   15 | void SimSelSort(int num[ ], int n,int S)
      |      ^~~~~~~~~~
main.c:7:3: note: previous implicit declaration of 'SimSelSort' with type 'void(int *, int,  int)'
    7 |   SimSelSort(a,N,S);
      |   ^~~~~~~~~~
main.c: In function 'SimSelSort':
main.c:41:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   41 |       printf("%d,",sum);
      |       ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | int main(void){
main.c:41:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   41 |       printf("%d,",sum);
      |       ^~~~~~
main.c:41:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:57:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   57 |       printf("\n0\n");
      |       ^~~~~~
main.c:57:7: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

int main(void){

  SimSelSort(a,N,S);
  
  

}



void SimSelSort(int num[ ], int n,int S)
{
  int i, j, k, min, temp;
  int time=0;
  int sum=0;

    for (i = 0; i < n - 1; i++) {
        min = num[i];                
        k = i;                       
        for (j = i + 1; j < n; j++) {
            if (num[j] < min) {      
                min = num[j];        
                k = j;                
            }
        }                             
        temp = num[i];                
        num[i] = num[k];
        num[k] = temp;
    }
  
    for(n; 0<n; --n){
      
      time++;

      sum += num[n];

      printf("%d,",sum);

      if(S<sum){
	printf("\n%d times succes\n",time);
	break;
      }else if(n==0){

      printf("0\n");


      }    
       
    }  
       
     if(n==0){

      printf("\n0\n");


      }   

}

Compiler output:
main.c: In function 'main':
main.c:3:3: error: implicit declaration of function 'SimSelSort' [-Wimplicit-function-declaration]
    3 |   SimSelSort(a,N,S);
      |   ^~~~~~~~~~
main.c:3:14: error: 'a' undeclared (first use in this function)
    3 |   SimSelSort(a,N,S);
      |              ^
main.c:3:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:3:16: error: 'N' undeclared (first use in this function)
    3 |   SimSelSort(a,N,S);
      |                ^
main.c:3:18: error: 'S' undeclared (first use in this function)
    3 |   SimSelSort(a,N,S);
      |                  ^
main.c: At top level:
main.c:11:6: warning: conflicting types for 'SimSelSort'; have 'void(int *, int,  int)'
   11 | void SimSelSort(int num[ ], int n,int S)
      |      ^~~~~~~~~~
main.c:3:3: note: previous implicit declaration of 'SimSelSort' with type 'void(int *, int,  int)'
    3 |   SimSelSort(a,N,S);
      |   ^~~~~~~~~~
main.c: In function 'SimSelSort':
main.c:37:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   37 |       printf("%d,",sum);
      |       ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | int main(void){
main.c:37:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   37 |       printf("%d,",sum);
      |       ^~~~~~
main.c:37:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:53:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   53 |       printf("\n0\n");
      |       ^~~~~~
main.c:53:7: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include<cstdio>
??
int a[100000];
int main(void){
????int n, s;
????scanf("%d%d", &n, &s);
????for(int i = 0;i < n;++i)
scanf("%d", &a[i]);

????int res = n + 1, sum = 0, l = 0, r = 0;

????for(;l < n;){
????????if(l == r)sum = a[r++];
????????else{
????????????if(sum >= s)sum -= a[l++];
????????????else if(r < n)sum += a[r++];
????????????else break;
????????}
????????if(sum >= s && res > r - l)res = r - l;
????}
????if(res <= n)printf("%d\n", res);
????else puts("0");
??
????return 0;
}

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

#include<stdio.h>

??
int a[100000];
int main(void){
????int n, s;
????scanf("%d%d", &n, &s);
????for(int i = 0;i < n;++i)scanf("%d", &a[i]);
????int res = n + 1, sum = 0, l = 0, r = 0;
????for(;l < n;){
????????if(l == r)sum = a[r++];
????????else{
????????????if(sum >= s)sum -= a[l++];
????????????else if(r < n)sum += a[r++];
????????????else break;
????????}
????????if(sum >= s && res > r - l)res = r - l;
????}
????if(res <= n)printf("%d\n", res);
????else puts("0");
??
????return 0;
}

Compiler output:
main.c:3:1: error: expected identifier or '(' before '?' token
    3 | ??
      | ^
main.c: In function 'main':
main.c:6:1: error: expected expression before '?' token
    6 | ????int n, s;
      | ^
main.c:7:1: error: expected expression before '?' token
    7 | ????scanf("%d%d", &n, &s);
      | ^
main.c:7:20: error: 'n' undeclared (first use in this function)
    7 | ????scanf("%d%d", &n, &s);
      |                    ^
main.c:7:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:24: error: 's' undeclared (first use in this function)
    7 | ????scanf("%d%d", &n, &s);
      |                        ^
main.c:8:1: error: expected expression before '?' token
    8 | ????for(int i = 0;i < n;++i)scanf("%d", &a[i]);
      | ^
main.c:9:1: error: expected expression before '?' token
    9 | ????int res = n + 1, sum = 0, l = 0, r = 0;
      | ^
main.c:10:1: error: expected expression before '?' token
   10 | ????for(;l < n;){
      | ^
main.c:20:1: error: expected expression before '?' token
   20 | ????else puts("0");
      | ^
main.c:21:1: error: expected expression before '?' token
   21 | ??
      | ^
Language: C

#include<stdio.h>

??
int a[100000];

int main(void){
????int n, s;
????scanf("%d%d", &n, &s);

????for(int i = 0;i < n;++i)
  scanf("%d", &a[i]);
????
  int res = n + 1; 
  int sum = 0;
  int l = 0;
  int  r = 0;

????for(;l < n;){
????????if(l == r)sum = a[r++];
????????else{
????????????if(sum >= s)sum -= a[l++];
????????????else if(r < n)sum += a[r++];
????????????else break;
????????}
????????if(sum >= s && res > r - l)
      res = r - l;
????}
????if(res <= n)printf("%d\n", res);
????else puts("0");
??
????return 0;
}

Compiler output:
main.c:3:1: error: expected identifier or '(' before '?' token
    3 | ??
      | ^
main.c: In function 'main':
main.c:7:1: error: expected expression before '?' token
    7 | ????int n, s;
      | ^
main.c:8:1: error: expected expression before '?' token
    8 | ????scanf("%d%d", &n, &s);
      | ^
main.c:8:20: error: 'n' undeclared (first use in this function)
    8 | ????scanf("%d%d", &n, &s);
      |                    ^
main.c:8:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:24: error: 's' undeclared (first use in this function)
    8 | ????scanf("%d%d", &n, &s);
      |                        ^
main.c:10:1: error: expected expression before '?' token
   10 | ????for(int i = 0;i < n;++i)
      | ^
main.c:12:1: error: expected expression before '?' token
   12 | ????
      | ^
main.c:18:1: error: expected expression before '?' token
   18 | ????for(;l < n;){
      | ^
main.c:29:1: error: expected expression before '?' token
   29 | ????else puts("0");
      | ^
main.c:30:1: error: expected expression before '?' token
   30 | ??
      | ^
Language: C++

import sys
INF = (sys.maxint)/3

def SmallestWindow(S, a_list):
	i = 0
	j = 0
	tmpS = 0
	res = INF
	while 1 :
		while tmpS < S and i <len(a_list)-1:
			i +=1
			tmpS += a_list[i]
		if (tmpS <S):
			break
		res = min (res, i-j)
		j += 1
		tmpS -=a_list[j]
	if res == INF:
		res = 0
	return res
		

def main():
	N, S = map(int, raw_input().split())
	a_list = map(int, raw_input().split())
	print SmallestWindow(S, a_list)

if __name__ == '__main__':
	main()

Compiler output:
a.cc:28:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   28 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

import sys
INF = (sys.maxint)/3

def SmallestWindow(S, a_list):
	i = 0
	j = 0
	tmpS = 0
	res = INF
	while 1 :
		while tmpS < S and i <len(a_list):
			tmpS += a_list[i]
			i = i+1
		if (tmpS <S):
			break
		res = min (res, i-j)
		tmpS -=a_list[j]
		j += 1
	if res == INF:
		res = 0
	return res
		

def main():
	N, S = map(int, raw_input().split())
	a_list = map(int, raw_input().split())
	print SmallestWindow(S, a_list)

if __name__ == '__main__':
	main()

Compiler output:
a.cc:28:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   28 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

int main() {
	int N, S; cin >> N >> S;
	vector<int>as(N);
	for (int i = 0; i < N; ++i)cin >> as[i];
	auto it = as.begin(), jt = as.begin();
	int sum = 0;
	int ans = 1e6;
	while (jt != as.end()) {
		sum += *jt;
		jt++;
		while (sum >= S) {
			ans = min(ans, jt - it);
			sum -= *it;
			it++;
		}
		
	}
	if (ans == 1e6)ans = 0;
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:34: error: no matching function for call to 'min(int&, __gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)'
   15 |                         ans = min(ans, jt - it);
      |                               ~~~^~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:15:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'})
   15 |                         ans = min(ans, jt - it);
      |                               ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:15:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 |                         ans = min(ans, jt - it);
      |                               ~~~^~~~~~~~~~~~~~
Language: C++

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

int main() {
	int N, S; cin >> N >> S;
	vector<int>as(N);
	for (int i = 0; i < N; ++i)cin >> as[i];
	auto it = as.begin(), jt = as.begin();
	int sum = 0;
	int ans = 1e6;
	while (jt != as.end()) {
		sum += *jt;
		jt++;
		while (sum >= S) {
			ans = min(ans, jt - it);
			sum -= *it;
			it++;
		}
		 
	}
	if (ans == int(1e6))ans = 0;
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:34: error: no matching function for call to 'min(int&, __gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)'
   15 |                         ans = min(ans, jt - it);
      |                               ~~~^~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:15:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'})
   15 |                         ans = min(ans, jt - it);
      |                               ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:15:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 |                         ans = min(ans, jt - it);
      |                               ~~~^~~~~~~~~~~~~~
Language: C++

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

int main() {
	int N, S; cin >> N >> S;
	vector<int>as(N);
	for (int i = 0; i < N; ++i)cin >> as[i];
	auto it = as.begin();auto jt = as.begin();
	int sum = 0;
	int ans = int(1e6);
	while (jt != as.end()) {
		sum += *jt;
		jt++;
		while (sum >= S) {
			ans = min(ans, jt - it);
			sum -= *it;
			it++;
		}
		 
	}
	if (ans == int(1e6))ans = 0;
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:34: error: no matching function for call to 'min(int&, __gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)'
   15 |                         ans = min(ans, jt - it);
      |                               ~~~^~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:15:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'})
   15 |                         ans = min(ans, jt - it);
      |                               ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:15:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 |                         ans = min(ans, jt - it);
      |                               ~~~^~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<numeric>
#include<functional>

using namespace std;

int main(int argc,char* argv[])
{
  int N, S, sum = 0, Ans = 100001;
  cin >> N >> S;
  vector<int> values(N);
  for(int i = 0; i < N; i++) {cin >> values[i];}
  for(auto ipt = values.begin() ;int(ipt) != int(values.end())+1; ipt++){
    for(auto jpt = ipt;int(jpt) != int(values.end())+1; jpt++){
      sum += *jpt;
      while(sum >= S){
        Ans = min(Ans, int(jpt-ipt)+1);
        sum -= *ipt;
        ipt++;
      }
    }
  }
  if(Ans == 100001) cout << 0 << endl;
  else cout << Ans << endl;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:14:34: error: invalid cast from type '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to type 'int'
   14 |   for(auto ipt = values.begin() ;int(ipt) != int(values.end())+1; ipt++){
      |                                  ^~~~~~~~
a.cc:14:46: error: invalid cast from type 'std::vector<int>::iterator' to type 'int'
   14 |   for(auto ipt = values.begin() ;int(ipt) != int(values.end())+1; ipt++){
      |                                              ^~~~~~~~~~~~~~~~~
a.cc:15:24: error: invalid cast from type '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to type 'int'
   15 |     for(auto jpt = ipt;int(jpt) != int(values.end())+1; jpt++){
      |                        ^~~~~~~~
a.cc:15:36: error: invalid cast from type 'std::vector<int>::iterator' to type 'int'
   15 |     for(auto jpt = ipt;int(jpt) != int(values.end())+1; jpt++){
      |                                    ^~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	long long N, S; cin >> N >> S;
	vector<long long> Sum(N + 1,0);
	for (int i = 1; i <= N;i++) {
		int a; cin >> a;
		Sum[i] += Sum[i - 1] + a;
	}
	long long ans = LLONG_MAX;
	int left = 0, right = 0;
	while (true) {
		if (Sum[right] - Sum[left] >= S) {
			ans = (ans < right - left) ? ans : right - left;
			left++;
		}
		else right++;
		if (right > N || left > N) { if (ans == LLONG_MAX)ans = 0; cout << ans << endl; return 0; }
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:25: error: 'LLONG_MAX' was not declared in this scope
   12 |         long long ans = LLONG_MAX;
      |                         ^~~~~~~~~
a.cc:3:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include<bits/stdc++.h>
long long i,a,N,s,A=INT_MAX,l,r,S[100002];int main(){scanf("%llf%llf",&N,&s);for(;i<N;i++){scanf("%d",&a);S[i+1]+=S[i]+a;}for(;;){if(S[r]-S[l]>=s){A=min(A,r-l);l++;}else r++;if(r>N){if(A==INT_MAX)A=0;printf(A);return 0;}}}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:150: error: 'min' was not declared in this scope; did you mean 'std::min'?
    2 | long long i,a,N,s,A=INT_MAX,l,r,S[100002];int main(){scanf("%llf%llf",&N,&s);for(;i<N;i++){scanf("%d",&a);S[i+1]+=S[i]+a;}for(;;){if(S[r]-S[l]>=s){A=min(A,r-l);l++;}else r++;if(r>N){if(A==INT_MAX)A=0;printf(A);return 0;}}}
      |                                                                                                                                                      ^~~
      |                                                                                                                                                      std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:2:208: error: invalid conversion from 'long long int' to 'const char*' [-fpermissive]
    2 | long long i,a,N,s,A=INT_MAX,l,r,S[100002];int main(){scanf("%llf%llf",&N,&s);for(;i<N;i++){scanf("%d",&a);S[i+1]+=S[i]+a;}for(;;){if(S[r]-S[l]>=s){A=min(A,r-l);l++;}else r++;if(r>N){if(A==INT_MAX)A=0;printf(A);return 0;}}}
      |                                                                                                                                                                                                                ^
      |                                                                                                                                                                                                                |
      |                                                                                                                                                                                                                long long int
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C++

#include<bits/stdc++.h>
long long i,a,N,s,A=INT_MAX,l,r,S[100002];int main(){scanf("%llf%llf",&N,&s);for(;i<N;i++){scanf("%llf",&a);S[i+1]+=S[i]+a;}for(;;){if(S[r]-S[l]>=s){A=min(A,r-l);l++;}else r++;if(r>N){if(A==INT_MAX)A=0;printf("%llf\n",A);return 0;}}}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:152: error: 'min' was not declared in this scope; did you mean 'std::min'?
    2 | long long i,a,N,s,A=INT_MAX,l,r,S[100002];int main(){scanf("%llf%llf",&N,&s);for(;i<N;i++){scanf("%llf",&a);S[i+1]+=S[i]+a;}for(;;){if(S[r]-S[l]>=s){A=min(A,r-l);l++;}else r++;if(r>N){if(A==INT_MAX)A=0;printf("%llf\n",A);return 0;}}}
      |                                                                                                                                                        ^~~
      |                                                                                                                                                        std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include<bits/stdc++.h>
long long i,a,N,s,A=INT_MAX,l,r,S[100002];int main(){scanf("%ll%ll",&N,&s);for(;i<N;i++){scanf("%ll",&a);S[i+1]+=S[i]+a;}for(;;){if(S[r]-S[l]>=s){A=min(A,r-l);l++;}else r++;if(r>N){if(A==INT_MAX)A=0;printf("%ll\n",A);return 0;}}}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:149: error: 'min' was not declared in this scope; did you mean 'std::min'?
    2 | long long i,a,N,s,A=INT_MAX,l,r,S[100002];int main(){scanf("%ll%ll",&N,&s);for(;i<N;i++){scanf("%ll",&a);S[i+1]+=S[i]+a;}for(;;){if(S[r]-S[l]>=s){A=min(A,r-l);l++;}else r++;if(r>N){if(A==INT_MAX)A=0;printf("%ll\n",A);return 0;}}}
      |                                                                                                                                                     ^~~
      |                                                                                                                                                     std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include<std/bits++>
long long i,a,N,s,A=INT_MAX,l,r,S[100002];int main(){scanf("%ld%ld",&N,&s);for(;i<N;i++){scanf("%ld",&a);S[i+1]+=S[i]+a;}for(;;){if(S[r]-S[l]>=s){A=std::min(A,r-l);l++;}else r++;if(r>N){if(A==INT_MAX)A=0;printf("%ld\n",A);return 0;}}}

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

#include<stdc/bits++>
long long i,a,N,s,A=INT_MAX,l,r,S[100002];int main(){scanf("%ld%ld",&N,&s);for(;i<N;i++){scanf("%ld",&a);S[i+1]+=S[i]+a;}for(;;){if(S[r]-S[l]>=s){A=std::min(A,r-l);l++;}else r++;if(r>N){if(A==INT_MAX)A=0;printf("%ld\n",A);return 0;}}}

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

#include<bits/stdc++>
long long i,a,N,s,A=INT_MAX,l,r,S[100002];int main(){scanf("%ld%ld",&N,&s);for(;i<N;i++){scanf("%ld",&a);S[i+1]+=S[i]+a;}for(;;){if(S[r]-S[l]>=s){A=std::min(A,r-l);l++;}else r++;if(r>N){if(A==INT_MAX)A=0;printf("%ld\n",A);return 0;}}}

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

import java.util.Scanner;

public class SmallestWindow2 {
    //http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_3_A
    //http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2692179#1 -- reference
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int K = in.nextInt();//target
        int a[] = new int[n+1];
        for(int i = 1; i<=n ;i++){
            a[i] = in.nextInt();
        }
        int tag[] = new int[K+1];
        //use two pointer
        int p1 = 0, p2 = 0;
        int min = n+1;//smallest size
        int sum = 0;
        //moving the pointer and check the sum < k
        while(p1<=n){
            //p2 = p1;
            if(sum==K) {
                min = Math.min(min, p2-p1);
                //System.out.println(min);
            }
            //main body
            //move right pointer
            if(sum<K){
                p2++;
                if(p2>n) break;
                if(a[p2] <= K){
                    if(tag[a[p2]]==0) sum++;
                    tag[a[p2]]++;
                }
            }else {
                p1++;
                if(p1>n) break;
                if(a[p1]<=K){
                    tag[a[p1]]--;
                    if(tag[a[p1]]==0) sum--;
                }
            }

        }
        if(min == n+1) System.out.println(0);
        else System.out.println(min);

    }

}



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

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

void SimSelSort(int num[ ], int n,int K);


int main(void){
  int N;
  int K;
  int a[100000] = {};
  int i=0; 

  while(i<100000){
    a[i] = rand()%9+1;
    ++i;
  }
  printf("N select number");
  scanf("%d",&N);

  printf("K select number");
  scanf("%d",&K);

  SimSelSort(a,N,K);
  
  

}

void SimSelSort(int num[ ], int n,int K)
{
  int i, j, k, min, temp;
  int time=0;
  int sum=0;
  int kazu=1;

    for (i = 0; i < n - 1; i++) {
        min = num[i];                
        k = i;                       
        for (j = i + 1; j < n; j++) {
            if (num[j] < min) {      
                min = num[j];        
                k = j;                
            }
        }                             
        temp = num[i];                
        num[i] = num[k];
        num[k] = temp;
    }
  
    for(time; 0<time;++time){
      
      if(num[time]==kazu){
	kazu++;
      }
     
      if(kazu==K)
      printf("\n%d\n",K);       
    }   
   
     if(kazu<K)
      printf("\n0\n,");       
    }   

}
#include <stdio.h>
#include <stdio.h>

void SimSelSort(int num[ ], int n,int K);


int main(void){
  int N;
  int K;
  int a[100000] = {};
  int i=0; 

  while(i<100000){
    a[i] = rand()%9+1;
    ++i;
  }
  printf("N select number");
  scanf("%d",&N);

  printf("K select number");
  scanf("%d",&K);

  SimSelSort(a,N,K);
  
  

}

void SimSelSort(int num[ ], int n,int K)
{
  int i, j, k, min, temp;
  int time=0;
  int sum=0;
  int kazu=1;

    for (i = 0; i < n - 1; i++) {
        min = num[i];                
        k = i;                       
        for (j = i + 1; j < n; j++) {
            if (num[j] < min) {      
                min = num[j];        
                k = j;                
            }
        }                             
        temp = num[i];                
        num[i] = num[k];
        num[k] = temp;
    }
  
    for(time; 0<time;++time){
      
      if(num[time]==kazu){
	kazu++;
      }
     
      if(kazu==K)
      printf("\n%d\n",K);       
    }   
   
     if(kazu<K)
      printf("\n0\n,");       
    }   

}

Compiler output:
main.c: In function 'main':
main.c:14:12: error: implicit declaration of function 'rand' [-Wimplicit-function-declaration]
   14 |     a[i] = rand()%9+1;
      |            ^~~~
main.c: At top level:
main.c:64:1: error: expected identifier or '(' before '}' token
   64 | }
      | ^
main.c:71:5: error: redefinition of 'main'
   71 | int main(void){
      |     ^~~~
main.c:7:5: note: previous definition of 'main' with type 'int(void)'
    7 | int main(void){
      |     ^~~~
main.c:93:6: error: redefinition of 'SimSelSort'
   93 | void SimSelSort(int num[ ], int n,int K)
      |      ^~~~~~~~~~
main.c:29:6: note: previous definition of 'SimSelSort' with type 'void(int *, int,  int)'
   29 | void SimSelSort(int num[ ], int n,int K)
      |      ^~~~~~~~~~
main.c:128:1: error: expected identifier or '(' before '}' token
  128 | }
      | ^
Language: C

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

void SimSelSort(int num[ ], int n,int K);


int main(void){
  int N;
  int K;
  int a[10000] = {};
  int i=0; 
  int b;

  scanf("%d",&N);

  scanf("%d",&S);

  for(i;i<N;i++){

   scanf("%d",&b);
   a[i]=b;
  }
 
  SimSelSort(a,N,K);
  
  

}

void SimSelSort(int num[ ], int n,int K)
{
  int i, j, k, min, temp;
  int time=0;
  int sum=0;
  int kazu=1;

    for (i = 0; i < n - 1; i++) {
        min = num[i];                
        k = i;                       
        for (j = i + 1; j < n; j++) {
            if (num[j] < min) {      
                min = num[j];        
                k = j;                
            }
        }                             
        temp = num[i];                
        num[i] = num[k];
        num[k] = temp;
    }
    for(time; time<n;++time){
      if(num[time]==kazu){
	kazu++;
      }
     
      if(kazu==K){
      printf("%d\n",K);
      break;      
      } 
    }   
   
    if(kazu<K){
      printf("0\n");       
    }   

}

Compiler output:
main.c: In function 'main':
main.c:16:15: error: 'S' undeclared (first use in this function)
   16 |   scanf("%d",&S);
      |               ^
main.c:16:15: note: each undeclared identifier is reported only once for each function it appears in