Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = [int(nq) for nq in input().split()]
AB = []
for i in range(N):
  AB.append([])
for i in range(N - 1):
  a, b = [int(ab) for ab in input().split()]
  AB[a - 1].append(b)
  AB[b - 1].append(a)

P, X = [], []
for j in range(Q):
  p, x = [int(px) for px in input().split()]
  P.append(p)
  X.append(x)

Score = [0] * N
for j in range(Q):
  Score[P[j] - 1] += X[j]

Now = [1]
cnt = 1
while cnt < N:
  for nw in Now:
    for nxt in AB[nw - 1]:
      Score[nxt - 1] += Score[nw - 1]
      AB[nxt - 1].remove(nw)
      Now.append(nxt)
      cnt += 1
    Now.remove(nw)

print(*Score)

Fixed submission:
N, Q = [int(nq) for nq in input().split()]
AB = []
for i in range(N):
  AB.append([])
for i in range(N - 1):
  a, b = [int(ab) for ab in input().split()]
  AB[a - 1].append(b)
  AB[b - 1].append(a)

P, X = [], []
for j in range(Q):
  p, x = [int(px) for px in input().split()]
  P.append(p)
  X.append(x)

Score = [0] * N
for j in range(Q):
  Score[P[j] - 1] += X[j]

Exists = [0] * N

Now = []
Next = [1]
Exists[1 - 1] = 1

while Next != []:
  Now = Next
  Next = []
  for nw in Now:
    for nxt in AB[nw - 1]:
      if Exists[nxt - 1] == 0:
        Exists[nxt - 1] = 1
        Score[nxt - 1] += Score[nw - 1]
        Next.append(nxt)

print(*Score)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for n in range(N):
  s = [ss for ss in input()]
  s.sort()
  s_join = "".join(s)
  S.append(s_join)

S_set = list(set(S))
ans = 0
for ss in S_set:
  howmany_ss = S.count(ss)
  if howmany_ss == 1:
    continue
  else:
    ans += sum(range(1, howmany_ss))
    
print(ans)

Fixed submission:
N = int(input())
S = {}
for n in range(N):
  s = [ss for ss in input()]
  s.sort()
  s_join = "".join(s)
  if s_join not in S.keys():
    S[s_join] = 1
  else: #s_join in S.keys():
    S[s_join] += 1

ans = 0
for k in S.values():
  if k == 1:
    continue
  else:
    ans += sum(range(1, k))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for n in range(N):
  s = [ss for ss in input()]
  s.sort()
  S.append(s)

ans = 0
for i in range(0, len(S)-1):
  for j in range(i+1, len(S)):
    if S[i] == S[j]:
      ans += 1
print(ans)

Fixed submission:
N = int(input())
S = {}
for n in range(N):
  s = [ss for ss in input()]
  s.sort()
  s_join = "".join(s)
  if s_join not in S.keys():
    S[s_join] = 1
  else: #s_join in S.keys():
    S[s_join] += 1

ans = 0
for k in S.values():
  if k == 1:
    continue
  else:
    ans += sum(range(1, k))

print(ans)
Buggy python submission (verdict: Runtime Error):
print((input()**2)*3)

Fixed submission:
print((int(input())**2)*3)
Buggy python submission (verdict: Runtime Error):
A, B, C, D = [int(e) for e in input().split()]

import math
G = math.gcd(C, D)

A_B = []
for AB in [A-1, B]:
  AB_c = AB // C
  AB_d = AB // D
  AB_g = AB // G
  A_B.append(AB_c + AB_d - AB_g)
can_divide = A_B[1] - A_B[0]
ans = (B - (A-1)) - can_divide
print(ans)

Fixed submission:
A, B, C, D = [int(e) for e in input().split()]
E = max(C, D)
F = min(C, D)

mod = 1
while mod > 0:
  mod = E % F
  if mod == 0:
    break
  else:
    E = F
    F = mod
G = C*D // F

A_B = []
for AB in [A-1, B]:
  AB_c = AB // C
  AB_d = AB // D
  AB_g = AB // G
  A_B.append(AB_c + AB_d - AB_g)
can_divide = A_B[1] - A_B[0]
ans = (B - (A-1)) - can_divide
print(ans)
Buggy python submission (verdict: Runtime Error):
X, A = [int(xa) for xa input().split()]
if X < A:
  print(0)
else:
  print(10)

