What is wrong in my approach i got Wrong Answer?

[Div 3 Starters 7]
(MAXSWT Problem - CodeChef)

here is my solution to the problem (link above)
I got Wrong Answer Can Someone help where i made mistake

Blockquote
#include<bits/stdc++.h>

using namespace std;

int main() {
// your code goes here
//---------------------------------------
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//---------------------------------------

int t;
cin>>t;

while(t--)
{
    
	long long int n,d;
	cin>>n>>d;

	vector <long long int> pi(n);
	vector <long long int> si(n);

	for (int i = 0; i < n; ++i)
	{
		cin>> pi[i];
	}

	for (int i = 0; i < n; ++i)
	{
		cin>> si[i];
	}


	unordered_map <long long int ,long long int> price;
	for(int i = 0;i<n;i++)
	{	
		//cout<<si[i]<<' '<<pi[i]<<endl;
		price.insert( { si[i]  , pi[i] } ) ;
	}


	//cout<<"--------------\n";
	priority_queue <long long int> pq;
	for(int i = 0;i<n;i++)
	{
		pq.push( si[i] );
	}

	long long int sweet = 0;
	int c = 0;

	while(!pq.empty() )
	{	

	
		if( price[pq.top()] <= d)
		{
			sweet += pq.top();
			d -= price[pq.top()];
			pq.pop(); c++;

			if(c == 2)
				break;
		}
		else
		{
			pq.pop();
		}

	}

	cout<<sweet<<endl;
}
return 0;

}

Blockquote

whats the question?

I used two vector to store prices and their sweetness and then hashmap( sweetness , price) and since we have to maximise the sweetness by taking atmost two candies i used the priority queue to first get the candy which having maximum sweetness.

Not getting why i got Wrong Answer

consider a case like this for n = 4 and d = 6.
sweetness - 1 4 4 5
prices - 1 3 3 5
taking the candy with maximum sweetness will not be the optimal answer, try using a dp approach.