Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;

int main() {
    int test_cases;
    cin >> test_cases;
    while (test_cases-- > 0) {
        string s;
        cin >> s;
        int sum=0;
        for(int i=0;i<s.length();i++){
            sum+=s[i];
        }
        int count_2=0;
        int count_3=0;
        for(int i=0;i<s.length();i++){
            if(s[i]=='2'){
                count_2++;
            }
            if(s[i]=='3'){
                count_3++;
            }
        }
        if(sum%9==0){
            cout << "YES" << endl;
            continue;
        }
        else if(sum%9==1){
            if(count_2>=2||(count_2>=1&&count_3>=1)){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==2){
            if(count_2>=8||(count_2>=2&&count_3>=2)||(count_2>=5&&count_3>=1)){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==3){
            if(count_2>=3||count_3>=1){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==4){
            if(count_2>=7||(count_2>=1&&count_3>=2)||(count_2>=4&&count_3>=1)){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==5){
            if(count_2>=2){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==6){
            if(count_2>=6||(count_2>=3&&count_3>=1)||count_3>=2){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==7){
            if(count_2>=1){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==8){
            if(count_2>=5||(count_2>=2&&count_3>=1)){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
    }
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;

int main() {
    int test_cases;
    cin >> test_cases;
    while (test_cases-- > 0) {
        string s;
        cin >> s;
        int sum=0;
        for(int i=0;i<s.length();i++){
            sum+=s[i]-'0';
        }
        int count_2=0;
        int count_3=0;
        for(int i=0;i<s.length();i++){
            if(s[i]=='2'){
                count_2++;
            }
            if(s[i]=='3'){
                count_3++;
            }
        }
        if(sum%9==0){
            cout << "YES" << endl;
            continue;
        }
        else if(sum%9==1){
            if(count_2>=2||(count_2>=1&&count_3>=1)){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==2){
            if(count_2>=8||(count_2>=2&&count_3>=2)||(count_2>=5&&count_3>=1)){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==3){
            if(count_2>=3||count_3>=1){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==4){
            if(count_2>=7||(count_2>=1&&count_3>=2)||(count_2>=4&&count_3>=1)){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==5){
            if(count_2>=2){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==6){
            if(count_2>=6||(count_2>=3&&count_3>=1)||count_3>=2){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==7){
            if(count_2>=1){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
        else if(sum%9==8){
            if(count_2>=5||(count_2>=2&&count_3>=1)){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
            continue;
        }
    }
}