Fixed submission:
X, A = [int(xa) for xa in input().split()]
if X < A:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = [int(w) for w in input().split
ans = 10000000
for t in range(N):
  less_T = W[:t]
  more_T = W[t:]
  S_l = sum(less_T)
  S_m = sum(more_T)
  d = abs(S_l - S_m)
  if ans > d:
     ans = d
print(ans)

Fixed submission:
N = int(input())
W = [int(w) for w in input().split()]
ans = 100000000
for t in range(N):
  less_T = W[:t]
  more_T = W[t:]
  S_l = sum(less_T)
  S_m = sum(more_T)
  d = abs(S_l - S_m)
  if ans > d:
     ans = d
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
Group = [N, 0, 0, 0, 0, 0]
X = [0] * 6
Y = [0] * 6
Method = [A, B, C, D, E]
T = 0
while Group[len(Method)] < N:
    for i in range(len(Method)):
        if Group[i]<=Method[i]:
            X[i+1] = Group[i]
            X[i] = 0
        else:
            X[i+1] = Method[i]
            X[i] = Group[i] - Method[i]
        Y[i] = Y[i] + X[i]
        Y[i+1] = Y[i+1] + X[i+1]
        X[i] = 0
        X[i+1] = 0
    Group[0] = Y[0]
    Group[1] = Y[1]
    Group[2] = Y[2]
    Group[3] = Y[3]
    Group[4] = Y[4]
    Group[5] = Group[5] + Y[5]
    Y = [0] * 6
    T += 1
print(T)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
M = min(A, B, C, D, E)
X = N // M
if N % M == 0:
    X = X - 1
print(5 + X)
Buggy python submission (verdict: Runtime Error):
S = input()
ACGT = ["A", "C", "G", "T"]
count = 0
mx = 0
if S[0] in ACGT:
    count += 1
if len(S) >= 2:
    for i in range(len(S)-1):
        if S[i] in ACGT and S[i+1] in ACGT:
            count += 1
        else:
            ans = max(mx, count)
            count = 0
            mx = ans
print(ans)

Fixed submission:
S = input()
ACGT = ["A", "C", "G", "T"]
K = []
for i in range(len(S)):
    if S[i] in ACGT:
        K.append(i)
if len(K) == 0:
    ans = 0
elif len(K) == 1:
    ans = 1
else:
    count = 0
    mx = 0
    for j in range(len(K)-1):
        if K[j+1]-K[j] == 1:
            count += 2
        else:
            ans = max(count, mx)
            count = 0
            mx = ans
    ans = max(count, mx)
    ans = ans/2 + 1
print(int(ans))

Buggy python submission (verdict: Runtime Error):
S = input()
ACGT = ["A", "C", "G", "T"]
count = 0
mx = 0
if S[0] in ACGT:
    count += 1
for i in range(len(S)-1):
    if S[i+1] in ACGT:
        if S[i] in ACGT:
            count += 1
        else:
            count = 1
    else:
        ans = max(mx, count)
        count = 0
        mx = ans
print(ans)

Fixed submission:
S = input()
ACGT = ["A", "C", "G", "T"]
K = []
for i in range(len(S)):
    if S[i] in ACGT:
        K.append(i)
if len(K) == 0:
    ans = 0
elif len(K) == 1:
    ans = 1
else:
    count = 0
    mx = 0
    for j in range(len(K)-1):
        if K[j+1]-K[j] == 1:
            count += 2
        else:
            ans = max(count, mx)
            count = 0
            mx = ans
    ans = max(count, mx)
    ans = ans/2 + 1
print(int(ans))

Buggy python submission (verdict: Runtime Error):
S = input()
ACGT = ["A", "C", "G", "T"]
count = 0
mx = 0
if S[0] in ACGT:
    count += 1
for i in range(len(S)-1):
    if S[i+1] in ACGT:
        if S[i] in ACGT:
            count += 1
    else:
        ans = max(mx, count)
        count = 0
        mx = ans
print(ans)

Fixed submission:
S = input()
ACGT = ["A", "C", "G", "T"]
K = []
for i in range(len(S)):
    if S[i] in ACGT:
        K.append(i)
if len(K) == 0:
    ans = 0
elif len(K) == 1:
    ans = 1
else:
    count = 0
    mx = 0
    for j in range(len(K)-1):
        if K[j+1]-K[j] == 1:
            count += 2
        else:
            ans = max(count, mx)
            count = 0
            mx = ans
    ans = max(count, mx)
    ans = ans/2 + 1
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(nm) for nm in input().split()]
AB = []
for n in range(N):
  A, B = [int(ab) for ab in input().split()]
  AB.append([A, B])
