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

Fixed submission:
x, y = map(int, input().split(" "))

#print(x, y)
leg_turtle = 4
leg_clane = 2

if y > x * leg_turtle:
    print("No")
    exit()
elif y < leg_clane * x:
    print("No")
    exit()


for i in range(x + 1):
    clane = i
    turtle = x - i
    #print(clane, turtle)

    legs = 2 * clane + 4 * turtle

    if legs == y:
        print("Yes")
        exit()
    else:
        continue
print("No")

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split(" "))

#print(x, y)
leg_turtle = 4
leg_clane = 2

if y > x * leg_turtle:
    print("No")
    exit()
elif y < leg_clane * x:
    print("No")
    exit()


import pulp

#線形計画の定義
problem = pulp.LpProblem('clane_turtle', pulp.LpMaximize)

#変数の定義
clane = pulp.LpVariable('clane', 0, 100, 'Integer') 
turtle = pulp.LpVariable('turtle', 0, 100, 'Integer') 

#目的関数の定義
problem += 2 * clane + 4 * turtle

#制約条件の定義
problem += clane + turtle == x
problem += 2 * clane + 4 * turtle <= y

#解く
status = problem.solve()
#print(pulp.LpStatus[status])
c = clane.value()
t = turtle.value()
res_1 =  2 * c + 4 * t
res_2 = c + t
#print(c, t)
if res_1 == y and res_2 == x:
    print("Yes")
else:
    print("No")
Problem p02657 (python)

Fixed submission:
nums = input().split()

A = int(nums[0])
B = int(nums[1])

val = A * B

print(val)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

A = int(a)
B = int(b)

val = A * B

print(val)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

print(a * b)
Problem p02720 (python)

Fixed submission:
k=int(input())
if k<=9:
    print(k)
    exit()
a=[1,2,3,4,5,6,7,8,9]
cnt=9
while True:
    q=[]
    for i in a:
       for j in range(10):
            if abs(int(str(i)[-1])-j)<=1:
                cnt+=1
                if cnt==k:
                    print(int(str(i)+str(j)))
                    exit()
                q.append(int(str(i)+str(j)))         
    a=list(sorted(set(q)))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
d=Counter(a)
import math
def cmb(n,r):
    f = math.factorial
    return int(f(n) // f(r) // f(n-r))
def combination(n, r):
    a = 1
    b = 1
    for i in range(r):
        a *= (n - i)
        b *= (i + 1)
    return a // b
e={}
dd=0
for i,j in d.items():
    dd+=combination(j, 2)
    e[i]=combination(j-1, 1)

for i in a:
    print(dd-e[i])
Problem p02756 (python)

Fixed submission:
s=input()
q=int(input())
from collections import deque
qq=deque(s)
cnt=0
for i in range(q):
    j=input()
    if j=="1":
        cnt+=1
        continue
    _,k,l=j.split()
    if (k=="2")^cnt%2:
        qq.append(l)
    else:
        qq.appendleft(l)

if cnt%2==1:
    print("".join(reversed(list(qq))))
else:
    print("".join(qq))

Buggy submission (verdict: Runtime Error):
s=input()
q=int(input())
from collections import deque
qq=deque(s)
cnt=0
for i in range(q):
    j=input()
    if j=="1":
        cnt+=1
        continue
    _,k,l=j.split()
    if (k=="2")^cnt%2:
        qq.append(l)
    else:
        qq.appendleft(l)

if cnt%2==1:
    print("".join(revesed(list(qq))))
else:
    print("".join(qq))
Problem p02803 (python)

Fixed submission:
h,w=map(int,input().split())
s=[input() for _ in range(h)]
from collections import deque
ans=0
dd=[(1,0),(-1,0),(0,1),(0,-1)]
for i in range(h):
  for j in range(w):
    if  s[i][j]=="#":
          continue
    
    g=[[0]*w for _ in range(h)]
    v=[[0]*w for _ in range(h)]
    g[i][j]=1
    q=deque([(j,i)])
    while q:
      x,y=q.popleft()
      for dx,dy in dd:
        nx=x+dx
        ny=y+dy
        if not 0<=nx<w:
          continue
        if not 0<=ny<h:
          continue
        if g[ny][nx]:
          continue
        if s[ny][nx]=="#":
          continue
        g[ny][nx]=1
        v[ny][nx]=v[y][x]+1
        q.append((nx,ny))
    for ii in v:
      ans=max(ans,max(ii))

print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
q=[(1+pp)/2 for pp in p]
ans=0
c=[0]
for qq in q:
      c.append(c[-1]+qq)
ans=0

for qq in range(k,1+n):
  ans=max(ans,c[qq]-c[qq-k])

print(ans)
Problem p02804 (python)

Fixed submission:
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
mod=10**9+7
ans=0
MOD=10**9+7

factorial = [1]
inverse = [1]
for i in range(1, n+2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))
 
 
# 組み合わせ計算
def nCr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % MOD
for i in range(n-k+1):
    ans-=a[i]*nCr(n-i-1,k-1)%mod
    ans%=mod
