No output printed

My code compiles successfully but no output is printed.
Here’s one approach
#include<bits/stdc++.h>
using namespace std;

int main()
{
int n,k;
cin>>n>>k;

vector<int> v;

int type;
cin>>type;

for( int q= 0; q<n; q++)
{

if (type==1)
{
	int x,y;
	cin>>x>>y;
	int dist = x*x + y*y;
	v.push_back(dist);
}
if (type==2)
{
	int temp = v[q-1];
	for( int i=1; i<k; i++)
	{
		if(v[q-k-1]<temp)
		{
			temp = v[q-k-1];
		}
	}
	cout<<temp<<"\n";
}

}
}

The other approach was using a heap. But, could you suggest how to keep the size of a heap fixed (liked 3).

Do it this way else you wont pass test cases.
1.Make a priority_queue / heap. (min)
2.Push distances.
3.When you have a query, temporarily pop k-1 elements from heap, give the answer.

Please have a look at this short snippet.

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.