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

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

for i in range(N,10*N+1):
    if set(str(i))&set(Dk) == set():
        print(i)
        break

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

for i in range(N,10*N+1):
    if set(i)&set(Dk) == set():
        print(i)

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

for i in range(N,10*N+1):
    if set(i)&set(Dk) == set():
        print(i)
Problem p02678 (python)

Fixed submission:
import math

n,m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]

hist= []
visited_pos = [-1] * n

#初期情報
#print(ab)
ts = {}
for el in ab:
  wk = ts.get(el[0]) 
  if wk is None:
    sss  = set()
    ts[el[0]] = sss
  ts[el[0]].add(el[1])
  wk = ts.get(el[1]) 
  if wk is None:
    sss  = set()
    ts[el[1]] = sss
  ts[el[1]].add(el[0])
#print(ts)


#幅優先探索
def tsk(pos):
  wk = ts.get(pos)
  if ts.get(pos) is None:
    return
  else:
    #print(pos,wk)
    for e in wk:
      if visited_pos[e-1] < 0:
        visited_pos[e-1] = pos # idx 値　0-
        hist.append(e) # 実値　1-

idx = 0
hist.append(1) #実値　1-
while True:
  if idx >= len(hist):
    break
  else:
    tsk(hist[idx])
    idx += 1
#print(hist)
#print(visited_pos)
ans = 'Yes'
for i in range(n):
  if visited_pos[i] == -1:
    ans = 'No'
    break

print(ans)
if ans == 'Yes':
  for i in range(1,n):
    print(visited_pos[i])

Buggy submission (verdict: Runtime Error):
import math

n,m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]

hist= []
visited_pos = [-1] * n

#初期情報
#print(ab)
ts = {}
for el in ab:
  wk = ts.get(el[0]) 
  if wk is None:
    sss  = set()
    ts[el[0]] = sss
  ts[el[0]].add(el[1])
  wk = ts.get(el[1]) 
  if wk is None:
    sss  = set()
    ts[el[1]] = sss
  ts[el[1]].add(el[0])
#print(ts)


#幅優先探索
def tsk(pos):
  wk = ts.get(pos)
  if ts.get(pos) is None:
    return
  else:
    #print(pos,wk)
    for e in wk:
      if visited_pos[e-1] < 0:
        visited_pos[e-1] = pos
        hist.append(e-1)

idx = 1
hist.append(1)
while True:
  if idx > len(hist):
    break
  else:
    tsk(hist[idx])
    idx += 1
#print(hist)
#print(visited_pos)
ans = 'Yes'
for i in range(n):
  if visited_pos[i] == -1:
    ans = 'No'
    break

print(ans)
if ans == 'Yes':
  for i in range(1,n):
    print(visited_pos[i])
Problem p02684 (python)

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
d2 = []
hist=[-1]*(n+1)
hist[0] = 0
cur = 1
d2.append(1)
st_idx = 0
rp_lgt = 1
for i in range(n):
  cur = a[cur-1]
  if hist[cur-1] >= 0 :
     d2.append(cur)
     st_idx = hist[cur-1]
     rp_lgt = i - st_idx + 1 
     break
  else:
    d2.append(cur)
    hist[cur-1] = i + 1
wk = k - st_idx
md = wk % rp_lgt
if k < st_idx:
  ans = d2[k]
else:
  ans = d2[md+st_idx]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
d2 = []
hist=[-1]*n
hist[0] = 0
cur = 1
d2.append(1)
st_idx = 0
rp_lgt = 0
for i in range(n):
  cur = a[cur-1]
  if hist[cur-1] >= 0 :
     d2.append(cur)
     st_idx = hist[cur-1] 
     rp_lgt = i - st_idx
     break
  else:
    d2.append(cur)
    hist[cur-1] = i
wk = k - st_idx
md = wk % rp_lgt
if k <= st_idx:
  ans = d2[k]
else:
  ans = d2[md+st_idx]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
s_d2 = set()
d2 = []
cur = 1
d2.append(1)
s_d2.add(1)
st_idx = 0
rp_lgt = 0
for i in range(n):
  cur = a[cur-1]
  if cur in s_d2:
    for j in range(len(d2)):
      if cur == d2[j] :
        st_idx = j - 1 
        rp_lgt = i - j + 1
        break
  else:
    d2.append(cur)
    s_d2.add(cur)
wk = k - st_idx
md = wk % rp_lgt
if k < st_idx:
  ans = d2[k]
