Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = n%8
t = n//k
ans = [[2,3,4,6,8,9,10,12],[6],[6,12],[2,6,12],[2,4,8,10],[2,4,6,8,10],[2,3,4,8,9,10],[2,3,4,6,8,9,10]][k]
if k == 0:
  for i in ranke(1,t):
    ans.append(i * 12 + 2)
    ans.append(i * 12 + 3)
    ans.append(i * 12 + 4)
    ans.append(i * 12 + 6)
    ans.append(i * 12 + 8)
    ans.append(i * 12 + 9)
    ans.append(i * 12 + 10)
    ans.append(i * 12 + 12)
else:
  for i in ranke(1,t+1):
    ans.append(i * 12 + 2)
    ans.append(i * 12 + 3)
    ans.append(i * 12 + 4)
    ans.append(i * 12 + 6)
    ans.append(i * 12 + 8)
    ans.append(i * 12 + 9)
    ans.append(i * 12 + 10)
    ans.append(i * 12 + 12)
print(*ans)

Fixed submission:
n = int(input())
k = n%8
t = n//8
if n == 3:
  print(*[2,5,63])
  quit()
ans = [[2,3,4,6,8,9,10,12],[6],[3,9],[3,6,9],[2,3,9,10],[2,3,6,9,10],[2,3,4,8,9,10],[2,3,4,6,8,9,10]][k]
if k == 0:
  for i in range(1,t):
    ans.append(i * 12 + 2)
    ans.append(i * 12 + 3)
    ans.append(i * 12 + 4)
    ans.append(i * 12 + 6)
    ans.append(i * 12 + 8)
    ans.append(i * 12 + 9)
    ans.append(i * 12 + 10)
    ans.append(i * 12 + 12)
else:
  for i in range(1,t+1):
    ans.append(i * 12 + 2)
    ans.append(i * 12 + 3)
    ans.append(i * 12 + 4)
    ans.append(i * 12 + 6)
    ans.append(i * 12 + 8)
    ans.append(i * 12 + 9)
    ans.append(i * 12 + 10)
    ans.append(i * 12 + 12)
