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

Fixed submission:

H, W = map(int, input().split())

ans = min(H, W)

for h in range(H // 3, H // 3 + 3):
    w = W // 2
    s1 = h*W
    s2 = (H-h)*w
    s3 = (H-h)*(W-w)
    ans = min(ans, max(s1,s2,s3) - min(s1,s2,s3))

for w in range(W // 3, W // 3 + 3):
    h = H // 2
    s1 = w*H
    s2 = (W-w)*h
    s3 = (W-w)*(H-h)
    ans = min(ans, max(s1,s2,s3) - min(s1,s2,s3))
    
if H % 3 == 0 or W % 3 == 0:
    ans = 0
    
print(ans)

Buggy submission (verdict: Runtime Error):

H, W = map(int, input().spilit())

hal = [H//3, H//3+1]

ans = float("inf")

for ha in hal:
    Sa = ha * W
    
    ## 横に分割
    hb = (H - ha)//2
    hc = H - ha - hb
    Sb = hb * W
    Sc = hc * W
    ans = min(ans, max(Sa, Sb, Sc) - min(Sa, Sb, Sc))
    
    ## 縦に分割
    wb = W//2
    wc = W - wb
    Sb = (H - ha) * wb
    Sc = (H - ha) * wc
    ans = min(ans, max(Sa, Sb, Sc) - min(Sa, Sb, Sc))

wal = [W//3, W//3+1]

for wa in wal:
    Sa = H * wa
    
    ## 横に分割
    hb = H//2
    hc = H - hb
    Sb = hb * (W - wa)
    Sc = hc * (W - wb)
    ans = min(ans, max(Sa, Sb, Sc) - min(Sa, Sb, Sc))
    
    ## 縦に分割
    wb = (W - wa)//2
    wc = W - wa - wb
    Sb = H * wb
    Sc = H * wc
    ans = min(ans, max(Sa, Sb, Sc) - min(Sa, Sb, Sc))

print(ans)
Problem p03999 (python)

Fixed submission:
S = input()
n = len(S)

def SplitSum(i, t):
    if i == n-1:
        return sum(list(map(int, t.split('+'))))
    
    return SplitSum(i+1, t+S[i+1]) + SplitSum(i+1, t+'+'+S[i+1])

print(SplitSum(0, S[0]))

Buggy submission (verdict: Runtime Error):
Sl = list(input())

def func(n, s):
    n += 1
    if n==len(Sl)-1:
        a = sum([int(i) for i in (s+Sl[n]).split("+")])
        b = sum([int(i) for i in (s+"+"+Sl[n]).split("+")])
        return a + b
    else:
        return func(n, s+Sl[n]) + func(n, s+"+"+Sl[n])

print(func(0, Sl[0]))
Problem p04013 (python)

Fixed submission:
from collections import Counter

N, A = map(int, input().split())
X = list(map(int, input().split()))

X2 = [0]*N

for i in range(N):
    X2[i] = X[i] - A

C = Counter([0, X2[0]])

for x in X2[1:]:
    C2 = Counter()
    for s, c in C.items():
        C2[s+x] += c
    C += C2

print(C[0]-1)

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

X2 = [0]*N

for i in range(N):
    X2[i] = X[i] - A

C = Counter([0, X2[0]])

for x in X2[1:]:
    C2 = Counter()
    for s, c in C.items():
        C2[s+x] += c
    C += C2

print(C[0]-1)

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

N, A = map(int, input().split())
X = list(map(int, input().split))

X2 = [0]*N

for i in range(N):
    X2[i] = X[i] - A

C = Counter([0, X2[0]])

for x in X2[1:]:
    C2 = Counter()
    for s, c in C.items():
        C2[s+x] += c
    C += C2

print(C[0]-1)
Problem p02585 (python)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
c=list(map(int,input().split()))
ttl=[]
cnt=[]
count=0
for i in range(n):
  nxt=i+1
  grp=[]
  count=0
  pnt=[]
  pnt.append(0)
  for j in range(n):
    nxt=p[nxt-1]
    pnt.append(pnt[j]+c[nxt-1])
    count+=1
    if nxt==i+1:
      del pnt[0]
      ttl.append(pnt)
      cnt.append(count)
      break
ans=[]
for i in range(n):
  peak=ttl[i].index(max(ttl[i]))
  if k<=cnt[i]:
    ans.append(max(ttl[i][:k]))
  else:
    if ttl[i][-1]<0:
      ans.append(ttl[i][peak])
    else:
      if k%cnt[i]==0:
        ans.append(((k-peak-1)//cnt[i])*ttl[i][-1]+ttl[i][peak])
      else:
        ans.append(max((k//cnt[i])*ttl[i][-1]+max(ttl[i][0:k%cnt[i]]),((k-peak-1)//cnt[i])*ttl[i][-1]+ttl[i][peak]))
print(max(ans))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
c=list(map(int,input().split()))
ttl=[]
cnt=[]
count=0
for i in range(n):
  nxt=i+1
  grp=[]
  count=0
  pnt=[]
  pnt.append(0)
  for j in range(n):
    nxt=p[nxt-1]
    pnt.append(pnt[j]+c[nxt-1])
    count+=1
    if nxt==i+1:
      del pnt[0]
      ttl.append(pnt)
      cnt.append(count)
      break
ans=[]
for i in range(n):
  peak=ttl[i].index(max(ttl[i]))
  if k<=cnt[i]:
    ans.append(max(ttl[i][:k]))
  else:
    if ttl[i][-1]<0:
      ans.append(ttl[i][peak])
    else:
      ans.append(max((k//cnt[i])*ttl[i][-1]+max(ttl[i][0:k%cnt[i]]),((k-peak-1)//cnt[i])*ttl[i][-1]+ttl[i][peak]))
print(max(ans))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
c=list(map(int,input().split()))
ttl=[]
cnt=[]
count=0
for i in range(n):
  nxt=i+1
  grp=[]
  count=0
  pnt=[]
  pnt.append(0)
  for j in range(n):
    nxt=p[nxt-1]
    grp.append(nxt)
    pnt.append(pnt[j]+c[nxt-1])
    count+=1
    if nxt==i+1:
      del pnt[0]
      ttl.append(pnt)
      cnt.append(len(grp))
      break
ans=[]
for i in range(n):
  peak=ttl[i].index(max(ttl[i]))
  if k<=cnt[i]:
    ans.append(max(ttl[i][:k]))
  else:
    if ttl[i][-1]<0:
      ans.append(max(ttl[i][:k]))
    else:
      ans.append(max((k//cnt[i])*ttl[i][-1]+max(ttl[i][0:k%cnt[i]]),((k-peak)//cnt[i])*ttl[i][-1]+ttl[i][peak]))
print(max(ans))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
c=list(map(int,input().split()))
ttl=[]
cnt=[]
count=0
for i in range(n):
  nxt=i+1
  grp=[]
  count=0
  pnt=[]
  pnt.append(0)
  for j in range(n):
    nxt=p[nxt-1]
    grp.append(nxt)
    pnt.append(pnt[j]+c[nxt-1])
    count+=1
    if nxt==i+1:
      del pnt[0]
      ttl.append(pnt)
      cnt.append(len(grp))
      break
      
ans=[]
for i in range(n):
  peak=ttl[i].index(max(ttl[i]))
  if k<=cnt[i]:
    ans.append(max(ttl[i][:k]))
  else:
    if ttl[i][-1]<0:
      ans.append(max(ttl[i][:k]))
    else:
      ans.append(max((k//cnt[i])*ttl[i][-1]+max(ttl[i][:k%cnt[i]]),((k-peak)//cnt[i])*ttl[i][-1]+ttl[i][peak]))
print(max(ans))
Problem p02678 (python)

Fixed submission:
from collections import deque
n, m = map(int,input().split())
def vertex_node()  -> list:
    v_c = [[] for _ in range(n+1)]
    for i in range(m):
        a,b = map(int,input().split())
        v_c[a].append(b)
        v_c[b].append(a)
    return v_c

def bfs(l) -> list:
    dist = [-1] * (n+1)
    dist[0] = 0
    dist[1] = 0
    d = deque()
    d.append(1)
    while d:
        v = d.popleft()
        for i in l[v]:
                if dist[i] != -1:
                    continue
                dist[i] = v
                d.append(i)
    return dist
if __name__ == "__main__":
    i = vertex_node()
    ans = bfs(i)[2:]
    print("Yes")
    for i in ans:
        print(i)

Buggy submission (verdict: Runtime Error):
from collections import deque
n, m = map(int,input().split())
def vertex_node()  -> list:
    v_c = [[] for _ in range(n+1)]
    v = [i.split() for i in q.split("\n")]
    for i in range(m):
        a,b = map(int,input().split())
        v_c[a].append(b)
        v_c[b].append(a)
    return v_c

def bfs(l) -> list:
    dist = [-1] * (n+1)
    dist[0] = 0
    dist[1] = 0
    d = deque()
    d.append(1)
    while d:
        v = d.popleft()
        for i in l[v]:
                if dist[i] != -1:
                    continue
                dist[i] = dist[v] + 1
                d.append(i)
    return dist
if __name__ == "__main__":
    i = vertex_node()
    ans = bfs(i)[2:]
    print(*ans)
Problem p03324 (python)

Fixed submission:
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(d,n):
    if  n != 100 :
        return (100**d)*n
    elif n == 100:
         return (100**d)*101 
    else:
        return n

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_a, str_b] = line.split(' ')
    return (int(str_a), int(str_b))

def main():
    a, b = readQuestion()
    answer = solve(a, b)
    print(answer)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
 def solve(d,n):
    if  n != 100 :
        return (100**d)*n
    elif n == 100:
         return (d**100)*101 
    else:
        return n

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_a, str_b] = line.split(' ')
    return (int(str_a), int(str_b))

def main():
    a, b = readQuestion()
    answer = solve(a, b)
    print(answer)
    
if __name__ == '__main__':
    main()
Problem p03328 (python)

Fixed submission:
import sys
def readQuestion():
    line = sys.stdin.readline()
    sline = line.rstrip()
    [rline,r1line]=sline.split(" ")
    a=int(rline)
    b=int(r1line)
    return a,b 

def solve(a,b):
    x=[]
    y=0
    high=0
    z=0
    u=0
    for i in range(1,1000):
        y+=i
        x.append(y)
    high = b-a
    z=high-1
    u=x[z]-b
    return u
# 全体
def main():
    x,y = readQuestion()
    answer = solve(x, y)
    print(answer)

# mainを呼び出す
if __name__ == '__main__':
    main()

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

# 解く
def solve(x):
    a,b=map(int,input().split())
    x=[]
    y=0
    high=0
    z=0
    u=0
    for i in range(1,1000):
        y+=i
        x.append(y)
    high = b-a
    z=high-1
    u=x[z]-b
    return u

# 全体
def main():
    x = readQuestion(a,b)
    answer = solve(x)
    print(answer)

# mainを呼び出す
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# 問題データを読み込む
def readQuestion(a,b):
    a,b=map(int,input().split())

# 解く
def solve(x):
    a,b=map(int,input().split())
    x=[]
    y=0
    high=0
    z=0
    u=0
    for i in range(1,1000):
        y+=i
        x.append(y)
    high = b-a
    z=high-1
    u=x[z]-b
    print(u)

# 全体
def main():
    x = readQuestion(a,b)
    answer = solve(x)
    print(answer)

# mainを呼び出す
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
y=0
high=0
for i in range(1,1000):
    y+=i
    x.append(y)
for xz in x:
    if xz <= b:
        high=xz
        d=high-a
print(d)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
y=0
high=0
for i in range(1,1000):
    y+=i
    x.append(y)
for xz in x:
    if xz < b:
        high=xz
print(high-a)
Problem p03337 (python)

Fixed submission:
A, B = map(int, input().split())
x = A+B
y = A-B
z = A*B

print(max(x,y,z))

Buggy submission (verdict: Runtime Error):
x = A+B
y = A-B
z = A*B

print(max(x,y,z))

Buggy submission (verdict: Runtime Error):
x = A+B
Y = A-B
Z = A*B

print(max(X,Y,Z))
Problem p03838 (python)

Fixed submission:
import math
a ,b= map(int,input().split())
ans ,x , y ,c = 0 ,int(math.sqrt(a * a)) ,int(math.sqrt(b * b)),0
if x == 0:
    if b < a:
         c += 1 
elif y == 0:
    c += 1
    if a < b:
        c -= 1
if (a < 0 and b < 0) and (a > b):
    ans = abs(x - y)
    c += 2
elif (a < 0 and b > 0) or (a > 0 and b < 0):
    ans = abs(x - y)
    c += 1
else:
    ans = abs(x - y)
    if a > b and a > 0 and b > 0:
        c += 2
print(ans + c)

Buggy submission (verdict: Runtime Error):
a ,b= map(int,input().split())
ans ,x , y ,c= 0 ,int(math.sqrt(a * a)) ,int(math.sqrt(b * b)),0
if x == 0:
    x = 1
    c += 1
    if b < 0:
        c += 1 
elif y == 0:
    y = 1
    c += 1
if (a < 0 and b < 0) and (a > b):
    ans = abs(x - y)
    c += 2
elif (a < 0 and b > 0) or (a > 0 and b < 0):
    ans = abs(x - y)
    c += 1
else:
    ans = abs(x - y)
print(ans + c)
Problem p02639 (python)

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

for count, i in enumerate(x):
    if(i == 0):
        print(count+1)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())

for i in range(X+1):
    for j in range(X+1):
        if(i+j > X):
            continue

        if(Y == 4*i+2*j):
            print("Yes")
            exit()

print("No")

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())

for i in range(X+1):
    for j in range(X+1):
        if(i+j > X):
            continue
        if(Y == 4*i+2*j):
            print("Yes")
            exit()
 
print("No")
Problem p02705 (python)

Fixed submission:
import math
a = float(input())
print(2 * a * math.pi )

Buggy submission (verdict: Runtime Error):
import collections
N = int(input()）
strA = input().split()
ans = collections.Counter(strA)
for i in range(1,N+1):
        
	print(ans[str(i)])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
result = {}
count = []
count = [0 for i in range(N)]

for i in range(1, len(A)+2):
    for j in A:
        if(j == i):
            count[i-1] = count[i-1]+1
for i in range(i):
    print(count[i])
Problem p02765 (python)

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

if(N >= 10):
    print(R)
else:
    K = N
    print(R+100*(10-K))

Buggy submission (verdict: Runtime Error):
def keta(n,k):
  cnt=0
  while(n!=0):
   	n//=k
 	cnt+=1
   	return cnt
     
N,K=map(int,input().split())
print(keta(N,K))
Problem p03149 (python)

Fixed submission:
n = input()
if "1" in n and "9" in n and "7" in n and "4" in n:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
    n = input()
    if "1" in n and "9" in n and "7" in n and "4" in n:
        print("YES")
    else:
        print("NO")
Problem p03150 (python)

Fixed submission:
S = input()
KEYENCE = "keyence"
 
 
isKeyence = False
for i in range(len(S)):
    for j in range(i, len(S)):
        s = S[:i] + S[j:]
        if s == KEYENCE:
            isKeyence = True
if isKeyence:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
x=input()
count=0
x_count=0
o=None
judge=[]
string=["k","e","y","e","n","c","e"]
for i in x:
    if(i==string[count] and count<=6):
        judge.append(i)
        count=count+1

for i in judge:        
    if(i==string[x_count]):
        o=True
        x_count=x_count+1
    else:
        x_count=x_count+1
        o=False
        break

if(o==True):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
x=input()
count=0
x_count=0
judge=[]
string=["k","e","y","e","n","c","e"]
for i in x:
    if(i==string[count] and count<=6):
        judge.append(i)
        count=count+1

for i in judge:        
    if(i==string[x_count]):
        o=True
        x_count=x_count+1
    else:
        x_count=x_count+1
        o=False
        break

if(o==True):
    print("YES")
else:
    print("NO")
Problem p03416 (python)

Fixed submission:
A, B = map(int, input().split())
cnt = 0
for i in range(A, B+1):
    j = list(str(i))
    if j[0] == j[4] and j[1] == j[3]:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

A, B, x, mid, count = map(int, input().split()), [], 2, 0
for i in range(A, B):
    while(i > 10):
        x.append(i % 10)
        i = int(i/10)
    count = count+1 if(x[0:mid] == x[mid:len(x)]
                       and len(x) > 0) else None
    x.clear()
print(count)
Problem p02585 (python)

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

ans = -float('inf')
for i in range(n):
    s = []
    j = p[i]-1 
    s.append(c[j])
    while j != i:
        j = p[j]-1
        s.append(s[-1]+c[j])
    l = len(s)
    if k <= l:
        a = max(s[:k])
    elif s[-1] <= 0:
        a = max(s)
    else:
        w, r = divmod(k, l)
        a1 = s[-1]*(w-1) + max(s)
        a2 = s[-1]*w
        if r != 0:
            a2 += max(0, max(s[:r]))
        a = max(a1, a2)
    ans = max(ans, a)
print(ans)

'''

n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = -float('inf')
for i in range(n):
    j = p[i] - 1
    s = [c[j]]
    while j != i:
        j = p[j] - 1
        s.append(s[-1] + c[j])
    l = len(s)
    if k <= l:
        score = max(s[:k])
    elif s[-1] <= 0:
        score = max(s)
    else:
        w, r = divmod(k, l)
        score1 = s[-1] * (w - 1)
        score1 += max(s)
        score2 = s[-1] * w
        if r != 0:
            score2 += max(0, max(s[:r]))
        score = max(score1, score2)

    ans = max(ans, score)

print(ans)
'''

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

ans = -float('inf')
for i in range(n):
    s = []
    j = p[i]-1 
    s.append(c[j])
    while j != i:
        j = p[j]-1
        s.append(s[-1]+c[j])
    l = len(s)
    if k <= l:
        a = max(s[:k])
    elif s[-1] <= 0:
        a = max(s)
    else:
        w, r = divmod(k, l)
        a1 = s[-1]*(w-1) + max(s)
        a2 = s[-1]*w + max(0, max(s[:r]))
        a = max(a1, a2)
    ans = max(ans, a)
print(ans)

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

ans = -float('inf')
for i in range(n):
    s = []
    j = p[i]-1 
    s.append(c[j])
    while j != i:
        j = p[j]-1
        s.append(s[-1]+c[j])
    l = len(s)
    if k <= l:
        a = max(s[:k])
    elif s[-1] <= 0:
        a = max(s)
    else:
        w, r = divmod(k, l)
        a1 = s[-1]*(w-1) + max(s)
        a2 = s[-1]*w + max(0, max(s[:r]))
        a = max(a1, a2)
    ans = max(ans, a)
print(ans)
Problem p03076 (python)

Fixed submission:
import math
abc = [int(input()) for _ in range(5)]
tmp = 9
ans = 0
ii = 0
for i in range(5):
    tmpp = min(tmp, (abc[i]-1)%10)
    if tmp != tmpp:
        tmp = tmpp
        ii = i
for i in range(5):
    if i == ii:
        ans += abc[i]
    else:
        ans += (math.ceil(abc[i]/10))*10
print(ans)

Buggy submission (verdict: Runtime Error):
import math
abc = [int(input()) for _ in range(5)]
tmp = 9
ans = 0
for i in range(5):
    tmpp = min(tmp, (abc[i]-1)%10)
    if tmp != tmpp:
        tmp = tmpp
        ii = i
for i in range(5):
    if i == ii:
        ans += abc[i]
    else:
        ans += (math.ceil(abc[i]/10))*10
print(ans)
Problem p03290 (python)

Fixed submission:
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]

ans = 100*11
for i in range(2**d):
    sum = 0
    cnt = 0
    a = []
    for j in range(d):
        if (i >> j) & 1 == 1:
            sum += (j+1)*100*pc[j][0] + pc[j][1]
            cnt += pc[j][0]
            a.append(j)
    if sum < g:
        for j in range(d):
            if d-j-1 not in a:
                for k in range(pc[d-j-1][0]):
                    if sum >= g:
                        break
                    sum += (d-j)*100
                    cnt += 1
    ans = min(ans, cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
N, M = map(int, input().split())
link = [[0 for i in range(N)] for j in range(N)]
for m in range(M):
    x, y = map(int, input().split())
    link[x-1][y-1] = 1
    link[y-1][x-1] = 1

for i in range(N,1,-1): # N, N-1, N-2, ... 2
    for comb in combinations(range(N),i):
        for c in combinations(comb, 2): # 議員の集合に対して考えられるペアを列挙
            if (link[c[0]][c[1]] == 0): # 一つでも知り合いでない組があればNG
                break
        else: # 派閥が作れた段階でプログラムを終了
            print (i)
            exit()
print (1)
Problem p03378 (python)

Fixed submission:
n, m, x = map(int, input().split())
a = list(map(int, input().split()))
b = [0]*(n+1)
for i in a:
    b[i] = 1
print(min(sum(b[:x:]), sum(b[x:n+1:])))

Buggy submission (verdict: Runtime Error):
n, m, x = map(int, input().split())
s = sum(i if int(i)<x for i in input().split())
print(min(s, m-s))
Problem p03543 (python)

Fixed submission:
N = list(input())
print('Yes' if N[1] == N[2] and (N[0] == N[1] or N[2] == N[3]) else 'No')

Buggy submission (verdict: Runtime Error):
N = list(input())
print('Yes' if N[1] == N[2] and (N[0] == N[1] or N[2] == N[3]) else 'No')a
Problem p04044 (python)

Fixed submission:
n, l = input().split()
n = int(n)
s = [input() for _ in range(n)]
s.sort()
print(*s, sep='')

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
s = sorted([map(int, input().split()) for _ in range(n)])
print(*s, sep='')
Problem p02602 (python)

Fixed submission:
n, k = map(int, input().split())
scores = list(map(int, input().split()))
right = k
left = right - k + 1

while right < n:
    if scores[right] > scores[left-1]:
        print("Yes")
    else:
        print("No")

    right += 1
    left += 1

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
scores = list(map(int, input().split()))
right = k - 1
left = right - k + 1
prev = 1
now = 0
for i in range(left, right + 1):
    prev *= scores[left]
left += 1
right += 1

while right < n:
    now = prev / (scores[left - 1]) * scores[right]
    if now > prev:
        print("Yes")
    else:
        print("No")
    
    prev, now = now, 1

    right += 1
    left += 1
Problem p02922 (python)

Fixed submission:
A, B = map(int, input().split())
ans = 0
sum = 0

if B == 1:
    print(0)
else:
    ans += 1
    sum += A
    while True:
        if sum >= B:
            print(ans)
            break
        else:
            ans += 1
            sum += A - 1

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())

if B % A == 0:
    print(B // A)
else:
    if B < A:
        print(a)
    else:
        print(B // A + 1)
Problem p02923 (python)

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

def f():
    ans = 0
    i = 1
    now = H[0]
    count = 0

    if N <= 1:
        return 0
    else:
        while True:
            if now >= H[i]:
                count += 1
                now = H[i]
            else:
                ans = max(count, ans)
                now = H[i]
                count = 0
            
            now = H[i]
            i += 1

            if i >= len(H):
                ans = max(ans, count)
                break

        return ans

print(f())

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

ans = 0
i = 1
now = H[0]
count = 0

while True:
    if now >= H[i]:
        count += 1
        now = H[i]
    else:
        ans = max(count, ans)
        now = H[i]
        count = 0
    
    now = H[i]
    i += 1

    if i >= len(H):
        ans = max(ans, count)
        break

print(ans)
Problem p03303 (python)

Fixed submission:
s = input()
w = int(input())
ans = ''
for i in range(0 ,len(s) , w):
  ans += s[i:i+w][0]

print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
w = int(input())
ans = ''
for i in range(0 ,len(s) , w):
  ans += s[i:i+w][0]

print(ans)s = input()
w = int(input())
ans = ''
for i in range(0 ,len(s) , w):
  ans += s[i]

print(ans)
Problem p03437 (python)

Fixed submission:
x, y = map(int, input().split())
if x % y == 0:
  print(-1)
else:
  print(x)

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

if x == y or x == 1 or y == 1:
  print(-1)
else:
  print(int(x * y / math.gcd(x, y) - x))
Problem p03485 (python)

Fixed submission:
import math
a, b = map(int, input().split())
print(math.ceil((a + b) / 2))

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

def f(s, t):
  s.sort()
  t.sort(reverse=True)

  for i in range(len(s)):
    if s[i] < t[i]:
      return 'Yes'
    elif s[i] > t[i]:
      return 'No'
    elif i + 1 >= len(s) and not i + 1 >= len(t):
      return 'No'
  return 'No'

print(f(s, t))

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

def f(s, t):
  s.sort()
  t.sort(reverse=True)

  for i in range(len(s)):
    if s[i] < t[i]:
      return 'Yes'
    elif s[i] > t[i]:
      return 'No'
    elif i + 1 >= len(s) and not i + 1 >= len(t):
      return 'No'
  return 'No'

print(f(s, t))