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

Fixed submission:
from bisect import bisect_left
 
ALPHABET = "abcdefghijklmnopqrstuvwxyz"
 
 
def main(s, t):
    positions = {char: [] for char in ALPHABET}
    for i, char in enumerate(s):
        positions[char].append(i)
 
    current = 0
    answer = 0
    for char in t:
        pos_num = len(positions[char])
        if pos_num < 1:
            return -1
        idx = bisect_left(positions[char], current)
        if idx < pos_num:
            current = positions[char][idx] + 1
        else:
            answer += len(s)
            idx = bisect_left(positions[char], 0)
            current = positions[char][idx] + 1
 
    answer += current
    return answer
 
 
s = input()
t = input()
print(main(s, t))

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
c = 0
pre = 0
rep = 0
dict = {word:[] for word in 'abcdefghijklmnopqrstuvwxyz'}
for i, w in enumerate(s):
    dict[w].append(i+1)
for n in t:
    if len(dict[n]) < 1:
        c = -1
        break
    if pre > dict[n][0]:
        rep += 1
    pre = dict[n][0]
    if len(dict[n]) > 1:
        num = dict[n].pop(0)
        dict[n].append(num)
    print('pre: {}'.format(pre))
    print('rep: {}'.format(rep))
    print('dict[n]: {}'.format(dict[n]))

if c == -1:
    print(-1)
else:
    print(len(s) * rep + dict[t[-1]][-1])

Buggy submission (verdict: Runtime Error):
Copy
Copy
from bisect import bisect_left
 
ALPHABET = "abcdefghijklmnopqrstuvwxyz"
 
 
def main(s, t):
    positions = {char: [] for char in ALPHABET}
    for i, char in enumerate(s):
        positions[char].append(i)
 
    current = 0
    answer = 0
    for char in t:
        pos_num = len(positions[char])
        if pos_num < 1:
            return -1
        idx = bisect_left(positions[char], current)
        if idx < pos_num:
            current = positions[char][idx] + 1
        else:
            answer += len(s)
            idx = bisect_left(positions[char], 0)
            current = positions[char][idx] + 1
 
    answer += current
    return answer
 
 
s = input()
t = input()
print(main(s, t))

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
c = 0
pre = 0
rep = 0
dict = {}
for i, w in enumerate(s):
    if not w in dict.keys():
        dict[w] = []
    dict[w].append(i+1)
for n in t:
    if len(dict[n]) < 1:
        c = -1
        break
    if pre > dict[n][0]:
        rep += 1
    pre = dict[n][0]
    if len(dict[n]) > 1:
        num = dict[n].pop(0)
        dict[n].append(num)
if c == -1:
    print(-1)
else:
    print(len(s) * rep + max(dict[t[-1]]))

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
alphabet = 'abcdefghijklmnopqrstuvwxyz'
pre = 0
rep = 0
dict = {word:[] for word in alphabet}
for i, w in enumerate(s):
    dict[w].append(i+1)
for n in t:
    if len(dict[n]) < 1:
        print(-1)
        break
    if pre > dict[n][0]:
        rep += 1
    pre = dict[n][0]
    if len(dict[n]) > 1:
        num = dict[n].pop(0)
        dict[n].append(num)
print(len(s) * rep + max(dict[t[-1]]))
Problem p03160 (python)

Fixed submission:
n = int(input())
h_list = list(map(int, input().split()))
if n == 1:
    print(h_list[0])
elif n == 2:
    print(abs(h_list[1]-h_list[0]))
else:
    dp1 = 0
    dp2 = abs(h_list[1]-h_list[0])
    dp3 = 0
    for i in range(2, n):
        if abs(h_list[i]-h_list[i-1]) + dp2 >= abs(h_list[i]-h_list[i-2]) + dp1:
            dp3 = abs(h_list[i]-h_list[i-2]) + dp1
        else:
            dp3 = abs(h_list[i]-h_list[i-1]) + dp2
        dp1 = dp2
        dp2 = dp3
    print(dp2)

Buggy submission (verdict: Runtime Error):
dp1, dp2, dp3 = 0, abs(h_list[1]-h_list[0]), 0
for i in range(2, n):
    if abs(h_list[i]-h_list[i-1]) + dp2 >= abs(h_list[i]-h_list[i-2]) + dp1:
        dp3 = abs(h_list[i]-h_list[i-2]) + dp1
    else:
        dp3 = abs(h_list[i]-h_list[i-1]) + dp2
    dp1 = dp2
    dp2 = dp3
