ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063C - Remove Exactly Two
Language: Python 3

Previous submission (verdict: Runtime error on test 2):
def solve():
    n = int(input())
    d = [{'id': _ + 1, 'v': []} for _ in range(n)]
    for i in range(n - 1):
        u, v = map(int, input().split())
        d[u - 1]['v'].append(v)
        d[v - 1]['v'].append(u)
    if n == 2:
        print(0)
    else:
        for i in range(n):
            s = 0
            for j in d[i]['v']:
                s += len(d[j - 1]['v'])
            d[i]['s'] = s
        d.sort(key=lambda x: (-len(x['v']), x['s']))
        cnt = 1
        cnt += len(d[0]['v']) - 1
        for item in d:
            if d[0]['id'] in item['v']:
                item['v'].remove(d[0]['id'])
        d.remove(d[0])
        for i in range(n - 1):
            s = 0
            for j in d[i]['v']:
                s += len(d[j - 1]['v'])
            d[i]['s'] = s
        d.sort(key=lambda x: (-len(x['v']), x['s']))
        cnt += len(d[0]['v']) - 1
        print(cnt)


for _ in range(int(input())):
    solve()


Submission (verdict: Accepted):
def solve():
    n = int(input())
    d = [{'id': _ + 1, 'v': []} for _ in range(n)]
    for i in range(n - 1):
        u, v = map(int, input().split())
        d[u - 1]['v'].append(v)
        d[v - 1]['v'].append(u)
    if n == 2:
        print(0)
    else:
        for i in range(n):
            s = 0
            for j in d[i]['v']:
                s += len(d[j - 1]['v'])
            d[i]['s'] = s
        d.sort(key=lambda x: (-len(x['v']), x['s']))
        cnt = 1
        cnt += len(d[0]['v']) - 1
        for item in d:
            if d[0]['id'] in item['v']:
                item['v'].remove(d[0]['id'])
        d.remove(d[0])
        d.sort(key=lambda x: (-len(x['v']), x['s']))
        cnt += len(d[0]['v']) - 1
        print(cnt)


for _ in range(int(input())):
    solve()
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <string>
using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--)
    {

    
    string s;
    cin >> s;
    int a[10];
    for (int i = 0; i < 10; i++) {
        a[i] = 0;  // Initialize the count array to 0
    }
    for (int i = 0; i < s.length(); i++) {
        if (s[i] >= '0' && s[i] <= '9') {
            a[s[i] - '0']++; 
        }
    }
    long long sum = 0;
    for (int i = 0; i < 10; i++)
    {
        sum += a[i]*i;
    }
    int brea = 0;
    sum = sum % 9;
    if (sum % 9 == 0)
    {
        cout << "YES" << endl;
        continue;
    }
    if (sum % 3 == 1)
    {
        
        if (a[2] >= 1)
        {
            sum += 2;
            a[2]--;
        }
        else

        {
            cout << "NO" << endl;
            continue;
        }
        
    }
    if (sum % 3 == 2)
    {

        if (a[2] >= 2)
        {
            sum += 4;
            a[2]-= 2;
        }
        else
        {
            cout << "NO" << endl;
            continue;
        }
    }
    if (sum % 9 == 0)
    {
        cout << "YES" << endl;
        continue;
    }
    if (sum % 9 == 6)
    {
        if (a[2] >= 3)
        {
            sum += 6;
            
        }
    }
    if (sum % 9 == 6)
    {
        if (a[3] >= 2)
        {
            cout << "YES" << endl;
            continue;
        }
        else
        {
            cout << "NO" << endl;
            continue;
        }
    }
    if (sum % 3 == 0)
    {
        if (a[3] >= 1)
        {
            cout << "YES" << endl;
            continue;
        }
        else
        {
            cout << "NO" << endl;
            continue;
        }
    }
    cout << "NO" << endl;
    }

    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous submission (verdict: Runtime error on test 1):
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
signed main() {
#ifdef ONPC
   freopen("input.txt", "r", stdin);
#endif
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   int test = 1;
   cin >> test;
   for (int t = 0; t < test; t++) {
      int n;
      cin >> n;
      vector<int> a(n);
      for (int i = 0; i < n; i++) {
        cin >> a[i];
      }
    
      for (int i = 0; i  < n ;i ++) {
        int mn = min(a[i], a[i+1]);
        a[i] -= mn;
        a[i+1] -= mn;
      }
      if (is_sorted(all(a))) {
        cout << "YES\n";
        
      } else {
        cout << "NO\n";
      }
   }

   return 0;
}