else:
  ans = d2[md+st_idx]
#print(d2)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
s_d2 = set()
d2 = []
cur = 1
d2.append(1)
st_idx = 0
rp_lgt = 0
for i in range(n):
  cur = a[cur-1]
  if cur in s_d2:
    for j in range(len(d2)):
      if cur == d2[j] :
        st_idx = j - 1 
        rp_lgt = i - j + 1
        break
  else:
    d2.append(cur)
    s_d2.add(cur)
wk = k - st_idx
md = wk % rp_lgt
if k < st_idx:
  ans = d2[k]
else:
  ans = d2[md+st_idx]
print(ans)
Problem p02741 (python)

Fixed submission:
d = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
str_n = input()
n = int(str_n)
print(d[n-1])

Buggy submission (verdict: Runtime Error):
import math

s = input().split()

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

if math.sqrt(a) + math.sqrt(b) < math.sqrt(c) :
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import math

s = input().split()

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

if math.sqrt(a) + math.sqrt(b) < math.sqrt(c) :
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import math

s = input().split()

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

if math.sqrt(a) + math.sqrt(b) < math.sqrt(c) :
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import math

s = input().split()

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

if (a + b + 2* math.sqrt(a*b) ) < c :
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import math

s = input().split()

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

#if math.sqrt(a) + math.sqrt(b) < math.sqrt(c) :
if (a + b + 2* math.sqrt(a*b) ) < c :
  print('Yes')
else:
  print('No')
Problem p02780 (python)

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

awk = 0
aix = k - 1
for i in range(k):
  awk += a[i]
a_max = awk

for i in range(k,n):
  awk = awk + a[i] - a[i-k]
  if a_max < awk:
    a_max =  awk
    aix   = i

ans = 0.0
#print('aix={}'.format(aix))
for i in range(aix-k+1,aix+1 ):
  #print(a[i])
  ans += ( 1 + a[i] )  / 2.0

print(ans)

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

awk = 0
aix = k
for i in range(k):
  awk += a[i]
  #print(a[i])
#print('--')
a_max = awk

for i in range(k,n):
  #print(a[i],i-k)
  awk = awk + a[i] - a[i-k]
  if a_max < awk:
    a_max =  awk
    aix   = i

#print('===')
ans = 0.0
for i in range(aix-k+1,aix+1 ):
  #print(a[i],( 1 + a[i] )  / 2.0)
  ans += ( 1 + a[i] )  / 2.0

print(ans)
Problem p02618 (python)

Fixed submission:
#!/usr/bin/env python3
import random
n, *a = map(int, open(0).read().split())
for i in range(n):
    print(random.randint(1, 26))

Buggy submission (verdict: Runtime Error):
import randam
n = map(int, open(0).read().split())
for i in range(365):
  print(random.randint(1, 26))
Problem p02642 (python)

Fixed submission:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
a.sort()
m = a[-1]
s = [0]*(m+1)
ans = 0
for i in a:
    if s[i] <= 1:
        for j in range(i, m+1, i):
            s[j] += 1
for k in a:
    if s[k] == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
a.sort()
ans = not(a[0] == a[1])
for i in range(1, n):
    t = 1
    for j in range(i):
        if a[i] % a[j] == 0:
            t = 0
            break
    ans += t
print(ans)
Problem p02687 (python)

Fixed submission:
#!/usr/bin/env python3
s = input()
if s == "ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = [0]+list(map(int, input().split()))
ans = [0]+[1]*n
for i in range(m):
    a, b = map(int, input().split())
    if h[a]>=h[b]:
        ans[b] = 0
    if h[b]>=h[a]:
        ans[a] = 0
print(sum(ans))
Problem p02760 (python)

Fixed submission:
#!/usr/bin/env python3
a = []
ans = 1
for i in range(3):
    a.append(list(map(int, input().split())))
n = int(input())
b = [int(input()) for i in range(n)]
for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            a[i][j] = -1
for k in range(3):
    if a[k] == [-1, -1, -1] or (a[0][k] == a[1][k] == a[2][k] == -1):
        ans = 0
if a[0][0] == a[1][1] == a[2][2] == -1:
    ans = 0
elif a[0][2] == a[1][1] == a[2][0] == -1:
    ans = 0
print('YNeos'[ans::2])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
a = []
for i in range(3):
    a += list(map(int, input().split()))
