Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N= int(input())
A = list(map(int,input().split()))
A.insert(0,A[0])
A.append(0)
 
money = 1000
previous_tendency = "remain"
current_tendency = "remain"
count = 1

 
for n in range(1,len(A)-1):
    if A[n] < A[n+1]:
        current_tendency = "up"
    elif A[n] > A[n+1]:
        current_tendency = "down"
    else:
        current_tendency = "remain"
        
    if previous_tendency != "down" and current_tendency != "up":
        #print(money,n,"chance",A[n],min(A[count:n+1]),previous_tendency, current_tendency)
        money += (money//min(A[count:n+1]))*(A[n]-min(A[count:n+1]))
        #print(A[count:n+1],money)
        count = n + 1
        previous_tendency = "remain"
    #print(A[n],max_price,min_price,previous_tendency,current_tendency)
    
    if current_tendency != "remain":
      previous_tendency = current_tendency
print(money)

Fixed submission:
N = int(input())
print(10-(N//200))
Buggy python submission (verdict: Runtime Error):
N N = int(input())
A = list(map(int,input().split()))

ans = 0
for a in range(0,len(A),2):
    if A[a]% 2 == 1:
        ans += 1
print(ans)
    

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

ans = 0
for a in range(0,len(A),2):
    if A[a]% 2 == 1:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())


def count_divisors(x):
    count = 0
    for i in range(1,int(x**(1/2))+1):
        if x%i == 0:
            count += 2
        if x%i == 0 and i == x**(1/2):
            count -= 1
    return count
ans = 0
for n in range(1,N+1):
    
    ans += n * count_divisors(n)
print(ans)

Fixed submission:
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    ans = 0
    for n in range(1,N+1):
        ans += (N//n)*(2*n+(N//n-1)*n)//2
    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

ans = 0
for n in range(1,N+1):
    ans += n * len(make_divisors(n))

print(ans)


Fixed submission:
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    ans = 0
    for n in range(1,N+1):
        ans += (N//n)*(2*n+(N//n-1)*n)//2
    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sympy

N = int(input())
ans = 0
for n in range(1,N+1):
    ans += n * len(sympy.divisors(n))
print(ans)

Fixed submission:
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    ans = 0
    for n in range(1,N+1):
        ans += (N//n)*(2*n+(N//n-1)*n)//2
    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sympy

N = int(input())
ans = 0
for n in range(1,N+1):
    ans += n * len(sympy.divisors(n))
    print(n,len(sympy.divisors(n)))
print(ans)

Fixed submission:
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    ans = 0
    for n in range(1,N+1):
        ans += (N//n)*(2*n+(N//n-1)*n)//2
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
x = list(input().split())
print(15-sum(x))

Fixed submission:
x = list(map(int,input().split()))
print(15-sum(x))
Buggy python submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())
 
if K <= A:
  print(K)
elif K <= (A+B):
  print(A)
else:
  print(A-(K-(A+B)))

Fixed submission:
S = input()
T = input()

T2 = T[:len(T)-1]

if S == T2:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())

ls = [1] * A + [0] * B + [-1] * C

print(sum(ls[:K]))

Fixed submission:
A,B,C,K = map(int,input().split())
 
if K <= A:
  print(K)
elif K <= (A+B):
  print(A)
else:
  print(A-(K-(A+B)))
Buggy python submission (verdict: Time Limit Exceeded):
A, B ,N = map(int,input().split())
if B-1 <= N:
    print(A*(B-1)//B)
else:
    ans = 0
    for x in range(1,N+1):
        ans_candidate = (A*x)//B- A*(x//B)
        if ans < ans_candidate:
            ans = ans_candidate
    print(ans)


Fixed submission:
A, B ,N = map(int,input().split())
if B-1 <= N:
    print(A*(B-1)//B)
else:
    print(A*N//B)
Buggy python submission (verdict: Runtime Error):
N = input()

flag =0
if N[0] == "7":
  flag = 1
if N[1] == "7":
  flag = 1
if N[2] == "7":
  flag = 1
  
if flag = 1:
  print("Yes")
else:
  print("No")

Fixed submission:
N = input()
 
flag =0
if N[0] == "7":
  flag = 1
if N[1] == "7":
  flag = 1
if N[2] == "7":
  flag = 1
  
if flag == 1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
N = int(input())

def gcd(*numbers):
    return reduce(math.gcd, numbers)

ans =0
for a in range(1,N+1):
    for  b in range(1,N+1):
        for c in range(1,N+1):
            ans += gcd(a, b, c)
print(ans)

Fixed submission:
import math
from functools import reduce
N = int(input())

def gcd(*numbers):
    return reduce(math.gcd, numbers)


ans =0
for a in range(1,N+1,1):
    for  b in range(a,N+1,1):
        for c in range(b,N+1,1):
            if len(set([a,b,c])) == 3:
                ans += gcd(a, b, c)*6
            elif len(set([a,b,c])) == 2:
                ans += gcd(a,b,c)*3
            else:
                ans += gcd(a,b,c)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input().split()
from scipy.special import comb
C1 = comb(s[0], 2, exact=True)
C2 = comb(s[1], 2, exact=True)

print(C1 + C2)

Fixed submission:
N, M = map(int,input().split())
C1 = N*(N-1)//2
C2 = M*(M-1)//2

print(C1 + C2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

import collections
import math

dicA = collections.Counter(A)

total = 0
for x in list(dicA.values()):
  total += math.factorial(x) // (math.factorial(x - 2)*2)

for i in range(N):
  print(total - dicA[A[i]] +1)
  

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

import collections
import math

dicA = collections.Counter(A)

total = 0
for x in list(dicA.values()):
  if x != 1:
    total += math.factorial(x) // (math.factorial(x - 2)*2)

for i in range(N):
  print(total - dicA[A[i]] +1)
Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
 
dic = {}
for i in range(N):
  S = input()
  if S in dic:
    dic[S] += 1
  else:
    dic[S] = 1
maxval = max(dic.values())
 
keys = [k for k, v in dic.items() if  v == max(dic.values())]
[print(sorted(keys)[i]) for i in range(len(keys))]

Fixed submission:
A,B,C = map(int,input().split())

if A == B:
  if B!=C:
    print("Yes")
  else:
    print("No")
elif (A == C)or (B ==C):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
p = list(map(int,input().split()))

exp = [(x+1)/2 for x in p]

ans = 0
for n in range(N-K+1):
  if ans < sum(exp[n:n+K]):
    ans = sum(exp[n:n+K])
    
print(ans)

Fixed submission:
N, K = map(int,input().split())
p = list(map(int,input().split()))
 
exp = [(x+1)/2 for x in p]
 
sums = 0
ls =[0]

for n in range(N):
  sums += exp[n]
  ls.append(sums)

ans = 0
for n in range(N-K+1):

  ans_candidate = ls[n+K]-ls[n]

  if ans < ans_candidate:
    ans = ans_candidate 
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    XL = [NLI() for _ in range(N)]
    

    arm_range = []
    for n in range(N):
        arm_len = XL[1]
        arm_range.append([XL[n][0]-XL[n][1],XL[n][0]+XL[n][1]])

    
    sorted_arm_range = sorted(arm_range, key=lambda x: x[1])  #[1]に注目してソート

    
    x = 0
    ans = 1
    while x<N-1:
        arm_end = sorted_arm_range[x][1]
        while x<N-1 and sorted_arm_range[x+1][0] < arm_end:
            x += 1
        ans += 1
        x += 1
        
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    XL = [NLI() for _ in range(N)]
    
    #print(XL)
    arm_range = []
    for n in range(N):
        arm_range.append([XL[n][0]-XL[n][1],XL[n][0]+XL[n][1]])
    #print(arm_range)
    
    sorted_arm_range = sorted(arm_range, key=lambda x: x[1])  #[1]に注目してソート
    #print(sorted_arm_range)
    
    ans = 1
    arm_end = sorted_arm_range[0][1]
    
    if N == 1:
        ans = 1
    else:
        for n in range(N-1):
            if sorted_arm_range[n+1][0] >= arm_end:
                arm_end = sorted_arm_range[n+1][1]
                ans += 1

    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int,input())

if (A-B)%2 == 0:
  print((A-B)//2)
else:
  print(min(max(N-A,N-B),max(A-1,B-1)))

Fixed submission:
N, A, B = map(int,input().split())

if (A-B)%2 == 0:
  print(abs(A-B)//2)
else:
  print(min((A+B-1)//2,(2*N-(A+B)+1)//2))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =list(map(int,input()))

ans = [[[0 for _ in range(10)] for _ in range(10)]for _ in range(10)]
ans_total = 0

for i,s in enumerate(S):
  Xoo = list(set(S[:i]))
  ooX = list(set(S[i+1:]))
  #print(s,Xoo,ooX)
  for r in Xoo:
    for t in ooX:
      #print(r,s,t)
      if ans[r][s][t] == 0:
        ans_total += 1
      ans[r][s][t] = 1
  if ans_total == 999:
    break
print(ans_total)

Fixed submission:
N = int(input())
S =list(map(int,input()))

ans = 0

for x in [0,1,2,3,4,5,6,7,8,9]:
  if x in S:
    x_index = S.index(x)
    for y in [0,1,2,3,4,5,6,7,8,9]:
      if y in S[x_index+1:]:
        y_index = S[x_index+1:].index(y)
        for z in [0,1,2,3,4,5,6,7,8,9]:
          if z in S[x_index + 1 + y_index+1:]:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int,input())

C = A- 2*B

if C >=0:
  print(C)
else:
  print(0)

Fixed submission:
A, B = map(int,input().split())
 
C = A- 2*B
 
if C >=0:
  print(C)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

inner_difference = 0
  
if len(set(list(S))) == 1:
  print(K*len(S)//2)
else:
  i = 0
  while i < len(S)-1:
    if S[i] == S[i+1]:
      inner_difference += 1
      i += 1
    i += 1

  if (S[0] != S[-1])or(S[0]==S[1])or(S[N-1]==S[N-2]):
    print(inner_difference*K)
  else:
    print(inner_difference*K + K-1)

Fixed submission:
S = input()
K = int(input())
 
INNER = 0
  
if len(set(list(S))) == 1:
  print(K*len(S)//2)
else: 
  i = 0
  while i < len(S)-1:
    if S[i] == S[i+1]:
      INNER += 1
      i += 1
    i += 1
  
  if (S[0] != S[-1]):#最初の文字と最後の文字が違うなら、
    print(INNER*K)
  else:
    same_from_start = 0
    same_from_end = 0
    
    count_from_start = 0
    count_from_end = 0
    
    flag_same_from_start = 0
    flag_same_from_end = 0
    
    while flag_same_from_start == 0:
      if S[count_from_start] == S[count_from_start+1]:
        count_from_start += 1
      else:
        count_from_start += 1
        flag_same_from_start = 1
    
    while flag_same_from_end == 0:
      if S[len(S)-count_from_end-1] == S[len(S)-count_from_end-2]:
        count_from_end += 1
      else:
        count_from_end += 1
        flag_same_from_end = 1
    print(INNER*K + (K -1) * ((count_from_start+count_from_end)//2 -\
                              count_from_start//2- count_from_end//2))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [''.join(sorted(list(input()))) for _ in range(N)]

ans = 0
for n in range(1,N):
  if a[n] in a[:n]:
    ans += a[:n].count(a[n])
print(ans)

Fixed submission:
N = int(input())
a = [''.join(sorted(list(input()))) for _ in range(N)]
import collections
c = collections.Counter(a)
c_ls = list(c.values())
ans = 0
for i in range(len(c_ls)):
  ans += c_ls[i] * (c_ls[i]-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [sorted(list(input())) for _ in range(N)]

ans = 0
for n in range(1,N):
  if a[n] in a[:n]:
    ans += a[:n].count(a[n])
print(ans)

Fixed submission:
N = int(input())
a = [''.join(sorted(list(input()))) for _ in range(N)]
import collections
c = collections.Counter(a)
c_ls = list(c.values())
ans = 0
for i in range(len(c_ls)):
  ans += c_ls[i] * (c_ls[i]-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B C = map(int,input().split())

if (A-B)>=C:
  print(C)
else:
  print(A-B)

Fixed submission:
A, B ,C = map(int,input().split())
 
if (A-B)>=C:
  print(0)
else:
  print(C-(A-B))
Buggy python submission (verdict: Runtime Error):
N, A, B= map(int,input().split())

print(min(N*A, B)

Fixed submission:
N, A, B= map(int,input().split())
 
print(min(N*A, B))
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int,input().split()
import fractions
lcm = C*D//fractions.gcd(C,D)
print((B-B//C-B//D+ B//lcm)-((A-1) - (A-1)//C - (A-1)//D + (A-1)//lcm))

Fixed submission:
A, B, C, D = map(int,input().split())
import fractions
lcm = C*D//fractions.gcd(C,D)
print((B-B//C-B//D+ B//lcm)-((A-1) - (A-1)//C - (A-1)//D + (A-1)//lcm))
Buggy python submission (verdict: Runtime Error):
import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():

    N, K = NMI()
    A = NLI()
    
    left = 0
    shakutori = 0
    ans = 0
    
    for left in range(N):
        shakutori = 0
        right = left
        
        while shakutori < K and right <N:
            shakutori += A[right]
            right+= 1
            
        if shakutori >= K:
            ans += N-right+1
        else:
            break
        
    print(ans)
    


if __name__ == '__main__':
    main()

Fixed submission:
X, A = map(int,input().split())

if X>=A:
  print(10)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
N, A, B,C,D = map(int,input().split())
S = list(input())

a = A-1
b = B-1
c = C-1
d = D-1

ans = 1

for i_a in range(a,C):
  #2連続の##がa~Cにないことを確認
  if S[i_a] == "#":
    if S[i_a+1] == "#":
      ans =0

for i_b in range(b,D):
  #2連続の##がb~Dにないことを確認
  if S[i_b] == "#":
    if S[i_b+1] == "#":
      ans =0

if D < C:
  ans = 0
  for i in range(b-1,D+1):
    #3連続があるなら1
    if S[i] == ".":
      if S[i+1] == ".":
        if S[i+2] == ".":
          ans = 1

if ans ==1:
  print("Yes")
else:
  print("No")


Fixed submission:
N, A, B,C,D = map(int,input().split())
S = list(input())

a = A-1
b = B-1
c = C-1
d = D-1

ans = 1

for i_a in range(a,C):
  #2連続の##がa~Cにないことを確認
  if S[i_a] == "#":
    if S[i_a+1] == "#":
      ans =0

for i_b in range(b,D):
  #2連続の##がb~Dにないことを確認
  if S[i_b] == "#":
    if S[i_b+1] == "#":
      ans =0

if D < C:
  ans = 0
  for i in range(b,D):
    #3連続があるなら1
    if S[i-1] == ".":
      if S[i] == ".":
        if S[i+1] == ".":
          ans = 1

if ans ==1:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N, A, B,C,D = map(int,input().split())
S = list(input())

a = A-1
b = B-1
c = C-1
d = D-1

ans = 1

for i_a in range(a,C):
  #2連続の##がa~Cにないことを確認
  if S[i_a] == "#":
    if S[i_a+1] == "#":
      ans =0

for i_b in range(b,D):
  #2連続の##がb~Dにないことを確認
  if S[i_b] == "#":
    if S[i_b+1] == "#":
      ans =0

if D < C:
  ans = 0
  for i in range(b-1,D+1):
    #3連続があるなら1
    if S[i] == ".":
      if S[i+1] == ".":
        if S[i+2] == ".":
          ans = 1

if ans =1:
  print("Yes")
else:
  print("No")

Fixed submission:
N, A, B,C,D = map(int,input().split())
S = list(input())

a = A-1
b = B-1
c = C-1
d = D-1

ans = 1

for i_a in range(a,C):
  #2連続の##がa~Cにないことを確認
  if S[i_a] == "#":
    if S[i_a+1] == "#":
      ans =0

for i_b in range(b,D):
  #2連続の##がb~Dにないことを確認
  if S[i_b] == "#":
    if S[i_b+1] == "#":
      ans =0

if D < C:
  ans = 0
  for i in range(b,D):
    #3連続があるなら1
    if S[i-1] == ".":
      if S[i] == ".":
        if S[i+1] == ".":
          ans = 1

if ans ==1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())


LR = [list(map(int,input().split())) for _ in range(M)]

set_ans = set(range(int(LR[0][0]),int(LR[0][1]+1)))
for m in range(1,M):
  set_ans = set_ans & set(range(int(LR[m][0]),int(LR[m][1])+1))
  if len(set_ans) == 0:
    break
print(len(set_ans))

Fixed submission:
N, M = map(int,input().split())


LR = [list(map(int,input().split())) for _ in range(M)]


    

L = [x[0] for x in LR]
R = [x[1] for x in LR]


if  min(R) - max(L)>=0:
  print(min(R)-max(L)+1)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = map(int,input().split())

ans = 0
balls = N
for r in range(0,(balls//R)+1):
  balls_r = balls - R*r
  for g in range(0,(balls//G)+1):
    balls_g = balls_r - G*g
    if (balls_g >= 0) and (balls_g % B == 0):
      ans += 1

print(ans)

Fixed submission:
R,G,B,N = map(int,input().split())

ans = 0
balls = N
for r in range(0,(balls//R)+1):
  balls_r = balls - R*r
  for g in range(0,(balls_r//G)+1):
    balls_g = balls_r - G*g
    if (balls_g >= 0) and (balls_g % B == 0):
      ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = map(int,input().split())

ans = 0
balls = N
for r in range(0,(balls//R)+1):
  balls_r = balls - R*r
  for g in range(0,(balls//G)+1):
    balls_g = balls_r - G*g
    for b in range(0,(balls//B)+1):
      balls_b = balls_g - B*b

      if balls_b == 0:
        ans += 1

print(ans)

Fixed submission:
R,G,B,N = map(int,input().split())

ans = 0
balls = N
for r in range(0,(balls//R)+1):
  balls_r = balls - R*r
  for g in range(0,(balls_r//G)+1):
    balls_g = balls_r - G*g
    if (balls_g >= 0) and (balls_g % B == 0):
      ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
A,B =map(int,input().split())

print(max(A*2-1,A+B,B*2-1)

Fixed submission:
A,B =map(int,input().split())
 
print(max(A*2-1,A+B,B*2-1))
Buggy python submission (verdict: Runtime Error):
b=input()

if b = 'A':
  print("T")
elif b = 'T':
  print('A')
elif b = 'C':
  print('G')
elif b = 'G':
  print('C')

Fixed submission:
b=input()
 
if b == 'A':
  print("T")
elif b == 'T':
  print('A')
elif b == 'C':
  print('G')
elif b == 'G':
  print('C')
Buggy python submission (verdict: Runtime Error):
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    h = NLI()
    
    dp = [0 for _ in range((10**5)+10)]
    dp[0] = 0
    dp[1] = abs(h[1]-h[0])
    
    for n in range(2,N):
        dp[n] = min(dp[n-2]+abs(h[n]-h[n-2]),dp[n-1]+abs(h[n]-h[n-1]))
    print(dp[n])


if __name__ == '__main__':
    main()

Fixed submission:
import sys
import math
import itertools
import collections
from collections import deque
 
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
 
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()
 
def main():
    N = NI()
    h = NLI()
    
    dp = [0 for _ in range((10**5)+10)]
    dp[0] = 0
    dp[1] = abs(h[1]-h[0])
    
    for n in range(2,N):
        dp[n] = min(dp[n-2]+abs(h[n]-h[n-2]),dp[n-1]+abs(h[n]-h[n-1]))
    print(dp[N-1])
 
 
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
s = input()

if len(s) == 2:
  print(s)
else:
  print("".join(list(reverse(s))))

Fixed submission:
s = input()
 
if len(s) == 2:
  print(s)
else:
  print("".join(list(reversed(s))))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()

for n in range(len(S)):
  S = S.translate(str.maketrans({S[n]:T[n],T[n]:S[n]}))
if S == T :
  print("Yes")
else:
  print("No")


Fixed submission:
import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    S = SI()
    T = SI()
    
    
    ord_S = [0 for _ in range(26)]
    ord_T = [0 for _ in range(26)]
    
    for n in range(len(S)):
        ord_S[ord(S[n])-97] += 1
        ord_T[ord(T[n])-97] += 1
    
    
    s_ord_S = sorted(ord_S)
    s_ord_T = sorted(ord_T)
    
    for p in range(26):
        if s_ord_S[p] != s_ord_T[p]:
            print("No")
            sys.exit()
    print("Yes")
        

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()

for n in range(len(S)):
  S = S.translate(str.maketrans({S[n]:T[n],T[n]:S[n]}))
if S == T :
  print("Yes")
else:
  print("No")


Fixed submission:
import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    S = SI()
    T = SI()
    
    
    ord_S = [0 for _ in range(26)]
    ord_T = [0 for _ in range(26)]
    
    for n in range(len(S)):
        ord_S[ord(S[n])-97] += 1
        ord_T[ord(T[n])-97] += 1
    
    
    s_ord_S = sorted(ord_S)
    s_ord_T = sorted(ord_T)
    
    for p in range(26):
        if s_ord_S[p] != s_ord_T[p]:
            print("No")
            sys.exit()
    print("Yes")
        

if __name__ == '__main__':
    main()