ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2049C - MEX Cycle
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 1):
for _ in range(int(input())):

    n,x,y=map(int,input().split())

    x-=1;y-=1

    #############################################################################

    if x == y+1 or x == y-1 or (x==0 and y==n-1) or (y==0 and x==n-1):

        if n%2==0:

            ans = [0]*n

            for i in range(n):

                if i%2: ans[i] = 1

        else:

            ans = [1]*n

            for i in range(n):

                if i%2: ans[i] = 0

                ans[n-1] = 2

        print(*ans)

    #############################################################################

    else:

        ans = [-1]*n

        switch = 0 ; friends = {}

        if x == 0:

            for i in range(x+1, n): 

                if switch == 0: ans[i] = 0 ; switch = 1

                else: ans[i] = 1 ; switch = 0

        else:

            for i in range(x+1, x+1 + (n - x+1) + x-1+1): 

                if switch == 0: ans[i%n] = 0 ; switch = 1

                else: ans[(i%n)] = 1 ; switch = 0

        

        if x == 0: friends = {ans[1],ans[y],ans[n-1]}

        elif x == n-1: friends = {ans[n-2],ans[y],ans[0]}

        else: friends = {ans[x+1],ans[y],ans[x-1]}



        if 0 in friends and 1 in friends: ans[x] = 2

        if 0 in friends and 1 not in friends: ans[x] = 1

        if 0 not in friends and 1 in friends: ans[x] = 0



        print(*ans)

Submission (verdict: Accepted):
for _ in range(int(input())):

    n,x,y=map(int,input().split())

    x-=1;y-=1

    #############################################################################

    if x == y+1 or x == y-1 or (x==0 and y==n-1) or (y==0 and x==n-1):

        if n%2==0:

            ans = [0]*n

            for i in range(n):

                if i%2: ans[i] = 1

        else:

            ans = [1]*n

            for i in range(n):

                if i%2: ans[i] = 0

                ans[n-1] = 2

        print(*ans)

    #############################################################################

    else:

        ans = [-1]*n

        switch = 0 ; friends = {}

        if x == 0:

            for i in range(x+1, n): 

                if switch == 0: ans[i] = 0 ; switch = 1

                else: ans[i] = 1 ; switch = 0

        else:

            for i in range(x+1, x+1 + (n - x+1) + x-1): 

                if switch == 0: ans[i%n] = 0 ; switch = 1

                else: ans[(i%n)] = 1 ; switch = 0



        

        if x == 0: friends = {ans[1],ans[y],ans[n-1]}

        elif x == n-1: friends = {ans[n-2],ans[y],ans[0]}

        else: friends = {ans[x+1],ans[y],ans[x-1]}



        if 0 in friends and 1 in friends: ans[x] = 2

        if 0 in friends and 1 not in friends: ans[x] = 1

        if 0 not in friends and 1 in friends: ans[x] = 0



        print(*ans)
Problem: 2049C - MEX Cycle
Language: PyPy 3-64


Submission (verdict: Wrong answer on test 1):
for _ in range(int(input())):

    n,x,y=map(int,input().split())

    x-=1;y-=1

    #############################################################################

    if x == y+1 or x == y-1 or (x==0 and y==n-1) or (y==0 and x==n-1):

        if n%2==0:

            ans = [0]*n

            for i in range(n):

                if i%2: ans[i] = 1

        else:

            ans = [1]*n

            for i in range(n):

                if i%2: ans[i] = 0

                ans[n-1] = 2

        print(*[ans])

    #############################################################################

    else:

        ans = [-1]*n

        switch = 0 ; friends = {}

        if x == 0:

            for i in range(x+1, n): 

                if switch == 0: ans[i] = 0 ; switch = 1

                else: ans[i] = 1 ; switch = 0

        else:

            for i in range(x+1, x+1 + (n - x+1) + x-1+1): 

                if switch == 0: ans[i%n] = 0 ; switch = 1

                else: ans[(i%n)] = 1 ; switch = 0

        

        if x == 0: friends = {ans[1],ans[y],ans[n-1]}

        elif x == n-1: friends = {ans[n-2],ans[y],ans[0]}

        else: friends = {ans[x+1],ans[y],ans[x-1]}



        if 0 in friends and 1 in friends: ans[x] = 2

        if 0 in friends and 1 not in friends: ans[x] = 1

        if 0 not in friends and 1 in friends: ans[x] = 0



        print(*ans)
