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

import java.util.Scanner;

public class ITP2_10_C {
	public static void main(String[] args){
		int q, order_num, i, j, n = 0, counter;
		boolean[] flag = new boolean[64];
		StringBuilder str = new StringBuilder();
		try (Scanner sc = new Scanner(System.in)) {
			q = sc.nextInt();
			for(j = 0; j < q; j++) {
				order_num = sc.nextInt();
				if(order_num <= 3) {
					n = sc.nextInt();
				}
				switch(order_num) {
				case 0 : System.out.println(flag[n] ? "1" : "0"); break;
				case 1 : flag[n] = true; break;
				case 2 : flag[n] = false; break;
				case 3 : flag[n] = !flag[n]; break;
				case 4 :
					counter = 1;
					for(i = 0; i < 64; i++) {
						if(flag[i] != true) {
							counter = 0;
							break;
						}
					}
					System.out.println(counter); break;
				case 5 :
					counter = 0;
					for(i = 0; i < 64; i++) {
						if(flag[i] != false) {
							counter = 1;
							break;
						}
					}
					System.out.println(counter); break;
				case 6 :
					counter = 1;
					for(i = 0; i < 64; i++) {
						if(flag[i] == true) {
							counter = 0;
							break;
						}
					}
					System.out.println(counter); break;
				case 7 :
					counter = 0;
					for(i = 0; i < 64; i++) {
						if(flag[i] == true) {
							counter++;
						}
					}
					System.out.println(counter); break;
				case 8 :
					for(i = 0; i < 64; i++) {
						str.append(flag[i] ? 1 : 0);
					}
					str.reverse();
					System.out.println(Long.parseUnsignedLong(str.toString(), 2));
				}
			}
		}
	}
}



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

import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		
		int n=in.nextInt(),m=(int)Math.pow(2, n+1)-1;
		PrintWriter out=new PrintWriter(System.out);
		for(int i=0;i<=m;i++){
			String str=Integer.toBinaryString(i);
//			System.out.println(str);
			
			List<Integer> ls=new ArrayList<>();
			for(int j=0;j<str.length();j++){
				if(str.charAt(str.length()-1-j)=='1')ls.add(j);
			}
			
			out.print(i+":");
			for(int j=0;j<ls.size();j++)out.print(" "+ls.get(j));
			out.println();
		}
		out.flush();
	}a

}



Compiler output:
Main.java:24: error: <identifier> expected
	}a
	  ^
1 error
Language: Java

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

public class ITP2_11_C {
	public static void main(String[] args){
		int n, i, j = 0, pow, input = 0, k, m;
		try (Scanner sc = new Scanner(System.in)) {
			n = sc.nextInt();
			k = sc.nextInt();
			int[] a = new int[n];
			List<Integer> b = new ArrayList<>(n);
			for(i = 0; i < k; i++) {
				input = sc.nextInt();
				for(;j < input; j++) {
					b.add(j);
				}
				j = j + 1;
			}
			pow = (int) (Math.pow(2, j));
			calculation :
			for(i = 0; i < pow; i++) {
				m = i;
				for(j = 0; m != 0; j++) {
					if(m % 2 == 1) {
						a[j] = 1;
						if(b.contains(j)) {
							continue calculation;
						}
					}else {
						a[j] = 0;
					}
					m /= 2;
				}
				System.out.print(i + ":");
				for(j = 0; j < a.length; j++) {
					if(a[j] == 1) {
						System.out.print(" " + j);
					}
				}
				System.out.println();
			}
		}
	}
}


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

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

public class ITP2_11_C {
	public static void main(String[] args){
		int n, i, j = 0, pow, input = 0, k, m;
		try (Scanner sc = new Scanner(System.in)) {
			n = sc.nextInt();
			k = sc.nextInt();
			int[] a = new int[n];
			List<Integer> b = new ArrayList<>(28);
			for(i = 0; i < k; i++) {
				input = sc.nextInt();
				for(;j < input; j++) {
					b.add(j);
				}
				j = j + 1;
			}
			pow = (int) (Math.pow(2, j));
			calculation :
			for(i = 0; i < pow; i++) {
				m = i;
				for(j = 0; m != 0; j++) {
					if(m % 2 == 1) {
						a[j] = 1;
						if(b.contains(j)) {
							continue calculation;
						}
					}else {
						a[j] = 0;
					}
					m /= 2;
				}
				System.out.print(i + ":");
				for(j = 0; j < a.length; j++) {
					if(a[j] == 1) {
						System.out.print(" " + j);
					}
				}
				System.out.println();
			}
		}
	}
}


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

import java.util.*;

public class MyClass{  
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        List<Integer> sales = new ArrayList<>();
        
        int n = sc.nextInt();
        
        for(int i=0; i<n; i++){
            int a = sc.nextInt();
            int count = 0;
            
            switch(a){
                case 0:
                    sales.add(sc.nextInt());
                    count ++;
                    break;
                case 1:
                    System.out.println(sales.get(sc.nextInt()));
                    break;
                case 2:
                    sales.remove(sales.size() -1);
                    break;                        
            }
        }
    }
}


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

