Help me in solving NETFLIX problem

My issue

cook your dish here

n=int(input())
d=
for i in range(n):
d=list(map(int,input().split()))

count=0
for i in range(len(d)):
    l1=d[i]
    for j in range(len(d)-1):
        if l1+d[j]==d[-1] and i!=j:
            count=1
            break
        else:
            if (d[j]>=d[-1]):
                count=1 
                break
if count==0:
    print("NO")
else:
    print("YES") 

My code

# cook your dish here
n=int(input())
d=[]
for i in range(n):
    d=list(map(int,input().split()))
    
    count=0
    for i in range(len(d)):
        l1=d[i]
        for j in range(len(d)-1):
            if l1+d[j]==d[-1] and i!=j:
                count=1
                break
            else:
                if (d[j]>=d[-1]):
                    count=1 
                    break
    if count==0:
        print("NO")
    else:
        print("YES")

Learning course: 500 difficulty rating
Problem Link: Netflix Practice Problem in - CodeChef

@viswanadh10
logic is if the sum of highest and second highest element is greater than x then print yes else print no.