For this Question: Given an integer Q representing the number of queries and an integer K. There are two types of queries:
(i) 1 x : Add the number x to the stream
(ii) 2 : Print the sum of last K numbers of the stream. If there are less than K numbers in the stream, print the sum of current stream.
Process all the queries.First line contains two integers Q and K.
Next Q lines contains the queries. 

Constraints
1 <= Q <= 10^5
1 <= x <= 10^5
1 <= K <= Q
There is atleast one query of 2nd type. For each query of type 2, print the sum of last K numbers of the stream on a new line.Sample Input 1:
5 2
1 4
2
1 1
1 3
2

Output 
4
4

Explanation:
Initial Stream = {}
Add 4. Stream = {4}
Sum of last two elements = 4
Add 1. Stream = {4, 1}
Add 3. Stream = {4, 1, 3}
Sum of last two elements = 4

Sample Input 2:
3 1
1 1
2
2

Output
1
1

Explanation
Initial Stream = {}
Add 1. Stream = {1}
Sum of last element = 1
Sum of last element = 1, I have written this Solution Code: import java.io.*;
import java.util.*;

class Main{
	public static void main (String[] args)throws IOException {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	    int n,k;
    	    String line = br.readLine();
    	    String[] strs = line.trim().split("\\s+");
    	    n=Integer.parseInt(strs[0]);
    	    k=Integer.parseInt(strs[1]);
    	    Long sum=0L;
    	    Queue<Integer>x=new LinkedList<Integer>();
    	    while(n>0){
    	        n--;
    	        line = br.readLine();
    	        strs = line.trim().split("\\s+");
    	        int y=Integer.parseInt(strs[0]);
    	        if(y==1){
    	            y=Integer.parseInt(strs[1]);
    	            x.add(y);
        			sum += y;
        			if (x.size() > k) {
        				sum -= x.peek();
        				x.remove();
        			}
    	        }
    	        else{
    	            System.out.print(sum+"\n");
    	        }
    	    }
	}	
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?