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

Fixed submission:
from fractions import gcd


def main():
    N = int(input())
    A = [0] + list(map(int, input().split()))

    L = [0] * (N+2)
    R = [0] * (N+2)
    G = [0] * (N+1)
    L[1] = A[1]
    R[N] = A[N]
    for i in range(2, N+1):
        L[i] = gcd(L[i-1], A[i])
    for i in range(1, N)[::-1]:
        R[i] = gcd(R[i+1], A[i])
    for i in range(1, N+1):
        if i == 1:
            G[i] = R[2]
        elif i == N:
            G[i] = L[N-1]
        else:
            G[i] = gcd(L[i-1], R[i+1])
    print(max(G[1:]))


main()

Buggy submission (verdict: Runtime Error):
from math import gcd


def main():
    N = int(input())
    A = [0] + list(map(int, input().split()))

    L = [0] * (N+2)
    R = [0] * (N+2)
    G = [0] * (N+1)
    L[1] = A[1]
    R[N] = A[N]
    for i in range(2, N+1):
        L[i] = gcd(L[i-1], A[i])
    for i in range(1, N):
        R[i] = gcd(R[i+1], A[i])
    for i in range(1, N+1):
        if i == 1:
            G[i] = R[2]
        elif i == N:
            G[i] = L[N-1]
        else:
            G[i] = gcd(L[i-1], R[i+1])
    print(max(G[1:]))


main()
Problem p03148 (python)

Fixed submission:
def main():
    n, k = map(int, input().split())
    sushi = [list(map(int, input().split())) for _ in range(n)]
    sushi = sorted(sushi, key=lambda x: x[1], reverse=True)

    first = set()
    second = []
    point = 0
    for s in sushi[:k]:
        if s[0] not in first:
            first.add(s[0])
        else:
            second.append(s)
        point += s[1]
    point += len(first) ** 2
    ans = point

    for s in sushi[k:]:
        if len(second) == 0:
            break
        if s[0] not in first:
            point = point + s[1] - second.pop()[1] + \
                (len(first) + 1) ** 2 - len(first) ** 2
            first.add(s[0])
            ans = max(ans, point)
    print(ans)


main()

Buggy submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    sushi = [list(map(int, input().split())) for _ in range(n)]
    sushi = sorted(sushi, key=lambda x: x[1], reverse=True)

    first = set()
    second = []
    point = 0
    for s in sushi[:k]:
        if s[0] not in first:
            first.add(s[0])
        else:
            second.append(s)
        point += s[1]
    point += len(first) ** 2
    ans = point

    for s in sushi[k:]:
        if s[0] not in first:
            point = point + s[1] - second.pop()[1] + \
                (len(first) + 1) ** 2 - len(first) ** 2
            first.add(s[0])
            ans = max(ans, point)
    print(ans)


main()
Problem p03244 (python)

