For this Question: Given an array containing N integers and an integer K. Your task is to find the length of the longest Sub-Array with sum of the elements equal to the given value K.The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. The first line of each test case contains two integers N and K and the second line contains N space-separated elements of the array.

Constraints:-
1<=T<=500
1<=N,K<=10^5
-10^5<=A[i]<=10^5

Sum of N over all test cases does not exceed 10^5For each test case, print the required length of the longest Sub-Array in a new line. If no such sub-array can be formed print 0.Sample Input:
3
6 15
10 5 2 7 1 9
6 -5
-5 8 -14 2 4 12
3 6
-1 2 3

Sample Output:
4
5
0, I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;

int main(){

int t;
cin>>t;
while(t--){
unordered_map<long long,int> um;
int n,k;
cin>>n>>k;
long arr[n];
int maxLen=0;
for(int i=0;i<n;i++){cin>>arr[i];}
long long sum=0;

for(int i=0;i<n;i++){
    sum += arr[i];

        // when subarray starts from index '0'
        if (sum == k)
            maxLen = i + 1;

        // make an entry for 'sum' if it is
        // not present in 'um'
        if (um.find(sum) == um.end())
            um[sum] = i;

        // check if 'sum-k' is present in 'um'
        // or not
        if (um.find(sum - k) != um.end()) {

            // update maxLength
            if (maxLen < (i - um[sum - k]))
                maxLen = i - um[sum - k];
        }
    }

cout<<maxLen<<endl;

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