For this Question: Given a binary sorted non-increasing array arr of size <b>N</b>. You need to print the count of <b>1's</b> in the binary array.

Try to solve the problem using binary searchThe input line contains T, denotes the number of testcases. 
Each test case contains two lines. The first line contains N (size of binary array). The second line contains N elements of binary array separated by space.

<b>Constraints:</b>
1 <= T <= 100
1 <= N <= 10^6
arr[i] = 0,1

<b>Sum of N over all testcases does not exceed 10^6</b>For each testcase in new line, print the count 1's in binary array.Input:
2
8
1 1 1 1 1 0 0 0
8
1 1 0 0 0 0 0 0

Output:
5
2

Explanation:
Testcase 1: Number of 1's in given binary array : 1 1 1 1 1 0 0 0 is 5.
Testcase 2: Number of 1's in given binary array : 1 1 0 0 0 0 0 0 is 2., I have written this Solution Code: #include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int a[N];

signed main() {
	IOS;
	int t;	cin >> t;
	while(t--){
		int n;	cin >> n;
		for(int i = 1; i <= n; i++)
			cin >> a[i];
		int l = 0, h = n+1;
		while(l+1 < h){
			int m = (l + h) >> 1;
			if(a[m] == 1)
				l = m;
			else
				h = m;
		}
		cout << l << endl;
	}
	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?