Problem: 2050C - Uninteresting Number
Language: c++17 

Code 1:
#include <ostream>

#include <cstdio>

#include <algorithm>

#include<list>

#include<queue>

#include <iostream>

#include <cstring>

#include <math.h>

#include <cmath>

#include <string>

using namespace std;

int t,number=1,total,num2,num3;

char num[1005][100005];

int main(){

    scanf("%d",&t);

    while (t--)

    {

        total = 0;

        num2 = 0;

        num3 = 0;

        scanf("%s",num[number]);

        for (int i = 0; i < strlen(num[number]); i++)

        {

            total += (num[number][i] - '0');

            if (num[number][i] == '2')

            {

                num2 ++;

            }

            if (num[number][i] == '3')

            {

                num3 ++;

            }

            

        }

        if (total%9 == 0)

        {

            printf("YES\n");

            continue;

        }

        

        if ((total%9)%2 == 0)

        {

            total = 18-(total%9);

        }else{

            total = 9-(total%9);

        }



        int temp = num2+num3;

       for (int i = 1; i <= temp+1; i++)

       {

        if (total == 0)

        {

            printf("YES\n");

            break;

        }

        

         if (total>=6 && num3>0)

         {

            total -= 6;

            num3--;

         }

         else if (total>=2 && num2>0)

         {

            total -= 2;

            num2--;

         

         

         

       }

       

        

    }

    if (total == 0)

    {

        continue;

    }

    

    printf("NO\n");

        

        number++;

}

    

    return 0;

}

Code 2:
#include <ostream>

#include <cstdio>

#include <algorithm>

#include<list>

#include<queue>

#include <iostream>

#include <cstring>

#include <math.h>

#include <cmath>

#include <string>

using namespace std;

int t,total,num2,num3;

char num[100005];

int main(){

    scanf("%d",&t);

    while (t--)

    {

        total = 0;

        num2 = 0;

        num3 = 0;

        scanf("%s",num);

        for (int i = 0; i < strlen(num); i++)

        {

            total += (num[i] - '0');

            if (num[i] == '2')

            {

                num2 ++;

            }

            if (num[i] == '3')

            {

                num3 ++;

            }

            

        }

        if (total%9 == 0)

        {

            printf("YES\n");

            continue;

        }

        

        if ((total%9)%2 == 0)

        {

            total = 18-(total%9);

        }else{

            total = 9-(total%9);

        }



        int temp = num2+num3;

       for (int i = 1; i <= temp+1; i++)

       {

        if (total == 0)

        {

            printf("YES\n");

            break;

        }

        

         if (total>=6 && num3>0)

         {

            total -= 6;

            num3--;

         }

         else if (total>=2 && num2>0)

         {

            total -= 2;

            num2--;

         

         

         

       }

       

        

    }

    if (total == 0)

    {

        continue;

    }

    

    printf("NO\n");

        

}

    

    return 0;

}

Answer: 2