Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03167 (python)

Fixed submission:
MOD = 10**9+7
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
dp = [[0 for _ in range(w)] for _ in range(h)]
for i in range(h):
	for j in range(w):
		if (i == 0) & (j == 0):
			dp[i][j] = 1
		elif a[i][j] == '#':
			continue
		elif i == 0:
			dp[i][j] = dp[i][j-1]
		elif j == 0:
			dp[i][j] = dp[i-1][j]
		else:
			dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD
print(dp[h-1][w-1])

Buggy submission (verdict: Runtime Error):
MOD = 10**9+7
h, w = map(int, input().split())
a = [['#' for _ in range(w+2)]]
for _ in range(h):
	l = ['#']
	m = list(input())
	l += m
	l.append('#')
	a.append(l)
a.append(['#' for _ in range(w+2)])

dp1 = [[[False, False] for _ in range(w+2)] for _ in range(h+2)]

def dfs1(x, y):
	if a[x+1][y] == '.':
		dp1[x+1][y][0] = True
		dfs1(x+1, y)
	if a[x][y+1] == '.':
		dp1[x][y+1][1] = True
		dfs1(x, y+1)
	return

dp2 = [[0 for _ in range(w+2)] for _ in range(h+2)]
dp2[1][1] = 1
def dfs2(x, y):
	if dp1[x][y] == [False, False]:
		if a[x+1][y] == '.':
			dp2[x+1][y] += (dp2[x][y] % MOD)
			dp2[x+1][y] %= MOD
			dp1[x+1][y][0] = False
			dfs2(x+1, y)
		if a[x][y+1] == '.':
			dp2[x][y+1] += (dp2[x][y] % MOD)
			dp2[x][y+1] %= MOD
			dp1[x][y+1][1] = False
			dfs2(x, y+1)
	return

dfs1(1,1)
dfs2(1,1)
ans = dp2[h][w] % MOD
print(ans)
Problem p03175 (python)

Fixed submission:
#dpp
import sys
sys.setrecursionlimit(10**7)
MOD = 10**9+7
n = int(input())
dp = [[1 for _ in range(2)] for _ in range(n)]
edges = [[] for _ in range(n)]
for _ in range(n-1):
	x, y = map(int, input().split())
	edges[x-1].append(y-1)
	edges[y-1].append(x-1)

def dfs(le, ro):
	for ed in edges[le]:
		if ed == ro:
			continue
		dfs(ed, le)
		dp[le][0] = (dp[le][0] * (dp[ed][0] + dp[ed][1])) % MOD
		dp[le][1] = (dp[le][1] * dp[ed][0]) % MOD
	return

dfs(0, -1)
print((dp[0][0] + dp[0][1]) % MOD)

Buggy submission (verdict: Runtime Error):
#dpp
MOD = 10**9+7
n = int(input())
dp = [[1 for _ in range(2)] for _ in range(n)]
edges = [[] for _ in range(n)]
for _ in range(n-1):
	x, y = map(int, input().split())
	edges[x-1].append(y-1)
	edges[y-1].append(x-1)

def dfs(le, ro):
	for ed in edges[le]:
		if ed == ro:
			continue
		dfs(ed, le)
		dp[le][0] = (dp[le][0] * (dp[ed][0] + dp[ed][1])) % MOD
		dp[le][1] = (dp[le][1] * dp[ed][0]) % MOD
	return

dfs(0, -1)
print((dp[0][0] + dp[0][1]) % MOD)
Problem p03238 (python)

Fixed submission:
G = int(input())
if G == 1:
    print('Hello World')
if G == 2:
    ANS = 0
    for i in range(2):
        ANS += int(input())
    print(ANS)

Buggy submission (verdict: Runtime Error):
import math
N, M = map(int, input().split())

if int(math.sqrt(M)) > N:
    divlist = []
    for i in range (N, int(math.sqrt(M))):
        if M%i == 0:
            divlist.append(i)
    
    if divlist != []:
        for i in range(N, int(math.sqrt(M))):
            if M%i == 0:
                ans = M//i
                break
    else:
        for i in range(N,0,-1):
            if M%i == 0:
                ans = i
                break