print(dp2)
Problem p03161 (python)

Fixed submission:
n, k = map(int, input().split())
h_list = list(map(int, input().split()))
costs = [0] * n
costs[1] = abs(h_list[0] - h_list[1])
start = 0
for i in range(2, n):
    tmp = []
    v = h_list[i]
    start = max(0, i-k)
    costs[i] = min(abs(v - h_j) + c for h_j, c in zip(h_list[start:i], costs[start:i]))
    # for l in range(start, i):
    #     tmp.append(abs(v - h_list[l])+costs[l])
    #     if abs(v - h_list[l]) == 0:
    #         break
    # costs[i] = min(tmp)
print(costs[-1])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h_list = list(map(int, input().split()))
costs = [0] * n
costs[1] = abs(h_list[0] - h_list[1])
start = 0
for i in range(2, n):
    tmp = []
    v = h_list[i]
    start = max(0, i-k)
    costs[i] = min(abs(v - h_j) + c for h_j, c in zip(h_list[j:i], costs[j:i]))
    # for l in range(start, i):
    #     tmp.append(abs(v - h_list[l])+costs[l])
    #     if abs(v - h_list[l]) == 0:
    #         break
    # costs[i] = min(tmp)
print(costs[-1])
Problem p02613 (python)

Fixed submission:
from collections import defaultdict as dc
d=dc(lambda:0)
st=['AC','WA','TLE','RE']
for n in range(int(input())):
    s=input()
    d[s]+=1
for n in st:
	print(n,'x',d[n])

Buggy submission (verdict: Runtime Error):
from collections import defaultdict as dc
d=dc(lambda:0)
st=['AC'.'WA','TLE','RE']
for n in range(int(input())):
	s=input()
    d[s]+=1
    
for n in st:
	print(n,'x',d[n])
Problem p02791 (python)

Fixed submission:
def readinput():
    n=int(input())
    p=list(map(int,input().split()))
    return n,p

def main(n,p):
    count=0
    pmin=p[0]
    for i in range(n):
        pmin=min(p[i],pmin)
        if pmin>=p[i]:
            count+=1
    return count

if __name__=='__main__':
    n,p=readinput()
    ans=main(n,p)
    print(ans)

Buggy submission (verdict: Runtime Error):
ln=10
bit=[0]*ln

def up(id):
    while id<ln:
        bit[id]+=1
        id+=id&(-id)
def qr(id):
    res=0
    while id:
        res+=bit[id]
        id-=id&(-id)
    return res

res=0

x=int(input())
s=list(map(int,input().split()))

st=sorted(list(set(s)),reverse=True)
dc={}
id=1
for n in st:
    dc[n]=id
    id+=1


for n in range(x):
    up(dc[s[n]])
    p=qr(dc[s[n]])
    #print(p)
    res+=int(p!=0)
    

print(res)
Problem p03101 (python)

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

Buggy submission (verdict: Runtime Error):
H, W = mat(int, input().split())
h, w = mat(int, input().split())
print((H-h)*(W-w))
Problem p03196 (python)

Fixed submission:
def primeFactor(n):
    res = {}
    i = 2
    while i*i <= n:
        while n % i == 0:
            key = str(i)
            res.update({key : 1+int(res.get(key,0))})
            n=n//i
        i=i+1    
    if n!=1:
        key = str(n)
        res.update({key : 1+int(res.get(key,0))})
    return res

N, P = map(int, input().split())
max = 1
for divisor, count in primeFactor(P).items():
    while count >= N:
        max *= int(divisor)
        count -= N
print(max)

Buggy submission (verdict: Runtime Error):
def primeFactor(n):
    res = {}
    i = 2
    while i*i <= n:
        while n % i == 0:
            key = str(i)
            res.update({key : 1+int(res.get(key,0))})
            n=n/i
        i=i+1    
    if n!=1:
        key = str(n)
        res.update({key : 1+int(res.get(key,0))})
    return res

N, P = map(int, input().split())
max = 1
for divisor, count in primeFactor(P).items():
    while count >= N:
        max *= int(divisor)
        count -= N
print(max)
Problem p03284 (python)

Fixed submission:
N, K=map(int, input().split())
print(0 if N%K==0 else 1);

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())
for i4 in range(N):
  for i7 in range(N):
    if i4 * 4 + i7 * 7 == N:
      print("Yes")
      sys.exit(0)
print("No")
Problem p03555 (python)

