ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063C - Remove Exactly Two
Language: c++17 

Solution 1 (runtime: 265 ms):
#include<iostream>
#include<cstdio>
#include<set>
#include<vector>
#include<algorithm>
using namespace std;
const int mod=998244353,N=200005;
vector<int>G[N];
int du[N],n;
signed main(){
	int i,T,x,y;
	scanf("%d",&T);du[0]=-1;
	while(T--){
		scanf("%d",&n);
		for(i=1;i<=n;i++)du[i]=0,G[i].clear();
		for(i=1;i<n;i++){
			scanf("%d%d",&x,&y);
			du[x]++;du[y]++;
			G[x].push_back(y),G[y].push_back(x);
		}
		int ct=0,mx=0;
		for(i=1;i<=n;i++){
			if(mx==du[i])ct++;
			else if(mx<du[i])mx=du[i],ct=1;
		}
		if(ct>=3){
			printf("%d\n",2*mx-1);
		}
		else if(ct==2){
			int p=0,q=0;
			for(i=1;i<=n;i++){
				if(du[i]==mx){
					if(!p)p=i;
					else q=i;
				}
			}
			int flg=0;
			for(int u:G[p]){
				if(u==q)flg=1;
			}
			printf("%d\n",2*mx-1-flg);
		}
		else{
			int it;
			for(i=1;i<=n;i++){
				if(mx==du[i]){it=i;break;}
			}
			for(int u:G[it])du[u]--;
			int rs=0;
			for(i=1;i<=n;i++){
				if(i==it)continue;
				rs=max(rs,du[i]);
			}
			printf("%d\n",1+mx-1+rs-1);
		}
	}
}

Solution 2 (runtime: 140 ms):
#include<bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define in_ freopen("input.txt", "r", stdin);
#define all(a) a.begin(), a.end()
#define cout2(a) for(int i = 0; i < a.size(); ++ i) cout << a[i] << " "; cout << "\n";
#define cout1(a, s, e) for(int i = s; i < e; ++ i) cout << a[i] << " "; cout << "\n";
#define debug1(x) cout << x << "!!!\n";
#define debug2(x) cout << x << "###\n";

typedef long long ll;
const int N = 200005;
typedef pair<int,int> PII;
 
#define x1 first
#define y1 second

void deal() {
	
	int n;
	cin >> n;
	
	vector<int> deg(n), a;
	vector<PII> e(n);
	
	for(int i = 0; i < n - 1; ++ i) {
		int u, v;
		cin >> u >> v;
		
		u --, v --;
	    deg[u] ++, deg[v] ++;
	    
	    e.push_back({u, v});
	}
	
	int ans = 0;
//	for(auto it : e) {
//		ans = max(ans, it.x1 + it.y1 - 2);
//	}
//	
	int vmax = *max_element(deg.begin(), deg.end());
	
	for(int i = 0; i < n; ++ i) if(deg[i] == vmax) a.push_back(i);
	
	if(a.size() >= 3) {
		cout << 2 * vmax - 1 << "\n";
		return;
	}
	 
	for(int j = 0; j < a.size(); ++j)  {
	    vmax = a[j];
	    
		vector<int> ok(n);
		ok[vmax] = 1;
		
		for(auto it : e) {
			if(it.x1 == vmax) ok[it.y1] = 1;
			if(it.y1 == vmax) ok[it.x1] = 1;
		}
		
		for(int i = 0; i < n; ++ i) {
			if(i == vmax) continue;
			if(ok[i]) ans = max(ans, deg[vmax] + deg[i] - 2);
			else ans = max(ans, deg[vmax] + deg[i] - 1);
		}
    } 

    cout << ans << "\n";
   	
} 

int main() {
	
	#ifndef ONLINE_JUDGE
	in_;
//	freopen("out.txt", "w", stdout); 
	#endif
	
	IOS;
	
	int t;
	cin >> t;
	while(t--)
	 deal();

	return 0;
}  

/*
       /\_/\
      (= ._.)
       />  \>  !!!!!!     
       author :: fly
	    
*/
Problem: 2060D - Subtract Min Sort
Language: c++17 

Solution 1 (runtime: 359 ms):
#include<bits/stdc++.h>
using namespace std;

using ll = long long;

