Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
ans = []
for i in range(n):
  for j in range(n-1):
    if j >= i and a[j]-a[i] <= 2:
      #print(i,j)
      count += 1
    else:
      ans.append(count)
      count = 0
if n == 1:
  print(1)
else:
  print(max(ans))

Fixed submission:
s = list(input())
a = []
for i in range(len(s)):
  if 2*i+1 <= len(s):
    a.append(s[2*i])
  else:
    break
print(''.join(a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
ans = []
for i in range(n):
  for j in range(n-1):
    if j >= i:
      if a[j]-a[i] <= 2:
        #print(i,j)
        count += 1
      else:
        if count != 0:
          ans.append(count)
        count = 0
        i += 1
    else:
      continue
#print(ans)
if n == 1:
  print(1)
else:
  print(max(ans))

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
p1 = []
for i in range(n):
  p1.append(a[i]-1)
p2 = []
for i in range(n):
  p2.append(a[i]+1)
chk = a+p1+p2
chk.sort()
#print(chk)
ans =[]
count = 0
for i in range(3*n-1):
  if chk[i+1] == chk[i]:
    count += 1
  else:
    ans.append(count)
    count = 0
print(max(ans)+1)

Buggy python submission (verdict: Runtime Error):
ans = []
for i in range(n):
  for j in range(n-1):
    if j >= i:
      if a[j]-a[i] <= 2:
        #print(i,j)
        count += 1
      else:
        if count != 0:
          ans.append(count)
        count = 0
        i += 1
    else:
      continue
if n == 1:
  print(1)
else:
  print(max(ans))

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
p1 = []
for i in range(n):
  p1.append(a[i]-1)
p2 = []
for i in range(n):
  p2.append(a[i]+1)
chk = a+p1+p2
chk.sort()
#print(chk)
ans =[]
count = 0
for i in range(3*n-1):
  if chk[i+1] == chk[i]:
    count += 1
  else:
    ans.append(count)
    count = 0
print(max(ans)+1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
ans = []
for i in range(n):
  for j in range(n-1):
    if j >= i and a[j]-a[i] <= 2:
      #print(i,j)
      count += 1
    else:
      ans.append(count)
      count = 0
if n == 1:
  print(1)
else:
  print(max(ans))

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
p1 = []
for i in range(n):
  p1.append(a[i]-1)
p2 = []
for i in range(n):
  p2.append(a[i]+1)
chk = a+p1+p2
chk.sort()
#print(chk)
ans =[]
count = 0
for i in range(3*n-1):
  if chk[i+1] == chk[i]:
    count += 1
  else:
    ans.append(count)
    count = 0
print(max(ans)+1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
ans = []
for i in range(n):
  for j in range(n-1):
    if j >= i and a[j]-a[i] <= 2:
      #print(i,j)
      count += 1
    else:
      ans.append(count)
      count = 0
if n == 1:
  print(1)
else:
  print(max(ans))

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
p1 = []
for i in range(n):
  p1.append(a[i]-1)
p2 = []
for i in range(n):
  p2.append(a[i]+1)
chk = a+p1+p2
chk.sort()
#print(chk)
ans =[]
count = 0
for i in range(3*n-1):
  if chk[i+1] == chk[i]:
    count += 1
  else:
    ans.append(count)
    count = 0
print(max(ans)+1)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
g = a[0]
for i in a:
  g = gcd(g,a)
  
if k%g != 0:
  print('IMPOSSIBLE')
elif k<=max(a):
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Fixed submission:
from fractions import gcd
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
g = a[0]
for i in a:
  g = gcd(g,i)
  
if k%g != 0:
  print('IMPOSSIBLE')
elif k<=max(a):
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
	a.append(int(input()))
t = [0]
ans = 1
if t == 2:
	print(ans)
else:
	while True:
		t = a[t-1]
		ans += 1
		if t == 2:
			print(ans)
			break
		if ans > n:
			print('-1')
			break

Fixed submission:
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
t = a[0]
ans = 1
if t == 2:
	print(ans)
else:
	while True:
		t = a[t-1]
		ans += 1
		if t == 2:
			print(ans)
			break
		if ans > n:
			print('-1')
			break
Buggy python submission (verdict: Runtime Error):
n,m = map(int(input().split()))
if abs(n-m) < 2:
  print('Brown')
else:
  print('Alice')

Fixed submission:
n,m = map(int,input().split())
if abs(n-m) < 2:
  print('Brown')
else:
  print('Alice')
Buggy python submission (verdict: Runtime Error):
W,a,b = [int(i) for i in input().split()]
ans = 0
if a <= b <= a+w or b <= a <= b+w:
  print(ans)
else:
  ans = min(abs(b-a-w),abs(a-b-w))
  print(ans)

Fixed submission:
w,a,b = [int(i) for i in input().split()]
ans = 0
if a <= b <= a+w or b <= a <= b+w:
  print(ans)
else:
  ans = min(abs(b-a-w),abs(a-b-w))
  print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = [int(i) for i in input().split()]
a = []
for i in range(n):
	array = input()
	a.append(array)
b = []
for i in range(m):
	line = input()
	b.append(line)
ans 'No'
for i in range (n-m+1):
	for j in range(n-m+1):
		Ans = ans
		if a[i][j:j+m] == b[0]:
			print(i,j)
			for k in range(m):
				if not a[i+k][j:j+m] == b[k]:
					ans = Ans
					continue
				else:
					ans = 'Yes'
					print(ans)
					break
print(ans)

Fixed submission:
n,m = [int(i) for i in input().split()]
a = []
for i in range(n):
	array = input()
	a.append(array)
b = []
for i in range(m):
	line = input()
	b.append(line)
ans = 'No'
for i in range (n-m+1):
	for j in range(n-m+1):
		Ans = ans
		if a[i][j:j+m] == b[0]:
			#print(i,j)
			for k in range(m):
				if not a[i+k][j:j+m] == b[k]:
					ans = Ans
					break
				else:
					ans = 'Yes'
					#print(ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split()]
a = []
for i in range(N):
	array = input()
	a.append(array)
b = []
for i in range(M):
	line = input()
	b.append(line)
for i in range(N-M):
	for j in range(N-M):
		ans = 'Yes'
		for n in range(M):
			for m in range(M):
				if a[i+n][j+m] == b[n][m]:
					pass
					#print(i,j,n,m)
				else:
					ans = 'No'
print(ans)

Fixed submission:
n,m = [int(i) for i in input().split()]
a = []
for i in range(n):
	array = input()
	a.append(array)
b = []
for i in range(m):
	line = input()
	b.append(line)
ans = 'No'
for i in range (n-m+1):
	for j in range(n-m+1):
		Ans = ans
		if a[i][j:j+m] == b[0]:
			#print(i,j)
			for k in range(m):
				if not a[i+k][j:j+m] == b[k]:
					ans = Ans
					break
				else:
					ans = 'Yes'
					#print(ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split()]
a = []
for i in range(N):
	array = input()
	a.append(array)
b = []
for i in range(M):
	line = input()
	b.append(line)
for i in range(N-M):
	for j in range(N-M):
		ans = 'Yes'
		for n in range(M):
			for m in range(M):
				if a[i+n][j+m] == b[n][m]:
					pass
					print(i,j,n,m)
				else:
					ans = 'No'
print(ans)

Fixed submission:
n,m = [int(i) for i in input().split()]
a = []
for i in range(n):
	array = input()
	a.append(array)
b = []
for i in range(m):
	line = input()
	b.append(line)
ans = 'No'
for i in range (n-m+1):
	for j in range(n-m+1):
		Ans = ans
		if a[i][j:j+m] == b[0]:
			#print(i,j)
			for k in range(m):
				if not a[i+k][j:j+m] == b[k]:
					ans = Ans
					break
				else:
					ans = 'Yes'
					#print(ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
t = s[::-1]
a = s.index('a')
z = t.index('z')
print(len(s)-a-z)

Fixed submission:
s = input()
t = s[::-1]
a = s.index('A')
z = t.index('Z')
print(len(s)-a-z)

Buggy python submission (verdict: Runtime Error):
s = input()
t = s[::-1]
a = s.index('a')
z = t.index('z')
print(len(s)-a-z)

Fixed submission:
s = input()
t = s[::-1]
a = s.index('A')
z = t.index('Z')
print(len(s)-a-z)

Buggy python submission (verdict: Runtime Error):
s = input
t = s[::-1]
a = s.index('a')
z = t.index('z')
print(len(s)-a-z)

Fixed submission:
s = input()
t = s[::-1]
a = s.index('A')
z = t.index('Z')
print(len(s)-a-z)
Buggy python submission (verdict: Time Limit Exceeded):
K,S = [int(i) for i in input().split()]
count = 0
for z in range(0,K+1):
	for y in range(0,z+1):
		for x in range(0,y+1):
			if x + y + z == S:
				if  x == y and y == z:
					count += 1
				elif (x-y)*(y-z)*(z-x) == 0:
					count += 3
				else:
					count += 6
print(count)

Fixed submission:
K,S = [int(i) for i in input().split()]
count = 0
for z in range(0,K+1):
	for y in range(0,K+1):
			if 0 <= S-y-z <= K:
				count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = [int(i) for i in input().split()]
count = 0
for z in range(0,K+1):
	for y in range(0,z+1):
		for x in range(0,y+1):
			if x > y:
				continue
			elif y > z:
				continue
			elif x > z:
				continue
			else:
				if x + y + z == S:
					if  x == y and y == z:
						count += 1
					elif (x-y)*(y-z)*(z-x) == 0:
						count += 3
					else:
						count += 6
print(count)

Fixed submission:
K,S = [int(i) for i in input().split()]
count = 0
for z in range(0,K+1):
	for y in range(0,K+1):
			if 0 <= S-y-z <= K:
				count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = [int(i) for i in input().split()]
count = 0
for x in range(0,K+1):
	for y in range(0,K+1):
		for z in range(0,K+1):
			if x > y:
				continue
			elif y > z:
				continue
			elif x > z:
				continue
			else:
				if x + y + z == S:
					if  x == y and y == z:
						count += 1
					elif (x-y)*(y-z)*(z-x) == 0:
						count += 3
					else:
						count += 6

						
print(count)

Fixed submission:
K,S = [int(i) for i in input().split()]
count = 0
for z in range(0,K+1):
	for y in range(0,K+1):
			if 0 <= S-y-z <= K:
				count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
ans = b//x - a//x
if a%x == 0:
  ams += 1
print(ans)

Fixed submission:
a,x,c = input().split()
X = x[0]
list = ['A',X,'C']
ans = ''.join(list)
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
if a == 0:
  ans = b//x + 1
else:
  ans = b//x - a//x
  if a%x == 0:
    ams += 1
print(ans)

Fixed submission:
a,x,c = input().split()
X = x[0]
list = ['A',X,'C']
ans = ''.join(list)
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
if a == 0:
  ans = b//x + 1
else:
  ans = (b-a+1)//x
  if a%x == 0 and b%x == 0:
    ans = ans + 1
  if x == 1:
    ans = ans - 1
print(ans)

Fixed submission:
a,x,c = input().split()
X = x[0]
list = ['A',X,'C']
ans = ''.join(list)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
ans = b//x - a//x
if a%x == 0:
  ams += 1
print(ans)

Fixed submission:
a,b,x = map(int,input().split())
ans = b//x - a//x
if a%x == 0:
  ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
ans = b//x - a//x
  if a%x == 0:
    ams += 1
print(ans)

Fixed submission:
a,b,x = map(int,input().split())
ans = b//x - a//x
if a%x == 0:
  ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
if a == 0:
  ans = b//x + 1
else:
  ans = b//x - a//x
  if a%x == 0:
    ams += 1
print(ans)

Fixed submission:
a,b,x = map(int,input().split())
ans = b//x - a//x
if a%x == 0:
  ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N,K = int(input().split())
print(int(K*((K-1)**(N-1))))

Fixed submission:
N,K = map(int,input().split())
print(int(K*(K-1)**(N-1)))
Buggy python submission (verdict: Time Limit Exceeded):
import re
s = input()
k = int(input())
n = len(s)
for i in range(n):
  si = s[i]
  num = ord(si)
  if num == 97 or 123-num > k:
    continue
  k -= (123-num)
  s = re.sub(si,'a',s,1)
if k > 0:
  t = k%26
  s = s[:n-1] + chr(ord(s[n-1])+t)
print(s)

Fixed submission:
s = input()
k = int(input())
n = len(s)
for i in range(n):
  num = ord(s[i])
  if num == 97 or 123-num > k:
    continue
  k -= (123-num)
  s = s[:i] + 'a' + s[i+1:]
if k > 0:
  t = k%26
  s = s[:n-1] + chr(ord(s[n-1])+t)
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
import re
s = input()
k = int(input())
n = len(s)
for i in range(n):
  si = s[i]
  num = ord(si)
  if num == 97 or 123-num > k:
    continue
  k -= (123-num)
  s = re.sub(si,'a',s,1)
if k > 0:
  t = k%26
  s = s[:n-1] + chr(ord(s[n-1])+t)
print(s)

Fixed submission:
s = input()
k = int(input())
n = len(s)
for i in range(n):
  num = ord(s[i])
  if num == 97 or 123-num > k:
    continue
  k -= (123-num)
  s = s[:i] + 'a' + s[i+1:]
if k > 0:
  t = k%26
  s = s[:n-1] + chr(ord(s[n-1])+t)
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
n = len(s)
for i in range(n):
  num = ord(s[i])
  if num == 97 or 123-num > k:
    continue
  k -= (123-num)
  s = bytearray(s.encode())
  s[i] = 97
  s = s.decode()
if k > 0:
  t = k%26
  s = bytearray(s.encode())
  s[n-1] += t
  s = s.decode()
print(s)

Fixed submission:
s = input()
k = int(input())
n = len(s)
for i in range(n):
  num = ord(s[i])
  if num == 97 or 123-num > k:
    continue
  k -= (123-num)
  s = s[:i] + 'a' + s[i+1:]
if k > 0:
  t = k%26
  s = s[:n-1] + chr(ord(s[n-1])+t)
print(s)
Buggy python submission (verdict: Runtime Error):
n = list(input())
ans = 'Yes'
 for i in w:
	if int(w.count(i))%2 == 1:
		ans = 'No'
		break
	if int(w.count(i))%2 == 0:
		continue
print(ans)

Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N > K:
	print(int(K*X + (N-K)*Y))
else:
	print(int(N*X))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
n = int(readline())
a = [int(readline()) for i in range(n)]
k = [ai for i,ai in enumerate(a) if i%2 == 0]
g = [ai for i,ai in enumerate(a) if i%2 == 1]
k.sort()
g.sort()
ans = 0

from bisect import insort
from collections import deque

for i in range(n-1):
  K = (i+1)//2
  G = i//2
  p = k[K]; q = g[G]
  if (K == G and p > q) or (K > G and p < q):
    ans += 1
    insort(k,q)
    insort(g,p)
    k = deque(k)
    g = deque(g)
    k.popleft()
    g.popleft()
    k = list(k)
    g = list(g)
    
print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
n = int(readline())
a = [int(readline()) for i in range(n)]
k = [ai for i,ai in enumerate(a) if i%2 == 0]
k = set(k)
a.sort()
ans = 0
for i,ai in enumerate(a):
  if ai in k and i%2 == 1:
    ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
n = int(readline())
a = [int(readline()) for i in range(n)]
k = [ai for i,ai in enumerate(a) if i%2 == 0]
g = [ai for i,ai in enumerate(a) if i%2 == 1]
k.sort()
g.sort()
ans = 0

from bisect import insort
from collections import deque

for i in range(n-1):
  K = (i+1)//2
  G = i//2
  p = k[K]; q = g[G]
  if (K == G and p > q) or (K > G and p < q):
    ans += 1
    insort(k,q)
    insort(g,p)
    k = deque(k)
    g = deque(g)
    k.popleft()
    g.popleft()
    k = list(k)
    g = list(g)
    
print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
n = int(readline())
a = [int(readline()) for i in range(n)]
k = [ai for i,ai in enumerate(a) if i%2 == 0]
k = set(k)
a.sort()
ans = 0
for i,ai in enumerate(a):
  if ai in k and i%2 == 1:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
word = ""
for i in range(n):
	if s[i] == '0':
		word = word + "0"
	if s[i] == '1':
		word = word + "1"
	if s[i] == "B":
		word = word[:-1]

print(word)

Fixed submission:
n = int(input())
s = 0
for i in range(1,n):
	s = s+i
print(s+n)

Buggy python submission (verdict: Runtime Error):
n = int(input())
print(sum(for i in range(1:n)))

Fixed submission:
n = int(input())
s = 0
for i in range(1,n):
	s = s+i
print(s+n)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,(input().split()))
l = [a,b,c]
if int(l.count(5)) == 2 and int(l.count(7)) == 1:
	print(Yes)
else:
	print(No)

Fixed submission:
l = list(map(int,input().split()))
if int(l.count(5)) == 2 and int(l.count(7)) == 1:
	print('YES')
else:
	print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))

a=1
for i in range(N):
    if i>= K:
        prev = a 
        cur = a * A[i] // A[i-K]
        if prev >= cur:
            print('No')
        else :
            print('Yes')
        a//=A[i-K]
    a*=A[i]


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

for i in range(N):
    if i>= K:
        prev = A[i-K] 
        cur = A[i]
        if prev >= cur:
            print('No')
        else :
            print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=map(int,input().split())
x=1
for a in A:
    x*=a

print(-1 if x>10**18 else x)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort()
x=1
for a in A:
    x*=a
    if x>10**18:
        print(-1)
        exit()

print(-1 if x>10**18 else x)
Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10**6)

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