Submission (verdict: Runtime error on test 1):
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
signed main() {
#ifdef ONPC
   freopen("input.txt", "r", stdin);
#endif
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   int test = 1;
   cin >> test;
   for (int t = 0; t < test; t++) {
      int n;
      cin >> n;
      vector<int> a(n);
      for (int i = 0; i < n; i++) {
        cin >> a[i];
      }
    
      for (int i = 0; i  < n; i++) {
        int mn = min(a[i], a[i+1]);
        a[i] -= mn;
        a[i+1] -= mn;
      }
      if (is_sorted(all(a))) {
        cout << "YES\n";
        
      } else {
        cout << "NO\n";
      }
   }

   return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)


Submission (verdict: Runtime error on test 1):
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
signed main() {
#ifdef ONPC
   freopen("input.txt", "r", stdin);
#endif
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   int test = 1;
   cin >> test;
   for (int t = 0; t < test; t++) {
      int n;
      cin >> n;
      vector<int> a(n);
      for (int i = 0; i < n; i++) {
        cin >> a[i];
      }
    
      for (int i = 0; i  < n ;i ++) {
        int mn = min(a[i], a[i+1]);
        a[i] -= mn;
        a[i+1] -= mn;
      }
      if (is_sorted(all(a))) {
        cout << "YES\n";
        
      } else {
        cout << "NO\n";
      }
   }

   return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous submission (verdict: Runtime error on test 1):
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
signed main() {
#ifdef ONPC
   freopen("input.txt", "r", stdin);
#endif
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   int test = 1;
   cin >> test;
   for (int t = 0; t < test; t++) {
      int n;
      cin >> n;
      vector<int> a(n);
      for (int i = 0; i < n; i++) {
        cin >> a[i];
      }
    
      for (int i = 0; i  < n; i++) {
        int mn = min(a[i], a[i+1]);
        a[i] -= mn;
        a[i+1] -= mn;
      }
      if (is_sorted(all(a))) {
        cout << "YES\n";
        
      } else {
        cout << "NO\n";
      }
   }

   return 0;
}

Submission (verdict: Runtime error on test 1):
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
signed main() {
#ifdef ONPC
   freopen("input.txt", "r", stdin);
#endif
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   int test = 1;
   cin >> test;
   for (int t = 0; t < test; t++) {
      int n;
      cin >> n;
      vector<int> a(n);
      for (int i = 0; i < n; i++) {
        cin >> a[i];
      }
    
      for (int i = 0; i < n ;i++) {
        int mn = min(a[i], a[i+1]);
        a[i] -= mn;
        a[i+1] -= mn;
      }
      if (is_sorted(all(a))) {
        cout << "YES\n";
        
      } else {
        cout << "NO\n";
      }
   }

   return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous submission (verdict: Runtime error on test 1):
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
signed main() {
#ifdef ONPC
   freopen("input.txt", "r", stdin);
#endif
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   int test = 1;
   cin >> test;
   for (int t = 0; t < test; t++) {
      int n;
      cin >> n;
      vector<int> a(n);
      for (int i = 0; i < n; i++) {
        cin >> a[i];
      }
    
      for (int i = 0; i < n ;i++) {
        int mn = min(a[i], a[i+1]);
        a[i] -= mn;
        a[i+1] -= mn;
      }
      if (is_sorted(all(a))) {
        cout << "YES\n";
        
      } else {
        cout << "NO\n";
      }
   }

   return 0;
}

Submission (verdict: Accepted):
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
signed main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int test = 1;
    cin >> test;
    for (int t = 0; t < test; t++)
    {
        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 mn = min(a[i], a[i + 1]);
            a[i] -= mn;
            a[i + 1] -= mn;
        }
        if (is_sorted(all(a)))
        {
            cout << "YES\n";
        }
        else
        {
            cout << "NO\n";
        }
    }

    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;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--) {
        int l, r;
        cin >> l >> r;

        int a = r, b = r; 
        bool found = false;
        for (int i = 30; i >= 0; i--) {
            if (!found && ((l & (1 << i)) != (r & (1 << i)))) {
                found = true;
                a |= (1 << i);  
                b &= ~(1 << i); 
            } 
            else if (found) {
                a &= ~(1 << i); 
                b |= (1 << i);  
            }
        }
        cout << a << " " << b << " " << (a+b)/2 << "\n";
    }

    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--){
        int l, r;
        cin >> l >> r;

        int a = r, b = r; 
        bool found = false;
        for (int i = 30; i >= 0; i--) {
            if (!found && ((l & (1 << i)) != (r & (1 << i)))) {
                found = true;
                a |= (1 << i);  
                b &= ~(1 << i); 
            } 
            else if (found) {
                a &= ~(1 << i); 
                b |= (1 << i);  
            }
        }
        int c = (abs(a-b)!=1) ? (a+b)/2 : (l!=b) ? l : r;
        cout << a << " " << b << " " << c << "\n";
    }

    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;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--) {
        int l, r;
        cin >> l >> r;

        int a = r, b = r; 
        bool found = false;
        for (int i = 30; i >= 0; i--) {
            if (!found && ((l & (1 << i)) != (r & (1 << i)))) {
                found = true;
                a |= (1 << i);  
                b &= ~(1 << i); 
            } 
            else if (found) {
                a &= ~(1 << i); 
                b |= (1 << i);  
            }
        }
        cout << a << " " << b << " " << l+1 << "\n";
    }

    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;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--) {
        int l, r;
        cin >> l >> r;

        int a = r, b = r; 
        bool found = false;
        for (int i = 30; i >= 0; i--) {
            if (!found && ((l & (1 << i)) != (r & (1 << i)))) {
                found = true;
                a |= (1 << i);  
                b &= ~(1 << i); 
            } 
            else if (found) {
                a &= ~(1 << i); 
                b |= (1 << i);  
            }
        }
        cout << a << " " << b << " " << l+1 << "\n";
    }

    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--) {
        int l, r;
        cin >> l >> r;

        int a = r, b = r; 
        bool found = false;
        for (int i = 30; i >= 0; i--) {
            if (!found && ((l & (1 << i)) != (r & (1 << i)))) {
                found = true;
                a |= (1 << i);  
                b &= ~(1 << i); 
            } 
            else if (found) {
                a &= ~(1 << i); 
                b |= (1 << i);  
            }
        }
        cout << a << " " << b << " " << (a+b)/2 << "\n";
    }

    return 0;
}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

