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

#include <stdio.h>
#include <string.h>
int main(int argc,const char *argv[]){
    char array[201],temp[201];
    int shufflu,i,x,j,length;
    while(1){
        j=0;
    scanf("%s",array);
        
    if(strcmp(array,"-")==0){
        break;
    }
        
    legth=strlen(array);
        
    scanf("%d",&shufflu);
        
    while(j!=shufflu){

        scanf("%d",&x);
        
        for(i=0;i<length-x;i++){
            temp[i]=array[x+i];
        }
        for(i=length-1;i<length;i++){
            temp[i]=array[j+a-len];
        }
        temp[len]='\0';
        strcpy(array,temp);
        j++;
    }
        
    printf("%s\n",array);
        
    }
    
    return 0;
    
    
}

Compiler output:
main.c: In function 'main':
main.c:14:5: error: 'legth' undeclared (first use in this function); did you mean 'length'?
   14 |     legth=strlen(array);
      |     ^~~~~
      |     length
main.c:14:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:29: error: 'a' undeclared (first use in this function)
   26 |             temp[i]=array[j+a-len];
      |                             ^
main.c:26:31: error: 'len' undeclared (first use in this function)
   26 |             temp[i]=array[j+a-len];
      |                               ^~~
Language: C

#include <stdio.h>
#include <string.h>
int main(int argc,const char *argv[]){
    char array[201],temp[201];
    int shufflu,i,x,j,length;
    while(1){
        j=0;
    scanf("%s",array);
        
    if(strcmp(array,"-")==0){
        break;
    }
        
    length=strlen(array);
        
    scanf("%d",&shufflu);
        
    while(j!=shufflu){

        scanf("%d",&x);
        
        for(i=0;i<length-x;i++){
            temp[i]=array[x+i];
        }
        for(i=length-1;i<length;i++){
            temp[i]=array[j+a-len];
        }
        temp[length]='\0';
        strcpy(array,temp);
        j++;
    }
        
    printf("%s\n",array);
        
    }
    
    return 0;
    
    
}

Compiler output:
main.c: In function 'main':
main.c:26:29: error: 'a' undeclared (first use in this function)
   26 |             temp[i]=array[j+a-len];
      |                             ^
main.c:26:29: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:31: error: 'len' undeclared (first use in this function)
   26 |             temp[i]=array[j+a-len];
      |                               ^~~
Language: C

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

enum {
	MAX_CARDS = 200,
};

void shuffle(char *cards, int no_cards, int height) {
	char temp[MAX_CARDS+1];
	int border = no_cards - height;
	strcpy(temp, cards + height, border);
	strcpy(temp + border, cards, height);
	strcpy(cards, temp, no_cards);
}

int main() {
	char cards[MAX_CARDS+1];
	int no_cards;
	int no_shuffle_times;
	int h;
	for (;;) {
		scanf("%s", cards);
		if (strcmp(cards, "-") == 0)
			break;

		no_cards = strlen(cards);
		scanf("%d", &no_shuffle_times);
		for (i = 0; i < no_shuffle_times; i++) {
			scanf("%d", &h);
			shuffle(cards, no_cards, h);
		}

		puts(cards);
	}
	return 0;
}

Compiler output:
main.c: In function 'shuffle':
main.c:11:9: error: too many arguments to function 'strcpy'
   11 |         strcpy(temp, cards + height, border);
      |         ^~~~~~
In file included from main.c:2:
/usr/include/string.h:141:14: note: declared here
  141 | extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
      |              ^~~~~~
main.c:12:9: error: too many arguments to function 'strcpy'
   12 |         strcpy(temp + border, cards, height);
      |         ^~~~~~
/usr/include/string.h:141:14: note: declared here
  141 | extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
      |              ^~~~~~
main.c:13:9: error: too many arguments to function 'strcpy'
   13 |         strcpy(cards, temp, no_cards);
      |         ^~~~~~
/usr/include/string.h:141:14: note: declared here
  141 | extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
      |              ^~~~~~