a=a[::-1]
for i in range(n-k+1):
    ans+=a[i]*nCr(n-i-1,k-1)%mod
    ans%=mod

print(ans%mod)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
mod=10**9+7
ans=0
MOD=10**9+7

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

a = cmb(n, r)
for i in range(n-k+1):
    ans-=a[i]*cmb(n-i-1,k-1)%mod
    ans%=mod
a=a[::-1]
for i in range(n-k+1):
    ans+=a[i]*cmb(n-i-1,k-1)%mod
    ans%=mod

print(ans%mod)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
MOD = 10 ** 9 + 7
 
ans = 0
# 各Aiについて、それが最小値になるような選び方が何通りあるかを求めながら計算
for i in range(N - K + 1):
    ans -= A[i] * nCr(N - i - 1, K - 1) % MOD
    ans %= MOD
 
# 各Aiについて、それが最小値になるような選び方が何通りあるかを求めながら計算
A = A[::-1]  # 大きい順に並び替え！
for i in range(N - K + 1):
    ans += A[i] * nCr(N - i - 1, K - 1) % MOD
    ans %= MOD
 
print(ans % MOD)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
mod=10**9+7
ans=0
MOD=10**9+7
def comb(n, k):
    ret = 1
    for i in range(1, k + 1):
        ret = ret * (n - i + 1) % MOD        
        ret = ret * pow(i, MOD - 2, MOD) % MOD
        
    return ret
for i in range(n-k+1):
    ans-=a[i]*cmb(n-i-1,k-1)
    ans%=mod
a=a[::-1]
for i in range(n-k+1):
    ans+=a[i]*cmb(n-i-1,k-1)
    ans%=mod

print(ans%mod)
Problem p02850 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
N = int(input())
AB = [tuple(map(int,input().split())) for i in range(N-1)]
es = [[] for i in range(N)]
for i,(a,b) in enumerate(AB):
    a,b = a-1,b-1
    es[a].append((b,i))
    es[b].append((a,i))
ans=[0]*(N-1)
g=[0]*N
def dfs(v,h=-1):
  res=1
  for i,j in es[v]:
      if g[i]:
            continue
      g[v]=1
      if h==res:
            res+=1
      ans[j]=res
      dfs(i,res)
      res+=1

dfs(0)
print(max(ans))
for i in ans:
      print(i)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**8)
