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

Previous submission (verdict: Wrong answer on test 2):
#include     		<bits/stdc++.h>
	
#define             ll   long long
#define            pll   pair<ll, ll>
#define            pii   pair<int, int>
#define          io(x)   if (fopen(x".inp","r")) {freopen(x".inp","r",stdin),freopen(x".out","w",stdout);}
#define      mem(c, x)   memset(c, x, sizeof(c))
#define         all(c)   c.begin(), c.end()
#define       bit(i,j)   ((i >> j) & 1)
#define             pb   push_back
#define             se   second     
#define             fi   first
#define             el   '\n'
using namespace std;  

template<class T> bool   maximize(T &a, const T &b) { return (a < b ? a = b, 1 : 0); }
template<class T> bool   minimize(T &a, const T &b) { return (a > b ? a = b, 1 : 0); }

int dx[8] = {0, 1, 0,-1, 1, 1,-1,-1};
int dy[8] = {1, 0,-1, 0, 1,-1,-1, 1};
const int  maxn  = 1e5 + 9;
const int  Inf   = 2e9 + 7;
const ll   Infll = 1e18 + 9;
const ll   Mod   = 1e9 + 7;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

void solve() {
	string s; cin >> s;
	vector<int> p;

	for (int j=0; j<=1; j++) {
		for (int k=0; k<=1; k++) {
			int cur1 = s[0]-'0', cur2 = s[1]-'0';
			if (j) cur1 *= cur1;
			if (k) cur2 *= cur2;
			if (cur1 < 10 && cur2 < 10) {
				p.pb((cur1 + cur2) % 9);
			}
		}
	}

	sort(all(p));

	for (int i=2; i<s.size(); i++) {
		vector<int> temp;
		for (int cur1 : p) {
			for (int k=0; k<=1; k++) {
				int cur2 = s[i]-'0';
				if (k) cur2 *= cur2;
				if (cur2 < 10) {
					temp.pb((cur1 + cur2) % 9);
					// cout << cur2 << ' ' << cur1 << el;
				}
			}
		}
		sort(all(temp)); temp.resize(unique(all(temp)) - temp.begin());
		p = temp;
	}

	if (binary_search(all(p), 0)) cout << "YES" << el; else cout << "NO" << el;


}

signed main() {
    
    ios_base::sync_with_stdio(false);  cin.tie(0); cout.tie(0); 
    io("task"); 

    int t; cin >> t;
    while (t--)
    solve();
    
    return (0 ^ 0);
}

Submission (verdict: Wrong answer on test 2):
#include     		<bits/stdc++.h>
	
#define             ll   long long
#define int long long
#define            pll   pair<ll, ll>
#define            pii   pair<int, int>
#define          io(x)   if (fopen(x".inp","r")) {freopen(x".inp","r",stdin),freopen(x".out","w",stdout);}
#define      mem(c, x)   memset(c, x, sizeof(c))
#define         all(c)   c.begin(), c.end()
#define       bit(i,j)   ((i >> j) & 1)
#define             pb   push_back
#define             se   second     
#define             fi   first
#define             el   '\n'
using namespace std;  

template<class T> bool   maximize(T &a, const T &b) { return (a < b ? a = b, 1 : 0); }
template<class T> bool   minimize(T &a, const T &b) { return (a > b ? a = b, 1 : 0); }

int dx[8] = {0, 1, 0,-1, 1, 1,-1,-1};
int dy[8] = {1, 0,-1, 0, 1,-1,-1, 1};
const int  maxn  = 1e5 + 9;
const int  Inf   = 2e9 + 7;
const ll   Infll = 1e18 + 9;
const ll   Mod   = 1e9 + 7;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

void solve() {
	string s; cin >> s;
	vector<int> p;

	for (int j=0; j<=1; j++) {
		for (int k=0; k<=1; k++) {
			int cur1 = s[0]-'0', cur2 = s[1]-'0';
			if (j) cur1 *= cur1;
			if (k) cur2 *= cur2;
			if (cur1 < 10 && cur2 < 10) {
				p.pb((cur1 + cur2) % 9);
			}
		}
	}

	sort(all(p));
	p.resize(unique(all(p)) - p.begin());

	for (int i=2; i<s.size(); i++) {
		vector<int> temp;
		for (int cur1 : p) {
			for (int k=0; k<=1; k++) {
				int cur2 = s[i]-'0';
				if (k) cur2 *= cur2;
				if (cur2 < 10) {
					temp.pb((cur1 + cur2) % 9);
				}
			}
		}
		sort(all(temp)); temp.resize(unique(all(temp)) - temp.begin());
		p = temp;
	}

	if ((int)p.size() && p[0] == 0) cout << "YES" << el; else cout << "NO" << el;


}

signed main() {
    
    ios_base::sync_with_stdio(false);  cin.tie(0); cout.tie(0); 
    io("task"); 

    int t; cin >> t;
    while (t--)
    solve();
    
    return (0 ^ 0);
}