main.c: In function 'main':
main.c:28:22: error: 'i' undeclared (first use in this function)
   28 |                 for (i = 0; i < no_shuffle_times; i++) {
      |                      ^
main.c:28:22: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <string.h>
 
int main(void)
{
  int m, h, len;
  char s[1024], tmp[1024];
   
  while (scanf("%s", s), *s != '-'){
    scanf("%d", &m);
    while (m--){
      scanf("%d", &h);
      strncpy(tmp, s + h);
      strcat(tmp, s, h);
      strcpy(s, tmp);
    }
    printf("%s\n", s);
  }
 
  return (0);
}

Compiler output:
main.c: In function 'main':
main.c:13:7: error: too few arguments to function 'strncpy'
   13 |       strncpy(tmp, s + h);
      |       ^~~~~~~
In file included from main.c:2:
/usr/include/string.h:144:14: note: declared here
  144 | extern char *strncpy (char *__restrict __dest,
      |              ^~~~~~~
main.c:14:7: error: too many arguments to function 'strcat'
   14 |       strcat(tmp, s, h);
      |       ^~~~~~
/usr/include/string.h:149:14: note: declared here
  149 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
      |              ^~~~~~
Language: C

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

int main(){
  int n, num=0;
  string h;
  string input;

  while(true){
    cin >> input;
    if(input == "-") break;
    else{
      cin >> n;
      for(int i=0; i<n; i++){
	cin >> h;
	num = (int)(char(h[0]) - '0');
	
	string left = input.substr(0,num);
	string right = input.substr(num, input.length()-1);
	input = right + left;
      }
      cout << input << endl;
    }
  }
  return 0;
}

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

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

void shuffle(char [], char [], int);

int main(void) 
{
  int i, j, m, h;
  char sequence[201], result[201];

  while (1) {
    scanf("%s", sequence);

    if (strcmp(sequence, "-") == 0) 
      break;

    scanf("%d", &m);

    for (i = 0; i < m; i++) {
      scanf("%d", &h);
      
      shuffle(result, sequence, h);

      sequence = result;
    }

    printf("%s\n", result);
  }

  return 0;
}

void
shuffle(char dest[], char src[], int h) {
  int i;

  for (i = 0; i < strlen(sequence) - h; i++) {
    dest[h + j] = src[j];
    dest[j]     = src[h + j];
  }
}

Compiler output:
main.c: In function 'main':
main.c:24:16: error: assignment to expression with array type
   24 |       sequence = result;
      |                ^
main.c: In function 'shuffle':
main.c:37:26: error: 'sequence' undeclared (first use in this function)
   37 |   for (i = 0; i < strlen(sequence) - h; i++) {
      |                          ^~~~~~~~
main.c:37:26: note: each undeclared identifier is reported only once for each function it appears in
main.c:38:14: error: 'j' undeclared (first use in this function)
   38 |     dest[h + j] = src[j];
      |              ^
Language: C

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

int main(){
	char s[201],tmp[201];
	int n,m;
	int i,j;
	
	while(1){
		scanf("%s",s);
		if(strcmp(s,"-")==0)
			break
		scanf("%d",&n);
		for(i=0;i<n;i++)
		{
			scanf("%d",&m);
			strncpy(tmp,s,m);
			for(j=0;j<strlen(s)-m;j++)
				s[j] = s[m+j];
			s[j] = '\0';
			strcat(s,tmp);
		}
		printf("%s\n",s);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:30: error: expected ';' before 'scanf'
   12 |                         break
      |                              ^
      |                              ;
   13 |                 scanf("%d",&n);
      |                 ~~~~~
Language: C++

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int length;
        int sh;
        int a;
        StringBuffer sb = new StringBuffer();
        while(true){
            String str = in.readLine();
            if(str.equals("-") == true) break;
            length = Integer.parseInt(in.readLine());
            sh = 0;
            for(int i=0; i<length; i++){
                sh += Integer.parseInt(in.readLine());
            }
            for(int i=0; i<str.length(); i++){
                a = (sh + i) % str.length();
                sb.append(str.charAt(a));
            }
            sb.append("\n");
        }

        System.out.print(sb);
        in.close();
    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.IOException;
      | ^~~~~~
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.io.BufferedReader;
      | ^~~~~~
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.io.InputStreamReader;
      | ^~~~~~
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 <iostream>
#include <string>

using namespace std;

int main(){
	int m,h;
	string str;
	// string ::iterator it = str.begin();

	while(cin >> str >> m, str != "-"){
		string cpstr = str;
		while(m--){
			cin >> h;
			int pos = 0;
			for(int i = h; i < str.size(); i++){
				str[pos] = cpstr[i];
				pos++;
			}
			for(int i = 0; i < h; i++){
				str[pos] = cpstr[i];
				pos++
			}
		}
		cout << str << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:38: error: expected ';' before '}' token
   22 |                                 pos++
      |                                      ^
      |                                      ;
   23 |                         }
      |                         ~
Language: C++

import java.io.*;
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String input=sc.nextLine();
        String s=input.substring(0,input.length()-2);
        /*int n=(int)input.charAt(input.length()-1)-'0';
        int move[]=new int[n];
        for (int i=0;i<n;i++) move[i]=sc.nextInt();
        for (int i=0;i<n;i++){
            String s1=s.substring(0,move[i]);
            String s2=s.substring(move[i],s.length());
            s=s2+s1;
        }
        System.out.println(s);*/
    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
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.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main{
      | ^~~~~~
Language: C++

#include<stdio.h>
#include<string>
int main(){
	int n,j,i,k;
	string str[22],top={'Z'};
	
	scanf("%d",&n);
	for(i=0;i<=n;i++){
		scanf("%s",str);
		if(str<top){
			top=str;
		}
	}
	printf("%s\n",top);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'string' was not declared in this scope
    5 |         string str[22],top={'Z'};
      |         ^~~~~~
a.cc:5:9: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:9:28: error: 'str' was not declared in this scope; did you mean 'std'?
    9 |                 scanf("%s",str);
      |                            ^~~
      |                            std
a.cc:10:24: error: 'top' was not declared in this scope
   10 |                 if(str<top){
      |                        ^~~
a.cc:14:23: error: 'top' was not declared in this scope
   14 |         printf("%s\n",top);
      |                       ^~~
Language: C++

// AOJ 10023
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>

using namespace std;

int aoj10023(void)
{
    char buf[1024];
    string str;
    while(1){

        char card[256];
        fgets(buf, sizeof(buf), stdin);
        sscanf(buf, "%s", card);
        str = card;
        if(str == "-") break;

        int num;
        fgets(buf, sizeof(buf), stdin);
        sscanf(buf, "%d", &num);

        int n;
        for(int i = 0; i < num; i++){
            fgets(buf, sizeof(buf), stdin);
            sscanf(buf, "%d", &n);

            str = str.substr(n, str.length()-n) + str.substr(0, n);
        }
        printf("%s\n", str.c_str());
    }

    return 0;
}

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

char c[201];t,p,i;main(m){for(;gets(c),i=*c!='-';p=!printf("%s%.*s\n",c+p,p,c))for(scanf("%d",&m);m--;p=(p+t)%strlen(c))scanf("%d ",&t);}

Compiler output:
a.cc:1:13: error: 't' does not name a type
    1 | char c[201];t,p,i;main(m){for(;gets(c),i=*c!='-';p=!printf("%s%.*s\n",c+p,p,c))for(scanf("%d",&m);m--;p=(p+t)%strlen(c))scanf("%d ",&t);}
      |             ^
a.cc:1:23: error: expected constructor, destructor, or type conversion before '(' token
    1 | char c[201];t,p,i;main(m){for(;gets(c),i=*c!='-';p=!printf("%s%.*s\n",c+p,p,c))for(scanf("%d",&m);m--;p=(p+t)%strlen(c))scanf("%d ",&t);}
      |                       ^
Language: C++

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

int main(void){

	string card,card1,card2;
	int m,h;

	while(1){
		cin>>card;
		if(strcmp(card.c_str(),"-")==0) break;
		cin>>m;
		for(int i=0;i<m;i++){
			cin>>h;
			card=card.substr(h,strlen(card.c_str())-h)+card.substr(0,h);
		}
		cout<<card<<endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: 'strcmp' was not declared in this scope
   12 |                 if(strcmp(card.c_str(),"-")==0) break;
      |                    ^~~~~~
a.cc:3:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<iostream>
  +++ |+#include <cstring>
    3 | using namespace std;
a.cc:16:44: error: 'strlen' was not declared in this scope
   16 |                         card=card.substr(h,strlen(card.c_str())-h)+card.substr(0,h);
      |                                            ^~~~~~
a.cc:16:44: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

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

int main(int argc, const char * argv[])
{
    string n;
    while (cin >> n) {
        int m;
        cin >> m;
        if (h != 0) {
        for (int i = 0; i <  m; i++) {
            int h;
            cin >> h;
            string left = n.substr(h, n.size());
            string right = n.substr(0, h);
            n = left + right;
        }
        cout << n << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:11:13: error: 'h' was not declared in this scope
   11 |         if (h != 0) {
      |             ^
Language: Java


import java.util.*;
public class A {
    Scanner sc;
    int d[] = new int [3];
    int e[] = new int [3];
    String[] bet = {"lunch","dinner","midnight"};
    void run() {
        sc = new Scanner(System.in);
        while (true) {
            int n = sc.nextInt();
            if (n == 0) break;
            int[] t = new int[n];
            int[] s = new int[n];
            for (int j=0;j<3;j++) d[j] = s[j] = 0;
            for (int i=0;i<n;i++) {
                String[] str = sc.next().split(":");
                t[i] = Integer.parseInt(str[0]) * 100 + Integer.parseInt(str[1]);
                s[i] = sc.nextInt();
                int serve = s[i]-t[i]%100;
                if (serve < 0) serve += 60;
                if (1100 < t[i] && 1459 > t[i] ) {
                    d[0]++;
                    if (serve < 8) e[0]++;
                }
                if (1800 < t[i] && 2059 > t[i] ) {
                    d[1]++;
                    if (serve < 8) e[1]++;
                }
                if ((2100 < t[i] && 2359 > t[i]) || ( 0 < t[i] && 159 > t[i]) ) {
                    d[2]++;
                    if (serve < 8) e[2]++;
                }
            }
        }
        for (int i=0;i<3;i++) {
            if (d[i] == 0) System.out.println(bet[i] + " " + "no guest");
            else System.out.println(bet[i] + " " + (int) ( (double)e[i]/(double)d[i]*100 ));
        }
    }

    public static void main(String[] args) {
        new A().run();
    }

}

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

import java.util.*;
public class Main { public static void main(String...args) {
Scanner sc = new Scanner(System.in);
for (int n = sc.nextInt(); n > 0; n = sc.nextInt()) {
  String[] ss = new String[n];
  int[][] d = new int[n][];
  for (int i = 0; i < n; i++) {
    ss[i] = sc.next();
    int m = sc.nextInt();
    for(int j = 0; j < m; j++)
      d[i][j] = sc.nextInt();
  }
  Map<Integer, Integer> map = new HashMap<Integer, Integer>();
  for (int[] is : d)
    for (int j : is)
      if (map.containsKey(j))
        map.put(j, map.get(j) + 1);
      else
        map.put(j, 0);
  int ans = 0;
  int min = 0;
  for (int i : d[0])
    min += N - map.get(i);
  for(int i = 1; i < N; i++) {
    int tmp = 0;
    for (int j : d[i])
      tmp += N - map.get(j);
    if (tmp < min || tmp == min && ss[i].comparTo(ss[ans]) < 0) {
      ans = i;
      min = tmp;
    }
  }
  System.out.println(min + " " + ss[ans);
}}}

Compiler output:
Main.java:33: error: ']' expected
  System.out.println(min + " " + ss[ans);
                                       ^
1 error
Language: Java

import java.util.*;
public class Main { public static void main(String...args) {
Scanner sc = new Scanner(System.in);
for (int n = sc.nextInt(); n > 0; n = sc.nextInt()) {
  String[] ss = new String[n];
  int[][] d = new int[n][];
  for (int i = 0; i < n; i++) {
    ss[i] = sc.next();
    int m = sc.nextInt();
    for(int j = 0; j < m; j++)
      d[i][j] = sc.nextInt();
  }
  Map<Integer, Integer> map = new HashMap<Integer, Integer>();
  for (int[] is : d)
    for (int j : is)
      if (map.containsKey(j))
        map.put(j, map.get(j) + 1);
      else
        map.put(j, 0);
  int ans = 0;
  int min = 0;
  for (int i : d[0])
    min += N - map.get(i);
  for(int i = 1; i < N; i++) {
    int tmp = 0;
    for (int j : d[i])
      tmp += N - map.get(j);
    if (tmp < min || tmp == min && ss[i].comparTo(ss[ans]) < 0) {
      ans = i;
      min = tmp;
    }
  }
  System.out.println(min + " " + ss[ans]);
}}}

Compiler output:
Main.java:23: error: cannot find symbol
    min += N - map.get(i);
           ^
  symbol:   variable N
  location: class Main
Main.java:24: error: cannot find symbol
  for(int i = 1; i < N; i++) {
                     ^
  symbol:   variable N
  location: class Main
Main.java:27: error: cannot find symbol
      tmp += N - map.get(j);
             ^
  symbol:   variable N
  location: class Main
Main.java:28: error: cannot find symbol
    if (tmp < min || tmp == min && ss[i].comparTo(ss[ans]) < 0) {
                                        ^
  symbol:   method comparTo(String)
  location: class String
4 errors
Language: Java

import java.util.*;
public class Main { public static void main(String...args) {
Scanner sc = new Scanner(System.in);
for (int n = sc.nextInt(); n > 0; n = sc.nextInt()) {
  String[] ss = new String[n];
  int[][] d = new int[n][];
  for (int i = 0; i < n; i++) {
    ss[i] = sc.next();
    int m = sc.nextInt();
    for(int j = 0; j < m; j++)
      d[i][j] = sc.nextInt();
  }
  Map<Integer, Integer> map = new HashMap<Integer, Integer>();
  for (int[] is : d)
    for (int j : is)
      if (map.containsKey(j))
        map.put(j, map.get(j) + 1);
      else
        map.put(j, 0);
  int ans = 0;
  int min = 0;
  for (int i : d[0])
    min += n - map.get(i);
  for(int i = 1; i < n; i++) {
    int tmp = 0;
    for (int j : d[i])
      tmp += n - map.get(j);
    if (tmp < min || tmp == min && ss[i].comparTo(ss[ans]) < 0) {
      ans = i;
      min = tmp;
    }
  }
  System.out.println(min + " " + ss[ans]);
}}}

Compiler output:
Main.java:28: error: cannot find symbol
    if (tmp < min || tmp == min && ss[i].comparTo(ss[ans]) < 0) {
                                        ^
  symbol:   method comparTo(String)
  location: class String
1 error
Language: C

#include <stdio.h>

int main(void) {
  int i, temp, n, page[50];
  while(1) {
    scanf("%d", &n);
    if(n == 0) break;
    for(i = 0; i < n; i++) {
      scanf("%d", &page[i]);
    }

    temp = page[0];
    printf("%d", page[0]);
    for(i = 1; i < n; i++) {
      if(page[i] - i != temp) {
        if(temp == page[i-1] - (i-1)) {
          printf(" %d", page[i]);
        else {
          printf("-%d %d", page[i-1], page[i]);
        }
        temp = page[i] - i;
    }
    printf("\n");
  }
}

Compiler output:
main.c: In function 'main':
main.c:18:9: error: expected '}' before 'else'
   18 |         else {
      |         ^~~~
main.c:25:1: error: expected declaration or statement at end of input
   25 | }
      | ^
Language: C

#include <stdio.h>

int main(void) {
  int i, temp, n, page[50];
  while(1) {
    scanf("%d", &n);
    if(n == 0) break;
    for(i = 0; i < n; i++) {
      scanf("%d", &page[i]);
    }

    temp = page[0];
    printf("%d", page[0]);
    for(i = 1; i < n; i++) {
      if(page[i] - i != temp) {
        if(temp == page[i-1] - (i-1)) {
          printf(" %d", page[i]);
        } else {
          printf("-%d %d", page[i-1], page[i]);
        }
        temp = page[i] - i;
    }
    printf("\n");
  }
}

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

#include <stdio.h>

float abs(float x){
	if (x >= 0){
		return (x);
	}
	else{
		return (-1 * x);
	}

int main(void) /*±±©çCÖ*/
{
	int hh[100]; /*Ô[0]`Ô[99]Ìüêq*/
	int mm[100]; /*ª[0]`ª[99]Ìüêq*/
	int MM[100]; /*ñiªj[0]`ñiªj[99]Ìüêq*/
	int ds; /*f[^ZbgÌ*/
	int i; /*for¶ðñ·½ßÌÏ*/
	float j[2];
	float k[2];
	float l[2];
	
	scanf("%d", &ds); /*f[^ZbgÌðmF*/
	
	while(ds != 0){
		j[0] = 0; /*¢ë¢ëÆú».*/
		j[1] = 0; /*j¨ÉÎ*/
		k[0] = 0;
		k[1] = 0; /*k¨[ûÉÎ*/
		l[0] = 0;
		l[1] = 0; /*l¨[éÉÎ*/
		
		for (i = 0; i < ds; i++){ /*i+1ÔÚÌÔAªAñ(ª)ðüÍB*/
			scanf("%d%*c%d%d",&hh[i], &mm[i], &MM[i]);
			
			if (11 <= hh[i] && hh[i] <= 14){ /*àµAÔª11(00ª)©ç14(59ª)ÈçÎ*/
				j[0]++; /*j[0],j[1]É1ð«·BÅIIÉÍAj[1]/[j[0](=)ðoÍ·é.ÈãA»ê¼êð0A1ÆæÔB*/
				j[1]++;
				if(mm[i] >= 52 &&  MM[i] <= 8){ /*àµAª45ª`59ªÌÔA©ÂAñª{100ª`{115ªÌÔÈçA*/
					MM[i] += 60; /*ñÔÉ60ð«µAø«ZÌÊª³ÉÈéæ¤ÉHv·é.¨±ñÈÉÍ¢çÈ¢H*/
				}
				if (MM[i] - mm[i] > 8){ /*àµAñ \ `[ ª Wªæèå«¯êÎ*/
					j[1]--; /*[1]iªqj©ç1ðø­BÈºA[ûA[éà¯lÌð·é.*/
				}
			}
			else if (18 <= hh[i] && hh[i] <= 20){
				k[0]++;
				k[1]++;
				if(mm[i] >= 52 && MM[i] <= 8 ){
					MM[i] += 60;
				}
				if (MM[i] - mm[i] > 8){
					k[1]--;
				}
			}
		
		 if ((21 <= hh[i] && hh[i] <= 23)||hh[i] == 00 || hh[i] == 01){
				l[0]++;
				l[1]++;
				if(mm[i] >= 52 && MM[i] <= 8){
					MM[i] += 60;
				}
				if (MM[i] - mm[i] > 8){
					l[1]--;
				}
		 	}
		}
		
		/*02`10A15`17ÌÍµÈ¢B*/
			
		printf("lunch ");
		if(j[0] == 0){ /*àµA0ª0ÈçÎ(É`[ªÈ¯êÎ)*/
			printf("no guest\n"); /*no guestÆoÍ·é.*/
		}
		else{
			printf("%.0f\n",abs((j[1] / j[0] - 0.005)) * 100);
		}
		/*ÈºA[A[éà¯lÉ·é*/
		printf("dinner ");
		if(k[0] == 0){
			printf("no guest\n");
		}
		else{
			printf("%.0f\n", abs((k[1] / k[0] - 0.005)) * 100 );
		}
		
		printf("midnight ");
		if(l[0] == 0){
			printf("no guest\n");
		}
		else{
			printf("%.0f\n", abs((l[1] / l[0] - 0.005)) * 100);
		}
		
		scanf("%d", &ds);
	}
	return (0);
}

Compiler output:
main.c:3:7: warning: conflicting types for built-in function 'abs'; expected 'int(int)' [-Wbuiltin-declaration-mismatch]
    3 | float abs(float x){
      |       ^~~
main.c:2:1: note: 'abs' is declared in header '<stdlib.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c: In function 'abs':
main.c:97:1: error: expected declaration or statement at end of input
   97 | }
      | ^
Language: C++

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

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
typedef long long Int;
template<class T> inline T sq(T x){return x*x;}
template<class T> inline void checkmin(T &a,T b){if(b<a)a=b;}
template<class T> inline void checkmax(T &a,T b){if(b>a)a=b;}


int main() {
  for(int N; cin >> N, N; ) {
    int v[N];
    REP(i, N) {
      cin >> v[i];
    }
    sort( v, v + N );
    v[N++] = 987654321;

    bool first = true;
    int start = v[0];
    for(int i = 1; i < N; i++) {
      if( v[i-1] + 1 == v[i] ) {
        ;
      } else {
        if( !first ) cout << " ";
        else first = false;

        if( start == v[i - 1] ) {
          cout << v[i - 1];
        } else {
          cout << start << "-" << v[i - 1];
        }
        
        start = v[i];
      }
    }
    cout << endl;
  }
  return 0;
}

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

import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		while(in.hasNextInt()){
			int n=in.nextInt();
			if(n==0)break;
			int p=in.nextInt(),s=p,e;
			String l="";
			l+=s;
			for(int i=1;i<n;i++){
				e=in.nextInt();
				if(e!=p+1){
					l+=((s!=p)?("-"+p):"")+","+e;
					s=p=e;
				}
				if(i==n-1)l+=((s!=e)?("-"+e):"");
				p=e;
			}
			System.out.println(l);
		}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
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.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: C++

#include <cstdio.h>
#include <cmath>
using namespace std;

int main(){
    int n;
    double x,y,z,x_,y_,z_;
    scanf("%d",&n);
    for(int i=0 ; i<n ; i++ ){
		scanf("%lf%lf%lf%lf%lf%lf",&x,&y,&z,&x_,&y_,&z_);
		printf("%.8f\n",( sqrt( (x-x_)*(x-x_)+(y-y_)*(y-y_)+(z-z_)*(z-z_) ) ));
    }
}

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

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

struct C { double L,a,b; };
double dist( C a, C b ) { return pow(a.L-b.L,2)+pow(a.a-b.a,2)+pow(a.b-b.b,2); }
int countbit( int n ) { int c=0; for(;n;n/=2)c+=n%2; return c; }

int main()
{
	int N, M;
	cin>>N>>M;
	vector<C> c(N);
	for ( int i=0; i<N; i++ )
		cin>>c[i].L>>c[i].a>>c[i].b;

	double ans = 0;
	for ( int i=0; i<1<<N; i++ )
	if ( countbit(i)==M )
	{
		double d=0;
		for ( int j=0; j<N; j++ )
		for ( int k=j+1; k<N; k++ )
		if ( i>>j&1 && i>>k&1 )
			d += dist(c[j],c[k]);
		ans = max( ans, d );
	}

	printf( "%.20f\n", ans );
}

Compiler output:
a.cc: In function 'double dist(C, C)':
a.cc:6:34: error: 'pow' was not declared in this scope
    6 | double dist( C a, C b ) { return pow(a.L-b.L,2)+pow(a.a-b.a,2)+pow(a.b-b.b,2); }
      |                                  ^~~
Language: C++

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

int main() {
	int n;
	while ( cin >> n && n > 0 ) {
	vector <string> names(n);
	vector <vector <int> > D(n);
	vector <int> C(30,0);
	for ( int i = 0; i < n; i++ ) {
		int m;
		cin >> names[i] >> m;
		for ( int j = 0; j < m; j++ ) {
			int k;
			cin >> k;
			D[i].push_back(k);
			C[k]++;
		}
	}
	vector < pair <int, string> > list;
	for ( int i = 0; i < n; i++ ) {
		pair <int, string> pis( 0, names[i] );
		for ( int j = 0; j < D[i].size(); j++ ) {
			pis.first += n - C[D[i][j]] + 1;
		}
		list.push_back(pis);
	}
	sort( list.begin(), list.end() );
	cout << (*list.begin()).first << " " << (*list.begin()).second << endl;
	}
	return 0;
}

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

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

int main() {
	int n;
	while ( cin >> n && n > 0 ) {
	vector <string> names(n);
	vector <vector <int> > D(n);
	vector <int> C(30,0);
	for ( int i = 0; i < n; i++ ) {
		int m;
		cin >> names[i] >> m;
		for ( int j = 0; j < m; j++ ) {
			int k;
			cin >> k;
			D[i].push_back(k);
			C[k]++;
		}
	}
	vector < pair <int, string> > list;
	for ( int i = 0; i < n; i++ ) {
		pair <int, string> pis( 0, names[i] );
		for ( int j = 0; j < (int)D[i].size(); j++ ) {
			pis.first += n - C[D[i][j]] + 1;
		}
		list.push_back(pis);
	}
	sort( list.begin(), list.end() );
	cout << (*list.begin()).first << " " << (*list.begin()).second << endl;
	}
	return 0;
}

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

#include <stdio.h>
#include <string>
using namespace std;

int main()
{
	while(true) {
		
		int n;
		scanf("%d", &n);
		if(n == 0) break;
		
		char buf[20];
		int m, t;
		
		string name[20];
		bool time[20][30] = {0};
		int point[20] = {0};
		int chara[30] = {0};
		
		for(int i = 0; i < n; ++i) {
		
			scanf("%s", buf);
			scanf("%d", &m);
			name[i] = buf;
			for(int j = 0; j < m; ++j) {
			
				scanf("%d", &t);
				time[i][t] = true;
				++chara[t];
			}
		}
		
		int min = 0;
		
		for(int i = 0; i < n; ++i) {
		
			for(int j = 0; j < 30; ++j)
				if(time[i][j]) point[i] += n + 1 - chara[j];
			}
			
			if(point[min] >= point[i] && name[min] <= name[i])
				min = i;
		}
		
		printf("%d %s", point[min], name[min].c_str();
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:48: error: 'i' was not declared in this scope
   42 |                         if(point[min] >= point[i] && name[min] <= name[i])
      |                                                ^
a.cc:46:33: error: 'point' was not declared in this scope
   46 |                 printf("%d %s", point[min], name[min].c_str();
      |                                 ^~~~~
a.cc:46:45: error: 'name' was not declared in this scope; did you mean 'rename'?
   46 |                 printf("%d %s", point[min], name[min].c_str();
      |                                             ^~~~
      |                                             rename
a.cc: At global scope:
a.cc:49:9: error: expected unqualified-id before 'return'
   49 |         return 0;
      |         ^~~~~~
a.cc:50:1: error: expected declaration before '}' token
   50 | }
      | ^
Language: C++

#include <stdio.h>
#include <string>
using namespace std;

int main()
{
	while(true) {
		
		int n;
		scanf("%d", &n);
		if(n == 0) break;
		
		char buf[20];
		int m, t;
		
		string name[20];
		bool time[20][30] = {0};
		int point[20] = {0};
		int chara[30] = {0};
		
		for(int i = 0; i < n; ++i) {
		
			scanf("%s", buf);
			scanf("%d", &m);
			name[i] = buf;
			for(int j = 0; j < m; ++j) {
			
				scanf("%d", &t);
				time[i][t] = true;
				++chara[t];
			}
		}
		
		int min = 0;
		
		for(int i = 0; i < n; ++i) {
		
			for(int j = 0; j < 30; ++j)
				if(time[i][j]) point[i] += n + 1 - chara[j];
			}
			
			if(point[min] >= point[i] && name[min] <= name[i])
				min = i;
		}
		
		printf("%d %s", point[min], name[min].c_str());
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:48: error: 'i' was not declared in this scope
   42 |                         if(point[min] >= point[i] && name[min] <= name[i])
      |                                                ^
a.cc:46:33: error: 'point' was not declared in this scope
   46 |                 printf("%d %s", point[min], name[min].c_str());
      |                                 ^~~~~
a.cc:46:45: error: 'name' was not declared in this scope; did you mean 'rename'?
   46 |                 printf("%d %s", point[min], name[min].c_str());
      |                                             ^~~~
      |                                             rename
a.cc: At global scope:
a.cc:49:9: error: expected unqualified-id before 'return'
   49 |         return 0;
      |         ^~~~~~
a.cc:50:1: error: expected declaration before '}' token
   50 | }
      | ^
Language: C++

import java.util.Scanner;


public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);


        while (true) {
            int n = sc.nextInt();
            if (n == 0) {
                break;
            }
            StringBuilder mes = new StringBuilder(sc.next());
            int[] a = new int[n];
            int[] b = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt() - 1;
                b[i] = sc.nextInt() - 1;
            }
            for (int i = n - 1; i >= 0; i--) {
                int diff = b[i] - a[i];

                char ac = mes.charAt(a[i]);
                char bc = mes.charAt(b[i]);

                ac = (char) (((ac - 'a') + diff) % 26 + 'a');
                bc = (char) (((bc - 'a') + diff) % 26 + 'a');

                mes.setCharAt(a[i], bc);
                mes.setCharAt(b[i], ac);
            }
            System.out.println(mes);
        }
    }

}

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

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;

public class MainB {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		while(in.hasNextInt()){
			int n = in.nextInt();
			if(n==0)break;
			TreeMap<Integer,Integer> m = new TreeMap<Integer,Integer>();
			for(int i=0;i<n;i++){int w=in.nextInt();m.put(in.nextInt(),w);}
			Set<Integer> s = m.keySet();
			int sw=0;
			boolean c= true;
			for(int k : s){
				sw+=m.get(k);
				if(k<sw){
					c=false;
					break;
				}
			}
			System.out.println(c?"Yes":"No");

		}
	}
}

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

include<stdio.h>
int main(){
long long  int a,b,S;
 int n,m;

  scanf("%d",&n);
  
  for(m=1;m<=n;m++){
    scanf("%lld %lld",&a,&b);
    S=a+b;
    printf("%d\n",S);
  }
  return 0;
}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
Language: C++

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

struct _node {
	int r,mc;
} node[32];

int n;

int dfs(int now_cost, int visit)
{
	if( visit==((1<<n)-1) )return 1;
	for(int i=0; i<n; i++){
		if( !(visit&(1<<i)) && now_cost+node[i].r<=node[i].mc ){
			if( dfs( now_cost+node[i].r , visit|(1<<i) ) )return 1;
		}
	}
	return 0;
}

int main()
{
	while( cin>>n,n ){
		memset(node,0,sizeof(node));
		for(int i=0; i<n; i++){
			int r,c;
			cin >> node[i].r >> node[i].mc;
		}
		puts( dfs(0,0) ? "Yes" : "No" );
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: 'memset' was not declared in this scope
   25 |                 memset(node,0,sizeof(node));
      |                 ^~~~~~
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 | using namespace std;
Language: C++

#include<iostream>
#include<vector>

#define N 512
#define SEC_ADJ 10000
#define LEN_PROGRAM 30

using namespace std;

struct program{
  string name;
  int weekday, start;
  bool watchable;
  int sec()const{
    return weekday * SEC_ADJ + 60 * (start / 100) + start % 100;
  }
  bool operator<(const program &p)const{
    int diff = sec() - p.sec();
    if( diff < 0 ) return true;
    else if ( diff == 0 ) return name < p.name;
    return false;
  }
  bool overlap(const program &p)const{
    return abs( sec() - p.sec()) < LEN_PROGRAM;
  }
};

int solve(int n, program programs[N], int p, string favs[N]){
  int ret = 0;
  int idx[N];

  for(int i = 0; i < p; ++i){
    for(int j = 0; j < n; ++j){
      if( favs[i] == programs[j].name ){
        idx[i] = j;
      }
    }
  }

  for(int i = 0; i < p; ++i){
    for(int j = 0; j < n; ++j){
      if( idx[i] != j && programs[idx[i]].overlap( programs[j] ) ){
        programs[j].watchable = false;
      }
    }
  }

  for(int i = 0; i < p; ++i){
    if( !programs[idx[i]].watchable ) return -1;
  }
  
  sort( programs, programs + n );

  int i0 = 0;
  while(i0<n && !programs[i0].watchable)++i0;
  while(i0<n){
    int nexti = i0+1;
    ++ret;
    while(nexti < n && programs[i0].overlap(programs[nexti])){
      ++nexti;
    }
    while(nexti < n && !programs[nexti].watchable ){
      ++nexti;
    }
    i0 = nexti;
  }
  return ret;
}

int main()
{
  int n,p;
  while(cin >> n && n){
    program programs[N];
    string favs[N];
    
    for(int i = 0; i < n; ++i){
      program tmp;
      
      cin >> programs[i].name >> programs[i].weekday >> programs[i].start;
      programs[i].watchable = true;
    }
    
    cin >> p;
    for(int i = 0; i < p; ++i){
      cin >> favs[i];
    }
    
    cout << solve( n, programs, p, favs ) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int solve(int, program*, int, std::string*)':
a.cc:52:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   52 |   sort( programs, programs + n );
      |   ^~~~
      |   short
Language: C++

#include<iostream>
#include<vector>

#define N 512
#define SEC_ADJ 10000
#define LEN_PROGRAM 30

using namespace std;

struct program{
  string name;
  int weekday, start;
  bool watchable;
  int sec()const{
    return weekday * SEC_ADJ + 60 * (start / 100) + start % 100;
  }
  bool operator<(const program &p)const{
    int diff = sec() - p.sec();
    if( diff < 0 ) return true;
    else if ( diff == 0 ) return name < p.name;
    return false;
  }
  bool overlap(const program &p)const{
    return abs( sec() - p.sec()) < LEN_PROGRAM;
  }
};

int solve(int n, program programs[N], int p, string favs[N]){
  int ret = 0;
  int idx[N];

  for(int i = 0; i < p; ++i){
    for(int j = 0; j < n; ++j){
      if( favs[i] == programs[j].name ){
	idx[i] = j;
      }
    }
  }

  for(int i = 0; i < p; ++i){
    for(int j = 0; j < n; ++j){
      if( idx[i] != j && programs[idx[i]].overlap( programs[j] ) ){
	programs[j].watchable = false;
      }
    }
  }

  for(int i = 0; i < p; ++i){
    if( !programs[idx[i]].watchable ) return -1;
  }
  
  sort( programs, programs + n );

  int i0 = 0;
  while(i0<n && !programs[i0].watchable)++i0;
  while(i0<n){
    int nexti = i0+1;
    ++ret;
    while(nexti < n && programs[i0].overlap(programs[nexti])){
      ++nexti;
    }
    while(nexti < n && !programs[nexti].watchable ){
      ++nexti;
    }
    i0 = nexti;
  }
  return ret;
}

int main()
{
  int n,p;
  while(cin >> n && n){
    program programs[N];
    string favs[N];
    
    for(int i = 0; i < n; ++i){
      program tmp;
      
      cin >> programs[i].name >> programs[i].weekday >> programs[i].start;
      programs[i].watchable = true;
    }
    
    cin >> p;
    for(int i = 0; i < p; ++i){
      cin >> favs[i];
    }
    
    cout << solve( n, programs, p, favs ) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int solve(int, program*, int, std::string*)':
a.cc:52:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   52 |   sort( programs, programs + n );
      |   ^~~~
      |   short
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;
#define WEEK (7*24*60)
set<int> sch;
int add_sch(int st){
	for(set<int>::iterator it=sch.begin();it!=sch.end();++it){
		if(((*it)+WEEK-st)%WEEK<30 || (st+WEEK-(*it))%WEEK<30)
			return 0;
	}
	sch.insert(st);
	return 1;
}
int main(){
	int N;
	for(;sch.clear(), cin>>N,N;){
		int num=0;
		map<string,int> prog;
		map<int,string> progr;
		for(;N--;){
			string name;
			int wd,st,t;
			cin>>name>>wd>>st;
			t=wd*24*60+(st/100)*60+(st%100);
			prog[name]=t;
			progr[t]=name;
		}
		int P;
		cin>>P;
		for(;P--;){
			string name;
			cin>>name;
			if(!add_sch(prog[name])){
				puts("-1");
				goto End;
			}
			//cout<<name<<endl;
			progr.erase(prog[name]);
			num++;
		}
		int prev_t=-WEEK;
		for(map<int,string>::iterator it=progr.begin();it!=progr.end();++it){
			if(it->first - prev_t >= 30 && add_sch(it->first)){
				num++;
				//cout<<it->second<<endl;
				prev_t=it->first;
			}
		}
		cout<<num<<endl;
End:;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:1: error: jump to label 'End'
   56 | End:;
      | ^~~
a.cc:41:38: note:   from here
   41 |                                 goto End;
      |                                      ^~~
a.cc:47:21: note:   crosses initialization of 'int prev_t'
   47 |                 int prev_t=-WEEK;
      |                     ^~~~~~
Language: C++

#include <vector>
#include <list>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstring>

using namespace std;
typedef long long ll;
const int wm = 60*24*7;
int prog[wm];
int n;

int solve(){
	map<string, int> pi;
	char name[33];
	int	weekday;
	int time;
	vector<int> start;
	for(int i = 0; i < n; ++i) {
		scanf("%s %d %d", name, &weekday, &time);
		if(time >= 2400) {
			time -= 2400;
			weekday = (weekday + 1) % 7;
		}
		time = weekday * 24 * 60 + time / 100 * 60 + time % 100;
		start.push_back(time);
		pi[string(name)] = j;
	}
	int p;
	scanf("%d", &p);
	vector<bool> used(n);
	for (int j = 0; j < p; ++j) {
		scanf("%s", name);
		int idx = pi[string(name)];
		for(int k = 0; k < 30; ++k) {
			int t = start[idx] + k;
			if(t >= wm) t -= wm;
			if(prog[t] != 0) {
				return -1;
			}
			prog[t] = 1;
		}
		used[idx] = true;
	}
	int ans = p;
	vector<int> rest;
	for(int i = 0; i < n; ++i) {
		if(used[i]) continue;
		rest.push_back(start[i]);
	}
	sort(rest.begin(), rest.end());
	if(rest.empty()) return ans;
	int si = 0;
	if(rest[0] + wm >= rest.back() + 30) {
		si = 0;
	}else{
		for(int i = 1; i < rest.size(); ++i) {
			if(rest[i] >= rest[i-1] + 30) {
				si = i;
				break;
			}
		}
	}
	for(int i = 0; i < rest.size(); ++i) {
		int start = rest[si];
		++si;
		if(si == rest.size()) si = 0;
		bool watch = true;
		for(int k = 0; k < 30; ++k) {
			int t = start + k;
			if(t >= wm) t -= wm;
			if(prog[t] != 0) {
				watch = false;
				break;
			}
		}
		if (watch) {
			++ans;
			for(int k = 0; k < 30; ++k) {
				int t = start + k;
				if(t >= wm) t -= wm;
				prog[t] = 1;
			}
		}
	}
	return ans;
}

int main()
{
	while(true) {
		scanf("%d", &n);
		if(n == 0) break;
		for(int i = 0; i < wm; ++i) {
			prog[i] = 0;
		}
		printf("%d\n", solve());
	}
	return 0;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:35:36: error: 'j' was not declared in this scope
   35 |                 pi[string(name)] = j;
      |                                    ^
Language: C

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

void search(char *longer, char *shorter, long long *num);

int main(void)
{
	long long same;
	char S[50001], T[50001];
	int s, t;
	
	scanf("%s", S);
	getchar();
	
	scanf("%s", T);
	getchar();
	
	s = strlen(S);
	t = strlen(T);
	
	same = 0;
	s >= t ? search(S, T, &same) : search(T, S, &same);
	
	printf("%lld\n", same);
	
	return (0);
}

void search(char *longer, char *shorter, long long *num)
{
	int i, j, k, l;
	int flag;
	syori = 0;
	for (k = 1; k <= strlen(shorter); k++){
		for (i = 0; i < strlen(longer); i++){
			if (i + k > strlen(longer)) break;
			for (j = 0; j < strlen(shorter); j++){
				if (strncmp(&longer[i], &shorter[j], k) == 0){
					flag = 1;
					for (l = 0; l <= k / 2; l++){
						if (longer[i + l] != longer[i + k - l - 1]){
							flag = 0;
							break;
						}
					}
					if (flag == 1){
						*num += 1;
					}
				}
			}
		}
	}
}

Compiler output:
main.c: In function 'search':
main.c:33:9: error: 'syori' undeclared (first use in this function)
   33 |         syori = 0;
      |         ^~~~~
main.c:33:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

void search(char *longer, char *shorter, int *num);

int main(void)
{
	int same;
	char S[50001], T[50001];
	int s, t;
	
	scanf("%s", S);
	getchar();
	
	scanf("%s", T);
	getchar();
	
	s = strlen(S);
	t = strlen(T);
	
	same = 0;
	s >= t ? search(S, T, &same) : search(T, S, &same);
	
	printf("%d\n", same);
	
	return (0);
}

void search(char *longer, char *shorter, int *num)
{
	int i, j, k, l;
	int flag;
	syori = 0;
	for (k = 1; k <= strlen(shorter); k++){
		for (i = 0; i < strlen(longer); i++){
			if (i + k > strlen(longer)) break;
			for (j = 0; j < strlen(shorter); j++){
				if (strncmp(&longer[i], &shorter[j], k) == 0){
					flag = 1;
					for (l = 0; l <= k / 2; l++){
						if (longer[i + l] != longer[i + k - l - 1]){
							flag = 0;
							break;
						}
					}
					if (flag == 1){
						*num += 1;
					}
				}
			}
		}
	}
}

Compiler output:
main.c: In function 'search':
main.c:33:9: error: 'syori' undeclared (first use in this function)
   33 |         syori = 0;
      |         ^~~~~
main.c:33:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main(void){
  int n,m;
  int p[ 20 ];
  int i,j;

  int av;
  int sum;
  double ans;
  int flag;

  while( 1 ){
    scanf("%d %d ",&n,&m );
    if( !n && !m )
      break;

    flag = 0;
    for( i=0;i<m;i++ ){
      scanf("%d",&p[i] );
      if( p[i]==1 )
	flag=1;
    }
    av = 0;sum=0;
    if( flag==0 ){
      for( i=1;i<=n;i++ ){
	for( j=0;j<m;j++ ){
	  if( i%p[j]== 0 )
	    break;
	}
	if( j==m ){
	  av++;
	  sum += i;
	}
      }
    }

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