Fixed submission:
def main():
    n = int(input())
    *v, = map(int, input().split())

    v0 = assemble(v[::2])
    v1 = assemble(v[1::2])

    if len(v0) == 1 and len(v1) == 1:
        if v0[0][0] == v1[0][0]:
            print(n // 2)
        else:
            print(0)
        return
    elif len(v0) == 1:
        if v0[0][0] == v1[0][0]:
            print(sum_v(v1, 1))
        else:
            print(sum_v(v1, 0))
        return
    elif len(v1) == 1:
        if v0[0][0] == v1[0][0]:
            print(sum_v(v0, 1))
        else:
            print(sum_v(v0, 0))
        return

    score = [[0, 0], [0, 0]]
    for i in range(2):
        for j in range(2):
            score[i][j] = sum_v(v0, i) + sum_v(v1, j)
            if v0[i][0] == v1[j][0]:
                score[i][j] = 10 ** 9
    print(min([min(s) for s in score]))


def assemble(v):
    dct = {}
    for vel in v:
        if vel in dct:
            dct[vel] += 1
        else:
            dct[vel] = 1
    return sorted(list(dct.items()), key=lambda x: x[1], reverse=True)


def sum_v(v, ii):
    return sum([vv[1] for i, vv in enumerate(v) if i != ii])


main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    *v, = map(int, input().split())

    v0 = assemble(v[::2])
    v1 = assemble(v[1::2])

    if len(v0) == 1 and len(v1) == 1:
        if v0[0][0] == v1[0][0]:
            print(n // 2)
        else:
            print(0)
        return
    elif len(v0) == 1:
        if v0[0][0] == v1[0][0]:
            print(sum_v(v1, 0))
        else:
            print(sum_v(v1, 1))
        return
    elif len(v1) == 1:
        if v0[0][0] == v1[0][0]:
            print(sum_v(v0, 0))
        else:
            print(sum_v(v0, 1))

    score = [[0, 0], [0, 0]]
    for i in range(2):
        for j in range(2):
            score[i][j] = sum_v(v0, i) + sum_v(v1, j)
            if v0[i][0] == v1[j][0]:
                score[i][j] = 10 ** 9
    print(min([min(s) for s in score]))


def assemble(v):
    dct = {}
    for vel in v:
        if vel in dct:
            dct[vel] += 1
        else:
            dct[vel] = 1
    return sorted(list(dct.items()), key=lambda x: x[1], reverse=True)


def sum_v(v, ii):
    return sum([vv[1] for i, vv in enumerate(v) if i != ii])


main()
Problem p03166 (python)

Fixed submission:
import decimal,math
from collections import Counter,defaultdict
from fractions import gcd
from bisect import bisect_right,bisect_left
decimal.getcontext().prec = 100
import sys
sys.setrecursionlimit(1000000)

adj=[]
n,m = map(int,raw_input().split())
for i in range(n+1):
	adj.append([])
dp=[0]*(n+1)	
def dd(l):
	if(dp[l]!=-1):
		return dp[l]
	ma=dd(adj[l][0])
	for j in range(1,len(adj[l])):
		ma=max(ma,dd(adj[l][j]))
	dp[l]=ma+1
	return ma+1	
for i in range(m):
	x,y = map(int,raw_input().split())
	adj[y].append(x)
	dp[y]=-1
ans=[]
for i in range(1,n+1):
	ans.append(dd(i))
	# print i
print max(ans)

Buggy submission (verdict: Runtime Error):
import decimal,math
from collections import Counter,defaultdict
from fractions import gcd
from bisect import bisect_right,bisect_left
decimal.getcontext().prec = 100


adj=[]
n,m = map(int,raw_input().split())
for i in range(n+1):
	adj.append([])
dp=[0]*(n+1)	
def dd(l):
	if(dp[l]!=-1):
		return dp[l]
	ma=dd(adj[l][0])
	for j in range(1,len(adj[l])):
		ma=max(ma,dd(adj[l][j]))
	dp[l]=ma+1
	return ma+1	
for i in range(m):
	x,y = map(int,raw_input().split())
	adj[y].append(x)
	dp[y]=-1
ans=[]
for i in range(1,n+1):
	ans.append(dd(i))
	# print i
print max(ans)
Problem p02946 (python)

Fixed submission:
K,X = map(int,input().split())
i = X - K + 1
lis = []
while i <= X + K - 1:
  lis.append(str(i))
  i += 1

s = ' '.join(lis)
print(s)

Buggy submission (verdict: Runtime Error):
K,X = map(int,input().split())
i = X - K + 1
lis = []
while i <= n + K - 1:
  lis.append(i)
  i += 1
print(lis)
Problem p02953 (python)

Fixed submission:
N = int(input())
li = list(map(int,input().split()))
out_count = 0

for j in range(N - 1 , 0 , -1):
  if li[j] <= li[j - 1] - 2:
    out_count += 1
  elif li[j] == li[j - 1] - 1:
    li[j - 1] -= 1
if out_count == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
li = list(map(int,input().split()))
out_count = 0
if li[0] > li[1] + 1:
  out_count += 1

for j in range(N - 1 , 0 , -1):
  if li[j] >= li[j - 1] + 2:
    out_count += 1
  elif li[j] == li[j - 1] + 1:
    li[j - 1] -= 1


if out_count == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
li = list(map(int,input().split()))
out_count = 0


for j in range(N - 1 , 0 , -1):
  if li[j] >= li[j - 1] + 2:
    out_count += 1
  elif li[j] == li[j - 1] + 1:
    li[j - 1] -= 1

if li[0] > li[1] + 1:
  out_count += 1
    
if out_count == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
li = list(map(int,input().split()))
out_count = 0


for j in range(N - 1 , 0 , -1):
  if li[j] >= li[j - 1] + 2:
    out_count += 1
  elif li[j] == li[j - 1] + 1:
    li[j - 1] -= 1

if li[0] > li[1]:
  out_count += 1
    
if out_count == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
li = list(map(int,input().split()))
out_count = 0


for j in range(N - 1 , 0 , -1):
  if li[j] >= li[j - 1] + 2:
    out_count += 1
  elif li[j] == li[j - 1] + 1:
    li[j - 1] -= 1
if li[0] > li[1]:
  out_count += 1
    
if out_count == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
li = list(map(int,input().split()))
out_count = 0


for j in range(N - 1 , 0 , -1):
  if li[j] >= li[j - 1] + 2:
    out_count += 1
  elif li[j] == li[j - 1] + 1:
    li[j - 1] -= 1
if li[0] > li[1]:
  out_count += 1
    
if out_count == 0:
  print('Yes')
else:
  print('No')
Problem p03030 (python)

Fixed submission:
N = int(input())
rest = []
for i in range(N):
  S,P = input().split()
  inrest = [ i + 1 , str(S) , int(P)]
  rest.append(inrest)

rest = sorted(rest , key = lambda x:x[2] , reverse = True)
rest = sorted(rest , key = lambda x:x[1])

for i in range(N):
  print(rest[i][0])

Buggy submission (verdict: Runtime Error):
N = int(input())
rest = []
for i in range(N):
  S,P = input().split()
  inrest = [ i + 1 , str(S) , int(P)]
  rest.append(inrest)

rest = sorted(rest , key = lambda x:x[2] , reverse = True)
rest = sorted(rest , key = lambda x:x[1])

for i in range(N):
  print(lest[i][0])
Problem p03059 (python)

Fixed submission:
li = list(map(int,input().split()))
A = li[0]
B = li[1]
T = li[2]
ans = int(T / A) * B
print(ans)

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
li[0] = A
li[1] = B
li[2] = T
ans = int(T / A) * B
print(ans)
Problem p03060 (python)

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

cost = []

for i in range(N):
  X = V[i] - C[i]
  if X >= 0:
    cost.append(X)

print(sum(cost))

Buggy submission (verdict: Runtime Error):
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

cost = []

for i in range(N):
  X = V[i] - C[i]
  cost.append(X)
  
new_cost = sorted(cost , reverse = True)
print(new_cost[0] + new_cost[1])
Problem p03219 (python)

Fixed submission:
X,Y = map(int,input().split())
print(int(X + Y /2))

Buggy submission (verdict: Runtime Error):
X,Y = map(int(input().split())
print(int(X + Y /2))

Buggy submission (verdict: Runtime Error):
X,Y = int(input())
print(int(X + Y /2))
Problem p03369 (python)

Fixed submission:
print( 700 + input().count('o') * 100)

Buggy submission (verdict: Runtime Error):
a = input()
count = 0
for i in range(len(a)):
  if a[i] = 'o':
    count += 1
print(700 + count * 100)
Problem p03434 (python)

Fixed submission:
N = int(input())
li = list(map(int,input().split()))
a = []
b = []

li.sort(reverse = True)
for i in li[0::2]:
  a.append(i)
for i in li [1::2]:
  b.append(i)
print(sum(a) - sum(b))

Buggy submission (verdict: Runtime Error):
N = int(input())
li = []
a = []
b = []
for i in range(N):
  li.append(int(input()))
li.sort(reverse = True)
for i in li[0::2]:
  a.append(i)
for i in li [1::2]:
  b.append(i)
print(sum(a) - sum(b))
Problem p03455 (python)

Fixed submission:
a,b = map(int,input().split())
c = a * b
if c % 2 == 1:
  print('Odd')
else:
  print('Even')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = a + b
print("Even" if c % 2 == 0 "Odd" else)

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())
c = a * b
if c % 2 == 1:
  print('Odd')
else:
  print('Even')
Problem p03486 (python)

Fixed submission:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse = True)
js = ''.join(s)
jt = ''.join(t)
if js < jt:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
new_s = s.sort()
new_t = t.sort(reverse = True)
js = ''.join(new_s)
jt = ''.join(new_t)
if js > jt:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())
new_s = s.sort()
new_t = t.sort(reverse = True)
js = ''.join(new_s)
jt = ''.join(new_t)
if js > jt:
  print('Yes')
