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

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

public class Main {
    public static void main(String args[]) {
        int n;
        LinkedList<Integer> list = new LinkedList<Integer>();
        Scanner sc = new Scanner(System.in);

        n = sc.nextInt();
        sc.nextLine();

        for (int i = 0; i < n; i++) {
            String s[] = sc.nextLine().split(" ");

            switch (s[0]) {
                case "insert":
                    list.addFirst(Integer.parseInt(s[1]));
                    break;
                case "delete":
                    int idx = list.indexOf(Integer.pasrInt(s[1]));
                    if (idx >= 0) list.remove(idx);
                    break;
                case "deleteFirst":
                    list.remove(0);
                    break;
                case "deleteLast":
                    list.remove(list.size() - 1);
                    break;
            }
        }

        for (int i = 0; i < list.size() - 1; i++) {
            System.out.print(list.get(i) + " ");
        }
        System.out.println(list.get(list.size() - 1));

    }
}

Compiler output:
Main.java:21: error: cannot find symbol
                    int idx = list.indexOf(Integer.pasrInt(s[1]));
                                                  ^
  symbol:   method pasrInt(String)
  location: class Integer
1 error
Language: Java

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

public class Main {
    public static void main(String args[]) {
        int n, idx, len;
        String s;
        LinkedList<Integer> list = new LinkedList<Integer>();
        Scanner sc = new Scanner(System.in);

        n = Integer.parseInt(sc.next());

        for (int i = 0; i < n; i++) {
            s = sc.next();

            switch (s.split(" ")[0]) {
                case "insert":
                    list.addFirst(Integer.parseInt(sc.next()));
                    break;
                case "delete":
                    idx = list.indexOf(Integer.parseInt(sc.next()));
                    if (idx >= 0) list.remove(idx);
                    break;
                case "deleteFirst":
                    list.remove(0);
                    break;
                case "deleteLast":
                    list.remove(list.size() - 1);
                    break;
            }
        }

        len = list.size();
        idx = 0;

        for (Iterator<Integer> it = list.iterator(); it.hasNext();) {
            if (idx == len - 1) {
                System.out.print\n(it.next());
            } else {
                System.out.print(it.next() + " ");
            }
            idx++;
        }
    }
}

Compiler output:
Main.java:38: error: illegal character: '\'
                System.out.print\n(it.next());
                                ^
Main.java:38: error: not a statement
                System.out.print\n(it.next());
                          ^
2 errors
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException, NumberFormatException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		List<String> list = new LinkedList<String>();
		
		int n = Integer.parseInt(br.readLine());
		
		for(int i = 0; i < n; i++){
			String[] str = br.readLine().split(" ");
			
			switch (str[0]){
			case "insert":
				list.add(0, str[1]);
				break;
				
			case "delete":
				if(list.indexOf(str[1]) >= 0){
					list.remove(list.indexOf(str[1]));
				}
				break;
				
			case "deleteFirst":
				list.remove(0);
				break;
				
			case "deleteLast":
				list.remove(list.size() - 1);
				break;
			}
		}
		
		for(int i = 0; i < list.size(); i++){
			System.out.print(list.get(i));
			
			if(i + 1 == list.size()){
				System.out.print("\n");
			} else {
				System.out.print(" ");
			}
		}
	}

}

Compiler output:
Main.java:12: error: cannot find symbol
		List<String> list = new LinkedList<String>();
		                        ^
  symbol:   class LinkedList
  location: class Main
1 error
Language: Java

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


public class Main{
    public static void main(String[] args){
        Scanenr sc = new Scanner(System.in);
        int num = sc.nextInt();
        Deque<Integer> deque = new ArrayDeque<Integer>();
        
        String str = "";
        int input = 0;
        for(int i =0; i < num; i++){
            str = next();
            if(str.equals("insert")){
                input = nextInt();
                deque.addFirst(input);
            }else if(str.equals("delete")){
                input = nextInt();
                deque.deleteFirstOccurrence(input);
            }else if(str.equals("deleteFirst")){
                deque.deleteFirst();
            }else{
                deque.deleteLast();
            }
        }
        StringBuilder output = new StringBuilder();
        output.append(deque.pollFirst);
        for(int x: deque){
            output.append(" " + x);
        }
        System.out.println(output);
    }
}


Compiler output:
Main.java:8: error: cannot find symbol
        Scanenr sc = new Scanner(System.in);
        ^
  symbol:   class Scanenr
  location: class Main
Main.java:15: error: cannot find symbol
            str = next();
                  ^
  symbol:   method next()
  location: class Main
Main.java:17: error: cannot find symbol
                input = nextInt();
                        ^
  symbol:   method nextInt()
  location: class Main
Main.java:20: error: cannot find symbol
                input = nextInt();
                        ^
  symbol:   method nextInt()
  location: class Main
