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

int main(void)
{
	long long a,b,i,d=1,e[1000010]={},f[1000010]={},g=0,j,k,l[1000010]={},n[1000010]={},m=0,o;
	char c[1000010];
	scanf("%lld %lld",&a,&b);
	scanf("%s",c);
	for(i=0;i<a;i++){
		if(d==1){
			if(c[i]=='1'){
				e[g]++;
			}else{
				f[g]++;
				d=0;
//              g++;
//              printf("%lld\n",g);
			}
		}else{
			if(c[i]=='0'){
				f[g]++;
			}else{
				g=g+1;
//              	printf("%lld\n",g);
				e[g]++;
				d=1;
			}
		}
	}
	for(i=1;i<100010;i++){
		l[i]=l[i-1]+e[i-1];
		n[i]=n[i-1]+f[i-1];
		if(f[i-4]==0){
          if(i>4){
				o=i;
				break;
          }
		}
	}
	for(i=0;i<o+2;i++){
		m=max(m,l[i+b+1]-l[i]+n[i+b]-n[i]);
	}
	printf("%lld",m);
	return 0;
}
\\

Compiler output:
main.c: In function 'main':
main.c:5:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    5 |         scanf("%lld %lld",&a,&b);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(void)
main.c:5:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    5 |         scanf("%lld %lld",&a,&b);
      |         ^~~~~
main.c:5:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:39:19: error: implicit declaration of function 'max' [-Wimplicit-function-declaration]
   39 |                 m=max(m,l[i+b+1]-l[i]+n[i+b]-n[i]);
      |                   ^~~
main.c:41:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   41 |         printf("%lld",m);
      |         ^~~~~~
main.c:41:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:41:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:41:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:44:1: error: stray '\' in program
   44 | \\
      | ^
main.c:44:2: error: stray '\' in program
   44 | \\
      |  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
inline bool chmax (int& a, int b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  char crr = '1';
  int cnt = 0;
  vector<int> a(0);
  a.push_back(0);
  for (int i = 0; i < n; i++) {
    if (crr != s[i]) {
      crr = s[i];
      a.push_back(cnt);
      cnt = 1;
    } else {
      cnt++;
    }
  }
  a.push_back(cnt);
  if (crr == '0') a.push_back(0);
  int sz = a.size();
  for (int i = 1; i < sz; i++) a[i] += a[i - 1];
  int ret = 0;
  int l(1), r(2 * k + 2);
  for (; r <= sz; l += 2, r += 2) 
    chmax(ret, a[r - 1] - a[l - 1]);
  }
  if (2 * k + 2 > sz) ret = n;
  cout << ret << endl;
  return 0;
}

Compiler output:
a.cc:36:3: error: expected unqualified-id before 'if'
   36 |   if (2 * k + 2 > sz) ret = n;
      |   ^~
a.cc:37:3: error: 'cout' does not name a type
   37 |   cout << ret << endl;
      |   ^~~~
a.cc:38:3: error: expected unqualified-id before 'return'
   38 |   return 0;
      |   ^~~~~~
a.cc:39:1: error: expected declaration before '}' token
   39 | }
      | ^
Language: C++

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