money = 0
while M > 0:
  AB_mn = min(AB)
  Ai, Bi = AB_mn[0], AB_mn[1]
  if Bi <= M:
    money += Ai * Bi
    M -= Bi
  else:
    money += Ai * M
    M = 0
  AB.remove(AB_mn)
print(money)

Fixed submission:
N, M = [int(nm) for nm in input().split()]
AB = []
for n in range(N):
  A, B = [int(ab) for ab in input().split()]
  AB.append([A, B])
AB.sort()
money = 0
while M > 0:
  Ai, Bi = AB[0][0], AB[0][1]
  if Bi <= M:
    money += Ai * Bi
    M -= Bi
  else:
    money += Ai * M
    M = 0
  AB.remove(AB[0])
print(money)
Buggy python submission (verdict: Runtime Error):
A, B, K = [int(akb) for akb in input().split()]
a, b = min(A, B), max(A, B)
r = b % a
while r > 0:
  b = a
  a = r
  r = b % a
gcd = a
ans = a
if K > 1:
  for i in range(100):
    if gcd % (i+1) == 0:
      ans = gcd / i
      K -= 1
    if K == 1:
      break
print(ans)

Fixed submission:
A, B, K = [int(akb) for akb in input().split()]
a, b = min(A, B), max(A, B)
r = b % a
while r > 0:
  b = a
  a = r
  r = b % a
gcd = a
ans = a
if K > 1:
  for i in range(1, 100):
    if gcd % (i+1) == 0:
      ans = gcd / (i+1)
      K -= 1
    if K == 1:
      break
print(int(ans))
Buggy python submission (verdict: Runtime Error):
N, M = [int(nm) for nm in input().split()]
for n in range(N):
  KA = [int(ka) for ka in input().split()]
  for ka in range(len(KA)-1):
    L.append(KA[ka+1])
like = 0
for m in range(M):
  if L.count(m+1) == N:
    like += 1
print(like)

Fixed submission:
N, M = [int(nm) for nm in input().split()]
L = []
for n in range(N):
  KA = [int(ka) for ka in input().split()]
  for ka in range(len(KA)-1):
    L.append(KA[ka+1])
like = 0
for m in range(M):
  if L.count(m+1) == N:
    like += 1
print(like)
Buggy python submission (verdict: Runtime Error):
N = input()

l = len(N)
ans = 0
#各桁を「数字無し（０）」「７（１）」「５（２）」「３（３）」で記述するような4進数を作る
for n in range(1, 4**l):
  n4 = ""
  while n > 0:
    mod = n % 4
    n4 = str(mod) + n4
    n //= 4
  
  if "0" in n4:
    continue
  
  if ("1" in n4) and ("2" in n4) and ("3" in n4):
    n4_10 = ""
    for i in range(len(n4)):
      if n4[i] == "1":
        n4_10 = n4_10 + "7"
      elif n4[i] == "2":
        n4_10 = n4_10 + "5"
      else:
        n4_10 = n4_10 + "3"
    if int(n4_10) =< int(N):
      ans += 1

print(ans)

Fixed submission:
N = input()

l = len(N)
ans = 0
#各桁を「数字無し（０）」「７（１）」「５（２）」「３（３）」で記述するような4進数を作る
for n in range(1, 4**l):
  n4 = ""
  while n > 0:
    mod = n % 4
    n4 = str(mod) + n4
    n //= 4
  
  if "0" in n4:
    continue
  
  if ("1" in n4) and ("2" in n4) and ("3" in n4):
    n4_10 = ""
    for i in range(len(n4)):
      if n4[i] == "1":
        n4_10 = n4_10 + "7"
      elif n4[i] == "2":
        n4_10 = n4_10 + "5"
      else:
        n4_10 = n4_10 + "3"
    if int(n4_10) <= int(N):
      ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()
for i in range(0, len(S)-1):
  for j in range(i+1, len(S)):
    if (S[i]==S[j]) and (T[i]!=T[j]):
      print("No")
      break
    elif (S[i]!=S[j]) and (T[i]==T[j]):
      print("No")
      break
  else:
    continue
  break
else:
  print("Yes")

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

SS = [s for s in S]
SS_set = list(set(SS))
CS = []
for c in SS_set:
  C_idx_in_S = [i for i, x in enumerate(SS) if x==c]
  if len(C_idx_in_S) > 1:
    CS.append(C_idx_in_S)

