Help in finding error for the problem ZUBREACH

Hello Chefs,

Will you please help me in finding error in following code, every time it is giving WA for the hidden TCs!!
Problem link : ZUBREACH Problem - CodeChef
Submissions link : CodeChef: Practical coding for everyone

for t in range(1,int(input())+1):
    m,n = map(int,input().split())
    rx,ry = map(int,input().split())
    n = int(input())
    x,y,l = 0,0,input()
    for i in l:
        if i=='L':
            x -= 1
        elif i=='R':
            x += 1
        elif i=='U':
            y += 1
        else:
            y -= 1
    if x==rx and y==ry:
        dir = 'REACHED'
    elif x<0 or x>m or y<0 or y>n:
        dir = 'DANGER'
    else:
        dir = 'SOMEWHERE'
    print('Case {}: {}'.format(t,dir))

Find the difference :slight_smile:
My Solution
Your Solution

1 Like

Thanks for the reply, I found the mistake
Have declared n 2 times

be_careful_with_variable_names_next_time_or_it_gives_wrong_output
Thanks bro and sure :hugs: :joy:

1 Like