ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


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

#define pyes cout << "YES\n"
#define pno cout << "NO\n"
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " " << x << endl;
#else
#define debug(x)
#endif

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; ++i)
    {
        int n, l, r;
        cin >> n >> l >> r;
        l--;
        r--;
        vector<int> v1;
        v1.reserve(n);
        int t1;
        string check = "checking\n";
        int x = max(0, l - (r - l + 1));
        int y = min(n - 1, r + (r - l + 1));
        debug(x) debug(y);
        for (int j = 0; j < n; ++j)
        {
            cin >> t1;
            v1.push_back(t1);
        }
        // debug(check);
        vector<int> v2(v1.begin() + l, v1.begin() + y + 1);
        sort(v2.begin(), v2.end());
        int a1 = 0;
        for (int i = 0; i < r - l + 1; i++)
        {
            a1 += v2[i];
        }
        int a2 = 0;
        // debug(check);
        vector<int> v3(v1.begin() + x, v1.begin() + r + 1);
        sort(v3.begin(), v3.end());
        for (int i = 0; i < r - l + 1; ++i)
        {
            a2 += v3[i];
        }
        // debug(check)
        cout << min(a1, a2) << endl;
    }
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

#define pyes cout << "YES\n"
#define pno cout << "NO\n"
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " " << x << endl;
#else
#define debug(x)
#endif

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; ++i)
    {
        int n, l, r;
        cin >> n >> l >> r;
        l--;
        r--;
        vector<int> v1;
        v1.reserve(n);
        int t1;
        string check = "checking\n";
        int x = max(0, l - (r - l + 1));
        int y = min(n - 1, r + (r - l + 1));
        debug(x) debug(y);
        for (int j = 0; j < n; ++j)
        {
            cin >> t1;
            v1.push_back(t1);
        }
        if(n==1)
        {
            cout<<t1<<endl;
            continue;
        }
        // debug(check);
        vector<int> v2(v1.begin() + l, v1.begin() + y + 1);
        sort(v2.begin(), v2.end());
        int a1 = 0;
        for (int i = 0; i < r - l + 1; i++)
        {
            a1 += v2[i];
        }
        int a2 = 0;
        // debug(check);
        vector<int> v3(v1.begin() + x, v1.begin() + r + 1);
        sort(v3.begin(), v3.end());
        for (int i = 0; i < r - l + 1; ++i)
        {
            a2 += v3[i];
        }
        // debug(check)
        cout << min(a1, a2) << endl;
    }
}

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

#define pyes cout << "YES\n"
#define pno cout << "NO\n"
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " " << x << endl;
#else
#define debug(x)
#endif

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; ++i)
    {
        int n, l, r;
        cin >> n >> l >> r;
        l--;
        r--;
        vector<int> v1;
        v1.reserve(n);
        int t1;
        string check = "checking\n";
        int x = max(0, l - (r - l + 1));
        int y = min(n - 1, r + (r - l + 1));
        debug(x) debug(y);
        for (int j = 0; j < n; ++j)
        {
            cin >> t1;
            v1.push_back(t1);
        }
        if (n == 1)
        {
            cout << t1 << endl;
            continue;
        }
        vector<int> v2(v1.begin(), v1.begin() + r + 1);
        sort(v2.begin(), v2.end());
        int a1 = 0, a2 = 0;
        for (int i = 0; i < r - l + 1; ++i)
        {
            a1 += v2[i];
        }
        vector<int> v3(v1.begin() + l, v1.end());
        sort(v3.begin(), v3.end());
        for (int i = 0; i < r - l + 1; ++i)
        {
            a2 += v3[i];
        }
        cout << min(a1, a2) << endl;
        // debug(check)
        // cout << min(a1, a2) << endl;
    }
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

#define pyes cout << "YES\n"
#define pno cout << "NO\n"
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " " << x << endl;
#else
#define debug(x)
#endif

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; ++i)
    {
        int n, l, r;
        cin >> n >> l >> r;
        l--;
        r--;
        vector<int> v1;
        v1.reserve(n);
        int t1;
        string check = "checking\n";
        int x = max(0, l - (r - l + 1));
        int y = min(n - 1, r + (r - l + 1));
        debug(x) debug(y);
        for (int j = 0; j < n; ++j)
        {
            cin >> t1;
            v1.push_back(t1);
        }
        if(n==1)
        {
            cout<<t1<<endl;
        }
        // debug(check);
        vector<int> v2(v1.begin() + l, v1.begin() + y + 1);
        sort(v2.begin(), v2.end());
        int a1 = 0;
        for (int i = 0; i < r - l + 1; i++)
        {
            a1 += v2[i];
        }
        int a2 = 0;
        // debug(check);
        vector<int> v3(v1.begin() + x, v1.begin() + r + 1);
        sort(v3.begin(), v3.end());
        for (int i = 0; i < r - l + 1; ++i)
        {
            a2 += v3[i];
        }
        // debug(check)
        cout << min(a1, a2) << endl;
    }
}

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