TT = [t for t in T]
TT_set = list(set(TT))
CT = []
for c in TT_set:
  C_idx_in_T = [i for i, x in enumerate(TT) if x==c]
  if len(C_idx_in_T) > 1:
    CT.append(C_idx_in_T)

if len(CS) == len(CT):
  for i in CS:
    if i in CT:
      continue
    else:
      print("No")
      break
  else:
    print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = []
W.append(input())
for n in range(N):
  w = input()
  if w[0] != W[-1][-1]:
    print("No")
    break
  elif W.count(w) != 0:
    print("No")
    break
  W.append(w)
else:
  print("Yes")
  

Fixed submission:
N = int(input())
W = []
W.append(input())
for n in range(N-1):
  w = input()
  if w[0] != W[-1][-1]:
    print("No")
    break
  elif W.count(w) != 0:
    print("No")
    break
  W.append(w)
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
N = int(input())
W = []
W.append(input())
for n in range(N):
  w = input()
  if w[0] != W[-1][-1]:
    print("No")
    break
  elif W.count(w) != 0:
    print("No")
    break
else:
  print("Yes")
  

Fixed submission:
N = int(input())
W = []
W.append(input())
for n in range(N-1):
  w = input()
  if w[0] != W[-1][-1]:
    print("No")
    break
  elif W.count(w) != 0:
    print("No")
    break
  W.append(w)
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
N, X = [int(nx) for nx in input().split()]
x = [abs(int(xx) - X) for xx in input().split()]

while len(x) > 1:
  x2 = []
  mn_x = min(x)
  for n in range(N):
    mod = x[n] % mn_x
    if mod != 0:
      x2.append(mod)
  x2.append(mn_x)
  x = x2
  
ans = x[0]
print(ans)

Fixed submission:
N, X = [int(nx) for nx in input().split()]
x = [abs(int(xx) - X) for xx in input().split()]

while len(x) > 1:
  x2 = []
  mn_x = min(x)
  for n in range(len(x)):
    mod = x[n] % mn_x
    if mod != 0:
      x2.append(mod)
  x2.append(mn_x)
  x = x2
  
ans = x[0]
print(ans)

Buggy python submission (verdict: Runtime Error):
N, X = [int(nx) for nx in input().split()]
x = [abs(int(xx) - X) for xx in input().split()]

while len(x) > 1:
  x2 = []
  mn_x = min(x)
  for n in range(N):
    mod = x[n] % mn_x
    if mod != 0:
      x2.append(mod)
  x2.append(mn_x)
  x = x2
print(x)

Fixed submission:
N, X = [int(nx) for nx in input().split()]
x = [abs(int(xx) - X) for xx in input().split()]

while len(x) > 1:
  x2 = []
  mn_x = min(x)
  for n in range(len(x)):
    mod = x[n] % mn_x
    if mod != 0:
      x2.append(mod)
  x2.append(mn_x)
  x = x2
  
ans = x[0]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(nk) for nk in input().split()]

