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

Fixed submission:
from sys import stdin
s = str(stdin.readline().rstrip())
#A, B, C = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに
q= int(stdin.readline().rstrip())
hanten = 0
t=""
u=""

for i in range(q):
    l = list(map(str, stdin.readline().rstrip().split()))
    if int(l[0]) == 1:
        t,u = u,t
        hanten ^= 1
    else:
        if int(l[1])==1:
            t+=l[2]
        else:
            u+=l[2]


if hanten==0:
    print(t[::-1]+s+u)
else:
    print(t[::-1]+s[::-1]+u)

Buggy submission (verdict: Runtime Error):
from sys import stdin
s = str(stdin.readline().rstrip())
q = int(stdin.readline().rstrip())
for i in range(q):
    query = list(map(int, stdin.readline().rstrip().split()))
    if int(query[0])==1:
        s = s[::-1]
    else:
        if int(query[1])==2:
            s += query[2]
        else:
            s = query[2] + s

print(s)
Problem p02780 (python)

Fixed submission:
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
N,K = map(int, stdin.readline().rstrip().split())
P = list(map(int, stdin.readline().rstrip().split()))

Q = [(p+1)/2 for p in P]
c = [0]
for q in Q:
    c.append(c[-1] + q)

ans = 0
for i in range(K,N+1):
    ans = max(ans, c[i] - c[i-K])
print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin
#n = int(stdin.readline().rstrip())
n,k = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに
p = list(map(int, stdin.readline().rstrip().split()))

l = []
for i in range(n):
    s = 0
    d = p[i]
    for j in range(d):
        s += 1+j
    l.append(s/d)

ans = 0
for i in range(k):
    sums = [l[i+j] for j in range(k)]
    ans = max(sum(sums), ans)
print(ans)
Problem p02802 (python)

Fixed submission:
from sys import stdin
n,m = map(int, stdin.readline().rstrip().split())

count = 0
penalty = 0
qb = [0]*n
was = [0]*n

for i in range(m):
    p,s = map(str,stdin.readline().rstrip().split())
    p = int(p)
    if s == "AC" and qb[p-1] != "AC":
        qb[p-1] = "AC"
        penalty += was[p-1]
        count += 1
    elif s == "WA":
        was[p-1] += 1
    else:
        pass

print(count, penalty)

Buggy submission (verdict: Runtime Error):
from sys import stdin
n,m = map(int, stdin.readline().rstrip().split())

count = 0
penalty = 0
qb = [0]*n
was = [0]*n

for i in range(m):
    p,s = map(str,stdin.readline().rstrip().split())
    p = int(p)
    if s == "AC" and qb[p-1] != "AC":
        qb[p-1] = "AC"
        pentalty += was[p-1]
        count += 1
    elif s == "WA":
        was[p-1] += 1
    else:
        pass

print(count, penalty)
Problem p02910 (python)

Fixed submission:

N = input()
steps = [i for i in N]
N = len(N)
ans = "Yes"
for i in range(0,N,2):
    if steps[i] == "L":
        ans = "No"
for i in range(1,N,2):
    if steps[i] == "R":
        ans = "No"
print(ans)

Buggy submission (verdict: Runtime Error):

N = input()
steps = [i for i in N]
N = len(N)
ans = "Yes"
#024 L があるとダメ
for i in range(0,N+1,2):
    if steps[i] == "L":
        ans = "No"
for i in range(1,N,2):
    if steps[i] == "R":
        ans = "No"
print(ans)
Problem p02983 (python)

Fixed submission:
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
L,R = map(int, stdin.readline().rstrip().split())
#S = [list(stdin.buffer.readline().decode().rstrip()) for _ in range(h)]

if R-L > 2019:
    print(0)
    exit()

ans = 2018
for i in range(L,R):
    for j in range(L+1,R+1):
        ans = min(ans, (i*j)%2019)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