n = int(input())
b = [int(input()) for i in range(n)]
for i in range(9):
    if a[i] in b:
        a[i] = -1
for j in range(3):
    if (a[j] == -1 and a[j+1] == -1 and a[j+2] == -1) or (a[3*j] == -1 and a[3*(j+1)] == -1 and a[3*(j+2)] == -1):
        print('Yes')
        quit()
if (a[0] == -1 and a[4] == -1 and a[8] == -1) or (a[2] == -1 and a[4] == -1 and a[6] == -1):
    print('Yes')
else:
    print('No')
Problem p02923 (python)

Fixed submission:
#!/usr/bin/env python3
n = int(input())
h = list(map(int, input().split()))
streak = 0
history = []
for i in range(n-1):
    if h[i] >= h[i+1]:
        streak += 1
    else:
        history.append(streak)
        streak = 0
history.append(streak)
print(max(history))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
n = int(input())
h = list(map(int, input().split()))
streak = 0
history = []
if n == 1:
    print(0)
else:
    for i in range(n-1):
        if h[i] >= h[i+1]:
            streak += 1
        else:
            history.append(streak)
            streak = 0
    print(max(max(history), streak))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
n = int(input())
h = list(map(int, input().split()))
streak = 0
history = []
for i in range(n-1):
    if h[i] >= h[i+1]:
        streak += 1
    else:
        history.append(streak)
        streak = 0
print(max(max(history), streak))
Problem p03146 (python)

Fixed submission:
#!/usr/bin/env python3
def collatz(number):
    if number % 2 == 0:
        return number // 2  # 整数の商
    else:  # elseで良い
        return 3 * number + 1  # // intは不要では？


number = int(input())
if number == 1:
    print(4)
    quit()
a = [number]
while True:
    number = collatz(number)
    a += [number]

    if number == 1:
        break
if 4 in a:
    print(a.index(4)+4)
elif 2 in a:
    print(a.index(2)+4)
else:
    print(a.index(1)+4)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
def collatz(number):
    if number % 2 == 0:
        return number // 2  # 整数の商
    else:  # elseで良い
        return 3 * number + 1  # // intは不要では？


number = int(input())
a = [number]
while True:
    number = collatz(number)
    a += [number]

    if number == 1:
        break
print(a.index(4)+4)
Problem p03211 (python)

Fixed submission:
n = input()
a = []
for i in range(len(n)-2):
    a += [abs(int(n[i:i+3])-753)]