m = [[] for _ in range(7)]
m[0].append([a,b,c])

for i in range(k):
    for j in m[i]:
        m[i+1].append([j[0]*2, j[1],j[2]])
        m[i+1].append([j[0], j[1]* 2, j[2]])
        m[i+1].append([j[0], j[1], j[2]* 2])

ans = 'No'

for t in m[k]:
    if t[0] < t[1] and t[1] < t[2]:
        ans = 'Yes'
        break
print(ans)

Fixed submission:
import sys

sys.setrecursionlimit(10**6)

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

m = [[] for _ in range(8)]
m[0].append([a,b,c])

for i in range(k):
    for j in m[i]:
        m[i+1].append([j[0]*2, j[1],j[2]])
        m[i+1].append([j[0], j[1]* 2, j[2]])
        m[i+1].append([j[0], j[1], j[2]* 2])

ans = 'No'

for t in m[k]:
    if t[0] < t[1] and t[1] < t[2]:
        ans = 'Yes'
        break
print(ans)

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

sys.setrecursionlimit(10**6)

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

m = [[] for _ in range(7)]
m[0].append([a,b,c])

for i in range(k):
    for j in m[i]:
        m[i+1].append([j[0]*2, j[1],j[2]])
        m[i+1].append([j[0], j[1]* 2, j[2]])
        m[i+1].append([j[0], j[1], j[2]* 2])

