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

#include<iostream>
using namespace std;int d[51][3210],n,m,s,i,j,k;int main(){while(cin>>n>>m>>s&&n){n*=n;memset(d,0,sizeof(d));d[0][0]=1;for(k=1;k<=m;k++)for(i=n;i;i--)for(j=k;j<=s;j++)d[i][j]=(d[i][j]+d[i-1][j-k])%100000;cout<<d[n][s]<<endl;}return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:88: error: 'memset' was not declared in this scope
    2 | using namespace std;int d[51][3210],n,m,s,i,j,k;int main(){while(cin>>n>>m>>s&&n){n*=n;memset(d,0,sizeof(d));d[0][0]=1;for(k=1;k<=m;k++)for(i=n;i;i--)for(j=k;j<=s;j++)d[i][j]=(d[i][j]+d[i-1][j-k])%100000;cout<<d[n][s]<<endl;}return 0;}
      |                                                                                        ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;int d[51][3210],n,m,s,i,j,k;int main(){while(cin>>n>>m>>s&&n){n*=n;memset(d,0,sizeof(d));d[0][0]=1;for(k=1;k<=m;k++)for(i=n;i;i--)for(j=k;j<=s;j++)d[i][j]=(d[i][j]+d[i-1][j-k])%100000;cout<<d[n][s]<<endl;}return 0;}
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	int dp1[50][3001];
	int dp2[50][3001];
	// x?????????, ?????¨???????¨???????y
	int mod=100000;
	int n,m,s;
	while(scanf("%d%d%d",&n,&m,&s)){
		if(n==0&&m==0&&s==0)
		break;
		
		memset(dp1,0,sizeof(dp1));
		dp1[0][0]=1;
		for(int i=1;i<=m;i++){
			memset(dp2,0,sizeof(dp2));
			for(int j=0;j<n*n+1;j++){
				for(int k=0;k<s+1;k++){
					//i???????????´???
					if(j<n*n&&k+i<=s){
						dp2[j+1][k+i]+=dp1[j][k];
						dp2[j+1][k+i]%=mod;
					}
					//??????????????´???
					dp2[j][k]+=dp1[j][k];
					dp2[j][k]%=mod;
				}
			}
			//dp2???dp1????????????
			for(int j=0;j<n*n+1;j++){
				for(int k=0;k<s+1;k++){
					dp1[j][k]=dp2[j][k];
				}
			}
		}
		printf("%d\n",dp1[n*n][s]);
	}
}

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

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>

using namespace std;

int main(){
	int dp1[50][3001];
	int dp2[50][3001];
	// x?????????, ?????¨???????¨???????y
	int mod=100000;
	int n,m,s;
	while(scanf("%d%d%d",&n,&m,&s)){
		if(n==0&&m==0&&s==0)
		break;
		
		memset(dp1,0,sizeof(dp1));
		dp1[0][0]=1;
		for(int i=1;i<=m;i++){
			memset(dp2,0,sizeof(dp2));
			for(int j=0;j<n*n+1;j++){
				for(int k=0;k<s+1;k++){
					//i???????????´???
					if(j<n*n&&k+i<=s){
						dp2[j+1][k+i]+=dp1[j][k];
						dp2[j+1][k+i]%=mod;
					}
					//??????????????´???
					dp2[j][k]+=dp1[j][k];
					dp2[j][k]%=mod;
				}
			}
			//dp2???dp1????????????
			for(int j=0;j<n*n+1;j++){
				for(int k=0;k<s+1;k++){
					dp1[j][k]=dp2[j][k];
				}
			}
		}
		printf("%d\n",dp1[n*n][s]);
	}
}

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

#include<cstdio>
#include<algorithm>

#define mod 100000

using namespace std;

int dp[50][3001];

int main(){
	int n,m,s;
	while(scanf("%d %d %d",&n,&m,&s)){
		if(n==0&&m==0&&s==0)
		break;
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		for(int i=1;i<=m;i++){
			for(int j=n*n;j>0;j--){
				for(int k=i;k<=s;k++){
					dp[j][k]=(dp[j][k]+dp[j-1][k-i])%mod;
				}
			}
		}
		printf("%d\n",dp[n*n][s]);
	}
}

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

#include<cstdio>
#include<algorithm>
#include<string>

#define mod 100000

using namespace std;

int dp[50][3001];

int main(){
	int n,m,s;
	while(scanf("%d %d %d",&n,&m,&s)){
		if(n==0&&m==0&&s==0)
		break;
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		for(int i=1;i<=m;i++){
			for(int j=n*n;j>0;j--){
				for(int k=i;k<=s;k++){
					dp[j][k]=(dp[j][k]+dp[j-1][k-i])%mod;
				}
			}
		}
		printf("%d\n",dp[n*n][s]);
	}
}

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


