For this Question: You are given an array A consisting of N number and an empty set S. For each pair of numbers A[i] and A[j] in the array (i < j), you need to find their LCM and insert the LCM into the set S.

You need to report the GCD of the elements in set S.The first line of the input contains an integer N.
The second line of the input contains N space separated integers A[1], A[2],. , A[N].

Constraints
2 <= N <= 100000
1 <= A[i] <= 200000Output a single integer, the GCD of LCM set S.Sample Input
4
10 24 40 60

Sample Output
20

Explanation: 
The pairwise LCM are as follows:
i : 1 | j : 2 | LCM : 120
i : 1 | j : 3 | LCM : 40
i : 1 | j : 4 | LCM : 60
i : 2 | j : 3 | LCM : 120
i : 2 | j : 4 | LCM : 120
i : 3 | j : 4 | LCM : 120
S = {40, 60, 120}. GCD of the values in S is 20.

Sample Input
2
3 3

Sample Output
3, I have written this Solution Code: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import java.util.HashSet;
import java.util.Iterator;
import java.util.TreeSet;


public class Main {

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

    public static void main(String[] args) throws IOException {
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(read.readLine());
        String[] str = read.readLine().trim().split(" ");
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(str[i]);
        }

        int[] temp = new int[n];
        for (int i = 0; i < n; i++) {
            temp[i] = 1;
        }
        temp[n - 1] = arr[n - 1];
        for (int i = n - 2; i >= 0; i--) {
            temp[i] = gcd(arr[i], temp[i + 1]);
        }
        int[] wemp = new int[n - 1];
        for (int i = 0; i < n - 1; i++) {
            wemp[i] = lcm(arr[i], temp[i + 1]);
        }
        int result = wemp[0];
        for (int i = 1; i < n - 1; i++) {
            result = gcd(result, wemp[i]);
        }
        System.out.println(result);

    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?