problem with my code

#include
#include
using namespace std;
int main()
{
int n;
std::cin>>n;
int a[100],b[100];
for(int j=0;j<n;j++)
{
std::cin>>a[j];
}
for(int j=0;j<n;j++)
{
std::cin>>b[j];
}
int ans[100];
int k=0;
int x[100];
x[0]=b[1];
int y[100];
y[0]=b[2];
while(k<n)
{
if(x[k]>y[k])
{
ans[k]=a[x[k]];
k++;
x[k]=(x[k-1]+7)%(n-1);
y[k]=(y[k-1]+11)n; } else if(y[k]>x[k]) { ans[k]=a[y[k]]; k++; x[k]=(x[k-1]+7)(n-1);
y[k]=(y[k-1]+11)%n;
}
}
int s=0;

for(int k=0;k<n;k++)
{s+=ans[k];
}
std::cout<<s;
return 0;

}

this code is giving right output when i was running it in koding.com but during submition in codechef why it’s showing wrong answer

Give a link to your code or format this properly.

Format your code properly and mention the problem link…