Why am i getting Wrong Answer?FLOW015??

using namespace std;

int main()
{
int t,i=0;
cin>>t;
vector ans(t);

`````` while(i<t)
{    int y;
cin>>y;
int x,z=0;
if(y>2001)
{    x=y-1;
for(;x>2001;x--)
{
if(x%4==0)
z++;
}
y=y-2001;
x=y+z;
for(;x>7;)
{
x-=7;
}
if(x==7)
ans[i]=1;
else if(x==1)
ans[i]=2;
else if(x==2)
ans[i]=3;
else if(x==3)
ans[i]=4;
else if(x==4)
ans[i]=5;
else if(x==5)
ans[i]=6;
else if(x==6)
ans[i]=7;
}
else if(y==2001)
{
ans[i]=1;
}
else
{    z=0;
for(x=y;x<=2001;x++)
{
if(x%4==0)
z++;
}
y=2001-y;
x=y+z;
for(;x>7;)
{
x-=7;
}
if(x==7)
ans[i]=1;
else if(x==6)
ans[i]=2;
else if(x==5)
ans[i]=3;
else if(x==4)
ans[i]=4;
else if(x==3)
ans[i]=5;
else if(x==2)
ans[i]=6;
else if(x==1)
ans[i]=7;

}
i++;
}
for(i=0;i<t;i++)
{
if(ans[i]==1)
cout<<"\nmonday";
else if(ans[i]==2)
cout<<"\ntuesday";
else if(ans[i]==3)
cout<<"\nwednesday";
else if(ans[i]==4)
cout<<"\nthursday";
else if(ans[i]==5)
cout<<"\nfriday";
else if(ans[i]==6)
cout<<"\nsaturday";
else if(ans[i]==7)
cout<<"\nsunday";
}
``````

}

one thing I notice on the fly is wrong placement of newline . It should be after the output .

Change the condition

1.Multiple of 4 but not 100

2.Multiple of 400

Check my solution Here.

Hope it will help!!

You can read the method of calculating days using oddDays on the link below

and check my small and simple solution
https://www.codechef.com/viewsolution/8785146

//