print(*ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
lis = [0] + list(map(int,input().split())) + [0]
b = 0
for i in range(n+1):
 b += abs(lis[i+1]-lis[i])
for i in range(1,n+1):
 if lis[i-1] <= lis[i] <= lis[i+1] or lis[i-1] => lis[i] => lis[i+1]:
   print(b)
 else:
  print(b-abs(lis[i-1] - lis[i]) - abs(lis[i+1] - lis[i]) + abs(lis[i+1] - lis[i-1]))

Fixed submission:
n = int(input())
lis = [0] + list(map(int,input().split())) + [0]
b = 0
for i in range(n+1):
 b += abs(lis[i+1]-lis[i])
for i in range(1,n+1):
 if (lis[i-1] <= lis[i] <= lis[i+1]) or (lis[i+1] <= lis[i] <= lis[i-1]):
   print(b)
 else:
  print(b-abs(lis[i-1] - lis[i]) - abs(lis[i+1] - lis[i]) + abs(lis[i+1] - lis[i-1]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lis = [0] + list(map(int, input().split())) + [0]
tmp = []
for j in range(len(lis)-1):
    tmp.append(lis[j+1] - lis[j])
for i in range(len(tmp)-1):
    a = tmp[:i] + [tmp[i]+tmp[i+1]] + tmp[i+2:]
    print(sum(map(abs,a)))


Fixed submission:
n = int(input())
lis = [0] + list(map(int, input().split())) + [0]
tmp = []
for j in range(len(lis)-1):
    tmp.append(lis[j+1] - lis[j])
lis = list(map(abs,tmp))
preans = sum(lis)
for i in range(len(tmp)-1):
    print(preans - lis[i] - lis[i+1] + abs(tmp[i] + tmp[i+1]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lis = [0] + list(map(int, input().split())) + [0]
def abs(m):
  if m>0:
    return m
  return(-m)
tmp = []
for j in range(len(lis)-1):
    tmp.append(lis[j+1] - lis[j])
for i in range(len(tmp)-1):
    a = tmp[:i] + [tmp[i]+tmp[i+1]] + tmp[i+2:]
    print(sum(map(abs,a)))


Fixed submission:
n = int(input())
lis = [0] + list(map(int, input().split())) + [0]
tmp = []
for j in range(len(lis)-1):
    tmp.append(lis[j+1] - lis[j])
lis = list(map(abs,tmp))
preans = sum(lis)
for i in range(len(tmp)-1):
    print(preans - lis[i] - lis[i+1] + abs(tmp[i] + tmp[i+1]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lis = list(map(int, input().split()))
def abs(m):
  if m>0:
    return m
  return(-m)
def mysum(data):
  ans = 0
  data = [0] + data+[0]
  for j in range(len(data)-1):
    ans += abs(data[j] - data[j+1])
  return(ans)
for i in range(len(lis)):
  tmp = lis[:i] + lis[i+1:]
  print(mysum(tmp))


Fixed submission:
n = int(input())
lis = [0] + list(map(int, input().split())) + [0]
tmp = []
for j in range(len(lis)-1):
    tmp.append(lis[j+1] - lis[j])
lis = list(map(abs,tmp))
preans = sum(lis)
for i in range(len(tmp)-1):
    print(preans - lis[i] - lis[i+1] + abs(tmp[i] + tmp[i+1]))
Buggy python submission (verdict: Runtime Error):
k = list(map(int,input()))
N , M =k[0],k[1]
if N == 2 or M == 2:
  print(0)
elif N == 1 or M == 1:
  print(abs(max(N,M)-2))
else:
  print((N-2) * (M-2))

Fixed submission:
a = input()
b = input()
c = input()
print(a[0]+b[1]+c[2])
Buggy python submission (verdict: Runtime Error):
N ,M = list(map(int,input()))
if N == 2 or M == 2:
  print(0)
elif N == 1 or M == 1:
  print(abs(max(N,M)-2))
else:
  print((N-2) * (M-2))

Fixed submission:
k = list(map(int,input().split()))
N, M = k[0],k[1]
if N == 2 or M == 2:
  print(0)
elif N == 1 or M == 1:
  print(abs(max(N,M)-2))
else:
  print((N-2) * (M-2))
Buggy python submission (verdict: Runtime Error):
n = int(input())
names = []
for i in range(n):
  names.appen(input())
names = [i[0] for i in names]
nm = ["M","A","R","C","H"]
ks = [names.count(nm[i]) for i in range(5)]
ans = 0
for i in range(3):
  for j in range(i+1,4):
    for k in range(j+1,5):
      ans += i*j*k
print(ans)

Fixed submission:
n = int(input())
names = []
for i in range(n):
  names.append(input())
names = [i[0] for i in names]
nm = ["M","A","R","C","H"]
ks = [names.count(nm[i]) for i in range(5)]
ans = 0
for i in range(3):
  for j in range(i+1,4):
    for k in range(j+1,5):
      ans += ks[i] * ks[j] * ks[k]
print(ans)
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return int(a/gcd(a,b)*b)
    
n = int(input())
ans=1
for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)

Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return b * a//gcd(a,b)
    
n = int(input())
ans=1
for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
tmp = list(map(int,input().split()))
As = list(map(int,input().split()))
n,p = tmp[0],tmp[1]
o ,e  = 0,0
for i in range(n):
  if As[i] % 2:
    o += 1
  else:
    e += 1
def comb(j,k):
  if k == 1:
    return(j)
  else:
    return comb(j-1,k-1) * j / k
ans = 0
if p == 0:
  for i in range(o+1):
    if not i % 2:
      ans += int(comb(o,i))
else:
  for i in range(o+1):
    if i % 2:
      ans += int(comb(o,i))
ans *= (2 ** e)
print(ans)

Fixed submission:
tmp = list(map(int,input().split()))
As = list(map(int,input().split()))
n,p = tmp[0],tmp[1]
o ,e  = 0,0
for i in range(n):
  if As[i] % 2:
    o += 1
  else:
    e += 1
def comb(j,k):
  if k == 0:
    return(1)
  else:
    return comb(j-1,k-1) * j / k
ans = 0
if p == 0:
  for i in range(o+1):
    if not i % 2:
      ans += int(comb(o,i))
else:
  for i in range(o+1):
    if i % 2:
      ans += int(comb(o,i))
ans *= (2 ** e)
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
ans = 0
for I in range(len(s)-1):
 if s[i]!=s[i+1]:
  ans += 1
print(ans)

Fixed submission:
s=input()
ans = 0
for i in range(len(s)-1):
 if s[i]!=s[i+1]:
  ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
x=int(input())

if X==0:
  print(1)
elif x==1:
  print(0)

Fixed submission:
x=int(input())

if x==0:
  print(1)
elif x==1:
  print(0)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
a<=x<=b
c<=y<=d

print(max(int(x)*int(y)))



Fixed submission:
a, b, c, d = map(int,input().split())

print(max(a*c, a*d, b*c, b*d))
Buggy python submission (verdict: Runtime Error):
N, X, T = map(int,input().split())
C=1
  if N%X!=0:
     C=N//X+1
  else:
    C=N//X

print(C*T)
    
   

Fixed submission:
N, X, T = map(int,input().split())
C=1
if N%X!=0:
     C=N//X+1
else:
    C=N//X
 
print(C*T)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0

    for i in range(N):
        for j in range(i + 1, N):
            ans += A[i] * A[j]

    print(ans % (10**9 + 7))


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))

    s = sum(A)
    ans = 0
    mod = 10**9 + 7
    for i in A:
        ans = (ans + i * (s - i))
    print((ans // 2) % mod)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def xyz(x, y, z):
    return x**2 + y**2 + z**2 + x * y + y * z + z * x


def main():
    N = int(input())
    # print(N)

    for i in range(1, N + 1):
        ans = 0
        for x in range(1, i):
            if x**2 > i:
                break
            for y in range(1, i):
                if y**2 > i:
                    break
                for z in range(1, i):
                    if z**2 > i:
                        break
                    if i == xyz(x, y, z):
                        ans += 1
        print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    ans = [0] * (6 * 10**4 + 10)

    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                ans[x**2 + y**2 + z**2 + x * y + y * z + x * z - 1] += 1

    for i in range(N):
        print(ans[i])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = A[0]
    for i in range(1, N):
        ans *= A[i]

    print(-1 if ans > 10**18 else ans)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))

    A.sort(reverse=True)

    if 0 in A:
        print(0)
        exit()

    ans = A[0]
    for i in range(1, N):
        ans *= A[i]
        if ans > 10**18:
            print(-1)
            exit()


    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    R = [False] * (N + 1)
    D = []

    p = 1

    while True:
        if R[p]:
            break
        D.append(p)
        R[p] = True
        p = A[p - 1]

    m = D.index(p)
    c = len(D) - m

    if K <= m:
        print(D[K])
    else:
        print(D[m + K - m] % c)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    R = [False] * (N + 1)
    D = []

    p = 1

    while True:
        if R[p]:
            break
        D.append(p)
        R[p] = True
        p = A[p - 1]

    m = D.index(p)
    c = len(D) - m

    if K <= m:
        print(D[K])
    else:
        print(D[m + (K - m) % c])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))
    AB = [tuple(map(int, input().split())) for _ in range(M)]

    result = 0

    for i in range(N):
        arr = []
        for ab in AB:
            if i + 1 in ab:
                arr.extend(ab)
        H_list = [H[a - 1] for a in set(arr)]
        if H_list == []:
            result += 1
        elif H[i] == max(H_list)and H_list.count(H[i]) == 1:
            result += 1

    print(result)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))

    result = [1] * N

    for i in range(M):
        a, b = map(int, input().split())
        if H[a - 1] <= H[b - 1]:
            result[a - 1] *= 0
        if H[a - 1] >= H[b - 1]:
            result[b - 1] *= 0
    print(result.count(1))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))

    for i in range(N):
        print(Counter(A)[i + 1])


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))
    count = Counter(A)

    for i in range(N):
        print(count[i + 1])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import Counter