#define pyes cout << "YES\n"
#define pno cout << "NO\n"
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " " << x << endl;
#else
#define debug(x)
#endif

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; ++i)
    {
        int n, l, r;
        cin >> n >> l >> r;
        l--;
        r--;
        vector<int> v1;
        v1.reserve(n);
        int t1;
        string check = "checking\n";
        int x = max(0, l - (r - l + 1));
        int y = min(n - 1, r + (r - l + 1));
        debug(x) debug(y);
        for (int j = 0; j < n; ++j)
        {
            cin >> t1;
            v1.push_back(t1);
        }
        if(n==1)
        {
            cout<<t1<<endl;
            continue;
        }
        // debug(check);
        vector<int> v2(v1.begin() + l, v1.begin() + y + 1);
        sort(v2.begin(), v2.end());
        int a1 = 0;
        for (int i = 0; i < r - l + 1; i++)
        {
            a1 += v2[i];
        }
        int a2 = 0;
        // debug(check);
        vector<int> v3(v1.begin() + x, v1.begin() + r + 1);
        sort(v3.begin(), v3.end());
        for (int i = 0; i < r - l + 1; ++i)
        {
            a2 += v3[i];
        }
        // debug(check)
        cout << min(a1, a2) << endl;
    }
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

#define pyes cout << "YES\n"
#define pno cout << "NO\n"
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " " << x << endl;
#else
#define debug(x)
#endif

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; ++i)
    {
        int n, l, r;
        cin >> n >> l >> r;
        l--;
        r--;
        vector<int> v1;
        v1.reserve(n);
        int t1;
        string check = "checking\n";
        int x = max(0, l - (r - l + 1));
        int y = min(n - 1, r + (r - l + 1));
        debug(x) debug(y);
        for (int j = 0; j < n; ++j)
        {
            cin >> t1;
            v1.push_back(t1);
        }
        if (n == 1)
        {
            cout << t1 << endl;
            continue;
        }
        vector<int> v2(v1.begin(), v1.begin() + r + 1);
        sort(v2.begin(), v2.end());
        int a1 = 0, a2 = 0;
        for (int i = 0; i < r - l + 1; ++i)
        {
            a1 += v2[i];
        }
        vector<int> v3(v1.begin() + l, v1.end());
        sort(v3.begin(), v3.end());
        for (int i = 0; i < r - l + 1; ++i)
        {
            a2 += v3[i];
        }
        cout << min(a1, a2) << endl;
        // debug(check)
        // cout << min(a1, a2) << endl;
    }
}

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

#define pyes cout << "YES\n"
#define pno cout << "NO\n"
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " " << x << endl;
#else
#define debug(x)
#endif

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; ++i)
    {
        int n, l, r;
        cin >> n >> l >> r;
        l--;
        r--;
        vector<int> v1;
        v1.reserve(n);
        int t1;
        string check = "checking\n";
        int x = max(0, l - (r - l + 1));
        int y = min(n - 1, r + (r - l + 1));
        debug(x) debug(y);
        for (int j = 0; j < n; ++j)
        {
            cin >> t1;
            v1.push_back(t1);
        }
        if (n == 1)
        {
            cout << t1 << endl;
            continue;
        }
        vector<int> v2(v1.begin(), v1.begin() + r + 1);
        sort(v2.begin(), v2.end());
        unsigned long long a1 = 0, a2 = 0;
        for (int i = 0; i < r - l + 1; ++i)
        {
            a1 += v2[i];
        }
        vector<int> v3(v1.begin() + l, v1.end());
        sort(v3.begin(), v3.end());
        for (int i = 0; i < r - l + 1; ++i)
        {
            a2 += v3[i];
        }
        cout << min(a1, a2) << endl;
        // debug(check)
        // cout << min(a1, a2) << endl;
    }
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define MOD 1000000007
#define PLL pair<ll, ll>
#define PII pair<int, int>
#define PI acos(-1.0)
using namespace std;
const int N = 1e5 + 10;