#define ll long long

#define MEM 101

#define x first

#define y second

#define sz size()

#define pb push_back

#define all(v) (v).begin(), (v).end()

using namespace std;

typedef pair<ll, ll> pi;

const ll INF = 4e18;

const ll MOD = 1e4;

ll gcd(ll a, ll b)

{

    if (a % b)

        return gcd(b, a % b);

    return b;

}

ll abs(ll a, ll b)

{

    return (a > b ? a - b : b - a);

}

ll add(ll a, ll b)

{

    return ((a + b) % MOD + MOD) % MOD;

}

ll sub(ll a, ll b)

{

    return ((a - b) % MOD + MOD) % MOD;

}

ll mul(ll a, ll b)

{

    return ((a * b) % MOD + MOD) % MOD;

}

ll t, n, k, m;

ll a[MEM];

main()

{

    cin.tie(0);

    cout.tie(0);

    ios::sync_with_stdio(0);

    cin >> t;

    while (t--)

    {

        string s;

        cin >> n;

        cin >> s;

        ll ans = 0, piv = 0, siv = 0;

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

        {

            if (s[i] == 'p')

                piv = 1;

            if (s[i] == 's')

                siv = 1;

        }

        if ((s[n - 1] == 'p' && s[0] == 's') || !(piv & siv))

            ans = 1;

        if (ans)

            cout << "YES\n";

        else

            cout << "NO\n";

    }

}



Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>