//y09-6 ビンゴ(2回目)
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int main(){
    ROOP(){
        int N,M,S;
        cin >> N >> M >> S;
        if(N==0) return 0;

        int dp[50][3001];
        for(int i=0; i<50; i++){
            for(int j=0; j<3001; j++){
                dp[i][j] = 0;
            }
        }
        dp[0][0] = 1;

        for(int i=1; i<=N*N; i++){
            for(int j=i; j<=S; j++){
                if(j>=i) dp[i][j] = dp[i-1][j-i] + dp[i][j-i];
                if(j>m) dp[i][j] -= dp[i-1][j-m-1];
                dp[i][j] %= 100000;
            }
        }
        cout << dp[N*N][S] << endl;

    }
    return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:47:22: error: 'm' was not declared in this scope
   47 |                 if(j>m) dp[i][j] -= dp[i-1][j-m-1];
      |                      ^
Language: C++


//y09-6 ビンゴ(2回目)
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int main(){
    ROOP(){
        int N,M,S;
        cin >> N >> M >> S;
        if(N==0) return 0;

        int dp[50][3001];
        for(int i=0; i<50; i++){
            for(int j=0; j<3001; j++){
                dp[i][j] = 0;
            }
        }
        dp[0][0] = 1;

        for(int i=1; i<=N*N; i++){
            for(int j=i; j<=S; j++){
                if(j>=i) dp[i][j] = dp[i-1][j-i] + dp[i][j-i];
                if(j>m) dp[i][j] -= dp[i-1][j-M-1];
                dp[i][j] %= 100000;
            }
        }
        cout << dp[N*N][S] << endl;

    }
    return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:47:22: error: 'm' was not declared in this scope
   47 |                 if(j>m) dp[i][j] -= dp[i-1][j-M-1];
      |                      ^
Language: C++

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

#define REP(i,n) for(i=0; i<(int)(n); i++)
#define rep(i,s,n) for(i=(s); i<(int)(n); i++)

typedef unsigned int uint;

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

#define MOD 100000

int n,m,s;
uint memo[2001][3001];
uint prevs[2][3001];
uint *prev, *prev2;

int main(){
  int i,j,k,x,y;
  while(1){
    n = getInt();
    m = getInt();
    s = getInt();

    if(n+m+s == 0) break;

    n = n * n;
    prev  = prevs[0];
    prev2 = prevs[1];

    REP(i,n){
      if(i == 0){
	REP(k,m+1) REP(j,s+1) memo[k][j] = 0;
	rep(x,1,m+1){
	  int xx = x * n;
	  if(xx > s) break;
	  memo[x][xx] = 1;
	}
      }else{
	memset(prev,0,sizeof(int)*s);

	if(i % 5 == 0){
	  rep(x,1,m+1){
	    //memcpy(prev2,memo[x],sizeof(int)*s);
	    rep(y,0,s+1-n+i){
	      prev2[y+(n-i)] = memo[x][y+(n-i)];
	      memo[x][y+(n-i)] = (memo[x-1][y] + prev[y]) % MOD;
	    }
	    uint *tmp = prev;
	    prev = prev2;
	    prev2 = tmp;
	  }
	}else{
	  rep(x,1,m+1){
	    //memcpy(prev2,memo[x],sizeof(int)*s);
	    rep(y,0,s+1-n+i){
	      prev2[y+(n-i)] = memo[x][y+(n-i)];
	      memo[x][y+(n-i)] = (memo[x-1][y] + prev[y]);
	    }
	    uint *tmp = prev;
	    prev = prev2;
	    prev2 = tmp;
	  }
	}
      }
    }

    int ans = 0;
    REP(i,m+1) ans = (ans + memo[i][s]) % MOD;

    printf("%d\n",ans);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int getInt()':
a.cc:13:10: error: 'isdigit' was not declared in this scope
   13 |   while(!isdigit(c)) c = getchar();
      |          ^~~~~~~
a.cc:14:9: error: 'isdigit' was not declared in this scope
   14 |   while(isdigit(c)){
      |         ^~~~~~~
Language: C++

#include <iostream>
using namespace std;

int dp[59][3001];
 
int main(void)
{
	while(1)
	{
		int num,max,sum;
		cin >> num >> max >> sum;
		if(num+max+sum == 0)
			return 0;
		memset(dp,0,sizeof(dp));
		dp[0][0] = 1;

		for(int m=1;m<=max;++m)//その数を使ッた時のあれ
		{
			for(int n=num*num;n>=1;--n)//どの数が使う？(num
			{
				for(int i=m;i<=sum;++i){//どの数が使う？(sum
					dp[n][i] += dp[n-1][i-m];//mを使った時の通り数を足す
					dp[n][i] %= 100000;
				}
			}
		}

		cout << dp[num*num][sum] << endl;
	}
		return 0;
}

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

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

int dp[59][3001];
 
int main(void)
{
	while(1)
	{
		int num,max,sum;
		cin >> num >> max >> sum;
		if(num+max+sum == 0)
			return 0;
		memset(dp,0,sizeof(dp));
		dp[0][0] = 1;

		for(int m=1;m<=max;++m)//その数を使ッた時のあれ
		{
			for(int n=num*num;n>=1;--n)//どの数が使う？(num
			{
				for(int i=m;i<=sum;++i){//どの数が使う？(sum
					dp[n][i] += dp[n-1][i-m];//mを使った時の通り数を足す
					dp[n][i] %= 100000;
				}
			}
		}

		cout << dp[num*num][sum] << endl;
	}
		return 0;
}

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

int dp[59][3001];
 
int main(void)
{
	while(1)
	{
		int num,max,sum;
		cin >> num >> max >> sum;
		if(num+max+sum == 0)
			return 0;
		memset(dp,0,sizeof(dp));
		dp[0][0] = 1;

		for(int m=1;m<=max;++m)//その数を使ッた時のあれ
		{
			for(int n=num*num;n>=1;--n)//どの数が使う？(num
			{
				for(int i=m;i<=sum;++i){//どの数が使う？(sum
					dp[n][i] += dp[n-1][i-m];//mを使った時の通り数を足す
					dp[n][i] %= 100000;
				}
			}
		}

		cout << dp[num*num][sum] << endl;
	}
		return 0;
}

Compiler output:
a.cc:38:5: error: redefinition of 'int dp [59][3001]'
   38 | int dp[59][3001];
      |     ^~
a.cc:5:5: note: 'int dp [59][3001]' previously declared here
    5 | int dp[59][3001];
      |     ^~
a.cc:40:5: error: redefinition of 'int main()'
   40 | int main(void)
      |     ^~~~
a.cc:7:5: note: 'int main()' previously defined here
    7 | int main(void)
      |     ^~~~
Language: C

#include<stdio.h>
#include<string.h>
#pragma warning(disable:4996)

int main(void){

	int n, m;
	char s[100002];
	int count;
	int i,ps;
	char *p;

	for (;;){

		scanf("%d", &n);
		if (n == EOF)break;
		scanf("%d", &m);
		scanf("%s", s);
		ps = m;
		p = s;
		while (ps > 0){
			p = strstr(p, "IOI");
			for (i = 3; p[i] = 'O' && p[i + 1] = 'I' && i <= 1 + 2 * n ; i+=2){
				if (i >= 1 + 2 * n){
					count++;
				}
			}
			p += 2;
			ps -= 2;
		}

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


	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:60: error: lvalue required as left operand of assignment
   23 |                         for (i = 3; p[i] = 'O' && p[i + 1] = 'I' && i <= 1 + 2 * n ; i+=2){
      |                                                            ^
Language: C

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

int main()
{
	int n,m,i,j,ans;	
	char str[1000000];
	while(1)
	{
		scanf("%d %d",&n,&m);
		if(n==0&&m==0)break;
		scanf("%s",str);
		i=2*n;
		ans=0;
		while(str[i]!='\0')
		{
			for(j=0;j<2*i+1;j++)
			{
				if(j%2==0 && str[i-j]!='J')
				{
					i++;
					break;	
				}
				if(j%2==1 && str[i-j]!='O')
				{
					i+=2;
					break;
				}
				if(j==2*i){
ans++;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:36:1: error: expected declaration or statement at end of input
   36 | }
      | ^
Language: C

c,n;main(x){for(;t=scanf("%d%*d ",&n),n;printf("%d\n",c))for(c=0;x=getchar()%5;)t=x-4?t%2?c+=t>2*n,t+1:2:t%2?1:t+1;}

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | c,n;main(x){for(;t=scanf("%d%*d ",&n),n;printf("%d\n",c))for(c=0;x=getchar()%5;)t=x-4?t%2?c+=t>2*n,t+1:2:t%2?1:t+1;}
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
    1 | c,n;main(x){for(;t=scanf("%d%*d ",&n),n;printf("%d\n",c))for(c=0;x=getchar()%5;)t=x-4?t%2?c+=t>2*n,t+1:2:t%2?1:t+1;}
      |   ^
main.c:1:5: error: return type defaults to 'int' [-Wimplicit-int]
    1 | c,n;main(x){for(;t=scanf("%d%*d ",&n),n;printf("%d\n",c))for(c=0;x=getchar()%5;)t=x-4?t%2?c+=t>2*n,t+1:2:t%2?1:t+1;}
      |     ^~~~
main.c: In function 'main':
main.c:1:5: error: type of 'x' defaults to 'int' [-Wimplicit-int]
main.c:1:18: error: 't' undeclared (first use in this function)
    1 | c,n;main(x){for(;t=scanf("%d%*d ",&n),n;printf("%d\n",c))for(c=0;x=getchar()%5;)t=x-4?t%2?c+=t>2*n,t+1:2:t%2?1:t+1;}
      |                  ^
main.c:1:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:1:20: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | c,n;main(x){for(;t=scanf("%d%*d ",&n),n;printf("%d\n",c))for(c=0;x=getchar()%5;)t=x-4?t%2?c+=t>2*n,t+1:2:t%2?1:t+1;}
      |                    ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | c,n;main(x){for(;t=scanf("%d%*d ",&n),n;printf("%d\n",c))for(c=0;x=getchar()%5;)t=x-4?t%2?c+=t>2*n,t+1:2:t%2?1:t+1;}
main.c:1:20: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | c,n;main(x){for(;t=scanf("%d%*d ",&n),n;printf("%d\n",c))for(c=0;x=getchar()%5;)t=x-4?t%2?c+=t>2*n,t+1:2:t%2?1:t+1;}
      |                    ^~~~~
main.c:1:20: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:41: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | c,n;main(x){for(;t=scanf("%d%*d ",&n),n;printf("%d\n",c))for(c=0;x=getchar()%5;)t=x-4?t%2?c+=t>2*n,t+1:2:t%2?1:t+1;}
      |                                         ^~~~~~
main.c:1:41: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:41: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:41: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:68: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
    1 | c,n;main(x){for(;t=scanf("%d%*d ",&n),n;printf("%d\n",c))for(c=0;x=getchar()%5;)t=x-4?t%2?c+=t>2*n,t+1:2:t%2?1:t+1;}
      |                                                                    ^~~~~~~
main.c:1:68: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
Language: C

char s[1000001];c[1000001];
main(n,m,i,r){for(;scanf("%d",&n),n;printf("%d\n",r)){
	for(memset(c,0,sizeof(c)),scanf("%d%s",&m,s),i=2;i<m;i++)if(s[i-2]=='I'&&s[i-1]=='O'&&s[i]=='I')c[i]=c[i-2]+1;
	for(i=r=0;i<m;i++)if(c[i]>=n)r++;
}

Compiler output:
main.c:1:17: warning: data definition has no type or storage class
    1 | char s[1000001];c[1000001];
      |                 ^
main.c:1:17: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(n,m,i,r){for(;scanf("%d",&n),n;printf("%d\n",r)){
      | ^~~~
main.c: In function 'main':
main.c:2:1: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'r' defaults to 'int' [-Wimplicit-int]
main.c:2:20: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    2 | main(n,m,i,r){for(;scanf("%d",&n),n;printf("%d\n",r)){
      |                    ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | char s[1000001];c[1000001];
main.c:2:20: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    2 | main(n,m,i,r){for(;scanf("%d",&n),n;printf("%d\n",r)){
      |                    ^~~~~
main.c:2:20: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:2:37: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    2 | main(n,m,i,r){for(;scanf("%d",&n),n;printf("%d\n",r)){
      |                                     ^~~~~~
main.c:2:37: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:2:37: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:2:37: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:3:13: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
    3 |         for(memset(c,0,sizeof(c)),scanf("%d%s",&m,s),i=2;i<m;i++)if(s[i-2]=='I'&&s[i-1]=='O'&&s[i]=='I')c[i]=c[i-2]+1;
      |             ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memset'
  +++ |+#include <string.h>
    1 | char s[1000001];c[1000001];
main.c:3:13: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
    3 |         for(memset(c,0,sizeof(c)),scanf("%d%s",&m,s),i=2;i<m;i++)if(s[i-2]=='I'&&s[i-1]=='O'&&s[i]=='I')c[i]=c[i-2]+1;
      |             ^~~~~~
main.c:3:13: note: include '<string.h>' or provide a declaration of 'memset'
main.c:5:1: error: expected declaration or statement at end of input
    5 | }
      | ^
Language: C

#include<stdio.h>

int main(){
	while(1){
		char ch;
		bool con=true;
		int cou=0;
		int m,n;
		int i,j;
		int ans=0;
		scanf("%d",&n);
		if(n==0)return 0;
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf(" %c",&ch);
			if(ch=='I'){
				if(!con){
					cou++;
					if(cou==n+1){
						ans++;
						cou--;
					}
				}
				else cou=1;
				con=true;
			}
			if(ch=='O'){
				if(!con)cou=0;
				con=false;
			}
		}
		printf("%d\n",ans);
	}
}

Compiler output:
main.c: In function 'main':
main.c:6:17: error: unknown type name 'bool'
    6 |                 bool con=true;
      |                 ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include<stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:6:26: error: 'true' undeclared (first use in this function)
    6 |                 bool con=true;
      |                          ^~~~
main.c:6:26: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:6:26: note: each undeclared identifier is reported only once for each function it appears in
main.c:29:37: error: 'false' undeclared (first use in this function)
   29 |                                 con=false;
      |                                     ^~~~~
main.c:29:37: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C++

#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
char P[2000002],str[1000000];
int main(){
    int n,f=1;
    for(int i=0;i<2000001;i++){
        if(f==1)P[i]='I';
        else P[i]='O';
        f*=-1;
    }
    while(cin>>n,n){
        int len;
        cin>>len;
        cin>>str;
        int cnt=0;
        for(int i=0;i<len;i++){
            if(i+1+2*n>m)break;
            if(!strncmp(str+i,P,n*2+1))cnt++;
        }
        cout<<cnt<<endl;
    }


}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:24: error: 'm' was not declared in this scope
   20 |             if(i+1+2*n>m)break;
      |                        ^
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main(){
	int n, k;
	while (cin >> n){
		int ans=0,size=0;
		string p = "I", s;
		cin >> k;
		for (int i = 0; i < n; i++){
			p += "OI";
		}
		cin >> s;
		for (int i = 0; i < s.size(); i++){
			if (s[i] == p[0]){
				if(s[i+1]==p[1]){
				size = 2;
				for (int j = 2; j < p.size(); j++){
					if (s[i + j] == p[j]){
						size++;
						if (size == p.size()){
							ans++;
						}
					}
				}
					else{
						break;
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:41: error: expected '}' before 'else'
   26 |                                         else{
      |                                         ^~~~
a.cc:16:49: note: to match this '{'
   16 |                                 if(s[i+1]==p[1]){
      |                                                 ^
a.cc:32:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |                 cout << ans << endl;
      |                         ^~~
      |                         abs
a.cc: At global scope:
a.cc:34:9: error: expected unqualified-id before 'return'
   34 |         return 0;
      |         ^~~~~~
a.cc:35:1: error: expected declaration before '}' token
   35 | }
      | ^
Language: C++

#include <iostream>
#include <string>


long main()
{

    while (1){
        long n = 0;
        long m = 0;
        long count = 0;
        std::string str = "";

        std::string check = "";

        std::cin >> n;

        if (n == 0) {
            break;
        }

        for (long i = 0; i < n; i++) {
            check += "I";
            check += "O";
            if (i == n - 1) {
                check += "I";
            }
        }

        std::cin >> m;

        std::cin >> str;

        std::string current;
        for (long i = 0; i < m; i++) {
            if (i >= m - 2 * n) {
                break;
            }

            for (long j = i; j < i + 2 * n + 1; j++) {
                if (j >= m) {
                    break;
                }
                current += str[j];
            }

            if (current == check) {
                count += 1;
            }

            current = "";



        }

        std::cout << count << std::endl;
    }
    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <iostream>
#include <string>


long main()
{

    while (1){
        long n = 0;
        long m = 0;
        long count = 0;
        std::string str = "";

        std::string check = "";

        std::cin >> n;

        if (n == 0) {
            break;
        }

        for (long i = 0; i < n; i++) {
            check += "I";
            check += "O";
            if (i == n - 1) {
                check += "I";
            }
        }

        std::cin >> m;

        std::cin >> str;

        std::string current;
        int next = 0;
        for (long i = 0; i < m; i++) {
            if (i >= m - 2 * n) {
                next +=1;
                break;
            }

            for (long j = i; j < i + 2 * n + 1; j++) {
                if (j >= m) {
                    next += 1;
                    break;
                }
                current += str[j];
            }

            if (next != 0) {
                break;
            }

            if (current == check) {
                count += 1;
            }

            current = "";



        }

        std::cout << count << std::endl;
    }
    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

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

char c[1000000];
int main() {
	int a, b;
	while (scanf("%d", &a), a) {
		scanf("%d%s",&b, c);
		int d = strlen(c);
		int s = 0;
		for (int e = 0; e < d; e++) {
			if (c[e] == 'I') {
				int k = 1;
				for (int f = e + 1; f < d; f++) {
					if (c[f - 1] == c[f]) { e = f - 1; break; }
					k++;
				}
				k++;
				k /= 2;
				if (k > a)s += k - a;
			}
		}
		printf("%d\n", s);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:25: error: 'strlen' was not declared in this scope
   12 |                 int d = strlen(c);
      |                         ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<cstdio>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m,c=0,i;
  string s;
  while(cin>>n,n){
  cin>>m>>s;
  for(i=0;i<m-2;i++){
    if(s[i]=='l'&&s[i+1]=='O'&&s[i+2]=='l')c++;
  }
  cout<<c<<endl;
  }

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

int main(){
  int n;
  while(cin>>n,n){
    int len;
    cin>>len;
    string str;
    cin>>str;
    int ans=0;
    for(int i=0;i<len-2;i++)
      if(str[i]=='I'&&str[i+1]=='O'&&str[i+2]=='I') ans++,i++;
    cout <<ans<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'cin' was not declared in this scope
    3 |   while(cin>>n,n){
      |         ^~~
a.cc:6:5: error: 'string' was not declared in this scope
    6 |     string str;
      |     ^~~~~~
a.cc:7:10: error: 'str' was not declared in this scope; did you mean 'std'?
    7 |     cin>>str;
      |          ^~~
      |          std
a.cc:11:5: error: 'cout' was not declared in this scope
   11 |     cout <<ans<<endl;
      |     ^~~~
a.cc:11:17: error: 'endl' was not declared in this scope
   11 |     cout <<ans<<endl;
      |                 ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<string.h>
#include<string>
#include<windows.h>

using namespace std;

void make_pn(int n);
int find_IOI(char pn[], char str[]);
char func_pn[1000000];
char str[1000000];
char IO[] = "IO";
int n, m, total;
bool isKisu;

int main()
{
	for(;;){
		total = 0;
		cin >> n;
		if(n == 0){
			break;
		}
		cin >> m;
		vector<char> str2(m);
		vector<char> Pn(n);
		if(n % 2 == 0){
			isKisu = 0;
		}
		else{
			isKisu = 1;
		}
		
		scanf("%s",str);
		
		make_pn(n);
		strcpy(&str2[0], &str[0]);
		strcpy(&Pn[0], &func_pn[0]);
		
		find_IOI(&Pn[0], &str2[0]);
		cout << total << endl;
	}
}

void make_pn(int n)
{
	int i, cont = 0;
	for(int i = 0; i < n; i++){
		strcpy(&func_pn[cont], IO);
		cont += 2;
	}
	func_pn[cont] = 'I';
	func_pn[cont+1] = '\0';
}

int find_IOI(char pn[], char str[]){
	int cont = 0, i;
	int len;
	bool flg = 1;
	
/*	for(int i = 0;str[i] != '\0' ; i++){
		cout << str[i];
	}
	cout << endl;
*/
	len = strlen(str);
	for(i = 0; i < len; i++){		//iÔÚÅ©Â¯½
		if(str[i] == 'I'){
			break;
		}
	}
//	cout << i << "ÔÚ¶áË"<< endl;
	vector<char> sub(2*n+1);
	
	for(int j = i;; j++){
		sub[cont] = str[j];
//		printf("sub[%d] = %c\n",cont,sub[cont]);
		if(cont+1 == 2*n+1){
			break;
		}
		cont++;
	}
	
	for(int j = 0; j < 2*n+1; j++){
		/*
		cout << strcmp(&pn[j], &sub[j]) <<endl;
		if(strcmp(&pn[j], &sub[j]) != 0){
			cout << strcmp(&pn[j], &sub[j]) << endl;
			flg = 0;
			break;
		}
		cout<< "*"<<endl;
		*/
		if(pn[j] != sub[j]){
			flg = 0;
			break;
		}
	}
	if(flg == 1){
		total++;
	}
/*	else{
		cout << "áÁ½c" << endl;
	}
*/
	if(len == 0){
		return 0;
	}
	else{
//		cout << "strlen = "<< len<<"\n" << endl;
		return find_IOI(&pn[0],&str[i+1]);
	}
}
		

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

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

int *buildFail(char *p) {
  int m = strlen(p);
  int *fail = new int[m+1];
  int j = fail[0] = -1;
  for (int i = 1; i <= m; ++i) {
    while (j >= 0 && p[j] != p[i-1]) j = fail[j];
    fail[i] = ++j;
  }
  return fail;
}
int match(char *t, char *p, int *fail) {
  int n = strlen(t), m = strlen(p);
  int count = 0;
  for (int i = 0, k = 0; i < n; ++i) {
    while (k >= 0 && p[k] != t[i]) k = fail[k];
    if (++k >= m) {
      ++count; // match at t[i-m+1 .. i]
      k = fail[k];
    }
  }
  return count;
}

int main(){
	int n,m;
	char in[1000010];
	char str[1000010];
	
	while(scanf("%d",&n),n!=0){
		scanf("%d %s",&m,in);
		for(int i=1; i<=2*n+1; i+=2){
			str[i-1] = 'I';
			str[i] = 'O';
		}
		str[2*n+1] = 0;
		//puts(str);
		printf("%d\n",match(in,str,buildFail(str)));
	}
	return 0;
}

Compiler output:
a.cc: In function 'int* buildFail(char*)':
a.cc:7:11: error: 'strlen' was not declared in this scope
    7 |   int m = strlen(p);
      |           ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 | #include <string>
a.cc: In function 'int match(char*, char*, int*)':
a.cc:17:11: error: 'strlen' was not declared in this scope
   17 |   int n = strlen(t), m = strlen(p);
      |           ^~~~~~
a.cc:17:11: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:21:16: error: 'm' was not declared in this scope
   21 |     if (++k >= m) {
      |                ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main()
{
  int n,m,ans,c[1000001];
  string s;
  while(cin>>n>>m>>s,n){
    memset(c,0,sizeof(c));
    for(int i=m-3;i>=0;i--){
      if(s.substr(i,3)=="IOI")c[i]=c[i+2]+1;
    }
    ans=0;
    for(int i=0;i<m;i++)cout<<c[i]<<", ";
    puts("");
    for(int i=0;i<m;i++)if(c[i]>=n)ans++;
    cout<<ans<<endl;
  }
}

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

#include<iostream>
#include<string>
#include<cmemory>
using namespace std;
int main()
{
  int n,m,ans,c[1000001];
  string s;
  while(cin>>n>>m>>s,n){
    memset(c,0,sizeof(c));
    for(int i=m-3;i>=0;i--){
      if(s.substr(i,3)=="IOI")c[i]=c[i+2]+1;
    }
    ans=0;
    for(int i=0;i<m;i++)cout<<c[i]<<", ";
    puts("");
    for(int i=0;i<m;i++)if(c[i]>=n)ans++;
    cout<<ans<<endl;
  }
}

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

#include<iostream>
main(){
int n,m,i,a,c[1000001];
for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))
for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)-"IOI"?0:c[i+2]+1;
}

Compiler output:
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:5:46: error: no match for 'operator-' (operand types are 'std::__cxx11::basic_string<char>' and 'const char [4]')
    5 | for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)-"IOI"?0:c[i+2]+1;
      |                                 ~~~~~~~~~~~~~^~~~~~
      |                                         |     |
      |                                         |     const char [4]
      |                                         std::__cxx11::basic_string<char>
In file included from /usr/include/c++/14/string:48,
                 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_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:5:47: note:   'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
    5 | for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)-"IOI"?0:c[i+2]+1;
      |                                               ^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:5:47: note:   'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
    5 | for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)-"IOI"?0:c[i+2]+1;
      |                                               ^~~~~
Language: C++

#include<cstdio>
main(){int n,m,i,a,c[1000001];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}

Compiler output:
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){int n,m,i,a,c[1000001];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}
      | ^~~~
a.cc: In function 'int main()':
a.cc:2:40: error: 'string' is not a member of 'std'
    2 | main(){int n,m,i,a,c[1000001];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}
      |                                        ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    1 | #include<cstdio>
  +++ |+#include <string>
    2 | main(){int n,m,i,a,c[1000001];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}
a.cc:2:54: error: 'cin' is not a member of 'std'
    2 | main(){int n,m,i,a,c[1000001];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}
      |                                                      ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cstdio>
  +++ |+#include <iostream>
    2 | main(){int n,m,i,a,c[1000001];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}
a.cc:2:65: error: 's' was not declared in this scope
    2 | main(){int n,m,i,a,c[1000001];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}
      |                                                                 ^
Language: C++

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

int main(){
int n,m,ans;
string a,b;
char s[1000000];
while(cin>>n){
ans=0;
a="I";
for(int i=0;i<n;i++){
a+="OI";}
cin>>m;
for(int i=0;i<m;i++){
cin>>s[i];}
for(int i=0;i<m-2n-1;i++){
b="";
if(s[i]="I"){
for(int j=i;j<2n+i+1;j++){
b+=s[j];}}
if(a==b){ans++;}
cout<<ans<<endl;}}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: unable to find numeric literal operator 'operator""n'
   17 | for(int i=0;i<m-2n-1;i++){
      |                 ^~
a.cc:19:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   19 | if(s[i]="I"){
      |         ^~~
      |         |
      |         const char*
a.cc:20:15: error: unable to find numeric literal operator 'operator""n'
   20 | for(int j=i;j<2n+i+1;j++){
      |               ^~
a.cc:23:19: error: expected '}' at end of input
   23 | cout<<ans<<endl;}}
      |                   ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <string>
#include <vector>
using namespace std;
vector<int> V;
int main() {
	int n,m;
	while(cin>>n,n) {
		cin>>m;
		string str;
		cin>>str;
		V.clear();
		int i;
		for(i=0;i<(m-2);i++) {
			if(str.substr(i,3)=="IOI") {
				int count=1;
				for(i+=3;i<(m-1);i+=2) {
					if(str.substr(i,2)=="OI") count++; else break;
				}
				V.push_back(count);
				i--;
			}
		}
		int sum=0;
		for(i=0;i<V.size();i++) {
			if(V[i]>=n) sum+=(V[i]-n+1);
		}
		cout<<sum<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:15: error: 'cin' was not declared in this scope
    7 |         while(cin>>n,n) {
      |               ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <vector>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:27:17: error: 'cout' was not declared in this scope
   27 |                 cout<<sum<<endl;
      |                 ^~~~
a.cc:27:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:28: error: 'endl' was not declared in this scope
   27 |                 cout<<sum<<endl;
      |                            ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <vector>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C

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

#define D_MAX 1000000000
#define N_MAX 100000
#define M_MAX 10000
#define TRUE  1
#define FALSE 0

int ad[N_MAX+1];
int ak[M_MAX+1];
int awork[N_MAX+1];

  /* 配列 x[ ] の left から right の要素のマージソートを行う */
void MergeSort(int x[ ], int left, int right)
{
    int mid, i, j, k;
	
    if (left >= right)              /* 配列の要素がひとつなら */
        return;                     /* 何もしないで戻る */

                                    /* ここでは分割しているだけ */
    mid = (left + right) / 2;       /* 中央の値より */
    MergeSort(x, left, mid);        /* 左を再帰呼び出し */
    MergeSort(x, mid + 1, right);   /* 右を再帰呼び出し */

      /* x[left] から x[mid] を作業領域にコピー */
    for (i = left; i <= mid; i++)
        awork[i] = x[i];

      /* x[mid + 1] から x[right] は逆順にコピー */
    for (i = mid + 1, j = right; i <= right; i++, j--)
        awork[i] = x[j];

    i = left;         /* i とj は作業領域のデーターを */
    j = right;        /* k は配列の要素を指している */

    for (k = left; k <= right; k++)    /* 小さい方から配列に戻す */
        if (awork[i] <= awork[j])        /* ここでソートされる */
            x[k] = awork[i++];
        else
            x[k] = awork[j--];
}

void input(void){
	int i;
	scanf("%d",&d);
	if( d != 0){
		scanf("%d",&n);
		scanf("%d",&m);
		ad[1] = 0;
		for( i=2; i<=n; i++){
			scanf("%d",&ad[i]);
		}
		for( i=1; i<=m; i++){
			scanf("%d",&ak[i]);
		}
	}
}

int main(void){
	int i;
	int sumDist = 0;
	while( 1 ){
		input();
		if( d == 0 ){
			break;
		}
		MergeSort( ad, 1, n);
		for( i=1; i<=m; i++){
			sumDist += calcDist(ak[i]);
		}
		printf("%d\n",sumDist);
		sumDist = 0;
	}
}




Compiler output:
main.c: In function 'input':
main.c:47:21: error: 'd' undeclared (first use in this function)
   47 |         scanf("%d",&d);
      |                     ^
main.c:47:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:49:29: error: 'n' undeclared (first use in this function)
   49 |                 scanf("%d",&n);
      |                             ^
main.c:50:29: error: 'm' undeclared (first use in this function)
   50 |                 scanf("%d",&m);
      |                             ^
main.c: In function 'main':
main.c:66:21: error: 'd' undeclared (first use in this function)
   66 |                 if( d == 0 ){
      |                     ^
main.c:69:35: error: 'n' undeclared (first use in this function)
   69 |                 MergeSort( ad, 1, n);
      |                                   ^
main.c:70:30: error: 'm' undeclared (first use in this function)
   70 |                 for( i=1; i<=m; i++){
      |                              ^
main.c:71:36: error: implicit declaration of function 'calcDist' [-Wimplicit-function-declaration]
   71 |                         sumDist += calcDist(ak[i]);
      |                                    ^~~~~~~~
Language: C

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

#define D_MAX 1000000000
#define N_MAX 100000
#define M_MAX 10000
#define min(x,y) (((x)<(y))?(x):(y))

int d;
int n;
int m;

int ad[N_MAX+1];
int ak[M_MAX+1];
int temp[N_MAX+1]; 

void MergeSort(int array[],int left,int right){
  int awork[N_MAX+1];
  int mid;
  int i;
  int j;
  int x;
  int y;
  
  if( left >= right ){
    return;
  }
  
  mid = (left + right) / 2;
  MergeSort( array, left, mid);
  MergeSort( array, mid+1, right);
  
  for( i=left; i<=mid; i++){
    awork[i] = array[i];
  }
  
  j = right;
  for( i=mid+1; i<=right; i++){
    awork[i] = array[j];
    j--;
  }
  
  x = left;
  y = right;
  
  for( i=left; i<=right; i++){
    if(awork[x] <= awork[y]){
      array[i] = awork[x];
      x++;
    }else{
      array[i] = awork[y];
      y--;
    }
  }
}


int calcDist(int k){
  int i;
  int j = 0;
  int sum = 0;
  int diff;
  int preDiff = 0;
  int minDist = d;
  int tmpDist;
  int halfDist = d >> 1;
  
  for( i=1; i<=m; i++){
    while(ad[j] > ak[i]){
      j++;
    }
    minDist = min( abs(ad[j-1]-ak[i]),abs(ad[j]-ak[i]) );
    sum += minDist;
  }
  return sum;
}

void input(void){
  int i;
  scanf("%d",&d);
  if( d != 0){
    scanf("%d",&n);
    scanf("%d",&m);
    ad[0] = 0;
    for( i=1; i<=n-1; i++){
      scanf("%d",&ad[i]);
    }
    ad[n] = d;
    for( i=1; i<=m; i++){
      scanf("%d",&ak[i]);
    }
  }
}

int main(void){
  int i;
  int sumDist = 0;
  while( 1 ){
    input();
    if( d == 0 ){
      break;
    }
    MergeSort( ad, 0, n);
    MergeSort( ak, 1, m)
    for( i=1; i<=m; i++){
      sumDist += calcDist(ak[i]);
    }
    printf("%d\n",sumDist);
    sumDist = 0;
  }
}




Compiler output:
main.c: In function 'main':
main.c:104:25: error: expected ';' before 'for'
  104 |     MergeSort( ak, 1, m)
      |                         ^
      |                         ;
  105 |     for( i=1; i<=m; i++){
      |     ~~~
Language: C

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

int i,j,k;
int d,n,m,a[1000000005],x,ans=0;

int main(){
	scanf("%d",&d);
	while(d!=0){
		for(i=0;i<=d;i++)a[i]=0;
		a[0]=1,a[d]=1;
		scanf("%d",&n);
		scanf("%d",&m);
		for(i=0;i<n-1;i++){
			scanf("%d",&x);
			a[x]=1;
		}
		for(i=0;i<m;i++){
			scanf("%d",&x);
			j=0;
			while(a[x-j]==0)j++,ans++;
		}
		printf("%d",ans);
		ans=0;
		scanf("%d",&d);
	}
	return 0;
}

Compiler output:
/tmp/ccoTc3b4.o: in function `main':
main.c:(.text+0xe3): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccoTc3b4.o
main.c:(.text+0x100): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccoTc3b4.o
main.c:(.text+0x14d): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccoTc3b4.o
main.c:(.text+0x185): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccoTc3b4.o
main.c:(.text+0x18e): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccoTc3b4.o
main.c:(.text+0x194): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccoTc3b4.o
main.c:(.text+0x1de): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccoTc3b4.o
main.c:(.text+0x1fa): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccoTc3b4.o
collect2: error: ld returned 1 exit status
Language: C

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

int i,j,k;
int d,n,m,a[100005],b[10005],x,ans=0;
int Min,Max,Mid;
int comp(const void *p,const void *q){
	return *(int *)p-*(int *)q;
}

int main(){
	scanf("%d",&d);
	while(d!=0){
		scanf("%d",&n);
		scanf("%d",&m);
		for(i=1;i<=n-1;i++)scanf("%d",&a[i]);
		a[0]=0,a[n]=d;
		for(i=0;i<m;i++)scanf("%d",&b[i]);
		qsort(a,n+1,sizeof(int),comp);
		//for(i=0;i<=n;i++)printf("%d ",a[i]);
		ans=0;
		for(i=0;i<m;i++)8{
			Min=0;Max=n;
			while(Max-Min>=1){
				Mid=(Min+Max)/2;
				if(a[Mid]==b[i])break;
				else if(a[Mid]>b[i])Max=Mid;
				else Min=Mid+1;
			}
			if(b[i]-a[Mid]>a[Mid+1]-b[i])ans+=a[Mid+1]-b[i];
			else ans+=b[i]-a[Mid];
			//printf("%d ",ans);
		}
		printf("%d",ans);
		ans=0;
		scanf("%d",&d);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:34: error: expected ';' before '{' token
   23 |                 for(i=0;i<m;i++)8{
      |                                  ^
      |                                  ;
Language: C

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

int i,j,k;
__int64 d,n,m,a[100005],b[10005],x,ans=0;
__int64 p,q,r;
int comp(const void *p,const void *q){
	return *(__int64 *)p-*(__int64 *)q;
}

int main(){
	scanf("%lld",&d);
	while(d!=0){
		scanf("%lld",&n);
		scanf("%lld",&m);
		for(i=1;i<=n-1;i++)scanf("%lld",&a[i]);
		a[0]=0,a[n]=d;
		for(i=0;i<m;i++)scanf("%lld",&b[i]);
		qsort(a,n+1,sizeof(__int64),comp);
		//for(i=0;i<=n;i++)printf("%d ",a[i]);
		ans=0;
		for(i=0;i<m;i++){
			p=0;q=n;
			while(q-p>=1){
				r=(p+q)/2;
				if(a[r]==b[i])break;
				else if(a[r]>b[i])q=r;
				else p=r+1;
			}
			if(b[i]-a[r]>a[r+1]-b[i])ans+=a[r+1]-b[i];
			else ans+=b[i]-a[r];
			//printf("%d ",ans);
		}
		printf("%lld",ans);
		ans=0;
		scanf("%lld",&d);
	}
	return 0;
}

Compiler output:
main.c:6:1: error: unknown type name '__int64'; did you mean '__int64_t'?
    6 | __int64 d,n,m,a[100005],b[10005],x,ans=0;
      | ^~~~~~~
      | __int64_t
main.c:7:1: error: unknown type name '__int64'; did you mean '__int64_t'?
    7 | __int64 p,q,r;
      | ^~~~~~~
      | __int64_t
main.c: In function 'comp':
main.c:9:18: error: '__int64' undeclared (first use in this function); did you mean '__int64_t'?
    9 |         return *(__int64 *)p-*(__int64 *)q;
      |                  ^~~~~~~
      |                  __int64_t
main.c:9:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:27: error: expected expression before ')' token
    9 |         return *(__int64 *)p-*(__int64 *)q;
      |                           ^
main.c: In function 'main':
main.c:20:36: error: '__int64' undeclared (first use in this function); did you mean '__int64_t'?
   20 |                 qsort(a,n+1,sizeof(__int64),comp);
      |                                    ^~~~~~~
      |                                    __int64_t
Language: C

#include<stdio.h>
#include<algorithm>
int*t,p="%d\n",n,m,d,i,s[99999];main(){for(;scanf("%d%d%d",&d,&n,&m),s[i=n]=d;printf(p,i)){for(;--i;)scanf(p,s+i);for(std::sort(s,s+n);m--;i+=std::min(*t-d,d-t[-1]))scanf(p,&d),t=std::upper_bound(s,s+n,d);}}

Compiler output:
main.c:2:9: fatal error: algorithm: No such file or directory
    2 | #include<algorithm>
      |         ^~~~~~~~~~~
compilation terminated.