int fastpow(int n, int x, int m){
 int ret = 1;
 n%=m;
 while(x){
  if(x&1) (ret*=n)%=m;
  x>>=1;
  (n*=n)%=m;
 }
 return ret;
}

int modInverse(int n , int m){
    return fastpow(n,m-2,m);
}

int ncrMod(int n , int r , int m){
    if (n < r)
        return 0;
    if (r == 0)
        return 1;

    int fac[n + 1];
    fac[0] = 1;
    for (int i = 1; i <= n; i++)
        fac[i] = (fac[i - 1] * i) % m;

    return (fac[n] * modInverse(fac[r], m) % m
            * modInverse(fac[n - r], m) % m)
           % m;
}

//********************************Solution starts here***********************************

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

    if(n==1){
        cout<<arr[0]<<endl;
        return;
    }

    if(n==2){
        cout<<abs(arr[0])+abs(arr[1])<<endl;
        return;
    }

    int final = n-1;
    int ans=0;
    for(int i=0 ; i<n ; i++){
        int sum = 0;
        for(int i=0 ; i<=final ; i++) sum+=arr[i];
        ans = max(ans,abs(sum));

        for(int i=0 ; i<final ; i++){
            arr[i]=arr[i+1]-arr[i];
        }
        final--;
    }

    cout << ans << endl;
}

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

    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        int n,l,r;
        cin>>n>>l>>r;
        vector<int>v(n);
        for(int i=0;i<n;i++){
            cin>>v[i];
        }
        sort(v.begin(),v.end());
        int g=(r-l)+1;
        int ans=0;
        for(int i=0;i<g;i++){
            ans+=(v[i]);
        }
        cout<<ans<<endl;
    }
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        long long int n,l,r;
        cin>>n>>l>>r;
        vector<long long int>v(n);
        for(long long int i=0;i<n;i++){
            cin>>v[i];
        }
        sort(v.begin(),v.end());
        long long int g=(r-l)+1;
        long long int ans=0;
        for(long long int i=0;i<g;i++){
            ans+=(v[i]);
        }
        cout<<ans<<endl;
    }
}

Submission (verdict: Wrong answer on test 8):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        int n,l,r;
        cin>>n>>l>>r;
        vector<int>v(n);
        vector<int>a,b;
        int g=(r-l)+1;
        for(int i=0;i<n;i++){
            cin>>v[i];
        }
        for(int i=l-1;i<n;i++){
            a.push_back(v[i]);
        }
        for(int i=0;i<r;i++){
            b.push_back(v[i]);
        }
        sort(a.begin(),a.end());
        sort(b.begin(),b.end());
        int ans1=0;
        int ans2=0;
        int ans=0;
        for(int i=0;i<g;i++){
            ans1+=(a[i]);
        }
        for(int i=0;i<g;i++){
            ans2+=(b[i]);
        }
        cout<<min(ans1,ans2)<<endl;
    }
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        int n,l,r;
        cin>>n>>l>>r;
        vector<int>v(n);
        for(int i=0;i<n;i++){
            cin>>v[i];
        }
        sort(v.begin(),v.end());
        int g=(r-l)+1;
        int ans=0;
        for(int i=0;i<g;i++){
            ans+=(v[i]);
        }
        cout<<ans<<endl;
    }
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        long long int n,l,r;
        cin>>n>>l>>r;
        vector<long long int>v(n);
        for(long long int i=0;i<n;i++){
            cin>>v[i];
        }
        sort(v.begin(),v.end());
        long long int g=(r-l)+1;
        long long int ans=0;
        for(long long int i=0;i<g;i++){
            ans+=(v[i]);
        }
        cout<<ans<<endl;
    }
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 8):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        int n,l,r;
        cin>>n>>l>>r;
        vector<int>v(n);
        vector<int>a,b;
        int g=(r-l)+1;
        for(int i=0;i<n;i++){
            cin>>v[i];
        }
        for(int i=l-1;i<n;i++){
            a.push_back(v[i]);
        }
        for(int i=0;i<r;i++){
            b.push_back(v[i]);
        }
        sort(a.begin(),a.end());
        sort(b.begin(),b.end());
        int ans1=0;
        int ans2=0;
        int ans=0;
        for(int i=0;i<g;i++){
            ans1+=(a[i]);
        }
        for(int i=0;i<g;i++){
            ans2+=(b[i]);
        }
        cout<<min(ans1,ans2)<<endl;
    }
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        long long int n,l,r;
        cin>>n>>l>>r;
        vector<long long int>v(n);
        vector<long long int>a,b;
        long long int g=(r-l)+1;
        for(long long int i=0;i<n;i++){
            cin>>v[i];
        }
        for(long long int i=l-1;i<n;i++){
            a.push_back(v[i]);
        }
        for(long long int i=0;i<r;i++){
            b.push_back(v[i]);
        }
        sort(a.begin(),a.end());
        sort(b.begin(),b.end());
        long long int ans1=0;
        long long int ans2=0;
        long long int ans=0;
        for(int i=0;i<g;i++){
            ans1+=(a[i]);
        }
        for(int i=0;i<g;i++){
            ans2+=(b[i]);
        }
        cout<<min(ans1,ans2)<<endl;
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 12):
// //12345
// //12435
// 3 4