ans = 'No'
for t in m[k]:
    if t[0] < t[1] and t[1]<t[2]:
        ans = 'Yes'
        break
    else:
        continue
print(ans)

Fixed submission:
import sys

sys.setrecursionlimit(10**6)

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

m = [[] for _ in range(8)]
m[0].append([a,b,c])

for i in range(k):
    for j in m[i]:
        m[i+1].append([j[0]*2, j[1],j[2]])
        m[i+1].append([j[0], j[1]* 2, j[2]])
        m[i+1].append([j[0], j[1], j[2]* 2])

ans = 'No'

for t in m[k]:
    if t[0] < t[1] and t[1] < t[2]:
        ans = 'Yes'
        break
print(ans)

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

m = [[] for _ in range(7)]
m[0].append([a,b,c])

for i in range(k):
    for j in m[i]:
        m[i+1].append([j[0]*2, j[1],j[2]])
        m[i+1].append([j[0], j[1]* 2, j[2]])
        m[i+1].append([j[0], j[1], j[2]* 2])

ans = 'No'
for t in m[k]:
    if t[0] < t[1] and t[1]<t[2]:
        ans = 'Yes'
        break
    else:
        continue
print(ans)



Fixed submission:
import sys

sys.setrecursionlimit(10**6)

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

m = [[] for _ in range(8)]
m[0].append([a,b,c])