N = int(input())
n=int(input())
c=[[] for _ in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  a-=1
  b-=1
  c[a].append((b,i))
  c[b].append((a,i))

ans=[0]*(n-1)
g=[0]*n
def dfs(v,h=-1):
  res=1
  for i,j in c[v]:
      if g[i]:
            continue
      g[v]=1
      if h==res:
            res+=1
      ans[j]=res
      dfs(i,res)
      res+=1

dfs(0)
print(max(ans))
for i in ans:
      print(i)

Buggy submission (verdict: Runtime Error):
n=int(input())
c=[[] for _ in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  a-=1
  b-=1
  c[a].append((b,i))
  c[b].append((a,i))

ans=[0]*(n-1)
g=[0]*n
def dfs(v,h=-1):
  res=1
  for i,j in c[v]:
      if g[i]:
            continue
      g[v]=1
      if h==res:
            res+=1
      ans[j]=res
      dfs(i,res)
      res+=1

dfs(0)
print(max(ans))
for i in ans:
      print(i)
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n,q=map(int,input().split())
c=[[] for _ in range(n)]
for _ in range(n-1):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  c[a].append(b)
  c[b].append(a)
px=[0]*n
for I in range(q):
    p,x=map(int,input().split())
    px[p-1]+=x 
ans=[0]*n
def dfs(g,h=-1):
  ans[g]=ans[h]+px[g]
  for i in c[g]:
    if i==h:continue
    dfs(i,g)
dfs(0)
print(*ans)

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
c=[[] for _ in range(n)]
for _ in range(n-1):
  a,b=map(int,input().split())
  a-=1
  b-=1
  c[a].append(b)
  c[b].append(a)
px=[0]*n
for I in range(q):
    p,x=map(int,input().split())
    px[p-1]+=x 
ans=[0]*n
def dfs(g,h=-1):
  ans[g]=ans[h]+px[g]
  for i in c[g]:
    if i==h:
      continue
    dfs(i,g)
dfs(0)
print(*ans)
Problem p02995 (python)

Fixed submission:
from fractions import gcd
A,B,C,D = map(int,input().split())
def f(n):
    x = n//C
    y = n//D
    z = n//(C*D//gcd(C,D))
    return n - x - y + z

print(f(B) - f(A-1))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
def k(n):
    aa=n//c
    bb=n//d
    f=n//((c*d)//math.gcd(c,d))
    return n-aa-bb+f
print(k(b)-k(a-1))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
def k(n):
    aa=n//c
    bb=n//d
    f=n//((c*d)//math.gcd(c,d))
    return n-aa-bb+f
print(k(b)-k(a-1))

Buggy submission (verdict: Runtime Error):
from  math import gcd
import math
a,b,c,d=map(int,input().split())
def k(n):
    aa=n//c
    bb=n//d
    f=n//((c*d)//math.gcd(c,d))
    return n-aa-bb+f
print(k(b)-k(a-1))
Problem p03061 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
l=[0]
r=[0]
ans=0
from  fractions import gcd
for i in range(n-1):
    l.append(gcd(l[i],a[i]))
    r.append(gcd(r[i],a[-1-i]))
for i in range(n):
    ans=max(ans,gcd(l[i],r[-1-i]))

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
l=[0]
r=[0]
ans=0
from  math import gcd
for i in range(n-1):
    l.append(gcd(l[i],a[i]))
    r.append(gcd(r[i],a[-1-i]))
for i in range(n):
    ans=max(ans,gcd(l[i],r[-1-i]))

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
l=[0]
r=[0]
ans=0
from  math import gcd
for i in range(n-1):
    l.append(gcd(l[i],a[i]))
    r.append(gcd(r[i],a[-1]-i))
for i in range(n):
    ans=max(ans,gcd(l[i],r[-1-i]))

print(ans)
Problem p03244 (python)

Fixed submission:
from collections import Counter
    
n = int(input())
v = list(map(int, input().split()))

a = Counter(v[0::2]).most_common()
b = Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])
if a[0][0] != b[0][0]:
    print(n - (a[0][1] + b[0][1]))
else:
    print(min(n-(a[1][1]+b[0][1]), n-(a[0][1]+b[1][1])))

Buggy submission (verdict: Runtime Error):
n=int(input())
from collections import Counter
v=list(map(int,input().split()))
from collections import Counter
a=Counter(v[0::2]).most_common()
b=Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])
if a[0][0]!=b[0][0]:
    print(n-(a[0][1]+b[0][1]))
else:
    print(min(n-(b[0][1]+a[1][1],n-(a[0][1]+b[1][1])))

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
from collections import Counter
a=Counter(v[0::2]).most_common()
b=Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])
if a[0][0]!=b[0][0]:
    print(n-(a[0][1]+b[0][1]))
