Language: Java

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


Compiler output:
Main.java:5: error: Deque is abstract; cannot be instantiated
        Deque<Integer> d = new Deque<Integer>();
                           ^
Main.java:10: error: variable d is already defined in method main(String[])
                case 0: int d = sc.nextInt(); if(d == 0) qu.addFirst(sc.nextInt()); else qu.addLast(sc.nextInt()); break;
                            ^
Main.java:10: error: int cannot be dereferenced
                case 0: int d = sc.nextInt(); if(d == 0) qu.addFirst(sc.nextInt()); else qu.addLast(sc.nextInt()); break;
                                                           ^
Main.java:10: error: int cannot be dereferenced
                case 0: int d = sc.nextInt(); if(d == 0) qu.addFirst(sc.nextInt()); else qu.addLast(sc.nextInt()); break;
                                                                                           ^
Main.java:11: error: variable i is already defined in method main(String[])
                case 1: int p = sc.nextInt(); for(int i = 0 ; i < qu.size() ; i++){ if(i == p) System.out.println(qu.element()); qu.addLast(qu.element()); qu.removeFirst();} break;
                                                      ^
Main.java:11: error: int cannot be dereferenced
                case 1: int p = sc.nextInt(); for(int i = 0 ; i < qu.size() ; i++){ if(i == p) System.out.println(qu.element()); qu.addLast(qu.element()); qu.removeFirst();} break;
                                                                    ^
Main.java:11: error: int cannot be dereferenced
                case 1: int p = sc.nextInt(); for(int i = 0 ; i < qu.size() ; i++){ if(i == p) System.out.println(qu.element()); qu.addLast(qu.element()); qu.removeFirst();} break;
                                                                                                                    ^
Main.java:11: error: int cannot be dereferenced
                case 1: int p = sc.nextInt(); for(int i = 0 ; i < qu.size() ; i++){ if(i == p) System.out.println(qu.element()); qu.addLast(qu.element()); qu.removeFirst();} break;
                                                                                                                                   ^
Main.java:11: error: int cannot be dereferenced
                case 1: int p = sc.nextInt(); for(int i = 0 ; i < qu.size() ; i++){ if(i == p) System.out.println(qu.element()); qu.addLast(qu.element()); qu.removeFirst();} break;
                                                                                                                                              ^
Main.java:11: error: int cannot be dereferenced
                case 1: int p = sc.nextInt(); for(int i = 0 ; i < qu.size() ; i++){ if(i == p) System.out.println(qu.element()); qu.addLast(qu.element()); qu.removeFirst();} break;
                                                                                                                                                             ^
Main.java:12: error: variable d is already defined in method main(String[])
                case 2: int d = sc.nextInt(); if(d == 0) qu.removeFirst(); else qu.removeLast(); break;
                            ^
Main.java:12: error: int cannot be dereferenced
                case 2: int d = sc.nextInt(); if(d == 0) qu.removeFirst(); else qu.removeLast(); break;
                                                           ^
Main.java:12: error: int cannot be dereferenced
                case 2: int d = sc.nextInt(); if(d == 0) qu.removeFirst(); else qu.removeLast(); break;
                                                                                  ^
13 errors