L,R = map(int, stdin.readline().rstrip().split())
#S = [list(stdin.buffer.readline().decode().rstrip()) for _ in range(h)]

lsho, lmod = divmod(L,2019)
rsho, rmod = divmod(R,2019)

if rsho - lsho == 0:
    print(int((lmod*(lmod+1))%2019))
    exit()

u = [0]*2019
for l in range(lsho,2019):
    u[l] += 1
for r in range(rsho):
    u[r] += 1

for i,v in enumerate(u):
    if v == 0:
        pass
    if v == 1:
        if u[i+1] != 0:
            print(int((i*(i+1))%2019))
            exit()
        else:
            for j in range(i+1,2019):
                if u[j] == 1:
                    print(int((i*j%2019)))
                    exit()
    if v == 2:
        print(int((i*i)%2019))
        exit()
Problem p02995 (python)

Fixed submission:
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
a,b,c,d = map(int, stdin.readline().rstrip().split())
#S = [list(stdin.buffer.readline().decode().rstrip()) for _ in range(h)]

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

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


cd = lcm(c,d)

# b以下
cwari = b//c
dwari = b//d
cdwari = b//cd
ub = b-cwari-dwari+cdwari

# a以下
cwari = (a-1)//c
dwari = (a-1)//d
cdwari = (a-1)//cd
ua = (a-1)-cwari-dwari+cdwari

print(ub-ua)

Buggy submission (verdict: Runtime Error):
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
import math
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
a,b,c,d = map(int, stdin.readline().rstrip().split())
#S = [list(stdin.buffer.readline().decode().rstrip()) for _ in range(h)]

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

# 最小公倍数
cd = lcm(c,d)

# b以下
cwari = b//c
dwari = b//d
cdwari = b//cd
ub = b-cwari-dwari+cdwari

# a以下
cwari = a//c
dwari = a//d
cdwari = a//cd
ua = a-cwari-dwari+cdwari

if a%c != 0 and a%d !=0:
    print(ub-ua+1)
else:
    print(ub-ua)
Problem p03693 (python)

Fixed submission:
from sys import stdin
r,g,b = [int(x) for x in stdin.readline().rstrip().split()]
a = 100*r+10*g+b
if a%4 == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
from sys import stdin
r, g, b = stdin.readline().rstrip().split()
a = 100*r+10*g+b
if a%4 == 0:
    print("YES")
else:
    print("NO")
Problem p02574 (python)

Fixed submission:
import math
from functools import reduce

def gcd_list(numbers):
  return reduce(math.gcd, numbers)

N=int(input())
A=list(map(int,input().split()))
mA = max(A)
D = [-1]*(mA+1)
D[0]=1
D[1]=1
for i in range(2,mA+1):
  if D[i] != -1: continue
  D[i] = i
  cnt = 2*i
  while cnt < mA+1:
    if D[cnt] == -1:
      D[cnt]=i
    cnt += i
done = set()
for a in A:
  tmp = set()
  while a > 1:
    tmp.add(D[a])
    a //= D[a]
  if len(done&tmp) > 0:
    if gcd_list(A) == 1: print('setwise coprime')
    else: print('not coprime')
    exit()
  done |= tmp
print('pairwise coprime')

Buggy submission (verdict: Runtime Error):
prime = sieve_of_eratosthenes(2*10**5+1)
g = gcd_list(A)
if g != 1: print('not coprime');exit();

for p in prime:
  cnt = 0
  for a in A:
    if a%p == 0: cnt += 1
    if cnt == 2:
      print('setwise coprime')
      exit()
print('pairwise coprime')
Problem p02613 (python)

Fixed submission:
k = ['AC','WA','TLE','RE']
n=int(input())
ans = {}
for _ in range(n):
  r = input()
  ans[r]=ans.get(r,0)+1
for r in k:
  print(r,'x',ans.get(r,0))

