# Why i'm getting WA for "partition It"(PARPERM)?

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

bool prime[100004];

ll gcd(ll a, ll b)
{
if (b == 0)
return a;
return gcd(b, a % b);

}

void Sieve(int n)
{
// Create a boolean array
// “prime[0…n]” and initialize
// all entries it as true.
// A value in prime[i] will
// finally be false if i is
// Not a prime, else true.
memset(prime, true, sizeof(prime));

``````for (int p = 2; p * p <= n; p++)
{
// If prime[p] is not changed,
// then it is a prime
if (prime[p] == true)
{
// Update all multiples
// of p greater than or
// equal to the square of it
// numbers which are multiple
// of p and are less than p^2
for (int i = p * p; i <= n; i += p)
prime[i] = false;
}
}
``````

}

void solve(){

``````        ll n,k;
cin >> n >> k;

ll prim[n+1];
memset(prim,0,sizeof(prim));

Sieve(n);

prim[1] = 1;
prime[1] = true;

for(int i=2;i<=n;i++){
if(prime[i])
{
if(i*2 <= n){
prim[i] += prim[i-1];
prime[i] = false;
}
else{
prim[i] += prim[i-1]+1;
}
}
else{
prim[i] = prim[i-1];
}
}

ll total = prim[n],count = 0;

if(k  > total){
cout << "NO\n";
return;
}

cout << "YES\n";
for(int i=1;i<=n;i++){
if(prime[i] and count < k)
{
cout << i << " ";
count++;
}

if(count >= k)
break;
}

cout << endl;
``````

}

int main() {

``````       ll t = 1;
cin >> t;

while(t--){
solve();
}

return 0;
``````

}