Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
v=[int(i) for i in input().split()]
v.sort()
mid=(v[0]+v[1])/2
for i in v[2,n]:
  mid=(mid+i)/2
print(mid)


Fixed submission:
n=int(input())
v=[int(i) for i in input().split()]
v.sort()
mid=(v[0]+v[1])/2
for i in range(2,n):
  mid=(mid+v[i])/2
print(mid)

Buggy python submission (verdict: Runtime Error):
n=int(input())
v=[int(i) for i in input().split()]
v.sort()
mid=(v[0]+v[1])/2
for i in v[2,n]:
  mid=(mid+v[i])/2
print(mid)

Fixed submission:
n=int(input())
v=[int(i) for i in input().split()]
v.sort()
mid=(v[0]+v[1])/2
for i in range(2,n):
  mid=(mid+v[i])/2
print(mid)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a=b:
  print(0)
elif (a+b)%2==0:
  print((a+b)//2)
else:
  print('IMPOSSIBLE')

Fixed submission:
a,b=map(int,input().split())
if a==b:
  print(0)
elif (a+b)%2==0:
  print((a+b)//2)
else:
  print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[int(i) for i in input().split()]
n1=[i for i in range(1,n+1)]
for i in n1:
  for k in n1:
    n1=n1.replace(i,k)
    if n1==p:
      print('YES')
      exit()
else:
  print('NO')
    
 

Fixed submission:
n=int(input())
p=[int(i) for i in input().split()]
n1=[i for i in range(1,n+1)]
for i in range(n):
  for k in range(n):
    n1[i],n1[k]=n1[k],n1[i]
    if n1==p:
      print('YES')
      exit()
    n1=[i for i in range(1,n+1)]
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for _ in range(n)]
amax=max(a)
for i in range(n):
  if max(a)==a[i]:
    b=a[i]
    a[i]=0
    print(max(a))
    a[i]=b
  else:
    print(amax)
  


Fixed submission:
n=int(input())
a=[int(input()) for _ in range(n)]

amax,b=max(a),a.index(max(a))
a.remove(amax)
bmax=max(a)
for i in range(n):
  if i==b:
    print(bmax)
  else:
    print(amax)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for _ in range(n)]
for i in range(n):
  b=a[i]
  a[i]=0
  print(max(a))
  a[i]=b
  

Fixed submission:
n=int(input())
a=[int(input()) for _ in range(n)]

amax,b=max(a),a.index(max(a))
a.remove(amax)
bmax=max(a)
for i in range(n):
  if i==b:
    print(bmax)
  else:
    print(amax)
Buggy python submission (verdict: Runtime Error):
l,r=map(int,input().split())
min1=2018
if r-l>=2018:
  print(0)
  exit()
else:
  for i in range(l,r):
    for j in range(i+1,r+1):
      min=min(i*j%2019,min1)
print(min1)
      


Fixed submission:
l,r=map(int,input().split())
min1=2018
if r-l>=2018:
  print(0)
  exit()
else:
  for i in range(l,r):
    for j in range(i+1,r+1):
      min1=min(i*j%2019,min1)
print(min1)

Buggy python submission (verdict: Runtime Error):
l,r=map(int,input().split())
if r-l>=2018:
  print(0)
  exit()
min1=2018
else:
  for i in range(l,r):
    for j in range(i+1,r+1):
      min=min(i*j%2019,min1)
print(min1)
      

Fixed submission:
l,r=map(int,input().split())
min1=2018
if r-l>=2018:
  print(0)
  exit()
else:
  for i in range(l,r):
    for j in range(i+1,r+1):
      min1=min(i*j%2019,min1)
