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

Fixed submission:
import sys
A, B = map(int, input().split())
for i in range(1, 4):
    x = A *B *i
    if ((x % 2) == 1):
      print('Yes')
      sys.exit()
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
for i in range(1, 4):
	x = A *B *i
    if ((x % 2) == 1):
      print('Yes')
	  break
else:
  print('No')
Problem p03280 (python)

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

print((a * b) - (a + b - 1))

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

print((a * b) - (a + b - 1))
Problem p02554 (python)

Fixed submission:
n=int(input())
if n<2:

    print(0)
else:
 
    mod=10**9+7
    exclusion=2*pow(9,n,mod)-pow(8,n,mod)
    total=pow(10,n,mod)
    ans=total-exclusion
    print(ans%mod)

Buggy submission (verdict: Runtime Error):
n=int(input())
mod=10**9+7
exlcusion=2*pow(9,n,mod)-pow(8,n,mod)
total=pow(10,n,mod)
ans=total-exclusion%mod
print(total)
Problem p02606 (python)

Fixed submission:
l,r,d=map(int,input().split())
if l%d!=0:
  print(r//d-l//d)
else:
  print((r//d-l//d)+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=[0]*(10001)
for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      index=i**2+j**2+k**2+i*j+j*k+i*k
      if index<10000:
        ans[index]+=1
     
for i in range(1,n+1):
  print(ans[i])
Problem p02608 (python)

Fixed submission:
n=int(input())
ans=[0]*(10001)
for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      index=i**2+j**2+k**2+i*j+j*k+i*k
      if index<=10000:
        ans[index]+=1
     
for i in range(1,n+1):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=[0]*(10000)
for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      ans[i**2+j**2+k**2+i*j+j*k+i*k]+=1
for i in range(n+1):
  print(ans[i])
Problem p02621 (python)

Fixed submission:
a=int(input())
print(a+(a**2)+(a**3))

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a.insert(0,0)
b.insert(0,0)
j=1
while j<=m and b[j]+b[j-1]<=k:
  b[j]+=b[j-1]
  j+=1
  

j-=1
books=j
i=1
while i<n+1:
  while j>0 and a[i]+b[j]>k:
    j-=1
  if(j>=0) and a[i]+b[j]<=k:
    books=max(books,j+i)
    a[i]+=a[i-1]
    i+=1
  else:
    break
print(books)
Problem p02628 (python)

Fixed submission:
import functools
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
cost=functools.reduce(lambda x,y:x+y,p[:k],0)
print(cost)

Buggy submission (verdict: Runtime Error):
import functools
n,k=int(input())
p=list(map(int,input().split()))
p.sort()
for i in range(k):
  cost+=p[i]
print(cost)

Buggy submission (verdict: Runtime Error):
import functools
n,k=int(input())
p=list(map(int,input().split()))
p.sort()
cost=functools.reduce(lambda x,y:x+y,p[:k],0)
print(cost)
Problem p02639 (python)

Fixed submission:
List=list(map(int,input().split()))
ans=-1
for x in range(5):
  if(List[x]==0):
    ans=x+1
    break
print(ans)

Buggy submission (verdict: Runtime Error):
List=list(map(int,input().split()))
ans=-1
for x in range(5):
  if(List[x]==0):
    ans=x+1
  	break
print(ans)
Problem p02642 (python)

Fixed submission:

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

List.sort()
seive=[0]*(List[~0]+1)
count=0
for each in List:
    for i in range(each,List[-1]+1,each):
        seive[i]+=1
        
for each in List:
    if(seive[each]==1):
        count+=1


print(count)

Buggy submission (verdict: Runtime Error):
import collections
def check(val):
  flag=1
  for v in range(2,int(val**0.5+1)):
    if(val%v==0):
      if(v in x or val//v in x):
        flag=0
        break
  if(flag):
    count+=1
n=int(input())
a=list(map(int,input().split()))
count=0
x=collections.Counter(a)
if(1 in x):
  if(x[1]==1):
    print(1)
  else:
    print(0)
else:
  for each in a:
    if(x[each]==1):
      check(each)
  print(count)

Buggy submission (verdict: Runtime Error):
import collections
def check(val):
  global x
  global count
  flag=1
  for v in range(2,val**.5+1):
    if(val%v==0):
      if(v in x or val//v in x):
        flag=0
        break
  if(flag):
    count+=1
n=int(input())
a=list(map(int,input().split()))
count=0
x=collections.Counter(a)
if(1 in x):
  if(x[1]==1):
    print(1)
  else:
    print(0)
else:
  for each in a:
    if(x[each]==1):
      check(each)
  print(count)

Buggy submission (verdict: Runtime Error):
import collections
def check(val):
  flag=1
  for v in range(2,val**.5+1):
    if(val%v==0):
      if(v in x or val//v in x):
        flag=0
        break
  if(flag):
    count+=1
n=int(input())
a=list(map(int,input().split()))
count=0
x=collections.Counter(a)
if(1 in x):
  if(x[1]==1):
    print(1)
  else:
    print(0)
else:
  for each in a:
    if(x[each]==1):
      check(each)
  print(count)
Problem p03160 (python)

Fixed submission:
import sys 
sys.setrecursionlimit(10**6)
def dp(n,cache,height):
  if n<0:
    return float('inf')
  elif n==0:
    return 0
  elif n==1:
    return abs(height[1]-height[0])
  elif n in cache :
    return cache[n]
  else:
    cache[n]= min(dp(n-1,cache,height)+abs(height[n]-height[n-1]),dp(n-2,cache,height)+abs(height[n]-height[n-2]))
    return cache[n]
n=int(input())
h=list(map(int,input().split()))
print(dp(n-1,dict(),h))

Buggy submission (verdict: Runtime Error):
import sys 
sys.setrecursionlimit(10**6)
def dp(n,cache,height):
  if n<0:
    return float('inf')
  elif n==0:
    return 0
  elif n==1:
    return abs(height[1]-height[0])
  elif n in cache :
    return cache[n]
  else:
    cache[n]= min(dp(n-1,cahche,height)+abs(height[n]-height[n-1]),dp(n-2,cahche,height)+abs(height[n]-height[n-2]))
	return cache[n]
n=int(input())
h=list(map(int,input().split()))
print(dp(n-1,dict(),h))

Buggy submission (verdict: Runtime Error):
import sys 
sys.setrecursionlimit(10**6)
def dp(n,cache,height):
  if n<0:
    return float('inf')
  elif n==0:
    return 0
  elif n==1:
    return abs(height[1]-height[0])
  elif n in cache :
    return cache[n]
  else:
    cache[n]= min(dp(n-1,cahche,height)+abs(height[n]-height[n-1]),dp(n-2,cahche,height)+abs(height[n]-height[n-2]))
	return cache[n]
Problem p03166 (python)

Fixed submission:
import collections
import sys
sys.setrecursionlimit(10**9)
cache,edge={},collections.defaultdict(list)
def dp(node):
  if node in cache:
    return cache[node]
  lcl_max=0
  for child in edge[node]:
    
    lcl_max=max(lcl_max,1+dp(child))
  cache[node]=lcl_max
  return lcl_max
 
max_dis=0

n,m=map(int,input().split())
for _ in range(m):
  a,b=map(int,input().split())
  edge[a].append(b)
for node in range(1,n+1):
  max_dis=max(max_dis,dp(node))
print(max_dis)

Buggy submission (verdict: Runtime Error):
import collections

def dfs(v):
    if cache.get(v):
        return cache[v]
    path=0
    for adj in g[v]:
        path=max(path,1+dfs(adj))
    cache[v]=path
    return path


n,m=map(int,input().split())
g=collections.defaultdict(list)
cache={}
path=0
for _ in range(m):
    u,v=map(int,input().split())
    g[u].append(v)
for v in range(1,n+1):
    path=max(path,dfs(v))
print(path)

Buggy submission (verdict: Runtime Error):
import collections
import sys
sys.setrecursionlimit(10**9)
cache,edge={},collections.defaultdict(list)
def dp(node):
  if node in cache:
    return cache[node]
  lcl_max=0
  for child in edge[node]:
    
    lcl_max=max(lcl_max,1+dp(child))
  cache[node]=lcl_max
  return lcl_max
 
max_dis=0

n,m=map(int,input().split())
for _ in range(m):
  a,b=map(int,input().split())
  edge[a].append(b)
for node in range(1,n+1):
  max_dis=max(max_dis,dp(node,cache,edge))
print(max_dis)

Buggy submission (verdict: Runtime Error):
import collections
def dp(node,cache,edge):
  if node in cache:
    return cache[node]
  lcl_max=0
  for child in edge[node]:
    cache[child]=dp(child,cache,edge)
    lcl_max=max(lcl_max,1+cache[child])
  return lcl_max
 
max_dis=0
cache,edge={},collections.defaultdict(list)
n,m=map(int,input().split())
for _ in range(m):
  a,b=map(int,input().split())
  edge[a].append(b)
for node in range(1,n+1):
  max_dis=max(max_dis,dp(node,cache,edge))

Buggy submission (verdict: Runtime Error):
import collections
def dp(node,cache,edge):
  if node in cache:
    return cache[node]
  lcl_max=0
  for child in edge[node]:
    dp[child]=dp(child,cache,edge)
    lcl_max=max(lcl_max,1+dp[child])
  return lcl_max

max_dis=0
cache,edge={},collections.defaultdict(list)
n,m=map(int,input().split())
for _ in range(m):
  a,b=map(int,input().split())
  edge[a].append(b)
for node in range(1,n+1):
  max_dis=max(max_dis,dp(node,cache,edge))
Problem p03167 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)
mod=10**9+7
m,n=map(int,input().split())
grid=[list(input()) for _ in range(m)]
cache={}
def dp(i,j):
  if i<0 or j<0 or i>=len(grid) or j>=len(grid[0]) or grid[i][j]=='#':
    return 0
  elif (i,j) in cache:
    return cache[(i,j)]
  elif i==m-1 and j==n-1:
    return 1
  cache[(i,j)]=dp(i+1,j)+dp(i,j+1)
  return cache[(i,j)]

print(dp(0,0)%mod)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)
mod=10**9+7
m,n=map(int,input().split())
grid=[list(input()) for _ in range(n)]
cache={}
def dp(i,j):
  if i<0 or j<0 or i>=len(grid) or j>=len(grid[0]) or grid[i][j]=='#':
    return 0
  elif (i,j) in cache:
    return cache[(i,j)]
  elif i==m-1 and j==n-1:
    return 1
  cache[(i,j)]=dp(i+1,j)+dp(i,j+1)
  return cache[(i,j)]

print(dp(0,0)%mod)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)
mod=10**9+7
m,n=map(int,input())
grid=[list(input()) for _ in range(n)]
cache={}
def dp(i,j):
  if i<0 or j<0 or i>=len(grid) or j>=grid[0] or grid[i][j]=='#':
    return 0
  elif (i,j) in cache:
    return cache[(i,j)]
  elif i==m-1 and j==n-1:
    return 1
  cache[(i,j)]=dp(i+1,j)+dp(i,j+1)
  return cache[(i,j)]

print(dp(0,0)%mod)
Problem p02924 (python)

Fixed submission:
n = int(input())
ans = (n-1)*(1+n-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(range(1, n))
print(sum(a))
Problem p02971 (python)

Fixed submission:
import itertools

n = int(input())
a = [int(input()) for i in range(n)]

max_list = [0] + list(itertools.accumulate(a, func=max))
max_list_r = ([0] +list(itertools.accumulate(reversed(a), func=max)))[::-1]
for i in range(n):
    print(max(max_list[i], max_list_r[i + 1]))

Buggy submission (verdict: Runtime Error):
import itertools

n = int(input())
a = [int(input()) for i in range(n)]

max_list = [0] + list(itertools.accumulate(a, func=max))
max_list_r = [0, *itertools.accumulate(reversed(a), func=max)][::-1]
# print(max_list)
# print(max_list_r)
for i in range(n):
    print(max(max_list[i], max_list_r[i + 1]))

Buggy submission (verdict: Runtime Error):
import itertools

n = int(input())
a = [int(input()) for i in range(n)]
max_list = list(itertools.accumulate(a, func=max))
max_list_r = list(itertools.accumulate(reversed(a), func=max))

for i in range(n):
    print(max(max_list[i - 1], max_list_r[i - 1]))
Problem p02993 (python)

Fixed submission:
s = input()
difficult = False
for i in range(3):
    if s[i] == s[i+1]:
        difficult = True

if difficult:
    print("Bad")
else:
    print("Good")

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
tastes = range(l, n + l)
ijo = [taste for taste in tastes if taste >= 0]
under = [taste for taste in tastes if taste < 0]
if len(ijo) == 0:
    print(sum(under[:-1]))
elif len(under) == 0:
    print(sum(ijo[1:]))
else:
    print(sum(tastes))
Problem p02999 (python)

Fixed submission:
x,a=map(int,input().split())
ans = 0 if x<a else 10
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n, k = map(int, input().split())
a = map(int, input().split())
accum = [0] + list(itertools.accumulate(a))
count = 0
for i in range(n):
    for j in range(i + 1, n + 1):
        if accum[j] - accum[i] >= k:
            count += 1
print(count)
Problem p03043 (python)

Fixed submission:
import math

n, k = map(int, input().split())
ans = 0
for i in range(1, n + 1):
    if k/i > 1:
        l = math.log2(k / i)
        a = math.ceil(l)
        ans += (1 / n) * ((1 / 2) ** a)
    else:
        ans += 1/n

print(ans)

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
ans = 0
for i in range(1, n + 1):
    if k/i > 1:
        l = math.log2(k / i)
        a = math.ceil(l)
        ans += (1 / n) * ((1 / 2) ** a)
    else:
        ans += 1/n

print(ans)
Problem p03047 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
S = [input() for _ in range(n)]
cnt = 0
fb_cnt = 0
ba_cnt = 0
for s in S:
    idx = len(s) - 1
    for i in range(idx - 1):
        if s[i] == 'A' and s[i + 1] == 'B':
            cnt += 1
    if s[idx] == 'A':
        ba_cnt += 1
    if s[0] == 'B':
        fb_cnt += 1

min_cnt = min(fb_cnt, ba_cnt)
min_cnt = min_cnt - 1 if fb_cnt == ba_cnt else min_cnt
print(cnt + min_cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
S = [input() for _ in range(n)]
cnt = 0
fb_cnt = 0
ba_cnt = 0
for s in S:
    idx = len(s) - 1
    for i in range(idx - 1):
        if s[i] == 'A' and s[i + 1] == 'B':
            cnt += 1
    if s[idx] == 'A':
        ba_cnt += 1
    if s[0] == 'B':
        fb_cnt += 1

min_cnt = min(fb_cnt, ba_cnt)
min_cnt = min_cnt - 1 if n <= min_cnt else min_cnt
print(cnt + min_cnt)
Problem p03425 (python)

Fixed submission:
N = int(input())
march = 'MARCH'
l = [0] * len(march)
for i in range(N):
    S = input()
    for j in range(len(march)):
        if S[0] == march[j]:
            l[j] += 1

# print(l)
tmp = []
lenl = len(l)
for i in range(lenl):
    for j in range(i + 1, lenl):
        for k in range(j + 1, lenl):
           tmp.append(l[i]*l[j]*l[k])
# print('tmp',tmp)
print(sum(tmp))

Buggy submission (verdict: Runtime Error):
N = int(input())
l = [0] * N
march = 'MARCH'
for i in range(N):
    S = input()
    for j in range(len(march)):
        if S[0] == march[j]:
            l[j] += 1

tmp = []
lenl = len(l)
for i in range(lenl):
    for j in range(i + 1, lenl):
        for k in range(j + 1, lenl):
           tmp.append(l[i]*l[j]*l[k])

print(sum(tmp))
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())
ans = '-1 -1 -1'
for i in range(N + 1):
    for j in range(N + 1):
        k = N - (i + j)
        if k >= 0 and 10000 * i + 5000 * j + 1000 * k == Y:
            ans = '{} {} {}'.format(i, j, k)
            break
    else:
        continue
    break
print(ans)

Buggy submission (verdict: Runtime Error):
n, y = map(int, input().split())
r = range(n+1)

ans = "-1 -1 -1"
for i in r:
    for j in r:
        k = (y-(10000*i+5000*j))//1000
        if k >= 0 and 10000*i+5000*j+1000*k == y and i+j+k == n:
            ans = f"{i} {j} {k}"

print(ans)

Buggy submission (verdict: Runtime Error):
n, y = map(int, input().split())
r = range(n+1)

ans = "-1 -1 -1"
for i in r:
    for j in r:
        k = (y-(10000*i+5000*j))//1000
        if k >= 0 and i+j+k == n:
            ans = f"{i} {j} {k}"

print(ans)

Buggy submission (verdict: Runtime Error):
n, y = map(int, input().split())
r = range(n+1)

ans = "-1 -1 -1"
for i in r:
    for j in r:
        k = (y-(10000*i+5000*j))//1000
        if k >= 0 and i+j+k <= n:
            ans = f"{i} {j} {k}"

print(ans)
Problem p03564 (python)

Fixed submission:
n = int(input())
k = int(input())
ans = 1
for i in range(n):
    ans = min(ans*2,ans+k)
print(ans)

Buggy submission (verdict: Runtime Error):
xi, yi, xii, yii = map(int, input().split())
dx = xii - xi
dy = yii - yi

x = xii
y = yii
for i in range(2):
    dx, dy = -dy, dx
    x += dx
    y += dy
    print(x, y, end=' ')
Problem p03627 (python)

Fixed submission:
import collections
import sys

N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
two = [k for k, v in c.items() if v > 1]
four = [k for k, v in c.items() if v > 3]
if len(two) < 2 and not four:
    print(0)
    sys.exit(0)

St = 0
Sf = 0
if two:
    two.sort(reverse=True)
    St = 1
    for i in range(2):
        St *= two[i]
if four:
    Sf = max(four) ** 2
print(St if St > Sf else Sf)

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

N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
two = [k for k, v in c.items() if v > 1]
four = [k for k, v in c.items() if v > 3]
if len(two) < 2 and not four:
    print(0)
    sys.exit(0)
two.sort(reverse=True)
four.sort(reverse=True)
tmp = 1
for i in range(2):
    tmp *= two[i]
max_four = max(four)
print(tmp if tmp > max_four else max_four)
Problem p03633 (python)

Fixed submission:
import fractions


def lcm(a, b):
    n = fractions.gcd(a, b)
    return a * b // n if n > 0 else 0


N = int(input())
T = [int(input()) for _ in range(N)]
tmp = 1
for i in range(N):
    tmp = lcm(tmp, T[i])
print(tmp)

Buggy submission (verdict: Runtime Error):
import math


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


N = int(input())
T = [int(input()) for _ in range(N)]
tmp = 1
for i in range(N):
    tmp = lcm(tmp, T[i])
print(tmp)
Problem p02553 (python)

Fixed submission:
input_lines = input().split()
num_lines = []
a = int(input_lines[0])
b = int(input_lines[1])
c = int(input_lines[2])
d = int(input_lines[3])

num_lines.append(a*c)
num_lines.append(a*d)
num_lines.append(b*c)
num_lines.append(b*d)

print(max(num_lines))

Buggy submission (verdict: Runtime Error):
input_lines = input().split()
num_lines = []
a = int(input_lines[0])
b = int(input_lines[1])
c = int(input_lines[2])
d = int1(input_lines[3])

num_lines.append(a*c)
num_lines.append(a*d)
num_lines.append(b*c)
num_lines.append(b*d)

print(max(num_lines))
Problem p02705 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import math

a = int(input())
print(2*a*math.pi)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
import numpy as np

a = int(input())
print(2*a*math.pi)
Problem p02602 (python)

Fixed submission:
# cook your dish here
n,k=input().split()
n=int(n)
k=int(k)
l=list(map(int,input().split()))
for j in range(n):
    if k+j==n:
        break
    if l[k+j]>l[j]:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
# cook your dish here
n,k=input().split()
n=int(n)
k=int(k)
l=list(map(int,input().split()))
for j in range(n):
	if l[k+j]>l[j]:
    	print("Yes")
	else:
      print("No")
    if k+j==n-1:
      break
Problem p03455 (python)

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

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = a * b
if c % 2 == 1:
    print("Odd")
else:
    print("Even")
Problem p03493 (python)

Fixed submission:
a = str(input())
print(a.count('1'))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
flag = True

while flag:
    ans = []
    for i in a:
        if i%2 == 1:
            flag = False
        else:
            ans.append(i/2)
    if len(ans) == n:
        cnt += 1
        a = ans

print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
flag = True

while flag:
    ans = []
    for i in a:
        if i%2 == 1:
            flag = False
            break
        else:
            ans.append(i/2)
    if len(ans) == n:
        cnt += 1
        a = ans

print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
count = 0
flag = 1

while flag == 1:
    b = list(map(lambda x: x % 2, a))
    if b.count(1) == 0:
        a = list(map(lambda x: x / 2, a))
        count += 1
    else:
        flag = 0

print(count)
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3 * r**2)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
 
def main():
  n = int(input())
  numList  = [int(input()) for _ in range(n)]
  maxVal = max(numList)
  workList = numList[:]
  workList.remove(maxVal)
  secondVal = max(workList)
  for num in numList:
    if num != maxVal:
      print(maxVal)
    else:
      print(secondVal)
      
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
n = int(input())
numList  = [input() for i in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
  if num != maxVal:
    print(maxVal)
  else:
    print(secondVal)

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

max = (n - d) - d
count = 1

for i in range(1000):
  if max <= 1:
    break
  max = (max - (d*2) -1) 
  count += 1

print(count)
Problem p02971 (python)

Fixed submission:
n = int(input())
numList  = [int(input()) for i in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
  if num != maxVal:
    print(maxVal)
  else:
    print(secondVal)

Buggy submission (verdict: Runtime Error):
n = int(input())
numList  = [input() for i in range(n)]
maxVal = max(numList)
workList = numList[:]
secondVal = max(workList.remove(maxVal))
for num in numList:
  if num != maxVal:
    print(maxVal)
  else
    print(secondVal)

Buggy submission (verdict: Runtime Error):
n = int(input())
# リスト内包表記
numList  = [input() for i in range(n)]

workList = numList.copy()
for j in range(n):
  workList.remove(numList[j])
  print(max(set(workList)))
  workList = numList.copy()
Problem p04043 (python)

Fixed submission:
li = list(map(int, input().split()))
count5 = count7 = 0
for l in li:
    if l == 5:
        count5 += 1
    elif l == 7:
        count7 += 1
    else:
        print("NO")
        exit()
if count5 == 2 and count7 == 1:
    print("YES")
else:
    print("NO")

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


def validate(strNum):
    for i in strNum:
        if i in d:
            return
    print(strNum)
    exit()


for i in range(0, 1000000):
    validate(str(n))
    n += 1

Buggy submission (verdict: Runtime Error):


n, k = map(int, input().split())
d = list(input().split())


def validate(strNum):
    for i in strNum:
        if i in d:
            return False
    print(strNum)
    exit()


for i in range(0, 10001):
    _ = validate(str(n))
    n += 1
Problem p03719 (python)

Fixed submission:
import sys

a, b, c = (int (i) for i in raw_input().split())

if c >= a and c <= b:
    print 'Yes'
else:
    print 'No'

Buggy submission (verdict: Runtime Error):
mport sys

a, b, c = (int (i) for i in raw_input().split())

if c >= a and c <= b:
    print 'yes'
else:
    print 'no'

Buggy submission (verdict: Runtime Error):

import sys

a, b, c = (int (i) for i in raw_input().split())

if c >= a and c <= b:
    print 'yes'
else:
    print 'no'
Problem p03087 (python)

Fixed submission:
n,q=map(int,input().split())
s=input()
a=[0,0]
for l in range(1,n):
    if s[l-1]=='A' and s[l]=='C':
        a.append(a[l]+1)
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y]-a[x])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
a=[0]
for l in range(n):
    if s[l]=='A' and s[l+1]=='C':
        a.append(a[l]+1)
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y-1]-a[x-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
a=[0]
for l in range(n):
    if s[l]=='A' and s[l+1]=='C':
        for j in range(1,3):
            a.append(a[l]+1)
        l+=1
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y-1]-a[x-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
a=[0]
for l in range(n):
    if s[l]=='A' and s[l+1]=='C':
        for j in range(1,2):
            a.append(a[l]+1)
        l+=1
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y-1]-a[x-1])
print(a)