Enable to run all testcases, i tried this code as shown in video but it is not working

#include
#include<bits/stdc++.h>
using namespace std;

int solve(int n){
int dp[n+1][2];
dp[0][0]=0;
dp[0][1]=0;

dp[1][0]=1;
dp[1][1]=1;

for(int i=2;i<=n;i++){
	dp[i][0]=dp[i-1][0]+dp[i-1][1];
	dp[i][1]=dp[i-1][0];
}

return dp[n][0]+dp[n][1];

}

int main() {
int t;
cin >> t;
int n;

while(t--){
	cin >> n;
    
	
	if(n>0) cout << solve(n) << endl;
	else cout << 0 << endl;
}
return 0;

}

#include #include<bits/stdc++.h> using namespace std; int solve(int n){ int dp[n+1][2]; dp[0][0]=0; dp[0][1]=0; dp[1][0]=1; dp[1][1]=1; for(int i=2;i<=n;i++){ dp[i][0]=dp[i-1][0]+dp[i-1][1]; dp[i][1]=dp[i-1][0]; } return dp[n][0]+dp[n][1]; } int main() { int t; cin >> t; int n; while(t–){ cin >> n; if(n>0) cout << solve(n) << endl; else cout << 0 << endl; } return 0; }