Why my code is not giviing correct output. my driver code is running fine. the problem is with the nth prime number

#include
#include
#include
#include
using namespace std;
int getseive(long long int n, int p){
for(long long int i=3; i<=n; i=i+2){
p[i]=1;
}
for(long long int i=3; i<=n; i=i+2){
if(p[i]==1){
for(int j=i
i; j<=n; j=j+i){
p[i]=0;
}
}
}
p[2]=1;
p[0]=p[1]=0;
long long int cnt=0;
for(long long int i=0;i<n; i++){
if(p[i]==1){
cnt++;
}
if(cnt==n){return i;}
}
}

int main(){
int p[1000] = {0};
stacks;
stacka;
stackb;
int n;
cin>>n;
int prime;
cin>>prime;
int data;
int itr = getseive(prime,p);
cout<<getseive(prime,p);
for(int i=0; i<n; i++){
cin>>data;
s.push(data);
}
while(!s.empty()){
if(s.top()%itr==0){
b.push(s.top());
s.pop();
}
else{
a.push(s.top());
s.pop();
}
}
while(!b.empty()){
cout<<b.top()<<endl;
b.pop();
}
while(!a.empty()){
cout<<a.top()<<endl;
a.pop();
}
}

Hello @dishant_rahangdale,

Please share code using the IDE: https://ide.codingblocks.com/

Cross verify your code with the following:

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.