def main():
    N = int(input())
    S = [input() for _ in range(N)]
    S = Counter(S)

    result = []
    for key, value in S.items():
        if value == S.most_common()[0][1]:
            result.append(key)
    result.sort()
    for r in result:
        print(r)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import Counter


def main():
    N = int(input())
    S = [input() for _ in range(N)]
    S = Counter(S)

    SM = S.most_common()[0][1]
    S = sorted(S.items(), key=lambda x: [-x[1], x[0]])
    for key, value in S:
        if value == SM:
            print(key)
        else:
            break


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    p = list(map(int, input().split()))

    count = 0
    for i in range(0, n):
        for j in range(0, i + 1):
            if p[i] > p[j]:
                break
            elif j == i:
                count += 1
    print(count)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    p = list(map(int, input().split()))

    count = 0
    n_min = 0
    for i in range(0, n):
        if i == 0:
            count += 1
            n_min = p[i]
            continue
        if p[i] <= n_min:
            count += 1
            n_min = p[i]
    print(count)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    P = list(map(int, input().split()))
    cnt = 0
    pmax = P[0]
    for i in P:
        if P[i] <= pmax:
            pmax = P[i]
            cnt += 1
        print(cnt)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    p = list(map(int, input().split()))

    count = 0
    n_min = 0
    for i in range(0, n):
        if i == 0:
            count += 1
            n_min = p[i]
            continue
        if p[i] <= n_min:
            count += 1
            n_min = p[i]
    print(count)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n, m = map(int, input().split())
    ac = []
    wa = []
    wa_count = 0
    for i in range(m):
        p, s = input().split()
        if p in ac:
            continue
        else:
            if s == 'AC':
                ac.append(p)
                wa_count += wa.count(p)
            else:
                wa.append(p)
    print(len(ac), wa_count)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np