else:
  print('No')
Problem p03494 (python)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
A = np.array(A)
count = 0
while True:
  x = 0
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

count = 0
while True:
  x = 0
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
x = 0
count = 0
while True:
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
x = 0
count = 0
while True:
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A /= 2
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
x = 0
count = 0
while True:
  for i in A:
    if i % 2 == 1:
      x == 1
  if x == 1:
    break
  else:
    A /= 2
    count += 1

print(count)
Problem p03644 (python)

Fixed submission:
N = int(input())

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 1:
      break
    else:
      i /= 2
      count += 1
  a.append(count)
print(a.index(max(a)) + 1)

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

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 0:
      i /= 2
    count += 1
    else:
      break
  a.append(count)
print(a.index(max(a)) + 1)

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

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 0:
      i /= 2
    count += 1
    else:
      break
  a.append(count)
print(a.index(max(X)) + 1)

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

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 0:
      i /= 2
    count += 1
    else:
      break
  a.append(count)
print(a.index(max(X) + 1))

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

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 0:
      i /= 2
    count += 1
    else:
      break
  a.append(count)
print(a.index(max(X) + 1)
Problem p03658 (python)

Fixed submission:
N,K = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = 0
for i in li[:K]:
  total += i
  
print(total)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = 0
for i in li[:K]
  total += i
  
print(total)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = 0
for i in li[:k-1]:
  total += i
  
print(total)
Problem p02952 (python)

Fixed submission:
n = int(input())

if len(str(n)) == 6:
    print(90909)
elif len(str(n)) == 4:
    print(909)
elif len(str(n)) == 2:
    print(9)
elif len(str(n)) == 1:
    print(n)
elif len(str(n)) == 3:
    print(9 + (n - 100) + 1)
elif len(str(n)) == 5:
    print(9 + 900 + (n - 10000) + 1)

Buggy submission (verdict: Runtime Error):
if len(str(n)) == 6:
    print(90909)
elif len(str(n)) == 4:
    print(909)
elif len(str(n)) == 2:
    print(9)
elif len(str(n)) == 1:
    print(n)
elif len(str(n)) == 3:
    print(9 + (n - 100) + 1)
elif len(str(n)) == 5:
    print(9 + 900 + (n - 10000) + 1)
Problem p02953 (python)

Fixed submission:
import sys

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

for i in range(n-1):
    d = h[i+1] - h[i]
    if d >= 1:
        h[i+1] -= 1
    elif d < 0:
        print('No')
        sys.exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
import sys

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

for i in range(n):
    d = h[i+1] - h[i]
    if d >= 1:
        h[i+1] -= 1
    elif d < 0:
        print('No')
        sys.exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
import numpy as np
flag = False

N = int(input())
H = list(map(int, input().split()))
H = np.array(H)
D = (H[1:]-H[:-1])

for i in range(len(H[1:]-H[:-1])):
    if D[i] < -1:
        flag = True
        break
    elif D[i] == -1:
        if i-1 < 0:
            continue
        elif i+1 == len(D):
            continue
        else:
            if len(D[D[i+1] == -1]) >= 1:
                flag = True
                break
            elif len(D[D[i-1] == -1]) >= 1:
                flag = True
                break

if flag == True:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
import numpy as np
flag = False

N = int(input())
H = list(map(int, input().split()))
H = np.array(H)
D = (H[1:]-H[:-1])

for i in range(len(H[1:]-H[:-1])):
    if D[i] < -1:
        flag = True
        break
    elif D[i] == -1:
        if i-1 < 0:
            continue
        elif i+1 == len(D):
            continue
        else:
            if len(D[D[i+1] == -1]) >= 1:
                flag = True
                break
            if len(D[D[i-1] == -1]) >= 1:
                flag = True
                break

if flag == True:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
import numpy as np
flag = False

N = int(input())
H = list(map(int, input().split()))
H = np.array(H)
D = (H[1:]-H[:-1])

for i in range(len(H[1:]-H[:-1])):
    if D[i] < -1:
        flag = True
        break
    elif D[i] == -1:
        if D[i-1] == -1:
            flag = True
            break
        elif D[i+1] == -1:
            flag = True
            break

if flag == True:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
import numpy as np
flag = False

N = int(input())
H = list(map(int, input().split()))
H = np.array(H)
D = (H[1:]-H[:-1])

for i in range(len(H[1:]-H[:-1])):
    if D[i] < -1:
        flag = True
        break
    elif D[i] == -1:
        if D[i-1] == -1:
            flag = True
        elif D[i+1] == -1:
            flag = True

if flag == True:
    print('No')
else:
    print('Yes')
Problem p03101 (python)

Fixed submission:
s = [input().split() for i in range(2)]

a, b, c, d = int(s[0][0]), int(s[0][1]), int(s[1][0]), int(s[1][1])

sum_cells_count = a * b
row_cells_count = b * c
col_cells_count = (a - c) * d

filled_cells_count = row_cells_count + col_cells_count

blank_cells_count = sum_cells_count - filled_cells_count
print(blank_cells_count)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
a = []
for i in range(N+1):
    a.append(list(map(int, input().split())))

count = 0
sum = 0
for i in range(1, N+1):
    for j in range(M):
        sum += int(a[0][j]) * int(a[i][j])
    if sum + int(C) > 0:
        count += 1
        sum = 0
    else:
        sum = 0

print(count)

Buggy submission (verdict: Runtime Error):
s = [input().split() for i in range(2)]
print(s)

sum_cells_count = s[0][0] * s[0][1]
row_cells_count = s[0][1] * s[1][0]
col_cells_count = s[0][0] - s[1][0]

filled_cells_count = row_cells_count + col_cells_count

return sum_cells_count - filled_cells_count
Problem p03150 (python)

Fixed submission:
import sys

s=input()

target="keyence"
j=0
mismatch=0

for i in range(len(target)):
    if target[:i]==s[:i] and target[i:]==s[-7+i:]:
        print('YES')
        sys.exit()
print('NO')

Buggy submission (verdict: Runtime Error):
s=input()

target="keyence"
j=0

for i in range(len(s)):
    if s[i]==target[j]:
        j+=1

if j==len(target):
    print('YES')
else:
    print('NO')
Problem p03260 (python)

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

if a*b%2==0:
    print('No')
else:
    print('Yes')

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

if a%2==1 and b%2==1:
    print('Yes')
else:
    print('No')
Problem p03282 (python)

Fixed submission:
import sys

s=input()
k=int(input())


i=0
while i<len(s) and i<k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print("1")

Buggy submission (verdict: Runtime Error):
import sys

s=input()
k=int(input())


i=0
while i<=k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print("1")

Buggy submission (verdict: Runtime Error):
import sys

s=input()
k=int(input())


i=0
while i<k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print(s[i])

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())

