https://www.codechef.com/LRNDSA01/problems/MULTHREE

What is the problem with my code

MY SOLUTION: CodeChef: Practical coding for everyone

for _ in range(int(input())):
    sum=0
    k, d0, d1 = map(int, input().split())
    if d0==5 and d1==5:
        res='NO'
    elif d0==0 or d1==0 or k<3:
        sum=d0+d1
        if sum%3 == 0:
            res='YES'
        else:
            res='NO'
    else:
        sum=d0+d1
        l1=[2,4,6,8]
        if sum%10 not in l1:
            d3=sum%10
            sum+=d3
            k-=1
        sum1=sum
        k=k-2
        if k>4:
            sum+=2*(k//4)
            k=k%4
        while k!=0:
            sum=sum+(sum1%10)
            sum1=sum1+(sum1%10)
            k-=1
        if sum%3 == 0:
            res='YES'
        else:
            res='NO'
    print(res)

Can anyone guide me on what’s the problem. I am getting the correct solution for test cases…