else:
    for i in range(M//N,0,-1):
        if M%i == 0:
            ans = i
            break
            
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, M = map(int, input().split())

if int(math.sqrt(M)) > N:
    divlist = []
    for i in range (N, int(math.sqrt(M))):
        if M%i == 0:
            divlist.append(i)
        else:
            continue
    
    if divlist != []:
        for i in range(N, int(math.sqrt(M))):
            if M%i == 0:
                ans = M//i
                break
            else:
                continue
    else:
        for i in range(N,0,-1):
            if M%i == 0:
                ans = i
                break
            else:
                continue
            
else:
    for i in range(M//N,0,-1):
        if M%i == 0:
            ans = i
            break
        else:
            continue

print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, M = map(int, input().split())

if int(math.sqrt(M)) > N:
    for i in range(N,int(math.sqrt(M))):
        if M%i == 0:
            ans = M//i
            break
        else:
            continue
else:
    for i in range(M//N,0,-1):
        if M%i == 0:
            ans = i
            break
        else:
            continue

print(ans)
Problem p03436 (python)

Fixed submission:
h, w = map(int, input().split())
maze = [['#'] * (w+2)]
cou = 0
for i in range(h):
    a = ['#'] + list(input()) + ['#']
    maze.append(a)
x = ['#'] * (w+2)
maze.append(x)

for i in range(1, h+1):
    for j in range(1, w+1):
        if maze[i][j] == '#':
            cou += 1

ng = True
pos = [[1, 1, 0]]
checklist = [[0] * (w+2) for _ in range(h+2)]
while len(pos) > 0:
    x, y, depth = pos.pop(0)
    if ([x, y] == [h, w]) & (maze[x][y] != '#'):
        ans = h * w - cou - depth - 1
        #print(cou)
        #print(depth)
        print(ans)
        ng = False
        break
    maze[x][y] = 'f'

    if (maze[x+1][y] == '.') & (checklist[x+1][y] == 0):
        pos.append([x+1, y, depth+1])
        checklist[x+1][y] = 1
    if (maze[x][y+1] == '.') & (checklist[x][y+1] == 0):
        pos.append([x, y+1, depth+1])
        checklist[x][y+1] = 1
    if (maze[x-1][y] == '.') & (checklist[x-1][y] == 0):
        pos.append([x-1, y, depth+1])
        checklist[x-1][y] = 1
    if (maze[x][y-1] == '.') & (checklist[x][y-1] == 0):
        pos.append([x, y-1, depth+1])
        checklist[x][y-1] = 1
    #print(pos)
    #print(maze)


if (len(pos) == 0) & ng:
    print(-1)

Buggy submission (verdict: Runtime Error):
import sys

def input():
    return.sys.stdin.buffer.readline()[:-1]

h, w = map(int, input().split())
maze = [['#'] * (w+2)]
cou = 0
for i in range(h):
    a = ['#'] + list(input()) + ['#']
    maze.append(a)
x = ['#'] * (w+2)
maze.append(x)

for i in range(1, h+1):
    for j in range(1, w+1):
        if maze[i][j] == '#':
            cou += 1

ng = True
pos = [[1, 1, 0]]
while len(pos) > 0:
    x, y, depth = pos.pop(0)
    if ([x, y] == [h, w]) & (maze[x][y] != '#'):
        ans = h * w - cou - depth - 1
        #print(cou)
        #print(depth)
        print(ans)
        ng = False
        break
    maze[x][y] = 'f'

    if maze[x+1][y] == '.':
        pos.append([x+1, y, depth+1])
    if maze[x][y+1] == '.':
        pos.append([x, y+1, depth+1])
    if maze[x-1][y] == '.':
        pos.append([x-1, y, depth+1])
    if maze[x][y-1] == '.':
        pos.append([x, y-1, depth+1])
    #print(pos)
    #print(maze)


if (len(pos) == 0) & ng:
    print(-1)
Problem p03808 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if n == 1:
	print('YES')
	exit()
tot = 0
for i in range(n):
	tot += a[i]
 
if tot % (n*(n+1)//2) != 0:
	print('NO')
	exit()
times = tot//(n*(n+1)//2)
 
x = a[n-1]-a[0]+times
if (x < 0) |(x % n != 0):
	print('NO')
	exit()
for i in range(1,n):
	x = a[i-1]-a[i]+times
	#print(i, x, times)
	if (x < 0) | (x % n != 0):
		print('NO')
		exit()
print('YES')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
if sum[a] % (n*(n+1)//2) != 0:
	print('NO')
else:
	times = sum[a]//(n*(n+1)//2)
	jud = True
	x = a[n-1]-a[0]+times
	if x % n != 0:
		jud = False
	for i in range(1,n):
		x = a[i-1]-a[i]+times
		if (x < 0 | x % n != 0):
			jud = False
			break
	print(jud)
Problem p03963 (python)

Fixed submission:
N, K = map(int, input().split())
ans = ((K-1)**(N-1))*K
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
ans = ((K-1)**(M-1))*K
print(ans)
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
S = ((a+b)*h)/2
print(int(S))

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
h = input()
print((a+b)*h//2)
Problem p04011 (python)

Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N > K:
    print(K*X+(N-K)*Y)
else:
    print(N*X)

Buggy submission (verdict: Runtime Error):
words = input()
lett = list(words)
numlist = []
for i in lett:
    num = lett.count(i)
    numlist += [num]
jud = []
for i in numlist:
    if i%2 == 0:
        jud += ['Yes']
    else:
        jud += ['No']

anslist = [x for x in set(jud) if jud.count(x) > 1]

ans = anslist[0]

print(ans)
Problem p04012 (python)

Fixed submission:
mojiretsu = input()
lett = list(mojiretsu)
numlist = []
for i in lett:
    num = lett.count(i)
    numlist += [num]
jud = []
for i in numlist:
    if i%2 == 0:
        jud += ['Yes']
    else:
        jud += ['No']

anslist = [x for x in set(jud) if jud.count(x) > 1]
anslisT = [x for x in jud if jud.count(x) == 1]

if anslist == ['Yes']:
    print('Yes')
elif anslisT == ['Yes']:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
mojiretsu = input()
lett = list(mojiretsu)
numlist = []
for i in lett:
    num = lett.count(i)
    numlist += [num]
jud = []
for i in numlist:
    if i%2 == 0:
        jud += ['Yes']
    else:
        jud += ['No']

anslist = [x for x in set(jud) if jud.count(x) > 1]

ans = anslist[0]

print(ans)

Buggy submission (verdict: Runtime Error):
W = input()
lett = list(W)
numlist = []
for i in lett:
    num = lett.count(i)
    numlist += [num]
jud = []
for i in numlist:
    if i%2 == 0:
        jud += ['Yes']
    else:
        jud += ['No']

anslist = [x for x in set(jud) if jud.count(x) > 1]

ans = anslist[0]

print(ans)

Buggy submission (verdict: Runtime Error):
W = input()
lett = list(W)
numlist = []
for i in lett:
    num = lett.count(i)
    numlist += [num]
jud = []
for i in numlist:
    if i%2 == 0:
        jud += ['Yes']
    else:
        jud += ['No']

anslist = [x for x in set(jud) if jud.count(x) > 1]

ans = anslist[0]

print(ans)
Problem p04025 (python)

Fixed submission:
N = int(input())
NUM = list(map(int,input().split()))
MAX = max(NUM)
MIN = min(NUM)
COSTLIST = []
for i in range (MIN,MAX+1):
    COST = 0
    for j in NUM:
        COST += (j-i)**2
    COSTLIST.append(COST)
MINIMUM = min(COSTLIST)

print(MINIMUM)

Buggy submission (verdict: Runtime Error):
N = int(input())
NUM = list(map(int,input().split()))
MAX = max(NUM)
MIN = min(NUM)
COSTLIST = []
for i in range (MIN,MAX):
    COST = 0
    for j in NUM:
        COST += (j-i)**2
    COSTLIST.append(COST)
MINIMUM = min(COSTLIST)

print(MINIMUM)
Problem p02706 (python)

Fixed submission:
n,m = map(int,input().split())
a = list(map(int,input().split()))
print(max(n-sum(a),-1))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [map(int,input().split())]
print(max(n-sum(a)),-1)
Problem p03110 (python)

Fixed submission:
n=int(input())
ans=0.0
for i in range(n):
  a=input().split()
  if a[1] == "JPY":
    ans += float(a[0])
  else:
    ans += float(a[0])*380000
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0.0
for i in range(n):
  a=list(input().split())
  if a[1] is "JPY":
    ans += int(a[0])
  else:
    ans += int(a[0])*380000
print(ans)
Problem p03386 (python)

Fixed submission:
a,b,k=map(int,list(input().split(" ")))
if b-a+1 <= k*2:
   for i in range(a,b+1):
      print(i)
else:
   for i in range(a,a+k):
      print(i)
   for i in range(b-k+1,b+1):
      print(i)

Buggy submission (verdict: Runtime Error):
a,b,k=map(list(input().split(" ")),int)
if b-a+1 <= k*2:
   for i in range(a,b+1):
      print(i)
else:
   for i in range(a,a+k):
      print(i)
   for i in range(b-k+1,b+1):
      print(i)
Problem p03644 (python)

Fixed submission:
n=int(input())
a=1
while a*2<=n:
 a*=2
print(a)

Buggy submission (verdict: Runtime Error):
n=input()
a=1
while a*2<=n:
 a*=2
print(a)
Problem p03658 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(k):
 ans+=a[n-1-i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=[]
for i in range(n):
 a+=map(input().split())
a.sort()
ans=0
for i in range(k):
 ans+=a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=[]
for i in range(n)
 a+=map(input().split())
a.sort()
ans=0
for i in range(k)
 ans+=a[i]
print(ans)
Problem p02982 (python)

Fixed submission:
# ABC 133: B – Good Distance
from itertools import combinations

n, d = [int(s) for s in input().split()]

x = []
for _ in range(n):
    x.append([int(s) for s in input().split()])

pairs = list(combinations(x, 2))
the_number_of_pairs = 0

#print(pairs)

for i in range(len(pairs)):
    distance = 0

    for j in range(d):
        distance += (abs(pairs[i][0][j] - pairs[i][1][j])) ** 2
    
    distance = distance ** 0.5

    if distance == int(distance):
#        print(pairs[i])
        the_number_of_pairs += 1

print(the_number_of_pairs)

Buggy submission (verdict: Runtime Error):
# ABC 133: B – Good Distance
from itertools import combinations

n, d = [int(s) for s in input().split()]

x = []
for _ in range(n):
    x.append([int(s) for s in input().split()])

pairs = list(combinations(x, 2))
the_number_of_pairs = 0

for i in range(n):
    distance = 0

    for j in range(d):
        distance += (abs(pairs[i][0][j] - pairs[i][1][j])) ** 2
    
    distance = distance ** 0.5

    if distance == int(distance):
        the_number_of_pairs += 1

print(the_number_of_pairs)
Problem p03000 (python)

Fixed submission:
# ABC 130: B – Bounding
N, X = map(int, input().split())
L = [int(s) for s in input().split()]

D = [0]

for i in range(N):
    D.append(D[i] + L[i])

print(len([d for d in D if d <= X]))

Buggy submission (verdict: Runtime Error):
# ABC 130: B – Bounding
n, x = [int(s) for s in input().split()]
l = [int(s) for s in input().split()]

d = 0
times = 0

while d <= x and times <= n:
    d += l[times]
    times += 1

print(times)

Buggy submission (verdict: Runtime Error):
# ABC 130: B – Bounding
n, x = [int(s) for s in input().split()]
l = [int(s) for s in input().split()]

d = 0
times = 0

while d <= x:
    d = d + l[times]
    times += 1

print(times)
Problem p03086 (python)

Fixed submission:
# ABC 122: B – ATCoder
s = input()
acgt = 'ACGT'

length = 0
max_length = 0

for i in range(len(s)):
    if s[i] in acgt:
        for j in range(len(s) - i):
            if s[i + j] in acgt:
                length += 1
            else:
                break

        max_length = max(max_length, length)
        length = 0

print(max_length)

Buggy submission (verdict: Runtime Error):
# ABC 122: B – ATCoder
S = input()
ACGT = 'AGCT'
longest = 0

for start in range(len(S)):
    current = 0
    if S[start] in ACGT:
        current += 1

        if start + 1 < len(S):
            next = start + 1
            while S[next] in ACGT:
                current += 1
                next += 1
        
        longest = max(longest, current)

print(longest)
Problem p03324 (python)

Fixed submission:
# ABC 100: B – Ringo's Favorite Numbers
d, n = map(int, input().split())
print(n * 100 ** d if n != 100 else (n + 1) * 100 ** d)

Buggy submission (verdict: Runtime Error):
v
Problem p03386 (python)

Fixed submission:
# ABC 093: B – Small and Large Integers
a, b, k = [int(s) for s in input().split()]

if k >= b - a + 1:
    for c in list(range(a, b + 1)):
        print(c)
else:
    s = set(list(range(a, a + k)) + list(range(b - k + 1, b + 1)))
    list_s = list(s)
    list_s.sort()

    for c in list_s:
        print(c)

Buggy submission (verdict: Runtime Error):
# ABC 093: B – Small and Large Integers
a, b, k = [int(s) for s in input().split()]
nums = list(range(a, b + 1))
result = []

if k >= len(nums):
    result = nums
else:
    result = [nums[i] for i in set(list(range(0, k)) + list(range(len(nums) - k, len(nums))))]

for num in result:
    print(num)

Buggy submission (verdict: Runtime Error):
# ABC 093: B – Small and Large Integers
a, b, k = [int(s) for s in input().split()]
nums = list(range(a, b + 1))
result = []

if k > len(nums):
    result = nums
else:
    result = [nums[i] for i in set(list(range(0, k)) + list(range(len(nums) - k, len(nums))))]

for num in result:
    print(num)
Problem p03544 (python)

Fixed submission:
# ABC 079: B – Lucas Number
n = int(input())
lucas = [2, 1]

for i in range(2, n + 1):
    lucas.append(lucas[i - 1] + lucas[i - 2])

print(lucas[n])

Buggy submission (verdict: Runtime Error):
#  ABC 079: B – Lucas Number
n = int(input())

l0 = 2
l1 = 1

if n == 1:
    print(l1)
else:
    for i in range(2, n + 1):
        l = l0 + l1
        l0 = l1
        l1 = l

print(l)

Buggy submission (verdict: Runtime Error):
#  ABC 079: B – Lucas Number
n = int(input())

l0 = 2
l1 = 1

for i in range(2, n + 1):
    l = l0 + l1
    l0 = l1
    l1 = l

print(l)
Problem p03591 (python)

Fixed submission:
# CODE FESTIVAL 2017 予選 A: A – Snuke's favorite YAKINIKU
s = input()
print('Yes' if s[:4] == 'YAKI' else 'No')

Buggy submission (verdict: Runtime Error):
# CODE FESTIVAL 2017 予選 A: A – Snuke's favorite YAKINIKU
s = input()
if len(s) < 4:
    print('No')
else:
    print('Yes' if s.index('YAKI') == 0 else 'No')

Buggy submission (verdict: Runtime Error):
# CODE FESTIVAL 2017 予選 A: A – Snuke's favorite YAKINIKU
s = input()
print('Yes' if len(s) >= 4 and s.index('YAKI') == 0 else 'No')
Problem p03721 (python)

Fixed submission:
# ABC 061: C – Big Array
N, K = [int(i) for i in input().split()]
a, b = [], []
for _ in range(N):
    tmp = input().split()
    a.append(int(tmp[0]))
    b.append(int(tmp[1]))

cnt = [0] * (100000 + 1)

for i in range(N):
    cnt[a[i]] += b[i]

for j in range(100000 + 1):
    if K <= cnt[j]:
        print(j)
        break
    K -= cnt[j]

Buggy submission (verdict: Runtime Error):
# ABC 061: C – Big Array
N, K = [int(i) for i in input().split()]
a, b = [], []
for _ in range(N):
    tmp = input().split()
    a.append(int(tmp[0]))
    b.append(int(tmp[1]))

cnt = [0] * 100000

for i in range(N):
    cnt[a[i]] += b[i]

for j in range(100000):
    if K <= cnt[j]:
        print(j)
        break
    K -= cnt[j]
Problem p03937 (python)

Fixed submission:
# AGC 007: A – Shik and Stone
h, w = [int(s) for s in input().split()]
a = [input() for _ in range(h)]

the_number_of_stones = 0

for i in range(h):
    the_number_of_stones += a[i].count('#')

print('Possible' if the_number_of_stones == h + w - 1 else 'Impossible')

Buggy submission (verdict: Runtime Error):
# AGC 007: A – Shik and Stone
H, W = [int(s) for s in input().split()]
A = [input() for _ in range(H)]

isExact = 'Possible'

i, j = 0, 0

while i < H - 1 or j < W - 1:
    A[i] = A[i][:j] + '.' + A[i][j + 1:]

    if A[i + 1][j] != '#' and A[i][j + 1] != '#':
        isExact = 'Impossible'
        break
    if j + 1 < W and A[i][j + 1] == '#':
        j += 1
    elif i + 1 < H and A[i + 1][j] == '#':
        i += 1

if isExact == 'Possible':
    A[H - 1] = A[H - 1][:W - 1] + '.'

    for line in A:
        if '#' in line:
            isExact = 'Impossible'
            break

print(isExact)
Problem p04033 (python)

Fixed submission:
# AGC 002: A – Range Product
a, b = [int(s) for s in input().split()]

if a > 0:
    print('Positive')
elif b < 0:
    if (b - a + 1) % 2 == 0:
        print('Positive')
    else:
        print('Negative')
elif a <= 0 <= b:
    print('Zero')

Buggy submission (verdict: Runtime Error):
# AGC 002: A – Range Product
a, b = [int(s) for s in input().split()]

numbers = list(range(a, b + 1))

if 0 in numbers:
    print('Zero')
else:
    number_of_negatives = 0
    
    for n in numbers:
        if n < 0:
            number_of_negatives += 1
    
    print('Positive' if number_of_negatives % 2 == 0 else 'Negative')
Problem p04043 (python)

Fixed submission:
# ABC 042: A – 和風いろはちゃんイージー / Iroha and Haiku (ABC Edition)
nums = [int(s) for s in input().split(" ")]
print("YES" if nums.count(5) == 2 and nums.count(7) == 1 else "NO")

Buggy submission (verdict: Runtime Error):
# ABC 042: A – 和風いろはちゃんイージー / Iroha and Haiku (ABC Edition)
nums = [int(s) for s in input().split(" ")]
print("YES" if nums.count(5) == 2 and nums.count(7) == 1 else "NO")

Buggy submission (verdict: Runtime Error):
# ABC 042: A – 和風いろはちゃんイージー / Iroha and Haiku (ABC Edition)
nums = [int(s) for s in input().split(" ")]
print("YES" if nums.count(5) == 2 and nums.count(7) == 1 else print("NO"))
Problem p02641 (python)

Fixed submission:
x,n=input().split()
x=int(x)
n=int(n)
lst=input().split()
for i in range(0,n):
    lst[i]=int(lst[i])
if n==0:
    print(x)
else:
    minv=min(lst)
    maxv=max(lst)
    dis=100000

    for i in range(minv-2,maxv+3):
        if(i not in lst and abs(i-x)<dis):
            dis=abs(i-x)
            clv=i
            
    print(clv)

Buggy submission (verdict: Runtime Error):
x,n=input().split()
x=int(x)
n=int(n)
lst = [ ]
lst=input()
lst=lst.split()
for i in range(0,n):
    lst[i]=int(lst[i])
minv=min(lst)
maxv=max(lst)
dis=100000
for i in range(minv-2,maxv+3):
    if(i not in lst and abs(i-x)<dis):
        dis=abs(i-x)
        clv=i
        
print(clv)
Problem p02658 (python)

Fixed submission:
def fun():
	n = int(input())
	A = list(map(int,input().split()))
	if 0 in A:
		print(0)
		return
	prod = 1
	for a in A:
		prod*=a
		if(prod>1000000000000000000):
			print(-1)
			return
	print(prod)
 
 
 
fun()

Buggy submission (verdict: Runtime Error):
def fun():
	n = int(input()
	A = list(map(int,input().split()))
	if 0 in A:
		print(0)
		return
	prod = 1
	for a in A:
		prod*=a
		if(prod>1000000000000000000):
			print(-1)
			return
	print(prod)



fun()

Buggy submission (verdict: Runtime Error):
n = int(input())
prod = 1
a = []
for i in range(n):
    a.append(int(input()))
sorted(a)
if(a[0]==0):
	print(0)
for i in range(n):
	prod*=a[i]
	if(prod>1e18):
		print(-1)
		return
print(prod)
Problem p02812 (python)

Fixed submission:
N = int(input())
S = input()
print(S.count('ABC'))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = int(input())
print(S.count('ABC'))
Problem p02817 (python)

Fixed submission:
S,T = list(input().split())
print(T + S)

Buggy submission (verdict: Runtime Error):
S,T = list(map(int,input().split()))
print(T + S)
Problem p02921 (python)

Fixed submission:
s = [input() for i in range(2)]
predict = s[0]
result = s[1]
count = 0
for i in range(3):
    if predict[i] == result[i]:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
s = [input() for i in range(3)]
print(s)
Problem p02687 (python)

Fixed submission:
s = input()
if( s == 'ABC'):
  print('ARC')
 
if( s == 'ARC'):
  print('ABC')

Buggy submission (verdict: Runtime Error):
import numpy as np
argList = list(map(int, input().split())) 
heights = list(map(int, input().split())) 

#いい展望台フラグ
check = np.array([1]*argList[0])

for n in range(argList[1]):
    #どことどこをつないでいるか
    con = list(map(int, input().split())) 
    #低かったらいい展望台ではない
    if heights[con[0]-1] <= heights[con[1]-1]:
        check[con[0]-1] = 0
    if heights[con[0]-1] >= heights[con[1]-1]:
        check[con[1]-1] = 0
print(np.sum(check))
Problem p03993 (python)

Fixed submission:
n = int(input())
l = list(map(int, input().split())) 
cnt = 0
for i in range(n):    
    if l[i]-1 > i:
        if( l[l[i]-1]-1 == i):
            cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
l = l[0]
cnt = 0
for i in range(n):    
    if l[i]-1 > i:
        if( l[l[i]-1]-1 == i):
            cnt+=1
print(cnt)
Problem p02747 (python)

Fixed submission:
S = list(input())
N = len(S)

if N%2 == 1:
    print('No')
    exit()
for i in range(0,N,2):
    if S[i] != 'h' or S[i+1] != 'i':
        print('No')
        exit()

print('Yes')

Buggy submission (verdict: Runtime Error):
S = list(input())
N = len(S)

if N == 1:
    print('No')
    exit()
for i in range(0,N,2):
    if S[i] != 'h' or S[i+1] != 'i':
        print('No')
        exit()

print('Yes')

Buggy submission (verdict: Runtime Error):
S = list(input())
N = len(S)
for i in range(0,N,2):
    if S[i] != 'h' or S[i+1] != 'i':
        print('No')
        exit()

print('Yes')