Main.java:21: error: cannot find symbol
                deque.deleteFirstOccurrence(input);
                     ^
  symbol:   method deleteFirstOccurrence(int)
  location: variable deque of type Deque<Integer>
Main.java:23: error: cannot find symbol
                deque.deleteFirst();
                     ^
  symbol:   method deleteFirst()
  location: variable deque of type Deque<Integer>
Main.java:25: error: cannot find symbol
                deque.deleteLast();
                     ^
  symbol:   method deleteLast()
  location: variable deque of type Deque<Integer>
Main.java:29: error: cannot find symbol
        output.append(deque.pollFirst);
                           ^
  symbol:   variable pollFirst
  location: variable deque of type Deque<Integer>
8 errors
Language: Java

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


public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        Deque<Integer> deque = new ArrayDeque<Integer>();
        
        String str = "";
        int input = 0;
        for(int i =0; i < num; i++){
            str = sc.next();
            if(str.equals("insert")){
                input = sc.nextInt();
                deque.addFirst(input);
            }else if(str.equals("delete")){
                input = sc.nextInt();
                deque.removeFirstOccurrence(input);
            }else if(str.equals("deleteFirst")){
                deque.removeFirst();
            }else{
                deque.removeLast();
            }
        }
        StringBuilder output = new StringBuilder();
        output.append(deque.pollFirst);
        for(int x: deque){
            output.append(" " + x);
        }
        System.out.println(output);
    }
}


Compiler output:
Main.java:29: error: cannot find symbol
        output.append(deque.pollFirst);
                           ^
  symbol:   variable pollFirst
  location: variable deque of type Deque<Integer>
1 error
Language: Java

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


public class Main{
    public static void main(String[] args){
        Scannr sc = new Scanner(System.in);
        int num = sc.nextInt();
        Deque<Integer> deque = new ArrayDeque<Integer>();
        
        String str = "";
        int input = 0;
        for(int i =0; i < num; i++){
            str = sc.next();
            if(str.equals("insert")){
                input = sc.nextInt();
                deque.addFirst(input);
            }else if(str.equals("delete")){
                input = sc.nextInt();
                deque.removeFirstOccurrence(input);
            }else if(str.equals("deleteFirst")){
                deque.removeFirst();
            }else{
                deque.removeLast();
            }
        }
        StringBuilder output = new StringBuilder();
        output.append(deque.pollFirst);
        for(int x: deque){
            output.append(" " + x);
        }
        System.out.println(output);
    }
}


Compiler output:
Main.java:8: error: cannot find symbol
        Scannr sc = new Scanner(System.in);
        ^
  symbol:   class Scannr
  location: class Main
Main.java:29: error: cannot find symbol
        output.append(deque.pollFirst);
                           ^
  symbol:   variable pollFirst
  location: variable deque of type Deque<Integer>
2 errors
Language: Java

import java.io
import java.util.ArrayDeque;
import java.util.Deque;


public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        Deque<Integer> deque = new ArrayDeque<Integer>();
        
        String str = "";
        int input = 0;
        for(int i =0; i < num; i++){
            str = sc.next();
            if(str.equals("insert")){
                input = sc.nextInt();
                deque.addFirst(input);
            }else if(str.equals("delete")){
                input = sc.nextInt();
                deque.removeFirstOccurrence(input);
            }else if(str.equals("deleteFirst")){
                deque.removeFirst();
            }else{
                deque.removeLast();
            }
        }
        StringBuilder output = new StringBuilder();
        output.append(deque.pollFirst());
        for(int x: deque){
            output.append(" " + x);
        }
        System.out.println(output);
    }
}


Compiler output:
Main.java:1: error: ';' expected
import java.io
              ^