for i in range(k):
    for j in m[i]:
        m[i+1].append([j[0]*2, j[1],j[2]])
        m[i+1].append([j[0], j[1]* 2, j[2]])
        m[i+1].append([j[0], j[1], j[2]* 2])

ans = 'No'

for t in m[k]:
    if t[0] < t[1] and t[1] < t[2]:
        ans = 'Yes'
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque

def main():
    N,M = map(int, input().split())
    r = [[] for i in range(N)]
    for i in range(M):
        a, b = map(int, input().split())
        r[a-1].append(b-1)
        r[b-1].append(a-1)
    print(r)

    p=[-1]*N
    q=deque([0])
    while q:
        i=q.popleft()
        for j in r[i]:
            if p[j] == -1:
                p[j] = i
                q.append(j)
    print('Yes')
    for i in range(1,N):
        print(p[i]+1)

main()

Fixed submission:
n = input()
hon = ['2','4','5','7','9']
pon = ['0','1','6','8']
if n[-1] in hon:
    print('hon')
elif n[-1] in pon:
    print('pon')
else:
    print('bon')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
list = []
for i in range(n):
    s = str(input())
    if s not in list:
        list.append(s)
print(len(list))

Fixed submission:
import collections

n = int(input())
list = []
for i in range(n):
    s = str(input())
    list.append(s)