int main(){
    ll t;
    cin >> t;

    while(t--){
        ll n;
        cin >> n;

        vector<ll> a(n);
        for(ll i=0; i<n; i++) cin >> a[i];

        if(n==2){
            if(a[0] <= a[1]){
                cout << "YES" << endl;
            }
            else cout << "NO" << endl;
            continue;
        }

        ll l = 0;
        while(l<n-1){
            while(l<n-1 && min(a[l], a[l+1]) == 0) l++;
            if(l>=n-1) break;
            ll mini = min(a[l], a[l+1]);
            a[l] -= mini, a[l+1] -= mini;
            l++;
        }

        bool possible = true;
        for(ll i=0; i<n; i++){
            if(a[i]!=0){
                if(i!=n-1){
                    possible = false;
                    break;
                }
            }
        }

        if(possible) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

Solution 2 (runtime: 108 ms):
#include<bits/stdc++.h>
using namespace std;
#define ll long long
signed solve()
{
	ll n;
	cin>>n;
	vector<ll> arr(n);
	for(int i=0;i<n;i++) cin>>arr[i];
	if(is_sorted(arr.begin(),arr.end()))
	{
		cout<<"YES"<<endl;
		return 0;
	}
	else
	{
		bool flag=true;
		for(int i=0;i<n-1;i++)
		{
			if(arr[i]>arr[i+1])
            {
                flag=false; 
                break;
            }
            else if(arr[i]<arr[i+1])
            {
                arr[i+1]-=arr[i];
                arr[i]=0;
            }
            else
            {
                arr[i]=0;
                arr[i+1]=0;
            }
		}
        // for(int i=0;i<n;i++) cout<<arr[i]<<" ";
        // cout<<"\n";
		if(flag)
        {
            if(is_sorted(arr.begin(),arr.end()))
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
        }
		else cout<<"NO"<<endl;
	}
    return 0;
}
signed main()
{
    int t;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>t;
    //t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: c++17 

Solution 1 (runtime: 171 ms):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
	int n;
	cin>>n;
	map<int,int>a;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	bool f=1;
	for(int i=2;i<=n;i++){
		if(a[i]>=a[i-1]){
			a[i]-=a[i-1];
			a[i-1]=0;
		}
		else {
			if(a[i-2]==0){
				f=0;
				break;
			}
			a[i-1]-=a[i-2];
			a[i-2]=0;
			i--;
		}
	}
	if(f){
		cout<<"YES\n";
	}
	else cout<<"NO\n";

}
int main(){ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	int _;
	cin>>_;
	while(_--){
		solve();
	}
	return 0;
} 

Solution 2 (runtime: 93 ms):
#include <bits/stdc++.h>
using namespace std;
#define int long long


signed main() {
    ios::sync_with_stdio(false); cin.tie(0);

   int tt; cin >> tt;
   while(tt--){
       int n; cin >> n;
       vector<int> a (n);
       for(int i = 0; i < n; i++) cin >> a[i];
       for(int i = 1; i < n; i++){
           int mn = min(a[i] , a[i - 1]);
           a[i] -= mn;
           a[i - 1] -= mn;
       }
       
       if(is_sorted(a.begin() , a.end())) cout << "YES\n";
       else cout << "NO\n";
   }

    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: c++17 

Solution 1 (runtime: 92 ms):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;



void solve() {

    int n;

    cin >> n;

    vector<int> a(n);

    

    for (int i = 0; i < n; ++i) {

        cin >> a[i];

    }

    

    for (int i = 0; i < n - 1; ++i) {

        int s = min(a[i], a[i + 1]);

        a[i] -= s;

        a[i + 1] -= s;

    }

    

    for (int i = 1; i < n; ++i) {

        if (a[i] < a[i - 1]) {

            cout << "NO\n";

            return;

        }

    }

    

    cout << "YES\n";

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    

    int T;

    cin >> T;

    while (T--) {

        solve();

    }

    

    return 0;

}



Solution 2 (runtime: 343 ms):
#include<bits/stdc++.h>

using namespace std;

#define yes cout<<"YES"<<endl;

#define no cout<<"NO"<<endl;

#define ll long long

int main()

{

int t;cin>>t;

while(t--)

{

ll n; cin>>n;

ll a[n],c=1;

for(ll i=0; i<n; i++) cin>>a[i];

for(ll i=0; i<n-1; i++){

ll x=min(a[i],a[i+1]);

a[i]-=x; a[i+1]-=x;

}for(ll i=0; i<n-1; i++){

if(a[i]>a[i+1]){c=0; break;}

}if(c)yes else no

}

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

Solution 1 (runtime: 61 ms):
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ld long double
#define all(x) x.begin(), x.end()
#define endl '\n'
#define T  ll t ; cin >> t; while(t--)
int main() {
    fast
    T{
        string s;
        cin>>s;
        int sum=0,c2=0,c3=0;
        for(int i=0;i<s.size();i++){
            sum+=(s[i]-'0');
            if(s[i]=='2'){
                c2++;
            }else if(s[i]=='3'){
                c3++;
            }
        }
        while(sum%9&&(c3||c2)){
            if(c2&&!c3){
                sum+=2;
                c2--;
            }else if(!c2&&c3){
                sum+=6;
                c3--;
            }else{
                if((sum+2)%9==0){
                    sum+=2;
                }else if((sum+4)%9==0&&c2>=2){
                    sum+=4;
                }else{
                    sum+=6;
                    c3--;
                }
            }

        }
        if(sum%9){
            cout<<"NO\n";
        }else{
            cout<<"YES\n";
        }
    }



}



Solution 2 (runtime: 77 ms):
#include <bits/stdc++.h>

using namespace std;



void sol() {

    string sttt;

    cin >> sttt;

    vector<int> s;

    for (char c : sttt) {

        s.push_back(c - '0');

    }



    int sm = accumulate(s.begin(), s.end(), 0);

    int twos = count(s.begin(), s.end(), 2);

    int threes = count(s.begin(), s.end(), 3);



    for (int i = 0; i <= min(10, twos); i++) {

        for (int j = 0; j <= min(10, threes); j++) {

            if ((sm + i * 2 + j * 6) % 9 == 0) {

                cout << "YES" << endl;

                return;

            }

        }

    }

    cout << "NO" << endl;

}



int main() {

    ios::sync_with_stdio(0);

    cin.tie(0);

    int t;

    cin >> t;

    while (t--) {

        sol();

    }

    return 0;

}
Problem: 2061D - Kevin and Numbers
Language: c++17 

Solution 1 (runtime: 359 ms):
#include <bits/stdc++.h>
 
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ln '\n'
#define sep ' '
#define ve vector

using namespace std;
 
using pii = pair<int, int>;
using ll  = long long;
using ull = unsigned ll;

int n, m;
multiset<int> A, B;

bool f(int x)
{
  if (A.find(x) != A.end())
  {
    A.erase(A.find(x));
    return 1;
  }
  if (x == 0) return false;
  return f(x / 2) && f((x + 1) / 2);
}

void solve()
{
  A.clear(); B.clear();
  cin >> n >> m;
  for (int i = 0; i < n; ++i) { int x; cin >> x; A.insert(x); }
  for (int i = 0; i < m; ++i) { int x; cin >> x; B.insert(x); }
  for (auto x : B) 
  {
    bool ret = f(x);
    if (!ret)
    {
      cout << "No\n";
      return;
    }
  }
  if (A.empty()) cout << "Yes\n";
  else cout << "No\n";
}

int main()
{
  fastio;
  int t = 1; 
  cin >> t;
  while (t--)
  {
    solve();
  }
  return 0;
}


Solution 2 (runtime: 390 ms):
#include <iostream>

#include <bits/stdc++.h>

using namespace std;

#define int long long

const int mod = 1e9 + 7;

#define mp make_pair

int isqrt(int x)

{

    int val = sqrtl(x) + 5;

    while (val * val > x)

        val--;

    return val;

}

int powm(int x, int n)

{

    int res = 1;

    x %= mod;

    while (n > 0)

    {

        if (n % 2)

            res = (res * x) % mod;

        x = (x * x) % mod;

        n /= 2;

    }

    return res;

}

void solve()

{

    int n, m;

    cin >> n >> m;

    multiset<int> a;

    vector<int> b(m);

    for (int i = 0; i < n; i++)

    {

        int x;

        cin >> x;

        a.insert(x);

    }

    for (int i = 0; i < m; i++)

    {

        cin >> b[i];

    }

    for (int i = 0; i < m; i++)

    {

        auto it = a.find(b[i]);

        if (it != a.end())

        {

            a.erase(it);

            continue;

        }

        int u = (b[i] + 1) / 2;

        int v = b[i] / 2;

        if (u == 0 || v == 0)

        {

            cout << "No\n";

            return;

        }

        priority_queue<int> pq;

        pq.push(u);

        pq.push(v);

        int cnt = n - m;

        while (!pq.empty() && cnt)

        {

            int top = pq.top();

            pq.pop();

            auto it = a.find(top);

            if (it != a.end())

            {

                a.erase(it);

            }

            else

            {

                if (top <= 1)

                {

                    cout << "No\n";

                    return;

                }

                int subu = (top + 1) / 2;

                int subv = top / 2;

                pq.push((top + 1) / 2);

                pq.push(top / 2);

                cnt--;

            }

        }

    }

    if (a.size() >= 1)

    {

        cout << "No\n";

    }

    else

    {

        cout << "Yes\n";

    }

}

signed main()

{

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    cout.tie(nullptr);

    int t;

    cin >> t;

    while (t--)

    {

        solve();

    }



    return 0;

}
Problem: 2057C - Trip to the Olympiad
Language: c++17 

Solution 1 (runtime: 93 ms):
#include <iostream>

int t, l, r;
int main()
{
    for (std::cin >> t; t--;)
    {
        std::cin >> l >> r;
        int k = std::__lg(l ^ r);
        // std::cout << k << ' ';
        int sb = ((1 << k) | l & (-1u << k));
        // std::cout << (1 << k) << ' ' << (-1u << k) << ' ' << (l & (-1u << k)) << ' ' << ((1 << k) | l & (-1u << k)) << ' ';
        std::cout << sb << ' ' << sb - 1 << ' ' << (sb + 1 <= r ? sb + 1 : sb - 2) << '\n';
    }
}

Solution 2 (runtime: 93 ms):
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

void getbits(ll x, vector<int>& bits){

    if(x==0){
        bits.push_back(0);
        return;
    }
    while(x > 0){
        bits.push_back(x % 2);
        x >>= 1; 
    }
    reverse(begin(bits), end(bits)); 
    return;
}

void solve(){
    ll l, r;
    cin >> l >> r;

    vector<int> rbits, lbits;

    getbits(r, rbits);

    // for(auto it : rbits)
    //     cout << it << ' ';

    // cout << endl; 

    int n = size(rbits);

    ll sum1 = 0, sum2 = 0;

    int x = 0, y = 0, z = 0;

    for (int i = 0; i < n; i++){

        if(rbits[i]==0) continue;

        sum2 = sum1 + (1 << (n - i - 1)); 

        if(sum2 > l and sum2 <= r){
            x = sum2;
            y = sum2 - 1;
            
            if(y == l){
                z = l + 2; 
            }
            else{
                z = l; 
            }
            break; 
        }

        sum1 += (1 << (n - i - 1)); 
    }

    cout << x << ' ' << y << ' ' << z << endl;
    int ans = (x xor y) + (y xor z) + (x xor z);

    // int a = 8, b = 1, c = 7;

    // int res = (a xor b) + (b xor c) + (a xor c);

    // if(res==ans){
    //     cout << "true";
    // }

    // cout << '\t' << ans << endl;
    return;
}
int main(){
    int t; cin>>t;
    while(t--){
        solve();
    }
}
Problem: 2062C - Cirno and Operations
Language: c++17 

Solution 1 (runtime: 46 ms):
#include<bits/stdc++.h>
#define int long long 
using namespace std;

int T,n;

signed main(){
	ios::sync_with_stdio(0),cin.tie(0);
	cin>>T;
	auto solve = [&](){
	    cin>>n;
		vector<int> a(n+100);
		vector<int> b(n+100);
		int sum=0,len=n;
		for(int i=1;i<=n;++i) cin>>a[i],sum+=a[i];
		if(n==1) cout<<sum<<'\n';
		else{
		    for(int i=1;i<=n-1;++i){
				sum=max(sum,abs(a[1]-a[len]));
				len--;
				for(int j=1;j<=len;++j) b[j]=a[j+1]-a[j];
				for(int j=1;j<=len;++j) a[j]=b[j];
			}
			cout<<sum<<'\n';
		}
	};
	while(T--) solve();
	return 0;
}

Solution 2 (runtime: 62 ms):
#include<bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        vector<long long int>vec(n);

        long long sum = 0;
        for(auto &it : vec)
        {
            cin >> it;
            sum += it;
        }

        while(n > 1)
        {
            long long temp = 0;
            for(int i = 0; i < n-1; i++)
            {
                temp += vec[i+1] - vec[i];
                vec[i] = vec[i+1] - vec[i];
            }
            sum = max(sum, abs(temp));
            n--;


        }
        cout << sum << endl;
    }


}
Problem: 2061D - Kevin and Numbers
Language: c++17 

Solution 1 (runtime: 452 ms):
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll T;
    cin >> T;
    while(T--) {
        ll n, m;
        cin >> n >> m;
        multiset<ll, greater<ll>> a, b;
        for(ll i = 0; i < n; i++) {
            ll x;
            cin >> x;
            a.insert(x);
        }
        for(ll i = 0; i < m; i++) {
            ll x;
            cin >> x;
            b.insert(x);
        }
        ll ans = 1;
        while(*a.begin() <= *b.begin()) {
            if(*a.begin() == *b.begin()) {
                a.erase(a.begin());
                b.erase(b.begin());
            } else {
                ll x = *b.begin();
                b.erase(b.begin());
                b.insert(x / 2);
                b.insert((x + 1) / 2);
            }
            if(!a.size() or !b.size() or a.size() <= b.size()) {
                break;
            }
        }
        if(a == b){
            cout << "YES\n";
        } else {
            cout << "NO\n";
        }
    }
    return 0;
}

Solution 2 (runtime: 906 ms):
#include<bits/stdc++.h>
using namespace std;
multiset<int> a,b;
vector<int> a1,b1;
multiset<int> tmp;
void f() {
    int n,m;
    cin >> n >> m;
    a1.clear();
    b1.clear();
    a.clear();
    b.clear();
    for(int i = 1;i<=n;i++) {
        int tmp ;
        cin >> tmp;
        a.insert(tmp);
        a1.push_back(tmp);
    }
    for(int i = 1;i<=m;i++) {
        int tmp ;
        cin >> tmp;
        b.insert(tmp);
        b1.push_back(tmp);
    }
    tmp = a;
    int k = 0;
    for(int i = 0;i<b1.size();i++) {
        if(b1.size() - k>n) {
            break;
        }
        if(tmp.find(b1[i])!=tmp.end()) {
            tmp.extract(b1[i]);
        } else {
            if(b1[i] == 1) {
                cout << "No" << endl;
                return;
            }
            b1.push_back(b1[i]/2);
            if(b1[i] % 2 ==0) {
                b1.push_back(b1[i]/2);
            } else b1.push_back(b1[i]/2+1);
            k++;
        }
    }
    if(!tmp.empty()) {
        cout << "No" << endl;
    } else
    cout << "Yes" << endl;
}

int main() {
    int k;
    cin >> k;
    while(k--) f();

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

Solution 1 (runtime: 77 ms):
#include <iostream>
#include <vector>
#include <string>
using namespace std;

void solve() {
    string input;
    cin >> input;

    vector<int> s;
    for (char c : input) {
        s.push_back(c - '0');
    }

    int sm = 0;
    int twos = 0;
    int threes = 0;

    for (int num : s) {
        sm += num;
        if (num == 2) twos++;
        if (num == 3) threes++;
    }

    for (int i = 0; i <= min(10, twos); ++i) {
        for (int j = 0; j <= min(10, threes); ++j) {
            if ((sm + i * 2 + j * 6) % 9 == 0) {
                cout << "YES" << endl;
                return;
            }
        }
    }
    cout << "NO" << endl;
}

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


Solution 2 (runtime: 62 ms):
//            ###   Lekin Raat ke Baad Hi To SAVERA Hota Hai   ### 
 


#include <iostream>
#define ll long long    
#include <algorithm>
#include<bits/stdc++.h>
#include <cstdint>  // For uint64_t
using namespace std;
ll M=1e9+7;
 

int main() {
    ll t;
    cin>>t;
    
    
    
    while(t--){
        ll n,m,h;
        // cin>>n>>m>>h;   
        string s;
        cin>>s;
        
        ll sum=0, cnt2=0, cnt3=0;
        for(int i=0; i<s.size(); i++){
            sum+=(s[i]-'0');
            if(s[i]=='2') cnt2++;
            if(s[i]=='3') cnt3++;
        }
        
        // cout<<sum<<" ";
        ll fg=0;
        for(int i=0; i<=min(cnt2, 9LL); i++){
            for(int j=0; j<=min(cnt3, 3LL); j++){
                if((sum+(2*i)+(6*j))%9==0){
                    fg=1;
                    break;
                }
            }
        }
        if(fg||sum%9==0) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
        
        
   
    }
}
Problem: 2050C - Uninteresting Number
Language: c++17 

Solution 1 (runtime: 62 ms):
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+5;
int a[N];
void solve()
{
	string s;cin>>s;
	int cnt2=0,cnt3=0;
	int sum=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='2') cnt2++;
		else if(s[i]=='3') cnt3++;
		sum+=(s[i]-'0');
	}
	if(sum%9==0)
	{
		cout<<"Yes"<<endl;
		return ;
	}
	int r=9-(sum%9);
	if(r&1) r+=9;
	r-=min(cnt3,(r/6))*6;
	if(r/2<=cnt2) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return ;
}
signed main()
{
	int t;
	cin>>t;
	while(t--) solve();
}