1 error
Language: Java


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main{

	public static void main(String[] args) {

		try {
			List<String> list = new ArrayList<String>();
			BufferedReader r =
                new BufferedReader(new InputStreamReader(System.in), 1);
			String strInput = r.readLine();
			String[] strcmd;
			int loopmax = Integer.parseInt(strInput);
			int tempIdx;

			for(int i=0;i<loopmax;i++) {
				strInput = r.readLine();
				strcmd = strInput.split(" ");

				if(strcmd[0].equals("insert")) {
					list.add(0,strcmd[1]);
				}else if(strcmd[0].equals("deleteFirst")) {
					list.remove(0);
				}else if(strcmd[0].equals("deleteLast")) {
					list.remove(list.size()-1);
				}else if(strcmd[0].equals("delete")) {
					tempIdx = list.indexOf(strcmd[1]);
					if(tempIdx>=0){
						list.remove(tempIdx);
					}
				}
			}

			StringBuffer sb = new StringBuffer();
			int listSize = list.size();
			for(int i=0;i<listSize;i++) {
				sb.append(list.get(i)).append(" ");
			}
			String out = sb.toString();
			System.out.println(out.subString(0,out.length()-1);

		} catch (IOException e) {
			e.printStackTrace();
		}

	}
}


Compiler output:
Main.java:45: error: ')' or ',' expected
			System.out.println(out.subString(0,out.length()-1);
			                                                  ^
1 error
Language: Java


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main{

	public static void main(String[] args) {

		try {
			List<String> list = new ArrayList<String>();
			BufferedReader r =
                new BufferedReader(new InputStreamReader(System.in), 1);
			String strInput = r.readLine();
			String[] strcmd;
			int loopmax = Integer.parseInt(strInput);
			int tempIdx;

			for(int i=0;i<loopmax;i++) {
				strInput = r.readLine();
				strcmd = strInput.split(" ");

				if(strcmd[0].equals("insert")) {
					list.add(0,strcmd[1]);
				}else if(strcmd[0].equals("deleteFirst")) {
					list.remove(0);
				}else if(strcmd[0].equals("deleteLast")) {
					list.remove(list.size()-1);
				}else if(strcmd[0].equals("delete")) {
					tempIdx = list.indexOf(strcmd[1]);
					if(tempIdx>=0){
						list.remove(tempIdx);
					}
				}
			}

			StringBuffer sb = new StringBuffer();
			int listSize = list.size();
			for(int i=0;i<listSize;i++) {
				sb.append(list.get(i)).append(" ");
			}
			String out = sb.toString();
			System.out.println(out.substring(0,out.length()-1);

		} catch (IOException e) {
			e.printStackTrace();
		}

	}
}


Compiler output:
Main.java:45: error: ')' or ',' expected
			System.out.println(out.substring(0,out.length()-1);
			                                                  ^
1 error
Language: Java


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main{

	public static void main(String[] args) {

		try {
			List<String> list = new ArrayList<String>();
			BufferedReader r =
                new BufferedReader(new InputStreamReader(System.in), 1);
			String strInput = r.readLine();
			String[] strcmd;
			int loopmax = Integer.parseInt(strInput);
			int tempIdx;

			for(int i=0;i<loopmax;i++) {
				strInput = r.readLine();
				strcmd = strInput.split(" ");

				if(strcmd[0].equals("insert")) {
					list.add(strcmd[1]);
				}else if(strcmd[0].equals("deleteFirst")) {
					list.remove(list.size()-1);
				}else if(strcmd[0].equals("deleteLast")) {
					list.remove(0);
				}else if(strcmd[0].equals("delete")) {
					tempIdx = list.lastindexOf(strcmd[1]);
					if(tempIdx>=0){
						list.remove(tempIdx);
					}
				}
			}

			StringBuffer sb = new StringBuffer();
			int listSize = list.size();
			for(int i=listSize-1;i>=0;i--) {
				sb.append(list.get(i)).append(" ");
			}
			String out = sb.toString();
			System.out.println(out.substring(0,out.length()-1));

		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}


Compiler output:
Main.java:32: error: cannot find symbol
					tempIdx = list.lastindexOf(strcmd[1]);
					              ^
  symbol:   method lastindexOf(String)
  location: variable list of type List<String>
1 error
Language: Java

import java.util.LinkedList;
import java.util.Scanner;
public class Main1{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int counter = 0;
        LinkedList<Integer> list = new LinkedList<>();
        for(int x = 0; x < n; x++){
            String check = scan.next();
            if(check.equals("insert")){
                int y = scan.nextInt();
                list.addFirst(y);
                counter++;
            }
            else if(check.equals("delete")){
                int y = scan.nextInt();
                list.remove((Integer) y);
                counter--;
            }
            else if(check.equals("deleteFirst")){
                list.pollFirst();
                counter--;
            }
            else{
                list.pollLast();
                counter--;
            }
        }
        for(int x = 0; x < counter; x++){
            if(x == counter - 1){
                System.out.println(list.poll());
            }
            else {
                System.out.print(list.poll() + " ");
            }
        }
    }
}


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

import java.io.*;
import java.util.*;
public class Main1{
    public static void main(String[] args) throws IOException {
        BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(scan.readLine());
        LinkedList<Integer> list = new LinkedList<>();
        int counter = 0;
        for(int x = 0; x < n; x++){
            String check = scan.readLine();
            if(check.startsWith("insert")){
                int y = Integer.parseInt(check.substring(check.indexOf(" ")+1));
                list.addFirst(y);
                counter++;
            }
            else if(check.startsWith("delete ")){
                int y = Integer.parseInt(check.substring(check.indexOf(" ")+1));
                if(list.remove((Integer) y)) {
                    counter--;
                }
            }
            else if(check.equals("deleteFirst")){
                list.pollFirst();
                counter--;
            }
            else{
                list.pollLast();
                counter--;
            }
        }
        for(int x = 0; x < counter; x++){
            if(x == counter - 1){
                System.out.println(list.poll());
            }
            else {
                System.out.print(list.poll() + " ");
            }
        }
    }
}


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

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Deque;
import java.util.ArrayDeque;


public class Main {
    public static void main(String[] args) throws Exception {
        
        Deque<Integer> list = new ArrayDeque<Integer>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        for(int i = 0; i < n ++i){
            String line = br.readLine());
            char c = line.charAt(0);
            if(c == 'i')
                list.addFirst(Integer.valueOf(line.substring(7)));
            if(c == 'd'){
                int len = line.length();
                if(len == 11)
                    list.removeFirst();
                else if(len == 10)
                    list.removeLast();
                else
                    list.remove(Integer.valueOf(line.substring(7)));
            }
        }

        Integer m;
        if((m = list.pollLast()) != null){
            for(int n : list)
                System.out.printf("%d ", n);
            System.out.println(m);
        }
    }
}


Compiler output:
Main.java:13: error: ';' expected
        for(int i = 0; i < n ++i){
                               ^
Main.java:14: error: ';' expected
            String line = br.readLine());
                                       ^
2 errors
Language: Java

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

public class Main {
	public static void main(String[] args) {
		ALDS1_3_C();
	}
	public static void ALDS1_3_C() {

		Scanner sc = new Scanner(System.in);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Deque<String> link = new ArrayDeque<String>();
		StringBuilder ans = new StringBuilder();
		String input_str[] = new String[2];
		try {
			int n = Integer.parseInt(br.readLine());
			for(int i = 0; i < n; i++) {
				input_str = br.readLine().split("\\s+");
				if(input_str[0].equals("insert")) {
					link.addFirst(input_str[1]);
				}else if(input_str[0].equals("delete")) {
					link.remove(input_str[1]);
				}else if(input_str[0].equals("deleteFirst")) {
					link.removeFirst();
				}else if(input_str[0].equals("deleteLast")) {
					link.removeLast();
				}

			}

			if(!link.isEmpty()) {
				ans.append(link.getFirst());
				link.removeFirst();
			}
			while(!link.isEmpty()) {
				ans.append(" ").append(link.getFirst());
				link.removeFirst();
			}
			System.out.println(ans.toString());
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}




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

import java.util.Scanner;
import java.util.LinkedList;

public class Main {
    private enum Command{
        Insert("insert"),
        Delete("delete"),
        DeleteFirst("deleteFirst"),
        DeleteLast("deleteLast");
        public final String name;
        private Command(String name){
            this.name=name;
        }
        public static Command recognize(String name){
            if(name.equals(Insert.name)){
                return Insert;
            }else if(name.equals(Delete.name)){
                return Delete;
            }else if(name.equals(DeleteFirst.name)){
                return DeleteFirst;
            }else if(name.equals(DeleteLast.name)){
                return DeleteLast;
            }
        }
    }
    public static void main(String[] args){
        // Your code here!
        Scanner scanner=new Scanner(System.in);
        int N=scanner.nextInt();
        LinkedList<Integer> linkedList=new LinkedList();
        for(int i=0;i<N;i++){
            Command command=Command.recognize(scanner.next());
            if(command==Command.Insert){
                linkedList.addFirst((Integer)scanner.nextInt());
            }else if(command==Command.Delete){
                linkedList.remove((Integer)scanner.nextInt());
            }else if(command==Command.DeleteFirst){
                linkedList.remove(0);
            }else if(command==Command.DeleteLast){
                linkedList.remove(linkedList.size()-1);
            }
        }
        for(int i=0;i<linkedList.size()-1;i++){
            System.out.print(linkedList.get(i)+" ");
        }
        System.out.println(linkedList.get(linkedList.size()-1));
        
    }
}



Compiler output:
Main.java:24: error: missing return statement
        }
        ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.util.Scanner;
import java.util.LinkedList;

public class Main {
    public static void main(String[] args){
        // Your code here!
        Scanner scanner=new Scanner(System.in);
        int N=scanner.nextInt();
        LinkedList<Integer> linkedList=new LinkedList();
        for(int i=0;i<N;i++){
            Command command=Command.recognize(scanner.next());
            if(command==Command.Insert){
                linkedList.addFirst((Integer)scanner.nextInt());
            }else if(command==Command.Delete){
                linkedList.remove((Integer)scanner.nextInt());
            }else if(command==Command.DeleteFirst){
                linkedList.remove(0);
            }else if(command==Command.DeleteLast){
                linkedList.remove(linkedList.size()-1);
            }
        }
        for(int i=0;i<linkedList.size()-1;i++){
            System.out.print(linkedList.get(i)+" ");
        }
        System.out.println(linkedList.get(linkedList.size()-1));
    }
    
    private enum Command{
        Insert("insert"),
        Delete("delete"),
        DeleteFirst("deleteFirst"),
        DeleteLast("deleteLast");
        public final String name;
        private Command(String name){
            this.name=name;
        }
        public static Command recognize(String name){
            if(name.equals(Insert.name)){
                return Insert;
            }else if(name.equals(Delete.name)){
                return Delete;
            }else if(name.equals(DeleteFirst.name)){
                return DeleteFirst;
            }else if(name.equals(DeleteLast.name)){
                return DeleteLast;
            }
        }
    }
}



Compiler output:
Main.java:47: error: missing return statement
        }
        ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner s=new Scanner(System.in);
        int n=s.nextInt(),first=0,num=1,last=0;
        int list[]=new int[1000000];
        int before[]=new int[100000];
        int next[]=new int[1000000];

        for(int i=0;i<n;i++){
            String o=s.next();
            if(o.equals("insert")){
                list[num]=s.nextInt();
                if(first==0) last=num;
                before[first]=num;
                next[num]=first;
                first=num;
                num++;
            }else if(o.equals("delete")){
                int d=s.nextInt();
                int j=first;
                while(j!=0){
                    if(d==list[j]){
                        if(j==last&&j==first){
                            first=0;
                            last=0;
                        }else if(j==last){
                            last=before[last];
                            next[last]=0;
                        }else if(j==first){
                            first=next[j];
                            before[first]=0;
                        }else{
                            next[before[j]]=next[j];
                            before[next[j]]=before[j];
                            break;
                        }
                    }
                    j=next[j];
                }
            }else if(o.equals("deleteFirst")){
                if(first==last){
                    first=0;
                    last=0;
                }else{
                    first=next[first];
                    before[first]=0;
                }
            }else{
                if(first==last){
                    first=0;
                    last=0;
                }else{
                    last=before[last];
                    next[last]=0;

            }
        }
        int soeji=first;
        while(soeji!=0){
            System.out.print(list[soeji]);
            soeji=next[soeji];
            if(soeji!=0) System.out.print(" ");
        }
        System.out.println("");
    }
}


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

import java.util.LinkedList;
import java.util.Scanner;

public class _CDoublyLinkedList {
    static LinkedList<Integer> list  =new LinkedList<>();
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());

        for(int i=0;i<n;i++){
            String[] sp = sc.nextLine().trim().split(" ");
            if (sp[0].equals("insert")){
                list.add(Integer.parseInt(sp[1]));
            } else if (sp[0].equals("delete")){
                Integer m = Integer.parseInt(sp[1]);
                list.remove(m);
            } else if (sp[0].equals("deleteFirst")){
                list.removeLast();
            }else if (sp[0].equals("deleteLast")){
                list.removeFirst();
            }
        }

        for (Integer i=list.size()-1;i>0;i--){
            System.out.print(list.get(i)+" ");
        }
        System.out.print(list.get(0));
    }
}


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

package ALDS1_3;

import java.util.*;

public class _CDoublyLinkedList {
    static Deque<String> list  =new ArrayDeque<>();
    public static void main(String[] args) {
        StringBuilder ans = new StringBuilder();
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] sp =new String[2];
        for(int i=0;i<n;i++){
           sp = sc.nextLine().trim().split(" ");
            if (sp[0].equals("insert")){
                list.addFirst(sp[1]);
            } else if (sp[0].equals("delete")){
                list.remove(sp[1]);
            } else if (sp[0].equals("deleteFirst")){
                list.removeFirst();
            }else if (sp[0].equals("deleteLast")){
                list.removeLast();
            }
        }

        if(!list.isEmpty()){
            ans.append(list.getFirst());
            list.removeFirst();
        }
        while(!list.isEmpty()){
            ans.append(" ").append(list.getFirst());
            list.removeFirst();
        }

        System.out.println(ans.toString());
//        for (Integer i=0;i<list.size()-1;i++){
//            System.out.print(list.get(i)+" ");
//        }
//        System.out.println(list.get(list.size()-1));
    }
}



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



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

