MULTHREE help needed

https://www.codechef.com/LRNDSA01/problems/MULTHREE
I have seen the hint given for this question

#include <bits/stdc++.h>
using namespace std;

#define lld long long int 

int main() {
	// your code goes here
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin>>t;
    while(t--){
    lld i=1,val,k,a,b,sum=0,res=0;
    cin>>k>>a>>b;
    res=(k-2)%4;
    for(int j=1;j<=res;j++)
    i*=2;
    if(res==0&&k>2)
    i=6;
    val=i*(a+b);
    //cout<<val;
    if(val%3==0)
    cout<<"YES\n";
    else
    cout<<"NO\n";}
}

I am getting WA. What is the error?
@everule1 @ssjgz