Buggy submission (verdict: Runtime Error):
k = ['AC','WA','TLE','RE']
n=int(input())
ans = {}
for _ in range(n):
  r = input()
  ans[r]=ans.get(r,0)+1
for r in k:
  print(r,'x',ans[r].get(r,0))
Problem p02642 (python)

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))
a=collections.Counter(a)
b,c=[],[]
for t in a:
  if a[t]==1:
    b.append(t)
  else:
    c.append(t)
if len(b) == 0:
  print(0)
  exit()
b.sort()
bm = b[-1]
ok = [True]*(bm+1)

if len(c)>0:
  c.sort()
  for t in c:
    if t>=bm: continue
    if ok[t] == False: continue
    i = 1
    while i*t<=bm:
      ok[i*t]=False
      i+=1
for t in b:
  if ok[t] == False: continue
  i = 2
  while i*t<=bm:
    ok[i*t]=False
    i+=1
ans = 0
for t in b:
  if ok[t]:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
a=list(map(int,input().split()))
a=collections.Counter(a)
b,c=[],[]
for t in a:
  if a[t]==1:
    b.append(t)
  else:
    c.append(t)
if len(b) == 0:
  print(0)
  exit()
b.sort()
bm = b[-1]
ok = [True]*(bm+1)

if len(c)>0:
  c.sort()
  for t in c:
    if ok[t] == False: continue
    i = 1
    while i*t<=bm:
      ok[i*t]=False
      i+=1
for t in b:
  if ok[t] == False: continue
  i = 2
  while i*t<=bm:
    ok[i*t]=False
    i+=1
ans = 0
for t in b:
  if ok[t]:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
a=list(map(int,input().split()))
a=collections.Counter(a)
b,c=[],[]
for t in a:
  if a[t]==1:
    b.append(t)
  else:
    c.append(t)
if len(b) == 0:
  print(0)
  exit()
b.sort()
bm = b[-1]
ok = [True]*(bm+1)

if len(c)>0:
  c.sort()
  for t in c:
    if ok[t] == False: continue
    i = 1
    while i*t<=bm:
      ok[i*t]=False
      i+=1
for t in b:
  if ok[t] == False: continue
  i = 2
  while i*t<=bm:
    ok[i*t]=False
    i+=1
ans = 0
for t in b:
  if ok[t]:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
a=list(map(int,input().split()))
a=collections.Counter(a)
b,c=[],[]
for t in a:
  if a[t]==1:
    b.append(t)
  else:
    c.append(t)
if len(b) == 0:
  print(0)
  exit()
b.sort()
bm = b[-1]
ok = [True]*(bm+1)

for t in c:
  if ok[t] == False: continue
  i = 1
  while i*t<=bm:
    ok[i*t]=False
    i+=1
for t in b:
  if ok[t] == False: continue
  i = 2
  while i*t<=bm:
    ok[i*t]=False
    i+=1
ans = 0
for t in b:
  if ok[t]:
    ans+=1
print(ans)
Problem p02691 (python)

Fixed submission:
N = int(input())
A = [int(v) for v in input().split()]
L, R = {}, {}
for i,a in enumerate(A):
  l,r = i+a,i-a
  if l not in L: L[l]=0
  if r not in R: R[r]=0
  L[l]+=1
  R[r]+=1

count = 0
for X in L:
  if X not in R: continue
  count += L[X]*R[X]
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
L,R={},{}
for i,a in enumerate(A):
  l,r = i-a,i+a
  if l in L: L[l]=0
  if r in R: R[r]=0
  L[l]+=1
  R[r]+=1

count = 0
for x in L:
  if x not in R: continue
  count += L[x]*R[x]
print(count)
Problem p02706 (python)

Fixed submission:
n,m=map(int,input().split())
A=list(map(int,input().split()))
print(max(-1,n-sum(A)))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
A=sum(list(map(int,input().split())))
print(max(-1,N-A))
Problem p02887 (python)