public class Main {
    static Deque<String> list = new ArrayDeque<String>();

    public static void main(String[] args) {
        StringBuilder ans = new StringBuilder();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] sp = new String[2];
        try {
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                sp = br.readLine().split(" ");
                if (sp[0].equals("insert")) {
                    list.addFirst(sp[1]);
                } else if (sp[0].equals("delete")) {
                    list.remove(sp[1]);
                } else if (sp[0].equals("deleteFirst")) {
                    list.removeFirst();
                } else if (sp[0].equals("deleteLast")) {
                    list.removeLast();
                }
            }
            sc.close();
            if (!list.isEmpty()) {
                ans.append(list.getFirst());
                list.removeFirst();
            }
            while (!list.isEmpty()) {
                ans.append(" ").append(list.getFirst());
                list.removeFirst();
            }
            System.out.println(ans.toString());
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }catch (IOException e) {
            e.printStackTrace();
        }
    }
}



Compiler output:
Main.java:29: error: cannot find symbol
            sc.close();
            ^
  symbol:   variable sc
  location: class Main
1 error
Language: Java

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

public class ListApp {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String[] line;
      MyList list = new MyList();

      for(int i=0; i<n; i++) {
        line = br.readLine().split(" ");
        switch( line[0] ) {
          case "insert" :
            list.insertFirst( Integer.parseInt(line[1]) );
            break;
          case "deleteFirst" :
            list.deleteFirst();
            break;
          case "deleteLast" :
            list.deleteLast();
            break;
          case "delete" :
            list.delete( Integer.parseInt(line[1]) );
            break;
          default :
            System.out.println("n:" + i + " is failed.");
        }
      }