#define ll long long

#define MEM 101

#define x first

#define y second

#define sz size()

#define pb push_back

#define all(v) (v).begin(), (v).end()

using namespace std;

typedef pair<ll, ll> pi;

const ll INF = 4e18;

const ll MOD = 1e4;

ll gcd(ll a, ll b)

{

    if (a % b)

        return gcd(b, a % b);

    return b;

}

ll abs(ll a, ll b)

{

    return (a > b ? a - b : b - a);

}

ll add(ll a, ll b)

{

    return ((a + b) % MOD + MOD) % MOD;

}

ll sub(ll a, ll b)

{

    return ((a - b) % MOD + MOD) % MOD;

}

ll mul(ll a, ll b)

{

    return ((a * b) % MOD + MOD) % MOD;

}

ll t, n, k, m;

ll a[MEM];

main()

{

    cin.tie(0);

    cout.tie(0);

    ios::sync_with_stdio(0);

    cin >> t;

    while (t--)

    {

        string s;

        cin >> n;

        cin >> s;

        ll ans = 0, piv = 0, siv = 0;

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

        {

            if (s[i] == 'p' && !piv)

                piv = i+1;

            if (s[i] == 's')

                siv = i+1;

        }

        if ((siv==1 || piv==n) || !(piv & siv))

            ans = 1;

        if (ans)

            cout << "YES\n";

        else

            cout << "NO\n";

    }

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

#define ll long long

#define MEM 101

#define x first

#define y second

#define sz size()

#define pb push_back

#define all(v) (v).begin(), (v).end()

using namespace std;

typedef pair<ll, ll> pi;

const ll INF = 4e18;

const ll MOD = 1e4;

ll gcd(ll a, ll b)

{

    if (a % b)

        return gcd(b, a % b);

    return b;

}

ll abs(ll a, ll b)

{

    return (a > b ? a - b : b - a);

}

ll add(ll a, ll b)

{

    return ((a + b) % MOD + MOD) % MOD;

}

ll sub(ll a, ll b)

{

    return ((a - b) % MOD + MOD) % MOD;

}

ll mul(ll a, ll b)

{

    return ((a * b) % MOD + MOD) % MOD;

}

ll t, n, k, m;

ll a[MEM];

main()

{

    cin.tie(0);

    cout.tie(0);

    ios::sync_with_stdio(0);

    cin >> t;

    while (t--)

    {

        string s;

        cin >> n;

        cin >> s;

        ll ans = 0, piv = 0, siv = 0;

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

        {

            if (s[i] == 'p')

                piv = 1;

            if (s[i] == 's')

                siv = 1;

        }

        if ((s[n - 1] == 'p' && s[0] == 's') || !(piv & siv))

            ans = 1;

        if (ans)

            cout << "YES\n";

        else

            cout << "NO\n";

    }

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>

#define ll long long

#define MEM 101

#define x first

#define y second

#define sz size()

#define pb push_back

#define all(v) (v).begin(), (v).end()

using namespace std;

typedef pair<ll, ll> pi;

const ll INF = 4e18;

const ll MOD = 1e4;

ll gcd(ll a, ll b)

{

    if (a % b)

        return gcd(b, a % b);

    return b;

}

ll abs(ll a, ll b)

{

    return (a > b ? a - b : b - a);

}

ll add(ll a, ll b)

{

    return ((a + b) % MOD + MOD) % MOD;

}

ll sub(ll a, ll b)

{

    return ((a - b) % MOD + MOD) % MOD;

}

ll mul(ll a, ll b)

{

    return ((a * b) % MOD + MOD) % MOD;

}

ll t, n, k, m;

ll a[MEM];

main()

{

    cin.tie(0);

    cout.tie(0);

    ios::sync_with_stdio(0);

    cin >> t;

    while (t--)

    {

        string s;

        cin >> n;

        cin >> s;

        ll ans = 0, piv = 0, siv = 0;

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

        {

            if (s[i] == 'p' && !piv)

                piv = i+1;

            if (s[i] == 's')

                siv = i+1;

        }

        if ((siv==1 || piv==n) || !(piv & siv))

            ans = 1;

        if (ans)

            cout << "YES\n";

        else

            cout << "NO\n";

    }

}



Submission (verdict: Accepted):
#include <bits/stdc++.h>

#define ll long long

#define MEM 101

#define x first

#define y second

#define sz size()

#define pb push_back

#define all(v) (v).begin(), (v).end()

using namespace std;

typedef pair<ll, ll> pi;

const ll INF = 4e18;

const ll MOD = 1e4;

ll gcd(ll a, ll b)

{

    if (a % b)

        return gcd(b, a % b);

    return b;

}

ll abs(ll a, ll b)

{

    return (a > b ? a - b : b - a);

}

ll add(ll a, ll b)

{

    return ((a + b) % MOD + MOD) % MOD;

}

ll sub(ll a, ll b)

{

    return ((a - b) % MOD + MOD) % MOD;

}

ll mul(ll a, ll b)

{

    return ((a * b) % MOD + MOD) % MOD;

}

ll t, n, k, m;

ll a[MEM];

main()

{

    cin.tie(0);

    cout.tie(0);

    ios::sync_with_stdio(0);

    cin >> t;

    while (t--)

    {

        string s;

        cin >> n;

        cin >> s;

        ll ans = 0, piv = 0, siv = 0;

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

        {

            if (s[i] == 'p' && !piv)

                piv = i + 1;

            if (s[i] == 's')

                siv = i + 1;

        }

        if ((siv == 1 || piv == n) || !(piv && siv))

            ans = 1;

        if (ans)

            cout << "YES\n";

        else

            cout << "NO\n";

    }

}
Problem: 2057B - Gorilla and the Exam
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	int t;
	cin>>t;
	while(t--){
		int n,k;
		cin>>n>>k;

		int arr[n];
		
		for(int i=0;i<n;i++){
			cin>>arr[i];
			
		}

		sort(arr,arr+n);
		vector <int> count{1};
		for(int i=0;i<n-1;i++){
			if(arr[i]==arr[i+1]){
				count.back()++;
			}
			else{
				count.emplace_back(1);
			}
		}
		int size=count.size();
		for(int i=0;i<size-1;i++){
			if(count[i]>k){
				cout<<size-i<<"\n";
				return 0;
			}
			k-=count[i];
		}
		cout<<1<<"\n";
		



	}
}
Problem: 2057B - Gorilla and the Exam
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	int t;
	cin>>t;
	while(t--){
		int n,k;
		cin>>n>>k;

		int arr[n];
		
		for(int i=0;i<n;i++){
			cin>>arr[i];
			
		}

		sort(arr,arr+n);
		vector <int> count{1};
		for(int i=0;i<n-1;i++){
			if(arr[i]==arr[i+1]){
				count.back()++;
			}
			else{
				count.emplace_back(1);
			}
		}
		int size=count.size();
		for(int i=0;i<size-1;i++){
			if(count[i]>k){
				cout<<size-i<<"\n";
				return 0;
			}
			k-=count[i];
		}
		cout<<1<<"\n";
		



	}
}

Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	int t;
	cin>>t;
	while(t--){
		int n,k;
		cin>>n>>k;

		int arr[n];
		
		for(int i=0;i<n;i++){
			cin>>arr[i];
			
		}

		sort(arr,arr+n);
		vector <int> count{1};
		for(int i=0;i<n-1;i++){
			if(arr[i]==arr[i+1]){
				count.back()++;
			}
			else{
				count.emplace_back(1);
			}
		}
		int size=count.size();
		for(int i=0;i<size-1;i++){
			if(count[i]>k){
				cout<<size-i<<"\n";
				break;
			}
			k-=count[i];
		}
		if(k>0)
		cout<<1<<"\n";
	

		



	}
}