For this Question: Given an array arr[] of size N containing 0s and 1s only. The task is to count the subarrays having an equal number of 0s and 1s.The first line of the input contains an integer N denoting the size of the array and the second line contains N space-separated 0s and 1s.

Constraints:-
1 <= N <= 10^6
0 <= A[i] <= 1For each test case, print the count of required sub-arrays in new line.Sample Input 
7
1 0 0 1 0 1 1

Sample Output
8

The index range for the 8 sub-arrays are:
(0, 1), (2, 3), (0, 3), (3, 4), (4, 5)
(2, 5), (0, 5), (1, 6), I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;
#define max1 1000001
int a[max1];
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
    cin>>a[i];
    if(a[i]==0){a[i]=-1;}
}
long sum=0;
unordered_map<long,int> m;
long cnt=0;
for(int i=0;i<n;i++){
  sum+=a[i];
    if(sum==0){cnt++;}
    cnt+=m[sum];
    m[sum]++;
}
cout<<cnt;
}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?