if s[0]=="1":
    print(s[1])
else:
    print(s[0])
Problem p03316 (python)

Fixed submission:
n=input()
s=0
for i in range(len(n)):
    s+=int(n[i])

if int(n)%s==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=input()
s=0
for i in range(len(n)):
    s+=int(n[i])

if int(n)%s==0:
    print('Yes')
else:
    print('No')
tanakashunshounoMacBook-P
Problem p03323 (python)

Fixed submission:
a,b=list(map(int, input().split()))
if a<=8 and b<=8:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
a,b=list(map(int, input().split()))
if a<=8 and b<=8:
    print(‘Yay!’)
else:
    print(‘:(’)
Problem p03351 (python)

Fixed submission:
def abs(a):
  if a<0:
    return a*(-1)
  else:
    return a

a,b,c,d=list(map(int,input().split()))
if abs(a-b)<=d and abs(b-c)<=d:
  print('Yes')
elif abs(a-c)<=d:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(1000)]
cand[0]=1
for i in range(2,log_x+1):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x+1]))

Buggy submission (verdict: Runtime Error):
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(x)]
cand[0]=1
for i in range(2,x):
    cand[i]=int(pow(x,1.0/i))**i
print(max(cand))
Problem p03352 (python)

Fixed submission:
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(1001)]
cand[0]=1
for i in range(2,1000):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x+1]))