Fixed submission:
import sys
s=input()
t=input()
for c in range(3):
    if s[c]!=t[2-c]:
        print("NO")
        sys.exit(0)
print("YES");

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
for c in range(3):
    if s[c]!=t[2-c]:
        print("NO")
        sys.exit(0)
print("YES");

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
for c in range(3):
    if s[c]!=t[2-c]:
        print("NO")
        sys.exit()
print("YES");
Problem p02582 (python)

Fixed submission:
S = list(input())
count = 0
ans = 0
for w in S:
    if w == 'R':
        count += 1
        
    else:
        count = 0
    if count > ans:
        ans = count
print(ans)

Buggy submission (verdict: Runtime Error):
S = list(input())
count = 0
for w in S:
    if w == 'R':
        count += 1
    else:
        ans = count
        count = 0
print(ans) if count < ans else print(count)
Problem p02788 (python)

Fixed submission:
from collections import deque
N, D, A = list(map(int, input().split()))
pair_xh = [[-1, -1] for _ in range(N)] # 1回ずつしか使わないけどソートするから必要
for i in range(N):
    pair_xh[i][0], pair_xh[i][1] = list(map(int, input().split()))
pair_xh.sort(key = lambda x: x[0]) #座標でソート

q_lim_d = deque() # 累積和に含まれる攻撃範囲とダメージを保存する場所
total = 0 # 喰らいダメージの累積和
count = 0 # 攻撃回数
for i in range(N):
    x = pair_xh[i][0]
    h = pair_xh[i][1]
    
    while len(q_lim_d) and q_lim_d[-1][0] < x: # 範囲外になったら喰らわないから累積和から外す
        total -= q_lim_d[-1][1]
        q_lim_d.pop()
    h -= total
    if h > 0: # 見てる敵の体力が0になる攻撃回数を求めその分を累積和に足す
        times = (h + A - 1) // A # 0にするのに必要な回数(切り上げ)
        count += times
        damage = A * times
        total += damage
        q_lim_d.appendleft([x + 2 * D, damage])
print(count)

Buggy submission (verdict: Runtime Error):
from collections import deque
N, D, A = list(map(int, input().split()))
D *= 2
pair_xh = [[-1, -1] for _ in range(N)]
for i in range(N):
    pair_xh[i][0], pair_xh[i][1] = list(map(int, input().split()))

q_lim_d = deque() # 累積和に含まれる攻撃範囲とダメージを保存する場所
total = 0 # 喰らいダメージの累積和
count = 0 # 攻撃回数
for i in range(N):
    x = pair_xh[i][0]
    h = pair_xh[i][1]
    
    while len(q_lim_d) and q_lim_d[0][0] < x: # 範囲外になったら喰らわないから累積和から外す
        total -= q[0][1]
        q_lim_d.pop()
    h -= total
    
    if h > 0: # 見てる敵の体力が0になる攻撃回数を求めその分を累積和に足す
        times = int((h + A - 1) / A) # 0にするのに必要な回数(切り上げ)
        count += times
        damage = A * times
        total += damage
        q_lim_d.append([x+D, damage])
print(count)
Problem p02608 (python)

Fixed submission:
from itertools import combinations_with_replacement
n=int(input())
ans=[0]*100000
list1=list(combinations_with_replacement(list(range(1,100)), 3))
for i in range(len(list1)):
    x=list1[i][0]
    y=list1[i][1]
    z=list1[i][2]
    if len(list(set(list1[i])))==1:
        ans[(x*x)+(y*y)+(z*z)+(x*y)+(y*z)+(x*z)-1]+=1
    elif len(list(set(list1[i])))==2:
        ans[(x*x)+(y*y)+(z*z)+(x*y)+(y*z)+(x*z)-1]+=3
    else:
        ans[(x*x)+(y*y)+(z*z)+(x*y)+(y*z)+(x*z)-1]+=6
for i in range(n):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
from itertools import combinations_with_replacement
n=int(input())
ans=[0]*1000
list1=list(combinations_with_replacement([1,2,3,4,5,6,7,8,9,10], 3))
for i in range(len(list1)):
    x=list1[i][0]
    y=list1[i][1]
    z=list1[i][2]
    if len(list(set(list1[i])))==1:
        ans[(x*x)+(y*y)+(z*z)+(x*y)+(y*z)+(x*z)-1]+=1
    elif len(list(set(list1[i])))==2:
        ans[(x*x)+(y*y)+(z*z)+(x*y)+(y*z)+(x*z)-1]+=3
    else:
        ans[(x*x)+(y*y)+(z*z)+(x*y)+(y*z)+(x*z)-1]+=6