def main():
    N, M = map(int, input().split())

    AC = np.array([0] * N)
    WA = np.array([0] * N)

    for i in range(M):
        p, S = input().split()

        if AC[int(p) - 1] == 0 and S == 'WA':
            WA[int(p) - 1] += 1
        else:
            AC[int(p) - 1] = 1
    print(sum(AC), sum(AC * WA))


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n, m = map(int, input().split())
    ac = []
    wa = []
    wa_count = 0
    for i in range(m):
        p, s = input().split()
        if p in ac:
            continue
        else:
            if s == 'AC':
                ac.append(p)
            else:
                wa.append(p)
    for a in ac:
        wa_count += wa.count(a)
    print(len(ac),wa_count)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np


def main():
    N, M = map(int, input().split())

    AC = np.array([0] * N)
    WA = np.array([0] * N)

    for i in range(M):
        p, S = input().split()

        if AC[int(p) - 1] == 0 and S == 'WA':
            WA[int(p) - 1] += 1
        else:
            AC[int(p) - 1] = 1
    print(sum(AC), sum(AC * WA))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = list(map(int, input().split()))
    print(*[S.index(i + 1) + 1 for i in range(N)])


if __name__ == "__main__":
    main()


Fixed submission:
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))

    result = []
    for i, a in enumerate(A, start=1):
        result.append([i, a])
    result = sorted(result, key=lambda x: x[1])

    print(*[i for i, a in result])


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = list(map(int, input().split()))

    result = []

    for i in range(N):
        result.append(S.index(i + 1) + 1)

    print(*result)


if __name__ == "__main__":
    main()


Fixed submission:
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))

    result = []
    for i, a in enumerate(A, start=1):
        result.append([i, a])
    result = sorted(result, key=lambda x: x[1])

    print(*[i for i, a in result])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-
import numpy as np


def main():
    N, K, Q = map(int, input().split())
    result = np.array([K] * N)
    for _ in range(Q):
        a = int(input())

        result[a - 1] += 1
        result -= 1

    for r in result:
        print('Yes'if r > 0 else 'No')