      System.out.println ( list.getAllElements() );
    }
  }
}

class Node {
  Node next,prev;
  int key;

  public Node(int key) {
    this.key = key;
  }
}

class MyList {
  Node nil;
  Node current;
  int size;

  public MyList() {
    nil = new Node(0);
    nil.next = nil.prev = nil;
    size = 0;
  }

  public String getAllElements() {
    StringBuilder buf = new StringBuilder(size*2);

    if(size > 0){
      current = nil.next;
      for(int i=0; i<size; i++){
        buf.append(current.key).append(" ");
        current = current.next;
      }
    }
    buf.setLength(buf.length()-1);

    return buf.toString();
  }
  public void insertFirst(int x) {
    if(size == 0) {
      current = new Node(x);
      nil.next = current;
      nil.prev = current;
      current.prev = nil;
      current.next = nil;
      size++;
    }
    else {
      Node add = new Node(x);
      
      current.prev.next = add;
      add.prev = current.prev;

      add.next = current;
      current.prev = add;

      current = add;
      size++;
    }
  }
  public void deleteFirst() {
    nil.next = current.next;
    current.next.prev = current.prev;

    current = current.next;
    size--;
  }
  public void deleteLast() {
    current = nil.prev;

    nil.prev = current.prev;
    current.prev.next = current.next;

    current = nil.next;
    size--;
  }
  public void delete(int x) {
    Node target = findFirst(x);

    if(target == nil) current = current.next;
    else {
      current.prev.next = target.next;
      current.next.prev = target.prev;
      current = nil.next;
      size--;
    }
  }
  private Node findFirst(int x) {
    while(current != nil) {
      if(current.key == x) return current;
      else if(current.next.key == x) return current.next;
      current = current.next.next;
    }

    return current;
  }
}


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

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

