My Code of This Problem Where m doing mistake plz hint me

#include<bits/stdc++.h>
using namespace std;
int main()
{
int q,k;
cin>>q>>k;
priority_queue qu;
while(q–)
{
int t;
cin>>t;
if(t==1)
{ int x,y;
cin>>x>>y;
long long int distance=(xx)+(yy);
qu.push(distance);
if(qu.size()>k)
qu.pop();

		}
		else
		{	
		    cout<<qu.top()<<endl;
		}
}
return 0;

}

Hey everything is good except type of x and y, make them long long!

i make it long long bt again this will give the error

/bin/run.sh: line 4: 17 Segmentation fault (core dumped) ./exe

go to ide.codingblocks.com, submit and save your code then share the link here

@Vijay-Gwala-1537851266358174 there is no code on this link, you have to save your code as well

https://hack.codingblocks.com/app/practice/1/401/problem try here, your code is perfect

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.

1 Like