Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
print(list[index])


Fixed submission:
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
index = int(index)
print(list[index-1])

Buggy python submission (verdict: Runtime Error):
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
print(list[index-1: index-1])


Fixed submission:
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
index = int(index)
print(list[index-1])

Buggy python submission (verdict: Runtime Error):
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
print(list[index])

Fixed submission:
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
index = int(index)
print(list[index-1])

Buggy python submission (verdict: Runtime Error):
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
print(list[index-1])


Fixed submission:
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
index = int(index)
print(list[index-1])

Buggy python submission (verdict: Runtime Error):
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
print(list[index+1])

Fixed submission:
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
index = int(index)
print(list[index-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())

def divisior(n):
    a = []
    i = 1
    while (i*i <= n):
        if n%i == 0:
            a.append(i)
            if (i*i == n): continue
            a.append(n//i)
        i += 1

    return a

ans = 0
a = divisior(n)

for x in a:
    if x == 1: continue
    tmp = n
    while (tmp%x == 0): tmp = tmp//x
    if (tmp%x == 1) : ans += 1

b = divisior(n-1)

ans = ans + len(b) -1

print(ans)




Fixed submission:

def swap(a ,b):
    x = 0
    x = a
    a = b
    b = x
    return a,b


str_number_list = input().split()
X = str_number_list[0]  #A
Y = str_number_list[1]  #B
Z = str_number_list[2]  #C

# swap(A,B)
X , Y = swap(X,Y)
#swap(A,C)
X,Z = swap(X,Z)
print("%s %s %s" % (X,Y,Z))

Buggy python submission (verdict: Runtime Error):
n = int(input())

def divisior(n):

    a = []
    i = 1

    while (i*i <= n):
        if n%i == 0:
            a.append(i)
            if (i*i == n): continue
            a.append(int(n/i))
        i += 1

    return a

ans = 0
a = divisior(n)

for x in a:
    if x == 1: continue
    tmp = n
    while (tmp%x == 0): tmp /= x
    if (tmp%x == 1) : ans += 1

b = divisior(n-1)

ans = ans + len(b) -1

print(ans)




Fixed submission:

def swap(a ,b):
    x = 0
    x = a
    a = b
    b = x
    return a,b


str_number_list = input().split()
X = str_number_list[0]  #A
Y = str_number_list[1]  #B
Z = str_number_list[2]  #C

# swap(A,B)
X , Y = swap(X,Y)
#swap(A,C)
X,Z = swap(X,Z)
print("%s %s %s" % (X,Y,Z))
Buggy python submission (verdict: Runtime Error):
K,N = list(map(int,input().split()))
A = list(map(int,input().split()))

middle = K // 2

i=0
while A[i] <= middle:
  i += 1

d0 = A[i] - A[i-1]
d1 = K - A[-1] + A[0]

if d0 >= d1: print(K - d0)
else: print(K-d1)


Fixed submission:
word = input()
if word[2]==word[3] and word[4]==word[5]:
  print ("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
while n > abs(n - k):
    n = abs(n - k)
print(n)

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

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split(" "))
print("{} {} {}".format(c, a, b)

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

Buggy python submission (verdict: Runtime Error):
a, b, c = input().split(" ")
print("{} {} {}".format(c, a, b)

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

Buggy python submission (verdict: Runtime Error):
a, b, c = input().sprit(" ")
temp = a
a = b
b = temp
temp = a
a = c
c = temp
print("{} {} {}".format(a, b, c)


Fixed submission:
a, b, c = map(int, input().split(" "))
print(c, a, b)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
while n > abs(n - k):
    n = abs(n - k)
print(n)

Fixed submission:
n, k = map(int, input().split())
print(min(n%k, k-n%k))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
while n > abs(n - k):
    n = abs(n - k)

print(n)

Fixed submission:
n, k = map(int, input().split())
print(min(n%k, k-n%k))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
while n > abs(n - k):
    n = abs(n - k)

print(n)

Fixed submission:
n, k = map(int, input().split())
print(min(n%k, k-n%k))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
temp = n
while temp > abs(temp - k):
    temp = abs(temp - k)

print(temp)

Fixed submission:
n, k = map(int, input().split())
print(min(n%k, k-n%k))
Buggy python submission (verdict: Runtime Error):
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
 
H  int(l1[0])
N = int(l1[1])
A = int(sum(l2))
result = H - A
if result <= 0:
    print("Yes")
else:
    print("No")

Fixed submission:
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
 
H = int(l1[0])
A = int(sum(l2))
result = H - A
if result <= 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
l1 = list(map(int, input().split()))
def attack2(l1):
    H, N= l1[0], l1[1]
    v = 0
    for i in range(2, N):
        v += l1[i]
    result = H - v
    if result >0:
        return "no"
    else:
        return "yes"
print(attack2(l1))

Fixed submission:
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
 
H = int(l1[0])
A = int(sum(l2))
result = H - A
if result <= 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))

N = l1[0]
K = l1[1]
l2.sort(reverse=True)
for i in range(K):
  l2[i] = 0
print(sum(l2))

Fixed submission:
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))

K = l1[1]
l2.sort(reverse=True)
print(sum(l2[K:]))
Buggy python submission (verdict: Runtime Error):
if txt[2] == txt[3] and txt[4] == txt[5]:
    print('Yes')
else :
    print('No')


Fixed submission:
txt = input()

if txt[2] == txt[3] and txt[4] == txt[5]:
    print('Yes')
else :
    print('No')
Buggy python submission (verdict: Runtime Error):
# Sample Input:
# 4 1
# 5 4 2 1
# total votes = 12
# 1/4M * 12 = 1/4 * 12 = 3, can't select item < 3

first_input = input("").split(" ")
N, M = map(int, first_input)
items = input("")

items = items.split(" ")
total_votes = list(map(float, items))

total_votes = sum(total_votes)

min_N = total_votes * ( 1.0 / (4.0 * M) )

if(N < min_N):
    print("No")
else:
    print("Yes")

Fixed submission:
input_arr = input("").split(" ")
a, b, c = map(str, input_arr)

print(c + " " + a + " " + b)

Buggy python submission (verdict: Runtime Error):
input_arr = input("").split(" ")
a, b, c = map(str, input_arr)

print(f"{c} {a} {b}")

Fixed submission:
input_arr = input("").split(" ")
a, b, c = map(str, input_arr)

print(c + " " + a + " " + b)

Buggy python submission (verdict: Runtime Error):

input_arr = input("").split(" ")
a, b, c = map(str, input_arr)

print(f"{c} {a} {b}")

Fixed submission:
input_arr = input("").split(" ")
a, b, c = map(str, input_arr)

print(c + " " + a + " " + b)

Buggy python submission (verdict: Runtime Error):

a = ""
b = ""
c = ""

a = input("")
b = input("")
c = input("")

return [b, c, a]

Fixed submission:
input_arr = input("").split(" ")
a, b, c = map(str, input_arr)

print(c + " " + a + " " + b)

Buggy python submission (verdict: Runtime Error):
a = input("")
b = input("")
c = input("")

return [a, b ,c]

Fixed submission:
input_arr = input("").split(" ")
a, b, c = map(str, input_arr)

print(c + " " + a + " " + b)

Buggy python submission (verdict: Runtime Error):
# a b c
# b a c
# b c a


function abcSwap(arr):
  arr[0], arr[1] = arr[1], arr[0]
  arr[1], arr[2] = arr[2], arr[1]
  return arr



Fixed submission:
input_arr = input("").split(" ")
a, b, c = map(str, input_arr)

print(c + " " + a + " " + b)

Buggy python submission (verdict: Runtime Error):
def resolve():
  a, b, c = map(int, input().split())
 
    temp_a = a
    temp_b = b
    a = temp_b
    b = temp_a
    temp_c = c
    temp_a = a
    c = temp_a
    a = temp_c
    print(a, b, c)

Fixed submission:
n = list(map(int,input().split()))
print(n[2],n[0],n[1])

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
 
    temp_a = a
    temp_b = b
    a = temp_b
    b = temp_a
    temp_c = c
    temp_a = a
    c = temp_a
    a = temp_c
    print(a, b, c)

Fixed submission:
n = list(map(int,input().split()))
print(n[2],n[0],n[1])
Buggy python submission (verdict: Runtime Error):
S,T = map(input().split())
A,B = map(int,input().split())
U = input()

if U==S:
  print (A-1,B);
else:
  print (A,B-1);
  

Fixed submission:
S,T = input().split()
A,B = map(int,input().split())
U = input()
 
if U==S:
  print (A-1,B);
else:
  print (A,B-1);
Buggy python submission (verdict: Runtime Error):
H,N = map(int,input().split())
A = list(map(int,input().split()))

if sum(A)>=H:
  print("Yes")
else:
  print("No")

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

if H%A==0:
  print(H//A)
else:
  print(H//A+1)

Buggy python submission (verdict: Runtime Error):
H,N = map(int,input().split())
A = list(map(int,input().split()))
s = sum (A)
if s>=H:
  print("Yes")
else:
  print("No")

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

if H%A==0:
  print(H//A)
else:
  print(H//A+1)

Buggy python submission (verdict: Runtime Error):
H,N = map(int,input().split())
A = list(map(int,input().split()))
if sum(A)>=H:
  print("Yes")
else:
  print("No")

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

if H%A==0:
  print(H//A)
else:
  print(H//A+1)
Buggy python submission (verdict: Runtime Error):
H,N = map(int,input().split())
A = list(map(int,input().split()))
if sum(A)>=H:
  print(Yes)
else:
  print(No)

Fixed submission:
H,N = map(int,input().split())
A = list( map(int,input().split()))
if sum(A)>=H:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())
if N==M:
  print("Yes")
else:
  print("No")

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

if (N==M):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())
print("Yes") if N==M else print("No")
  

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

if (N==M):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())
if N==M:
  print("Yes")
  else:
    print("No")

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

if (N==M):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())
if N == M:
  print("Yes")
  else:
    print("No")

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

if (N==M):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
int N= input()
int M = input()
if (N==M):
 		 print("Yes")
 	else:
      print("No")

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

if (N==M):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = input()

count = 0
C = []
for i in list(S):
  if i == "A" or i == "C" or i == "G" or i == "T":
    count += 1
  else:
    C.append(count)
    count = 0

print(max(C))

Fixed submission:
S = input()

count = 0
C = []
for i in range(len(S)):
  C.append(count)
  count = 0
  if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
    count += 1
    if(i == len(S)-1):
      C.append(count)
      break
    for j in range(i+1,len(S)):
      if S[j] == "A" or S[j] == "C" or S[j] == "G" or S[j] == "T":
        count += 1
      else: break

print(max(C))
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
count = 0

def black_and_white(S):
  global count
  for i in range(0,len(S)-1):
    if(S[i] == "B" and S[i+1] == "W"):
      count += 1
      tmp = S[i]
      S[i] = S[i+1]
      S[i+1] = tmp
      return True
  return False

while(1):
  if not black_and_white(S): break

print(count)



Fixed submission:
S = list(input())
b_count = 0
ans = 0

for i in range(0,len(S)):
  if S[i] == "B":
    b_count += 1
  elif S[i] == "W":
    ans += b_count

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = input()
min = 3 * 10 ** 15
for i in range(n):
    tmp = S[0:i].count("W") + S[i+1:n].count("E")
    if min > tmp:
        min = tmp
print(min)


Fixed submission:
n = int(input())
S = input()
W = 0
E = 0
T = [0 for i in range(n)]  
for i in range(n-1):
    if S[i] == "W": W+=1
    if i > 0:
        T[i+1] += W 

for i in range(n-1,0,-1):
    if S[i] == "E": E+=1
    if i < n-1:
        T[i-1] += E
print(min(T))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = list(input())
min = 3 * 10 ** 15
for i in range(n):
    tmp = S[0:i].count("W") + S[i+1:n].count("E")
    if min > tmp:
        min = tmp

print(min)

Fixed submission:
n = int(input())
S = input()
W = 0
E = 0
T = [0 for i in range(n)]  
for i in range(n-1):
    if S[i] == "W": W+=1
    if i > 0:
        T[i+1] += W 

for i in range(n-1,0,-1):
    if S[i] == "E": E+=1
    if i < n-1:
        T[i-1] += E
print(min(T))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())



# S = []
# for i in range(len(s)+1):
#     for j in range(i+1,len(s)+1):
#         if not(s[i:j] in S):
#             S.append(s[i:j])
#         # print(s[i:j])

t = s
S = []

while(1):
    for i in range(t.index(min(t))+1,len(s)+1):
        if not(s[t.index(min(t)):i] in S):
            S.append(s[t.index(min(t)):i])
    if t.count(min(t)) == 1 and len(S)>=k: break
    else: t = t.replace(min(t),"z",1)
    # print(t)
    # print(S)

S.sort()

print(S[k-1])








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



# S = []
# for i in range(len(s)+1):
#     for j in range(i+1,len(s)+1):
#         if not(s[i:j] in S):
#             S.append(s[i:j])
#         # print(s[i:j])

S = set()

for i in range(1, k+1):
    for j in range(len(s)-i+1):
            S.add(s[j:j+i])

T = sorted([x for x in S])

print(T[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())

S = []
for i in range(len(s)+1):
    for j in range(i+1,len(s)+1):
        if not(s[i:j] in S):
            S.append(s[i:j])
        # print(s[i:j])

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


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



# S = []
# for i in range(len(s)+1):
#     for j in range(i+1,len(s)+1):
#         if not(s[i:j] in S):
#             S.append(s[i:j])
#         # print(s[i:j])

S = set()

for i in range(1, k+1):
    for j in range(len(s)-i+1):
            S.add(s[j:j+i])

T = sorted([x for x in S])

print(T[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
X = list(map(int,input().split()))

X_sort = sorted(X)

for i in X:
    if X_sort.index(i) < len(X)//2:
        print(X_sort[len(X)//2])
    else: print(X_sort[len(X)//2-1])




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

X_sort = sorted(X)
t = X_sort[len(X)//2]

for i in X:
    if i < t:
        print(X_sort[len(X)//2])
    else: print(X_sort[len(X)//2-1])
Buggy python submission (verdict: Runtime Error):
import math

N=int(input())
S=[]
T=[]
m=a=r=c=h=0
for i in range(N):
    S.append(list(input()))
    if S[i][0]=="M" or S[i][0]=="A" or S[i][0]=="R" or S[i][0]=="C" or S[i][0]=="H":
        T.append(S[i][0])
K=set(T)
P=[]
for i in K:
    P.append(T.count(i))
if P==[]: ans=0
else: ans=math.factorial(sum(P))//(6*math.factorial(sum(P)-3))

for i in range(len(P)):
    if P[i]>2:
        ans-=(math.factorial(P[i])//6)*(len(P)-1)
    if P[i]>1:
        ans-=(math.factorial(P[i])//2)*(len(P)-1)

print(ans)


Fixed submission:
N=int(input())
T=[0]*5
for i in range(N):
    S=input()
    if S[0]=="M": T[0]+=1
    elif S[0]=="A": T[1]+=1
    elif S[0]=="R": T[2]+=1
    elif S[0]=="C": T[3]+=1
    elif S[0]=="H": T[4]+=1

ans=0
for i in range(5):
    for j in range(i+1,5):
        for k in range(j+1,5):
            ans+=T[i]*T[j]*T[k]
print(ans)

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

N=int(input())
S=[]
T=[]
m=a=r=c=h=0
for i in range(N):
    S.append(list(input()))
    if S[i][0]=="M" or S[i][0]=="A" or S[i][0]=="R" or S[i][0]=="C" or S[i][0]=="H":
        T.append(S[i][0])
K=set(T)
P=[]
for i in K:
    P.append(T.count(i))
if P==[]: ans=0
else: ans=math.factorial(sum(P))//(6*math.factorial(sum(P)-3))

for i in range(len(P)):
    if P[i]>2:
        ans-=(math.factorial(P[i])//6)*(len(P)-1)
    if P[i]>1:
        ans-=math.factorial(P[i])//2*(len(P)-1)

print(ans)


Fixed submission:
N=int(input())
T=[0]*5
for i in range(N):
    S=input()
    if S[0]=="M": T[0]+=1
    elif S[0]=="A": T[1]+=1
    elif S[0]=="R": T[2]+=1
    elif S[0]=="C": T[3]+=1
    elif S[0]=="H": T[4]+=1

ans=0
for i in range(5):
    for j in range(i+1,5):
        for k in range(j+1,5):
            ans+=T[i]*T[j]*T[k]
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())

T=[]
X=[]
Y=[]
for i in range(N):
    t,x,y=map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

flag=0
for i in range(N):
    if i==0:
        if T[i]<X[i]+Y[i] or (X[i]!=0 and Y[i]!=0 and T[i]%(X[i]+Y[i])!=0):
            flag=1
            break
        if (X[i]==Y[i]==0 and T[i]%2!=0) or (((X[i]==1 and Y[i]==0) or (X[i]==0 and Y[i]==1)) and T[i]%2!=1):
            flag=1
            break
    else:
    if T[i]-T[i-1]<(X[i]-X[i-1])+(Y[i]-Y[i-1]) or (X[i]-X[i-1]!=0 and Y[i]-Y[i-1]!=0 and T[i]-T[i-1]%((X[i]-X[i-1])+(Y[i]-Y[i-1]))!=0):
        flag=1
        break
    if (X[i]-X[i-1]==Y[i]-Y[i-1]==0 and T[i]%2!=0) or (((X[i]-X[i-1]==1 and Y[i]-Y[i-1]==0) or (X[i]-X[i-1]==0 and Y[i]-Y[i-1]==1)) and T[i]-T[i-1]%2!=1):
        flag=1
        break

if flag==0:
    print("Yes")
else:
    print("No")


Fixed submission:
N=int(input())

t=x=y=0
judge=True
for i in range(N):
    in_t,in_x,in_y=map(int,input().split())
    dt=in_t-t
    dxy=abs(in_x-x)+abs(in_y-y)
    if dxy>dt or (dxy-dt)%2!=0: judge=False
    t=in_t
    x=in_x
    y=in_y

if judge: print("Yes")
else: print("No")

Buggy python submission (verdict: Runtime Error):
N=int(input())

T=[]
X=[]
Y=[]
for i in range(N):
    t,x,y=map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

flag=0
for i in range(N):
    # １回目はそのままの数
    if i==0:
    # 数的に無理
        if T[i]<X[i]+Y[i] or (X[i]!=0 and Y[i]!=0 and T[i]%(X[i]+Y[i])!=0):
            flag=1
            break
    # (0,0)にいれるのはt偶数の時だけ,(1,0)(0,1)にいれるのは奇数の時だけ
        if (X[i]==Y[i]==0 and T[i]%2!=0) or (((X[i]==1 and Y[i]==0) or (X[i]==0 and Y[i]==1)) and T[i]%2!=1):
            flag=1
            break
    # 数的に無理
    else:
    if T[i]-T[i-1]<(X[i]-X[i-1])+(Y[i]-Y[i-1]) or (X[i]-X[i-1]!=0 and Y[i]-Y[i-1]!=0 and T[i]-T[i-1]%((X[i]-X[i-1])+(Y[i]-Y[i-1]))!=0):
        flag=1
        break
    # 前回と同じとこにとどまれるのは偶数の時だけ
    if (X[i]-X[i-1]==Y[i]-Y[i-1]==0 and T[i]%2!=0) or (((X[i]-X[i-1]==1 and Y[i]-Y[i-1]==0) or (X[i]-X[i-1]==0 and Y[i]-Y[i-1]==1)) and T[i]-T[i-1]%2!=1):
        flag=1
        break

if flag==0:
    print("Yes")
else:
    print("No")


Fixed submission:
N=int(input())

t=x=y=0
judge=True
for i in range(N):
    in_t,in_x,in_y=map(int,input().split())
    dt=in_t-t
    dxy=abs(in_x-x)+abs(in_y-y)
    if dxy>dt or (dxy-dt)%2!=0: judge=False
    t=in_t
    x=in_x
    y=in_y

if judge: print("Yes")
else: print("No")
Buggy python submission (verdict: Runtime Error):
X,Y=map(int,input().split())
t=X
for i in range(1,X*Y):
    if t*2>Y: break
    else:
        t*=2

print(i)


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

i=1
A=[]
A.append(X)

while(1):
    T=A[i-1]*2
    if T<=Y:
        A.append(T)
    elif T>Y:
        break
    i+=1

print(len(A))

Buggy python submission (verdict: Time Limit Exceeded):
X,Y = map(int, input().split())

j=0
d=[]
d.append(X)
for i in range(X+1,Y+1):
    if i%d[j]==0:
        d.append(i)
        j+=1

print(len(d))

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

i=1
A=[]
A.append(X)

while(1):
    T=A[i-1]*2
    if T<=Y:
        A.append(T)
    elif T>Y:
        break
    i+=1

print(len(A))
Buggy python submission (verdict: Runtime Error):
def compare(a, A):
    R=0
    for i in range(0, len(A)):
        if(a==A[i]):
            R+=1
        elif(a<A[i]):
            break
    return R

def result(R,a):
    if(R==a):
        return 0
    elif(a<R):
        return R-a
    return R

N = int(input())

a = list(map(int, input().split()))
a.sort()

R=0
T=compare(a[0],a)
R+=result(T,a[0])

for i in range(1, N):
    if(a[i] != a[i-1]):
        C=compare(a[i],a[T:])
        R+=result(C,a[i])
        T+=C

print(R)


Fixed submission:
import math

a,b = map(int, input().split())

T = math.ceil((a+b)/2)

print(T)

Buggy python submission (verdict: Runtime Error):
def compare(a, A):
    R=0
    for i in range(0, len(A)):
        if(a==A[i]):
            R+=1

    if(R==a):
        return 0
    elif(a<R):
        return R-a
    return R

N = int(input())

a = list(map(int, input().split()))
a.sort()

R=0
R+=compare(a[0],a)

for i in range(1, N):

    if(a[i] != a[i-1]):
        R+=compare(a[i],a)

print(R)


Fixed submission:
import math

a,b = map(int, input().split())

T = math.ceil((a+b)/2)

print(T)
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())

if a<b:
    print('<')
elif a>b:
    print('>')
else:
    print('=')

Fixed submission:
a,b=map(str, input().split())

if a<b:
    print('<')
elif a>b:
    print('>')
else:
    print('=')
Buggy python submission (verdict: Runtime Error):
a,b=map(str, input().split())

if (a="H" and b="H") or (a="D" and b="D"):
    print("H")
else:
    print("D")


Fixed submission:
a,b=map(str, input().split())

if (a=="H" and b=="H") or (a=="D" and b=="D"):
    print("H")
else:
    print("D")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
t=1
for i in range(1,N+1):
    t*=i

print(int(t%(10**9+7)))


Fixed submission:
import math
N=int(input())

print(int(math.factorial(N)%(10**9+7)))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M=map(int, input().split())

A=[]
for i in range(N):
    a=list(input())
    A.append(a)

B=[]
for i in range(M):
    b=list(input())
    B.append(b)

An=np.array(A)
Bn=np.array(B)

t=0
for i in range(N):
    for j in range(N):
        if Bn in An[i:i+M,j:j+M]:
            t=1
            break

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


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

A=[list(input()) for i in range(N)]
B=[list(input()) for i in range(M)]




flag=0
for i in range(N-M+1):
    for j in range(N-M+1):
        for t in range(M):
            for s in range(M):
                if A[i+t][j+s]==B[t][s]:
                    flag+=1
        if flag==M*M: break
        else: flag=0
    if flag==M*M: break

if flag==0: print("No")
else: print("Yes")
Buggy python submission (verdict: Runtime Error):
N,L=map(int,input().split())
S=[input() for i in range(N)]


Ts=""
T=[]
for j in range(L):
    t=j
    for i in range(N):
        if t==L: t=0
        Ts+=S[t]
        t+=1
    T.append(Ts)
    Ts=""

print(min(T))

Fixed submission:
N,L=map(int,input().split())
S=[input() for i in range(N)]

T=[]
for i in range(N):
    s=min(S)
    T.append(s)
    S.pop(S.index(s))

Ts=""
for i in range(len(T)):
    Ts+=T[i]

print(Ts)