Problem: 2049C - MEX Cycle
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 1):
for _ in range(int(input())):

    n,x,y=map(int,input().split())

    x-=1;y-=1

    #############################################################################

    if x == y+1 or x == y-1 or (x==0 and y==n-1) or (y==0 and x==n-1):

        if n%2==0:

            ans = [0]*n

            for i in range(n):

                if i%2: ans[i] = 1

        else:

            ans = [1]*n

            for i in range(n):

                if i%2: ans[i] = 0

                ans[n-1] = 2

        print(*[ans])

    #############################################################################

    else:

        ans = [-1]*n

        switch = 0 ; friends = {}

        if x == 0:

            for i in range(x+1, n): 

                if switch == 0: ans[i] = 0 ; switch = 1

                else: ans[i] = 1 ; switch = 0

        else:

            for i in range(x+1, x+1 + (n - x+1) + x-1+1): 

                if switch == 0: ans[i%n] = 0 ; switch = 1

                else: ans[(i%n)] = 1 ; switch = 0

        

        if x == 0: friends = {ans[1],ans[y],ans[n-1]}

        elif x == n-1: friends = {ans[n-2],ans[y],ans[0]}

        else: friends = {ans[x+1],ans[y],ans[x-1]}



        if 0 in friends and 1 in friends: ans[x] = 2

        if 0 in friends and 1 not in friends: ans[x] = 1

        if 0 not in friends and 1 in friends: ans[x] = 0



        print(*ans)

Submission (verdict: Wrong answer on test 1):
for _ in range(int(input())):

    n,x,y=map(int,input().split())

    x-=1;y-=1

    #############################################################################

    if x == y+1 or x == y-1 or (x==0 and y==n-1) or (y==0 and x==n-1):

        if n%2==0:

            ans = [0]*n

            for i in range(n):

                if i%2: ans[i] = 1

        else:

            ans = [1]*n

            for i in range(n):

                if i%2: ans[i] = 0

                ans[n-1] = 2

        print(*ans)

    #############################################################################

    else:

        ans = [-1]*n

        switch = 0 ; friends = {}

        if x == 0:

            for i in range(x+1, n): 

                if switch == 0: ans[i] = 0 ; switch = 1

                else: ans[i] = 1 ; switch = 0

        else:

            for i in range(x+1, x+1 + (n - x+1) + x-1+1): 

                if switch == 0: ans[i%n] = 0 ; switch = 1

                else: ans[(i%n)] = 1 ; switch = 0

        

        if x == 0: friends = {ans[1],ans[y],ans[n-1]}

        elif x == n-1: friends = {ans[n-2],ans[y],ans[0]}

        else: friends = {ans[x+1],ans[y],ans[x-1]}



        if 0 in friends and 1 in friends: ans[x] = 2

        if 0 in friends and 1 not in friends: ans[x] = 1

        if 0 not in friends and 1 in friends: ans[x] = 0



        print(*ans)
Problem: 2050C - Uninteresting Number
Language: C# 10