public class main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String[] line;
      MyList list = new MyList();

      for(int i=0; i<n; i++) {
        line = br.readLine().split(" ");
        switch( line[0] ) {
          case "insert" :
            list.insertFirst( Integer.parseInt(line[1]) );
            break;
          case "deleteFirst" :
            list.deleteFirst();
            break;
          case "deleteLast" :
            list.deleteLast();
            break;
          case "delete" :
            list.delete( Integer.parseInt(line[1]) );
            break;
          default :
            System.out.println("n:" + i + " is failed.");
        }
      }

      System.out.println ( list.getAllElements() );
    }
  }
}

class Node {
  Node next,prev;
  int key;

  public Node(int key) {
    this.key = key;
  }
}

class MyList {
  Node nil;
  Node current;
  int size;

  public MyList() {
    nil = new Node(0);
    nil.next = nil.prev = nil;
    size = 0;
  }

  public String getAllElements() {
    StringBuilder buf = new StringBuilder(size*2);

    if(size > 0){
      current = nil.next;
      for(int i=0; i<size; i++){
        buf.append(current.key).append(" ");
        current = current.next;
      }
    }
    buf.setLength(buf.length()-1);

    return buf.toString();
  }
  public void insertFirst(int x) {
    if(size == 0) {
      current = new Node(x);
      nil.next = current;
      nil.prev = current;
      current.prev = nil;
      current.next = nil;
      size++;
    }
    else {
      Node add = new Node(x);
      
      current.prev.next = add;
      add.prev = current.prev;

      add.next = current;
      current.prev = add;

      current = add;
      size++;
    }
  }
  public void deleteFirst() {
    nil.next = current.next;
    current.next.prev = current.prev;

    current = current.next;
    size--;
  }
  public void deleteLast() {
    current = nil.prev;

    nil.prev = current.prev;
    current.prev.next = current.next;

    current = nil.next;
    size--;
  }
  public void delete(int x) {
    Node target = findFirst(x);

    if(target == nil) current = current.next;
    else {
      current.prev.next = target.next;
      current.next.prev = target.prev;
      current = nil.next;
      size--;
    }
  }
  private Node findFirst(int x) {
    while(current != nil) {
      if(current.key == x) return current;
      if(current.next.key == x) return current.next;
      current = current.next.next;
    }

    return current;
  }
}


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

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

class Cell {
	int data;
	Cell next;
	Cell prev;

	Cell(int data) {
		this.data = data;
		this.next = null;
		this.prev = null;
	}
}

class DLList {
	final Cell header;
	Cell cell;