else:
    print(min(n-(b[0][1]+a[1][1],n-(a[0][1]+b[1][1])))
Problem p03340 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
j=0
b=0
for  i in range(n):
    while j<n and b^a[j]==b+a[j]:
        b^=a[j]
        j+=1
    ans+=j-i    
    b^=a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=0
j=0
b=0
for  i in range(n):
    while j<n and b^a[j]==b+a[jl:
        b^=a[j]
        j+=1
    ans+=j-i    
    b^=a[i]
print(ans)
Problem p03380 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[10**10]
a.sort(reverse=True)
c=a[0]
e=c//2
for i in range(1,n):
    b.append(abs(a[i]-e))
d=a[b.index(min(b))]
print(c,d)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
m=a[-1]
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
d={}
for i in range(n-1):
    d[i]=cmb(m,a[i])
print(a[-1],a[max(d,key=d.get)])
Problem p03496 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
print(2*n-1)
if abs(max(a))>=abs(min(a)):
    b=a.index(max(a))
    for i in range(n):
        print(b+1,i+1)
    for j in range(n-1):
        print(j+1,j+2)
    
else:
    b=a.index(min(a))
    for i in range(n):
        print(b+1,i+1)
    for j in range(n-1,0,-1):
        print(j+1,j)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
print(2*n-1)
if abs(max(a))>=abs(min(a)):
     b=a.index(max(a))
    for i in range(n):
        print(b+1,i)
    for j in range(n-1):
        print(j+1,j+2)
    
else:
    b=a.index(min(a))
    for i in range(n):
        print(b+1,i+1)
    for j in range(n-1,0,-1):
        print(j+1,j)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
print(2*n-1)
if abs(a)>max(a):
    b=a.index(min(a))
    for i in range(n):
        print(b+1,i+1)
    for j in range(n-1,0,-1):
        print(j+1,j)
else:
    b=a.index(max(a))
    for i in range(n):
        print(b+1,i)
    for j in range(n-1):
        print(j+1,j+2)
Problem p03599 (python)

Fixed submission:
a,b,c,d,e,f = map(int,input().split())
w = set()
for x in range(0,f+1,100*a):
    for y in range(0,f+1-x,100*b):
        w.add(x+y)
s = set()
for x in range(0,f+1,c):
    for y in range(0,f+1-x,d):
        s.add(x+y)
ans = -1
sugerwater = 0
suger = 0
for x in w:
    for y in s:
        if  0<x+y<=f and y <= x*e/100:
            if ans < y/(x+y):
                ans = y/(x+y)
                sugerwater = x+y
                suger = y
print(sugerwater,suger)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
q=set()
ans=0
p=set()
for i in range(0,f+1,100*a):
    for j in range(0,f+1-i,100*b):
        q.add(i+j)
for i in range(0,f+1,c):
    for j in range(0,f+1-i,d):
        p.add(i+j)
for pp in p:
    for qq in q:
        if 0<pp+qq and qq<=pp*e/100:
            if ans<qq/(pp+qq):
                ans=qq/(pp+qq)
                s=pp+qq
                ss=pp

print(s,ss)
Problem p03608 (python)

Fixed submission:
from itertools import permutations
from scipy.sparse.csgraph import floyd_warshall

n,m,R=map(int,input().split())
r=list(map(int,input().split()))
s=[[0]*n for i in range(n)]
for i in range(m):
    a, b, c = list(map(int, input().split()))
    a, b = a-1, b-1
    s[a][b] = c
    s[b][a] = c
s=floyd_warshall(s)   

ans=float('inf')
for i in permutations(r):
    an=0
    for j in range(R-1):
        an+=s[i[j]-1][i[j+1]-1]
    ans=min(ans,an)
print(int(ans))

Buggy submission (verdict: Runtime Error):
from itertools import permutations
from scipy.sparse.csgraph import floyd_warshall

n,m,R=map(int,input().split())
r=list(map(int,input().split()))
s=[[0]*n for i in range(n)]
for i in range(m):
    a, b, c = list(map(int, input().split()))
    a, b = a-1, b-1
    s[a][b] = c
    s[b][a] = c
s=floyd_warshall(s)   

ans=float('inf')
for i in permutations(r):
    an=0
    for j in range(R-1):
        an+=s[i[j]-1][i[j+1]-1]
    ans=min(ans,an)
print(int(ans))
Problem p03633 (python)

Fixed submission:
n=int(input())
a=[int(input()) for _ in range(n)]
ans=a[0]
from fractions import gcd
for i in range(1, n):
    ans = ans * a[i] // gcd(ans, a[i])
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for _ in range(n)]
ans=a[0]
import math
for i in range(1, n):
    ans = ans * a[i] // math.gcd(ans, a[i])
print(ans)
Problem p03673 (python)

Fixed submission:
n = int(input())
a = input().split()
b = []
for i in range(n - 1, -1, -2):
  b.extend([a[i]])
for j in range(n % 2, n, 2):
  b.extend([a[j]])
print(" ".join(b))

Buggy submission (verdict: Runtime Error):
from collections import deque
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

que = deque()
for i in range(N):
    if i % 2 == 0:
        que.append(A[i])
    else:
        que.appendleft(A[i])
if N % 2:
    que.reverse()
print(*que)

Buggy submission (verdict: Runtime Error):
from collections import deque
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

que = deque()
for i in range(N):
    if i % 2 == 0:
        que.append(A[i])
    else:
        que.appendleft(A[i])
if N % 2:
    que.reverse()
print(*que)
Problem p03681 (python)

Fixed submission:
import math

n,m=map(int,input().split())
a=math.factorial(n) * math.factorial(m) 
if abs(n-m) == 0:
    a *= 2
elif abs(n-m) > 1:
    a = 0
print(a%1000000007)

Buggy submission (verdict: Runtime Error):
import math

n,m=map(int,input().split())
mod=10**9+7
a=math.factorial(n)*math.factorial(m)
if abs(n-m)==0:
    print(2*a%mod)
    exit()
elif abs(n-m)>1:
    a=0
print(a％mod)
Problem p03740 (python)

Fixed submission:
x, y = map(int, input().split())
 
if abs(x - y) <= 1:print('Brown')
else:
  print('Alice')

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
 
    if abs(x - y) <= 1:
        print('Brown')
    else:
        print('Alice')
Problem p03999 (python)

Fixed submission:
s=input()
n=len(s)
n-=1
ans=0
for i in range(1<<n):
    tmp=0
    for j in range(n):
        if (i>>j)&1:
            ans+=int(s[tmp:j+1])
            tmp=j+1
    ans+=int(s[tmp:])
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
d=[]
n=len(s)
ans=0
for i in range(1<<n):
    tmp=0
    for j in range(n):
        if (i>>j)&1:
            ans+=int(s[tmp:j+1])
            tmp=j+1
    ans+=int(s[tmp:])

print(ans)
Problem p02639 (python)

Fixed submission:
a,b,c,d,e = map(int,input(). split ())
x = [a,b,c,d,e]
for i in x:
    if i * 1 == 0:
        print(x.index(i) + 1)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e = map(int,input(). split ())
for i in 5:
    if i * 1 == 0:
        print(i)
Problem p02801 (python)

Fixed submission:
print(chr(ord(input())+1))

Buggy submission (verdict: Runtime Error):
N,K,M=map(int,input().split())
l = input().split()
L = [int(i) for i in l]

Lsum=sum(L)

if M*N-Lsum>K:
    print(-1)
elif M*N-Lsum<0:
    print(0)
else:
    print(M*N-Lsum)
Problem p03471 (python)

Fixed submission:
N,yen=map(int,input().split())
count=0
end=0
man=0
gosen=0
sen=0
# print(N)
# print(yen)

for i in range(N+1):
    if end==1:
        break
    for j in range(N-i+1):
        # print(i)
        # print(j)
        k=N-i-j
        # print(k)
        sum=i*10000+j*5000+k*1000
        # print(sum)
        if sum==yen:
            man=i
            gosen=j
            sen=k
            end=1
            break

if man==0 and gosen==0 and sen==0:
    print("-1 -1 -1")
else:
    print(str(man)+" "+str(gosen)+" "+str(sen))

Buggy submission (verdict: Runtime Error):
N,yen=map(int,input().split())
count=0
end=0
# print(N)
# print(yen)

for i in range(N):
    if end==1:
        break
    for j in range(N-i+1):
        # print(i)
        # print(j)
        k=N-i-j
        # print(k)
        sum=i*10000+j*5000+k*1000
        # print(sum)
        if sum==yen:
            man=i
            gosen=j
            sen=k
            end=1
            break


print(str(man)+" "+str(gosen)+" "+str(sen))
Problem p03632 (python)

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

if min(b,d)-max(a,c)>=0:
    print(min(b,d)-max(a,c))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
if b<=c:
    print(0)
elif d<=a:
    print(0)
elif c>=a and d<=b:
    print(d-c)
elif c>=a and c<=b and d>=b:
    print(b-c)
elif a>=c and a<=d and d<=b:
    print(d-a)
elif a>=c and b<=d:
    print(b-a)
else:
    print(err)
Problem p02639 (python)

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

for num in range(len(a)):
    if a[num]==0:
        print(num+1)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
x,n=map(int,input().split())
if n!=0:
    a=list(map(int,input().split()))
else:
    a=[0]*3
number=[0]*101

for num in range(len(a)):
    number[a[num]]=a[num]
    
counter=0
plus=0
ans=0

while counter==0:
    if number[x-plus]==0:
        counter+=1
        ans=x-plus
    elif number[x+plus]==0:
        counter+=1
        ans=x+plus
    else:
        plus+=1
        if plus>x or plus>(100-x):
            counter+=1
            ans=0

print(ans)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())