if __name__ == "__main__":
    main()


Fixed submission:
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-
import numpy as np


def main():
    N, K, Q = map(int, input().split())
    result = np.array([K - Q] * N)
    for _ in range(Q):
        a = int(input())
        result[a - 1] += 1

    for r in result:
        print('Yes'if r > 0 else 'No')


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, K, Q = map(int, input().split())
    # A = [int(input()) for _ in range(Q)]
    # print(N, K, Q, A)
    P = [K] * N
    for q in range(Q):
        a = int(input())
        P[a - 1] += 1
        for i in range(N):
            if P[i] < 0:
                continue
            else:
                P[i] -= 1

    for p in P:
        if p > 0:
            print('Yes')
        else:
            print('No')


if __name__ == "__main__":
    main()


Fixed submission:
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-
import numpy as np


def main():
    N, K, Q = map(int, input().split())
    result = np.array([K - Q] * N)
    for _ in range(Q):
        a = int(input())
        result[a - 1] += 1

    for r in result:
        print('Yes'if r > 0 else 'No')


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, K, Q = map(int, input().split())
    # A = [int(input()) for _ in range(Q)]
    # print(N, K, Q, A)
    P = [K] * N
    for q in range(Q):
        a = int(input())
        P[a - 1] += 1
        for i in range(N):
            P[i] -= 1

    for p in P:
        if p > 0:
            print('Yes')
        else:
            print('No')


if __name__ == "__main__":
    main()


Fixed submission:
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-
import numpy as np


def main():
    N, K, Q = map(int, input().split())
    result = np.array([K - Q] * N)
    for _ in range(Q):
        a = int(input())
        result[a - 1] += 1

    for r in result:
        print('Yes'if r > 0 else 'No')


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-
from itertools import combinations


def main():
    N = int(input())
    S = [sorted(input()) for _ in range(N)]
    ptn = list(combinations(S, 2))
    result = 0

    for p in ptn:
        result += all([p[0] == p[1]])
    print(result)


if __name__ == "__main__":
    main()


Fixed submission:
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-
from collections import defaultdict


def main():
    N = int(input())
    dct = defaultdict(int)

    for i in range(N):
        s = input()
        sorted_s = "".join(sorted(s))
        dct[sorted_s] += 1

    ans = 0
    for k, v in dct.items():
        ans += v * (v - 1) // 2
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from copy import copy


def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    for i in range(N):
        tmp = copy(A)
        tmp[i] = 0
        print(max(tmp))


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from copy import copy


def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    A_max = copy(A)
    A_max.sort(reverse=True)

    for a in A:
        if a == A_max[0]:
            print(A_max[1])
        else:
            print(A_max[0])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    L, R = map(int, input().split())
    result = []
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            result.append(i * j % 2019)
    print(min(result))


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    L, R = map(int, input().split())
    mod = 2019

    min_mod = float("inf")

    for i in range(L, min(R, L + mod)):
        for j in range(i + 1, min(R + 1, i + 1 + mod)):
            curr_mod = i * j % mod
            min_mod = min(min_mod, curr_mod)
            if min_mod == 0:
                break

    print(min_mod)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, M = map(int, input().split())
    A = [int(input()) for _ in range(M)]

    mod = 10**9 + 7
    dp = [0] * (N + 1)
    dp[0] = 1

    for i in range(1, N + 1):
        if i in A:
            continue

        if i == 1:
            dp[1] = dp[0]
            continue

        dp[i] = dp[i - 1] + dp[i - 2]
        dp[i] %= mod

    print(dp[N])


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, M = map(int, input().split())
    A = set([int(input()) for _ in range(M)])

    mod = 10**9 + 7
    dp = [0] * (N + 1)
    dp[0] = 1

    for i in range(1, N + 1):
        if i in A:
            continue

        if i == 1:
            dp[1] = dp[0]
            continue

        dp[i] = dp[i - 1] + dp[i - 2]
        dp[i] %= mod

    print(dp[N])


if __name__ == "__main__":
    main()