	DLList() {
		header = new Cell(-1);
	}
	void insert(int x) {
		Cell c = new Cell(x);
		header.next.prev = c;
		c.next = header.next;
		header.next = c;
		c.prev = header;
	}
	Cell search(int x) {
		Cell c = header;
		while(c.data != x) {
			c = c.next;
		}
		return c;
	}
	void delete(int x) {
		Cell c = search(x);
		c.prev.next = c.next;
		c.next.prev = c.prev;
		c = null;
	}
	void deleteFirst() {
		Cell c = header.next;
		header.next = c.next;
		c.next.prev = header;
		c = null;
	}
	void deleteLast() {
		Cell c = header.prev;
		c.prev.next = header;
		header.prev = c.prev;
		c = null;
	}
}

//双方向連結リスト
public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		DLList list = new DLList();
		try {
			int n = Integer.parseInt(br.readLine());
			for(int i = 0; i < n; i++) {
				String[] str = br.readLine().split(" ");
				if(str[0].startsWith("i")) {
					list.insert(a);
					int a = Integer.parseInt(str[1]);
				} else if(str[0].equals("deleteFirst")) {
					list.deleteFirst();
				} else if(str[0].equals("deleteLast")) {
					list.deleteLast();
				} else {
					list.delete(a);
					int a = Integer.parseInt(str[1]);
				}
			}
			for(Cell c = list.header.next; c == list.header.prev; c = c.next) {
				if(c.next == list.header) {
					System.out.println(c.data);
				} else {
					System.out.print(c.data + " ");
				}
			}
		} catch(IOException e) {
			System.out.println("error");
		} finally {
			try {
				br.close();
			} catch(IOException e) {

			}
		}
	}

}



Compiler output:
Main.java:69: error: cannot find symbol
					list.insert(a);
					            ^
  symbol:   variable a
  location: class Main
Main.java:76: error: cannot find symbol
					list.delete(a);
					            ^
  symbol:   variable a
  location: class Main
2 errors
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.Deque;

public class pr_3_C_double_linked_list {
    public static void main(String[] args) throws IOException{
        // Prints "Hello, World" to the terminal window.
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	int n = Integer.parseInt(br.readLine());
    	int i = 0;
    	String orders[] = new String[n];
    	Deque<String> doubly_linked_list = new ArrayDeque<String>();
    	StringBuilder ans = new StringBuilder();
    	
    	while(i++ < n){
    		String order_word[] = new String[2]; 
    		order_word = br.readLine().split(" ");
    		String order = order_word[0];
    		String num = order_word[1];
    		
    		if(order.equals("insert")){
    			doubly_linked_list.addFirst(num);
    		}
    		if(order.equals("delete")){
    			doubly_linked_list.remove(num);
    		}
    		if(order.equals("deleteFirst")){
    			doubly_linked_list.removeFirst();
    		}
    		if(order.equals("deleteLast")){
    			doubly_linked_list.removeLast();
    		}
    	}    		
		if(!doubly_linked_list.isEmpty()){
			ans.append(doubly_linked_list.getFirst());
			doubly_linked_list.removeFirst();
		}
		
		while(!doubly_linked_list.isEmpty()){
			ans.append(" ").append(doubly_linked_list.getFirst());
			doubly_linked_list.removeFirst();
		}
		System.out.println(ans.toString());
    }
}    



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

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.Deque;

public class Main {
    public static void main(String[] args) throws IOException{
        // Prints "Hello, World" to the terminal window.
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	int n = Integer.parseInt(br.readLine());
    	int i = 0;
    	String orders[] = new String[n];
    	Deque<String> doubly_linked_list = new ArrayDeque<String>();
    	StringBuilder ans = new StringBuilder();
    	
    	while(i++ < n){
    		String order_word[] = new String[2]; 
    		order_word = br.readLine().split(" ");
    		String order = order_word[0];
//    		String num = order_word[1];
    		
    		if(order.equals("insert")){
    			doubly_linked_list.addFirst(num);
    		}
    		if(order.equals("delete")){
    			doubly_linked_list.remove(num);
    		}
    		if(order.equals("deleteFirst")){
    			doubly_linked_list.removeFirst();
    		}
    		if(order.equals("deleteLast")){
    			doubly_linked_list.removeLast();
    		}
    	}    		
		if(!doubly_linked_list.isEmpty()){
			ans.append(doubly_linked_list.getFirst());
			doubly_linked_list.removeFirst();
		}
		
		while(!doubly_linked_list.isEmpty()){
			ans.append(" ").append(doubly_linked_list.getFirst());
			doubly_linked_list.removeFirst();
		}
		System.out.println(ans.toString());
    }
}    



Compiler output:
Main.java:25: error: cannot find symbol
    			doubly_linked_list.addFirst(num);
    			                            ^
  symbol:   variable num
  location: class Main
Main.java:28: error: cannot find symbol
    			doubly_linked_list.remove(num);
    			                          ^
  symbol:   variable num
  location: class Main