int main() {
	int n, k;
	string s;
	cin >> n >> k;
	cin >> s;
	int num[100000];
	int pointer = 0;
	for (int i = 0; i < 100000; i++) {
		num[i] = 0;
	}
	if (s.find('0') == string::npos) {
		cout << 0 << endl;
		return;
	}
	bool is0 = false;
	for (int i = 0; i < s.length(); i++) {
		if ((is0 && s[i] == '0') || (!is0 && s[i] == '1')) {
			num[pointer]++;
		} else {
			is0 = !is0;
			pointer++;
			num[pointer]++;
		}
	}
	int ans = 0;
	k = k * 2 + 1;
	for (int i = 0; i < 100000 - k; i+=2) {
		int sum = 0;
		for (int j = 0; j < k; j++) {
			sum += num[i + j];
		}
		ans = max(ans, sum);
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
   18 |                 return;
      |                 ^~~~~~
Language: C++

I2luY2x1ZGU8aW9zdHJlYW0+I2luY2x1ZGU8YWxnb3JpdGhtPiNpbmNsdWRlPHZlY3Rvcj51c2lu
ZyBuYW1lc3BhY2Ugc3RkO3R5cGVkZWYgbG9uZyBsb25nIGxsO3R5cGVkZWYgdmVjdG9yPGludD4g
Vkk7aW50IG1haW4oKSB7IGludCBuLCBrOyBjaW4gPj4gbiA+PiBrOyBzdHJpbmcgczsgY2luID4+
IHM7IFZJIGE7IGludCBjbnQgPSAxOyBjaGFyIHogPSBzWzBdOyBmb3IgKGludCBpID0gMTsgaSA8
IG47IGkrKykgeyBpZiAoc1tpXSA9PSB6KWNudCsrOyBlbHNlIHsgYS5wdXNoX2JhY2soY250KTsg
Y250ID0gMTsgeiA9IHNbaV07IH0gfWEucHVzaF9iYWNrKGNudCk7IGZvciAoaW50IGkgPSAxOyBp
IDwgYS5zaXplKCk7IGkrKylhW2ldICs9IGFbaSAtIDFdOyBpbnQgeDsgY250ID0gMDsgaW50IGFu
cyA9IDA7IGlmIChzWzBdID09ICcwJykgeyB4ID0gayAqIDIgLSAxOyBpZiAoeCA+PSBhLnNpemUo
KSl4ID0gYS5zaXplKCkgLSAxOyBjbnQgPSBhW3hdOyBhbnMgPSBtYXgoYW5zLCBjbnQpOyBjbnQg
PSAwOyBmb3IgKGludCBpID0gMTsgaSA8IGEuc2l6ZSgpOyBpKyspIHsgaWYgKGkgJSAyID09IDEp
IHsgeCA9IGkgKyBrICogMjsgaWYgKHggPj0gYS5zaXplKCkpeCA9IGEuc2l6ZSgpIC0gMTsgY250
ID0gYVt4XSAtIGFbaSAtIDFdOyBhbnMgPSBtYXgoYW5zLCBjbnQpOyBjbnQgPSAwOyB9IGVsc2Ug
eyB4ID0gaSArIGsgKiAyIC0gMTsgaWYgKHggPj0gYS5zaXplKCkpeCA9IGEuc2l6ZSgpIC0gMTsg
Y250ID0gYVt4XSAtIGFbaSAtIDFdOyBhbnMgPSBtYXgoYW5zLCBjbnQpOyBjbnQgPSAwOyB9IH0g
fSBlbHNlIHsgeCA9IGsgKiAyOyBpZiAoeCA+PSBhLnNpemUoKSl4ID0gYS5zaXplKCkgLSAxOyBj
bnQgPSBhW3hdOyBhbnMgPSBtYXgoYW5zLCBjbnQpOyBjbnQgPSAwOyBmb3IgKGludCBpID0gMTsg
aSA8IGEuc2l6ZSgpOyBpKyspIHsgaWYgKGkgJSAyID09IDApIHsgeCA9IGkgKyBrICogMjsgaWYg
KHggPj0gYS5zaXplKCkpeCA9IGEuc2l6ZSgpIC0gMTsgY250ID0gYVt4XSAtIGFbaSAtIDFdOyBh
bnMgPSBtYXgoYW5zLCBjbnQpOyBjbnQgPSAwOyB9IGVsc2UgeyB4ID0gaSArIGsgKiAyIC0gMTsg
aWYgKHggPj0gYS5zaXplKCkpeCA9IGEuc2l6ZSgpIC0gMTsgY250ID0gYVt4XSAtIGFbaSAtIDFd
OyBhbnMgPSBtYXgoYW5zLCBjbnQpOyBjbnQgPSAwOyB9IH0gfWNvdXQgPDwgYW5zIDw8IGVuZGw7
IHJldHVybiAwOyB9

Compiler output:
a.cc:1:1: error: 'I2luY2x1ZGU8aW9zdHJlYW0' does not name a type
    1 | I2luY2x1ZGU8aW9zdHJlYW0+I2luY2x1ZGU8YWxnb3JpdGhtPiNpbmNsdWRlPHZlY3Rvcj51c2lu
      | ^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define UL unsigned long long


int main(void)
{
    IOS
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;

    vector<int> zero;
    vector<int> one;
    if (s[0] == '0') {
        one.emplace_back(0);
    }

    int cnt = 1;
    char c = s[0];
    for(auto i = 1; i < n; i++)
    {
        if (c == s[i]) {
            cnt++;
            //cerr << cnt;
        }
        if (c != s[i]) { 
            if (c == '0') {
                zero.emplace_back(cnt);
            } else {
                one.emplace_back(cnt);
            }
            c = s[i];
            cnt = 1;
        }
        if (i == n-1)) { 
            if (c == '0') {
                zero.emplace_back(cnt);
            } else {
                one.emplace_back(cnt);
            }
        }
    }
    
    /*
    cerr << "zero: ";
    for(int i = 0; i < zero.size() ; i++) {
        cerr << zero[i] << " ";
    }
    cerr << "one: ";
    for(int i = 0; i < one.size() ; i++) {
        cerr << one[i] << " ";
    }
    */
    
    int m = zero.size();
    if (m < k) {
        cout << n << endl; 
        return 0;
    }

    int ans = 0;
    int count = 0;
    for(auto i = 0; i <= m-k+1; i++)
    {
        count += one[i] + zero[i];
        if (i > k) {
            count -= one[i-k] + zero[i-k];
        }
        if (i != m-k+1) count += one[i+k];
        if (ans < count)  ans = count; 
    }
    

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


Compiler output:
a.cc: In function 'int main()':
a.cc:40:22: error: expected primary-expression before ')' token
   40 |         if (i == n-1)) {
      |                      ^
Language: C++

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

struct point{
  int x;
  int y;
};

string s;
vector <point> a;
int n, k, xx, yy, res=0;

int main(){
  cin >> n >> k;
  cin >> s;
  s = '1' + s + '1';
  for (int i=1; i<=n+1; ++i){
    if (s[i]=='1'){
      if (s[i-1]=='0'){
        xx = yy = i;
      }
      else yy++;
    }
    else if (s[i-1]=='1') a.push_back({xx, yy});
  }
  a.push_back({xx, yy});
  if (k>=a.size()-1) res=n;
  else{
    for (int i=0; i<a.size()-k; ++i){
      if (a[i+k].y-a[i].x+1 > res){
        res = a[i+k].y-a[i].x+1;
        if (i+k == a.size()-1 || i=0) res--;
      }
    }
  }
  cout << res;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:31: error: lvalue required as left operand of assignment
   32 |         if (i+k == a.size()-1 || i=0) res--;
      |             ~~~~~~~~~~~~~~~~~~^~~~
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		if (S.length() == 2)
			System.out.println(S);
		else
			System.out.println(S.charAt(2) +"" +S.charAt1(1)+"" +S.charAt(0));
	}
}	


Compiler output:
Main.java:11: error: cannot find symbol
			System.out.println(S.charAt(2) +"" +S.charAt1(1)+"" +S.charAt(0));
			                                     ^
  symbol:   method charAt1(int)
  location: variable S of type String
1 error
Language: Java

import java.util.*;

public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int length = sc.nextInt();
		int times = sc.nextInt();
		String s = sc.next();

		int flag =0;
		int counter=0;
		String st[] = s.split("");
		if(st[0].equals("1")){
			flag=1;
		}

		for(int i=0;i<length-1;i++){
			if(Integer.st[i] != Integer.st[i+1]){
				counter++;
			}
		}

		int counter2=0;
		int point[] = new int[counter+1];
		int j=0;
		for(int i=0;i<length-1;i++){
			if(Integer.st[i] != Integer.st[i+1]){
				point[j] = i-counter2+1;
				counter2 =i;
				j++;
			}
		}
		if(st[length-1].equals(st[length])){
			point[counter2-1]=1;
		}

		int[] cumulativesum = new int[counter2];
		cumulativesum[0]=0;
		for(int i=1;i<=counter2;i++)
			cumulativesum[i]=cumulativesum[i-1]+point[i];

		int max1=0;
		int max2=0;
		int k=0;

		if(counter2>2*times){
			k=counter2-2*times+1;
		}else
			k=counter2;

		for(int i=0;i<k;i++){
			if(cumulativesum[i]>max1)
				max1=cumulativesum[i]
		}

		if(counter2>2*k-1){
			k=counter2-2*times;
		}else
			k=counter2;

		for(int i=0;i<k;i++){
			if(cumulativesum[i]>max2)
		}

		System.out.println(Math.max(max1,max2));
	}
}