Solution 2 (runtime: 62 ms):
#include <iostream>
#include <cstring>
#include <cmath>

using namespace std;

const int N = 1e5 + 10;
char a[N];

int main()
{
    int n;
    cin >> n;
    while (n --)
    {
        int tows = 0, threes = 0;
        scanf("%s",a);
        int len = strlen(a);
        long long sum = 0;
        for (int i = 0; i < len; i ++)
        {
            if (a[i] == '2') tows ++;
            else if (a[i] == '3') threes ++;
            sum = sum + a[i] - '0';
        }
        
        bool flag = false;
        for (int i = 0; i < min(tows + 1, 9); i ++)
        {
            for (int j = 0; j < min(threes + 1, 9); j ++)
            {
                if ((long long)(sum + i * 2 + j * 6) % 9 == 0)
                {
                    puts("yes");
                    flag = true;
                    break;
                }
            }
            if (flag) break;
        }
        if (!flag) puts("no");

    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: c++17 

Solution 1 (runtime: 108 ms):
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define fast                          \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL)
#define fr(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define vi vector<int>
typedef pair<int, int> pi;


signed main(){
    int t;
    cin>>t;
    while(t--){
        int l,r;
        cin>>l>>r;
        int sigma=l;
        int boy=r;
        int count=log2(max(l,r))+1;
        int c=0;
        vi a(count),b(count);
        fr(i,0,count){
            a[i]=l%2;
            b[i]=r%2;
            l=l/2;
            r=r/2;
        }
        fr(i,0,count){
            c+=(a[count-1-i]|b[count-1-i])*pow(2,count-1-i);
            if(a[count-1-i]!=b[count-1-i]) break;
        }
        int d;
        fr(i,sigma,boy+1){
            if(i!=c&&i!=c-1){
                d=i;
                break;
            }
        }
        cout<<c<<" "<<c-1<<" "<<d<<endl;
    }   
}

Solution 2 (runtime: 93 ms):
#include <bits/stdc++.h>
using namespace std;

int main(void) {
    int t;
    cin >> t;
    while (t--) {
        int l, r;
        cin >> l >> r;
        if (r - l == 2) {
            cout << r << " " << r - 1 << " " << r - 2 << endl;
            continue;
        }
        bitset<32> a = bitset<32>(l);
        bitset<32> b = bitset<32>(r);
        int num1 = 0, num2 = 0, num3 = 0;
        for (int i = 31; i >= 0; i--) {
            if (a[i] != b[i]) {
                num1 += (1 << i);
                break;
            } else if (b[i] == 1) {
                num1 += (1 << i);
            }
        }

        num2 = num1 - 1;
        num3 = num2 - 1;
        if (num3 < l) {
            num3 = num1 + 1;
        }
        cout << num1 << " " << num2 << " " << num3 << endl;
    }
}