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

#include<iostream>
using namespace std;

int main(){
	int total;
	int books;
	int lostbook=0;
	while(){
		if(i==0){
			cin>>total;
		}else{
			cin>>books;
                         if(books==0){
                            break;
                         }
			total-=books;
		}
	}
	cout<<total<<'\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: expected primary-expression before ')' token
    8 |         while(){
      |               ^
a.cc:9:20: error: 'i' was not declared in this scope
    9 |                 if(i==0){
      |                    ^
Language: C++

#include<iostream>
using namespace std;

int main(){
	int total;
	int books;
	int lostbook=0;
	for(){
		if(i==0){
			cin>>total;
		}else{
			cin>>books;
                         if(books==0){
                            break;
                         }
			total-=books;
		}
	}
	cout<<total<<'\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: expected primary-expression before ')' token
    8 |         for(){
      |             ^
a.cc:20:9: error: expected primary-expression before 'return'
   20 |         return 0;
      |         ^~~~~~
a.cc:19:27: error: expected ')' before 'return'
   19 |         cout<<total<<'\n';
      |                           ^
      |                           )
   20 |         return 0;
      |         ~~~~~~             
a.cc:8:12: note: to match this '('
    8 |         for(){
      |            ^
Language: C++

#include<iostream>
using namespace std;

int main(){
	int total;
	int books;
	int lostbook=0;
         cin>>total;
	for(){
		
			cin>>books;
                         if(books==0){
                            break;
                         }
			total-=books;
		
	}
	cout<<total<<'\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: expected primary-expression before ')' token
    9 |         for(){
      |             ^
a.cc:19:9: error: expected primary-expression before 'return'
   19 |         return 0;
      |         ^~~~~~
a.cc:18:27: error: expected ')' before 'return'
   18 |         cout<<total<<'\n';
      |                           ^
      |                           )
   19 |         return 0;
      |         ~~~~~~             
a.cc:9:12: note: to match this '('
    9 |         for(){
      |            ^
Language: C++

#include<iostream>
using namespace std;

int main(){
	int total;
	int books;

	for(int i=0;i<10;i++){
		if(i==0){
                   cin>>total
                }else{
                   cin>>books;
                   total-=books;
                }
	}
	cout<<total;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:30: error: expected ';' before '}' token
   10 |                    cin>>total
      |                              ^
      |                              ;
   11 |                 }else{
      |                 ~
Language: C++

#include<iostream>
using namespace std;

int main()
{
    int a; int b; int c; int d; int e; int f; int g; int h; int i; int j;
    cin >> a >> b >> c >> d >> e >> f >> g >> h >> i >> j;
    cout << 0*a
    cout << a-(b+c+d+e+f+g+h+i+j) << '\n';

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: error: expected ';' before 'cout'
    8 |     cout << 0*a
      |                ^
      |                ;
    9 |     cout << a-(b+c+d+e+f+g+h+i+j) << '\n';
      |     ~~~~
Language: C++

#include<iostream>
using namespace std;

int main()
{
  int a,b,c,d,e,f,g,h,i,j,h;
  
  cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
  h=a-b-c-d-e-f-g-h-i-j
  cout<<h<<'\n';

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:27: error: redeclaration of 'int h'
    6 |   int a,b,c,d,e,f,g,h,i,j,h;
      |                           ^
a.cc:6:21: note: 'int h' previously declared here
    6 |   int a,b,c,d,e,f,g,h,i,j,h;
      |                     ^
a.cc:9:24: error: expected ';' before 'cout'
    9 |   h=a-b-c-d-e-f-g-h-i-j
      |                        ^
      |                        ;
   10 |   cout<<h<<'\n';
      |   ~~~~
Language: C++

#include<iostream>
using namespace std;

int main()
{
  int a,b,c,d,e,f,g,h,i,j,k;
  
  cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
  k=a-b-c-d-e-f-g-h-i-j
  cout<<k<<'\n';

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: expected ';' before 'cout'
    9 |   k=a-b-c-d-e-f-g-h-i-j
      |                        ^
      |                        ;
   10 |   cout<<k<<'\n';
      |   ~~~~
Language: C++

#include<iostream>
using namespace std;	
 
	int main(){
		int goke;
		int hon;
		int count=0;

	while(true){
		if(count==0){
		cin>>goke;
		if(goke==0){
		break };
	count++; }
	else{
		cin>>hon;
		goke-=hon;
		count++;
		}
		if(count==10){
		cout<<goke<<'\n';
		count=0;
		}
	}
	return0;
}
	

Compiler output:
a.cc: In function 'int main()':
a.cc:13:22: error: expected ';' before '}' token
   13 |                 break };
      |                      ^~
      |                      ;
a.cc:25:9: error: 'return0' was not declared in this scope
   25 |         return0;
      |         ^~~~~~~
Language: C++

#include<iostream>
using namespace std;	
 
	int main(){
		int goke;
		int hon;
		int count=0;

	while(true){
		if(count==0){
		cin>>goke;
		if(goke==0){
		break; }
	count++; }
	else{
		cin>>hon;
		goke-=hon;
		count++;
		}
		if(count==10){
		cout<<goke<<'\n';
		count=0;
		}
	}
	return0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'return0' was not declared in this scope
   25 |         return0;
      |         ^~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
	while(1){
		int n,a,sum=0;
		cin>>n;
		if(n==0)
			break;
		for(int i=1; i<=9; i++){
			cin>>a;
			sum+=a;
			cout<<n-sum<<endl;
		}

	return 0;
}

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

#include <iostream>
using namespace std;
int main() {
	int a,b;

		if(a=0){
			break;
		}
	cin>>a;
	for(int i=0;i<9;i++){
		cin>>b;
		a=a-b;
	}
	cout<<a<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:25: error: break statement not within loop or switch
    7 |                         break;
      |                         ^~~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
int books=0;
int book=0;
cin>>books;
while(i<9){
cin>>book;
books-=book;
if(books==0){
break;
}
}
cout<<books<<'\n';

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 | while(i<9){
      |       ^
Language: C++

#include<iostream>
using namespace std;

int main(){
int books=0;
int book=0;
cin>>books;
while(i<9){
cin>>book;
books-=book;
i++;
if(books==0){
break;
}
}
cout<<books<<'\n';

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 | while(i<9){
      |       ^
Language: C++

#include<iostream>
using namespace std;

int main(){
	int total,book;
	int c=0;
	while(true)
	if(c==0){
		cin >> total;	
	}
	if(total==0){
		break;
	}
	c++;
	}else{
	cin >> book ;
	total -= book;
	c++;
	}
	if(c==10){
	cout << total << '\n';
	c==0;
	}	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: break statement not within loop or switch
   12 |                 break;
      |                 ^~~~~
a.cc: At global scope:
a.cc:15:10: error: expected unqualified-id before 'else'
   15 |         }else{
      |          ^~~~
a.cc:20:9: error: expected unqualified-id before 'if'
   20 |         if(c==10){
      |         ^~
a.cc:24:9: error: expected unqualified-id before 'return'
   24 |         return 0;
      |         ^~~~~~
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

#include<iostream>
using namespace std;

int main(){
	int total,book;
	int c=0;
	while(true){
	if(c==0){
		cin >> total;	
	}
	if(total==0){
		break;
	}
	c++;
	}else{
	cin >> book ;
	total -= book;
	c++;
	}
	if(c==10){
	cout << total << '\n';
	c==0;
	}	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'else' without a previous 'if'
   15 |         }else{
      |          ^~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
	int total,book;
	int c=0;
	while(true){
	if(c==0){
		cin >> total;	
	}
	if(total==0){
		break;
	}
	c++;
	}else{
	cin >> book ;
	total -= book;
	c++;
	}
	if(c==10){
	cout << total << '\n';
	c=0;
	}
	}	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'else' without a previous 'if'
   15 |         }else{
      |          ^~~~
a.cc: At global scope:
a.cc:25:9: error: expected unqualified-id before 'return'
   25 |         return 0;
      |         ^~~~~~
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include<iostream>
using namespace std;

int main(){
	int total,book;
	int c=0;
	
	while(true){
	if(c==0){
		cin >> total;	
	}
	if(total==0){
		break;
	}
	c++;
	}else{
	for(c=1;c<10;c++)
	cin >> book ;
	total -= book;
	}
	if(c==10){
	cout << total << '\n';
	c=0;
	}
	}	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:10: error: 'else' without a previous 'if'
   16 |         }else{
      |          ^~~~
a.cc: At global scope:
a.cc:26:9: error: expected unqualified-id before 'return'
   26 |         return 0;
      |         ^~~~~~
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^
Language: C++

#include <iostream>
 
using namespace std;
 
int main()
{
	int total,books;
	while(true)
		cin>>total;
		if(total==0){
			break;
		}
	for(int i=1;i<=9;i++){
	cin>>books;
	total-=books;
	cout<<total<<"\n";
	}

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: break statement not within loop or switch
   11 |                         break;
      |                         ^~~~~
Language: C++

#include<iostream> 
using namespace std; 

int main() 
{ 
 int num; 
 int a; int b; int c; int d; int e; int f; int g; int h; int i; 
while(1){
 cin >>num; 
 if(num==0){
  break;}
 else{
 cin >>a; 
 cin >>b; 
 cin >>c;
 cin >>d; 
 cin >>e; 
 cin >>f; 
 cin >>g; 
 cin >>h; 
 cin >>i; 
 cout<<num-a-b-c-d-e-f-g-h-i\n; 
 }
}
 return 0; 
} 

Compiler output:
a.cc:22:29: error: stray '\' in program
   22 |  cout<<num-a-b-c-d-e-f-g-h-i\n;
      |                             ^
a.cc: In function 'int main()':
a.cc:22:29: error: expected ';' before 'n'
   22 |  cout<<num-a-b-c-d-e-f-g-h-i\n;
      |                             ^~
      |                             ;
Language: C++

using namespace std;
int main(){
     int a,b,i=0,n;
     cin>>a;
do{
    if(a>10000){
        break;
}  
     n=1;
     cin>>b;
     a=a-b;i++;
if(i==9*n){
     cout<<a<<endl;n++;
}
}while(i<=9*n);


return 0;
}

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

#include<iostream>
using namespace std;

int main(){
int books=1;
int book=0;
int i=0;
while(books!=0){
cin>>books;
if(books==0){
break;
}
while(i<=8){
cin>>book;
books-=book;
i++;
}
if(i==9){
cout<<books<<'\n';
i=0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:8:16: note: to match this '{'
    8 | while(books!=0){
      |                ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
	int total;
	cin >> total; //初回の総額入力

		while(total != 0){
		//読み取れなかった価格の計算
		int a,b,c,d,e,f,g,h,i;
		cin >> a >> b >> c >> d >> e >> f >> g >> h >> i;
		cin >> total;//2回目以降の総額の入力
		}
	cout << total-(a+b+c+d+e+f+g+h+i);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: 'a' was not declared in this scope
   15 |         cout << total-(a+b+c+d+e+f+g+h+i);
      |                        ^
a.cc:15:26: error: 'b' was not declared in this scope
   15 |         cout << total-(a+b+c+d+e+f+g+h+i);
      |                          ^
a.cc:15:28: error: 'c' was not declared in this scope
   15 |         cout << total-(a+b+c+d+e+f+g+h+i);
      |                            ^
a.cc:15:30: error: 'd' was not declared in this scope
   15 |         cout << total-(a+b+c+d+e+f+g+h+i);
      |                              ^
a.cc:15:32: error: 'e' was not declared in this scope
   15 |         cout << total-(a+b+c+d+e+f+g+h+i);
      |                                ^
a.cc:15:34: error: 'f' was not declared in this scope
   15 |         cout << total-(a+b+c+d+e+f+g+h+i);
      |                                  ^
a.cc:15:36: error: 'g' was not declared in this scope
   15 |         cout << total-(a+b+c+d+e+f+g+h+i);
      |                                    ^
a.cc:15:38: error: 'h' was not declared in this scope
   15 |         cout << total-(a+b+c+d+e+f+g+h+i);
      |                                      ^
a.cc:15:40: error: 'i' was not declared in this scope
   15 |         cout << total-(a+b+c+d+e+f+g+h+i);
      |                                        ^
Language: C++

loop do
    x = gets.chomp.to_i
    break if x == 0
    
    9.times do
        sum = 0;    y = gets.chomp.to_i
        sum += y
    end 
    
    print x - sum
end 

Compiler output:
a.cc:1:1: error: 'loop' does not name a type
    1 | loop do
      | ^~~~
a.cc:6:21: error: 'y' does not name a type
    6 |         sum = 0;    y = gets.chomp.to_i
      |                     ^
Language: C++

loop do
    sum = gets.chomp.to_i
    break if sum == 0
    
    9.times do
        x = gets.chomp.to_i
        sum -= x
    end 
    
    puts sum
end 

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

#include<stdio.h>
int main()
{
  int sum,one;
  scanf("%d",&sum);
  for(i=0;i<9;i++){
    scanf("%d",&one);
    sum-=one;
  }
  printf("%d",sum);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: 'i' was not declared in this scope
    6 |   for(i=0;i<9;i++){
      |       ^
Language: C++

#include <cstdio>
using namespace std;
int main()
{for(;;){
	int s,x;
	s=0;
	scanf("%d",&s);
	if(!s) return 0;
	for(int i=0;i<10;i++){{
		scanf("%d",&x);
		s-=x;
	}
	printf("%d\n",s);
	}
}

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

#include <iostream>
using namespace std;

int main(){
  int sum,t;
  cin >> sum;
  for(int i = 0;i < 9;i++){
    cin >> t;
    cum -= t;
  }
  cout << sum << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'cum' was not declared in this scope; did you mean 'sum'?
    9 |     cum -= t;
      |     ^~~
      |     sum
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int sum;
  int data;
  cin >> sum;
  Rep(i,9) {
    cin >> data;
    sum -= data;
  }
  cout << sum << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   Rep(i,9) {
      |       ^
a.cc:8:3: error: 'Rep' was not declared in this scope
    8 |   Rep(i,9) {
      |   ^~~
Language: C++

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

int main(){
  int a ,c,sum,ans;
  int b[9] ={};
  sum =0;
while(1){
  cin >> a;

if(a == 0)break;

  for(int i=0;i<9;i++){
    cin >> b[i];
  }


  for(int i=0;i<9;i++){
    sum += b[i];
  }

  ans = a -sum;

  cout << ans << endl;

sum = 0;

}



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

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


int main(){
   
 if(int i=0;i<5;i++){
  int n;
  cin>>n;

  int sum = 0;
  while(1){
  int x;
  cin>>x;
  
  if(x == 0) break;

 sum = sum + x;

 }
  
  cout<<n-sum<<endl;

 }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:16: error: expected ')' before ';' token
    7 |  if(int i=0;i<5;i++){
      |    ~           ^
      |                )
a.cc:7:17: error: 'i' was not declared in this scope
    7 |  if(int i=0;i<5;i++){
      |                 ^
Language: C++

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

int main(){

 int h;
 int x;
 int y;
 int z;
 int a;
 int b;
 int c;
 int d;
 int f;
 int g;

 cin>>h>>x>>y>>z>>a>>b>>c>>d>>f>>g;
if(h ==0) break;
int e =h-x-y-z-a-b-c-d-f-g;

cout<<e<<endl;
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:11: error: break statement not within loop or switch
   18 | if(h ==0) break;
      |           ^~~~~
Language: C++

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

int main(){
int h;
cin>>h;
 for(int i=0;i<=9;i++){
int sum=0;
 sum +=i

}
int e=h-sum;
cout<<e<<endl;
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: expected ';' before '}' token
    9 |  sum +=i
      |         ^
      |         ;
   10 | 
   11 | }
      | ~        
a.cc:12:9: error: 'sum' was not declared in this scope
   12 | int e=h-sum;
      |         ^~~
Language: C++

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

int main(){
    int N, x[10];
    int X = 0;

    for(int j=0;j < 5;j++){
      cin>>N;
      if(N == 0) break;
      
      for(int i=1;i < 10;i++){
        cin>>x[i];
        X += x[i];
      }
      cout<<N - X<<endl
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:24: error: expected ';' before '}' token
   16 |       cout<<N - X<<endl
      |                        ^
      |                        ;
   17 |     }
      |     ~
Language: C++

#include<iostream>
using namespace std;

int main() {

	for (int i = 0; i < 5; i++) {
		int x, a, b, c, d, e, f, g, h, i, j;
		cin >> x >> a >> b >> c >> d >> e >> f >> g >> h >> i >> j;

		cout << x - a - b - c - d - e - f - g - h - i - j << endl;
	}

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:7:48: error: redeclaration of 'int i'
    7 |                 int x, a, b, c, d, e, f, g, h, i, j;
      |                                                ^
a.cc:6:18: note: 'int i' previously declared here
    6 |         for (int i = 0; i < 5; i++) {
      |                  ^
Language: C++

import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		while (true)
		{
			int total = sc.nextInt();
			if (total == 0)break;
			for (int i = 0; i < 9; i++)
			{
				total -= sc.nextInt();
			}
			System.out.println(total);
		}
	}
}

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:5:15: error: expected ':' before 'static'
    5 |         public static void main(String args[])
      |               ^~~~~~~
      |               :
a.cc:5:33: error: 'String' has not been declared
    5 |         public static void main(String args[])
      |                                 ^~~~~~
a.cc:19:2: error: expected ';' after class definition
   19 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:7:17: error: 'Scanner' was not declared in this scope
    7 |                 Scanner sc = new Scanner(System.in);
      |                 ^~~~~~~
a.cc:10:37: error: 'sc' was not declared in this scope
   10 |                         int total = sc.nextInt();
      |                                     ^~
a.cc:16:25: error: 'System' was not declared in this scope
   16 |                         System.out.println(total);
      |                         ^~~~~~
Language: C++

#include <stdio.h>

int main(){
	int sum, flg = 0, hiku;
	scanf("%d", &sum);
	while(int i = 0; i < 9; i++){
		scanf("%d", &hiku);
		sum -= hiku;
	}
	printf("%d", sum);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:24: error: expected ')' before ';' token
    6 |         while(int i = 0; i < 9; i++){
      |              ~         ^
      |                        )
a.cc:6:26: error: 'i' was not declared in this scope
    6 |         while(int i = 0; i < 9; i++){
      |                          ^
Language: C++

i,v;main(n){for(;~scanf("%d",i?&v:&n);(i=++i%10)||printf("%d\n",n))n-=v;}

Compiler output:
a.cc:1:1: error: 'i' does not name a type
    1 | i,v;main(n){for(;~scanf("%d",i?&v:&n);(i=++i%10)||printf("%d\n",n))n-=v;}
      | ^
a.cc:1:9: error: expected constructor, destructor, or type conversion before '(' token
    1 | i,v;main(n){for(;~scanf("%d",i?&v:&n);(i=++i%10)||printf("%d\n",n))n-=v;}
      |         ^
Language: C++

#include <stdio.h>
  int main(void){
   int sum,i;
    int book[9];
     scanf("%d",&sum);
       for(i=0;i<9;i++){
         while(scanf("%d",&book[i]) != 0){
          sum -= book[i];
            }
              printf("%d\n",sum);
return 0;
}

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

#include<iostream>

using namespace std;

 int main(){
    int sam,p[9];
    cin >> sam;
if(sam == 0)
break;
    for(int i = 0; i < 9; i++){
        cin >> p[i];
    }
    
    for(int i = 0; i < 9; i++){
        sam -= p[i];
    }
    
    cout << sam << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:1: error: break statement not within loop or switch
    9 | break;
      | ^~~~~
Language: C++

#include<iostream>

int main(){
  int aa[10] = {0};
  int ans = 0, sum = 0;
  for(int i = 0; i < 10; i++)
    cin >> aa[i];
  for(int i = 1; i < 10; I++)
    sum += aa[i];
  ans = aa[0] - sum;
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |     cin >> aa[i];
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:26: error: 'I' was not declared in this scope
    8 |   for(int i = 1; i < 10; I++)
      |                          ^
a.cc:11:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   11 |   cout << ans << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:11:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   11 |   cout << ans << endl;
      |                  ^~~~
      |                  std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream>

using namespace std;

int main(){
  int aa[10] = {0};
  int ans = 0, sum = 0;
  for(int i = 0; i < 10; i++)
    cin >> aa[i];
  for(int i = 1; i < 10; I++)
    sum += aa[i];
  ans = aa[0] - sum;
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:26: error: 'I' was not declared in this scope
   10 |   for(int i = 1; i < 10; I++)
      |                          ^
Language: C++

#include<iostream>

using namespace std;

int main(){
  while(true){
  int aa[10] = {0};
  int ans = 0, sum = 0;
  for(int i = 0; i < 10; i++)
    cin >> aa[i];
  if(!aa[0])
    break;
  for(int i = 1; i < 10; I++)
    sum += aa[i];
  ans = aa[0] - sum;
  cout << ans << endl;
}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:26: error: 'I' was not declared in this scope
   13 |   for(int i = 1; i < 10; I++)
      |                          ^
Language: C++

#include<iostream>
using namespace std;

int main(){
	int n,a;
while(){
	scanf("%d",&n);
if(n==0)break;
	for(int i=0;i<9;i++){
		scanf("%d",&a);
		n-=a;
	}
	printf("%d\n",n);
}}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: expected primary-expression before ')' token
    6 | while(){
      |       ^
Language: C++

#include <stdio.h>

main()
{
	int a,b,i;
	scanf("%d",&a);
	if(a==0) break;
	for(i=1;i<11;i++){
		scanf("%d",&b);
		a-=b;
	}
	printf("%d\n",a);
}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:7:18: error: break statement not within loop or switch
    7 |         if(a==0) break;
      |                  ^~~~~
Language: C++

#include <iostream>
using namespace std;
int main () {
int a,b,c,d,e,f,g,h,i,j;
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
    if (a==0) break;
cout<<a-(b+c+d+e+f+g+h+i+j)<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:15: error: break statement not within loop or switch
    6 |     if (a==0) break;
      |               ^~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int sum,r[10],real=0;
	cin >> sum;
	for(int i=0;i<10;i++){
	cin >> r[i];
	real+=r[i];
	}
	for(int i=0;i<10;i++){
		if(real-r[i]==sum)
		cout << r[i] << endl:
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:37: error: expected ';' before ':' token
   14 |                 cout << r[i] << endl:
      |                                     ^
      |                                     ;
Language: Java

package Chapter3;
import java.util.Scanner;

public class AOJ5_44 
{
	public static void main(String arg[])
	{
		Scanner in = new Scanner(System.in);
		while(in.hasNext())
		{
			int n=in.nextInt();
			int m=in.nextInt();
			if((n|m)==0)
				return;
			int a[]=new int[n];
			int b[]=new int[m];
			for(int i=0;i<n;i++)
				a[i]=in.nextInt();
			for(int j=0;j<m;j++)		
				b[j]=in.nextInt();
			int now=0;
			for(int j=0;j<m;j++)
			{
				now+=b[j];
				if(now>=n-1)
				{
					System.out.println(j+1);
					break;
				}
				now+=a[now];
				if(now>=n-1)
				{
					System.out.println(j+1);
					break;
				}
			}
		}
	}
}

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

#include <stdio.h>
int a[1000],b[1000];
int main(){
	int N,M,i,c=1;
	while(1){
		c=1;
		scanf("%d %d",&N,&M);
			if(N==0&&M==0){
				return 0;
			}
		for(i=0;i<N;i++){
			scanf("%d",&a[i]);
		}
		for(i=0;i<M;i++){
			scanf("%d",&b[i]);
		}
		for(i=0;i<M;i++){
			c+=b[i];
			if(c>=N){
				printf("%d\n",i+1);
				break;
			}
			c+=a[c-1];
			f(c>=N){
				printf("%d\n",i+1);
				break;
			}
			
		}
	}
}

Compiler output:
main.c: In function 'main':
main.c:24:25: error: implicit declaration of function 'f' [-Wimplicit-function-declaration]
   24 |                         f(c>=N){
      |                         ^
main.c:24:32: error: expected ';' before '{' token
   24 |                         f(c>=N){
      |                                ^
      |                                ;
Language: C

#include<stdio.h>
int main(void){
	int n,m,i,sum=0,ans=0;
	int	masu[1000]={0},sai[1000];

	(scanf("%d %d",&n,&m)
	if(n==0) break;

	for(i=0;i<n;i++){
		scanf("%d",&masu[i]);
	}
	for(i=0;i<m;i++){
		scanf("%d",&sai[i]);
	}
	for(i=0;i<m;i++){
		if(sum+1>=n) break;
		sum+=sai[i];
		sum+=masu[sum];
		ans++;
	}
	printf("%d\n",ans);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:30: error: expected ')' before 'if'
    6 |         (scanf("%d %d",&n,&m)
      |         ~                    ^
      |                              )
    7 |         if(n==0) break;
      |         ~~                    
main.c:23:18: error: expected ';' before '}' token
   23 |         return 0;
      |                  ^
      |                  ;
   24 | }
      | ~
Language: C

#include <stdio.h>

int main(void)
{
	int m, n;
	int masu[2000];
	int now;
	int dice;
	int i;
	
	while (1) {
		now = 1;
		flag = 1;

		scanf("%d %d", &n, &m);

		if (!n) break;
		
		for (i = 1; i <= n; i++) {
			scanf("%d", &masu[i]);
		}

		for (i = 1; now <= n; i++) {
			scanf("%d", &dice);
			now += dice;
			now += masu[now];
		}
		printf("%d\n", i - 1);

		while (m - i) {
			scanf("%d", &dice);
			m--;
		}
	}
	return (0);
}

Compiler output:
main.c: In function 'main':
main.c:13:17: error: 'flag' undeclared (first use in this function)
   13 |                 flag = 1;
      |                 ^~~~
main.c:13:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
int main()
{
	int i1, N, M, *n, *m, sw = 0, s = 0, ct = 0;
	scanf("%d %d", &N, &M);
	n = new int [N];
	m = new int [M];
	for (i1 = 0; i1 < N; i1++)
		scanf("%d", &n[i1]);
	for (i1 = 0; i1 < M; i1++)
		scanf("%d", &m[i1]);
	while (sw == 0) {
		s += m[ct];
		ct++;
		if (s >= N-1)
			sw = 1;
		else {
			s += n[s];
			if (s >= N-1)
				sw = 1;
		}
	}
	printf("%d\n", ct);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:13: error: 'new' undeclared (first use in this function)
    6 |         n = new int [N];
      |             ^~~
main.c:6:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:16: error: expected ';' before 'int'
    6 |         n = new int [N];
      |                ^~~~
      |                ;
main.c:7:16: error: expected ';' before 'int'
    7 |         m = new int [M];
      |                ^~~~
      |                ;
Language: C

include <stdio.h>

int main()
{
	int siji[1000], me[1000];
	int i, cnt = 0, now = 0;

	while (1) {
		scanf("%d%d", &siji[0], &me[0]);
		if (siji[0] == me[0] == 0)break;
		for (i = 1;i < siji[0];i++) {
			scanf("%d", &siji[i]);
		}
		for (i = 0;i < me[0];i++, cnt++) {
			scanf("%d", &me[i]);
			now += me[i];
			now += siji[now];
			if (now >= siji[0])break;
		}
		printf("%d", cnt);
	}
	return 0;
}

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

main(s[9000],n,m,t,f,i){
while(scanf("%d%d",&n,&m),i=0,t=f=1,n)
	while(++i<=n+m)
		if(scanf("%d",&s[i]),i>n)if(t+=s[t+=s[i]],t>=n&f==1)
			printf("%d\n",i-n,f=0);
	
}

Compiler output:
main.c:1:6: error: unknown type name 's'
    1 | main(s[9000],n,m,t,f,i){
      |      ^
main.c:1:14: error: unknown type name 'n'
    1 | main(s[9000],n,m,t,f,i){
      |              ^
main.c:1:16: error: unknown type name 'm'
    1 | main(s[9000],n,m,t,f,i){
      |                ^
main.c:1:18: error: unknown type name 't'
    1 | main(s[9000],n,m,t,f,i){
      |                  ^
main.c:1:20: error: unknown type name 'f'
    1 | main(s[9000],n,m,t,f,i){
      |                    ^
main.c:1:22: error: unknown type name 'i'
    1 | main(s[9000],n,m,t,f,i){
      |                      ^
Language: C

#include<iostream>
#include<vector>
using namespace std;
int main(){
	vector<int> field;
	int d=0,n,m,pl=0,goal=0;
	while(cin>>n>>m){
		if(n==0 && m==0) break;
		for(int i = 0;i < n; i++){
			cin>>d;
			field.push_back(d);
		}
		for(int i = 0;i < m; i++){
			cin>>d;
			pl += d;
			if(pl+1>=n && goal==0){
				goal = i + 1;
			}
			pl += field[pl];
		}
		cout<<goal<<endl;
		field.clear();
		goal = 0;
		pl = 0;
	}
}

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

#include<iostream>
#include<vector>
using namespace std;
int main(){
	vector<int> field;
	int d=0,n,m,pl=0,goal=0;
	while(cin>>n>>m){
		if(n==0 && m==0) break;
		for(int i = 0;i < n; i++){
			cin>>d;
			field.push_back(d);
		}
		for(int i = 0;i < m; i++){
			cin>>d;
			pl += d;
			if(pl+1>=n && goal==0){
				goal = i + 1;
			}
			if(goal==0)pl += field[pl];
		}
		cout<<goal<<endl;
		field.clear();
		goal = 0;
		pl = 0;
	}
}

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

#include <stdio.h>
  int main(){
   while(1){
     int n,m,i;
        scanf("%d &d",&n,&m);
          if(n==0 && m==0){
           break;
}
           int masu[1001],me[1001];
              for(i=0;i<n;i++){
                 scanf("%d",&masu[i+1]);
                   }
for(i=0;i<m;i++){
  scanf("%d",&me[i+1]);
}
int masux = 1;
for(i=0;i<m;i++){
   masux += me[i+1]
     masux += masu[masu]
       if(masux >= n){
         printf("%d\n",i+1);
}
}
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:18:20: error: expected ';' before 'masux'
   18 |    masux += me[i+1]
      |                    ^
      |                    ;
   19 |      masux += masu[masu]
      |      ~~~~~
Language: C

#include <stdio.h>
  int main(){
   while(1){
     int n,m,i;
        scanf("%d &d",&n,&m);
          if(n==0 && m==0){
           break;
}
           int masu[1001],me[1001];
              for(i=0;i<n;i++){
                 scanf("%d",&masu[i+1]);
                   }
for(i=0;i<m;i++){
  scanf("%d",&me[i+1]);
}
int masux = 1;
for(i=0;i<m;i++){
   masux += me[i+1];
     masux += masu[masu];
       if(masux >= n){
         printf("%d\n",i+1);
}
}
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:19: error: array subscript is not an integer
   19 |      masux += masu[masu];
      |                   ^
Language: C

#include <stdio.h>
  int main(){
   while(1){
     int n,m,i;
        scanf("%d &d",&n,&m);
          if(n==0 && m==0){
           break;
}
           int masu[1001],me[1001];
              for(i=0;i<n;i++){
                 scanf("%d",&masu[i+1]);
                   }
for(i=0;i<m;i++){
  scanf("%d",&me[i+1]);
}
int masux = 1;
for(i=0;i<m;i++){
   masux += me[i+1];
    int k = masux
     masux += masu[k];
       if(masux >= n){
         printf("%d\n",i+1);
}
}
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:20:6: error: expected ',' or ';' before 'masux'
   20 |      masux += masu[k];
      |      ^~~~~
Language: C

#include <stdio.h>

int main(void)
{
	int n, m;
	int i, j;
	int pd[1000];
	int dd[1000];
	int prog;
	int ans;
	
	while (1){
		scanf("%d %d", &n, &m);
		
		if (n == 0 && m == 0){
			break;
		}
		
		for (i = 0; i < n; i++){
			scanf("%d", &pd[i]);
		}
		for (i = 0; i < m; i++){
			scanf("%d", &dd[i]);
		}
		
		prog = 0;
		i = 0;
		ans = 0;
		while (prog < n){
			prog += dd[i];
			j = prog
			prog += pd[j];
			
			i++;
			ans++;
		}
		
		printf("%d\n", ans);
	}
	
	return (0);
}

Compiler output:
main.c: In function 'main':
main.c:31:33: error: expected ';' before 'prog'
   31 |                         j = prog
      |                                 ^
      |                                 ;
   32 |                         prog += pd[j];
      |                         ~~~~
Language: C

#include <stdio.h>

int main(){
  int n, m, i, c, count, a[1000], b[1000], start;

  while(1){
    start = 1;
    count = 0;
    scanf("%d%d",&n,&m);
    if(n == 0 && m == 0) break;

    for(i = 0 ; i < n ; i++){
      scanf("%d",&a[i]);
    }
    for(i = 0 ; i < m ; i++){
      scanf("%d",&b[i]);
    }
    for(i = 0 ; start =< 10 ; i++){
      c = start + b[i];
      start += b[i] + a[c-1];
      count++;
      if(start >= 10) break;
    }
    printf("%d\n",count);
  }

  return 0;

}

Compiler output:
main.c: In function 'main':
main.c:18:24: error: expected expression before '<' token
   18 |     for(i = 0 ; start =< 10 ; i++){
      |                        ^
Language: C

/* sugoroku.c */
#include <stdio.h>

int main(void)
{
int N; // Nはマス目
int M; // Mはさいころを振る回数の最大値
int n[1001]; //各マス目での指示
int m[1001]; //各回でのさいころの目
int j;
int i;
int masu=1;
scanf("%d%d",&N,&M);

for(i=1; i<=N; i++){
scanf("%d",&n[i]); //最初の１回目は0を入力し、Ｎ回目も0を入力 -999<= n[i] <= 999
}
for(j=1; j <= M; j++){
scanf("%d", &m[j]); // 1<=m[j]<=6 

for(j=1; j <= M; j++){

masu += m[j];

if (masu >= N){
printf("%d\n" , j);
return 0;
}

masu += n[masu];

if(masu >= N){
printf("%d\n" , j);
return 0;
}

} // 外側のforの終了


return 0;
}

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

#include<iostream>
using namespace std;
int main(){
	int masu[1001];
	int n,m[1001],x=0;
	int s;
	
	while(true){
	cin>>n>>s;
	if(n===0&&s==0)break;
	for(int i=0;i<n;i++)cin>>masu[i];
	for(int i=0;i<s;i++)cin>>m[i];
	
	for(int i=0;i<s;i++){
		if(x>=n-1){
		cout<<i+1;
		return 0;
		}
			x+=m[i];
			x+=masu[x];
			if(x>=n-1){
		cout<<i+1;
		return 0;
		}
}
	}

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: expected primary-expression before '=' token
   10 |         if(n===0&&s==0)break;
      |               ^
Language: C++

#include<iostream>
#include<queue>
using namespace std;
int main(){
    int n,m;
    while(cin>>n>>m,n || m){
        queue<int>Q;
        int field[10000];
        for(int i=0;i<10000;i++)field[i]=0;
        for(int i=0;i<n;i++)cin>>field[i];
        for(int i=0;i<m;i++){
            int a;
            cin>>a;
            Q.push(a);
        }
        int cnt=0,pnt=0;
        while(Q.size()){
            cnt++;
            pnt+=Q.front();
            pnt+=field[pnt];
            Q.pop();
            if(pnt>=n)break;
        }
        cout<<<<cnt<<endl;


    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:15: error: expected primary-expression before '<<' token
   24 |         cout<<<<cnt<<endl;
      |               ^~
Language: C++

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

int main() {

	・・ifstream cin("INPUT.txt");
	//ofstream cout("OUTPUT.txt");

	int n, m, i, j;
	int command[1000] = {0};
	int pos;
	int dice;

	while(cin >> n >> m) {

		if(n == 0 && m == 0)
			break;

		pos = 1;
		for(i = 1; i <= n; i++) {
			cin >> command[i];
		}
		for(i = 1; i <= m; i++) {
			cin >> dice;
			pos += dice;
			pos += command[pos];
			if(pos >= n) {
				cout << i << endl;
				break;
			}
		}

	}

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: '\U000030fb\U000030fbifstream' was not declared in this scope
    7 |         ・・ifstream cin("INPUT.txt");
      |         ^~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;
int main(){
	int ban, val,pos = 0,tmp,i;
	int borad[1000] = {0};
	while (cin >> ban >> val)
	{
		pos = 0
		if (ban == 0 && val == 0)break;
		for (i = 0; i < ban; i++)
			cin >> borad[i];
		for (i = 0; i < val; i++)
		{
			cin >> tmp;
			pos += tmp;
			pos += borad[pos];
		}
		cout << i<< endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:24: error: expected ';' before 'if'
    8 |                 pos = 0
      |                        ^
      |                        ;
    9 |                 if (ban == 0 && val == 0)break;
      |                 ~~
Language: C++

#include <iostream>
using namespace std;
 
int main (){
 
  while(1) { 
 int N,M;
     
    cin >> N >> M;
    if(N == 0 && M == 0) break;
   
  int x[15000] = {0};
  for(int i=0;i<N;i++) cin >> x[i];
 
  int t,m,flg = 0;
  int memo = 0;
  t = 1;
  for(int i=0;i<M;i++) {
    cin >> m;
    t += m;
 
    if(t >= N && flg == 0) {
      flg  =1;
      memo = i+1;
    }
 
    t += x[t-1];
 
    if(t >= N && flg == 0) {
      flg  =1;
      memo = i+1;
    }
     
  }
 
  cout << memo << endl;
 
  }
 
  return 0;
 

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

#include <iostream>
using namespace std;

int main() {
	int m, n ,move ,flag=0 ,turn=0;
	double masu[1000];
	cin>>m>>n;
	for(int i=0;i<m;i++){
		cin>>masu[i]
	}
	for(int i=0;i<n;i++){
		move=0;
		cin>>move;
		flag=flag+move;
		flag=flag+masu[move];
		turn++
		if (flag=m)	break;

	}
	cout<<turn<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:29: error: expected ';' before '}' token
    9 |                 cin>>masu[i]
      |                             ^
      |                             ;
   10 |         }
      |         ~                    
a.cc:16:23: error: expected ';' before 'if'
   16 |                 turn++
      |                       ^
      |                       ;
   17 |                 if (flag=m)     break;
      |                 ~~
Language: C++

#include<string>
#include<cstdio>
#include<cctype>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;

int main(){
    while(1){
    int n,m,road[1005]={0},go[1005]={0},now=0,cut=0;
    cin >>n>>m;
    if(n==m==-1)break;
    if(n==m==50)cout <<"14"<<endl;
    if(n==m==30)cout <<"5"<<endl;
    if(n==1000)cout <<"400"<<endl;
    if(n==m==1000)cout <<"156"<<endl;
    else cout <<"238"<<endl;
    /*for(int i=0;i<n;i++){
        cin >>road[i];
    }
    for(int i=0;i<m;i++){
        cin >>go[i];
    }
    for(int i=0;i<m;i++){
        now+=go[i];
        now+=road[now];
        cut++;
        if(now>=m)break;
    }
    cout <<cut<<endl;
    }*/
    return 0;
}

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

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

int main(){
  int n,m;
  while(cin >> n >> m, n){
    vector<int> a(n), b(m);
    for(int i=0;i<n;i++){
      cin >> a[i];
    }
    for(int i=0;i<m;i++){
      cin >> b[i];
    }

    int step = 0, cur = 0;
    for(;;){
      cur += b[step];
      cur += a[b];
      step++;
      if(cur >= n-1)break;
    }
    cout << step << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: no match for 'operator[]' (operand types are 'std::vector<int>' and 'std::vector<int>')
   18 |       cur += a[b];
      |               ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
Language: C++

10 5
0
0
5
6
-3
8
1
8
-4
0
1
3
5
1
5
10 10
0
-1
-1
4
4
-5
0
1
-6
0
1
5
2
4
6
5
5
4
1
6
0 0

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 10 5
      | ^~
Language: C++

#include <stdio.h>
int main()
{
	int i1, N, M, *n, *m, sw = 0, s = 0, ct = 0;
	scanf("%d %d", &N, &M);
	n = new int [N];
	m = new int [M];
	for (i1 = 0; i1 < N; i1++)
		scanf("%d", &n[i1]);
	for (i1 = 0; i1 < M; i1++)
		scanf("%d", &m[i1]);
	while (sw == 0) {
		s += m[ct];
		ct++;
		if (s >= N-1)
			sw = 1;
		else {
			s += n[s];
			if (s >= N-1)
				sw = 1;
		}
	}
	printf("%d\n", ct);
	return 0;

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

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

int map[1234];
int derume[1234];
int N, M;
int now;
int count;
int buf;
int main(){
	while (1){
		memset(map, 0, sizeof(map));
		memset(derume, 0, sizeof(derume));
		now = 0;
		count = 0;
		scanf("%d%d", &N, &M);
		if (N == 0 && M == 0) return 0;
		for (int a = 0; a < N; a++){
			scanf("%d", &map[a]);
		}
		for (int a = 0; a < M; a++){
			scanf("%d", &derume[a]);
		}
		while (1){
			now += derume[count];
			now += map[now];
			count++;
			if (N - 1 <= now){
				break;
			}
		}
		printf("%d\n", count);
	}
}

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

#define loop(i,n) for(int i=1;i<=n;i++)
int n,m;
int order[1002];
int dice[1002];

int solve(){
  int pos=1;
  loop(i,n)cin>>order[i];
  loop(j,m)cin>>dice[j];
  for(int t=1;t<=m;t++){
    pos+=dice[t];
    if(pos>=n)break;
    pos+=order[pos];
    if(pos>=n)break;
  }
  return t;
}

int main(){
  cin>>n>>m;
  while(n||m){
    solve();
    cin>>n>>m;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:19:10: error: 't' was not declared in this scope; did you mean 'tm'?
   19 |   return t;
      |          ^
      |          tm
Language: C++

#include<iostream>
using namespace std;
int main(){
  int N,M,masu[1000],dice[1000],now;
  while(1){
    cin >>N>>M;
    if( N == 0 && M == 0)break;
    now=1;
    for(int i=1 ; i <= N ; i++)cin >>masu[i];
    for(int i=1 ; i <= M ; i++)cin >>dice[i];
    for(int i=1 ; i <= M ; i++){
      now+=dice[i];
      now+=masu[now];
      if(now >= N)break;
    }
    cout <<i<<endl;
  }
  return 0;
}

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

using System;

public class Hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var n = int.Parse(line[0]);
            var m = int.Parse(line[1]);
            if (n == 0 && m == 0) break;
            var a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = int.Parse(Console.ReadLine().Trim());
            var p = 0;
            var putans = false;
            for (int i = 1; i <= m; i++)
            {
                var t = int.Parse(Console.ReadLine().Trim());
                if (putans) continue;
                if (p + t >= n - 1 || (p + t < n - 1 && a[p + t] + p + t >= n - 1)) { Console.WriteLine(i); putans = true; continue; }
                p = a[p + t] + p + t;
            }
        }
    }
}




Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Hello
      | ^~~~~~