print(min(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(len(str(n))-2):
    a += [abs(n[i:i+3]-753)]
print(min(a))
Problem p02606 (python)

Fixed submission:
N, M ,L = map(int, input().split())
print(M//L-(N-1)//L)

Buggy submission (verdict: Runtime Error):
N, M ,L = map(int, input().split())
print((M//L-(N-1)//L)
Problem p02607 (python)

Fixed submission:
N=int(input())
A = list(map(int, input().split()))
c=0
for i in range(0,len(A),2):
  if A[i]%2==1:
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
A = list(map(int, input().split()))
c=0
for i in range(0,len(A),2):
  if A[i]%2=1:
    c+=1
print(c)
Problem p02742 (python)

Fixed submission:
N, M = map(int, input().split())
K=N*M
if N==1 or M==1:
  print(1)
elif K%2==1:
  print(K//2+1)
else:
  print(K//2)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
K=N*M
if N==1orM==1:
  print(1)
elif K%2==1:
  print(K//2+1)
else:
  print(K//2)
Problem p02658 (python)

Fixed submission:
n= int(input())
a=list(map(int,input().split()))
ans = 1
if not 0 in a:
  for i in range(n):
    ans*=a[i]
    if ans>1e+18:
      print(-1)
      break     
  if ans<=1e+18:
    print(ans)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n= int(input())
a=list(map(int,input().split()))
ans = 1
if not 0 in a:
  for i in range(n):
    ans*=a[i]
    if ans>1e+18:
      print(-1)
      break     
  if ans<=1e+18:
    print(ans)
eles:
  print(0)
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
if a%2==b%2:
  print((int)((a+b)/2))
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().splot())
if a%2==b%2:
  print((int)((a+b)/2))
else:
  print("IMPOSSIBLE")
Problem p03043 (python)

Fixed submission:
from math import log
from math import ceil
n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
  a=ceil(k/i)
  x=ceil(log(a,2))
  ans+=0.5**x
print(ans/n)

Buggy submission (verdict: Runtime Error):
from math import log
from math import ceil
n,k=map(int,input().split())
ans=0
for i in range(n):
  a=ceil(k/i)
  x=ceil(log(a,2))
  ans+=0.5**x
print(ans/n)

Buggy submission (verdict: Runtime Error):
from math import log
from math import ceil
while(1):
    ans=0
    n,k=map(int,input().split())
    for i in range(1,n+1):
        a=ceil(k/i)
        x=ceil(log(a,2))
        ans+=0.5**x
    print(ans/n)
Problem p03049 (python)

Fixed submission:
n=int(input())
a=0
b=0
ab=0
ba=0
bet=0
for i in range(n):
  s=input()
  ab+=s.count('AB')
  if s[len(s)-1]=='A' and s[0]!='B':
    a+=1
  if s[0]=='B' and s[-1]!='A':
    b+=1
  if s[-1]=='A' and s[0]=='B':
    ba+=1
if a!=0 and b!=0:
  bet+=ba+1
  bet+=min(a-1,b-1)
elif a==0 and b==0:
  if ba>0:
    bet+=ba-1
else:
  bet+=ba
print(ab+bet)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=0
b=0
ab=0
ba=0
for i in range(n):
  s=input()
  ab+=s.count('AB')
  if s[len(s)-1]=='A':
    a+=1
  if s[0]=='B':
    b+=1
  if s[len(s)-1]=='A' and s[0]=='B':
    ba+=1
if ba*2==a+b+1 or ba*2==a+b:
  print(ans+ba-1)
else:
  print(ab+min(a,b))
Problem p03062 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
count=0
flag=1
num=10*9+1
for i in range(n):
  if a[i]<0:
    count+=1
    a[i]*=-1
  elif a[i]==0:
    flag=0
if count%2==0 or flag==0:
  print(sum(a))
else:
  print(sum(a)-2*min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
count=0
flag=1
num=10*9+1
for i in range(n):
  if a[i]<0:
    count+=1
    a[i]*=-1
  elif a[i]==0:
    flag=0
  if num>a[i]:
    num=a[i]
if count%2==0 or flag=0:
  print(sum(a))
else:
  print(sum(a)-2*num)
Problem p03067 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a<c<b or b<c<a:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
k=int(input())
key=s[k-1]
ans=""
for i in range(len(s)):
  if s[i]==key:
    ans+=key
  else:
    ans+="*"
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a<c<b or c<b<a:
print("Yes")
else:
print("No")
Problem p03068 (python)

Fixed submission:
n=int(input())
s=input()
k=int(input())
key=s[k-1]
ans=""
for i in range(len(s)):
  if s[i]==key:
    ans+=key
  else:
    ans+="*"
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
k=int(input())
key=s[k]
ans=""
for i in range(len(s)):
  if s[i]==key:
    ans+=key
  else:
    ans+="*"
print(ans)
Problem p03087 (python)

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

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
ac=[0]*n
for i in range(0,len(s)):
  if s[i]=='A' and s[i+1]=='C':
    ac[i]=1
for i in range(q):
  l,r=map(int,input().split())
  ans=0
  for j in range(l-1,r-1):
    ans+=ac[j]
  print(ans)
Problem p03095 (python)

Fixed submission:
n=int(input())
S=input()
a='abcdefghijklmnopqrstuvwxyz'
ans=1
for i in range(26):
  cnt=S.count(a[i])
  ans=ans*(cnt+1)
ans-=1
ans=ans%(10**9+7)
print(int(ans))

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
S=input()
c=collections.Counter(S)
C=len(c)
ans=2**C*1.5**(n-C)
ans-=1
ans%=(10**9+7)
print(int(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
S=input()
a='abcdefghijklmnopqrstuvwxyz'
ans=1
for i in range(26):
  cnt=S.count(a[i])
  if cnt >0:
    ans=ans*(1.5**(cnt-1))*2
ans-=1
ans=ans%(10**9+7)
print(int(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
S=input()
a='abcdefghijklmnopqrstuvwxyz'
ans=1
for i in range(26):
  cnt=S.count(a[i])
  if cnt >0:
    ans=ans*(1.5**(cnt-1))*2
ans=ans%(10**9+7)
ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
S=input()
a='abcdefghijklmnopqrstuvwxyz'
ans=1
for i in range(26):
  cnt=S.count(a[i])
  if cnt >0:
    ans=ans*(1.5**(cnt-1))*2
  ans=ans%(10^9+7)
ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
S=input()
a='abcdefghijklmnopqrstuvwxyz'
ans=1
for i in range(26):
  cnt=S.count(a[i])
  if cnt >0:
    ans=ans*(1.5**(cnt-1))*2
    ans=ans%(10^9+7)
ans-=1
print(int(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
S=input()
a='abcdefghijklmnopqrstuvwxyz'
ans=1
for i in range(26):
  cnt=S.count(a[i])
  if cnt >0:
    ans=ans*(1.5**(cnt-1))*2
ans-=1
ans=ans%(10^9+7)
print(int(ans))
Problem p03101 (python)

Fixed submission:
H,W=map(int,input().split())
h,w=map(int,input().split())
math=H*W
black=h*W+H*w-h*w
white=math-black
print(white)

Buggy submission (verdict: Runtime Error):
H,W=map(int,input(),split())
h,w=map(int,input().split())
math=H*W
black=h*w+H*w-h*w
white=math-black
print(white)

Buggy submission (verdict: Runtime Error):
H,W=map(int,inout(),split())
h,w=map(int,inout().split())
all=H*W
black=h*w+H*w-h*w
white=all-black
purint(white)
Problem p03103 (python)

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(n):
  a.append(list(map(int,input().split())))
a.sort()  
i=0
cost=0
while m>0:
  if a[i][1]<m:
    cost+=a[i][0]*a[i][1]
    m-=a[i][1]
    i+=1
  else:
    cost+=a[i][0]*m
    break
print(cost)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(n):
  a.append(list(map(int,input().split())))
a.sort()  
i=0
cost=0
while m>0:
  if a[i][1]<m:
    cost+=a[i][0]*a[i][1]
    M-=a[i][1]
    i+=1
  else:
    cost+=a[i][0]*m
    print(cost)
    break
Problem p03106 (python)

Fixed submission:
a,b,c=(map(int,input().split()))
gcd = 0
d = min(a,b)
for i in range(d,0,-1):
  if a%i==0 and b%i==0:
    gcd +=1
    if gcd ==c:
      print(i)

Buggy submission (verdict: Runtime Error):
a,b,c=(map(int,input().split()))
gcd = 0
d = max[a,b]
for i in range(1,d+1):
  if a%i==0:
    if b%i==0:
      gcd+=1
      if gcd ==c:
        print(i)

Buggy submission (verdict: Runtime Error):
a,b,c=(map(int,input()))
A =[]
B =[]
C =[]
for i in range(1,a+1):
  if a%i==0:
    A = i
for i in range(1,b+1):
  if b%i==0:
    B =i
for i in A:
  for j in B:
    if A[i]=B[j]:
      C = A[i]
print(C[c])
Problem p03110 (python)

Fixed submission:
N = int(input())
money =0
for i in range(N):
  a,b = input().split()
  if b == 'JPY':
    money += int(a)
  else:
    money += float(a)*380000.0
print(money)

Buggy submission (verdict: Runtime Error):
N = int(input())
money =0
for i in range(N):
  a,b = input().split()
  if b == 'JPY':
    money += int(a)
  else:
    money += int(a)*380000.0
print(money)

Buggy submission (verdict: Runtime Error):
N = int(input())
money =0
for i in range(N):
  a,b = input.split()
  if b == 'JPY':
    money += int(a)
  else:
    money += int(a)*380000.0
print(money)
Problem p03151 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
diff = [a[i]-b[i] for i in range(n)]
if sum(diff) < 0:
  print(-1)
else:
  diff.sort()
  count = 0
  ans = 0
  for i in diff:
    if i<0:
      count += i
      ans += 1
    else:
      break
  for i in diff[::-1]:
    if count>=0:
      break
    else:
      count += i
      ans += 1
  print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
diff = [a[i]-b[i] for i in range(n)]
if sum(diff) < 0:
  print(-1)
else:
  diff.sort()
  count = 0
  ans = 0
  for i in diff:
    if i<0:
      count += i
      ans += 1
    else:
      break
  for i in diff[::-1]:
    if count>=0:
      break
    else:
      count += i
      ans += 1
print(ans)
Problem p03206 (python)

Fixed submission:
day=int(input())
s='Christmas'
eve=25-day
for i in range(eve):
  s=s+' Eve'
print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=[int(input()) for i in range(n)]
h.sort()
ans=[]
for i in range(n+1-k):
  ans.append(h[i+k-1]-h[i])
print(min(ans))
Problem p03240 (python)

Fixed submission:
from sys import exit
n=int(input())
pyramid=[]
for i in range(n):
  x,y,h=map(int,input().split())
  pyramid.append([x,y,h])
flag=0
for i in range(n):
  if flag==0 and pyramid[i][2]!=0:
    flag=-1
  elif flag==-1 and pyramid[i][2]!=0:
    flag=1
if flag==-1:
  for i in range(n):
    if pyramid[i][2]!=0:
      print(pyramid[i][0],pyramid[i][1],pyramid[i][2])
      exit()
ans=[[0 for i in range(101)] for i in range(101)]
for i in range(n):
  if pyramid[i][2]!=0:
    for cx in range(101):
      for cy in range(101):
        H=pyramid[i][2]+abs(pyramid[i][0]-cx)+abs(pyramid[i][1]-cy)
        if flag==1:
          ans[cx][cy]=H
        else:
          if ans[cx][cy]!=H:
            ans[cx][cy]=0
    flag=0
for i in range(101):
  for j in range(101):
    if ans[i][j]!=0:
      print(i,j,ans[i][j])

Buggy submission (verdict: Runtime Error):
pyramid=[]
if n==1:
  x,y,h=map(int,input().split())
  print(x,y,h)
  return
else:
  x,y,h=map(int,input().split())
  pyramid.append([x,y,h])
ans=[[0 for i in range(101)] for i in range(101)]
flag=1
for i in range(n):
  if pyramid[i][2]!=0:
    for cx in range(101):
      for cy in range(101):
        H=pyramid[i][2]+abs(pyramid[i][0]-cx)+abs(pyramid[i][1]-cy)
        if flag==1:
          ans[cx][cy]=H
        else:
          if ans[cx][cy]!=H:
            ans[cx][cy]=0
  flag=0
for i in range(101):
  for j in range(101):
    if ans[i][j]!=0:
      print(i,j,ans[i][j])

Buggy submission (verdict: Runtime Error):

pyramid=[]
if n==1:
  x,y,h=map(int,input().split())
  print(x,y,h)
else:
  x,y,h=map(int,input().split())
  pyramid.append([x,y,h])
ans=[[0 for i in range(101)] for i in range(101)]
flag=1
for i in range(n):
  if pyramid[i][2]!=0:
    for cx in range(101):
      for cy in range(101):
        H=pyramid[i][2]+abs(pyramid[i][0]-cx)+abs(pyramid[i][1]-cy)
        if flag==1:
          ans[cx][cy]=H
        else:
          if ans[cx][cy]!=H:
            ans[cx][cy]=0
  flag=0
for i in range(101):
  for j in range(101):
    if ans[i][j]!=0:
      print(i,j,ans[i][j])
Problem p03260 (python)

Fixed submission:
a,b,=map(int,input().split())
if a%2!=0 and b%2!=0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[]

for i in range(h):
  x=list(map(int,input().split()))
  a.append(x)
ans=[]
times=0
for i in range(h):
  for j in range(w-1):
    if a[i][j]%2!=0:
      a[i][j]-=1
      a[i][j+1]+=1
      ans.append([i+1,j+1,i+1,j+2])
      times+=1
for i in range(h-1):
  if a[i][w-1]%2!=0:
    a[i][w-1]-=1
    a[i+1][w-1]+=1
    ans.append([i+1,w,i+2,w])
    times+=1
print(times)
for i in range(len(ans)):
  print(ans[i])
Problem p03261 (python)

Fixed submission:
from sys import exit
n=int(input())
s=input()
w=[]
w.append(s)
for i in range(n-1):
  s=input()
  if w[i][-1]!=s[0] or s in w:
    print('No')
    exit()
  else:
    w.append(s)
print('Yes')

Buggy submission (verdict: Runtime Error):
from sys import exit
n=int(input())
s=input()
w=[]
w.append(s)
for i in range(n-1):
  s=input()
  if w[i][-1]!=a[0] or s in w:
    print('No')
    exit()
  else:
    w.append(s)
print('Yes')
Problem p02945 (python)

Fixed submission:
l= [int(x) for x in input().split()]
p=[]
p.append(l[0]-l[1])
p.append(l[0]+l[1])
p.append(l[0]*l[1])
print(max(p))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
l=[]
l.append(a+b)
l.append(a-b)
l.append(a*b)
print(max(l))