Why doesn't this question work with policy based data structures

I used policy based data structure to solve this question but doesn’t work. Why is this so?

hello @Ferogle you can solve this question by priority queue .
use that you will be able to solve this .

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef unsigned long long llu;

typedef long double ldo;

#define forz(iter,n) for(int iter=0;iter<n;++iter)

#define rep(iter,s,e) for(int iter=s;iter<e;++iter)

#define urep(iter,s,e) for(int iter=s;iter>=e;–iter)

#define MOD (ll)1000000007

#define ppl pair<ll,ll>

#define ppi pair<int,int>

#define vii vector

#define vvi vector

#define vll vector

#define vpp vector

#define vss vector

#define take(A,n) {forz(iter,n)cin>>A[iter];}

#define pb push_back

#define pob pop_back

#define eb emplace_back

#define pf push_front

#define pof pop_front

#define mkp make_pair

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

#define ff first

#define ss second

#define lcm(a,b) (a*b)/__gcd(a,b)

#define bs(v,x) binary_search(all(v),x)

#define ub(v,x) upper_bound(all(v),x)

#define lb(v,x) lower_bound(all(v),x)

#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);

#define N 1005

/*

Policy based DS

*/

#include<ext/pb_ds/assoc_container.hpp>

#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

typedef tree<ll,null_type,less,rb_tree_tag,tree_order_statistics_node_update> PBDS;

int main(){

/*

zoom;

#ifndef ONLINE_JUDGE

freopen("C:\\Users\\srika\\CLionProjects\\InterviewPrep\\input.txt", "r", stdin);

freopen("C:\\Users\\srika\\CLionProjects\\InterviewPrep\\output.txt", "w", stdout);

#endif

*/

int t=1;//cin>>t;

while(t--) {

    int n,k;cin>>n>>k;

    PBDS st;

    while(n--){

        int tq;cin>>tq;

        if(tq==1){

            ll x,y;cin>>x>>y;

            ll dis=(ll)(((ll)(x*x))+((ll)(y*y)));

            st.insert(dis);

        }

        else{

            cout<<*st.find_by_order(k-1)<<endl;

        }

    }

}

return 0;

}

this fails in only 1 test case.Could you please look into it

hey @Ferogle please share your code by saving it on ide.codingblocks.com

My code is visible right?

Why is it failing in last case? Can anyone please explain this?

hey @Ferogle please wait let me see your code and test case .

hey @Ferogle your code is falling for large test cases.
you have to use priotrity queue .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.