3 Logicians Walk into a Bar- Starters 112

Can anyone tell me what is wrong with the code or testcase which gives wrong output.

Code:

include
using namespace std;

int main() {
// your code goes here
ios_base::sync_with_stdio(false) ;
cin.tie(NULL);
cout.tie(NULL);
int t;
cin>>t;
while(t–)
{
int n,p=0;
cin>>n;
string s;
cin>>s;
if(n==1)
{
if(s[0]==‘0’)
cout<<“NO\n”;
else
cout<<“YES\n”;
}
else{
p=0;
for(int i=0;i<n-1;i++)
{
if(s[0]==‘0’){
p=1;
cout<<“NO\n”;
}
else if(p==1)
cout<<“NO\n”;
else
cout<<“IDK\n”;
}
if(p==1||s[n-1]==‘0’)
cout<<“NO\n”;
else
cout<<“YES\n”;
}
}
return 0;
}

there are so many error, like syntax errors and inconsistency
right code should be like this.

include
using namespace std;

int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

int t;
cin >> t;

while(t--) {
    int n, p = 0;
    cin >> n;
    string s;
    cin >> s;
    
    if(n == 1) {
        if(s[0] == '0')
            cout << "NO\n";
        else
            cout << "YES\n";
    } else {
        p = 0;
        for(int i = 0; i < n - 1; i++) {
            if(s[0] == '0') {
                p = 1;
                cout << "NO\n";
            } else if(p == 1) {
                cout << "NO\n";
            } else {
                cout << "IDK\n";
            }
        }
        if(p == 1 || s[n - 1] == '0')
            cout << "NO\n";
        else
            cout << "YES\n";
    }
}
return 0;

}