For this Question: Given an array, A of size N and Q queries of two types:
1 U X - change the value at index U to X
2 L R - print the sum of elements in the range L to R.
Print a single integer corresponding to every query of type 2.The first line of input contains two integers N and Q denoting the number of elements in the array and type of queries respectively. The next line contains N integers denoting the elements of the array A. The next Q lines contain three integers T L R denoting the queries.

1 <= N, Q <= 100000
1 <= A[i] <= 100000
1 <= T <= 2
1 <= U, X <= 100000
1 <= L <= R <= 100000Print a single integer corresponding to every query of type 2 in a separate line. Since the answer can be large print ans modulo (10^9 + 7)Sample Input:
5 6
2 1 3 5 4
2 3 5
1 2 7
1 4 2
2 2 4
1 5 3
2 1 5

Sample Output:
12
12
17

Explanation:
Array after 2nd query: [2, 7, 3, 5, 4]
Array after 3rd query: [2, 7, 3, 2, 4]
Array after 5th query: [2, 7, 3, 2, 3], I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	int st[];
    Main(int arr[], int n)
    {
        int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));
        int max_size = 2 * (int) Math.pow(2, x) - 1;
        st = new int[max_size];
        constructSTUtil(arr, 0, n - 1, 0);
    }
    int getMid(int s, int e) {
        return s + (e - s) / 2;
    }
    int getSumUtil(int ss, int se, int qs, int qe, int si)
    {
        if (qs <= ss && qe >= se)
            return st[si];
        if (se < qs || ss > qe)
            return 0;
        int mid = getMid(ss, se);
        return (getSumUtil(ss, mid, qs, qe, 2 * si + 1) +
                getSumUtil(mid + 1, se, qs, qe, 2 * si + 2))%1000000007;
    }
    void updateValueUtil(int ss, int se, int i, int diff, int si)
    {
        if (i < ss || i > se)
            return;
        st[si] = (st[si] + diff)%1000000007;
        if (se != ss) {
            int mid = getMid(ss, se);
            updateValueUtil(ss, mid, i, diff, 2 * si + 1);
            updateValueUtil(mid + 1, se, i, diff, 2 * si + 2);
        }
    }

    void updateValue(int arr[], int n, int i, int new_val)
    {
        if (i < 0 || i > n - 1) {
            System.out.println("Invalid Input");
            return;
        }
        int diff = new_val - arr[i];
        arr[i] = new_val;
        updateValueUtil(0, n - 1, i, diff, 0);
    }
    int getSum(int n, int qs, int qe)
    {
       return getSumUtil(0, n - 1, qs, qe, 0);
    }
    int constructSTUtil(int arr[], int ss, int se, int si)
    {
        if (ss == se) {
            st[si] = arr[ss];
            return arr[ss];
        }
        int mid = getMid(ss, se);
        st[si] = (constructSTUtil(arr, ss, mid, si * 2 + 1) +
                 constructSTUtil(arr, mid + 1, se, si * 2 + 2))%1000000007;
        return st[si];
    }
	public static void main (String[] args) throws IOException{
                    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                    String s[] = br.readLine().split(" ");
                    int n = Integer.parseInt(s[0]);
                    int q = Integer.parseInt(s[1]);
                    int arr[] = new int[n];
                    String S[] = br.readLine().split(" ");
                    for(int i=0; i<n; i++){
                        arr[i] = Integer.parseInt(S[i]);
                    }
                    Main tree = new Main(arr,n);
                    for(int i=0; i<q; i++){
                        String str[]=br.readLine().split(" ");
                        int qt = Integer.parseInt(str[0]);
                        int val1 = Integer.parseInt(str[1]);
                        int val2 = Integer.parseInt(str[2]);
                        if(qt==1){
                            tree.updateValue(arr, n, val1-1, val2);
                        }
                        else{
                             System.out.println(tree.getSum(n, val1-1, val2-1));
                        }
                     }
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?