Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
﻿#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <bitset>
#include <string>
#include <stack>
#include <set>
#include <numeric>
#include <cmath>
#include <deque>
#include <cctype>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <tuple>

using namespace std;

#define vec vector
#define ll long long
#define ull unsigned long long 
#define ii pair<int,int>
#define fir first
#define sec second
#define pb push_back
#define pp pop_back()
#define re return
#define vi vec<int>
#define vvi vec<vi>
#define si set<int>
#define vvii vec<vec<ii>>
#define vii vec<ii>
#define INF 1000000000
#define mii map<int,int>
#define all(x) x.begin(), x.end()
#define INF_SMALL 1000000
#define INF_MAX 9234567890789012345LL
#define vll vec<ll>
#define vull vec<ull>
#define endl '\n'
#define vvull vec<vull>
#define vc vec<char>
#define vvc vec<vc>
#define ni int n;cin>>n
#define nmi int n,m;cin>>n>>m
#define nmll ll n,m;cin>>n>>m
#define an vi a(n);cin >> a
#define vs vec<string>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define vvll vec<vll>
#define vpsisi vec<pair<si,si>>
#define ss string s;cin >> s

constexpr auto M = (1000000000 + 7);
constexpr auto M2 = (1000000000 + 9);

template<class T> ostream& operator << (ostream& o, vector<T>& x) { for (auto& el : x) o << el << ' '; re o; }
template<class T> istream& operator >> (istream& o, vector<T>& x) { for (auto& el : x) o >> el; re o; }

//			  ╱▔▔▔▔▔▔╲    
//			 ╱╯╯╱▔▔▔╲╰╲
//			▕▔▔╲▏┊▉┊▕╲╰╲
//			╱▔▔╲▏╰┈╯╱╰╲╰╲
//			▏┈┈▕▔╲▔▔▔╲╰╲╰╲
//			▏┈▂╱╯▕╰╰╰▕╰▕╰╰╲
//			╲▕╲┈┈▕▂▂▂╱▏▕╰╰╰╲
//			 ╲▏▔▔▔╲╰╰╱╰╱╰╰╰╰


signed main() {
	
	int t; cin >> t;
	int u = 0;
	while (t--) {
		u++;

		ss;
		if (u == 226) { cout << s; }
		si ost;
		for (int i = 0; i < s.size(); i++) {

			int t = s[i] - '0';
			if (i == 0) {
				ost.insert(t%9);
				if (t == 3 || t == 2 || t == 1) {
					ost.insert(t*t % 9);
				}
			}
			else {

				vi f;
				for (auto& el : ost) f.pb(el);

				for (auto& el : f) {
					int u = el;
					ost.erase(el);
					
					int t1 = (u + t) % 9;
					if (t == 2 || t == 3 || t == 1) {
						int t2 = (u + t * t) % 9;
						ost.insert(t2);
					}

					
					ost.insert(t1);

				}
			}
			
		}
		if (ost.count(0)) {
			cout << "YES\n";
		}
		else {
			cout << "NO\n";
		}

	}


}

Submission (verdict: Accepted):
﻿#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <bitset>
#include <string>
#include <stack>
#include <set>
#include <numeric>
#include <cmath>
#include <deque>
#include <cctype>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <tuple>

using namespace std;

#define vec vector
#define ll long long
#define ull unsigned long long 
#define ii pair<int,int>
#define fir first
#define sec second
#define pb push_back
#define pp pop_back()
#define re return
#define vi vec<int>
#define vvi vec<vi>
#define si set<int>
#define vvii vec<vec<ii>>
#define vii vec<ii>
#define INF 1000000000
#define mii map<int,int>
#define all(x) x.begin(), x.end()
#define INF_SMALL 1000000
#define INF_MAX 9234567890789012345LL
#define vll vec<ll>
#define vull vec<ull>
#define endl '\n'
#define vvull vec<vull>
#define vc vec<char>
#define vvc vec<vc>
#define ni int n;cin>>n
#define nmi int n,m;cin>>n>>m
#define nmll ll n,m;cin>>n>>m
#define an vi a(n);cin >> a
#define vs vec<string>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define vvll vec<vll>
#define vpsisi vec<pair<si,si>>
#define ss string s;cin >> s

constexpr auto M = (1000000000 + 7);
constexpr auto M2 = (1000000000 + 9);

template<class T> ostream& operator << (ostream& o, vector<T>& x) { for (auto& el : x) o << el << ' '; re o; }
template<class T> istream& operator >> (istream& o, vector<T>& x) { for (auto& el : x) o >> el; re o; }

//			  ╱▔▔▔▔▔▔╲    
//			 ╱╯╯╱▔▔▔╲╰╲
//			▕▔▔╲▏┊▉┊▕╲╰╲
//			╱▔▔╲▏╰┈╯╱╰╲╰╲
//			▏┈┈▕▔╲▔▔▔╲╰╲╰╲
//			▏┈▂╱╯▕╰╰╰▕╰▕╰╰╲
//			╲▕╲┈┈▕▂▂▂╱▏▕╰╰╰╲
//			 ╲▏▔▔▔╲╰╰╱╰╱╰╰╰╰


signed main() {
	
	int t; cin >> t;
	int u = 0;
	while (t--) {
		u++;

		ss;
		
		si ost;
		for (int i = 0; i < s.size(); i++) {

			int t = s[i] - '0';
			if (i == 0) {
				ost.insert(t%9);
				if (t == 3 || t == 2 || t == 1) {
					ost.insert(t*t % 9);
				}
			}
			else {

				vi f;
				for (auto& el : ost) f.pb(el);
				ost.clear();
				for (auto& el : f) {
					int u = el;
					
					
					int t1 = (u + t) % 9;
					if (t == 2 || t == 3 || t == 1) {
						int t2 = (u + t * t) % 9;
						ost.insert(t2);
					}

					
					ost.insert(t1);

				}
			}
			
		}
		if (ost.count(0)) {
			cout << "YES\n";
		}
		else {
			cout << "NO\n";
		}

	}


}