Need Help! my code is successfully compiled but not getting submitted

my code

    t = int(input())
    temp = 0
    c = []
    for i in range(t):
        x, y = map(int, input().split())
        d = x-y
        if d >= 0:
            d = abs(d)
        if temp < d:
            temp = d
    for i,j in c:
        if j == temp:
            print('{} {}'.format(i,j))

except : pass

I have used try, except as codechef giving me nzec exception everytime.

Parth add this to your previous thread and continue there no need of creating new thread for same topic .
[Need Help! my code is successfully compiled but not getting submitted due to TLE - #6 by parth111]

ok sure, but what is the problem with this code shown above?

I think your logic is wrong here @parth111 …I tried with your code and it is giving wrong answer on submit…in the example case u will get the maximum difference for the first one itself so it giving crct answer for that…u need to change ur logic and u need to find the difference of current turn by depending on the previous turn…

It shouldn’t do - are you trying to “Run” without Providing “Custom Input”?

Anyway, see e.g. WA for my program (TLG) - #2 by ssjgz

1 Like

how to add new thread to the topic please tell?

Thanks i got the meaning of question now and i tried even with custom inputs but still nzec exception persists that’s why i have to use try and except.

Same Issue With My Code.
Any Explanation Appreciated.

TW = 1
W = 1
ML = 0
for tc in range(int(input()):
    N, K = map(int, input().split(" "))
    if K > N:
        K, N = N, K
        TW = 2
    L = K - N
    if ML < L:
        ML = L
        W = TW
print(f"{W} {TW}")