Fixed submission:
N=int(input())
S=input()
last = S[0]
cnt = 1
for s in S[1:]:
  if last != s:
    cnt+=1
    last = s
print(cnt)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
last = s[0]
cnt = 0
for s in S[1:]:
  if last != s:
    cnt+=1
    last = s
print(cnt)
Problem p03574 (python)

Fixed submission:
H,W = map(int,input().split())
grid = [[0 for w in range(W)] for h in range(H)]
sharps = []
for h in range(H):
  row = [v for v in input()]
  #print(row)
  for w,r in enumerate(row):
    #print(w,r)
    if r == "#":
      #grid[h][w] = "#"
      sharps.append([h,w])
      if h>=1:
        grid[h-1][w] += 1
        if w>=1:
          grid[h-1][w-1] += 1
        if w<=W-2:
          grid[h-1][w+1] += 1
      if h<=H-2:
        grid[h+1][w] += 1
        if w>=1:
          grid[h+1][w-1] += 1
        if w<=W-2:
          grid[h+1][w+1] += 1
      if w>=1:
        grid[h][w-1] +=1
      if w<=W-2:
        grid[h][w+1] +=1
#print(sharps)
for sharp in sharps:
  grid[sharp[0]][sharp[1]] = "#"
for g in grid:
  print("".join([str(v) for v in g]))

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
grid = [[0 for w in range(W)] for h in range(H)]
sharps = []
for h in range(H):
  row = input()
  #print(row)
  for w,r in enumerate(row):
    #print(w,r)
    if r == "#":
      #grid[h][w] = "#"
      sharps.append([h,w])
      if h>=1:
        grid[h-1][w] += 1
        if w>=1:
          grid[h-1][w-1] += 1
        if w<=W-1:
          grid[h-1][w+1] += 1
      if h<=H-1:
        grid[h+1][w] += 1
        if w>=1:
          grid[h+1][w-1] += 1
        if w<=W-1:
          grid[h+1][w+1] += 1
      if w>=1:
        grid[h][w-1] +=1
      if w<=W-1:
        grid[h][w+1] +=1
for sharp in sharps:
  grid[sharp[0]][sharp[1]] = "#"
for g in grid:
  print("".join([str(v) for v in g]))

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
grid = [[0 for w in range(W)] for h in range(H)]
sharps = []
for h in range(H):
  row = input()
  print(row)
  for w,r in enumerate(row):
    #print(w,r)
    if r == "#":
      #grid[h][w] = "#"
      sharps.append([h,w])
      if h>=1:
        grid[h-1][w] += 1
        if w>=1:
          grid[h-1][w-1] += 1
        if w<=W-1:
          grid[h-1][w+1] += 1
      if h<=H-1:
        grid[h+1][w] += 1
        if w>=1:
          grid[h+1][w-1] += 1
        if w<=W-1:
          grid[h+1][w+1] += 1
      if w>=1:
        grid[h][w-1] +=1
      if w<=W-1:
        grid[h][w+1] +=1
for sharp in sharps:
  grid[sharp[0]][sharp[1]] = "#"
for g in grid:
  print("".join([str(v) for v in g]))

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
grid = [[0]*W]*H
for h in range(H):
  row = input.split()
  for w,r in enumerate(row):
    if r == "#":
      if h>=1:
        grid[h-1][w] += 1
        if w>=1:
          grid[h-1][w-1] += 1
        if w<=W-1:
          grid[h-1][w+1] += 1
      if h<=H-1:
        grid[h+1][w] += 1
        if w>=1:
          grid[h+1][w-1] += 1
        if w<=W-1:
          grid[h+1][w+1] += 1
      if w>=1:
        grid[h][w-1] +=1
      if w<=W-1:
        grid[h][w+1] +=1
  grid.append([0 if v == "." else "#" for v in input().split()])