if y%2==0 and y/x<=4 and y/x>=2:
    print("Yes")
else:
    print("No")
Problem p02639 (python)

Fixed submission:
a = input().split(" ")
temp = 0
for i, ai in enumerate(a):
    if int(ai)==0:
        temp=i
        break
 
print(temp+1)

Buggy submission (verdict: Runtime Error):
a = input().split(" ")
cnt=0
for i, ai in enumerate(a):
  if ai==0
  return i+1

Buggy submission (verdict: Runtime Error):
a = input().aplit(" ")
cnt=0
for i, ai in enumerate(a):
  if ai==0
  return i+1

Buggy submission (verdict: Runtime Error):
a = int(input()).aplit(" ")
cnt=0
for i, ai in enumerate(a):
  if ai==0
  return i+1
Problem p02681 (python)

Fixed submission:
s = input()
t = input()

if s == t[:-1]:
    print('Yes')
else:
    print('No')

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

if int(n[-1]) in [2,4,5,7,9]:
    print('hon')
elif int(n[-1]) in [0,1,6,8]:
    print('pon')
else:
    print('bon')
Problem p03494 (python)

Fixed submission:
import numpy as np
n = int(input())
count = 0
val_list = np.array(list(map(int, input().split())))

while True:
    # 偶数の数算出
    even_cnt = len(list(filter(lambda x:x % 2 == 0, val_list)))
    
    # 配列の値の偶数判定
    if n == even_cnt:
        # 配列の割り算
        val_list = val_list/2
        # 上記繰り返しの回数保存
        count += 1
    else:
        break
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
val = map(int, input().split())
count = 0
val_list = np.array(list(map(int, val.split())))

