For this Question: You have been given a sequence A of N digits. Each digit in this sequence ranges from 1 to 10^9. You need to perform 2 types of operations on this list:

Add(x): Add element x to the end of the list.
Max(list): Find the maximum element in the current sequence.
For each query of type 2, you need to print the result of that operation.The first line consists of a single integer N denoting the size of the initial sequence. The next line consists of N space-separated integers denoting the elements of the initial sequence. The next line contains a single integer q denoting the number of queries. The next q lines contain the details of the operation. The first integer type indicates the type of query. If typei ==1, it is followed by another integer x and you need to perform an operation of type 1 else operations of type 2

Constraints
1 < = N < = 10^5
1 < = Ai < = 10^9
1 < = q < = 10^4For each operation of the second type, print a single integer on a new line.Sample Input
5
1 2 3 4 5
6
1 1
1 2
1 3
2
1 8
2

Sample Output
5
8, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static long mod= (long) (1e9 +7);
	static InputReader s;
	static PrintWriter out;
	public static void main(String args[]) {
		new Thread(null, new Runnable() {
			public void run() {
				try{
					solve();
					out.flush();
					out.close();
				}
				catch(Exception e){
					e.printStackTrace();
				}
			}
		}, "1", 1 << 26).start();
	}
	public static void solve() throws IOException{
		s= new InputReader(System.in);
		OutputStream outputStream= System.out;
		out= new PrintWriter(outputStream);
		PriorityQueue<Integer> q= new PriorityQueue<>(Collections.reverseOrder());
		int n= s.nextInt();
		for(int i=0;i<n;i++){
			q.add(s.nextInt());
		}
		int query = s.nextInt();
		while(query-->0){
			int type= s.nextInt();
			if(type==1){
				q.add(s.nextInt());
			}
			else{
				out.println(q.peek());

			}
		}
	}

	static long combinations(long n,long r){
		if(r==0 || r==n) return 1;
		r= Math.min(r, n-r);
		long ans=n;
		for(int i=1;i<r;i++){
			ans= (ans*(n-i))%mod;
			ans= (ans*modulo(i+1,mod-2,mod))%mod;
		}
		return ans;
	}

	static long modulo(long x,long y,long p)
	{
		 long res = 1;
		 x = x % p;

	    while (y > 0)
	    {
	        if (y%2==1)
	            res = (res*x) % p;

	        y = y>>1;
	        x = (x*x) % p;
	    }
	    return res;
	}

	static HashSet<Integer> primeFactors(int n)
	{

		HashSet<Integer> arr= new HashSet<>();
	    while (n%2 == 0)
	    {
	        arr.add(2);
	        n = n/2;
	    }


	    for (int i = 3; i <= Math.sqrt(n); i = i+2)
	    {

	        while (n%i == 0)
	        {
	            arr.add(i);
	            n = n/i;
	        }
	    }


	    if (n > 2)
	        arr.add(n);

	    return arr;
	}

	public static long expo(long a, long b){
		if (b==0)
	        return 1;
	    if (b==1)
	        return a;
	    if (b==2)
	        return a*a;

	    if (b%2==0){
	            return expo(expo(a,(b/2)),2);
	    }
	    else{
	        return a*expo(expo(a,(b-1)/2),2);
	    }
	}
	static class Pair implements Comparable<Pair>
	{
		String x;
		String y;
		Pair(String ii, String cc)
		{
			x=ii;
			y=cc;
		}

		public int compareTo(Pair o)
		{




			return this.x.compareTo(o.x);

		}







		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return x == other.x && y == other.y;
		}

		public String toString() {
			return "[x=" + x + ", y=" + y + "]";
		}

	}

	public static int[] sieve(int N){
		int arr[]= new int[N+1];
		for(int i=2;i<=Math.sqrt(N);i++){
			if(arr[i]==0){
				for(int j= i*i;j<= N;j= j+i){
					arr[j]=1;
				}
			}
		}
		return arr;

	}
	static int gcd(int a,int b){
		if(b==0) return a;
		return gcd(b,a%b);
	}

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static void catalan_numbers(int n) {
		long catalan[]= new long[n+1];
	    catalan[1] = 1;
	    for (int i = 2; i <= n; i++) {
	        for (int j = 1; j <= i - 1; j++) {
	            catalan[i] = catalan[i] + ((catalan[j]) * catalan[i - j]);
	        }
	    }
	}

	static final class InputReader{
        private final InputStream stream;
        private final byte[] buf=new byte[1024];
        private int curChar;
        private int Chars;
        public InputReader(InputStream stream){this.stream=stream;}
		private int read()throws IOException{
            if(curChar>=Chars){
                curChar=0;
                Chars=stream.read(buf);
                if(Chars<=0)
                    return -1;
            }
            return buf[curChar++];
        }
        public final int nextInt()throws IOException{return (int)nextLong();}
        public final long nextLong()throws IOException{
            int c=read();
            while(isSpaceChar(c)){
                c=read();
                if(c==-1) throw new IOException();
            }
            boolean negative=false;
            if(c=='-'){
                negative=true;
                c=read();
            }
            long res=0;
            do{
                if(c<'0'||c>'9')throw new InputMismatchException();
                res*=10;
                res+=(c-'0');
                c=read();
            }while(!isSpaceChar(c));
            return negative?(-res):(res);
        }
        public final int[] nextIntBrray(int size)throws IOException{
            int[] arr=new int[size];
            for(int i=0;i<size;i++)arr[i]=nextInt();
            return arr;
        }
        public final String next()throws IOException{
            int c=read();
            while(isSpaceChar(c))c=read();
            StringBuilder res=new StringBuilder();
            do{
                res.append((char)c);
                c=read();
            }while(!isSpaceChar(c));
            return res.toString();
        }
        public final String nextLine()throws IOException{
            int c=read();
            while(isSpaceChar(c))c=read();
            StringBuilder res=new StringBuilder();
            do{
                res.append((char)c);
                c=read();
            }while(c!='\n'&&c!=-1);
            return res.toString();
        }
        private boolean isSpaceChar(int c){
            return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
        }
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?