Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
pos = [list(map(int,input().split())) for p in range(n)]
for i in range(1,en(pos)):
  diff = pos[i+1][0]-pos[i][0]
  num = abs(pos[i][1]-pos[i+1][1]) + abs(pos[i][2]-pos[i+1][2])
  if((pos[i][0]-pos[i-1][0])>=(abs(pos[i][1]-pos[i-1][1])+abs(pos[i][2]-pos[i-1][2])) and (pos[i][0]-pos[i-1][0])%2==(abs(pos[i-1][1]-pos[i][1])+abs(pos[i][2]-pos[i-1][2]))%2):
    pass
  else:
    print("No")
    sys.exit()      
print("Yes")
    


Fixed submission:
n=int(input())
x,y=0,0
t=0
for i in range(n):
    T,X,Y=map(int,input().split())
    if((T-t)>=(abs(X-x)+abs(Y-y)) and (T-t)%2==(abs(x-X)+abs(Y-y))%2):
        x=X
        y=Y
        t=T
    else:
        print("No")
        exit()
print("Yes")

Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
pos = [list(map(int,input().split())) for p in range(n)]
for i in range(1,en(pos)):
  diff = pos[i+1][0]-pos[i][0]
  num = abs(pos[i][1]-pos[i+1][1]) + abs(pos[i][2]-pos[i+1][2])
  if((pos[i][0]-pos[i-1][0])>=(abs(pos[i][1]-pos[i-1][0])+abs(pos[i][2]-pos[i-1][0])) and (pos[i][0]-pos[i-1][0])%2==(abs(pos[i-1][1]-pos[i][1])+abs(pos[i][0]-pos[i-1][0]))%2):
    pass
  else:
    print("No")
    sys.exit()      
print("Yes")
    


Fixed submission:
n=int(input())
x,y=0,0
t=0
for i in range(n):
    T,X,Y=map(int,input().split())
    if((T-t)>=(abs(X-x)+abs(Y-y)) and (T-t)%2==(abs(x-X)+abs(Y-y))%2):
        x=X
        y=Y
        t=T
    else:
        print("No")
        exit()
print("Yes")

Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
pos = [list(map(int,input().split())) for p in range(n)]
for i in range(len(pos)):
  if i == 0:
    num = abs(pos[i][1]-0) + abs(pos[i][2]-0)
    if num <= diff and diff * (diff%2) == num%2:
      pass
    else:
      print("No")
      sys.exit()     
  else:
    diff = pos[i][0]-pos[i-1][0]
    num = abs(pos[i][1]-pos[i-1][1]) + abs(pos[i][2]-pos[i-1][2])
    if num <= diff and diff * (diff%2) == num%2:
      pass
    else:
      print("No")
      sys.exit()      
print("Yes")
    


Fixed submission:
n=int(input())
x,y=0,0
t=0
for i in range(n):
    T,X,Y=map(int,input().split())
    if((T-t)>=(abs(X-x)+abs(Y-y)) and (T-t)%2==(abs(x-X)+abs(Y-y))%2):
        x=X
        y=Y
        t=T
    else:
        print("No")
        exit()
print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = 0
num = 0
for k in range(min(a)-1,max(a)+1):
  num = a.count(k)+a.count(k-1)+a.count(k+1)
  ans = max(ans,num)
print(ans)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
memo = [0]*(10**5+2)
ans = 1
for i in range(N):
  memo[a[i]] += 1
  memo[a[i]+1] += 1
  memo[a[i]-1] += 1
print(max(memo))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
aa =set(a)
ans = 0
num = 0
for k in aa:
  num = a.count(k)+a.count(k-1)+a.count(k+1)
  ans = max(ans,num)
print(ans)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
memo = [0]*(10**5+2)
ans = 1
for i in range(N):
  memo[a[i]] += 1
  memo[a[i]+1] += 1
  memo[a[i]-1] += 1
