CLEANUP problem runtime error in c++ ,got right output when i used custom input provided in problem on codechef ide

#include
#include
#include
#include
using namespace std;
int main()
{
int t;
vector v,c,o,p;
cin>>t;
while(t–)
{
int n,m,j=0,flag=0,k=0,l=0;
cin>>n>>m;
v.resize(n);
c.resize(m);
if((n-m)%2==0)
{
o.resize((n-m)/2);
p.resize((n-m)/2);
}
else
{
o.resize((n-m)/2 + 1);
p.resize((n-m)/2);
}
for(int i=0;i<m;i++) cin>>c[i];
sort(c.begin(),c.end());
for(int i=0;i<n;i++)
{
if(i==c[j]-1)
{
j++;

        }
        else if(flag==0)
        {
            o[k]=i+1;
            k++;
            flag=1;
        }
        else
        {
            p[l]=i+1;
            l++;
            flag=0;
        }
    }
     
    for(int i=0;i<o.size();i++) cout<<o[i]<<" ";
    cout<<endl;
    for(int i=0;i<p.size();i++) cout<<p[i]<<" ";
    cout<<endl;
    
}

return 0;
}