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

#include<iostream>
main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];}

Compiler output:
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];}
      | ^~~~
a.cc: In function 'int main()':
a.cc:2:12: error: 'intn' was not declared in this scope; did you mean 'int'?
    2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];}
      |            ^~~~
      |            int
a.cc:2:17: error: 'k' was not declared in this scope
    2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];}
      |                 ^
a.cc:2:19: error: 'a' was not declared in this scope
    2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];}
      |                   ^
a.cc:2:29: error: 's' was not declared in this scope
    2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];}
      |                             ^
a.cc:2:31: error: 'M' was not declared in this scope
    2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];}
      |                               ^
a.cc:2:33: error: 'i' was not declared in this scope
    2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];}
      |                                 ^
a.cc:2:45: error: 'n' was not declared in this scope
    2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];}
      |                                             ^
a.cc:2:112: error: 'ik' was not declared in this scope
    2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];}
      |                                                                                                                ^~
Language: C++

#include <cstdio>

#define MAX(x, y) (x < y) ? y : x

int main(void)
{
	int n, k;
	int data[100000] = {0};
	
	while (1){
		scanf("%d %d", &n, &k);
		if (n == 0 && k == 0) break;
		for (int i = 0; i < n; i++){
			scanf("%d", &data[i]);
		}
		
		for (int i = 0; i < n - 1; i++){
			if (data[j] < 0) data[j] *= 2;
		}
		
		for (int i = 0; i < n - 1; i++){
			data[i + 1] += data[i];
		}
		int max = 0;
		for (int i = 0; i <= (n - k); i++){
			int tmp = data[i + k] - data[i];
//			for (int j = i; j < (i + k); j++){
//				if (data[j] < 0) tmp += data[j];
//			}
			max = MAX(max, tmp);
		}
		
		/*
		int max = 0, tmp;
		for (int i = 0; i <= (n - k); i++){
			tmp = 0;
			for (int j = i; j < (i + k); j++){
				tmp += data[j];
			}
			max = MAX(max, tmp);
		}*/
		
		printf("%d\n", max);
	}
	
	return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:34: error: 'j' was not declared in this scope
   18 |                         if (data[j] < 0) data[j] *= 2;
      |                                  ^
Language: C++

#include <iostream>
using namespace std;

int main(){
	int n,k,max,buf,*a;
	
	while(1){
		cin >> n >> k;
		
		if(n || k){
			max = 0;
			
			a = new int[n];
			
			for(int i = 0; i < n; i++){
				cin >> a[i];
			}
			
			for(int i = 0; i <= n-k; i++){
				buf = 0;
				
				for(int j = 0; j < k; j++){
					buf += a[i+j];
				}
				
				if(max < buf){
					max = buf;
				}
			}
			
			cout << max << endl;
	}
	
	return 0;
}

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

import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			final int n = in.nextInt();
			final int k = in.nextInt();
			if (n == 0 && k == 0) { throw new RuntimeException(); }
			int max = Integer.MIN_VALUE, val = 0;
			Deque<Integer> deq = new ArrayDeque<Integer>(k);
			for (int i = 0; i < n; i++) {
				final int number = in.nextInt();
				if (i < k) {
					val += number;
				} else {
					final int f = deq.poll();
					val += (number - f);
				}
				deq.addLast(number);
				if (val > max) {
					max = val;
				}
			}
			System.out.println(max);
		}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.ArrayDeque;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Deque;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.Scanner;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
    5 | public class Main {
      | ^~~~~~
Language: C++

#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}

typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

const double EPS = 1e-10;

int main() {
	int n, k;
	ll result, tmp;

	cin >> n >> k;

	vi nums(n);
	result = -_UI64_MAX;

	REP(i, n) {
		cin >> nums[i];
	}

	REP(i, n-k+1) {
		tmp = 0;

		REP(j, k) {
			tmp += nums[i+j];
		}

		if(result < tmp) {
			result = tmp;
		}
	}

	cout << result << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:19: error: '_UI64_MAX' was not declared in this scope; did you mean 'UINT_MAX'?
   48 |         result = -_UI64_MAX;
      |                   ^~~~~~~~~
      |                   UINT_MAX
Language: C++

#include <stdio.h>
int main(){
while(1){
int k,n,i,x[100000];
long long int max,sum=0;
scanf("%d%d",&n,&k);
if(n==0 && k==0) break;
for(i=0;<n;i++){
scanf("%d",&x[i]);
}
for(i=0;i<k;i++){
sum+=x[i];
}
max=sum;
for(i=1;i<=n-k;i++){
for(j=i;j<i+k;j++){
sum=0;
sum+=x[j];
}
if(max<sum) max=sum;
}
printf("%lld\n",max);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: expected primary-expression before '<' token
    8 | for(i=0;<n;i++){
      |         ^
a.cc:16:5: error: 'j' was not declared in this scope
   16 | for(j=i;j<i+k;j++){
      |     ^
a.cc:24:2: error: expected '}' at end of input
   24 | }
      |  ^
a.cc:2:11: note: to match this '{'
    2 | int main(){
      |           ^
Language: C++

#include <stdio.h>
int main(){
	int n,k,i,max=0;
	int x[100001];
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++)[
	scanf("%d",&x[i]);
}
for(i=0;i<k;i++){
	max+=x[i];
}
	for(i=0;i<n-k;i++){
		if(x[i]<x[i+k]){
			max-=x[i];
			max+=x[i+k];
		}}
		printf("%d\n",max);
		return 0;
		}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:25: error: expression list treated as compound expression in initializer [-fpermissive]
    7 |         scanf("%d",&x[i]);
      |                         ^
a.cc:7:26: error: expected ',' before ';' token
    7 |         scanf("%d",&x[i]);
      |                          ^
      |                          ,
a.cc:7:26: error: expected identifier before ';' token
a.cc:7:26: error: expected ']' before ';' token
    7 |         scanf("%d",&x[i]);
      |                          ^
      |                          ]
a.cc: In lambda function:
a.cc:7:26: error: expected '{' before ';' token
a.cc: At global scope:
a.cc:9:1: error: expected unqualified-id before 'for'
    9 | for(i=0;i<k;i++){
      | ^~~
a.cc:9:9: error: 'i' does not name a type
    9 | for(i=0;i<k;i++){
      |         ^
a.cc:9:13: error: 'i' does not name a type
    9 | for(i=0;i<k;i++){
      |             ^
a.cc:12:9: error: expected unqualified-id before 'for'
   12 |         for(i=0;i<n-k;i++){
      |         ^~~
a.cc:12:17: error: 'i' does not name a type
   12 |         for(i=0;i<n-k;i++){
      |                 ^
a.cc:12:23: error: 'i' does not name a type
   12 |         for(i=0;i<n-k;i++){
      |                       ^
a.cc:17:23: error: expected constructor, destructor, or type conversion before '(' token
   17 |                 printf("%d\n",max);
      |                       ^
a.cc:18:17: error: expected unqualified-id before 'return'
   18 |                 return 0;
      |                 ^~~~~~
a.cc:19:17: error: expected declaration before '}' token
   19 |                 }
      |                 ^
Language: C++

#include<string>
#include<vector>
#include<algorithm>
#include<queue>

using namespace std;

int main()
{
	int n, k, num, ans, sam;
	
	while(cin >> n >> k)
	{
		queue<int> que;
		ans = 0;
		sam = 0;
		for(int i = 0; i < n; i++)
		{
			cin >> num;
			que.push(num);
			sam += num;
			if(que.size() == 3 )
			{
				if(ans < sam)
				{
					ans = sam;
				}
				sam -= que.front();
				que.pop();
			}
		}
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: 'cin' was not declared in this scope
   12 |         while(cin >> n >> k)
      |               ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include<queue>
  +++ |+#include <iostream>
    5 | 
a.cc:32:17: error: 'cout' was not declared in this scope
   32 |                 cout << ans << endl;
      |                 ^~~~
a.cc:32:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:32: error: 'endl' was not declared in this scope
   32 |                 cout << ans << endl;
      |                                ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include<queue>
  +++ |+#include <ostream>
    5 |
Language: C++

const int MAX_N = 1 << 17, INF = 1 << 24;
class BIT{
public:
	BIT(int _n)
		:n(_n){
		std::fill(bit, bit+n, 0);
	}
	int sum(int i){
		int s = 0;
		while(i > 0){
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}
	int add(int i, int x){
		while(i <= n){
			bit[i] += x;
			i += i & -i;
		}
	}
private:
	int bit[MAX_N], n;
};

int main(){
	int n, k;
	while(std::cin >> n >> k, n){
		BIT b(n+1);
		for(int i=1;i<=n;i++){
			int a_i;
			std::cin >> a_i;
			b.add(i, a_i);
		}

		int res = -INF;
		for(int i=1;i+k-1<=n;i++){
			res = std::max(res, b.sum(i+k-1) - b.sum(i-1));
		}

		std::cout << res << std::endl;
	}
}

Compiler output:
a.cc: In constructor 'BIT::BIT(int)':
a.cc:6:22: error: 'fill' is not a member of 'std'
    6 |                 std::fill(bit, bit+n, 0);
      |                      ^~~~
a.cc: In member function 'int BIT::add(int, int)':
a.cc:21:9: warning: no return statement in function returning non-void [-Wreturn-type]
   21 |         }
      |         ^
a.cc: In function 'int main()':
a.cc:28:20: error: 'cin' is not a member of 'std'
   28 |         while(std::cin >> n >> k, n){
      |                    ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | const int MAX_N = 1 << 17, INF = 1 << 24;
a.cc:32:30: error: 'cin' is not a member of 'std'
   32 |                         std::cin >> a_i;
      |                              ^~~
a.cc:32:30: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:38:36: error: 'max' is not a member of 'std'
   38 |                         res = std::max(res, b.sum(i+k-1) - b.sum(i-1));
      |                                    ^~~
a.cc:41:22: error: 'cout' is not a member of 'std'
   41 |                 std::cout << res << std::endl;
      |                      ^~~~
a.cc:41:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:41:42: error: 'endl' is not a member of 'std'
   41 |                 std::cout << res << std::endl;
      |                                          ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | const int MAX_N = 1 << 17, INF = 1 << 24;
Language: C++

#include <iostream>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>

using namespace std;

int main(int argc, char const* argv[])
{
    int n,k;
    while (cin >> n >> k) 
    {
        if (n == 0 && k==0) 
        {
            break;
        }
        vector<int> vec(n);
        vector<int> sum(n -k +1);
        int input;
        for (int i = 0; i < n; i++) 
        {
            cin >> vec[i];//input;
            //vec.push_back(input);
        }
        for (int i = 0; i < n - k + 1; i++) 
        {
            sum[i]=0;
            for (int j = 0; j < k; j++) 
            {
                sum[i] += vec[i + j];
                //cout << " " << vec[i+j] << endl;
            }
            //cout << "sum="<< sum[i] << endl;
        }
        //for (int i = 0; i < n-k+1; i++) 
        //{
        //    cout << vec[i]<<endl;
        //}
        sort(sum.begin(), sum.end() , greater<int>() );
        //for (int i = 0; i < n-k+1; i++) 
        //{
        //    cout << vec[i]<<endl;
        //}
        cout << sum[0];
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:41:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   41 |         sort(sum.begin(), sum.end() , greater<int>() );
      |         ^~~~
      |         short
Language: C++

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

#define rep(i, a, b) for(int i = (a); (i) < (b); i++)

using namespace std;

int main() {
	int n, k;
	while(cin >> n >> k, n) {
		vector<int> num;
		int tmp;
		rep(i, 0, n) {
			cin >> tmp;
			num.push_back(tmp);
		}

		int s = 0;
		rep(i, 1, n-k+1) {
			tmp = 0;
			rep(j, 0, k) {
				tmp += num[i+j-1];
			}

			if(s < tmp) s = tmp;
		}
	}

	cout << s << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: 's' was not declared in this scope
   31 |         cout << s << endl;
      |                 ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
#define debug(x) cout << #x << " = " << x << endl;
#define sq(x) ((x)*(x))

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;

int main(){
	int n, k;
	cin >> n >> k;
	queue<int> q;
	int sum = 0;
	int ans = -INT_MAX;
	rep(i, n){
		int a;
		cin >> a;
		sum += a;
		q.push(a);
		if(q.size() >= k){
			ans = max(ans, sum);
			sum -= q.front();
			q.pop();
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:20: error: 'INT_MAX' was not declared in this scope
   39 |         int ans = -INT_MAX;
      |                    ^~~~~~~
a.cc:17:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   16 | #include <bitset>
  +++ |+#include <climits>
   17 |
Language: C++

import sys

#fp = open("input.txt", "r")
fp = sys.stdin

while True:
    req = map(int, fp.readline()[:-1].split(" "))
    if req[0] + req[1] == 0:
        break

    n = req[0]
    k = req[1]

    sum_max = 0
    num_list = []
    
    for i in xrange(n):
        num = int(fp.readline()[:-1])
        num_list.append(num)
        if k > 0:
            sum_max += num
            k -= 1
            continue
        else:
            num_list.pop(0)
            sum_tmp = sum(num_list)
            if sum_tmp > sum_max:
                sum_max = sum_tmp

    print sum_max

Compiler output:
a.cc:3:2: error: invalid preprocessing directive #fp
    3 | #fp = open("input.txt", "r")
      |  ^~
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: Java

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int flagN = in.nextInt();
		int flagK = in.nextInt();
		while ((flagN != 0) && (flagK != 0)) {
			final int k = flagK;
			boolean has0 = false;
			NumTree nums = null;
			for (int i = 0; i < k; i++) {
				int num = in.nextInt();
				if (!has0 && (num == 0)) {
					has0 = true;
				} else if (nums == null) {
					nums = new NumTree(num);
				} else {
					nums = nums.put(num);
				}
			}
			System.out.println(nums.maxCount(has0));
			flagN = in.nextInt();
			flagK = in.nextInt();
		}
	}
}

class NumTree {
	int low, high;
	NumTree upperHigh = null;

	NumTree(int num) {
		this.low = num;
		this.high = num;
	}

	int count() {
		return (high - low) + 1;
	}

	int maxCount(boolean has0) {
		if (upperHigh == null) { return count(); }
		int upperMax = upperHigh.maxCount(has0);
		int count = count();
		if (has0 && ((upperHigh.low - 2) == high)) {
			count += upperHigh.count() + 1;
		}
		return Math.max(upperMax, count);
	}

	NumTree put(int num) {
		if (num <= (low - 2)) {
			NumTree result = new NumTree(num);
			result.upperHigh = this;
			return result;
		}
		if (num == (low - 1)) {
			low = num;
		} else if (num == (high + 1)) {
			high = num;
			if ((upperHigh != null) && ((high + 1) == upperHigh.low)) {
				high = upperHigh.high;
				upperHigh = upperHigh.upperHigh;
			}
		} else if (num > high) {
			if (upperHigh != null) {
				upperHigh = upperHigh.put(num);
			} else {
				upperHigh = new NumTree(num);
			}
		}
		return this;
	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner in = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner in = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			int flagN = Integer.parseInt(in.next());
			int flagK = Integer.parseInt(in.next());
			if (flagN == 0) {
				break;
			}
			int k = flagK;
			int[] array = new int[flagK];
			boolean has0 = false;
			NumTree nums = NumTree.QQQ;
			for (int i = 0; i < k; i++) {
				array[i] = Integer.parseInt(in.next());
			}
			for (int num : array) {
				if (!has0 && (num == 0)) {
					has0 = true;
				} else {
					nums = nums.put(num);
				}
			}
			System.out.println(nums.maxCount(has0));
		}
	}
}

class NumTree {
	static final NumTree QQQ = new NumTree(Integer.MAX_VALUE);
	int low, high;
	NumTree upperHigh = QQQ;

	NumTree(int num) {
		this.low = num;
		this.high = num;
	}

	int count() {
		return (high - low) + 1;
	}

	int maxCount(boolean has0) {
		if (upperHigh == QQQ) { return count(); }
		int upperMax = upperHigh.maxCount(has0);
		int count = count();
		if (has0 && ((upperHigh.low - 2) == high)) {
			count += upperHigh.count() + 1;
		}
		return Math.max(upperMax, count);
	}

	NumTree put(int num) {
		if (num <= (low - 2)) {
			NumTree result = new NumTree(num);
			result.upperHigh = this;
			return result;
		}
		if (num == (low - 1)) {
			low = num;
		} else if (num == (high + 1)) {
			high = num;
			if ((high + 1) == upperHigh.low) {
				high = upperHigh.high;
				upperHigh = upperHigh.upperHigh;
			}
		} else if (num > high) {
			if (upperHigh != QQQ) {
				upperHigh = upperHigh.put(num);
			} else {
				upperHigh = new NumTree(num);
			}
		}
		return this;
	}

Compiler output:
Main.java:77: error: reached end of file while parsing
	}
	 ^
1 error
Language: Java

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			int flagN = Integer.parseInt(in.next());
			int flagK = Integer.parseInt(in.next());
			if (flagN == 0) {
				break;
			}
			int k = flagK;
			int[] array = new int[flagK];
			boolean has0 = false;
			NumTree nums = NumTree.QQQ;
			for (int i = 0; i < k; i++) {
				array[i] = Integer.parseInt(in.next());
			}
			try {
				for (int num : array) {

					if (!has0 && (num == 0)) {
						has0 = true;
					} else {
						nums = nums.put(num);
					}

				}
			} catch (RuntimeException e) {
				System.out.println(3);
				nums = NumTree.QQQ;
			}
			System.out.println(nums.maxCount(has0));
		}
	}
}

class NumTree {
	static final NumTree QQQ = new NumTree(99999);
	long low = 0, high = 0;
	NumTree upperHigh = QQQ;

	NumTree(int num) {
		this.low = num;
		this.high = num;
	}

	long count() {
		return (high - low) + 1;
	}

	long maxCount(boolean has0) {
		long count = count();
		if (upperHigh == QQQ) { return count; }
		if (has0 && ((upperHigh.low - 2) == high)) {
			count += (((upperHigh.high - upperHigh.low) + 1) + 1);
		}
		long upperMax = upperHigh.maxCount(has0);
		return (upperMax < count) ? count : upperMax;
	}

	NumTree put(int num) {
		if (num <= (low - 2)) {
			NumTree result = new NumTree(num);
			result.upperHigh = this;
			return result;
		}
		if (num == (low - 1)) {
			low = num;
		} else if (num == (high + 1)) {
			high = num;
			if ((high + 1) == upperHigh.low) {
				high = upperHigh.high;
				upperHigh = upperHigh.upperHigh;
			}
		} else if (num > high) {
			if (upperHigh != QQQ) {
				upperHigh = upperHigh.put(num);
			} else {
				upperHigh = new NumTree(num);
			}
		}
		return this;
	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner in = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner in = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

public class Main2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		for(;;){


			int n = sc.nextInt(),k=sc.nextInt();
			if(n+k==0)break;
			int[] a = new int[n+1];
			
			int[] b = new int[n+2];
			int[] c = new int[n+2];
			for(int i=0;i<k;i++){
				a[sc.nextInt()]=1;
			}
			int max=-1;
			for(int i=1;i<=n;i++){
				if(a[i]==1){
					b[i]=b[i-1]+1;
					max=Math.max(max, b[i]);
				}
			}
			for(int i=n;i>=1;i--){
				if(a[i]==1){
					c[i]=c[i+1]+1;
					max=Math.max(max, c[i]);
				}
			}
			if(a[0]==1){
				for(int i=1;i<=n;i++){
					if(a[i]==0){
						max=Math.max(max, b[i-1]+c[i+1]+1);
					}
				}
			}
			System.out.println(max);
		}
	}
}

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

#include <cstdio>

using namespace std;

void CheckLongest(int& longest, int i, int j)
{
    if (longest < j - i + 1){
        longest = j - i + 1;
        //printf("length:%d\n\n", longest);
    }
}

int main()
{
    int n;
    int k;

    while (scanf("%d %d", &n, &k) * n != 0){
        char card[100005] = {0};
        int longest = 0;
        bool zero_flag;

        for (int i = 0; i < k; i++){
            int tmp;
            scanf("%d", &tmp);
            card[tmp] = 1;
        }

        zero_flag = card[0];
        for (int i = 1, j = 1; i <= n; ){
            //for (int k = i; k <= j || !printf("f:%d\n", zero_flag); k++) printf("%d ", k);
            if (card[j] != 1){
                if (j <= n && zero_flag){
                    zero_flag = false;
                    CheckLongest(longest, i, j);
                    j++;
                }
                else {
                    if (card[i] != 1){
                        zero_flag = card[0];
                    }
                    i++;
                    if (j < i){
                        j = i;
                    }
                }
            }
            else {
                CheckLongest(longest, i, j);
                j++;
            }
        }
        printf("%d\n", longest);
        //puts("");
    }

    return 0;
}

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

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

int main(){
	while (1){
		int n, k, a[100000] = {}, sam, b[1000] = {}, roop = 0, save[1000] = {0}, ans[1000] = {}, w = 0;
		cin >> n >> k;
		if (n == 0 || k == 0)
			break;
		for (int i = 0; i<k; i++){
			cin >> a[i];
		}
		sort(a, a + k);
		for (int i = 0; i<k; i++){
			if (a[i + 1] - a[i] == 1){
				sam++;
			}
			else if (a[i + 1] - a[i] != 1){
				b[roop] = sam+1;
				if(a[0]==0){
					if (a[i + 1] - a[i] == 2){
						save[w] = roop;
						w++;
					}
				}
				sam = 0;
				roop++;
			}
		}
		for (int i = 0; i <= roop; i++){
			if (save[i] != 0){
				ans[i] = b[save[i]];
				ans[i]+= b[save[i] + 1] + 1;
			}
		}
		sort(b, b + roop+1);
		sort(ans, ans + roop+1);
		if (ans[roop]>b[roop])
		cout << ans[roop] << endl;
		if (ans[roop] <= b[roop])
			cout << b[roop] << endl;
	}
	return 0;
}

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

while(n,k=gets.split.map &:to_i)[0]>0
l=(1..k).map{gets.to_i}.sort
d=l.each_cons(2).map{|i,j|"#{j-i}"}*""
r=l[0]>0?/1+/:/1+21*|1*21+|1+/
p d.scan(r).map(&:size).max+1
end

Compiler output:
a.cc:2:4: error: too many decimal points in number
    2 | l=(1..k).map{gets.to_i}.sort
      |    ^~~~
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while(n,k=gets.split.map &:to_i)[0]>0
      | ^~~~~
a.cc:2:24: error: expected unqualified-id before '.' token
    2 | l=(1..k).map{gets.to_i}.sort
      |                        ^
a.cc:3:37: error: expected unqualified-id before string constant
    3 | d=l.each_cons(2).map{|i,j|"#{j-i}"}*""
      |                                     ^~
Language: C++

#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

int main()
{
  while(1){
    int n,k;
    cin>>n>>k;
    if(!n&&!k){break;}
    else{
      int *a;
      a=new int[k];
      for(int i=0;i<k;i++){
	cin>>a[i];
      }
      
      sort(a,a+k);
      int lx=0,l=1;
      
      if(a[0]){
	for(int i=0;i<k-1;i++){
	  if(a[i]+1==a[i+1]){l++;}
	  else{
	    lx=(l>lx)?l:lx;
	    l=1;
	  }
	}

	lx=(l>lx)?l:lx;
      }

      else{
	int m=0;
	for(int i=1;i<k-1;i++){
	  if(a[i]+1==a[i+1]){l++;}
	  else if(a[i]+2==a[i+1]){
	    lx=(lx<l+m)?l+m:lx;
	    m=l+1;l=1;
	  }
	  else{
	    lx=(lx<l+m)?l+m:lx;
	    m=0;l=1;
	  }
	}

	lx=(lx<l+m)?l+m:lx;
      }
      
      cout<<lx<<endl;
      delete []a;
    }
  }
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:56:12: error: expected '}' at end of input
   56 |   return 0;
      |            ^
a.cc:8:1: note: to match this '{'
    8 | {
      | ^
Language: C++

while True:    
    n, k = map(int, raw_input().split())
    if n==0: break
    t = [0]*(n+2)
    for i in xrange(k):
        t[input()] += 1
    for i in xrange(2,n+1):
        if t[i] > 0: t[i] += t[i-1]
    ans = 0
    if t[0]==0:
        for x in t:
            if ans < x: ans = x
    else:    
        nt = []
        for i in xrange(2,n+2):
            if t[i]==0:
                t[i-t[i-1]] = t[i-1]
        for i in xrange(2,n+1):
            if t[i]==0:
                nt += [t[i-1]+1+t[i+1]]
            else: nt += [t[i]]
        for x in nt:
            if ans < x: ans = x
    print ans

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while True:
      | ^~~~~
Language: C++

#include<stdio.h>;main(){printf("7\n11\n53\n");}

Compiler output:
a.cc:1:18: warning: extra tokens at end of #include directive
    1 | #include<stdio.h>;main(){printf("7\n11\n53\n");}
      |                  ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <cstring>

using namespace std;

#define rep1(i,x) for(int i=1;i<=(x);++i)

int a[MAX_N + 1];
int memo[MAX_N + 1];
int start[MAX_N + 1];

int main()
{
	int N, K;
	while (cin >> N >> K, N || K) {
		memset(a, 0, sizeof(a));
		memset(memo, 0, sizeof(memo));
		memset(start, 0, sizeof(start));

		bool f = false;

		rep1(i, K) {
			int tmp; cin >> tmp;
			if (tmp == 0) f = true;
			else a[tmp] = true;
		}

		rep1(i, N) {
			if (a[i]) {
				if (i - 1 >= 0 && a[i - 1]) {
					start[i] = start[i - 1];
					memo[start[i]]++;
				} else {
					start[i] = i;
					memo[start[i]]++;
				}
			}
		}

		int ma = 0;
		int now = -1;

		rep1(i, N) {
			if (a[i]) {
				if (now == start[i]) continue;
				if (ma < memo[start[i]]) {
					ma = memo[start[i]];
					now = start[i];
				}
			} else if (f) {
				int v;
				if (i + 1 <= N && a[i - 1] && a[i + 1]) {
					v = memo[start[i - 1]] + memo[start[i + 1]] + 1;
					if (ma < v) {
						ma = v;
						now = start[i + 1];
					}
				} else if (a[i - 1]) {
					v = memo[start[i - 1]] + 1;
					if (ma < v) {
						ma = v;
						now = start[i - 1];
					}
				} else if (i + 1 <= N && a[i + 1]) {
					v = memo[start[i + 1]] + 1;
					if (ma < v) {
						ma = v;
						now = start[i + 1];
					}
				}
			}
		}

		cout << ma << endl;
	}
}

Compiler output:
a.cc:8:7: error: 'MAX_N' was not declared in this scope
    8 | int a[MAX_N + 1];
      |       ^~~~~
a.cc:9:10: error: 'MAX_N' was not declared in this scope
    9 | int memo[MAX_N + 1];
      |          ^~~~~
a.cc:10:11: error: 'MAX_N' was not declared in this scope
   10 | int start[MAX_N + 1];
      |           ^~~~~
a.cc: In function 'int main()':
a.cc:16:24: error: 'a' was not declared in this scope
   16 |                 memset(a, 0, sizeof(a));
      |                        ^
a.cc:17:24: error: 'memo' was not declared in this scope
   17 |                 memset(memo, 0, sizeof(memo));
      |                        ^~~~
a.cc:18:24: error: 'start' was not declared in this scope
   18 |                 memset(start, 0, sizeof(start));
      |                        ^~~~~
Language: C++

 
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int arr[100000+5]={0};
  
 int main()
 {
   int n,k;
 while(cin>>n>>k)
 {
   if(n==0&&k==0) break;
   int num;
   int count=0;
   bool flag_2=false;
   for(int i=0;i<k;i++)
   {
     cin>>num;
     if(num==0) flag_2=true;
     else
     {
       //count++;
       arr[num]++; 
     }         
   }
   //if(k-count==1) flag_2=true;
   int sum1=0;
   int sum2=0;
   int max=0;
   bool flag=false;
   int blank_num=0;
   for(int i=1;i<=n;i++)
   {
     while((i<=n)&&arr[i]&&(!flag))
     {
       if(flag_2==true&&(blank_num==1)) break;
       else
       {
         sum1++;
         i++;     
         if(sum1>max) max=sum1;
       }             
     }      
     //if(sum1>max) max=sum1;  
     if(i<=n&&arr[i]&&(flag_2)&&(blank_num==1))
     {
       while((i<=n)&&arr[i])
       {
         sum2++;
         i++;                     
       }
       if((sum1+sum2+1)>max)
       {
         max=sum1+sum2+1;
         flag=true;                 
       }
       sum1=sum2;
       sum2=0;
     }
     if(arr[i-1])
     {
       if(i<=n&&(!arr[i])) blank_num=1;
       if(i+1<=n&&(!arr[i+1])) blank_num=2;
       if(blank_num==2&&(flag_2))
       {
         sum1=0;
         flag=false;
       }
       if((blank_num==1||black_num==2)&&(!flag_2)) sum1=0;
     }
   }
   cout<<max<<endl;  
 }
 //while(1);     
 return 0;  
 }
 

Compiler output:
a.cc: In function 'int main()':
a.cc:83:26: error: 'black_num' was not declared in this scope; did you mean 'blank_num'?
   83 |        if((blank_num==1||black_num==2)&&(!flag_2)) sum1=0;
      |                          ^~~~~~~~~
      |                          blank_num
Language: C++

#include <bits/stdc++.h>  

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int N, K;
bool card[100010];

int main() {
	while(scanf("%d %d", &N, &K), N || K) {
		memset(card, false, sizeof(card));
		rep(i, K) {
			int c;
			scanf("%d", &c);
			card[c] = true;
		}
		if(!card[0]) {
			int cnt = 1, ans = 0;
			rep(i, K - 1) {
				if(card[i] && card[i + 1]) ++cnt;
				else {
					ans = max(ans, cnt);
					cnt = 1;
				}
			}
			printf("%d\n", ans);
		}
		else {
			int now, non, mini = 0, maxi = 0;
			FOR(i, 1, N + 1) if(!card[i]) {
				non = i;
				now = i + 1;
				break;
			}
			int ans = 0;
			FOR(i, now, N + 1) {
				if(!card[i]) {
					maxi = i - (mini) - 1;
					ans = max(ans, maxi);
					mini = non;
					non = i;
				}
			}
			maxi = i - (mini) - 1;
			printf("%d\n", ans);
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:32: error: 'i' was not declared in this scope
   53 |                         maxi = i - (mini) - 1;
      |                                ^
Language: C++

#include <iostream>
#include <cstdlib>

using namespace std;

int main(int argc, char **argv)
{
  int k, n, a[100001], s, t, p, q, r, j;

  while(1){
    cin >> n >> k;
    if(n == 0 && k == 0){
      break;
    }

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

    if(a[0] == 0){
      q = 1;
      while(a[q] == 0 && q < k){
	q++;
      }

      s = q;
      for(int i = q; i < k-1; i++){
	t = 1;
	p = q;
	j = i;
	while(j < k-1){
	  r = a[j+1]-a[j]-1;
	  if(r == 0){
	    t++;
	  } else if(p == r){
	    t += (1+p);
	    p -= r;
	  } else if(p > r){
	    t += r;
	    p -= r;
	  } else {
	    t += p;
	    break;
	  }
	  j++;
	}
	if(s < t){
	  s = t;
	}
      }
    } else {
      t = a[0];
      s = 1;
      for(int i = 1; i < k; i++){
	if(t+1 == a[i]){
	  p = 2;
	  i++;
	  while(a[i] == t+p && i < k){
	    i++;
	    p++;
	  }
	  if(s < p){
	    s = p;
	  }
	  if(i == k){
	    break;
	  }
	}
	t = a[i];
      }
    }
    cout << s << endl;
  }


  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   19 |     sort(a, a+k);
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<vector>

using namespace std;

vector<int> cards;

int MAX = 0;
int cont = 0;
int flg = false;
int use = false;

void saiki(int now_card);

int main()
{
	for(;;){
		int n, k, temp;
		int cont = 0;
		cards.clear();
		
		cin >> n;
		cin >> k;
		
		if(n == 0 && k == 0){
			break;
		}
		
		for(int i = 0; i < k; i++){
			cin >> temp;
			cards.push_back(temp);
		}
		
		//\[g
		sort(cards.begin(), cards.end());
		
		//J[h³µÅTõ
		for(int i = 0; i < k; i++){
	//		cout << cards[i] <<"ÌJ[hðTõ"<< endl;
			if(cards[i] == 0){
				//tOª§Á½º
	//			printf("flg >> on\n");
				flg = true;
			}
			else{
				saiki(i);
			}
		}
		
		//J[hAÅTõ
		if(flg == true){
			use = true;
			for(int i = 1; i < k; i++){
	//			cout <<"à¤êñ"<< cards[i] <<"ÌJ[hðTõ"<< endl;
				saiki(i);
				use = true;
			}
		}
		
		cout << MAX << endl;
	}
}


void saiki(int now_card)					//zñÌY¦
{
//	printf("¡ÌJ[h¨%d        ÌJ[h¨%d\n",cards[now_card],cards[now_card+1]);
	if(cards[now_card]+1 == cards[now_card+1]){
	//	printf("ÌJ[hÖ\n");
		cont++;
		saiki(now_card+1);
	}
	else{
		if(use == true && cards[now_card]+2 == cards[now_card+1]){
	//		printf("úßñÈæI\n");
			cont+=2;
			use = false;
			//cards[now_card]+1 == cards[now_card+1]Å éÆ·é
			saiki(now_card+1);
		}
		
	//	printf("****I¹:%dXebv****\n",cont+1);
		if(cont+1 > MAX){
			MAX = cont+1;
		}
		cont = 0;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   35 |                 sort(cards.begin(), cards.end());
      |                 ^~~~
      |                 short
Language: C++

#include<cstdio>
#include<cstring>
#define ma(a,b) (a>b?a:b)
int main(){
	int k[100001],a,b,table[2][100001];
	memset(k,0,sizeof(k));
	memset(table,0,sizeof(table));
	while(scanf("%d%d",&a,&b),a,b){
		for(int i=0;i<b;i++){
			int c;
			scanf("%d",&c);k[c]=1;
		}	
		int res=0;
		for(int i=1;i<=a;i++){
			if(k[i]){
				table[0][i]=table[0][i-1]+1;
			}
			else{
				if(k[0]){
					table[1][i]=table[0][i-1]+1;
				}
			}
			res=max(res,max(table[0][i],table[1][i]));
		}
		printf("%d\n",res);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:37: error: 'max' was not declared in this scope; did you mean 'ma'?
   23 |                         res=max(res,max(table[0][i],table[1][i]));
      |                                     ^~~
      |                                     ma
a.cc:23:29: error: 'max' was not declared in this scope; did you mean 'ma'?
   23 |                         res=max(res,max(table[0][i],table[1][i]));
      |                             ^~~
      |                             ma
Language: C++

1>------ ビルド開始: プロジェクト: AOJ, 構成: Debug Win32 ------
1>  0517.cpp
1>  AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe
========== ビルド: 1 正常終了、0 失敗、0 更新不要、0 スキップ ==========

Compiler output:
a.cc:3:22: error: stray '\' in program
    3 | 1>  AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe
      |                      ^
a.cc:3:28: error: stray '\' in program
    3 | 1>  AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe
      |                            ^
a.cc:3:37: error: stray '\' in program
    3 | 1>  AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe
      |                                     ^
a.cc:3:47: error: stray '\' in program
    3 | 1>  AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe
      |                                               ^
a.cc:3:66: error: stray '\' in program
    3 | 1>  AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe
      |                                                                  ^
a.cc:3:75: error: stray '\' in program
    3 | 1>  AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe
      |                                                                           ^
a.cc:3:79: error: stray '\' in program
    3 | 1>  AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe
      |                                                                               ^
a.cc:3:85: error: stray '\' in program
    3 | 1>  AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe
      |                                                                                     ^
a.cc:4:22: error: extended character 、 is not valid in an identifier
    4 | ========== ビルド: 1 正常終了、0 失敗、0 更新不要、0 スキップ ==========
      |                      ^
a.cc:4:34: error: extended character 、 is not valid in an identifier
    4 | ========== ビルド: 1 正常終了、0 失敗、0 更新不要、0 スキップ ==========
      |                                  ^
a.cc:4:42: error: extended character 、 is not valid in an identifier
    4 | ========== ビルド: 1 正常終了、0 失敗、0 更新不要、0 スキップ ==========
      |                                          ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 1>------ ビルド開始: プロジェクト: AOJ, 構成: Debug Win32 ------
      | ^
Language: C++

#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
struct Cards {
	int start,end;
	Cards(int _start,int _end) {start=_start,end=_end;}
};
vector<Cards> cards; 
int card[100000];
int main() {
	int n,k,i,j;
	bool blank;
	while(scanf("%d %d",&n,&k),n|k) {
		memset(card,0,sizeof(card));
		cards.clear();
		blank=0;
		for(i=0;i<k;i++) {
			scanf("%d",&card[i-blank]);
			if(card[i-blank]==0) blank=1;
		}
		k-=blank;
		sort(card,card+k);
		int ans=0;
		for(i=0;i<k;i++) {
			for(j=i+1;j<k;j++) {if((card[j]-card[j-1])!=1)break;}
			cards.push_back(Cards(card[i],card[j-1]));
			ans=max(ans,card[j-1]-card[i]+1);
			i=j-1;
		}
		if(!blank) {printf("%d\n",ans); continue;}
		for(i=0;i<cards.size();i++) {
			if(i==0) {
				if(cards[i].start>1)
					ans=max(ans,cards[i].end-cards[i].start+2);
			}else if((cards[i].start-cards[i-1].end)==2) {
				ans=max(ans,(cards[i].end-cards[i].start+1)+(cards[i-1].end-cards[i-1].start+1)+1);
			}
		}
		if(cards[i-1].end<n) ans=max(ans,(cards[i-1].end-cards[i-1].start+1));
		printf("%d\n",ans);
	}
}

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

#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
int x=1;
int main()
{
	while(x!=0){
    int n,k,a[10^5];
	cin >> n >> k;
	if(n==0&&k==0)return 0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		a[i]=a[i]-i;
	}
	sort(a,a+n);
	int b[10^5+2];
	memset(b,0,sizeof(b));
	for(int i=0;i<n;i++){
		b[a[i]]++;
	}
	int ans=0;
	for(int i=0;i<=100000;i++){
		ans=max(ans,b[i]+b[i+1]);
	}
	printf("%d\n",ans);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: warning: result of '10^5' is 15; did you mean '1e5'? [-Wxor-used-as-pow]
   12 |     int n,k,a[10^5];
      |                 ^
      |               ---
      |               1e
a.cc:12:15: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
   12 |     int n,k,a[10^5];
      |               ^~
      |               0xa
a.cc:21:9: error: 'memset' was not declared in this scope
   21 |         memset(b,0,sizeof(b));
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<algorithm>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

#include "stdio.h"
#include <queue>

using namespace std;

int main()
{
 int n,k;
 scanf("%d %d",&n,&k);
 priority_queue<int> q;
 for(int i = 0; i < k; i++)
 {
  int w;
  scanf("%d",&w);
  q.push(w);
 }
 int dp[2] = {0,0};
 int flg = 0;
 int max = 0;
 if(q.top() == 0)
 {
  flg = 1;
  q.pop();
 }
 for(int i = 0; i < n; i++)
 {
  if(q.empty() == true)
  {
   if(flg == 1)
   {
    if(max < dp[0] + 1)
    {
     max = dp[0] + 1;
    }
   }
   if(max < dp[0])
   {
    max = dp[0];
   }
   if(max < dp[1])
   {
    max = dp[1];
   }
   break;
  }
  if(q.top() == i)
  {
   dp[0]++;
   dp[1]++;
  }
  else
  {
   if(flg == 1)
   {
    if(max < dp[1])
    {
     max = dp[1];
    }
    dp[1] = dp[0] + 1;
   }
   if(max <　dp[0])
   {
    max = dp[0];
   }
   dp[0] = 0;
  }
 }
 printf("%d\n",max);
 return 0;
}

Compiler output:
a.cc:61:12: error: extended character 　 is not valid in an identifier
   61 |    if(max <　dp[0])
      |            ^
a.cc: In function 'int main()':
a.cc:61:12: error: '\U00003000dp' was not declared in this scope
   61 |    if(max <　dp[0])
      |            ^~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	while(1){
		int ans=0,p=0,n,k,x,a[100001]={},flag=0,sflag=0;
		vector<int> V;
		cin>>n>>k;
		if(n==0 && k==0)
			break;
		for(int i=0;i<k;i++){
			cin>>x;
			if(x==0)
			flag=1;
			a[x]=1;
		}
		for(int i=1;i<=n;i++){
			if(sflag==0 && a[i])
				sflag=1;
			if(sflag){
				if(a[i])
					p++;
				else{
					sflag=0;
					V.push_back(p);
					p=0;
				}
			}
		}
		V.push_back(p);
		if(flag){
			for(int i=0;i<V.size()-1;i++)
				ans=max(V[i]+V[i+1]+1,ans);
		}else{
			for(int i=0;i<V.size();i++)
				ans=max(V[i],ans);
		}
		endl<<ans<<endl;
	}
	return 0;
}

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

#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

#define MAX 100000

int main(){
  int N, K, in;

  while(scanf("%d%d" ,&N ,&K), (N | K)){
    bool found = false, used[MAX+2];
    vector<int> vec;
    int start = MAX;

    memset(used,false,sizeof(used));

    for(int i = 0 ; i < K ; i++){
      scanf("%d" ,&in);
     
      if(in){
	start = min(start, in);
	used[in] = true;
	vec.push_back(in);
      }else{
	found = true;
      }
    }

    int res = 1;
    if(found){
      start--;
      int cnt = 0, pos, p = 0;
      for(int i = start ; i <= N+1 ; i++){
	if(used[i]){
	  cnt++;
	}else{
	  p++;
	  if(p == 1){
	    pos = i + 1;
	    if(i != 0 || i != N+1){
	      cnt++;
	    }
	  }
	  if(i == 0) continue;
	  if(p == 2){
	    res = max(res,cnt);
	    p = 1;
	    cnt = i - pos + 1;
	    pos = i + 1;
	  }
	}

      }
    }else{
      sort(vec.begin(),vec.end());
      int cnt = 0;
      for(int i = 1 ; i < K ; i++){
	if(vec[i] - vec[i-1] == 1){
	  cnt++;
	  res = max(res,cnt);
	}else{
	  cnt = 1;
	}
      }
    }

    printf("%d\n" ,res);
  }

  return 0;
}

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

#include<iostream>
#include<cstdio>
#include<fstream>
using namespace std;
int main()
{
	int n,x[3000],y[3000];
	bool f[5001][5001];
	while(true){
		int ans=0;
		cin >> n;
		if(n==0)return 0;
		memset(f,false,sizeof(f));
		for(int i=0;i<n;i++){
			cin >> x[i] >> y[i];
			f[x[i]][y[i]]=true;
		}
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				int a,b,c,d;
				a=x[j]+y[i]-y[j];
				b=y[j]+x[j]-x[i];
				c=x[i]+y[i]-y[j];
				d=y[i]+x[j]-x[i];
				bool f1=false,f2=false;
				if(a>=0&&a<=5000&&b>=0&&b<=5000&&f[a][b])f1=true;
				if(c>=0&&c<=5000&&d>=0&&d<=5000&&f[c][d])f2=true;
			if(f1&&f2)ans=max(ans,(a-c)*(a-c)+(b-d)*(b-d));
		}
		}
		cout << ans << "\n";
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'memset' was not declared in this scope
   13 |                 memset(f,false,sizeof(f));
      |                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<fstream>
  +++ |+#include <cstring>
    4 | using namespace std;