import java.util.Scanner;
public class Main{
    public static void run(String str, Vector<Integer> vec){
        switch(str.charAt(0)){
            case '0' : vec.add(Character.getNumericValue(str.charAt(2))); break;
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(str.charAt(2)))); break;
            case '2' : vec.remove(vec.size()-1); break;
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Vector<Integer> vec = new Vector<Integer>();
        int q = sc.nextInt();
        for(int i = 0 ; i < q ; i++){
            String str = sc.nextLine();
            run(str,vec);
        }
    }
}


Compiler output:
Main.java:3: error: cannot find symbol
    public static void run(String str, Vector<Integer> vec){
                                       ^
  symbol:   class Vector
  location: class Main
Main.java:12: error: cannot find symbol
        Vector<Integer> vec = new Vector<Integer>();
        ^
  symbol:   class Vector
  location: class Main
Main.java:12: error: cannot find symbol
        Vector<Integer> vec = new Vector<Integer>();
                                  ^
  symbol:   class Vector
  location: class Main
3 errors
Language: Java

import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Vector<Integer> vec = new Vector<Integer>();
        int q = sc.nextInt();
        for(int i = 0 ; i < q ; i++){
            String str = sc.nextLine();
            switch(str.charAt(0)){
            case '0' : vec.add(Character.getNumericValue(str.charAt(2))); break;
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(str.charAt(2)))); break;
            case '2' : vec.remove(vec.size()-1); break;
            }
        }
    }
}


Compiler output:
Main.java:5: error: cannot find symbol
        Vector<Integer> vec = new Vector<Integer>();
        ^
  symbol:   class Vector
  location: class Main
Main.java:5: error: cannot find symbol
        Vector<Integer> vec = new Vector<Integer>();
                                  ^
  symbol:   class Vector
  location: class Main
2 errors
Language: Java

import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Vector<Integer> vec = new Vector<>();
        int q = sc.nextInt();
        for(int i = 0 ; i < q ; i++){
            String str = sc.nextLine();
            switch(str.charAt(0)){
            case '0' : vec.add(Character.getNumericValue(str.charAt(2))); break;
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(str.charAt(2)))); break;
            case '2' : vec.remove(vec.size()-1); break;
            }
        }
    }
}


Compiler output:
Main.java:5: error: cannot find symbol
        Vector<Integer> vec = new Vector<>();
        ^
  symbol:   class Vector
  location: class Main
Main.java:5: error: cannot find symbol
        Vector<Integer> vec = new Vector<>();
                                  ^
  symbol:   class Vector
  location: class Main
2 errors
Language: Java

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Vector<Integer> vec = new Vector<>();
        int q = sc.nextInt();
        for(int i = 0 ; i < q ; i++){
            char c = sc.nextLine();
            switch(c){
            case '0' : vec.add(Character.getNumericValue(sc.next().charAt(0))); break;
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(sc.next().charAt(0)))); break;
            case '2' : vec.remove(vec.size()-1); break;
            }
        }
    }
}


Compiler output:
Main.java:8: error: incompatible types: String cannot be converted to char
            char c = sc.nextLine();
                                ^
1 error
Language: Java

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Vector<Integer> vec = new Vector<>();
        int q = sc.nextInt();
        for(int i = 0 ; i < q ; i++){
            char c = sc.next();
            switch(c){
            case '0' : vec.add(Character.getNumericValue(sc.next().charAt(0))); break;
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(sc.next().charAt(0)))); break;
            case '2' : vec.remove(vec.size()-1); break;
            }
        }
    }
}


Compiler output:
Main.java:8: error: incompatible types: String cannot be converted to char
            char c = sc.next();
                            ^
1 error
Language: Java

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Vector<Integer> vec = new Vector<>();
        int q = sc.nextInt();
        for(int i = 0 ; i < q ; i++){
            char c = sc.next().charAt(0);
            switch(c){
            case '0' : vec.add(Character.getNumericValue(sc.next().parseInt())); break;
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(sc.next().parseInt())); break;
            case '2' : vec.remove(vec.size()-1); break;
            }
        }
    }
}


Compiler output:
Main.java:11: error: ')' or ',' expected
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(sc.next().parseInt())); break;
                                                                                                        ^
1 error
Language: Java

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Vector<Integer> vec = new Vector<>();
        int q = sc.nextInt();
        for(int i = 0 ; i < q ; i++){
            char c = sc.next().charAt(0);
            switch(c){
            case '0' : vec.add(Character.getNumericValue(sc.next().parseInt())); break;
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(sc.next().parseInt()))); break;
            case '2' : vec.remove(vec.size()-1); break;
            }
        }
    }
}


Compiler output:
Main.java:10: error: cannot find symbol
            case '0' : vec.add(Character.getNumericValue(sc.next().parseInt())); break;
                                                                  ^
  symbol:   method parseInt()
  location: class String