ans = 0
# a+b=pK b+c=qK c+a=rK
for p in range(1, ((2*N)//K)+1):#1<=p<=(2*N)//K
  for q in range(1, ((2*N)//K)+1):
    b0 = (( p+q-1)*K)/2
    if b0 < 1:
      continue
    for r in range(1, ((2*N)//K)+1):
      a = (( p-q+r)*K)/2
      b = (( p+q-r)*K)/2
      c = ((-p+q+r)*K)/2
      if b < 1:
        break
      elif a > N or c > N:
        break
      elif b > N:
        continue
      elif a < 1 or c < 1:
        continue
      elif a == int(a) and b == int(b) and c == int(c):
        ans += 1
        
print(ans)

Fixed submission:
N, K = [int(nk) for nk in input().split()]

if K % 2 == 1:
  print((N//K)**3)
else:
  ans1 = (N//K)**3
  ans2 = ((N-(K//2))//K + 1)**3
  print(ans1 + ans2)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(nk) for nk in input().split()]

ans = 0
# a+b=pK b+c=qK c+a=rK
for p in range(1, ((2*N)//K)+1):#1<=p<=(2*N)//K
  for q in range(1, ((2*N)//K)+1):
    for r in range(1, ((2*N)//K)+1):
      a = (( p-q+r)*K)/2
      b = (( p+q-r)*K)/2
      c = ((-p+q+r)*K)/2
      if b < 1:
        break
      elif a > N or c > N:
        break
      elif b > N:
        continue
      elif a < 1 or c < 1:
        continue
      elif a == int(a) and b == int(b) and c == int(c):
        ans += 1
        
print(ans)

Fixed submission:
N, K = [int(nk) for nk in input().split()]

if K % 2 == 1:
  print((N//K)**3)
else:
  ans1 = (N//K)**3
  ans2 = ((N-(K//2))//K + 1)**3
  print(ans1 + ans2)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(nk) for nk in input().split()]

ans = 0
# a+b=pK b+c=qK c+a=rK
for p in range(1, ((2*N)//K)+1):#1<=p<=(2*N)//K
  for q in range(1, ((2*N)//K)+1):
    for r in range(1, ((2*N)//K)+1):
      a = (( p-q+r)*K)/2
      b = (( p+q-r)*K)/2
      c = ((-p+q+r)*K)/2
      if b < 1:
        break
      elif b > N:
        continue
      elif a < 1 or c < 1:
        continue
      elif a > N or c > N:
        break
      else:
        if a == int(a) and b == int(b) and c == int(c):
          ans += 1

print(ans)

Fixed submission:
N, K = [int(nk) for nk in input().split()]

if K % 2 == 1:
  print((N//K)**3)
else:
  ans1 = (N//K)**3
  ans2 = ((N-(K//2))//K + 1)**3
  print(ans1 + ans2)
Buggy python submission (verdict: Runtime Error):
H, W = [int(hw) for hw in input().split()]
A = []
for h in range(H):
  a = [a for a in input()]
  if a.count("#") > 0:
    A.append(a)
for w in range(W):
  cnt = 0
  for h in range(len(A)):
    if A[h][w] == ".":
      cnt += 1
  if cnt == len(A):
    for h in range(len(A)):
      del A[h][w]
for h in range(len(A)):
  print(A[h])

Fixed submission:
H, W = [int(hw) for hw in input().split()]
A = []
for h in range(H):
  a = [a for a in input()]
  if a.count("#") > 0:
    A.append(a)

for w in reversed(range(W)):
  cnt = 0
  for h in range(len(A)):
    if A[h][w] == ".":
      cnt += 1
  if cnt == len(A):
    for h in range(len(A)):
      del A[h][w]

for h in range(len(A)):
  ans = "".join(A[h])
  print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
if S[0] == "1":
  print(S[1])
else:
  print(S[0])

Fixed submission:
S = input()
K = int(input())
for i in range(len(S)):
  if S[i] == "1":
    K -= 1
  else:
    K = 0
  if K == 0:
    break
print(S[i])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

EW = [] # 「EW」となっている部分のEの座標
if S[0] == "W":
    EW.append(-1)
for i in range(N-1):
    if S[i]=="E" and S[i+1]=="W":
        EW.append(i)
if S[N-1] == "E":
    EW.append(N-1)

ans = 1000000
for ew in EW:
    cnt = 0
    for j in range(0, ew):
        if S[j] == "W":
            cnt += 1
    for k in range(ew+2, N):
        if S[k] == "E":
            cnt += 1
    if ans > cnt:
        ans = cnt

print(ans)

Fixed submission:
N = int(input())
S = input()

w_rotation = 0
e_rotation = S.count("E")
ans = w_rotation + e_rotation
for i in range(N):
    if S[i] == "W":
        w_rotation += 1
    else: # S[i] == "E":
        e_rotation -= 1
    if ans > w_rotation + e_rotation:
        ans = w_rotation + e_rotation

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())
S = set(s)
SK2 = []
for a in range(len(S)):
  mn_S = min(S)
  SK2.append(mn_S)
  idx_mnS = [i for i, x in enumerate(s[:-1]) if x==mn_S]
  for i in idx_mnS:
    for j in range(i+2, len(s)+1):
      SK2.append(s[i:j])
  SK2 = list(set(SK2))
  if len(SK2)>=K:
    break
  else:
    S.remove(mn_S)
SK2.sort()
print(SK2[K-1])

Fixed submission:
s = input()
K = int(input())

S = [ss for ss in s]
S_set = list(set(S))
S_set.sort()

substring = []
for c in S_set:
  idx_c = [i for i, x in enumerate(s) if x == c]
  substring_c = []
  for x in idx_c:
    for dx in range(1, min(5, len(s)-x)+1):
      substring_c.append(s[x:x+dx])
  substring_c = list(set(substring_c))
  substring += substring_c
  if len(substring) >= 5:
    break

substring.sort()
print(substring[K-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())
SK2 = list(s)
for i in range(2, len(s)+1):
  for j in range(len(s)-(i-1)):
    SK2.append(s[j:j+i])
SK3 = list(set(SK2))
SK3.sort()
print(SK3[K-1])

Fixed submission:
s = input()
K = int(input())

S = [ss for ss in s]
S_set = list(set(S))
S_set.sort()

substring = []
for c in S_set:
  idx_c = [i for i, x in enumerate(s) if x == c]
  substring_c = []
  for x in idx_c:
    for dx in range(1, min(5, len(s)-x)+1):
      substring_c.append(s[x:x+dx])
  substring_c = list(set(substring_c))
  substring += substring_c
  if len(substring) >= 5:
    break

substring.sort()
print(substring[K-1])

Buggy python submission (verdict: Runtime Error):
s = input()
K = int(input())
SK2 = list(set(s))
for i in range(2, len(s)):
  for j in range(len(s)-(i-1)):
    SK2.append(s[j:j+i])
SK2.sort()
print(SK2[K-1])

Fixed submission:
s = input()
K = int(input())

S = [ss for ss in s]
S_set = list(set(S))
S_set.sort()

substring = []
for c in S_set:
  idx_c = [i for i, x in enumerate(s) if x == c]
  substring_c = []
  for x in idx_c:
    for dx in range(1, min(5, len(s)-x)+1):
      substring_c.append(s[x:x+dx])
  substring_c = list(set(substring_c))
  substring += substring_c
  if len(substring) >= 5:
    break

substring.sort()
print(substring[K-1])
Buggy python submission (verdict: Runtime Error):
a, b = list(input().split())
if a <= b:
  print(a)
else:
  print(a-1)

Fixed submission:
a, b = [int(ab) for ab in input().split()]
if a <= b:
  print(a)
else:
  print(a-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = [int(x) for x in input().split()]
X_nm = []
for n in range(N):
  X_nm.append([n, X[n]])
X_nm.sort(key=lambda x:x[1])

for n in range(N):
  idx = X_nm.index([n, X[n]])
  if idx+1 <= N//2:
    ans = X_nm[N//2][1]
    print(ans)
  else:
    ans = X_nm[N//2-1][1]
    print(ans)

Fixed submission:
N = int(input())
X = [int(x) for x in input().split()]

XX = list(tuple(X))
XX.sort()
X_medium_1 = XX[(N//2)-1]
X_medium_2 = XX[N//2]

for n in range(N):
  if X[n] <= X_medium_1:
    print(X_medium_2)
  else: # X[n] >= X_medium_2:
    print(X_medium_1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(a) for a in input().split()]
A.insert(0, 0)
A.append(0)

B = []
for i in range(len(A)-1):
  B.append(A[i+1] - A[i])
B_abs = [abs(b) for b in B]

for j in range(1, N+1):
  M1 = sum(B_abs[:j-1])
  M2 = abs(B[j-1] + B[j])
  M3 = sum(B_abs[j+1:])
  M = M1 + M2 + M3
  print(M)

Fixed submission:
N = int(input())
A = [int(a) for a in input().split()]
A.insert(0, 0)
A.append(0)

B = []
for i in range(len(A)-1):
  B.append(A[i+1] - A[i])

B_abs = [abs(b) for b in B]
B_abs_cusum = [0]
cusum = 0
for j in B_abs:
  cusum += j
  B_abs_cusum.append(cusum)

for k in range(1, N+1):
  M1 = B_abs_cusum[k-1]
  M2 = abs(B[k-1] + B[k])
  M3 = B_abs_cusum[-1] - B_abs_cusum[k+1]
  M = M1 + M2 + M3
  print(M)
Buggy python submission (verdict: Runtime Error):
c_1 = input()
c_2 = input()
c_3 = input()
print(c_11[0] + c_22[1] + c_33[2])

Fixed submission:
c_1 = input()
c_2 = input()
c_3 = input()
print(c_1[0] + c_2[1] + c_3[2])

Buggy python submission (verdict: Runtime Error):
c_11, c_12, c_13 = [int(a) for a in input().split()]
c_21, c_22, c_23 = [int(b) for b in input().split()]
c_31, c_32, c_33 = [int(c) for c in input().split()]
print(str(c_11) + str(c_22) + str(c_33))

Fixed submission:
c_1 = input()
c_2 = input()
c_3 = input()
print(c_1[0] + c_2[1] + c_3[2])