2 errors
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.Deque;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringBuilder ans = new StringBuilder();

        int n = Integer.parseInt(br.readLine());
     	Deque<String> doubly_linked_list = new ArrayDeque<String>();
        for (int i = 0; i < n; i++) {
            String[] line = br.readLine().split(" ");
            if (line[0].equals("insert")) {
                doubly_linked_list.insert(Integer.parseInt(line[1]));
            } else if (line[0].equals("delete")) {
                doubly_linked_list.delete(Integer.parseInt(line[1]));
            } else if (line[0].equals("deleteFirst")) {
                doubly_linked_list.deleteFirst();
            } else if (line[0].equals("deleteLast")) {
                doubly_linked_list.deleteLast();
            }
        }
		if(!doubly_linked_list.isEmpty()){
			ans.append(doubly_linked_list.getFirst());
			doubly_linked_list.removeFirst();
		}
		
		while(!doubly_linked_list.isEmpty()){
			ans.append(" ").append(doubly_linked_list.getFirst());
			doubly_linked_list.removeFirst();
		}
        System.out.print(ans.toString());
    }
}


Compiler output:
Main.java:18: error: cannot find symbol
                doubly_linked_list.insert(Integer.parseInt(line[1]));
                                  ^
  symbol:   method insert(int)
  location: variable doubly_linked_list of type Deque<String>
Main.java:20: error: cannot find symbol
                doubly_linked_list.delete(Integer.parseInt(line[1]));
                                  ^
  symbol:   method delete(int)
  location: variable doubly_linked_list of type Deque<String>
Main.java:22: error: cannot find symbol
                doubly_linked_list.deleteFirst();
                                  ^
  symbol:   method deleteFirst()
  location: variable doubly_linked_list of type Deque<String>
Main.java:24: error: cannot find symbol
                doubly_linked_list.deleteLast();
                                  ^
  symbol:   method deleteLast()
  location: variable doubly_linked_list of type Deque<String>
4 errors
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.Deque;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringBuilder ans = new StringBuilder();

        int n = Integer.parseInt(br.readLine());
     	Deque<String> doubly_linked_list = new ArrayDeque<String>();
        for (int i = 0; i < n; i++) {
            String[] line = br.readLine().split(" ");
            if (line[0].equals("insert")) {
                doubly_linked_list.addFirst(Integer.parseInt(line[1]));
            } else if (line[0].equals("delete")) {
                doubly_linked_list.remove(Integer.parseInt(line[1]));
            } else if (line[0].equals("deleteFirst")) {
                doubly_linked_list.removeFirst();
            } else if (line[0].equals("deleteLast")) {
                doubly_linked_list.removeLast();
            }
        }
		if(!doubly_linked_list.isEmpty()){
			ans.append(doubly_linked_list.getFirst());
			doubly_linked_list.removeFirst();
		}
		
		while(!doubly_linked_list.isEmpty()){
			ans.append(" ").append(doubly_linked_list.getFirst());
			doubly_linked_list.removeFirst();
		}
        System.out.print(ans.toString());
    }
}


Compiler output:
Main.java:18: error: incompatible types: int cannot be converted to String
                doubly_linked_list.addFirst(Integer.parseInt(line[1]));
                                                            ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: Java

package alds13list;

import java.util.Scanner;

import static alds13list.Main.insert;

public class Main {
    
class Node {
    Node prev, next;
    int value;
}

    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();

        nil.next = nil;
        nil.prev = nil;

        for (int i = 0; i < n; i++) {
            String s = scan.next();
            int x = scan.nextInt();

            if (s.equals("delete")) {
                delete(x);
            } else if (s.equals("insert")) {
                insert(x);
            } else if (s.equals("deleteFirst")) {
                deleteFirst();
            } else if (s.equals("deleteLast")) {
                deleteLast();
            }

            }

        Node nn = nil.next;
        while (nn != nil) {
            System.out.print(nn.value + " ");
            nn = nn.next;
        }

    }

    static void insert(int x) {
        Node n = new Node();
        Node next = nil.next;

        nil.next = n;
        n.next = next;
        n.prev = nil;
        next.prev = n;
        n.value = x;
    }

    static void delete(int x) {
        Node n = nil.next;
        while (n != nil && n.value != x) {
            n = n.next;
        }
        n.prev.next = n.next;
        n.next.prev = n.prev;
    }

    static void deleteFirst() {
        Node next = nil.next.next;
        nil.next = next;
        next.prev = nil;
    }

    static void deleteLast() {
        Node n = nil;
        while (n.next != nil && n != nil) {
            n = n.next;
        }
        Node prev = n.prev;
        prev.next = nil;
        nil.prev = prev;
    }

    static Node nil = new Node();

}




Compiler output:
Main.java:47: error: non-static variable this cannot be referenced from a static context
        Node n = new Node();
                 ^
Main.java:82: error: non-static variable this cannot be referenced from a static context
    static Node nil = new Node();
                      ^
2 errors