// 2 1
// 1 2
// 3 2
// 3 1
// 1 3
// 2 3
// 12345
// 4 3
// 4 2
// 4 1
// 1 4
// 2 4
// 3 4*

// //12345
// //14352
// 2 3
// 2 4
// 2 5
// 3 4

// 2 1
// 1 2
// 3 2
// 3 1
// 1 3
// 2 3*
// 13245
// 4 2
// 4 3
// 4 1
// 1 4
// 2 4*
// 14325
// 5 2
// 5 3
// 5 4
// 5 1
// 1 5
// 4 5
// 3 5
// 2 5*
// 14352

// 1 2 3 4 5 6
// 1 6 3 5 4 2
// 1 2
// 2 1
// 3 2
// 4 2
// 5 2
// 6 2
// 1 3 4 5 6 2
// 1 3
// 3 1
// 4 3
// 1 4 3 5 6 2
// 4 1 
// 1 4
// 3 4
// 5 4
// 6 4
// 1 3 5 6 4 2
// 5 3
// 5 1
// 1 5
// 3 5
// 6 5
// 1 3 6 5 4 2
// 6 3
// 6 1
// 1 6
// 1 6 3 5 4 2

// 6 1
// 1 6
// 3 6 *
// 5 3 
// 5 6 *
// 3 5
// 4 5*
// 2 4*

#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define mod 1000000007
void solve()
{
    int n;
    cin >> n;
    vector<int> a(n + 1);
    map<int, int> mp;
    for (int i = 1; i <= n; i++)
        a[i] = i;
    for (int i = 1; i <= n; i++)
    {
        int x;
        cin >> x;
        mp[x] = i;
    }
    map<int,int> curr;
    for(int i=1;i<=n;i++)
    curr[i]=i;
    int i=1;
    vector<pair<int,int>> ans;
    for(int i=1;i<=n;i++)
    {
        int c = curr[i];
        int d = mp[i];
        for(int j=c-1;j>=1;j--)
        {
            ans.push_back({i,a[j]});
            swap(a[j],a[j+1]);
        }
        for(int j=2;j<=d;j++)
        {
            ans.push_back({a[j],i});
            swap(a[j],a[j-1]);
        }
        for(int i=1;i<=n;i++)
        {
            curr[a[i]]=i;
        }
    }
    // for(auto it:a)
    // cout <<it << " ";
    // cout << endl;
    cout << ans.size() << endl;
    for (auto [x, y] : ans)
    {
        cout << x << " " << y << endl;
    }
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test = 1;
    // cin>>test;
    while (test--)
    {
        solve();
    }
    return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
#define f(i,a) for(ll i = 0; i < a; i++)

int dx[4] = { 0, 0, 1, -1 };
int dy[4] = { 1, -1, 0, 0 };

using namespace std;

ll pow(ll n, ll exp)
{
    if(exp == 0)
    return 1;
    if(exp == 1)
    return n;

    ll half = pow(n, exp / 2);
    
    if(exp%2 == 0)
    return half * half;    
    else
    return n * half * half;
    
}

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

    ll t  = 1;
    cin >> t;   
    while (t--) {
        //unordered_map<ll, ll> mpp;
        bool choice = false;
        ll n = -1, m, k;
        
        cin >> n >> k;
        vector<ll> a(n);
        map<ll, ll> mpp;

        

        for(ll i = 0; i < n; i++)
        {
            cin >> a[i];
            mpp[a[i]]++;
        }
        if(k == n)
        {
            cout << 1 << endl;
            continue;
        }
        priority_queue<ll, vector<ll>, greater<ll>> pq;
        for(auto x : mpp)
        pq.push(x.second);
        
        ll removed = 0;
        while(k>0)
        {
            ll temp = pq.top(); pq.pop();
            if(k - temp >= 0)
            removed++;
            k-=temp;
        }
        cout << pq.size() << endl;
        

        
    }
        return 0;
    }
    


Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
#define f(i,a) for(ll i = 0; i < a; i++)