print(max(memo))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
aa =set(a)
ans = 0
num = 0
for k in aa:
  num = a.count(k)+a.count(k-1)+a.count(k+1)
  ans = max(ans,num)
print(ans)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
memo = [0]*(10**5+2)
ans = 1
for i in range(N):
  memo[a[i]] += 1
  memo[a[i]+1] += 1
  memo[a[i]-1] += 1
print(max(memo))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
a = list(map(int,input().split()))
aa = collections.Counter(a)
ans = 0
num = 0
for k in aa.keys():
  num = a.count(k)+a.count(k-1)+a.count(k+1)
  ans = max(ans,num)
print(ans)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
memo = [0]*(10**5+2)
ans = 1
for i in range(N):
  memo[a[i]] += 1
  memo[a[i]+1] += 1
  memo[a[i]-1] += 1
print(max(memo))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
a = list(map(int,input().split()))
aa = collections.Counter(a)
ans = 0
num = 0
for k,v in aa.items():
  num = a.count(k)+a.count(k-1)+a.count(k+1)
  ans = max(ans,num)
print(ans)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
memo = [0]*(10**5+2)
ans = 1
for i in range(N):
  memo[a[i]] += 1
  memo[a[i]+1] += 1
  memo[a[i]-1] += 1
print(max(memo))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = 0
num = 0
for aa in a:
  num = a.count(aa-1)+a.count(aa)+a.count(aa+1)
  ans = max(ans,num)
print(ans)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
memo = [0]*(10**5+2)
ans = 1
for i in range(N):
  memo[a[i]] += 1
  memo[a[i]+1] += 1
  memo[a[i]-1] += 1