Main.java:11: error: cannot find symbol
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(sc.next().parseInt()))); break;
                                                                                           ^
  symbol:   method parseInt()
  location: class String
2 errors
Language: Java

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Vector<Integer> vec = new Vector<>();
        int q = sc.nextInt();
        for(int i = 0 ; i < q ; i++){
            char c = sc.next().charAt(0);
            switch(c){
            case '0' : vec.add(Character.getNumericValue(Integer.parseInt(sc.next()))); break;
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(Integer.parseInt(sc.next())); break;
            case '2' : vec.remove(vec.size()-1); break;
            }
        }
    }
}


Compiler output:
Main.java:11: error: ')' or ',' expected
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(Integer.parseInt(sc.next())); break;
                                                                                                              ^
1 error
Language: Java

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Vector<Integer> vec = new Vector<>();
        int q = sc.nextInt();
        for(int i = 0 ; i < q ; i++){
            char c = sc.next().charAt(0);
            switch(c){
            case '0' : vec.add(Character.getNumericValue(Integer.parseInt(sc.next()))); break;
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(Integer.parseInt(sc.next()))); break;
            case '2' : vec.remove(vec.size()-1); break;
            }
        }
    }
}


Compiler output:
Main.java:11: error: ')' or ',' expected
            case '1' : System.out.println(vec.elementAt(Character.getNumericValue(Integer.parseInt(sc.next()))); break;
                                                                                                               ^
1 error
Language: C

#include<bits/stdc++.h>
using namespace std;
long long t,n,k,i=0;
long long arr[10000005];
int main(){

    cin>>t;
    while(t--){

        cin>>k;
        if(k==0){
            cin>>n;     ///What is the element you want to insert??
            arr[i]=n;
            i++;
        }
        if(k==2){
            i--;
        }
        if(k==1){
                cin>>n;
           cout<<arr[n]<<endl;
        }


    }

}




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

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

#define VECTOR_INITIAL_CAPACITY 1000
#define push 0
#define access 1
#define pop 2

typedef struct {
    int size;
    int capacity;
    int *data;
} Vector;


void vector_double_capacity_if_full(Vector* vector) {
    if (vector->size < vector->capacity) {
        return;
    }
    
    vector->capacity *= 2;
    vector->data = realloc(vector->data, sizeof(int) * vector->capacity);
}

void vector_init(Vector* vector) {
    vector->size = 0;
    vector->capacity = VECTOR_INITIAL_CAPACITY;
    vector->data = malloc(sizeof(int) * vector->capacity);
}

void vector_append(Vector* vector, int value) {
    vector_double_capacity_if_full(vector);
    vector->data[vector->size++] = value;
}

void vector_pop(Vector* vector) {
    if (vector->size == 0) {
        return;
    }
    
    vector->size--;
}

int vector_get(Vector* vector, int index) {
    if (index >= vector->size || index < 0) {
        printf("Invalid index %d for size %d", index, vector->size);
        exit(1);
    }
    return vector->data[index];
}

void vector_set(Vector* vector, int index, int value) {
    if (index >= vector->size || index < 0) {
        printf("Invalid index %d for size %d", index, vector->size);
        exit(1);
    }
    
    while (index >= vector->size) {
        vector_append(vector, 0);
    }
    
    vector->data[index] = value;
}


void vector_free(Vector* vector) {
    free(vector->data);
}

int main(void){
    int n, op, operand;
    scanf("%d", &n);
    
    Vector v;
    vector_init(&v);
    
    for (int i=0; i<n; i++) {
        scanf("%d", &op);
        if (op != pop) {
            scanf("%d", &operand);
        }

        switch (op) {
            case push:
                vector_append(&v, operand);
                break;
            case access:
                printf("%d\n", vector_get(&v, operand));
                break;
            case pop:
                vector_pop(&v);
                break;
        }
    }
    
    free(&v);
}



Compiler output:
a.cc: In function 'void vector_double_capacity_if_full(Vector*)':
a.cc:22:27: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   22 |     vector->data = realloc(vector->data, sizeof(int) * vector->capacity);
      |                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                           |
      |                           void*
a.cc: In function 'void vector_init(Vector*)':
a.cc:28:26: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   28 |     vector->data = malloc(sizeof(int) * vector->capacity);
      |                    ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |
      |                          void*
Language: C++


#include "stdafx.h"
#include "stdio.h"
#include <vector>

using namespace std;

int main()
{
	int n, a, v;
	vector<int> vec;

	scanf_s("%d", &n);

	int ni = 0;

	while (ni < n)
	{
		scanf_s("%d", &a);
		if (a == 0) {
			scanf_s("%d", &v);
			vec.push_back(v);
		}
		else if (a == 1) {
			scanf_s("%d", &v);
			printf("%d\n", vec[v]);
		}
		else {
			vec.pop_back();
		}
		ni++;
	}

    return 0;
}


Compiler output:
a.cc:2:10: fatal error: stdafx.h: No such file or directory
    2 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++


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

using namespace std;

int main()
{
	int n, a, v;
	vector<int> vec;

	scanf_s("%d", &n);

	int ni = 0;

	while (ni < n)
	{
		scanf_s("%d", &a);
		if (a == 0) {
			scanf_s("%d", &v);
			vec.push_back(v);
		}
		else if (a == 1) {
			scanf_s("%d", &v);
			printf("%d\n", vec[v]);
		}
		else {
			vec.pop_back();
		}
		ni++;
	}

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   12 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

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

int main(void) {
  vector<int> A;
  int q;
  int query;
  int x;
  int p;
  for(int i = 0; i < q; i++) {
    cin >> query;
    if(query == 0) {
      cin >> x;
      A.push_back(x);
    }
    if(query == 1) {
      cin >> p;
      cout << A.at(p);
    }
    if(query == 2) A.pop_back;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: invalid use of non-static member function 'void std::vector<_Tp, _Alloc>::pop_back() [with _Tp = int; _Alloc = std::allocator<int>]'
   20 |     if(query == 2) A.pop_back;
      |                    ~~^~~~~~~~
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:1324:7: note: declared here
 1324 |       pop_back() _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
Language: C++

#include <iostream>
#include <queue>
using namespace std;
int main(){
  int n,k[5],l[200005];
cin>>n;
for(int i=0;i<n;++i){
  cin>>k[0];
if(k[0]!=2){
cin>>k[1];
if(k[0]==0) l.pish_back(k[1]);
else cout<<k[k[1]]<<endl;
}
else l.pop();
}
}



Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: request for member 'pish_back' in 'l', which is of non-class type 'int [200005]'
   11 | if(k[0]==0) l.pish_back(k[1]);
      |               ^~~~~~~~~
a.cc:14:8: error: request for member 'pop' in 'l', which is of non-class type 'int [200005]'
   14 | else l.pop();
      |        ^~~
Language: C++

#include <vector>
#include <cstdio>

int main(){
    int q;
    scanf("%d",q);
    vector<int> vi;
    while(q--){
        int x,k;
        scanf("%d",x);
        if(x == 2) vi.pop_back();
        else if(x == 1){
            scanf("%d",&k);
            printf("%d\n",vi[k]);
        }
        else{
            scanf("%d",&k);
            vi.push_back(k);
        }
    }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int> vi;
      |     ^~~~~~
a.cc:7:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> vi;
      |            ^~~
a.cc:11:20: error: 'vi' was not declared in this scope
   11 |         if(x == 2) vi.pop_back();
      |                    ^~
a.cc:14:27: error: 'vi' was not declared in this scope
   14 |             printf("%d\n",vi[k]);
      |                           ^~
a.cc:18:13: error: 'vi' was not declared in this scope
   18 |             vi.push_back(k);
      |             ^~
Language: C++

#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<string>
#include<stdlib.h>
#include<time.h>
#include<stdio.h>
#include<set>
using namespace std;
#pragma warning(disable:4996)
#define INF 2147483647 
#define ll long long 

void main(int argc, char** argv)

{
	vector<int> a;
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		string str;
		getline(cin, str);
		if (str[0] == '0')a.push_back(str[2]);
		else if (str[0] == '2')a.pop_back();
		else if (str[0] == '1')cout << a[str[3]] << endl;
	}
}


Compiler output:
a.cc:15:1: error: '::main' must return 'int'
   15 | void main(int argc, char** argv)
      | ^~~~
Language: C++

#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<string>
#include<stdlib.h>
#include<time.h>
#include<stdio.h>
#include<set>
using namespace std;
#define INF 2147483647 
#define ll long long 

void main(int argc, char** argv)

{
	vector<int> a;
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		string str;
		getline(cin, str);
		if (str[0] == '0')a.push_back(str[2]);
		else if (str[0] == '2')a.pop_back();
		else if (str[0] == '1')cout << a[str[3]] << endl;
	}
}


Compiler output:
a.cc:14:1: error: '::main' must return 'int'
   14 | void main(int argc, char** argv)
      | ^~~~
Language: C++

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

int main(){
    int q,x;
    cin>>q;
    vector<int>a(q);
    for(int i=0;i<n;i++){
        if(q==0){
            cin>>x;
            a.push_back(x);
        }
        else if(q==1){
            cin>>x;
            a.erase(x);
        }
        else{
            a.pop_back();
        }
    }
    for(int i=0;<a.size();i++){
        cout<<a[i]<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:19: error: 'n' was not declared in this scope
    9 |     for(int i=0;i<n;i++){
      |                   ^
a.cc:16:20: error: no matching function for call to 'std::vector<int>::erase(int&)'
   16 |             a.erase(x);
      |             ~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided
a.cc:22:17: error: expected primary-expression before '<' token
   22 |     for(int i=0;<a.size();i++){
      |                 ^
Language: C++

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

int main(){
    int q,x;
    cin>>q;
    vector<int>a(q);
    for(int i=0;i<q;i++){
        if(q==0){
            cin>>x;
            a.push_back(x);
        }
        else if(q==1){
            cin>>x;
            a.erase(x);
        }
        else{
            a.pop_back();
        }
    }
    for(int i=0;<a.size();i++){
        cout<<a[i]<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: no matching function for call to 'std::vector<int>::erase(int&)'
   16 |             a.erase(x);
      |             ~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided
a.cc:22:17: error: expected primary-expression before '<' token
   22 |     for(int i=0;<a.size();i++){
      |                 ^
Language: C++

#include <bits/stdc++.h>


using namespace std;


typedef vector<int> vi;

#define looplr(i,l,r) for(int i=l;i<=r;++i)

#define pb push_back




//int arr[MAX];
int n,sum=0,sum1=0,sum2=0,tc,x,y,z,count1=0,count2=0,rem,a,b,c,d,l,r,m,len;
//string s,s1,s2;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    fastio;
    vi v;
    scanf("%d",&tc);
    while(tc--){
        scanf("%d",&n);
        if(n==0) {
            scanf("%d",&a);
            v.pb(a);
        }
        else if(n==1) {
            scanf("%d",&a);
            printf("%d\n",v[a]);
        }
        else if (n==2){
            v.pop_back();
        }
    }

    //cout << clock()*1.0/ CLOCKS_PER_SEC << endl;
    return 0;
}



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

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

using namespace std;

int main()
{
	vector<int> query;
	int n;
	int order=0,x=0;
	
	scanf_s("%d", &n);
	for (int i = 0;i < n;i++) {
		scanf_s("%d", &order);

		switch (order)
		{
		case 0:
			scanf_s("%d", &x);
			query.push_back(x);
			break;
		case 1:
			scanf_s("%d", &x);
			cout << query[x] << endl;
			break;
		case 2:
			query.pop_back();
		default:
			break;
		}
	}
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   14 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

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

using namespace std;

int main()
{
	vector<int> query;
	int n;
	int order=0,x=0;
	
	scanf_s("%d", &n);
	for (int i = 0;i < n;i++) {
		scanf_s("%d", &order);

		switch (order)
		{
		case 0:
			scanf_s("%d", &x);
			query.push_back(x);
			break;
		case 1:
			scanf_s("%d", &x);
			printf("%d",query[x]);
			break;
		case 2:
			query.pop_back();
		default:
			break;
		}
	}
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   14 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: Java

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Deque<Integer> de = new ArrayDeque<Integer>();
        int q = sc.nextInt();
        for(int i = 0 ; i < q ; i++){
            int qu = sc.nextInt();
            switch(qu){
                case 0: int d = sc.nextInt(); if(d == 0) de.addFirst(sc.nextInt()); else de.addLast(sc.nextInt()); break;
                case 1: int p = sc.nextInt(); for(int i = 0 ; i < de.size() ; i++){ if(i == p) System.out.println(de.element()); de.addLast(de.element()); de.removeFirst();} break;
                case 2: int d = sc.nextInt(); if(d == 0) de.removeFirst(); else de.removeLast(); break;
            }
        }
    }
}


Compiler output:
Main.java:11: error: variable i is already defined in method main(String[])
                case 1: int p = sc.nextInt(); for(int i = 0 ; i < de.size() ; i++){ if(i == p) System.out.println(de.element()); de.addLast(de.element()); de.removeFirst();} break;
                                                      ^
Main.java:12: error: variable d is already defined in method main(String[])
                case 2: int d = sc.nextInt(); if(d == 0) de.removeFirst(); else de.removeLast(); break;
                            ^
2 errors
Language: Java

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Deque<Integer> de = new ArrayDeque<Integer>();
        int q = sc.nextInt();
        for(int i = 0 ; i < q ; i++){
            int qu = sc.nextInt();
            switch(qu){
                case 0: int d = sc.nextInt(); if(d == 0) de.addFirst(sc.nextInt()); else de.addLast(sc.nextInt()); break;
                case 1: int p = sc.nextInt(); for(int i = 0 ; i < de.size() ; i++){ if(i == p) System.out.println(de.element()); de.addLast(de.element()); de.removeFirst();} break;
                case 2: int a = sc.nextInt(); if(a == 0) de.removeFirst(); else de.removeLast(); break;
            }
        }
    }
}


Compiler output:
Main.java:11: error: variable i is already defined in method main(String[])
                case 1: int p = sc.nextInt(); for(int i = 0 ; i < de.size() ; i++){ if(i == p) System.out.println(de.element()); de.addLast(de.element()); de.removeFirst();} break;
                                                      ^
1 error
Language: C++

# 2018/06/02

class Deque2(object):
    def __init__(self):
        self.a = list()

    def push(self, d, x):
        if d == 0:
            self.a = [x] + self.a
        else:
            self.a.append(x)

    def randomAccess(self, p):
        print self.a[p]

    def pop(self, d):
        if d == 0:
            self.a = self.a[1:]
        elif d == 1:
            self.a = self.a[:-1]

if __name__ == "__main__":
    d = Deque2()
    q = int(raw_input())
    for i in range(q):
        query = [int(j) for j in raw_input().split()]
        if query[0] == 0:
            d.push(query[1], query[2])
        elif query[0] == 1:
            d.randomAccess(query[1])
        else:
            d.pop(query[1])


Compiler output:
a.cc:1:7: error: "/" is not a valid filename
    1 | # 2018/06/02
      |       ^
a.cc:3:21: error: expected initializer before ':' token
    3 | class Deque2(object):
      |                     ^
Language: C++

# 2018/06/02
 
class Deque2(object):
    def __init__(self):
        self.a = list()
 
    def push(self, d, x):
        if d == 0:
            self.a = [x] + self.a
        elif d == 1:
            self.a.append(x)
 
    def randomAccess(self, p):
        print self.a[p]
 
    def pop(self, d):
        if d == 0:
            self.a = self.a[1:]
        elif d == 1:
            self.a = self.a[:-1]
 
    def __repr__(self):
        return " ".join([str(i) for i in self.a])
 
if __name__ == "__main__":
    d = Deque2()
    q = int(raw_input())
    for i in range(q):
        query = [int(j) for j in raw_input().split()]
        if query[0] == 0:
            d.push(query[1], query[2])
        elif query[0] == 1:
            d.randomAccess(query[1])
        elif query[0] == 2:
            d.pop(query[1])


Compiler output:
a.cc:1:7: error: "/" is not a valid filename
    1 | # 2018/06/02
      |       ^
a.cc:3:21: error: expected initializer before ':' token
    3 | class Deque2(object):
      |                     ^
Language: C++

#include"stdafx.h"
#include<iostream>
#include<deque>

using namespace std;

int main() {
	int n, q, f, x;
	deque<int> DQ;
	cin >> n;
	for (int i = 0;i<n;i++) {
		cin >> q;
		switch (q) {
		case 0:
			cin >> f >> x;
			if (f) DQ.push_back(x);
			else DQ.push_front(x);
			break;
		case 1:
			cin >> f;
			cout << DQ[f] << endl;
			break;
		case 2:
			cin >> f;
			if (f) DQ.pop_back();
			else DQ.pop_front();
		}
	}
	return 0;
}


Compiler output:
a.cc:1:9: fatal error: stdafx.h: No such file or directory
    1 | #include"stdafx.h"
      |         ^~~~~~~~~~
compilation terminated.
Language: C

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

void insert(int *L, int x, int *cursor, int *first) {
    int i, n=0;

    for (i=*first; i<*cursor; i++) {
        L[i-1]=L[i];
        n++;
    }
    (*first)-=n;
    L[(*cursor)-1]=x;
    (*cursor)--;
}

void move(int d, int *cursor) {
    if (d>=0) (*cursor)+=d;
    else (*cursor)-=d;
}

void erase (int *L, int q, int *cursor, int *first) {
    if (L[*cursor]==-1) (*cursor)=q-1;
    else {
        int i;
        (*cursor)++;
        for (i=*cursor; i>*first; i++) {
            L[i]=L[i-1];
        }
        L[*first]=-1;
        (*first)++;
    }
}

int main (void) {
    int i, q, x, *L, cursor, query, first;

    scanf("%d", &q);
    L=(int *)malloc(sizeof(int)*q+1);
    memset(L, -1, sizeof(int)*q+1);
    cursor=q-1;
    for (i=0; i<q; i++) {
        scanf("%d", &query);
        if (query==0) {
            scanf("%d", &x);
            insert (L, x, &cursor);
        } else if (query==1) {
            scanf("%d", &x);
            move(x, &cursor);
        } else {
            erase(L, q, &cursor);
        }
    }
    for (i=cursor;i<q-1;i++) printf("%d\n", L[i]);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:46:13: error: too few arguments to function 'insert'
   46 |             insert (L, x, &cursor);
      |             ^~~~~~
main.c:5:6: note: declared here
    5 | void insert(int *L, int x, int *cursor, int *first) {
      |      ^~~~~~
main.c:51:13: error: too few arguments to function 'erase'
   51 |             erase(L, q, &cursor);
      |             ^~~~~
main.c:22:6: note: declared here
   22 | void erase (int *L, int q, int *cursor, int *first) {
      |      ^~~~~
Language: C++

using namespace std;
signed main() {
  list<int> L;
  int N,p,q; cin >> N;
  int cursor = 0;
  for (int i = 0; i < N; i++) {
    cin >> p;
    if (p == 0) {
      cin>>q;
      L.insert(next(L.begin(), cursor), q);
    } else if (p == 1) {
      cin>>q;
      cursor += q;
    } else {
      L.erase(next(L.begin(), cursor));
    }
  }

  for (int i = 0; i < L.size(); i++) {
    cout << *next(L.begin(), i) << endl;
  } 
}



Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'list' was not declared in this scope
    3 |   list<int> L;
      |   ^~~~
a.cc:1:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
  +++ |+#include <list>
    1 | using namespace std;
a.cc:3:8: error: expected primary-expression before 'int'
    3 |   list<int> L;
      |        ^~~
a.cc:4:14: error: 'cin' was not declared in this scope
    4 |   int N,p,q; cin >> N;
      |              ^~~
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:10:7: error: 'L' was not declared in this scope
   10 |       L.insert(next(L.begin(), cursor), q);
      |       ^
a.cc:10:16: error: 'next' was not declared in this scope
   10 |       L.insert(next(L.begin(), cursor), q);
      |                ^~~~
a.cc:1:1: note: 'std::next' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>'
  +++ |+#include <iterator>
    1 | using namespace std;
a.cc:15:7: error: 'L' was not declared in this scope
   15 |       L.erase(next(L.begin(), cursor));
      |       ^
a.cc:15:15: error: 'next' was not declared in this scope
   15 |       L.erase(next(L.begin(), cursor));
      |               ^~~~
a.cc:15:15: note: 'std::next' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>'
a.cc:19:23: error: 'L' was not declared in this scope
   19 |   for (int i = 0; i < L.size(); i++) {
      |                       ^
a.cc:20:5: error: 'cout' was not declared in this scope
   20 |     cout << *next(L.begin(), i) << endl;
      |     ^~~~
a.cc:20:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:14: error: 'next' was not declared in this scope
   20 |     cout << *next(L.begin(), i) << endl;
      |              ^~~~
a.cc:20:14: note: 'std::next' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>'
a.cc:20:36: error: 'endl' was not declared in this scope
   20 |     cout << *next(L.begin(), i) << endl;
      |                                    ^~~~
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<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
    int q;
    list<int>L;
    list<int>iterator it=L.begin();
    cin>>q;
    while(q--){
        int a,b;
        cin>>a;
        if(a<2)cin>>b;
        if(!a)it=L.insert(it,b);
        else if(a==1){
            r(i,abs(b)){
                if(b<0)it--;
                else it++;
            }
        }
        else it=L.erase(it);
    }
    it=L.begin();
    for(;it=L.end();it++){
        cout<<*it<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:23: error: expected initializer before 'it'
    8 |     list<int>iterator it=L.begin();
      |                       ^~
a.cc:14:15: error: 'it' was not declared in this scope; did you mean 'int'?
   14 |         if(!a)it=L.insert(it,b);
      |               ^~
      |               int
a.cc:17:24: error: 'it' was not declared in this scope; did you mean 'i'?
   17 |                 if(b<0)it--;
      |                        ^~
      |                        i
a.cc:18:22: error: 'it' was not declared in this scope; did you mean 'i'?
   18 |                 else it++;
      |                      ^~
      |                      i
a.cc:21:14: error: 'it' was not declared in this scope; did you mean 'int'?
   21 |         else it=L.erase(it);
      |              ^~
      |              int
a.cc:23:5: error: 'it' was not declared in this scope; did you mean 'int'?
   23 |     it=L.begin();
      |     ^~
      |     int
Language: C++

#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
    int q;
    list<int>L;
    list<int>::iterator it=L.begin();
    cin>>q;
    while(q--){
        int a,b;
        cin>>a;
        if(a<2)cin>>b;
        if(!a)it=L.insert(it,b);
        else if(a==1){
            r(i,abs(b)){
                if(b<0)it--;
                else it++;
            }
        }
        else it=L.erase(it);
    }
    it=L.begin();
    for(;it=L.end();it++){
        cout<<*it<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:12: error: could not convert '(it = L.std::__cxx11::list<int>::end())' from 'std::__cxx11::list<int>::iterator' to 'bool'
   24 |     for(;it=L.end();it++){
      |          ~~^~~~~~~~
      |            |
      |            std::__cxx11::list<int>::iterator
Language: C++

#include <iostream>
#include <list>
#include <iterator>
using namespace std;

int main(){
  int q,cmd,x,d;
  list <int> lst;
  list::iterator itr = lst.end();
  cin >> q;
  for(int i = 0 ; i < q ; i++){
    cin >> cmd;
    switch (cmd){
    case 0 ://insert(x)
      cin >> x;
      lst.insert(itr,x);
      break;
    case 1://move(d)
      cin >> d;
      itr.advance(d);
      break;
    case 2://erase()
      lst.erase(itr);
      break;
    }
  }
  for(int i:a)cout << i << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:18: error: qualified-id in declaration before 'itr'
    9 |   list::iterator itr = lst.end();
      |                  ^~~
a.cc:16:18: error: 'itr' was not declared in this scope
   16 |       lst.insert(itr,x);
      |                  ^~~
a.cc:27:13: error: 'a' was not declared in this scope
   27 |   for(int i:a)cout << i << endl;
      |             ^
Language: C++

#include <iostream>
#include <list>
#include <iterator>
using namespace std;

int main(){
  int q,cmd,x,d;
  list <int> lst;
  list::iterator itr = lst.end();
  cin >> q;
  for(int i = 0 ; i < q ; i++){
    cin >> cmd;
    switch (cmd){
    case 0 ://insert(x)
      cin >> x;
      lst.insert(itr,x);
      break;
    case 1://move(d)
      cin >> d;
      itr.advance(d);
      break;
    case 2://erase()
      lst.erase(itr);
      break;
    }
  }
  for(int i:lst)cout << i << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:18: error: qualified-id in declaration before 'itr'
    9 |   list::iterator itr = lst.end();
      |                  ^~~
a.cc:16:18: error: 'itr' was not declared in this scope
   16 |       lst.insert(itr,x);
      |                  ^~~
Language: C++

#include <iostream>
#include <list>
#include <iterator>
using namespace std;

int main(){
  int q,cmd,x,d;
  list<int> lst;
  list<int>::iterator itr = lst.end();
  cin >> q;
  for(int i = 0 ; i < q ; i++){
    cin >> cmd;
    switch (cmd){
    case 0 ://insert(x)
      cin >> x;
      lst.insert(itr,x);
      break;
    case 1://move(d)
      cin >> d;
      itr.advance(d);
      break;
    case 2://erase()
      lst.erase(itr);
      break;
    }
  }
  for(int i:lst)cout << i << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:11: error: 'std::__cxx11::list<int>::iterator' has no member named 'advance'
   20 |       itr.advance(d);
      |           ^~~~~~~
Language: C++

#include <iostream>
#include <list>
#include <iterator>
using namespace std;

int main(){
  int q,cmd,x,d;
  list<int> lst;
  list<int>::iterator itr = lst.end();
  cin >> q;
  for(int i = 0 ; i < q ; i++){
    cin >> cmd;
    switch (cmd){
    case 0 ://insert(x)
      cin >> x;
      lst.insert(itr,x);
      break;
    case 1://move(d)
      cin >> d;
      advance(d);
      break;
    case 2://erase()
      lst.erase(itr);
      break;
    }
  }
  for(int i:lst)cout << i << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:14: error: no matching function for call to 'advance(int&)'
   20 |       advance(d);
      |       ~~~~~~~^~~
In file included from /usr/include/c++/14/string:47,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:220:5: note: candidate: 'template<class _InputIterator, class _Distance> constexpr void std::advance(_InputIterator&, _Distance)'
  220 |     advance(_InputIterator& __i, _Distance __n)
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:220:5: note:   candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:475:5: note: candidate: 'template<class _CharT2, class _Distance> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, void>::__type std::advance(istreambuf_iterator<_CharT>&, _Distance)'
  475 |     advance(istreambuf_iterator<_CharT>& __i, _Distance __n)
      |     ^~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:475:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int main(){
	list<int>ls;
	ls.push_back(0);
	auto it=ls.begin();
	int q;cin>>q;
	rep(i,q){
		int a;cin>>a;
		if(a==0){
			int b;cin>>b;
			ls.insert(it,b);
		}
		else if(a==1){
			int d;cin>>d;
			if(d>0){
				rep(i,d)b++;
			}
			else{
				rep(i,d)b--;
			}
		}
		else{
			it=ls.erase(it);
		}
	}
	bool flag=false;
	for(auto it:ls){
		if(flag)cout<<" ":
		cout<<it;
		flag=true;
	}
	cout<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:19:41: error: 'b' was not declared in this scope
   19 |                                 rep(i,d)b++;
      |                                         ^
a.cc:22:41: error: 'b' was not declared in this scope
   22 |                                 rep(i,d)b--;
      |                                         ^
a.cc:31:34: error: expected ';' before ':' token
   31 |                 if(flag)cout<<" ":
      |                                  ^
      |                                  ;
Language: C++

#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <list>
#define rep(i,n) for (int i = 0; (i) < (n); ++(i))
using namespace std;

int main() {
    int n,q;
    cin >> n >> q;
    vector<int> a(n);
    rep(i,q) {
        int s,t;
        switch(s) {
            case 0:
            int x;
            cin >> x;
            v[t].push_back(x);
            break;
            case 1:
            rep(j,v.size()) {
                cout << v[j];
                if(j!= v.size()) cout << " ";
                else    cout << endl;
            }
            break;
            case 2:
            a[t].erase(a[t].begin(), a[t].end());
            break;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:13: error: 'v' was not declared in this scope
   27 |             v[t].push_back(x);
      |             ^
a.cc:37:18: error: request for member 'erase' in 'a.std::vector<int>::operator[](((std::vector<int>::size_type)t))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   37 |             a[t].erase(a[t].begin(), a[t].end());
      |                  ^~~~~
a.cc:37:29: error: request for member 'begin' in 'a.std::vector<int>::operator[](((std::vector<int>::size_type)t))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   37 |             a[t].erase(a[t].begin(), a[t].end());
      |                             ^~~~~
a.cc:37:43: error: request for member 'end' in 'a.std::vector<int>::operator[](((std::vector<int>::size_type)t))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   37 |             a[t].erase(a[t].begin(), a[t].end());
      |                                           ^~~