print(min1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
d=[int(i) for i in input().split()]
d.sort()
print(d[n//2+1]-d[n//2])


Fixed submission:
n=int(input())
d=[int(i) for i in input().split()]
d.sort()
print(d[n//2]-d[n//2-1])

Buggy python submission (verdict: Runtime Error):
n=int(input())
d=[int,input().split()]
d.sort()
print(d[n//2]-d[n//2+1])

Fixed submission:
n=int(input())
d=[int(i) for i in input().split()]
d.sort()
print(d[n//2]-d[n//2-1])
Buggy python submission (verdict: Runtime Error):
import math

n,k=map(int,input().split())
for i in range(1,k+1):
  if n-k<i-1:
      print(0)
  else :
    a=math.factorial(k-1)
    b=math.factorial(i-1)
    c=math.factorial(k-i)
    d=math.factorial(n-k+1)
    e=math.factorial(i)
    f=math.factorial(n-k-i+1)
    g=a/b/c
    h=d/e/f
    print(g*h%1000000007)
    

Fixed submission:
import math

n,k=map(int,input().split())
for i in range(1,k+1):
  if n-k<i-1:
      print(0)
  else :
    a=math.factorial(k-1)
    b=math.factorial(i-1)
    c=math.factorial(k-i)
    d=math.factorial(n-k+1)
    e=math.factorial(i)
    f=math.factorial(n-k-i+1)
    g=a//b//c
    h=d//e//f
    print(g*h%1000000007)
Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
 a=n*(2*l+n-1)//2
if 1-n<=l<=0:
  print(a)
elif l<=-n:
  print(a-l-n+1)
else :
  print(a-l)
  

Fixed submission:
n,l=map(int,input().split())
a=n*(2*l+n-1)//2
if 1-n<=l<=0:
  print(a)
elif l<=-n:
  print(a-l-n+1)
else :
  print(a-l)

Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
if 1-n<=l<=0:
  a=n*(2*l+n-1)//2
  print(a)
elif l<=-n:
  print(a-l-n+1)
else :
  print(a-l)
  

Fixed submission:
n,l=map(int,input().split())
a=n*(2*l+n-1)//2
if 1-n<=l<=0:
  print(a)
elif l<=-n:
  print(a-l-n+1)
else :
  print(a-l)
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=[int(i) for i in input()split()]
a=0
ans=0
for i in l:
  if a+i>x:
    print(ans+1)
    exit()
  ans+=1
  a+=i
print(ans)

Fixed submission:
n,x=map(int,input().split())
l=[int(i) for i in input().split()]
d=0
ans=0
for i in l:
  if d+i>x:
    print(ans+1)
    exit()
  ans+=1
  d+=i
print(ans+1)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=[input(i) for i in input().split()]

x.sort()
y=[]
if n-m>=0:
  print(0)
  exit(0)
else:
  for i in range(m-1):
    y.append(x[i+1]-x[i])
y.sort()
print(sum(y[:n-m+2]))

Fixed submission:
n,m=map(int,input().split())
x=[int(i) for i in input().split()]

x.sort()
y=[]
if n-m>=0:
  print(0)
  exit(0)
else:
  for i in range(m-1):
    y.append(x[i+1]-x[i])
y.sort()
print(sum(y[:m-n]))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=[int(i) for i in input().split()]
x.sort()
y=[]
if n-m>=0:
  print(0)
  exit(0)
else:
  for i in range(n-1):
    y.append(x[i+1]-x[i])
y.sort()
print(sum(y[:n-m])
  
  
  



Fixed submission:
n,m=map(int,input().split())
x=[int(i) for i in input().split()]

x.sort()
y=[]
if n-m>=0:
  print(0)
  exit(0)
else:
  for i in range(m-1):
    y.append(x[i+1]-x[i])
y.sort()
print(sum(y[:m-n]))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
h=[int(i) for i in input().split()]
j=0
ans=0
while True:
  if h[0]>j:
    ans+=1
  for i in range(1,n):
    if h[i-1]<=j and h [i]>j:
      ans+=1
  j+=1
  if j==max(h):
    break
print(ans) 

Fixed submission:
n=int(input())
h=[int(i) for i in input().split()]
j=0
ans=0
while j<max(h):
  if h[0]>j:
    ans+=1
  for i in range(1,n):
    if h[i-1]<=j and h [i]>j:
      ans+=1
  j+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=[int(i) for i input().split()]
j=0
ans=0
while True:
  if h[0]>j:
    ans+=1
  for i in range(1,n):
    if h[i-1]<=j and h [i]>j:
      ans+=1
  j+=1
  if j==max(h):
    break
print(ans) 

Fixed submission:
n=int(input())
h=[int(i) for i in input().split()]
j=0
ans=0
while j<max(h):
  if h[0]>j:
    ans+=1
  for i in range(1,n):
    if h[i-1]<=j and h [i]>j:
      ans+=1
  j+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=ini(input())
h=[int(i) for i input().split()]
j=0
ans=0
while True:
  if h[0]>j:
    ans+=1
  for i in range(1,n):
    if h[i-1]<=j and h [i]>j:
      ans+=1
  j+=1
  if j==max(h):
    break
print(ans) 

Fixed submission:
n=int(input())
h=[int(i) for i in input().split()]
j=0
ans=0
while j<max(h):
  if h[0]>j:
    ans+=1
  for i in range(1,n):
    if h[i-1]<=j and h [i]>j:
      ans+=1
  j+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import functools as fun

@fun.lru_cache(maxsize = None)
def rec(n):
	if n == 0:
		return 0
	elif n == 1:
		return abs(h[n] - h[n-1])
	else:
		return min(rec(n-1) + abs(h[n] - h[n-1]), rec(n-2) + abs(h[n] - h[n-2]))


### main

N = int(input())
h = list(map(int, input().split()))

print(rec(N-1))



Fixed submission:
def main():
	N = int(input())
	h = list( map(int, input().split()) )
	
	dp = [0 for _ in range(N)]
	dp[1] = abs(h[0] - h[1])
	for i in range(2, N):
		dp[i] = min( dp[i-1] + abs(h[i] - h[i-1]),
		             dp[i-2] + abs(h[i] - h[i-2]) )
	print(dp[N-1])

	return

main()

Buggy python submission (verdict: Runtime Error):
import functools as fun

@fun.lru_cache
def rec(n):
	if n == 0:
		return 0
	elif n == 1:
		return abs(h[n] - h[n-1])
	else:
		return min(rec(n-1) + abs(h[n] - h[n-1]), rec(n-2) + abs(h[n] - h[n-2]))

### main
N = int(input())
h = list(map(int, input().split()))

print(rec(N-1))



Fixed submission:
def main():
	N = int(input())
	h = list( map(int, input().split()) )
	
	dp = [0 for _ in range(N)]
	dp[1] = abs(h[0] - h[1])
	for i in range(2, N):
		dp[i] = min( dp[i-1] + abs(h[i] - h[i-1]),
		             dp[i-2] + abs(h[i] - h[i-2]) )
	print(dp[N-1])

	return

main()
Buggy python submission (verdict: Runtime Error):
n,m=list(map(int,input().split()))
lists=[]
for i in range(n):
  lists.append()
for i in range(n):
  am=int(input())
  bm=int(input())
  lists[am-1]+=1
  lists[bm-1]+=1
for i in range(n):
  print(str(list[i])+"\n")

Fixed submission:
n,m=list(map(int,input().split()))
lists=[]
for i in range(n):
  lists.append(0)
for i in range(m):
  am,bm=list(map(int,input().split()))
  lists[am-1]+=1
  lists[bm-1]+=1
for i in range(n):
  print(lists[i])
Buggy python submission (verdict: Runtime Error):
M1, D1 = map(int, input().split())
M2, D2 = map(int, input().split())

if M1 in [1, 3, 5, 7, 8, 10, 12]:
	if D1 == 31:
		print("1")
	else:
		print("0")
else if M1 == 2:
	if D1 == 28:
		print("1")
	else:
		print("0")
else:
	if D1 == 30:
		print("1")
	else:
		print("0")

Fixed submission:
M1, D1 = map(int, input().split())
M2, D2 = map(int, input().split())

if M1 in [1, 3, 5, 7, 8, 10, 12]:
	if D1 == 31:
		print("1")
	else:
		print("0")
elif M1 == 2:
	if D1 == 28:
		print("1")
	else:
		print("0")
else:
	if D1 == 30:
		print("1")
	else:
		print("0")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
H = [0] * 3
P = 1
for i in A:
	P *= H.count(i)
	P %= 1000000007
	H[H.index(i)] += 1
print(P)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
H = [0] * 3
P = 1
for i in A:
	if H.count(i) == 0:
		P = 0
		break
	P *= H.count(i)
	P %= 1000000007
	H[H.index(i)] += 1
print(P)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
H = [0] * 3
P = 1
for i in A:
	P *= H.count(i)
	H[H.index(i)] += 1
print(P % 1000000007)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
H = [0] * 3
P = 1
for i in A:
	if H.count(i) == 0:
		P = 0
		break
	P *= H.count(i)
	P %= 1000000007
	H[H.index(i)] += 1
print(P)
Buggy python submission (verdict: Time Limit Exceeded):
M = int(input())
D, C = [0] * M, [0] * M
total = 0
count = 0
for i in range(M):
	D[i], C[i] = map(int, input().split())
	count += D[i] * C[i]
	while count > 9:
		total += 1
		count -= 9
print(sum(C)-1+total)

Fixed submission:
M = int(input())
D, C = [0] * M, [0] * M
total = 0
for i in range(M):
	D[i], C[i] = map(int, input().split())
	total += D[i] * C[i]
print(sum(C)-1+(int((total-1)/9)))
Buggy python submission (verdict: Runtime Error):
x=int(input())
ans=0
for i in range(1000):
   if i*100<=x<=105*i:
       ans=1
print(ans)

Fixed submission:
M1,D1=map(int,input().split())
M2,D2=map(int,input().split())
if D2==1:
    print(1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split();print(max(a+b,a-b,a*b)))

Fixed submission:
a,b=map(int,input().split())
i=a+b
j=a-b
k=a*b
biggest=[i,j,k]
biggest_1=sorted(biggest)
print(biggest_1[-1])
Buggy python submission (verdict: Runtime Error):
a=input("A")
b=input("B")
c=input("C")
i=int(a)-int(b)
j=int(c)-int(i)
if j > 0:
    print(j)
else:
    print('0')


Fixed submission:
A, B, C = map(int, input().split())
print(max(C - A + B, 0))

Buggy python submission (verdict: Runtime Error):
a=input("a")
b=input("b")
i=int(a)-int(b)
c=input("c")
j=int(c)-int(i)
if j > 0:
    print(j)
else:
    print('0')


Fixed submission:
A, B, C = map(int, input().split())
print(max(C - A + B, 0))
Buggy python submission (verdict: Runtime Error):
import re
print(max(map(len, re.findall("A.*Z",input())))

Fixed submission:
import re

r = re.compile(r"A.*Z")
print(max(map(len, r.findall(input()))))
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
for i in range(h):
    str = input()+"\n"
    print(str*2)

Fixed submission:
print("vowel" if input() in ("a", "i", "u", "e", "o") else "consonant")
Buggy python submission (verdict: Runtime Error):
N=int(input())

X=int(N/1.08)
if int(X*1.08)==N:
    print(X)
else
    print(":(")

Fixed submission:
N=int(input())

X=int(N/1.08)
if int(X*1.08)==N:
    print(X)
elif int((X+1)*1.08)==N:
    print(X+1)
else:
    print(":(")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np

N=int(input())

X=np.array(list(map(int,input().split())))

for i in range(N):
	temp=X
	temp=np.delete(temp,i)
	med=np.median(temp)
	print(int(med))

Fixed submission:
import sys
import numpy as np

N=int(input())

X=np.array(list(map(int,input().split())))
temp=X
temp=np.sort(temp,kind="quicksort")
med=temp[int(N/2)]
for i in range(N):
	if X[i]<med:
		print(med)
	else:
		print(temp[int(N/2)-1])
Buggy python submission (verdict: Runtime Error):
import sys

N = int(input())

L0=2
L1=1

for i in range(N-1):
	temp=L0+L1
	L0=L1
	L1=temp
print(temp)

Fixed submission:
import sys

N = int(input())

L0=2
L1=1

temp=L1
for i in range(N-1):
	temp=L0+L1
	L0=L1
	L1=temp
print(temp)
Buggy python submission (verdict: Runtime Error):
S = raw_input().split()

if ord(S[0])<ord(S[1]):
	print("<")
elif ord(S[0])>ord(S[1]):
	print(">")
else:
	print("=")

Fixed submission:
import sys

S = input().split()

if ord(S[0])<ord(S[1]):
	print("<")
elif ord(S[0])>ord(S[1]):
	print(">")
else:
	print("=")
Buggy python submission (verdict: Runtime Error):
import datetime

M,D = map(int,input().split())
tdy = datetime.date(2019, M, D)
tmr = now + datetime.timedelta(days=1)

if tmr.day == 1:
    print("1")
else:
    print("0")

Fixed submission:
n = []
for i in range(2):
    n.append(list(map(int, input().split())))
    
if n[1][1] == 1:
    print("1")
else:
    print("0")
Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = []
for _ in range(n):
    nums.append(int(input()))

sorted(nums)
min_num = -1
max_num = -1

# 最大値
ans_right = nums.pop()
# 最小値
ans_left = nums.pop(0)
ans = abs(ans_right - ans_left)

while len(nums) > 2:
    num_max = nums[-1]
    num_min = nums[0]
    compare = [
        abs(num_max-ans_right),
        abs(num_max-ans_left),
        abs(num_min-ans_right),
        abs(num_min-ans_left)
    ]
    t = max(compare)
    c = compare.index(t)

    # 追加処理
    ans += t
    add_to_ans = num_max if c == 0 else num_min
    nums.remove(add_to_ans)
    if c % 2 == 0:
        ans_right = add_to_ans
    else:
        ans_left = add_to_ans

# add len(nums) == 1
print(ans + max(abs(nums[0]-ans_right),abs(nums[0]-ans_left)))

Fixed submission:
n = int(input())
nums = []
for _ in range(n):
    nums.append(int(input()))

nums.sort()
# 奇数は2通り
# w型とm型
if n % 2 == 1:
    w = -2*sum(nums[:n//2])+nums[n//2]+nums[n//2+1]+2*sum(nums[n//2+2:])
    m = -2*sum(nums[:n//2-1])-nums[n//2-1]-nums[n//2]+2*sum(nums[n//2+1:])
    print(max(w,m))
# 偶数は1通り
else:
    print(-2*sum(nums[:n//2-1])-nums[n//2-1]+nums[n//2]+2*sum(nums[n//2+1:]))

Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = []
for _ in range(n):
    nums.append(int(input()))

sorted(nums)
min_num = -1
max_num = -1

# 最大値
ans_right = nums.pop()
# 最小値
ans_left = nums.pop(0
ans = abs(ans_right - ans_left)

while len(nums) > 2:
    num_max = nums[-1]
    num_min = nums[0]
    compare = [
        abs(num_max-ans_right),
        abs(num_max-ans_left),
        abs(num_min-ans_right),
        abs(num_min-ans_left)
    ]
    t = max(compare)
    c = compare.index(t)

    # 追加処理
    ans += t
    add_to_ans = num_max if c == 0 else num_min
    nums.remove(add_to_ans)
    if c % 2 == 0:
        ans_right = add_to_ans
    else:
        ans_left = add_to_ans

# add len(nums) == 1
print(ans + max(abs(nums[0]-ans_right),abs(nums[0]-ans_left)))

Fixed submission:
n = int(input())
nums = []
for _ in range(n):
    nums.append(int(input()))

nums.sort()
# 奇数は2通り
# w型とm型
if n % 2 == 1:
    w = -2*sum(nums[:n//2])+nums[n//2]+nums[n//2+1]+2*sum(nums[n//2+2:])
    m = -2*sum(nums[:n//2-1])-nums[n//2-1]-nums[n//2]+2*sum(nums[n//2+1:])
    print(max(w,m))
# 偶数は1通り
else:
    print(-2*sum(nums[:n//2-1])-nums[n//2-1]+nums[n//2]+2*sum(nums[n//2+1:]))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M = map(int,input().split())
S = input()
T = input()

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
 

def lcm(a, b):
	return a * b // gcd (a, b)

L = N*M // gcd(N,M)

X = np.zeros(L, dtype=np.str)

for i in range(N):
    X[i*(L//N)] = S[i]

for i in range(M):
    if X[i*(L//M)] == '':
        X[i*(L//M)] = T[i]
    elif X[i*(L//M)] != T[i]:
        print('-1')
        exit()

print(L)

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

L = N*M // gcd(N,M)

n = L // N
m = L // M

list_n = [i for i in range(0,L,n)]
list_m = [i for i in range(0,L,m)]

list_common = sorted(list(set(list_n) & set(list_m)))

for i in list_common:
    if i == 0:
        if S[0] != T[0]:
            print('-1')
            exit()
    elif S[i//n] != T[i//m]:
        print('-1')
        exit()

print(L)

Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
N,M = map(int,input().split())
S = input()
T = input()

L = N*M // math.gcd(N,M)

X = np.zeros(L, dtype=np.str)

for i in range(N):
    X[i*(L//N)] = S[i]

for i in range(M):
    if X[i*(L//M)] == '':
        X[i*(L//M)] = T[i]
    elif X[i*(L//M)] != T[i]:
        print('-1')
        exit()

print(L)

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

L = N*M // gcd(N,M)

n = L // N
m = L // M

list_n = [i for i in range(0,L,n)]
list_m = [i for i in range(0,L,m)]

list_common = sorted(list(set(list_n) & set(list_m)))

for i in list_common:
    if i == 0:
        if S[0] != T[0]:
            print('-1')
            exit()
    elif S[i//n] != T[i//m]:
        print('-1')
        exit()

print(L)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a*b % 2 == 0:
    print('Even')
else:
    print('Odd')

Fixed submission:
a,b = [int(i) for i in input().split()]
if a*b % 2 == 0:
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for _ in range(n)]
a.insert(0,-1)
ans = 0

tmp = 1
while 1:
    current = a[tmp]
    ans += 1
    if tmp == current or current == 1:
        print(a[0])
        exit()
    elif current == 2:
        print(ans)
        exit()
    else:
        tmp = current

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
a.insert(0,-1)
ans = 0

tmp = 1
for i in range(1,n+1):
    current = a[tmp]
    ans += 1
    if current == 2:
        print(ans)
        exit()
    else:
        tmp = current

print(a[0])
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Fixed submission:
a,b,c = input().split()
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')
Buggy python submission (verdict: Runtime Error):
m, d = map(int, raw_input().split())
raw_input()
if m in (1,3,5,7,8,10,12) and d == 31:
  print(1)
elif m in (4,6,9,11) and d == 30:
  print(1)
elif m == 2 and d == 28:
  print(1)
else:
  print(0)


Fixed submission:
m, d = map(int, raw_input().split())
raw_input()
if m in (1,3,5,7,8,10,12) and d == 31:
  print(1)
elif m in (4,6,9,11) and d == 30:
  print(1)
elif m == 2 and d == 28:
  print(1)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
m, d = map(int, raw_input().split())
if m in (1,3,5,7,8,10,12) and d == 31:
  print(1)
elif m in (4,6,9,11) and d == 30:
  print(1)
elif m == 2 and d == 28:
  print(1)
else:
  print(0)


Fixed submission:
m, d = map(int, raw_input().split())
raw_input()
if m in (1,3,5,7,8,10,12) and d == 31:
  print(1)
elif m in (4,6,9,11) and d == 30:
  print(1)
elif m == 2 and d == 28:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n = raw_input()
l = raw_input().split()
print(sum(sorted(l, reverse=True)[1::2]))

Fixed submission:
n = raw_input()
l = raw_input().split()
print(sum(sorted(map(int,l), reverse=True)[1::2]))
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

if A >= B: print(2*A)
elif: print(2*B) 
  

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

if A > B: print(2*A-1)
elif A == B: print(2*A)
else: print(2*B-1)
Buggy python submission (verdict: Runtime Error):
N = int(intput())
H = list(map(int, input().split()))

ans = 0
max_H = 0
for h in H:
  if h >= max_H:
    h = max_H
    ans += 1

print(ans)

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

ans = 0
max_H = 0
for h in H:
  if h >= max_H:
    max_H = h
    ans += 1

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a = prime_factorize(n = N)

if len(a) > 2:
    b = a[0] * a[1]
    if b > 9:
        print('No')
    else:
        print('Yes')
else:
    if (a[0] > 9):
        print('No')
    else:
        print('Yes')

Fixed submission:
N = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    a.sort(reverse = True)
    return a

a = prime_factorize(n = N)
ans = 'Yes'


if len(a) == 0:
    if N > 9:
        ans = 'No'
elif len(a) > 4:
    if N / 8 > 9:
        ans = 'No'
elif len(a) == 3:
    if a[1] * a[2] > 9:
        ans = 'No'
else:
    n = N
    b = []
    for i in a:
        n = n / i
        b.append(n)

    if a[0] > 9:
        ans = 'No'
    if N > 81:
        ans = 'No'
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]

import pandas as pd
a = pd.DataFrame({'a': A})
a.index = range(1, N + 1)
b = a.sort_values('a')
l = b.index.tolist()
print(*l)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

l = [0] * N

for i, a in enumerate(A):
    l[int(a - 1)] = str(i + 1)
print(*l)

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

l = []
A2 = sorted(A)
for i in range(N):
    a = A2[i]
    idx = A.index(a)
    l.append(idx + 1)
print(*l)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

l = [0] * N

for i, a in enumerate(A):
    l[int(a - 1)] = str(i + 1)
print(*l)

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

l = []
AA = A.copy()

for k in range(N):
    Amin = min(AA)
    #print(Amin)
    a = A.index(Amin)
    l.append(a + 1)
    AA.remove(Amin)
print(*l)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

l = [0] * N

for i, a in enumerate(A):
    l[int(a - 1)] = str(i + 1)
print(*l)

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

l = []
AA = A.copy()
for k in range(N):
    Amin = min(AA)
    for i in range(len(A)):
        a = A[i]
        if Amin == a:
            l.append(i + 1)
    AA.remove(Amin)
print(*l)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

l = [0] * N

for i, a in enumerate(A):
    l[int(a - 1)] = str(i + 1)
print(*l)