c = collections.Counter(list)
print(len(c))
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())
answer = 0
for a in range(1,n+1):
    for b in range(1,n+1):
        for c in range(1,n+1):
            answer += math.gcd(a, math.gcd(b,c))
print(answer)

Fixed submission:
import math

n = int(input())
answer = 0

for a in range(1,n+1):
    for b in range(1,n+1):
        t = math.gcd(a,b)
        for c in range(1,n+1):
            answer += math.gcd(t,c)
print(answer)

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

def gcd(i):
    print(i)
    while i[1]:
        i[0], i[1] = i[1], i[0]%i[1]
    while i[2]:
        i[0], i[2] = i[2], i[0]%i[2]
    return i[0]

n = int(input())
if n == 1:
    print(1)
elif n==2:
    print(9)
else:
    l = [int(x) for x in range(1,n+1)]
    p = list(itertools.product(l,repeat=3))
    result = 0
    for i in p:
        result += gcd(list(i))
print(result)



Fixed submission:
import math

n = int(input())
answer = 0

for a in range(1,n+1):
    for b in range(1,n+1):
        t = math.gcd(a,b)
        for c in range(1,n+1):
            answer += math.gcd(t,c)
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())

if n%k == 0:
    print(0)
else:
    while True:
        tmp = abs(n-k)

        if n > tmp:
            n = tmp
        else:
            break
    print(n)


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

a = n%k
while True:
    tmp = abs(a-k)

    if a > tmp:
        a = tmp
    else:
        break
print(a)

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

while True:
    tmp = abs(n-k)

    if n > tmp:
        n = tmp
    else:
        break
print(n)


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

a = n%k
while True:
    tmp = abs(a-k)

    if a > tmp:
        a = tmp
    else:
        break
print(a)