For this Question: You are given two arrays - value and frequency both containing N elements.
There is also a third array C which is currently empty. Then you perform N insertion operation in the array. For ith operation you insert value[i] to the end of the array frequency[i] number of times.
Finally you have to tell the kth smallest element in the array C.First line of input contains N. 
Second line contains N integers denoting array - value
Third line contains N integers denoting array - frequency
Fourth line contains single integer K.

Constraints
1 <= N, value[i], frequency[i] <= 100000
1 <= k <= frequency[1] + frequency[2] +frequency[3] +........ + frequency[N]
   Output a single integer which is the kth smallest element of the array C.Sample input 1
5
1 2 3 4 5
1 1 1 2 2
3

Sample output 1
3

Explanation 1: 
Array C constructed is 1 2 3 4 4 5 5
Third smallest element is 3

Sample input 2
3
2 1 3
3 3 2
2

sample output 2
1

Explanation 2: 
Array C constructed is  2 2 2 1 1 1 3 3
Second smallest element is 1, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
    public static void main (String[] args)throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        StringTokenizer st = new StringTokenizer(br.readLine());
        int[] val = new int[n];
        for(int i=0; i<n; i++){
            val[i] = Integer.parseInt(st.nextToken());
        }

        st = new StringTokenizer(br.readLine());
        int[] freq = new int[n];
        for(int i=0; i<n; i++){
            freq[i] = Integer.parseInt(st.nextToken());
        }

        int k = Integer.parseInt(br.readLine());

        for (int i=0; i<n; i++) {
            for (int j=i+1; j<n; j++) {
                if (val[j] < val[i]) {
                    int temp = val[i];
                    val[i] = val[j];
                    val[j] = temp;
                    int temp1 = freq[i];
                    freq[i] = freq[j];
                    freq[j] = temp1;
                }
            }
        }
        int element=0;
        for(int i=0; i<n; i++){
            for(int j=0; j<freq[i]; j++){
                element++;
                int value = val[i];
                if(element==k){
                    System.out.print(value);
                    break;
                }
            }
        }
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?