For this Question: You are given the number N. You need to convert it to 1 in the minimum number of operations.
The operations allowed are as follows:
1. If N is even then divide the number by 2.
2. If N is odd then you can either add 1 to it or subtract 1 from it.
Using the above operations, find the minimum number of operations required to convert N to 1.The first line of input contains an integer T denoting the number of test cases. T test cases follow.  Each test case contains 1 line of input containing integer N.

<b>Constraints:</b>
1 &le; T &le; 100
1 &le; N &le; 10<sup>7</sup>
For each testcase, in a new line, print the minimum number of steps required.Sample Input:
4
1
2
3
4

Sample Output:
0
1
2
2

<b>Explanation:</b>
1 can be converted into 1 in 0 steps.
2 can be converted into 1 in 1 step: 2/2=1
3 can be converted into 1 in 3 steps: 3-1= 2 then 2/2=1
4 can be converted into 1 in 2 steps:  4/2=2 then 2/2=1, I have written this Solution Code: #include<bits/stdc++.h>

using namespace std;
#define int            long long
#define f(i,n)        for(int i=0;i<(n);++i)
#define fA(i,a,n)     for(int i=a;i<=(n);++i)
#define fD(i,a,n)     for(int i=a;i>=(n);--i)
#define tc 			  int t;cin>>t;f(testcase,t)
#define pii             pair<int,int>
void c_p_c() {

	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("inputf.in", "r", stdin);
	freopen("outputf.in", "w", stdout);
#endif
}
int dp[10000001];
int minsteps(int n , int dp[]) {
	if (n == 1)
		return 0;
	if (dp[n] != 0)
		return dp[n];
	int op1, op2, op3;
	op1 = op2 = op3 = INT_MAX;

	if (n % 2 == 0) {
		op1 = 1 + minsteps(n / 2, dp);
	}
	else {
		op2 = 1 + minsteps(n - 1, dp);

		op3 = 1 + minsteps(n + 1, dp);
	}

	int ans = min(op1, min(op2, op3));
	dp[n] = ans;
	return dp[n];

}
int32_t main() {




	memset(dp, 0, sizeof(dp));
	tc {
		int n;
		cin >> n;
		cout << minsteps(n, dp) << "\n";
	}

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