I used this code for the problem (https://www.spoj.com/problems/TEAMNIM/)
// first second push_back unordered return continue break vector visited check flag bool while iterator begin end lower_bound upper_bound temp true false ll_MAX ll_MIN insert erase clear pop push compare ll64_MAX ll64_MIN reverse replace stringstream string::npos length substr front priority_queue
#include <bits/stdc++.h>
using namespace std;
#define debug(...) 42
#define ll long long
#define pb(x) push_back(x);
#define ce(x) cout << x << '\n';
using pll = pair < ll, ll >;
#define scan(a, n) for(int i = 0; i < n; i++)cin >> a[i];
#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a) (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
#define infl LLONG_MAX
#define tc(tt) \
ll tt; \
cin >> tt; \
for (ll _tt = 0; _tt < tt; _tt++) // testcase
string en = "Elayne/Nynaeve", ab = "Aviendha/Birgitte";
int32_t main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll t, i, x, j, y, z, k, n;
tc(tt) {
std::array<int, 3> a;
rep(i, 0, 3, 1) cin >> a[i];
std::vector<string> v(4);
rep(i, 0, 4, 1) cin >> v[i];
rep(i, 0, 4, 1) {
if (v[i] == "Elayne") x = i;
else if (v[i] == "Nynaeve") y = i;
}
debug(x, y, v);
if (abs(x - y) == 1) {
if (x == 0 or y == 0 or x == 1 or y == 1) cout << en;
else cout << ab;
} else if (abs(x - y) == 2) {
z = a[0] ^ a[1] ^ a[2];
if (z) {
if (x == 0 or y == 0) cout << en;
else cout << ab;
} else {
if (x == 0 or y == 0) cout << ab;
else cout << en;
}
} else {
if (x == 0 or y == 0)
cout << ab;
else cout << en;
}
ce("");
}
}
But got WA can someone please help me find out why I am wrong?