Submission (verdict: Wrong answer on test 1):
using System;
using System.Runtime.InteropServices;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        #nullable disable
        int t = int.Parse(Console.ReadLine());
        for(int i = 0; i < t; i++) {
            string s = Console.ReadLine();
            StringBuilder sb = new StringBuilder(s);
            int len = s.Length;
            int sum = 0 ;
            int cnt2 = 0 , cnt3 = 0 ;
            for(int j = 0 ; j<len ; j++)    {
                sum += (sb[j] - '0') ;
                if(sb[j] == '2') cnt2++ ; 
                if(sb[j] == '3') cnt3++ ;
            }

            bool f = false ;
            if(sum % 9 == 0){
                Console.WriteLine("YES") ;
            }else {
                int st = sum / 9 * 9 ; 
                while(st <= sum + 2 * cnt2 + 4 * cnt3) {
                    if(st < sum) {
                        st += 9 ;
                        continue ;
                    }
                    int diff = st - sum ; 
                    if(diff % 2 != 0) {
                        st += 9 ;
                        continue ;
                    }else{
                        if((diff % 4 != 0 && cnt2 > 0) || diff % 4 == 0) {
                            f = true ; 
                            break ;
                        }
                    }
                }
            }
            if(f == true) Console.WriteLine("YES") ;
            else Console.WriteLine("NO") ;
        }
    }
}
Problem: 2050C - Uninteresting Number
Language: C# 10

Previous submission (verdict: Wrong answer on test 1):
using System;

public class ProblemC
{
    public static void Main(string[] args)
    {
        #nullable disable
        int t = int.Parse(Console.ReadLine());
        for (int i = 0; i < t; i++)
        {
            string n = Console.ReadLine();
            int sum = 0, two = 0, three = 0;
            foreach (var c in n)
            {
                if (c == '2') ++two;
                else if (c == '3') ++three;
                sum += c - '0';
            }

            bool possible = false;
            for (int j = 0; j <= three; j++)
            {
                for (int k = 0; k <= two; k++)
                {
                    if ((sum + j * 2 + k * 6) % 9 == 0)
                    {
                        possible = true;
                        break;
                    }
                }
                if (possible) break; 
            }

            Console.WriteLine(possible ? "YES" : "NO");
        }
    }
}

Submission (verdict: Accepted):
using System;

public class ProblemC
{
    public static void Main(string[] args)
    {
        #nullable disable
        int t = int.Parse(Console.ReadLine());
        for (int i = 0; i < t; i++)
        {
            string n = Console.ReadLine();
            int sum = 0, two = 0, three = 0;
            foreach (var c in n)
            {
                if (c == '2') ++two;
                else if (c == '3') ++three;
                sum += c - '0';
            }

            bool possible = false;
            for (int j = 0; j <= three; j++)
            {
                for (int k = 0; k <= two; k++)
                {
                    if ((sum + j * 6 + k * 2) % 9 == 0)
                    {
                        possible = true;
                        break;
                    }
                }
                if (possible) break; 
            }

            Console.WriteLine(possible ? "YES" : "NO");
        }
    }
}
Problem: 2050C - Uninteresting Number
Language: C# 10

Previous submission (verdict: Wrong answer on test 1):
using System;
using System.Runtime.InteropServices;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        #nullable disable
        int t = int.Parse(Console.ReadLine());
        for(int i = 0; i < t; i++) {
            string s = Console.ReadLine();
            StringBuilder sb = new StringBuilder(s);
            int len = s.Length;
            int sum = 0 ;
            int cnt2 = 0 , cnt3 = 0 ;
            for(int j = 0 ; j<len ; j++)    {
                sum += (sb[j] - '0') ;
                if(sb[j] == '2') cnt2++ ; 
                if(sb[j] == '3') cnt3++ ;
            }

            bool f = false ;
            if(sum % 9 == 0){
                Console.WriteLine("YES") ;
            }else {
                int st = sum / 9 * 9 ; 
                while(st <= sum + 2 * cnt2 + 4 * cnt3) {
                    if(st < sum) {
                        st += 9 ;
                        continue ;
                    }
                    int diff = st - sum ; 
                    if(diff % 2 != 0) {
                        st += 9 ;
                        continue ;
                    }else{
                        if((diff % 4 != 0 && cnt2 > 0) || diff % 4 == 0) {
                            f = true ; 
                            break ;
                        }
                    }
                }
            }
            if(f == true) Console.WriteLine("YES") ;
            else Console.WriteLine("NO") ;
        }
    }
}