print(max(memo))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
s = sorted(a)
k = s[(n//2)-1]
ans = 0
for i in s:
  if i == s[k] or i == s[k]-1 or i ==s[k]+1:
    ans += 1
print(ans)


Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
memo = [0]*(10**5+2)
ans = 1
for i in range(N):
  memo[a[i]] += 1
  memo[a[i]+1] += 1
  memo[a[i]-1] += 1
print(max(memo))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for l in range(n)]
flag = True
ans = 0
i = a[0]
while flag:
  i = a[i-1]
  ans += 1
  if i == 2:
    print(ans+1)
    flag = False
  else:
    count += 1
    if count >= n:
      print(-1)
      flag = False
    
    

Fixed submission:
n = int(input())
a = [int(input()) for l in range(n)]
count = 0
for i in range(n):
  if a[count] == 2:
    print(i+1)
    exit()
  else:
    count = a[count]-1
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
i = int(input())
p = 1
m = (10 **9)+7 
for ii in range(1,i+1):
	ii %= m
	p *= ii

print(p % m)
          

Fixed submission:
i = int(input())
p = 1
M = 10 **9+7 
for ii in range(1,i+1):
	ii %= M
	p *= ii
	p %= M
print(p)

Buggy python submission (verdict: Time Limit Exceeded):
i = int(input())
p = 1
for ii in range(1,i+1):
	p *= ii

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

Fixed submission:
i = int(input())
p = 1
M = 10 **9+7 
for ii in range(1,i+1):
	ii %= M
	p *= ii
	p %= M
print(p)

Buggy python submission (verdict: Time Limit Exceeded):
i = int(input())
p = 1
for ii in range(1,i+1):
	p *= ii
ans = int(p % ((10 **9) +7))
print(ans)

Fixed submission:
i = int(input())
p = 1
M = 10 **9+7 
for ii in range(1,i+1):
	ii %= M
	p *= ii
	p %= M
print(p)
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
student = input()
passp = 0
passb = 0
for s in student:
	if s == "a":
		if passp < (A+B):
			passp += 1
			print("Yes")
 		else:
			print("No")
	elif s == "b":
		if passp < (A+B) and passb < B:
			passp += 1
			passb += 1
			print("Yes")
		else:
			print("No")
	else:
		print("No")

Fixed submission:
N,A,B = map(int,input().split())
student = input()
passp = 0
passb = 0
ab = (A+B)
for s in student:
	if s == "a":
		if passp < ab:
			passp += 1
			print("Yes")
		else:
			print("No")
	elif s == "b":
		if passp < ab and passb < B:
			passp += 1
			passb += 1
			print("Yes")
		else:
			print("No")
	else:
		print("No")

Buggy python submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
student = input()
passp = 0
passb = 0
for s in student:
	if s == "a":
		if passp < (A+B):
			passp += 1
			print("YES")
 		else:
			print("NO")
	elif s == "b":
		if passp < (A+B) and passb < B:
			passp += 1
			passb += 1
			print("YES")
		else:
			print("NO")
	else:
		print("NO")

Fixed submission:
N,A,B = map(int,input().split())
student = input()
passp = 0
passb = 0
ab = (A+B)
for s in student:
	if s == "a":
		if passp < ab:
			passp += 1
			print("Yes")
		else:
			print("No")
	elif s == "b":
		if passp < ab and passb < B:
			passp += 1
			passb += 1
			print("Yes")
		else:
			print("No")
	else:
		print("No")
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sun Aug  2 21:11:34 2020

@author: NEC-PCuser
"""

N = int(input())

s = input()

l = 0
r = len(s) - 1
count = 0
while True:
	flg = False
	for i in range(l, r):
		if (s[i] == 'W'):
			l = i + 1
			flg = True
			break
	for j in range(r, l - 1, -1):
		if (s[j] == 'R'):
			r = j - 1
			if flg:
				count += 1
			break
	if flg == False:
		break
print(count)


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Aug  2 21:11:34 2020

@author: NEC-PCuser
"""

N = int(input())

s = input()

l = 0
r = len(s) - 1
count = 0
while True:
	flg = False
	for i in range(l, r):
		if (s[i] == 'W'):
			l = i + 1
			flg = True
			break
	for j in range(r, l - 1, -1):
		if (s[j] == 'R'):
			r = j - 1
			if flg:
				count += 1
			break
	else:
		break
	if flg == False:
		break
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sun Aug  2 21:11:34 2020

@author: NEC-PCuser
"""

N = int(input())

s = input()

l = 0
r = len(s) - 1
count = 0
while True:
	flg = False
	for i in range(l, r):
		if (s[i] == 'W'):
			l = i + 1
			flg = True
			break
	for j in range(r, l - 1, -1):
		if (s[j] == 'R'):
			r = j - 1
			if flg:
				count += 1
				str_list = list(s)
				str_list[l - 1] = 'R'
				str_list[r + 1] = 'W'
				s = "".join(str_list)
			break
	if flg == False:
		break
print(count)
	

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Aug  2 21:11:34 2020

@author: NEC-PCuser
"""

N = int(input())

s = input()

l = 0
r = len(s) - 1
count = 0
while True:
	flg = False
	for i in range(l, r):
		if (s[i] == 'W'):
			l = i + 1
			flg = True
			break
	for j in range(r, l - 1, -1):
		if (s[j] == 'R'):
			r = j - 1
			if flg:
				count += 1
			break
	else:
		break
	if flg == False:
		break
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 28 13:44:44 2020

@author: NEC-PCuser
"""
N = int(input())
ans = 0
for i in range(1, N + 1):
    for j in range(i, N + 1, i):
        ans += j

print(ans)
    

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 28 13:44:44 2020

@author: NEC-PCuser
"""
N = int(input())
ans = 0
for i in range(1, N + 1):
    n = N // i
    ans += i * n * (n + 1) // 2 

print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 13 21:30:21 2020

@author: NEC-PCuser
"""


A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())


dis = abs(A - B)
soutai_v = V - W

if dis == 0:
    print("YES")
elif soutai_v <= 0:
    print("NO")
else:
    amari = dis % soutai_v
    shou = dis // soutai_v

    if shou > T or (shou == T and amari != 0):
        print("NO")
    else:
        print("YES")



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 13 21:27:14 2020

@author: NEC-PCuser
"""

print(input()[0:3])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 20 10:11:22 2020

@author: NEC-PCuser
"""

N, K = map(int, input().split())

A = list(map(int, input().split()))

tele_set = set()
tele_set.add(1)
junkai_town = -1 
junkai_first = -1
junkai_second = -1
for i in range(N):
    if A[i] not in tele_set:
        tele_set.add(A[i])
    else:
        junkai_town = A[i] - 1
        junkai_second = i
        break

town = 0
start_flg = False
junkaimae_list = []
junkai_list = []
for i in range(N):
    if town == junkai_town and start_flg == False:
        junkai_first = i
        start_flg = True
    elif town == junkai_town:
        break
    if start_flg == True:
        junkai_list.append(town)
    else:
        junkaimae_list.append(town)
    town = A[town] - 1

if K <= len(junkaimae_list):
    print(junkaimae_list[K - 1] + 1)
else:
    kaisu = K - len(junkaimae_list)
    print(junkai_list[kaisu % len(junkai_list)] + 1)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 20 10:11:22 2020

@author: NEC-PCuser
"""

N, K = map(int, input().split())

A = list(map(int, input().split()))

tele_set = set()
tele_set.add(1)
junkai_town = -1 
junkai_first = -1
town = 1
for i in range(N):
    if A[town - 1] not in tele_set:
        tele_set.add(A[town - 1])
    else:
        junkai_town = A[town - 1]
        break
    town = A[town - 1] 

town = 1
start_flg = False
junkaimae_list = []
junkai_list = []
for i in range(N):
    if town == junkai_town and start_flg == False:
        junkai_first = i
        start_flg = True
    elif town == junkai_town:
        break
    if start_flg == True:
        junkai_list.append(town)
    else:
        junkaimae_list.append(town)
    town = A[town - 1]


if K < len(junkaimae_list):
    print(junkaimae_list[K])
else:
    kaisu = K - len(junkaimae_list)
    print(junkai_list[kaisu % len(junkai_list)])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Mon Jun  1 16:47:45 2020

@author: NEC-PCuser
"""

N = int(input())
S = input()
count = 0
for i in range(0, 1000):
    j = 0
    a = str(i).zfill(3)
    for k in S:
        if (a[j] == k):
            j += 1
        if (j == 3):
            count += 1
            break
            
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Jun  1 16:47:45 2020

@author: NEC-PCuser
"""

N = int(input())
S = input()
count = 0
for i in range(0, 1000):
    j = 0
    a = str(i).zfill(3)
    b = S.find(a[0])
    if b == -1:
        continue
    c = S[b+1:].find(a[1])
    if c == -1:
        continue
    d= S[b+c+2:].find(a[2])
    if d != -1:
        count += 1
    
            
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Mon Jun  1 16:47:45 2020

@author: NEC-PCuser
"""

N = int(input())
S = input()
count = 0
for i in range(0, 1000):
    j = 0
    a = str(i).zfill(3)
    for k in range(0, N):
        if (a[j] == S[k]):
            j += 1
        if (j == 3):
            count += 1
            break
            
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Jun  1 16:47:45 2020

@author: NEC-PCuser
"""

N = int(input())
S = input()
count = 0
for i in range(0, 1000):
    j = 0
    a = str(i).zfill(3)
    b = S.find(a[0])
    if b == -1:
        continue
    c = S[b+1:].find(a[1])
    if c == -1:
        continue
    d= S[b+c+2:].find(a[2])
    if d != -1:
        count += 1
    
            
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Mon Jun  1 16:47:45 2020

@author: NEC-PCuser
"""

N = int(input())
S = input()
count = 0
for i in range(0, 1000):
    j = 0
    a = str(i).zfill(3)
    for k in range(0, len(S)):
        if (a[j] == S[k]):
            j += 1
        if (j == 3):
            count += 1
            break
            
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Jun  1 16:47:45 2020

@author: NEC-PCuser
"""

N = int(input())
S = input()
count = 0
for i in range(0, 1000):
    j = 0
    a = str(i).zfill(3)
    b = S.find(a[0])
    if b == -1:
        continue
    c = S[b+1:].find(a[1])
    if c == -1:
        continue
    d= S[b+c+2:].find(a[2])
    if d != -1:
        count += 1
    
            
print(count)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Jun  3 14:11:35 2020

@author: NEC-PCuser
"""
def gcd(a, b):
    
    if (a % b == 0):
        return b
    return gcd(b, a % b)

def factorize(num):
    i = 2
    factorize_list = []
    num_tmp = num
    while i * i <= num_tmp:
        count = 0
        if num % i == 0:
            while num % i == 0:
                count += 1
                num /= i
            factorize_list.append([i, count])
        i += 1
    return factorize_list 
                


if __name__ == "__main__":
    A, B =  map(int, input().split())
    big_num = max(A, B)
    short_num = min(A, B)
    gcd_num = gcd(big_num, short_num)
    print(len(factorize(gcd_num) + 1))
            

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Jun  3 14:11:35 2020

@author: NEC-PCuser
"""
def gcd(a, b):
    
    if (a % b == 0):
        return b
    return gcd(b, a % b)

def factorize(num):
    i = 2
    factorize_list = []
    num_tmp = num
    while i * i <= num_tmp:
        count = 0
        if num % i == 0:
            while num % i == 0:
                count += 1
                num //= i
            factorize_list.append([i, count])
        i += 1
    if num != 1:
        factorize_list.append([num, 1])
    return factorize_list 
                


if __name__ == "__main__":
    A, B =  map(int, input().split())
    big_num = max(A, B)
    short_num = min(A, B)
    gcd_num = gcd(big_num, short_num)
    print(len(factorize(gcd_num)) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Wed Jun  3 18:35:23 2020

@author: NEC-PCuser
"""

N, M = map(int, input().split())
A = list(map(int, input().split()))

for i in range(M):
    A.sort()
    A[len(A) - 1] = A[len(A) - 1] // 2

ans = 0
for j in range(len(A)):
    ans += A[j]

print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Jun  3 18:35:23 2020

@author: NEC-PCuser
"""
import heapq

N, M = map(int, input().split())
A = [-int(n) for n in input().split(" ")]

heapq.heapify(A)

for i in range(M):
    most_expensive = -heapq.heappop(A)
    most_expensive //= 2
    heapq.heappush(A, -most_expensive)
    
print(-sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sun May 31 13:40:00 2020

@author: NEC-PCuser
"""
def fibonatch(a, N):
    #d[i][j]: iからjへの最短距離
    n1, n2 = 1, 1
    if N == 0:
        return 1
    elif N == 1:
        return 1
    else:
        for i in range(N - 1):
            if str(i) in a:
                n2 = 0
            if str(i + 1) in a:
                n1 = 0
            n1, n2 = n1 + n2, n1
        return (n1) % 1000000007



if __name__ == "__main__":
    N, M = map(int, input().split())
    a = []
    for i in range(M):
        a.append(input())
    
    print(fibonatch(a, N))


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun May 31 13:40:00 2020

@author: NEC-PCuser
"""
def fibonatch(a, N):
    #d[i][j]: iからjへの最短距離
    n1, n2 = 1, 1
    if N == 0:
        return 1
    elif N == 1:
        return 1
    else:
        for i in range(N - 1):
            if a[i] == 1:
                n1 = 0
            if a[i + 1] == 1:
                n2 = 0
            n1, n2 = n1 + n2, n1
        return (n1) % 1000000007



if __name__ == "__main__":
    N, M = map(int, input().split())
    a = [0] * N
    for i in range(M):
        a[int(input()) - 1] = 1
    
    print(fibonatch(a, N))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 20:59:16 2019

@author: doppe
"""

N, M = map(int, input().split())
likeList = []

for i in range(0, N):
    L = [int(i) for i in input().split()]
    likeListTmp = []
    if (i == 0):
        likeList = L
    else:
        for j in range(1, L[0] + 1):
            if (L[j] in likeList):
                likeListTmp.append(L[j])
        likeList = likeListTmp

print(len(likeList))

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 20:59:16 2019

@author: doppe
"""

A, B = map(int, input().split())

if (B % A == 0):
    print(A + B)
else:
    print(B - A)
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    n = int(input())
    c = []
    d = []
    e = []
    
    for i in range(0, n):
        a, b = map(int, input().split())
        c.append(a)
        d.append(b)
        e.append(a + b)
    
    li1, li2 = sorted(e), sorted(range(len(e)), key=lambda k: e[k])
    
    turn = 0
    happy = 0

    for i in range(n - 1, -1, -1):
        now = li1[i]
        if (turn == 0):
            max = 0
            maxKey = 0
            for j in range(i, -1, -1):
                if (now == li1[j] and max < c[li2[j]]):
                    max = c[li2[j]]
                    maxKey = j
                else:
                    li2[i], li2[maxKey] = li2[maxKey], li2[i]
                    break
            happy += c[li2[i]]
        else:

            max = 0
            maxKey = 0
            for j in range(i, -1, -1):
                if (now == li1[j] and max < d[li2[j]]):
                    max = d[li2[j]]
                    maxKey = j
                else:
                    li2[i], li2[maxKey] = li2[maxKey], li2[i]
                    break

            happy -= d[li2[i]]
        turn = (turn + 1) % 2
    print(happy)
    


    
    


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

c = 0
d = a + b -n
if (a > b):
    c = b
else:
    c = a

if (d < 0):
    d = 0
    
print(str(c) + " " + str(d))

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

c = 0
d = a + b -n
if (a > b):
    c = b
else:
    c = a

if (d < 0):
    d = 0
    
print(str(c) + " " + str(d))

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

c = 0
d = a + b -n
if (a > b):
    c = b
else:
    c = a

if (d < 0):
    d = 0
    
print(str(c) + " " + str(d))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Fri Jun  5 09:50:00 2020

@author: NEC-PCuser
"""

H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))

gazo = [[0] * W  for i in range(H)]

count = 0
start_H = 0
start_W = 0
direction = 0
for i in range(len(a)):
    for j in range(a[i]):
        gazo[start_H][start_W] = i + 1
        if (start_W < W - 1 and direction == 0):
            start_W += 1
        elif (start_W == W - 1 and direction == 0):
            start_H += 1
            direction = 1
        elif (start_W > 0 and direction == 1):
            start_W -= 1
        elif (start_W == 0 and direction == 1):
            start_H += 1
            direction = 1

for i in range(len(gazo)):
    print(' '.join(map(str, gazo[i])))

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Fri Jun  5 09:50:00 2020

@author: NEC-PCuser
"""

H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))

gazo = [[0] * W  for i in range(H)]

count = 0
start_H = 0
start_W = 0
direction = 0
for i in range(len(a)):
    for j in range(a[i]):
        gazo[start_H][start_W] = i + 1
        if (start_W < W - 1 and direction == 0):
            start_W += 1
        elif (start_W == W - 1 and direction == 0):
            start_H += 1
            direction = 1
        elif (start_W > 0 and direction == 1):
            start_W -= 1
        elif (start_W == 0 and direction == 1):
            start_H += 1
            direction = 0
    
for i in range(len(gazo)):
    print(' '.join(map(str, gazo[i])))