Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 3):
#include<bits/stdc++.h>
using namespace std;
#define int long long  
#define forr(i,x,n) for(int i = x ; i < n ; i ++)  
constexpr int MOD = 1e9 + 7;  


int sumOfDigits(int number) {
    int sum = 0;

    // Ensure the number is positive for calculation
    number = abs(number);

    while (number > 0) {
        sum += number % 10; // Add the last digit
        number /= 10;       // Remove the last digit
    }

    return sum;
}

int c2(int number) {
    int s = 0;

    // Ensure the number is positive for calculation
    number = abs(number);

    while (number > 0) {
        if(number % 10 == 2) s++ ; // Add the last digit
        number /= 10;       // Remove the last digit
    }

    return s;
} 

int c3(int number) {
    int s = 0;

    // Ensure the number is positive for calculation
    number = abs(number);

    while (number > 0) {
        if(number % 10 == 3) s++ ; // Add the last digit
        number /= 10;       // Remove the last digit
    }

    return s;
}

int32_t main() {   
    int t  ; 
    cin >> t ; 
    while(t--) {    
        int n ; 
        cin >> n ;  
        int s = sumOfDigits(n) ;   
        int k = s ; 
        bool ya = false ; 
        if(s%9 == 0) ya = true ; 
        else { 
            int tw = c2(n) ; 
            int th = c3(n) ;  
            int mth = min(10ll ,th + 1);
            int mtw = min(10ll , tw + 1) ; 
          //  cout << (th) << endl ;
            forr(i,0, mth ) { 
                forr(j,0, mtw ) { 
                    s= k +  j*2 + i*6 ;  
                  //  cout << s << endl ; 
                    if(s%9 == 0){ 
                        ya = true ; 
                        break ; 
                    } 
                  // if(ya) cout << "YES" << endl ;
                  // else cout << "NO" << endl ;
                }
            }  
        } 

                   if(ya) cout << "YES" << endl ;
                   else cout << "NO" << endl ;
            
        

         
         

    }
} 

Submission (verdict: Runtime error on test 3):
#include<bits/stdc++.h>
using namespace std;
#define int long long  
#define forr(i,x,n) for(int i = x ; i < n ; i ++)  
constexpr int MOD = 1e9 + 7;  


int sumOfDigits(int number) {
    int sum = 0;

    // Ensure the number is positive for calculation
    number = abs(number);

    while (number > 0) {
        sum += number % 10; // Add the last digit
        number /= 10;       // Remove the last digit
    }

    return sum;
}

int c2(int number) {
    int s = 0;

    // Ensure the number is positive for calculation
    number = abs(number);

    while (number > 0) {
        if(number % 10 == 2) s++ ; // Add the last digit
        number /= 10;       // Remove the last digit
    }

    return s;
} 

int c3(int number) {
    int s = 0;

    // Ensure the number is positive for calculation
    number = abs(number);

    while (number > 0) {
        if(number % 10 == 3) s++ ; // Add the last digit
        number /= 10;       // Remove the last digit
    }

    return s;
}

int32_t main() {   
    int t  ; 
    cin >> t ; 
    while(t--) {    
        string st  ; 
        cin >> st ;   
        int n = stoll(st) ; 
        int s = sumOfDigits(n) ;   
        int k = s ; 
        bool ya = false ; 
        if(s%9 == 0) ya = true ; 
        else { 
            int tw = c2(n) ; 
            int th = c3(n) ;  
            int mth = min(10ll ,th + 1);
            int mtw = min(10ll , tw + 1) ; 
          //  cout << (th) << endl ;
            forr(i,0, mth ) { 
                forr(j,0, mtw ) { 
                    s= k +  j*2 + i*6 ;  
                  //  cout << s << endl ; 
                    if(s%9 == 0){ 
                        ya = true ; 
                        break ; 
                    } 
                  // if(ya) cout << "YES" << endl ;
                  // else cout << "NO" << endl ;
                }
            }  
        } 

                   if(ya) cout << "YES" << endl ;
                   else cout << "NO" << endl ;
            
        

         
         

    }
}