Submission (verdict: Wrong answer on test 1):
using System;

public class ProblemC
{
    public static void Main(string[] args)
    {
        #nullable disable
        int t = int.Parse(Console.ReadLine());
        for (int i = 0; i < t; i++)
        {
            string n = Console.ReadLine();
            int sum = 0, two = 0, three = 0;
            foreach (var c in n)
            {
                if (c == '2') ++two;
                else if (c == '3') ++three;
                sum += c - '0';
            }

            bool possible = false;
            for (int j = 0; j <= three; j++)
            {
                for (int k = 0; k <= two; k++)
                {
                    if ((sum + j * 2 + k * 6) % 9 == 0)
                    {
                        possible = true;
                        break;
                    }
                }
                if (possible) break; 
            }

            Console.WriteLine(possible ? "YES" : "NO");
        }
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
// // order_of_key(k): Number of items strictly smaller than k.
// // find_by_order(k): K-th element in a set (counting from zero).

#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

signed main() {
    int test_cases = 1;
    cin >> test_cases;
    while (test_cases--) {
        int l , r ; cin>>l>>r ;
        int x = __lg(r);
        int a = 0 , b = 0 ;
        for(int i = x ; i >= 0 ; i--) {
            if((1LL << i)&l && (1LL << i)&r) {
                a |= (1LL << i) ;
                b |= (1LL << i) ;
                x--;
            }else {
               break;
            }
        }
        a |= ((1LL << x) - 1) ;
        b |= (1LL << x) ;
        cout<<a << ' ' << b << ' ';
        for(int i = l ; i <= r; i++) {
            if(i != a && i != b) {
                cout<<i<<endl;
                break;
            }
        }
    }
    return 0;
}


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
// // order_of_key(k): Number of items strictly smaller than k.
// // find_by_order(k): K-th element in a set (counting from zero).

#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

signed main() {
    int test_cases = 1;
    cin >> test_cases;
    while (test_cases--) {
        int l, r;
        cin >> l >> r;
        int x = __lg(r);
        int a = 0, b = 0;
        for (int i = x; i >= 0; i--) {
            if (((l >> i) & 1) == ((r >> i) & 1)) {
                if ((l >> i) & 1) {
                    a |= (1LL << i);
                    b |= (1LL << i);
                }
            }
            x--;
            if (((l >> i) & 1) != ((r >> i) & 1)) {
                break;
            }
        }
        a |= ((1LL << x) - 1);
        b |= (1LL << x);
        cout << a << ' ' << b << ' ';
        for (int i = l; i <= r; i++) {
            if (i != a && i != b) {
                cout << i << endl;
                break;
            }
        }
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
// // order_of_key(k): Number of items strictly smaller than k.
// // find_by_order(k): K-th element in a set (counting from zero).

#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

signed main() {
    int test_cases = 1;
    cin >> test_cases;
    while (test_cases--) {
        int l, r;
        cin >> l >> r;
        int x = __lg(r);
        int a = 0, b = 0;
        for (int i = x; i >= 0; i--) {
            if (((l >> i) & 1) == ((r >> i) & 1)) {
                if ((l >> i) & 1) {
                    a |= (1LL << i);
                    b |= (1LL << i);
                }
            }
            x--;
            if (((l >> i) & 1) != ((r >> i) & 1)) {
                break;
            }
        }
        a |= ((1LL << x) - 1);
        b |= (1LL << x);
        cout << a << ' ' << b << ' ';
        for (int i = l; i <= r; i++) {
            if (i != a && i != b) {
                cout << i << endl;
                break;
            }
        }
    }
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define int long long
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
// // order_of_key(k): Number of items strictly smaller than k.
// // find_by_order(k): K-th element in a set (counting from zero).

#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

signed main() {
    int test_cases = 1;
    cin >> test_cases;
    while (test_cases--) {
        int l, r;
        cin >> l >> r;
        int x = __lg(r) ;
        int a = 0, b = 0;
        for (int i = x; i >= 0; i--) {
            if (((l >> i) & 1) == ((r >> i) & 1)) {
                if ((l >> i) & 1) {
                    a |= (1LL << i);
                    b |= (1LL << i);
                }
                x--;
            }
            if (((l >> i) & 1) != ((r >> i) & 1)) {
                break;
            }
        }
        a |= ((1LL << x) - 1);
        b |= (1LL << x);
        cout << a << ' ' << b << ' ';
        for (int i = l; i <= r; i++) {
            if (i != a && i != b) {
                cout << i << endl;
                break;
            }
        }
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
// // order_of_key(k): Number of items strictly smaller than k.
// // find_by_order(k): K-th element in a set (counting from zero).

#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

signed main() {
    int test_cases = 1;
    cin >> test_cases;
    while (test_cases--) {
        int l , r ; cin>>l>>r ;
        int x = __lg(r);
        int a = 0 , b = 0 ;
        for(int i = x ; i >= 0 ; i--) {
            if((1LL << i)&l && (1LL << i)&r) {
                a |= (1LL << i) ;
                b |= (1LL << i) ;
                x--;
            }else {
               break;
            }
        }
        a |= ((1LL << x) - 1) ;
        b |= (1LL << x) ;
        cout<<a << ' ' << b << ' ';
        for(int i = l ; i <= r; i++) {
            if(i != a && i != b) {
                cout<<i<<endl;
                break;
            }
        }
    }
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
#define int long long
using namespace std;
int c[1003];
int a[1003];
map <pair<int,int>, bool> pos;
vector <pair<int,int> > res;
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i=1 ; i<=n ; i++)
        cin >> c[i];
    for (int i=1 ; i<=n ; i++)
        a[i]=i;
    int assist;
    for (int i=1 ; i<=n ; i++)
    {
        if (c[i]<=i)
            continue;
        for (int j=1 ; j<=n ; j++)
            if (a[j]==c[i])
                assist=j;
        while (a[i]!=c[i])
        {
            pos[ {a[assist],a[assist-1]}]=true;
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist],a[assist-1]);
            assist--;
        }
    }
    for (int i=1 ; i<n ; i++)
        if (!pos[ {a[i],a[i+1]}] && !pos[ {a[i+1],a[i]}])
        {
            res.push_back({a[i+1],a[i]});
            res.push_back({a[i],a[i+1]});
        }
    cout << res.size() << "\n";
    for (auto u : res)
        cout << u.first << " " << u.second << "\n";
    return 0;
}


Submission (verdict: Wrong answer on test 5):
#include <bits/stdc++.h>
#define int long long
using namespace std;
int c[1005];
int a[1005];
map <pair<int,int>, bool> pos;
vector <pair<int,int> > res;
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    a[0]=-1;
    a[n+1]=-1;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> c[i];
        pos[ {-1,c[i]}]=true;
        pos[ {c[i],-1}]=true;
    }
    for (int i=1 ; i<=n ; i++)
        a[i]=i;
    int assist;
    for (int i=1 ; i<=n ; i++)
    {
        if (c[i]<=i)
            continue;
        for (int j=1 ; j<=n ; j++)
            if (a[j]==c[i])
                assist=j;
        while (a[i]!=c[i])
        {
            pos[ {a[assist],a[assist-1]}]=true;
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist],a[assist-1]);
            assist--;
        }
    }
    for (int i=1 ; i<=n ; i++)
    {
        assist=i;
        while (!pos[ {a[assist],a[assist-1]}] && !pos[ {a[assist-1],a[assist]}])
        {
            pos[ {a[assist],a[assist-1]}]=true;
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist],a[assist-1]);
            assist--;
        }
        while (assist!=i)
        {
            pos[ {a[assist+1],a[assist]}]=true;
            res.push_back({a[assist+1],a[assist]});
            swap(a[assist+1],a[assist]);
            assist++;
        }
    }
    cout << res.size() << "\n";
    for (auto u : res)
        cout << u.first << " " << u.second << "\n";
    return 0;
}