for g in grid:
  print("".join([str(v) for v in g])
Problem p02640 (python)

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

for i in range(x + 1):
    if 4*i + 2*(x-i) == y:
        print("Yes")
        exit()
        
print("No")

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

for i in range(i + 1):
    if 4*i + 2*(x-i) == y:
        print("Yes")
        exit()
        
print("No")
Problem p02658 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
ans = 1
for i in A:
    ans *= i
    ans = min(ans,10**18 + 1)
if ans >= 10**18 + 1:
    ans = -1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b = map(float,input().split())
ans = ((a*b*100) /100)// 1
print(int(ans))
Problem p03455 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a*b%&2 == 0:
    print("Even")
else:
    print("Odd")
Problem p02660 (python)

Fixed submission:
import collections
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())
if n == 1:
    print(0)
else:
    ans = 0
    c = factorization(n)
    for arr in c:
        m = arr[1]
        i = 1
        for _ in range(m):
            if i > m:
                break
            ans += 1
            m -= i
            i += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
import collections
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())
if n == 1:
    print(0)
else:
    ans = 0
    c = factorization(n)
    for arr in c:
        m = arr[1]
        i = 1
        for _ in range(m):
            if i > m:
                break
            ans += 1
            m -= i
            i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
if n ==1:
    print(0)
else:
    ans = 0
    c = collections.Counter(prime_factorize(n))
    for v in c.values():
        m = v
        i = 1
        for _ in range(1, m+1):
            if i > m:
                break
            ans += 1
            m -= i
            i += 1
print(ans)
Problem p02678 (python)

Fixed submission:
from collections import deque
n, m = map(int, input().split())
to = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1; b -= 1
    to[a].append(b)
    to[b].append(a)
q = deque()
visited = [0 for _ in range(n)]
pre = [-1 for _ in range(n)]
q.append(0)
visited[0] = 1
while q:
    # visitした
    v = q.popleft()
    for u in to[v]:
        if visited[u] == 1: continue
        visited[u] = 1
        pre[u] = v
        q.append(u)
print("Yes")
for p in pre[1:]:
    p += 1
    print(p)

Buggy submission (verdict: Runtime Error):
from collections import deque
import numpy as np
n, m = map(int, input().split())
route = np.zeros((n, n), dtype = np.bool)
for _ in range(m):
    a, b = map(int, input().split())
    route[a-1][b-1] = True
    route[b-1][a-1] = True

q = deque()
visited = [0] * n
pre = [-1] * n
q.append(0)
visited[0] = 1
while q:
    # visitした
    v = q.popleft()
    for i in range(n):
        if visited[i] == 1 or route[v][i] == False: continue
        visited[i] = 1
        pre[i] = v
        q.append(i)
print("Yes")
for p in pre[1:]:
    p += 1
    print(p)
Problem p02713 (python)

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

comb_count = {1:1, 2:3, 3:6}
k = int(input())
ans = 0
for a in range(1, k+1):
    for b in range(a, k+1):
        for c in range(b, k+1):
            ans += gcd(a, b, c) * comb_count[len(set([a, b, c]))]
print(ans)

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

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())
ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            ans += gcd(a, b, c)
print(ans)
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 8)
n, q = map(int, input().split())
g = [[] for _ in range(n)]
value = [0] * n
for _ in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)
for _ in range(q):
    p, x = map(int, input().split())
    value[p-1] += x

seen = [False] * n
def dfs(v):
    seen[v] = True
    for nv in g[v]:
        if seen[nv]:
            continue
        value[nv] += value[v]
        dfs(nv)
dfs(0)
print(*value)

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
g = [[] for _ in range(n)]
value = [0] * n
for _ in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)
for _ in range(q):
    p, x = map(int, input().split())
    value[p-1] += x

seen = [False] * n
def dfs(v):
    seen[v] = True
    for nv in g[v]:
        if seen[nv]:
            continue
        value[nv] += value[v]
        dfs(nv)