Buggy submission (verdict: Runtime Error):
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(x)]
cand[0]=1
for i in range(2,log_x+1):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x]))

Buggy submission (verdict: Runtime Error):
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(x)]
cand[0]=1
for i in range(2,log_x+1):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x+1]))
Problem p03369 (python)

Fixed submission:
s=input()
o=s.count('o')
print(700+100*o)

Buggy submission (verdict: Runtime Error):
s=input()
o=s.count('o')

print o*800+(len(s)-o)*700
Problem p03370 (python)

Fixed submission:
n,x=list(map(int,input().split()))
m=[]
sum=0
for i in range(n):
  mi=int(input())
  m.append(mi)
  sum+=mi

ans=n+int((x-sum)/min(m))
print(ans)

Buggy submission (verdict: Runtime Error):
n,x=list(map(int,input()))
m=[]
sum=0
for i in range(n):
  mi=int(input())
  m.append(mi)
  sum+=mi

ans=n+(x-sum)/min(m)
print(ans)
Problem p03456 (python)

Fixed submission:
import math
a,b=raw_input().split()
n=int(a+b)
if(int(math.sqrt(n))**2==n):
  print "Yes"
else:
  print "No"

Buggy submission (verdict: Runtime Error):
a,b=raw_input().split()
n=int(a+b)
if(sqrt(n)**2==n):
  print "Yes"
else:
  print "No"
Problem p03469 (python)

Fixed submission:
s=input()
s="2018"+s[4:]
print(s)

Buggy submission (verdict: Runtime Error):
s=input()
s="2018"+s[4:]
print s
Problem p03487 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
dict={}
for i in a:
  if i not in dict:
    dict[i]=1
  else:
    dict[i]+=1

ans=0
for i in dict.keys():
  count=dict[i]
  if count>i:
    ans+=count-i
  elif count<i:
    ans+=count

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=input().split()
dict={}
for i in a:
  if i not in dict:
    dict[i]=1
  else:
    dict[i]+=1

ans=0
for i in dict.keys():
  count=dict[i]
  if count>i:
    ans+=count-i
  elif count<i:
    ans+=count

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=map(int,input().split())

ans=0
for i in range(n):
  if a.count(i)>i:
    ans+=a.count(i)-i
  elif a.count(i)<i:
    ans+=a.count(i)

print(ans)