int dx[4] = { 0, 0, 1, -1 };
int dy[4] = { 1, -1, 0, 0 };

using namespace std;

ll pow(ll n, ll exp)
{
    if(exp == 0)
    return 1;
    if(exp == 1)
    return n;

    ll half = pow(n, exp / 2);
    
    if(exp%2 == 0)
    return half * half;    
    else
    return n * half * half;
    
}

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

    ll t  = 1;
    cin >> t;   
    while (t--) {
        //unordered_map<ll, ll> mpp;
        bool choice = false;
        ll n = -1, m, k;
        
        cin >> n >> k;
        vector<ll> a(n);
        map<ll, ll> mpp;

        

        for(ll i = 0; i < n; i++)
        {
            cin >> a[i];
            mpp[a[i]]++;
        }
        if(k == n)
        {
            cout << 1 << endl;
            continue;
        }
        priority_queue<ll, vector<ll>, greater<ll>> pq;
        for(auto x : mpp)
        pq.push(x.second);
        
        ll removed = 0;
        while(k>0)
        {
            ll temp = pq.top(); 
            if(k - temp >= 0)
            {
                pq.pop();
                removed++;
            }
            k-=temp;
        }
        cout << pq.size() << endl;
        

        
    }
        return 0;
    }
Problem: 2057B - Gorilla and the Exam
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
#define f(i,a) for(ll i = 0; i < a; i++)

int dx[4] = { 0, 0, 1, -1 };
int dy[4] = { 1, -1, 0, 0 };

using namespace std;

ll pow(ll n, ll exp)
{
    if(exp == 0)
    return 1;
    if(exp == 1)
    return n;

    ll half = pow(n, exp / 2);
    
    if(exp%2 == 0)
    return half * half;    
    else
    return n * half * half;
    
}

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

    ll t  = 1;
    cin >> t;   
    while (t--) {
        //unordered_map<ll, ll> mpp;
        bool choice = false;
        ll n = -1, m, k;
        
        cin >> n >> k;
        vector<ll> a(n);
        map<ll, ll> mpp;

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

        priority_queue<ll, vector<ll>, greater<ll>> pq;
        for(auto x : mpp)
        pq.push(x.second);
        
        ll removed = 0;
        while(k>0)
        {
            ll temp = pq.top(); pq.pop();
            if(k - temp >= 0)
            removed++;
            k-=temp;
        }
        if(pq.size() != 0)
        cout << pq.size() << endl;
        else
        cout << 1 << endl;

        
    }
        return 0;
    }
    


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
#define f(i,a) for(ll i = 0; i < a; i++)

int dx[4] = { 0, 0, 1, -1 };
int dy[4] = { 1, -1, 0, 0 };

using namespace std;

ll pow(ll n, ll exp)
{
    if(exp == 0)
    return 1;
    if(exp == 1)
    return n;

    ll half = pow(n, exp / 2);
    
    if(exp%2 == 0)
    return half * half;    
    else
    return n * half * half;
    
}

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

    ll t  = 1;
    cin >> t;   
    while (t--) {
        //unordered_map<ll, ll> mpp;
        bool choice = false;
        ll n = -1, m, k;
        
        cin >> n >> k;
        vector<ll> a(n);
        map<ll, ll> mpp;

        

        for(ll i = 0; i < n; i++)
        {
            cin >> a[i];
            mpp[a[i]]++;
        }
        if(k == n)
        {
            cout << 1 << endl;
            continue;
        }
        priority_queue<ll, vector<ll>, greater<ll>> pq;
        for(auto x : mpp)
        pq.push(x.second);
        
        ll removed = 0;
        while(k>0)
        {
            ll temp = pq.top(); pq.pop();
            if(k - temp >= 0)
            removed++;
            k-=temp;
        }
        cout << pq.size() << endl;
        

        
    }
        return 0;
    }