dfs(0)
print(*value)
Problem p03043 (python)

Fixed submission:
n, k = map(int, input().split())
w = max((n-k+1) / n, 0)
coin_win = 0
for i in range(1, min(k, n+1)):
    for x in range(1, 18):
        if i * (2 ** x) >= k:
            coin_win += 1 / (2 ** x)
            break
if k != 1:
    print(w + (1-w) * coin_win / min(k-1, n))
else:
    print(w)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
w = max((n-k+1) / n, 0)
coin_win = 0
for i in range(1, min(k, n+1)):
    for x in range(1, 18):
        if i * (2 ** x) >= k:
            coin_win += 1 / (2 ** x)
            break
print(w + (1-w) * coin_win / min(k-1, n))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
w = max((n-k+1) / n, 0)
coin_win = 0
for i in range(1, min(k, n+1)):
    for x in range(1, 18):
        if i * (2 ** x) >= k:
            print(x)
            coin_win += 1 / (2 ** x)
            break
print(w + (1-w) * coin_win / min(k-1, n))
Problem p03457 (python)

Fixed submission:
n = int(input())
tp, xp, yp = 0, 0, 0
for _ in range(n):
    t, x, y = map(int, input().split())
    td = t - tp
    xd = x - xp
    yd = y - yp
    if td < abs(xd) + abs(yd) or (td - abs(xd) - abs(yd)) % 2 == 1:
        print('No')
        break
    tp = t
    xp = x
    yp = y
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
n = int(input())
tp, xp, yp = 0, 0, 0
for _ in range(n):
  t, x, y = map(int, input().split())
  td = t - tp
  xd = x - xp
  yd = y - yp
  if td < abs(xd) + abs(yd) or (td - abs(xd) - abs(yd)) % 2 == 1:
    print('No')
    break
    tp = t
    xp = x
    yp = y
    else:
      print('Yes')
Problem p02683 (python)

Fixed submission:
import numpy as np
N,M,X = map(int, input().split())
nd_list = np.ones(M)*X

next_list = []
for i in range(0,N):
    next_list.append(list(map(int, input().split())))
next_list = np.array(next_list)
min_tot = 10000000

def dfs(i,ab_list):
    global min_tot
    if i==N and np.all(ab_list[1:]>=nd_list):
        if min_tot > ab_list[0]:
            min_tot = ab_list[0]
        return True
    elif i ==N:
        return True

    dfs(i+1,ab_list)
    dfs(i+1,ab_list+next_list[i,:])


dfs(0,np.zeros(1+M))
if min_tot ==10000000:
    print(-1)
else:
    print(int(min_tot))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M,X = map(int, input().split())
nd_list = np.ones(M)*X

next_list = []
for i in range(0,N):
    next_list.append(list(map(int, input().split())))
next_list = np.array(next_list)
min_tot = 10000000

def dfs(i,ab_list):
    global min_tot
    if i==N and np.all(ab_list[1:]>=nd_list):
        if min_tot > ab_list[0]:
            min_tot = ab_list[0]
        return True
    elif i ==N:
        return True

    dfs(i+1,ab_list)
    dfs(i+1,ab_list+next_list[i,:])


if min_tot ==10000000:
    print(-1)
else:
    print(min_tot)
Problem p02718 (python)

Fixed submission:
import numpy as np
N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))

all_sum_a = np.sum(A)

if M<=np.sum(A>=all_sum_a/(4*M)):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
M,N = input().split()
A = list(input().split())mport numpy as np
N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))

all_sum_a = np.sum(A)

if M<=np.sum(A>=all_sum_a/(4*M)):
    print('Yes')
else:
    print('No')
Problem p02741 (python)

Fixed submission:
lst = [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]
K = int(input())

print(lst[K-1])

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

if c-a-b>=0:
    if 4*a*b<(c-a-b)**2:
        print('Yes')
    else:
        print('No')
else:
    print('No')