for i in range(n):
    print(ans[i])
Problem p02646 (python)

Fixed submission:
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
flag=0
ky=abs(a-b)
if b==a:
    flag=1
elif w>=v:
    pass
elif abs((b-a)/(v-w))<=t:
    flag=1
if flag==1:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
flag=0
if b==a:
    flag=1
elif (v-w)<0:
    pass
elif a>b:
    pass
elif abs((b-a)/(v-w))<=t:
    flag=1
if flag==1:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
flag=0
if v<=w:
    if (a>=b):
        if (a-b)/(w-v)<=t:
            flag=1
elif (a==b):
    flag=1
elif (b-a)<0:
    pass
elif t==0:
    pass
elif (b-a)/(v-w)<=t:
    flag=1
if flag==1:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
flag=0
if v<=w:
    if (a>=b):
        if (a-b)/(w-v)<=t:
            flag=1
if (a==b):
    flag=1
elif (b-a)/(v-w)<=t:
    flag=1
if flag==1:
    print('YES')
else:
    print('NO')
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=1
a=list(map(int,input().split()))
for i in range(n):
    ans*=a[i]
    if 0 in a:
        ans=0
        break
    if n>70:
        ans=-1
        break
    if ans>1000000000000000000:
        ans=-1
        break
print(ans)
Problem p02658 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=1
a=list(map(int,input().split()))
m=n-a.count(1)
b=sorted(a)
c=list(set(b))
if (1 in b)and(len(c)>1):
    if c[1]==1: 
        del b[:b.index(c[2])-1]
    else:
        del b[:b.index(c[1])-1]
for i in range(n):
    ans*=b[i]
    if 0 in a:
        ans=0
        break
    if m>68:
        ans=-1
        break
    if ans>1000000000000000000:
        ans=-1
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=1
a=list(map(int,input().split()))
m=n-a.count(1)
b=sorted(a)
if 1 in b: 
    del b[:b.index(2)-1]
for i in range(n):
    ans*=b[i]
    if 0 in a:
        ans=0
        break
    if m>68:
        ans=-1
        break
    if ans>1000000000000000000:
        ans=-1
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=1
a=list(map(int,input().split()))
m=n-a.count(1)
b=sorted(a)
del b[:a.index(2)-1]
for i in range(n):
    ans*=b[i]
    if 0 in a:
        ans=0
        break
    if m>68:
        ans=-1
        break
    if ans>1000000000000000000:
        ans=-1
        break
print(ans)
Problem p02664 (python)

Fixed submission:
t=list(input())
if t[-1]=='?':
    t[-1]='D'
indexes = [i for i, x in enumerate(t) if x == '?']
for i in range(len(indexes)-1,0,-1):
    a=indexes[i]
    if t[a-1]=='P':
        t[a]='D'
    else:
        if t[a+1]=='D':
            t[a]='P'
        else:
            t[a]='D'
if '?'in t:
    a=t.index('?')
    if t[a-1]=='P':
        t[a]='D'
    else:
        if t[a+1]=='D':
            t[a]='P'
        else:
            t[a]='D'   
print(''.join(t))

Buggy submission (verdict: Runtime Error):
t=list(input())
if t[-1]=='?':
    t[-1]='D'
indexes = [i for i, x in enumerate(t) if x == '?']
for i in range(len(indexes)-1,0,-1):
    a=indexes[i]
    if t[a-1]=='P':
        t[a]='D'
    else:
        if t[a+1]=='D':
            t[a]='P'
        else:
            t[a]='D'
a=t.index('?')
if t[a-1]=='P':
    t[a]='D'
else:
    if t[a+1]=='D':
        t[a]='P'
    else:
        t[a]='D'   
print(''.join(t))
Problem p02696 (python)

Fixed submission:

import math
 
def f(A, B, X):
	return math.floor((A*X)/B) - A*math.floor(X/B)
 
A,B,N = map(int,input().split())
 
if N < B:
	print(f(A,B,N))
else:
	print(f(A,B,B-1))

Buggy submission (verdict: Runtime Error):
import sys
a,b,c=map(float,input().split())/100
a=int(a*100)
ans=[0]*b
if c>b-2:
    for i in range(int(b*100)):
        d=(0.01*i+0.01)*b-0.01
        ans[i]=int((a*d)/b)-a*(int(d/b))
        if c<d:
            break
else :
    for i in range(int(c*100)):
        ans[i]=int((a*(i+1))/b*100)-a*(int((i+1)/b*100))
print(max(ans))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
ans=[0]*b
if c>b-2:
    for i in range(b):
        d=(i+1)*b-1
        ans[i]=int((a*d)/b)-a*(int(d/b))
        if c<d:
            break
else :
    for i in range(c):
        ans[i]=int((a*i)/b)-a*(int(i/b))
print(max(ans))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
ans=[0]*b
if c>b-2:
    for i in range(b):
        d=(i+1)*b-1
        ans[i]=int((a*d)/b)-d*(int(d/b))
        if c<d:
            break
else :
    ans[0]=int((a*c)/b)-b*(int(c/b))
print(max(ans))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
ans=[0]*b
if c>b-2:
    for i in range(b):
        d=(i+1)*b-1
        ans[i]=int((a*d)/b)-d*(int(d/b))
        print(ans[i])
        if c<=d:
            break
        if i==1000000:
            break
else :
    ans[0]=int((a*c)/b)-b*(int(c/b))
print(max(ans))
Problem p02786 (python)

Fixed submission:
import math
n=int(input())
n=int(math.log2(n))
ans=2**(n+1)
print(ans-1)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
n=int(math.log2(n))
ans=2**(n+1)
print(ans-1)
Problem p03001 (python)

Fixed submission:
w,h,x,y=map(int,input().split())
ans1=(w*h)/2.0
ans2=0
if (w/2==x)and(h/2==y):
    ans2=1
print('%f %d'%(ans1,ans2))

Buggy submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
ans1=(w*h)/2.0
ans=0
if (w/2==x)and(h/2==y):
    ans2=1
print('%f %d'%(ans1,ans2))

Buggy submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
ans1=(w*h)/2
ans=0
if (w/2==x)and(h/2==y):
    ans2=1
print('%f %d'%(ans1,ans2))
Problem p03712 (python)

Fixed submission:
h,w=map(int,input().split())
list1=[[0 for i in range(w)]for j in range(h)]
for i in range(h):
    list1[i]=list(map(str,input().split()))
print('#'*(w+2))
for i in range(h):
    print('#'+str(''.join(list1[i]))+'#')
print('#'*(w+2))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
list1=[[0 for i in range(h)] for j in range(w)]
for i in range(h):
    list1[i]=list(map(str,input().split()))
print('#'*(w+2))
for i in range(h):
    print('#'+str(''.join(list1[i]))+'#')
print('#'*(w+2))
Problem p03760 (python)

Fixed submission:
a=input()
b=input()
cnt=0
passw=''
if (len(a)-len(b))==1:
  while 1:
      passw=passw+a[cnt]+b[cnt]
      cnt=cnt+1
      if (cnt+1)>len(b):
        passw=passw+a[cnt]
        break
else:
  while 1:
      passw=passw+a[cnt]+b[cnt]
      cnt=cnt+1
      if (cnt+1)>len(b):
        break
print(passw)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
cnt=0
passw=''
if (len(a)-len(b))==1:
  while 1:
      passw=passw+a[cnt]+b[cnt]
      cnt=cnt+1
      if (cnt+1)>len(b):
        passw=passw+a[cnt+1]
        break
else:
  while 1:
      passw=passw+a[cnt]+b[cnt]
      cnt=cnt+1
      if (cnt+1)>len(b):
        break
print(passw)
Problem p02988 (python)

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

c = 0
for i in range(1, n-1):
  if sorted([ns[i-1], ns[i], ns[i+1]])[1] == ns[i]:
    c += 1
    
print(c)

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

c = 0
for i in range(1, n):
  if sorted([n[i-1], n[i], n[i+1]])[2] == n[i]:
    c += 1
    
print(c)
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, raw_input().split())
print(X + Y/2)

Buggy submission (verdict: Runtime Error):
X, Y = input().split()
print(X + Y/2)
Problem p03220 (python)

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

Ts = list(map(lambda x: T-x * 0.006, Hs))

i = 0
v = None
for _i, _T in enumerate(Ts):
    if v is None or abs(_T-A) < v:
        v = abs(_T-A)
        i = _i

print(i+1)

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

Ts = list(map(lambda x: T-x * 0.006), Hs)

i = 0
v = 0
for _i, _T in enumerate(Ts):
    if abs(_T-T) < v:
        v = abs(_T-T)
        i = _i

print(i+1)

Buggy submission (verdict: Runtime Error):
N = int(raw_inpit())
T, A = map(int, raw_input().split())
Hs = list(map(int, raw_input().split()))

Ts = list(map(lambda x: T-x * 0.006), Hs)

i = 0
v = 0
for _i, _T in enumerate(Ts):
    if abs(_T-T) < v:
        v = abs(_T-T)
        i = _i

print(i+1)

Buggy submission (verdict: Runtime Error):
N = int(raw_inpit())
T, A = map(int, raw_input().split())
Hs = list(map(int, raw_input().split()))

Ts = list(map(lambda x: T-x * 0.006), Hs)

i = 0
v = 0
for _i, _T in enumerate(Ts):
    if abs(_T-T) < v:
        v = abs(_T-T)
        i = _i

print(i)
Problem p03455 (python)

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

Buggy submission (verdict: Runtime Error):
print('Even' if a * b % 2 == 0 else 'Odd')
Problem p03469 (python)

Fixed submission:
a = [c for c in input()]
a[3] = '8'
print(''.join(a))

Buggy submission (verdict: Runtime Error):
a = input()
a[3] = '8'
print(a)
Problem p03501 (python)

Fixed submission:
N, A, B = map(int, input().split())
print(min([A * N, B]))

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
print(min([A * T, B]))
Problem p03543 (python)

Fixed submission:
s = input()
print('Yes' if len(set(s[:3])) == 1 or len(set(s[1:])) == 1 else 'No')

Buggy submission (verdict: Runtime Error):
s = [c for c in input()]
print('Yes' if len(set(s[:3])) == 1 or len(set[1:]) == 1 else 'No')

Buggy submission (verdict: Runtime Error):
s = input()
print('Yes' if len(set(s[:3])) == 1 or len(set[1:]) == 1 else 'No')
Problem p03547 (python)

Fixed submission:
x, y = input().split()
if x < y: print('<')
if x == y: print('=')
if x > y: print('>')

Buggy submission (verdict: Runtime Error):
x, y = input(), input()
if x < y: print('<')
if x == y: print('=')
if x > y: print('>')
Problem p03609 (python)

Fixed submission:
x, y = map(int, input().split())
print(max([x - y, 0]))

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
print(max([x - y, 0])
Problem p03711 (python)

Fixed submission:
groups = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
gg = lambda t: [i for i in range(0, 3) if t in groups[i]][0]
x, y = map(int, input().split())
print('Yes' if gg(x) == gg(y) else 'No')

Buggy submission (verdict: Runtime Error):
groups = [[1, 3, 5, 7, 8, 12], [4, 6, 9, 11], [2]]
gg = lambda t: [i for i in range(0, 3) if t in groups[i]][0]
x, y = map(int, input().split())
print('Yes' if gg(x) == gg(y) else 'No')
Problem p02783 (python)

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

print(h//a + int(h%a!=0))

Buggy submission (verdict: Runtime Error):
h, a = map(int, input())

print(h // a + int(h%a != 0))

Buggy submission (verdict: Runtime Error):
h, a = map(int, input())

print(h//a + int(h%a!=0))

Buggy submission (verdict: Runtime Error):
h, a = map(int, input())

print(h//a + int(h%a!=0))
Problem p02612 (python)

Fixed submission:
import math
N = int(input())
S = 0
ans = 0
for i in range(1000, 10001, 1000):
    if i - N == 0:
        ans = 0
        break
    if i - N > 0:
        ans = i - N
        break
        # ans = min(ans, i - N)
        
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N = input()
S = 0
S = int(N[-3]) * 100
if S == 0:
    print(S)
else:
    print(1000 - S)
Problem p02641 (python)

Fixed submission:
X,N = map(int,input().split())
P = list(map(int,input().split()))
m = {}
for i in range(102):
    if i in P:
        continue
    ab = abs(i - X)
    m[i] = ab
# min_kv_list = [kv for kv in m.items() if kv[1] == min(m.values())]
min_k_list = [kv[0] for kv in m.items() if kv[1] == min(m.values())]
print(min(min_k_list))

Buggy submission (verdict: Runtime Error):
X,N = map(int,input().split())
P = list(map(int,input().split()))
m = {}
for i in range(1, 101):
    if i in P:
        continue
    ab = abs(i - X)
    m[i] = ab
min_k_list = [kv[0] for kv in m.items() if kv[1] == min(m.values())]
print(min(min_k_list))