Compiler output:
Main.java:54: error: ';' expected
				max1=cumulativesum[i]
				                     ^
Main.java:64: error: illegal start of statement
		}
		^
2 errors
Language: C++

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

int main(){
  int N,K;
  cin>>N>>K; 
  string S;
  cin >> S;
  vector<int> Nums;
  int now = 1;
  int cnt = 0;
  
  for(int i=0;i<N;i++){
    if(S[i]==(char)('0'+now)) cnt++;
    else{
      Nums.push_back(cnt);
      now=1-now;
      cnt=1;
    }
  }
  if(cnt!=0) Nums.push_back(cnt);
  if(Nums.size()%2==0) Nums.push_back(0);
  int Add=2*K+1;
  vector<int> sum(Nums.size()+1);
  sum[0]=0
  for(int i=0;i<sum.size();i++){
      sum[i+1]=sum[i]+Nums[i];
  }
  int ans=0;
  for(int i=0;i<Nums.size();i+=2){
      int left=i;
      int right=min(i+Add,(int)Nums.size());
      int tmp=sum[right]-sum[left];
      ans=max(ans,tmp);
  }
	cout <<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: expected ';' before 'for'
   28 |   sum[0]=0
      |           ^
      |           ;
   29 |   for(int i=0;i<sum.size();i++){
      |   ~~~      
a.cc:29:15: error: 'i' was not declared in this scope
   29 |   for(int i=0;i<sum.size();i++){
      |               ^
Language: C++

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

char s;
int k = 0,q = 0,new1 = 1,old;
int ans = -1, temp = 0, total = 0;

//N文字の数列の初めに１をつけて簡略化
int main() {
  int N, K;
  cin >> N >> K;
  queue<int> que, que2;
  for(int i = 0; i < N + 1 ; i++ ){
    cin >> s;
    old = new1;
    new1 = s - '0';
    q++;
    if(old != new1 || i == N)que.push(q),q = 0;
  }

  int K2 = K*2;
  while(total != N + 1) {
    temp += que.front();
    k++;
    que2.push(que.front());
    if(k > K2 && (k & 1) == 1) {
      if(ans == -1) ans = temp - 1;
      else ans = max(ans,temp);
      temp -= que2.front();
      que2.pop();
      temp -= que2.front();
      que2.pop();
    }
    total += que.front();
    que.pop();
  }
  if(ans == -1) ans = temp - 1;
  else ans = max(ans,temp);

  cout << ans << endl;


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

#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std; 

//しゃくとり方でとく//
int main(void){
 int N,K;

 string S;
 vector<int> A;

 cin>>N>>K;
 cin>>S;

 int cnt=0;
 int now=0;

 for(int i=0; i<strlen(S);i++){
  if(S[i]==(char)('1'-now)){
   cnt++;
  }
  else{
   now=1-now;
   A.push_back(cnt);
   cnt=1;
  }
 }
 A.push_back(cnt);          
 
 if(A.size()%2==0)A.push_back(0);
 
 int sum,left,right,ans,nextleft,nextright;
 sum=0;
 left=0;
 right=0;
 nextleft=0;
 nextright=0;
 ans=0;
 
 for(int i=0; i<A.size();i+=2){
  nextleft=i;
  nextright=min(i+2*K+1,(int)A.size());

  while(nextleft>left){
   sum-=A[left];
   left++;
  }
  while(nextright>right){
   sum+=A[right];
   right++;
  }
  ans=max(sum,ans);
 }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:24:24: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   24 |  for(int i=0; i<strlen(S);i++){
      |                        ^
      |                        |
      |                        std::string {aka std::__cxx11::basic_string<char>}
In file included from a.cc:6:
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,k;
  cin >> n >>k;
  string S;
  cin>> S;
  
  int l=S.size();
  int s[l+1];
  
  //配列に移した
  for (int i=0;i<l;i++){
    if (S.at(i)=='0'){
      s[i]=0;
    }else{
      s[i]=1;
    }
  }
  
  s[l]=1;
  int c=0;
  for (int i=0;i<l;i++){
    if(s[l-1-i]==0&&s[l-i]==1){
      c++;
    }
  }
  
  //0と1が変わる境界の数を数える
  int d=1;
  int e=s[0];
  for (int i=0;i<l;i++){
    if(s[i]!=e){
      d++;
      e=s[i];
    }
  }
  e++;
  
  //今eは塊の列の数を表している
  //a[0][]は直立(0)か逆立ち(1)かを表せるようにし、a[1][]はそれぞれの数を表せるようにする
  int a[2][e];
  for (int i=0;i<e;i++){
    a[1][i]=0;
  }
  a[0][0]=s[1];
  
  int f=0;
  for (int i=0;i<l;i++){
    if (a[0][f]==s[i]){
      a[1][f]++;
    }else{
      f++;
      a[0][f]=s[i];
      a[1][f]++;
    }
  }
 
  int m;
  if(s[0]==0&&s[l]==0){
    m=(e+1)/2;
  }else{
    m=e/2;
  }
  
  int L=0;
  int M=0;
  for (int i=0;i<m-min(m,k)+1;i++){
    if(a[0][0]==1){
      for(int j=0;j<min(m,k);j++){
        L+=a[1][i+j];
    
  
  
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:76:2: error: expected '}' at end of input
   76 | }
      |  ^
a.cc:70:19: note: to match this '{'
   70 |     if(a[0][0]==1){
      |                   ^
a.cc:76:2: error: expected '}' at end of input
   76 | }
      |  ^
a.cc:69:35: note: to match this '{'
   69 |   for (int i=0;i<m-min(m,k)+1;i++){
      |                                   ^
a.cc:76:2: error: expected '}' at end of input
   76 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,k;
  cin >> n >>k;
  string S;
  cin>> S;
  
  int l=S.size();
  int s[l+1];
  
  //配列に移した
  for (int i=0;i<l;i++){
    if (S.at(i)=='0'){
      s[i]=0;
    }else{
      s[i]=1;
    }
  }
  
  s[l]=1;
  int c=0;
  for (int i=0;i<l;i++){
    if(s[l-1-i]==0&&s[l-i]==1){
      c++;
    }
  }
  
  //0と1が変わる境界の数を数える
  int d=1;
  int e=s[0];
  for (int i=0;i<l;i++){
    if(s[i]!=e){
      d++;
      e=s[i];
    }
  }
  e++;
  
  //今eは塊の列の数を表している
  //a[0][]は直立(0)か逆立ち(1)かを表せるようにし、a[1][]はそれぞれの数を表せるようにする
  int a[2][e];
  for (int i=0;i<e;i++){
    a[1][i]=0;
  }
  a[0][0]=s[i];
  
  int f=0;
  for (int i=0;i<l;i++){
    if (a[0][f]==s[i]){
      a[1][f]++;
    }else{
      f++;
      a[0][f]=s[i];
      a[1][f]++;
    }
  }
  
  
  
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:47:13: error: 'i' was not declared in this scope
   47 |   a[0][0]=s[i];
      |             ^
Language: Java


import java.util.ArrayList;
import java.util.Scanner;

public class ruiseki {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());//int型
		int k = Integer.parseInt(sc.next());
		String sline = sc.next();
		int[] s = new int[n];
		for (int i=0; i<n; i++){
			s[i] = Integer.parseInt(String.valueOf(sline.charAt(i)));
		}
		sc.close();
		// 1-0-1-...でいくつセットで並んでいるか.00011100101=0332101(最初1は0個並んでいる.
		
		ArrayList<Integer> nums = new ArrayList<Integer>();
		
		int now = 1;// 今見ている数
		int cnt = 0;// nowがいくつ並んでいるか
		for (int i=0; i<n; i++){
			if (s[i] == now) {
				cnt++;
			} else {
				nums.add(cnt);
				now = 1 - now;// これで0,1の入れ替えができる.
				cnt = 1;
			}
		}
		if(cnt != 0){
			nums.add(cnt);
		}
		// 1-0-1-...-0-1という形でほしい
		// 0で終わっている時は一つ足す
		if (nums.size() % 2 == 0) {
			nums.add(0);
		}

		int Add = 2*k + 1;
		/*
		 * 累積和を作る
		 * 0 1 2 3 4 5 6 累積和のインデックス
		 *  0 1 2 3 4 5  もとのインデックス
		 * s[i+1]=(i番目までの累積した和)
		 */
		
		int[] sum = new int[n+1];
		sum[0] = 0;
		for (int i = 0; i< nums.size(); i++) {
			sum[i+1] = sum[i] + nums.get(i);
		}
		
		int ans = 0;
		
		// 1-0-1-0-1と続くので偶数番目だけ見る
		for (int i = 0; i < nums.size(); i += 2) {
			/*
			 * 次のleft, rightを計算 [left, right)
			 */
			int left = i;
			int right = Math.min(i+Add, nums.size());
			int tmp = sum[right] - sum[left];
			
			ans = Math.max(tmp, ans);
		}
		System.out.println(ans);
	}
}


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

#include <fstream>
using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  ifstream ifs;
  
  string x;
  x = to_string(a);
  cout << x;
  ifs.open("\tmp", ios::in);
  if (ifs.fail()) { throw runtime_error(x); }

  cout << c + d;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> a >> b >> c >> d;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <fstream>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:11:3: error: 'cout' was not declared in this scope
   11 |   cout << x;
      |   ^~~~
a.cc:11:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    
    string s;
    cin >> s;
    
    int cntUp = 0;
    int cntDown = 0;
    vector<int> up;
    vector<int> down;
    for(int i = 0; i < n; i++) {
        if(s[i] == '0') {
            cntUp++;
        }
        else {
            cntDown++;
        }
        
        if(i == n - 1 || s[i] != s[i + 1]) {
            if(s[i] == '0') {
                up.push_back(cntUp);
                cntUp = 0;
            }
            else {
                down.push_back(cntDown);
                cntDown = 0;
            }
        }
    }
    
    if(k >= up.size()) {
        cout << n << endl;
    }
    else {
        int cnt = 0;
        for(int i = 0; i < k; i++) {
            cnt += up[i];
            cnt += down[i];
        }
        
        int ans = cnt;
        int index = 0;
        if(s[0] == '0') {
            while(k + index != up.size()) {
                if(index == 0) {
                    cnt -= up[index];
                }
                else {
                    cnt -= up[index];
                    cnt -= down[index];
                }
                
                cnt += up[k + index];
                if(k + index < down.size()) {
                    cnt += down[k + index];
                }
                
                if(ans < cnt) {
                    ans = cnt;
                }
                
                index++;
            }
        }
        else {
            cnt += down[k];
            
            while(k + index != up.size()) {
                cnt -= up[index] + down[index];
                
                cnt += up[k + index];
                if(k + index + 1 < down.size()) {
                    cnt += down[k + index + 1];
                }
                
                if(ans < cnt) {
                    ans = cnt;
                }
                
                index++;
            }
        }
        
        cout << ans << endl;
    }
    
    return 0;
}


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

#include <stdio.h>
#include <string.h>
int main(void){
	int n,k;
	scanf("%d%d\n",n,k);
	char s[n+1];
	scanf("%s",s);
	
	int i,l=0,j,countk,countl[n/2 +1],start;
	
	for(start = 0;start <= n;){
		countk = 0;
		for(j = start ; (countk < k)||(j < n);){
			if(s[j] == '1'){
				j++;
			}else{
				do{j++;}while(s[j] == '0');
				countk++;
				if(countk == 1){start = j;}
			}
		}
		do{j++;}while((s[j] == '1' )||(j <= n));
		countl[l] = j-start;
		l++;
	}
	int max=countl[0];
    for(i=0;i<l;i++){
        if(countl[0]<countl[i]){
            max=countl[i];
        }
    }
	printf("%d",max);

Compiler output:
main.c: In function 'main':
main.c:32:9: error: expected declaration or statement at end of input
   32 |         printf("%d",max);
      |         ^~~~~~
Language: C++

#include <vector>
#include <string>
 
int main(void){
	int N, K;
  	std::cin >> N >> K;
  	std::string str;
  	std::cin >> str;
  
  	int Length = str.size();
  	int K_limit = str[0] == '0' ? 2*K : 2*K+1;
  	std::vector<int> count;
  	count.resize(K_limit);
  
  	int result = 0;
  	int start = 0;
  	int loopVar = 0;
  	for(int i = 0; i < Length-1; ++i){
    	if(str[i] != str[i+1]){
          count[loopVar] = i - start + 1;
          start = i+1;
          ++loopVar;
          if(loopVar == K_limit){
        	loopVar = 0;
            int result_tmp;
            for(int j = 0; j < K_limit; ++j){
            	result_tmp += count[j];
            }
            result = result >= result_tmp ? result : result_tmp;
          }
      	}
      
      	if(i == Length-1) result = result >= i - start + 1 ? result : i - start + 1;
    }
  
  	std::cout << result << std::endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:14: error: 'cin' is not a member of 'std'
    6 |         std::cin >> N >> K;
      |              ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <string>
  +++ |+#include <iostream>
    3 | 
a.cc:8:14: error: 'cin' is not a member of 'std'
    8 |         std::cin >> str;
      |              ^~~
a.cc:8:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:36:14: error: 'cout' is not a member of 'std'
   36 |         std::cout << result << std::endl;
      |              ^~~~
a.cc:36:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:36:37: error: 'endl' is not a member of 'std'
   36 |         std::cout << result << std::endl;
      |                                     ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <string>
  +++ |+#include <ostream>
    3 |
Language: C++

#include <iostream>
#include <vector>
#include <string>

int main(void){
	int N, K;
  	std::cin >> N >> K;
  	std::string str;
  	std::cin >> str;
  
  	int Length = str.size();
  	int K_limit = str[0] == '0' ? 2*K : 2*K+1;
  	std::vector<int> count;
  	count.resize(K_limit);
  
  	int result = 0;
  	int start = 0;
  	for(int i = 0; i < Length-1; ++i){
    	if(str[i] != str[i+1]){
          count[loopVar] = i - start + 1;
          start = i+1;
          ++loopVar;
          if(loopVar == K_limit){
        	loopVar = 0;
            int result_tmp;
            for(int j = 0; j < K_limit; ++j){
            	result_tmp += count[j];
            }
            result = result >= result_tmp ? result : result_tmp;
          }
      	}
      
      	if(i == Length-1) result = result >= i - start + 1 ? result : i - start + 1;
    }
  
  	std::cout << result << std::endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'loopVar' was not declared in this scope
   20 |           count[loopVar] = i - start + 1;
      |                 ^~~~~~~
Language: C++

#include <stdio.h>

#define MAX 100000

int main() {
        int N, K;
        char S[MAX] = { '\0' };
        int Tidx[MAX] = { 0 };
        int i, j, idx, tidx;
        int max, tmp;

        scanf("%d %d", &N, &K);
        scanf("%s", S);

        i = 0;
        while (i < N) {
                Tidx[tidx++] = i;
                i = readSeq(S, i, N, &tmp);
                //tidx++;
        }

        max = -1;
        for (i = 0; i < tidx; i++) {
                int idx = Tidx[i];
                int tmp;
                if (S[idx] == '0') {
                        if (i + 2 * K < tidx) {
                                tmp = Tidx[i+2*K] - idx;
                        } else {
                                tmp = N - idx;
                        }
                } else if (S[idx] == '1') {
                        if (i + 2 * K + 1 < tidx) {
                                tmp = Tidx[i+2*K+1] - idx;
                        } else {
                                tmp = N - idx;
                        }
                }

                if (tmp > max) max = tmp;
        }

        printf("%d\n", max);

        return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'readSeq' was not declared in this scope
   18 |                 i = readSeq(S, i, N, &tmp);
      |                     ^~~~~~~
Language: C++

#include <stdio.h>

int main() {
        int N, K;
        char S[MAX] = { '\0' };
        int Tidx[MAX] = { 0 };
        int i, j, idx, tidx;
        int max, tmp;

        scanf("%d %d", &N, &K);
        scanf("%s", S);

        i = 0;
        while (i < N) {
                Tidx[tidx++] = i;
                i = readSeq(S, i, N, &tmp);
                //tidx++;
        }

        max = -1;
        for (i = 0; i < tidx; i++) {
                int idx = Tidx[i];
                int tmp;
                if (S[idx] == '0') {
                        if (i + 2 * K < tidx) {
                                tmp = Tidx[i+2*K] - idx;
                        } else {
                                tmp = N - idx;
                        }
                } else if (S[idx] == '1') {
                        if (i + 2 * K + 1 < tidx) {
                                tmp = Tidx[i+2*K+1] - idx;
                        } else {
                                tmp = N - idx;
                        }
                }

                if (tmp > max) max = tmp;
        }

        printf("%d\n", max);

        return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:16: error: 'MAX' was not declared in this scope
    5 |         char S[MAX] = { '\0' };
      |                ^~~
a.cc:11:21: error: 'S' was not declared in this scope
   11 |         scanf("%s", S);
      |                     ^
a.cc:15:17: error: 'Tidx' was not declared in this scope; did you mean 'tidx'?
   15 |                 Tidx[tidx++] = i;
      |                 ^~~~
      |                 tidx
a.cc:16:21: error: 'readSeq' was not declared in this scope
   16 |                 i = readSeq(S, i, N, &tmp);
      |                     ^~~~~~~
a.cc:22:27: error: 'Tidx' was not declared in this scope; did you mean 'tidx'?
   22 |                 int idx = Tidx[i];
      |                           ^~~~
      |                           tidx
Language: C++

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

int main() {
  int N, K;
  string line;
  cin >> N >> K;
  cin >> line;
  int now = 1;
  int cnt = 0;
  vector<int> lines;
  for (int i = 0; i < N; i++) {
    if (line[i] == (char)('0' + now)) {
      cnt++;
    } else {
      lines.push_back(cnt);
      now = 1 - now;
      cnt = 1;
    }
  }
  if (cnt != 0) {
    lines.push_back(cnt);
  }
  if (lines.size() % 2 == 0) {
    lines.push_back(0); // 1-0-1-0-1-...-0-1
  }
  ///
  int add = 2*K+1;
  int ans = 0;
  for (int i = 0; i < lines.size(); i+=2) {
    int tmp = 0;
    int left = i;
    int right = min(i + add, lines.size());
    for (int j = left; j < right; j++) {
      tmp += lines[j];
    }
    ans = max(tmp, ans);
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:20: error: no matching function for call to 'min(int, std::vector<int>::size_type)'
   35 |     int right = min(i + add, lines.size());
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 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:35:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   35 |     int right = min(i + add, lines.size());
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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:35:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   35 |     int right = min(i + add, lines.size());
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main () {
  int fro[100001];
  int ba[100001];
  int ju = 0;
  int N, K;
  cin >> N >> K;
  vector<char> hu(N + 4);
  for (int i = 2; i <= N + 1; i ++) cin >> hu[i];
  hu[0] = '0';
  fu[1] = '1';
  hu[N + 2] = '1';
  hu[N + 3] = '0';
  for (int i = 1; i < N; i ++) {
    if (hu[i - 1] == '0' && hu[i] == '1') fro[ju] = i;
    if (hu[i - 1] == '1' && hu[i] == '0') {
      ba[ju] = i;
      ju ++;
    }
  }
  if (ju - 1 <= K) {
    cout << N << endl:
    return 0;
  }
  vector<int>as(ju - K);
  for (int i = 0; i < ju - K; ju ++) {
    as[i] = ba[i + K] - fro[i];
    if (i == 0 || i == ju - K - 1) as[i] --;
  }
  sort(as.begin(), as.end());
  cout << as[ju - K - 1] << endl;
}
  
  
  
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'fu' was not declared in this scope; did you mean 'hu'?
   12 |   fu[1] = '1';
      |   ^~
      |   hu
a.cc:23:22: error: expected ';' before ':' token
   23 |     cout << N << endl:
      |                      ^
      |                      ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,k,a[N],x[N],dp[N],ji,ans;
int main()
{
	cin>>n>>k;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)a[i+1]=s[i]-'0';
	for(int i=1;i<=n;i++)x[i]=a[i]^a[i-1];
	for(int i=1;i<=n;i++)dp[i]=dp[i-1]+x[i];
	for(int i=1;i<=n;i++)
	{
		ji^=x[i];
		ans=max(ans,(upper_bound(dp+1,dp+n+1,k*2-(!ji)+dp[i])-dp)-i);
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:24: error: no matching function for call to 'max(int&, long int)'
   16 |                 ans=max(ans,(upper_bound(dp+1,dp+n+1,k*2-(!ji)+dp[i])-dp)-i);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:16:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   16 |                 ans=max(ans,(upper_bound(dp+1,dp+n+1,k*2-(!ji)+dp[i])-dp)-i);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:16:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |                 ans=max(ans,(upper_bound(dp+1,dp+n+1,k*2-(!ji)+dp[i])-dp)-i);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include <stdio.h>

int sum(int *hairetsu,int n){
	int sum_add=0;
	for(int num=0;num<n;num++){
		sum_add += hairetsu[num];
	}
	return sum_add;
}

int main(){
	char s[100001];
	int n,k;
	int a = scanf("%d%d%s", &n, &k, s);
	
	int cnt = 0;
	int init = s[0]=='0'?0:1;
	int h[100001] = {};
	int h_cnt = 0;
	
	h[0]+=1;
	for(int i=1;i<n;i++){
		if(s[i]!=s[i+1]){
			h[++h_cnt]+=1;
		}
		else{
			h[h_cnt]+=1
		}
	}
	h_cnt+=1
	//h_cnt is finally length of h_cnt
	
	int zero_num = 0;
	int max = 0;
	if(init){ //start with 1
		zero_num = h_cnt/2;
		if(zero_num<=k){
			max = n;
		}
		else{
			int sum_0 = sum(h,k*2+1);
			int max = sum_0;
			for(int j=0;j<=zero_num-k+1;j++){ //j is 0's location
				sum_0 = sum_0 - h[j*2] - h[j*2+1] + h[(j+k)*2+1] + h[(j+k+1)*2];
				if(max<=sum_0){
					max = sum_0;
				}
			}
		}
	}
	
	else{ //start with 0
		zero_num = h_cnt/2 +1;
		if(zero_num<=k){
			max = n;
		}
		else{
			int sum_0 = sum(h,k*2);
			int max = sum_0;
			for(int j=0;j<=zero_num-k+1;j++){ //j is 0's location
				sum_0 = sum_0 - h[j*2] - h[j*2+1] + h[(j+k)*2] + h[(j+k)*2+1];
				if(max<=sum_0){
					max = sum_0;
				}
			}
		}
	}
	printf("%d\n", max);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:27:36: error: expected ';' before '}' token
   27 |                         h[h_cnt]+=1
      |                                    ^
      |                                    ;
   28 |                 }
      |                 ~                   
main.c:30:17: error: expected ';' before 'int'
   30 |         h_cnt+=1
      |                 ^
      |                 ;
......
   33 |         int zero_num = 0;
      |         ~~~      
main.c:36:17: error: 'zero_num' undeclared (first use in this function)
   36 |                 zero_num = h_cnt/2;
      |                 ^~~~~~~~
main.c:36:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,k,a[N],x[N],dp[N],ji,ans;
int main()
{
	cin>>n>>k;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)a[i+1]=s[i]-'0';
	for(int i=1;i<=n;i++)x[i]=a[i]^a[i-1];
	for(int i=1;i<=n;i++)dp[i]=dp[i-1]+x[i];
	for(int i=1;i<=n;i++)
	{
		ji^=x[i];
		ans=max(ans,upper_bound(dp+1,dp+n+1,k*2-(!ji)+dp[i])-dp-i);
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:24: error: no matching function for call to 'max(int&, long int)'
   16 |                 ans=max(ans,upper_bound(dp+1,dp+n+1,k*2-(!ji)+dp[i])-dp-i);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:16:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   16 |                 ans=max(ans,upper_bound(dp+1,dp+n+1,k*2-(!ji)+dp[i])-dp-i);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:16:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |                 ans=max(ans,upper_bound(dp+1,dp+n+1,k*2-(!ji)+dp[i])-dp-i);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include <stdio.h>

int sum(int *hairetsu,int n){
	int sum_add=0;
	for(int num=0;num<n;num++){
		sum_add += hairetsu[num];
	}
	return sum_add;
}

int main(){
	char s[100001];
	int n,k;
	scanf("%d%d%s", &n, &k, s);
	
	int cnt = 0;
	int init = s[0]=='0'?0:1;
	int h[100001] = {};
	int h_cnt = 0;
	
	for(int i=1;i<n;i++){
		if(s[i-1]!=s[i]){
			h[h_cnt++]+=1;
		}
		else{
			h[h_cnt]+=1;
		}
	}
	//h_cnt is finally length of h_cnt
	
	int zero_num = 0;
	int max = 0;
	if(init){ //start with 1
		zero_num = h_cnt/2;
		if(zero_num<=k){
			max = n;
		}
		else{
			int sum_0 = sum(h,k*2+1);
			int max = sum_0;
			for(int j=0;j<=zero_num-k+1;j++){ //j is 0's location
				sum_0 = sum_0 - h[j*2] - h[j*2+1] + h[(j+k)*2+1] + h[(j+k+1)*2];
				if(max<=sum_0){
					max = sum_0;
				}
			}
		}
	}
	
	else{ //start with 0
		zero_num = h_cnt/2 +1;
		if(zero_num<=k){
			max = n;
		}
		else{
			int sum_0 = sum(h,k*2);
			int max = sum_0;
			for(int j=0;j<=zero_num-k+1;j++){ //j is 0's location
				sum_0 = sum_0 - h[j*2] - h[j*2+1] + h[(j+k)*2] + h[(j+k)*2+1];
				if(max<=sum_0){
					max = sum_0;
				}
			}
		}
	}
	printf('%d', max)
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:66:16: warning: multi-character character constant [-Wmultichar]
   66 |         printf('%d', max)
      |                ^~~~
main.c:66:16: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
   66 |         printf('%d', max)
      |                ^~~~
      |                |
      |                int
In file included from main.c:1:
/usr/include/stdio.h:363:43: note: expected 'const char * restrict' but argument is of type 'int'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
main.c:66:26: error: expected ';' before 'return'
   66 |         printf('%d', max)
      |                          ^
      |                          ;
   67 |         return 0;
      |         ~~~~~~
Language: Java

import java.util.*;

 
class Main {
 
    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {

        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        String s=sc.next();
        char[] si  = s.toCharArray();
        char s0='0';
        char s1='1';
        ArrayList<Integer> numS =new ArrayList<Integer>();
        int now = Character.getNumericValue(si[0]);;
        int count=0;
        //101111011->11412へ
        for(char curr:si){
            if(Character.getNumericValue(curr) == now){
                count++;
            }else{
                numS.add(count);
                now=1-now;
                count=1;
            }
        }
        if(cnt!=0)numS.add(count);
        if(numS.size()%2==0)numS.add(0);

        System.out.println(numS);
        int add= 2 * k + 1;
        int ans = 0;
        //11412
        for(int left = 0; left < numS.size(); left += 2)
        {
            int tmp =0;
            int right =Math.min(left + add,numS.size());

            for(int j = left; j < right; j++)
            {
                tmp += numS.get(j);
            }
            ans = Math.max(tmp,ans);
        }

        System.out.println(ans);
    }
}

Compiler output:
Main.java:29: error: cannot find symbol
        if(cnt!=0)numS.add(count);
           ^
  symbol:   variable cnt
  location: class Main
1 error
Language: C++

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

int main() {
    int N, K;
    cin >> N >> K;
    string S; cin >> S;
    vector<int> num;
    int now = 1;
    int cnt = 0;

    for(int i = 0; i < N; i++){
        if(S[i] == (char)('0' + now)) cnt++;
        else{
            num.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
        if(cnt != 0) num.push_back(cnt);
    }
    if(num.size() % 2 == 0) num.push_back(0);

    int Add = 2 * K + 1;
    int ans = 0;
    int left = 0;
    int right = 0;
    int tmp = 0;

    for(int i = 0; i < num.size(); i += 2){
        int Nextleft = i;
        int Nextright = min(i + Add, num.size());

        while(Nextleft > left){
            tmp -= num[left];
            left++;
        }
        
        while(Nextright > right){
            tmp += num[right];
            right++;
        }

        ans = max(tmp, ans);
    }

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:28: error: no matching function for call to 'min(int, std::vector<int>::size_type)'
   34 |         int Nextright = min(i + Add, num.size());
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~
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: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:34:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   34 |         int Nextright = min(i + Add, num.size());
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~
/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
Language: C++

#include <bits/stdc++.h>

using namespace std;

char sw_state(char state){
  if(state == '1'){
    return '0';
  }
  else {
    return '1';
  }
}

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

  char state = '1';
  
  vector<int> v;
  /* 最初が0から始まる場合は、１が0個という意味で、0を入れておく */
  
  int count = 0;
  for(int i = 0;i<N;i++){
    if(S[i] == state){
      count++;
    }
    else{
      state = sw_state(state);
      v.push_back(count);
      count = 1;
    }
  }

  if(count == 1){
    v.push_back(count);
  }

  if(S[(N-1)] == '0'){
    v.push_back(0);
  }

  /*
  for(int i=0;i<v.size();i++){
    cout << v[i] << endl;
  }
  */

  vector<int> csum(v.size() + 1); //0から始める
  for(int i=0;i<v.size();i++){
      csum[i+1] == csum[i] + v[i];
  }

  /*
  for(int i=0;i<v.size();i++){
    cout << csum[i] << endl;
  }
  */
  
  int result = 0;
  for(int i=0;i<v.size();i+=2){
    int left = i;
    int right = min(i+2*K+1,(int)(v.size()-1));
    result = max(result,(csum[right]- csum[left]));
    }
  }

  cout << result << endl;
  return 0;

}
  
  
  


Compiler output:
a.cc:71:3: error: 'cout' does not name a type
   71 |   cout << result << endl;
      |   ^~~~
a.cc:72:3: error: expected unqualified-id before 'return'
   72 |   return 0;
      |   ^~~~~~
a.cc:74:1: error: expected declaration before '}' token
   74 | }
      | ^