while True:
    # 偶数の数算出
    even_cnt = len(list(filter(lambda x:x % 2 == 0, val_list)))
    
    # 配列の値の偶数判定
    if n == even_cnt:
        # 配列の割り算
        val_list = val_list/2
        # 上記繰り返しの回数保存
        count += 1
    else:
        break
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
val = map(int, input().split())
count = 0
val_list = np.array(list(map(int, val.split())))

while True:
    # 偶数の数算出
    even_cnt = len(list(filter(lambda x:x % 2 == 0, val_list)))
    
    # 配列の値の偶数判定
    if n == even_cnt:
        # 配列の割り算
        val_list = val_list/2
        # 上記繰り返しの回数保存
        count += 1
    else:
        break
print(count)
Problem p02639 (python)

Fixed submission:
n = input().split()
for i, j in enumerate(n):
  if j == '0':
    print(i+1)
    break

Buggy submission (verdict: Runtime Error):
n = input().spilt()
for i, j in range(n):
  if j == '0':
    print(i+1)
    exit()
Problem p03495 (python)

Fixed submission:
N, K = map(int, input().split())
B = [0]*(N+1)
for i in input().split():
  B[int(i)] += 1
print(sum(sorted(B)[:-K]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
B = [0]*N
for i in input().split():
  B[int(i)] += 1
print(sum(sorted(B)[:-K]))
Problem p03992 (python)

Fixed submission:
a = input()
a = u'{0}'.format(a)
print('{0} {1}'.format(a[:4],a[4:]))

Buggy submission (verdict: Runtime Error):
s = input()
print('{0] {1}'.format(s[:4],s[4:]))