#include <bits/stdc++.h>
#include "teams.h"
#define ll long long
using namespace std;
ll n;
vector<pair<ll,ll>> p;
void init(int N, int A[], int B[])
{
    n=N;
    for (int i=0;i<n;i++)
    {
        pair<ll,ll> pr={A[i],B[i]};
        p.push_back(pr);
    }
    sort(p.begin(),p.end(),[](pair<ll,ll> a, pair<ll,ll> b){if(a.second!=b.second) a.second < b.second; else return a.first > b.first;});
}
int can(int M, int K[])
{
    set<pair<ll,ll>> st;
    for (int i=0;i<M;i++)
    {
        st.insert({K[i],i});
    }
    vector<ll> used(M);
    for (int i=0;i<n;i++)
    {
        pair<ll,ll> pr = {p[i].first,0};
        auto it = st.lower_bound(pr);
        if(it==st.end() || (*it).first > p[i].second) continue;
        pair<ll,ll> prr=*it;
        used[prr.second]++;
        if(used[prr.second]==pr.first)
        {
            st.erase(it);
        }
    }
    int good=1;
    for (int i=0;i<M;i++)
    {
        if(used[i]!=K[i])good=0;
    }
    return good;
}
// int main()
// {
//     ll n;
//     cin>>n;
//     int A[10];
//     int B[10];
//     for (int i=0;i<n;i++)
//     {
//         cin>>A[i]>>B[i];
//     }
//     init(n,A,B);
//     ll q;
//     cin>>q;
//     while(q--)
//     {
//         int K[100];
//         int m;
//         cin>>m;
//         for (int i=0;i<m;i++)
//         {
//             cin>>K[i];
//         }
//         cout << can(m,K) << endl;
//     }
// }
Compilation message (stderr)
teams.cpp: In lambda function:
teams.cpp:15:135: warning: control reaches end of non-void function [-Wreturn-type]
   15 |     sort(p.begin(),p.end(),[](pair<ll,ll> a, pair<ll,ll> b){if(a.second!=b.second) a.second < b.second; else return a.first > b.first;});
      |                                                                                                                                       ^| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |