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

Fixed submission:
N = int(input())
SP = []
for i in range(N):
  S,P = input().split()
  P = int(P)
  SP.append((S,-P,i+1))
SP.sort()
for a,b,c in SP:
  print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
SP = []
for i in range(N):
  S,P = input().split()
  P = int(P)
  SP.append(S,-P,i+1)
SP.sort()
for a,b,c in SP:
  print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
SP = []
for i in range(N):
  S,P = input().split()
  P = int(P)
  SP.append(S,P,i+1)
SP.sort()
for a,b,c in SP:
  print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
SP = []
for i in range(N):
  S,P = map(int,input().split())
  P = int(P)
  SP.append(S,P,i+1)
SP.sort()
for a,b,c in SP:
  print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
SP = [list(map(int,input().split()))for _ in range(N)]
SP.sort()
for i in SP.values():
  print(i)
Problem p03037 (python)

Fixed submission:
N,M = map(int,input().split())
L = []
R = []
ans = 0
for _ in range(M):
  l, r = map(int, input().split())
  L.append(l)
  R.append(r)
ans = max(0,min(R) - max(L) + 1)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
L = []
R = []
count = 0
for j in range(M):
  L,R = map(int,input().split())
for i in range(N+1):
  if i > max(L) and i < min(R):
    count += 1

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
L,R = list(map(int,input().split()))
count = 0
for i in range(N+1):
  if i > max(L) and i < min(R):
    count += 1

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
L,R = [list(map(int,input().split())) for _ in range(M)]
count = 0
for i in range(N+1):
  if i > max(L) and i < min(R):
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
L = list(map(int,input().split()))
R = list(map(int,input().split()))
ans = 0
if N >= min(R):
  ans = max(0,min(R) - min(L) + 1)
else:
  ans = max(0,N - min(L) + 1)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
L = [list(map(int,input().split())) for _ in range(M)]
R = [list(map(int,input().split())) for _ in range(M)]
L.sort()
R.sort()
count = 0
for i in range(1,N+1):
  if i >= L[-1] and i <= R[0]:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
L = list(map(int,input().split()))
R = list(map(int,input().split()))
L.sort()
R.sort()
count = 0
for i in range(1,N+1):
  if i >= L[-1] and i <= R[0]:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
L = list(map(int,input().split()))
R = list(map(int,input().split()))
L.sort()
R.sort()
count = 0
for i in range(N):
  if i >= L[0] and i <= R[0]:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
LR = [list(map(int,input().split())) for _ in range(N)]
count = 0
for i in range(N):
  for j,k in LR:
    if i >= j and i <= k:
      count += 1
print(count)
Problem p03043 (python)

Fixed submission:
N,K = map(int,input().split())
ans = 0
for i in range(1,N+1):
  j = 0
  point = i
  while point < K:
    point *= 2
    j += 1
  ans += (1/N)*(0.5**j)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
point = 0
for i in range(1,N+1):
  for j in range(N):
    if  i**j >= K:
      point += (1/N)*(1/2)**j
      i += 1
    else:
      j += 1
print(point)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
K = int(input())
win = [0]
win = np.array(win,dtype=np.float64)
for i in range(1,N+1):
  for j in range(N):
    if  i**j >= K:
      win[i] = (1/N)*(1/2)**j
      i += 1
    else:
      j += 1
ans = sum(win)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
K = int(input())
win = [0]
win = np.array(win)
point = 0
for i in range(1,N+1):
  for j in range(1,K):
    if  i**j >= K:
      win[i] = (1/N)*{(1/2)**j}
      i += 1
    else:
      j += 1
ans = sum(win)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
win = []
win[0] = 0
point = 0
for i in range(1,N+1):
  for j in range(1,K):
    if  i**j >= K:
      win[i] = (1/N)*{(1/2)**j}
      i += 1
    else:
      j += 1
ans = sum(win)
print(ans)
Problem p03048 (python)

Fixed submission:
R,G,B,N = map(int,input().split())
count = 0
 
for i in range(0,N+1,R):
    for j in range(0,N+1,G):
        sum = i + j
        if N - sum < 0:
            break
        elif (N - sum) % B == 0:
            count += 1
 
print(count)

Buggy submission (verdict: Runtime Error):
R,G,B = map(int,input().split())
N = int(input())
count = 0
for r in range(R):
  for g in range(G):
    for b in range(B):
      if r*R+g*G+b*B == N:
        count += 1
      else:
        r += 1
print(count)
Problem p03076 (python)

Fixed submission:
menu = [int(input()) for _ in range(5)]
last = 10**18
last_menu = 0
num = -1
for i in range(len(menu)):
  if menu[i]%10 != 0:
    last = min(last, menu[i]%10)
  if last == menu[i]%10:
    num = i
if num >= 0:
  last_menu = menu.pop(num)

time = 0
for j in range(len(menu)):
  if menu[j]%10 == 0:
    time += menu[j]
  else:
    time += menu[j] + (10 - menu[j]%10)
time += last_menu

print(time)

Buggy submission (verdict: Runtime Error):
menu = [int(input()) for _ in range(5)]
last = 10**18
last_menu = 0
for i in range(5):
  if menu[i]%10 != 0:
    last = min(last, menu[i]%10)
  if last == menu[i]%10:
    num = i
last_menu = menu.pop(num)

time = 0
for j in range(len(menu)):
  if menu[j]%10 == 0:
    time += menu[j]
  else:
    time += menu[j] + (10 - menu[j]%10)
time += last_menu

print(time)

Buggy submission (verdict: Runtime Error):
menu = [int(input()) for _ in range(5)]
last = 10**18
last_menu = 0
for i in range(5):
  if menu[i]%10 != 0:
    last = min(last, menu[i]%10)
  if last == menu[i]%10:
    num = i
last_menu = menu.pop(num)

time = 0
for j in range(4):
  if menu[j]%10 == 0:
    time += menu[j]
  else:
    time += menu[j] + (10 - menu[j]%10)
time += last_menu

print(time)
Problem p03078 (python)

Fixed submission:
from heapq import *
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

A = sorted(A,reverse = True)
B = sorted(B,reverse = True)
C = sorted(C,reverse = True)

cake = []
heapify(cake)
for x in range(X):
  for y in range(min(Y,K//(x+1)+1)):
    for k in range(min(Z,K//((x+1)*(y+1))+1)):
      heappush(cake,-(A[x]+B[y]+C[k]))
for _ in range(K):
  print(abs(heappop(cake)))

Buggy submission (verdict: Runtime Error):
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

l = [0]*(X*Y*Z)
c = 0

from decimal import *

for x in range(X):
  for y in range(Y):
    for z in range(Z):
      l[c] = Decimal(A[x]+B[y]+C[z])
      c += 1

ans = sorted(l,reverse = True)

for k in range(K):
  print(ans[k])

Buggy submission (verdict: Runtime Error):
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

l = [0]*(X*Y*Z)
c = 0

for x in range(X):
  for y in range(Y):
    for z in range(Z):
      l[c] = A[x]+B[y]+C[z]
      c += 1

ans = sorted(l,reverse = True)

for k in range(K):
  print(ans[k])
Problem p03161 (python)

Fixed submission:
import numpy as np
N,K = map(int,input().split())
h = list(map(int,input().split()))
h = np.array(h)
dp = [0]*N
dp = np.array(dp)
dp[1]=abs(h[1]-h[0])
for i in range(1,N):
  j = max(0,i-K)
  dp[i] = min(dp[j:i]+abs(h[i]-h[j:i]))
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [0]*N
dp[0] = 0
dp[1]=abs(h[1]-h[0])
for i in range(2,N):
  dp[i] += min(dpj+abs(hj-h[i]) for dpj,hj in zip(dp[i-K:i],h[i-K:i]))
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [0]*N
dp[0] = 0
dp[1]=abs(h[1]-h[0])
for i in range(2,N):
  dp[i] += min(dpj+abs(hj-h[i]) for dpj,hj in zip(dp[i-K:i],h[i-K:i])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [0]*N
dp[0] = 0
dp[1]=abs(h[1]-h[0])
for i in range(2,N):
  dp[i] += min(dpj+abs(hj-h[i]) for dpj,hj in zip(dp[i-k:i],h[i-k:i])
print(dp[-1])
Problem p03229 (python)

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]

A.sort()
n = N//2
if N%2 != 0:
    ans1,ans2,ans = 0,0,0
    ar1,ar2 = A[:n],A[n+1:]
    ar = []
    for i in range(n):
        ar.append(ar2[i])
        ar.append(ar1[i])
    ar.append(A[n])
    for i in range(N-1):
        ans1 += abs(ar[i]-ar[i+1])
    ar = [A[n]]+ar[:-1]
    for i in range(N-1):
        ans2 += abs(ar[i]-ar[i+1])
    ans = max(ans1,ans2)
else:
    ans = 0
    ar1,ar2 = A[:n],A[n:]
    ar = []
    for i in range(n):
        ar.append(ar2[i])
        ar.append(ar1[i])
    for i in range(N-1):
        ans += abs(ar[i]-ar[i+1])
 
print(ans)

Buggy submission (verdict: Runtime Error):
A.sort()
n = N//2
if N%2 != 0:
    ans1,ans2,ans = 0,0,0
    ar1,ar2 = A[:n],A[n+1:]
    ar = []
    for i in range(n):
        ar.append(ar2[i])
        ar.append(ar1[i])
    ar.append(A[n])
    for i in range(N-1):
        ans1 += abs(ar[i]-ar[i+1])
    ar = [A[n]]+ar[:-1]
    for i in range(N-1):
        ans2 += abs(ar[i]-ar[i+1])
    ans = max(ans1,ans2)
else:
    ans = 0
    ar1,ar2 = A[:n],A[n:]
    ar = []
    for i in range(n):
        ar.append(ar2[i])
        ar.append(ar1[i])
    for i in range(N-1):
        ans += abs(ar[i]-ar[i+1])
 
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]

A.sort()
n = N//2
if N%2 != 0:
    ar1,ar2 = [],[]
    ans1,ans2 = 0,0

    for i in range(n):
        ar1.append(A[-1-i])
        ar1.append(A[i])
        
    for i in range(1,len(ar1)):
        ans1 += abs(ar1[i]-ar1[i-1])
    ans1 += max(abs(ar1[0]-A[n]), abs(ar1[-1]-A[n]))
    for i in range(n):
        ar2.append(A[-1-i])
        ar2.append(A[i])
        
    for i in range(1,len(ar1)):
        ans2 += abs(ar2[i]-ar2[i-1])
    ans2 += max(abs(ar2[0]-A[n]), abs(ar2[-1]-A[n]))
    ans = max(ans1,ans2)
else:
    ar = []
    ans = 0
    for i in range(n-1):
        ar.append(A[-1-i])
        ar.append(A[i])
    for i in range(1,len(ar)):
        ans += abs(ar[i]-ar[i-1])
    ans += max(abs(ar[0]-A[n])+abs(ar[-1]-A[n+1]), abs(ar[-1]-A[n])+abs(ar[0]-A[n+1]))
        
    
print(ans)
Problem p03231 (python)

Fixed submission:
import math
 
N,M = map(int,input().split())
S = list(str(input()))
T = list(str(input()))
g = math.gcd(N,M)
gn,gm = N//g,M//g
for i in range(g):
  if S[i*gn] != T[i*gm]:
    print(-1)
    exit()

print(gn*gm*g)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
 
N,M = map(int,input().split())
S = list(str(input()))
T = list(str(input()))
MOD = 10**9+7
L = lcm(N,M)
if L == max(N,M):
  L *= 2
X = [""]*(L%MOD)
if S[0] != T[0]:
  print(-1)
  exit()
else:
  X[0] = S[0]
 
for i in range(1,N):
  X[i*L//N] = S[i]
for j in range(1,M):
  if X[j*L//M] == "" or X[j*L//M] == T[j]:
    pass
  else:
    print(-1)
    exit()
 
print(L)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

N,M = map(int,input().split())
S = list(str(input()))
T = list(str(input()))

L = lcm(N,M)
if L == max(N,M):
  L *= 2
X = [""]*L
if S[0] != T[0]:
  print(-1)
  exit()
else:
  X[0] = S[0]

for i in range(1,N):
  X[i*L//N] = S[i]
for j in range(1,M):
  if X[j*L//M] == "" or X[j*L//M] == T[j]:
    pass
  else:
    print(-1)
    exit()

print(L)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

N,M = map(int,input().split())
S = str(input())
T = str(input())

L = lcm(N,M)
if L == max(N,M):
  L *= 2
X = [""]*(L+10**5)
if S[0] != T[0]:
  print(-1)
  exit()
else:
  X[0] = S[0]

for i in range(1,N):
  X[i*L//N] = S[i]
for j in range(1,M):
  if X[j*L//M] == "" or X[j*L//M] == T[j]:
    pass
  else:
    print(-1)
    exit()

print(L)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

N,M = map(int,input().split())
S = str(input())
T = str(input())

L = lcm(N,M)
if L == max(N,M):
  L *= 2
X = [""]*L
if S[0] != T[0]:
  print(-1)
  exit()
else:
  X[0] = S[0]

for i in range(1,N):
  X[i*L//N] = S[i]
for j in range(1,M):
  if X[j*L//M] == "" or X[j*L//M] == T[j]:
    pass
  else:
    print(-1)
    exit()

print(L)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

N,M = map(int,input().split())
S = str(input())
T = str(input())

L = lcm(N,M)
if L == max(N,M):
  L *= 2
X = [""]*L
if S[0] != T[0]:
  print(-1)
  exit()
else:
  X[0] = S[0]

for i in range(1,N):
  X[i*L//N] = S[i]
for j in range(1,M):
  if X[j*L//M] == "":
    X[j*L//M] = T[j]
  elif X[j*L//M] == T[j]:
    pass
  else:
    print(-1)
    exit()

print(L)
Problem p03246 (python)

Fixed submission:
from collections import Counter

N = int(input())
l = list(map(int,input().split()))

if len(set(l)) == 1:
  print(N//2)
else:
  l_odd,l_even = [],[]

  for i in range(N):
    if i%2 == 0:
      l_odd.append(l[i])
    else:
      l_even.append(l[i])

  C_odd = Counter(l_odd).most_common()
  C_even = Counter(l_even).most_common()

  if C_odd[0][0] != C_even[0][0]:
    ans = N - C_odd[0][1] - C_even[0][1]
  else:
    ans = min(N - C_odd[0][1] - C_even[1][1],N - C_odd[1][1] - C_even[0][1])

  print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
l = list(map(int,input().split()))

if len(set(l)) == 1:
  print(N//2)
else:
  l_odd,l_even = [],[]

  for i in range(N):
    if i%2 == 0:
      l_odd.append(l[i])
  else:
    l_even.append(l[i])

    C_odd = Counter(l_odd).most_common()
    C_even = Counter(l_even).most_common()

    if C_odd[0][0] != C_even[0][0]:
      ans = N - C_odd[0][1] - C_even[0][1]
    else:
      ans = min(N - C_odd[0][1] - C_even[1][1],N - C_odd[1][1] - C_even[0][1])

    print(ans)
Problem p03294 (python)

Fixed submission:
from fractions import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
a = list(map(int,input().split()))
m = lcm(*a) - 1
ans = 0
for i in range(N):
  ans += m%a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
a = list(map(int,input().split()))
m = lcm(*a) - 1
ans = 0
for i in range(N):
  ans += m%a[i]
print(ans)
Problem p03425 (python)

Fixed submission:
from itertools import *
N = int(input())
march = []
for _ in range(N):
  H =str(input())
  if H[0] == 'M' or H[0] == 'A' or H[0] == 'R' or H[0] == 'C' or H[0] == 'H':
    march.append(H[0])
march = ''.join(march)
m = march.count('M')
a = march.count('A')
r = march.count('R')
c = march.count('C')
h = march.count('H')
l = [m,a,r,c,h]
L = []
for i in range(len(l)):
  if l[i] > 0:
    L.append(l[i])
if len(L) < 3:
  print(0)
  exit()
else:
  ans = 0
  for l in combinations(L,3):
    a,b,c = l
    ans += (a*b*c)
    
print(ans)

Buggy submission (verdict: Runtime Error):
mod = 10**9 + 7
def cmb(n,r,mod):
	a=1
	b=1
	r = min(r,n-r)
	for i in range(r):
		a = a*(n-i)%mod
		b = b*(i+1)%mod
	return a*pow(b,mod-2,mod)%mod

N = int(input())
march = []
for _ in range(N):
  H =str(input())
  if H[0] == 'M' or H[0] == 'A' or H[0] == 'R' or H[0] == 'C' or H[0] == 'H':
    march.append(H[0])
march = ''.join(march)
m = march.count('M')
a = march.count('A')
r = march.count('R')
c = march.count('C')
h = march.count('H')
l = [m,a,r,c,h]
L = []
for i in range(len(l)):
  if l[i] > 0:
    L.append(l[i])
if L == []:
  print(0)
else:
  ans = cmb(len(L),3,mod)
  for i in range(len(L)):
    if L[i] > 1:
      ans = ans*L[i]-(len(L)-3)
print(ans)
Problem p03436 (python)

Fixed submission:
from collections import deque
H,W = map(int,input().split())
l = [str(input()) for _ in range(H)]
white_count = 0
for s in l:
  white_count += s.count('.')
sy = 0
sx = 0
gy = H-1
gx = W-1
visited = [[-1]*W for _ in range(H)]
visited[sy][sx] = 0
Q = deque([[sy,sx]])
while Q:
  y,x = Q.popleft()
  if [y,x] == [gy,gx]:
    print(white_count - visited[y][x] - 1)
    exit()
  for i,j in [(1,0),(0,1),(-1,0),(0,-1)]:
    if 0 <= x+j < W and 0 <= y+i < H and visited[y+i][x+j] == -1 and l[y+i][x+j] == '.':
      visited[y+i][x+j] = visited[y][x]+1
      Q.append([y+i,x+j])
    else:
      continue
print(-1)

Buggy submission (verdict: Runtime Error):
from collections import deque
H,W = map(int,input().split())
S = [list(input()) for _ in range(H)]
ans = 0

def bfs(y,x,m):
  g = [[None if S[i][j] == '.' else -1 for j in range(W)] for i in range(H)]
  g[y][x] = 0
  q = deque()
  q.append((y,x))
  while q:
    i,j = q.popleft()
    for di,dj in ((0,1),(1,0),(-1,0),(0,-1)):
      ni = i+di; nj = j+dj
      if 0 <= ni < H and 0 <= nj < W and g[ni][nj] is None:
        g[ni][nj] = g[i][j] + 1
        q.append((ni,nj))
  return max(max(r) for r in g)

for i in range(H):
  for j in range(W):
    if S[i][j] == '.':
      deq = bfs(i,j,S)
      if ans < deq:
        ans = deq
print(ans)
Problem p03437 (python)

Fixed submission:
X,Y = map(int,input().split())
X_ = X
while X_ <= 10**9:
  if X == Y:
    print(-1)
    exit()
  X_ += X
  if X%Y != 0:
    print(X)
    exit()

print(-1)

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

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

X,Y = map(int,input().split())
if lcm(X,Y)//X > 10**18 or X == Y:
  print(-1)
else:
  print(lcm(X,Y)//X)
Problem p03472 (python)

Fixed submission:
from bisect import bisect_left
N,H = map(int,input().split())
A = [0]*N
B = [0]*N

for i in range(N):
  a,b = map(int,input().split())
  A[i] = a
  B[i] = b

A = max(A)
B = sorted(B)

count,damage = 0,0
b = bisect_left(B,A)

for i in range(len(B)-1,b-1,-1):
  damage += B[i]
  count += 1
  if damage >= H:
    print(count)
    exit()

count,damage = 0,0
damage = sum(B[b:])
count += len(B[b:])
count += (H-damage)//A
damage = H - (H-damage)%A
if damage == H:
  pass
else:
  count += 1
print(count)

Buggy submission (verdict: Runtime Error):
from collections import deque
N,H = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
AB_a = sorted(AB, reverse = True, key=lambda x: x[0])
AB_b = deque(sorted(AB, reverse = True, key=lambda x: x[1]))
damage = 0
count = 0

while damage < H:
  if AB_b[0][1] > AB_a[0][0]:
    damage += AB_b[0][1]
    AB_b.popleft()
  else:
    damage += AB_a[0][0]
  count += 1
print(count)
Problem p03524 (python)

Fixed submission:
S = str(input())
V = [S.count('a'),S.count('b'),S.count('c')]
V.sort()
ans = 'YES'
if V[2]-V[0] > 1:
  ans = 'NO'

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
S = str(input())
CS = Counter(S)
V = list(CS.values())
ans = 'YES'

if V.count(0) == 2:
  ans = 'NO'
elif V.count(0) <= 1:
  if V[0] >= 2*V[1]:
    ans = 'NO'
else:
  if V[0] >= 2*V[1] and V[0] >= 6*V[2]:
    ans = 'NO'

print(ans)
Problem p03545 (python)

Fixed submission:
math = input()
for i in range(2**3):
  op = format(i,"03b")
  op = op.replace('1', '+').replace('0', '-')
  ans = math[0]+op[0]+math[1]+op[1]+math[2]+op[2]+math[3]
  if eval(ans) == 7:
    print(ans+"=7")
    break

Buggy submission (verdict: Runtime Error):
math = input()
for i in range(2**3):
  op = format(i,"03b")
  op = op.replace('1', '+').replace('0', '-')
  ans = math[0]+op[0]+math[1]+op[1]+math[2]+op[3]+math[3]
  if eval(ans) == 7:
    print(ans+"=7")
    break
Problem p03547 (python)

Fixed submission:
X,Y = map(str, input().split())
if X < Y:
  print("<")
elif X > Y:
  print(">")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
X,Y = map(int, input().split())
if X < Y:
  print("<")
elif X > Y:
  print(">")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
X,Y = map(int, input())
if X < Y:
  print("<")
else if X > Y:
  print(">")
else:
  print("=")
Problem p03548 (python)

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

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

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

Buggy submission (verdict: Runtime Error):
X,Y,Z= map(int, input().split())
print(max(X/(Z+Y)))
Problem p03644 (python)

Fixed submission:
N = int(input())
k = 0
while 1:
  if 2**k > N:
    break
  ans = 2**k
  k += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
k = 0
while k**2 > N:
  ans = k**2
  k += 1
print(ans)

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

while N % 2 == 0:
  N / 2
  count += 1
print(count)

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

while N % 2 == 0:
  N / 2
  count ++
print(count)
Problem p03645 (python)

Fixed submission:
N,M = map(int,input().split())
tmp = [0]*N

for _ in range(M):
  a,b = map(int,input().split())
  if a == 1:
    if tmp[b-1] == 1:
      print('POSSIBLE')
      exit()
    else:
      tmp[b-1] = 1
  elif b == N:
    if tmp[a-1] == 1:
      print('POSSIBLE')
      exit()
    else:
      tmp[a-1] = 1
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M = map(int,input().split())
AB = np.array([[0]*M]*M)

for i in range(M):
  a,b = map(int,input().split())
  AB[a-1][i] = b
for i in range(M):
  if AB[0][i] != 0:
    k = AB[0][i]-1
    for j in range(M):
      if AB[k][j] == N:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")
Problem p03658 (python)

Fixed submission:
N, K = map(int, input().split())
l = list(map(int, input().split()))
std = sorted(l, reverse = True)
print(sum(std[0:K]))

Buggy submission (verdict: Runtime Error):
l = list(map(int, input().split()))
N, K = map(int, input().split())
i = 0
std = sorted(l, reverse = True)
print(sum(std[0:K]))

Buggy submission (verdict: Runtime Error):
N = list(map(int, input().split()))
K = map(int, input().split())
l = 0
i = 0
std = sorted(N, reverse = True)
while i < K:
  l += std[i]
  i += 1

Buggy submission (verdict: Runtime Error):
N = list(map(int, input().split()))
K = map(int, input().split())
l = 0
std = sorted(N, reverse = True)
for i = 0 and i <= K and i += 1:
  l += std[i]
Problem p03994 (python)

Fixed submission:
from bisect import *
S = list(str(input()))
K = int(input())

alp = list("abcdefghijklmnopqrstuvwxyz")

for i in range(len(S)):
  b = bisect_left(alp,S[i])

  if i == len(S)-1:
    S[i] = alp[(b+K)%26]
  elif b == 0:
    continue
  elif 26 - b <= K:
    K -= (26 - b)
    S[i] = "a"
  if K == 0:
    break
  
print("".join(S))

Buggy submission (verdict: Runtime Error):
from bisect import *
S = list(str(input()))
K = int(input())

alp = list("abcdefghijklmnopqrstuvwxyz")

for i in range(len(S)):
  b = bisect_left(alp,S[i])
  print(b,K,S)
  if i == len(S)-1:
    S[i] = alp[(b+K)%26]
  elif 26 - b <= K:
    K -= (26 - b)
    S[i] = "a"
  if K == 0:
    break
  
print("".join(S))