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

Fixed submission:
#【註】入力受け取り部分 …… そのまま用いています。
A = input()
B = input()
C = input()

#【註】現在 A, B, C がカードを何枚目まで切っているかを示す変数 …… そのまま用いています。
xa = 0
xb = 0
xc = 0

#【註】関数 next は、単純に A[xa] や B[xb] および C[xc] を用いることで
# 複雑な処理を行うことなく次の手番が誰になるかを確認できるため、今回の
# 解答となるコードからは削除しました。

#【註】最初の A の手番の処理
h = 'A'
k = A[xa] #【註】 next 関数を削除し、A[xa] を用いて A の 0 枚目のカードを参照するように変更しました。
xa += 1

#【註】このゲームの勝敗が決まるタイミングに着目します。
# このゲームは、「場に出たカードに書かれているプレイヤー」のカードが
# 残り 0 枚だったとき、そのプレイヤーが勝利するようになっています。
# そのため、ループ構造は「カードを場に出す」→「もしもそのプレイヤーが勝つならループを抜ける、そうでなければ
# 次のカードを場に出させる（ループを続ける）」という形になるのが適切です。
# カードを場に出した際にループが続くか・ループから抜けるかが決まるため、while 文は
# 条件式を True とし、ループから抜ける処理が走るまでループさせ続けるとよいでしょう。
while True:

    #【註】場に出たカードに書かれている文字（ k ）に注目 … この if 文の構造はそのまま用いています。
    if k == 'a':
        h = 'A'  #【註】h（誰の手番になったのか）を更新 …… そのまま用いています。

        #【註】もし次に参照するべきカードの順番：xa がカードの枚数：len(A) より小さければ、
        # A に 1 枚カードを出させる（k に A[xa] を代入し、xa に 1 を足す）処理をします。
        if xa < len(A): 
            k = A[xa]
            xa += 1
        #【註】そうでなければ、A はもうカードを持っていないことになりますから、このループを抜けることができます。
        else:
            break

    elif k == 'b':
        h = 'B'
        xb += 1
        if xb < len(B):
            k = B[xb]
            xb += 1
        else:
            break
    else:
        h = 'C'
        xc += 1
        if xc < len(C):
            k = C[xc]
            xc += 1
        else:
            break

print(h)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

def next(X, i):
    if X[i] == 'a':
        return A[i+1]
    elif X[i] == 'b':
        return B[i+1]
    else:
        return C[i+1]

xa = 0
xb = 0
xc = 0

k = next(A, xa)
xa += 1

while xa < len(A)-1 and xb < len(B)-1 and xc < len(C)-1:
    if k == 'a':
        k = next(A, xa)
        xa += 1
    elif k == 'b':
        k = next(B, xb)
        xb += 1
    else:
        k = next(C, xc)
        xc += 1

print(str.upper(k))

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

def next(X, i):
    if X[i] == 'a':
        return A[i+1]
    elif X[i] == 'b':
        return B[i+1]
    else:
        return C[i+1]

xa = 0
xb = 0
xc = 0

k = next(A, xa)
xa += 1

while xa < len(A)-1 and xb < len(B)-1 and xc < len(C)-1:
    if k == 'a':
        k = next(A, xa)
        xa += 1
    elif k == 'b':
        k = next(B, xb)
        xb += 1
    else:
        k = next(C, xc)
        xc += 1

print(str.upper(k))
Problem p02582 (python)

Fixed submission:
weat= input()
imput = 0
if weat == 'SSS':
  imput = 0
if weat == 'SSR' or weat == 'RSS' or weat == 'SRS' or weat == 'RSR':
  imput = 1
if weat == 'SRR' or weat == 'RRS':
  imput = 2
if weat == 'RRR':
  imput = 3

print(imput)

Buggy submission (verdict: Runtime Error):
weat= input()
seaS = 'S'
seaR = 'R'
a = 0
b = 0
c = 0
imput = 0
for alp in wea:
  if a == 0:
    if alp == seaS:
      a = 1
    if alp == seaR:
      a = 2
  if b == 0 and a != 0:
    if alp == seaS:
      b = 1
    if alp == seaR:
      b = 2
  if c == 0 and a != 0 and b != 0:
    if alp == seaS:
      c = 1
    if alp == seaR:
      c = 2
if a or b or c == 2:
  imput = 1
if a and b == 2 or b and c == 2:
  imput = 2
if a and b and c == 3:
  imput = 3

print(imput)
Problem p03355 (python)

Fixed submission:
s = str(input())
K = int(input())
L = []
M = []
con = 0
for i in s:
  L.append(i)
L = list(set(L))
L.sort()
for j in range(len(s)):
    if s[j] == L[0]:
      for k in range(1,6):
        if j + k >=len(s):
          M.append(s[j:])
          break
        else:
          M.append(s[j:j+k])
if len(L) != 1:
  for l in range(len(s)):
    if s[l] == L[1]:
      for m in range(1,6):
        if l + m >= len(s):
          M.append(s[l:])
          break
        else:
          M.append(s[l:l+m]) 
if len(M) < K:
  for n in range(len(s)):
    if s[n] == L[2]:
      for o in range(1,6):
        if n + o >=len(s):
          M.append(s[n:])
          break
        else:
          M.append(s[n:n+o])
M = list(set(M))
M.sort()
print(M[K - 1])

Buggy submission (verdict: Runtime Error):
s = str(input())
K = int(input())
L = []
M = []
con = 0
for i in s:
  L.append(i)
L = list(set(L))
L.sort()
for j in range(len(s)):
    if s[j] == L[0]:
      for k in range(1,6):
        if j + k >=len(s):
          M.append(s[j:])
          break
        else:
          M.append(s[j:j+k])

for l in range(len(s)):
  if s[l] == L[1]:
    for m in range(1,6):
      if l + m >= len(s):
        M.append(s[l:])
        break
      else:
        M.append(s[l:l+m]) 
if len(M) < K:
  for n in range(len(s)):
    if s[n] == L[2]:
      for o in range(1,6):
        if n + o >=len(s):
          M.append(s[n:])
          break
        else:
          M.append(s[n:n+o])
M = list(set(M))
M.sort()
print(M)
print(M[K - 1])
Problem p03386 (python)

Fixed submission:
A,B,K = map(int,input().split())
if B - A >= 2 * K :
  for i in range(K):
    print(A + i)
  for j in reversed(range(K)):
    print(B - j)
else:
  for _ in range(A,B + 1):
    print(_)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
L = list(range(A,B + 1))
for i in range(len(L)):
  if i < K or len(L) - K <= i:
    print(L[i])
Problem p03738 (python)

Fixed submission:
A = int(input())
B = int(input())
if A > B:
  print('GREATER')
if A < B:
  print('LESS')
if A == B:
  print('EQUAL')

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
if A > B:
  print('GREATER')
if A < B:
  print('LESS')
if A == B:
  print('EQUAL')
Problem p02534 (python)

Fixed submission:
k = int(input())
for i in range(k):
  print("ACL",end="")

Buggy submission (verdict: Runtime Error):
k=input()
for i in range(k):
  print("ACL",end="")
Problem p02741 (python)

Fixed submission:
print([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][int(input())-1])

Buggy submission (verdict: Runtime Error):
print([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][int(input()-1)]
Problem p03061 (python)

Fixed submission:
from math import sqrt
from sys import exit
N=int(input())
A=list(map(int,input().split()))

if len(A)==2:
    print(max(A))
    exit()

def gcd(a,b):
    if a<b: a,b=b,a
    if a%b==0: return b
    return gcd(b,a%b)
    
g=gcd(A[0],A[-1])

p=[]

for i in range(1,int(sqrt(g)+1)):
    if g%i==0:
        if i*i==g: p.append(i)
        else: p+=[i,g//i]
        
def ok(n):
    f=False
    for a in A[1:-1]:
        if a%n:
            if f: return False
            f=True
    return True
    
def GCD(L):
    if len(L)==1: return L[0]
    ans=gcd(L[0],L[1])
    if len(L)>2:
        for l in L[2:]:
            ans=gcd(ans,l)
    return ans

p.sort(reverse=True)
for num in p:
    if ok(num):
        ans=num
        break
p1=GCD(A[1:-1])
print(max([ans,gcd(p1,A[0]),gcd(p1,A[-1])]))

Buggy submission (verdict: Runtime Error):
from math import gcd, sqrt
from sys import exit
N=int(input())
A=list(map(int,input().split()))

if len(A)==2:
    print(max(A))
    exit()

g=gcd(A[0],A[-1])

p=[]
for i in range(1,int(sqrt(g)+1)):
    if g%i==0:
        if i*i==g: p.append(i)
        else: p+=[i,g//i]
        
def ok(n):
    f=False
    for a in A[1:-1]:
        if a%n:
            if f: return False
            f=True
    return True
    
def GCD(L):
    if len(L)==1: return L[0]
    ans=gcd(L[0],L[1])
    if len(L)>2:
        for l in L[2:]:
            ans=gcd(ans,l)
    return ans

p.sort(reverse=True)
for num in p:
    if ok(num):
        ans=num
        break
p1=GCD(A[1:-1])
print(max([ans,gcd(p1,A[0]),gcd(p1,A[-1])]))
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
if a>b:
    ans=a
    a-=1
else:
    ans=b
    b-=1
print(ans+max(a,b))

Buggy submission (verdict: Runtime Error):
from math import gcd
a,b=map(int,input().split())
print(gcd(a,b))

Buggy submission (verdict: Runtime Error):
from math import gcd,ceil
a,b=map(int,input().split())
print(gcd(a,b))

Buggy submission (verdict: Runtime Error):
from math import gcd,ceil
a,b=map(int,input().split())
print(gcd(a,b))
Problem p03193 (python)

Fixed submission:
N,H,W=map(int,input().split())
ans=0
for _ in range(N):
    a,b=map(int,input().split())
    if a>=H and b>=W:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
N,H,W=map(int,input())
ans=0
for _ in range(N):
    a,b=map(int,input().split())
    if a>=H and b>=W:
        ans+=1
print(ans)
Problem p03200 (python)

Fixed submission:
S=list(input())
n=len(S)
ans=0
b=0

for s in S:
    if s=='B':b+=1
    else:ans+=b
    
print(ans)

Buggy submission (verdict: Runtime Error):
S=list(input())
n=len(S)

def search(t,ans):
    if t==n-1:
        print(ans)
    elif S[t]=='B' and S[t+1]=='W':
        S[t],S[t+1]='W','B'
        if t: search(t-1,ans+1)
        else: search(1,ans+1)
    else:
        search(t+1,ans)
    
search(0,0)

Buggy submission (verdict: Runtime Error):
S=list(input())
n=len(S)

def search(t):
    for i in range(t,n-1):
        if S[i]=='B' and S[i+1]=='W':
            S[i],S[i+1]='W','B'
            if i>0:
                return 1+search(i-1)
            else:
                return 1+search(1)
    return 0

print(search(0))

Buggy submission (verdict: Runtime Error):
S=list(input())
n=len(S)

def search(t):
    for i in range(t,n-1):
        if S[i]=='B' and S[i+1]=='W':
            S[i],S[i+1]='W','B'
            if t>0:
                return 1+search(t-1)
            else:
                return 1+search(1)
    return 0

print(search(0))
Problem p03231 (python)

Fixed submission:
import sys

def gcd(a,b):
    if a<b:
        a,b = b,a
    if a%b==0:
        return b
    else:
        return gcd(a%b,b)
        
N,M=map(int,input().split())
length=N*M//gcd(N,M)

S=input()
T=input()

a=length//N
b=length//M
l=a*b//gcd(a,b)
s=l//a
t=l//b

for i in range(gcd(N,M)):
    if S[i*s]!=T[i*t]:
        print(-1)
        sys.exit()
print(length)

Buggy submission (verdict: Runtime Error):
import math
import sys

N,M=map(int,input().split())
length=N*M//math.gcd(N,M)

S=input()
T=input()

a=length//N
b=length//M
l=a*b//math.gcd(a,b)
s=l//a
t=l//b

for i in range(math.gcd(N,M)):
    if S[i*s]!=T[i*t]:
        print(-1)
        sys.exit()
print(length)
Problem p03262 (python)

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

def devidable(numbers,i):
    for number in numbers:
        if number%i: return False
    return True

def gcd(numbers):
    i=min(numbers)
    while True:
        if devidable(numbers,i): return i
        else: i-=1

x.append(X)
x.sort()
y=[]

for i in range(len(x)-1):
    y.append(x[i+1]-x[i])
    
print(gcd(y))

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

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

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
    
x.append(X)
x.sort()
y=[]

for i in range(len(x)-1):
    y.append(x[i+1]-x[i])
    
print(gcd_list(y))
Problem p02553 (python)

Fixed submission:
a,b,c,d = input().split()
ans_list= []
ans_list.append(int(a)*int(c))
ans_list.append(int(a)*int(d))
ans_list.append(int(b)*int(c))
ans_list.append(int(b)*int(d))
print(max(ans_list))

Buggy submission (verdict: Runtime Error):
a,b,c,d = int(input().split())
ans_list= []
ans_list.append(a*c)
ans_list.append(a*d)
ans_list.append(b*c)
ans_list.append(b*d)
print max(ans_list)
Problem p02657 (python)

Fixed submission:
A, B = list(map(int, input().split()))
print(A * B)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
m = 1
for i in a:
  m = m*i
if m<= 10**18:
  print(m)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
A, B = list(map(int, input().split()))
print(A * B
Problem p02743 (python)

Fixed submission:
from decimal import *
a, b, c = map(int, input().split())
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
from decimal import *
a, b, c = map(int, input().split())
if decimal(a) + decimal(b) < decimal(c):
  print("Yes")
else:
  print("No")
Problem p02804 (python)

Fixed submission:
#----------------------------------------------------------
P = 10**9 + 7
N = 500000 #使える最大値、値に注意
inv = [0] + [1] # 1/x
finv = [1] + [1] # 1/x!
fac = [1] + [1] # x!
for i in range(2,N):
  inv += [inv[P % i] * (P - int(P / i)) % P]
  fac += [(fac[i-1] * i) % P]
  finv += [(finv[i-1] * inv[i]) % P]

def comb(a, b):
    if a<b:
        return -1 # error
    return (fac[a] * ((finv[b] * finv[a-b]) % P)) %P
#----------------------------------------------------------

n, k = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a, key=lambda x: x, reverse=False)
ans = 0
# a[i]が最小値になる場合の数
for i in range(len(a)):
    tmp = comb(n-1-i, k-1)
    if tmp<0:
        continue
    if a[i] < 0:
        ans = (ans + (abs(a[i])*tmp)%P)%P
    else:
        ans = (ans - (abs(a[i])*tmp)%P + P)%P

# a[i]が最大値になる場合の数
for i in range(len(a)):
    tmp = comb(n-1-i, k-1)
    if tmp<0:
        continue
    if a[n-1-i] < 0:
        ans = (ans - (abs(a[n-1-i])*tmp)%P + P)%P
    else:
        ans = (ans + (abs(a[n-1-i])*tmp)%P)%P
print(ans)

Buggy submission (verdict: Runtime Error):
#----------------------------------------------------------
P = 10**9 + 7
N = 10000
inv = [0] + [1] # 1/x
finv = [1] + [1] # 1/x!
fac = [1] + [1] # x!
for i in range(2,N):
  inv += [inv[P % i] * (P - int(P / i)) % P]
  fac += [(fac[i-1] * i) % P]
  finv += [(finv[i-1] * inv[i]) % P]

def comb(a, b):
    if a<b:
        return -1 # error
    return (fac[a] * ((finv[b] * finv[a-b]) % P)) %P
#----------------------------------------------------------

n, k = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a, key=lambda x: x, reverse=False)
ans = 0
# a[i]が最小値になる場合の数
for i in range(len(a)):
    tmp = comb(n-1-i, k-1)
    if tmp<0:
        continue
    if a[i] < 0:
        ans = (ans + (abs(a[i])*tmp)%P)%P
    else:
        ans = (ans - (abs(a[i])*tmp)%P + P)%P

# a[i]が最大値になる場合の数
for i in range(len(a)):
    tmp = comb(n-1-i, k-1)
    if tmp<0:
        continue
    if a[n-1-i] < 0:
        ans = (ans - (abs(a[n-1-i])*tmp)%P + P)%P
    else:
        ans = (ans + (abs(a[n-1-i])*tmp)%P)%P
print(ans)
Problem p02839 (python)

Fixed submission:
import sys
def main():
    input=sys.stdin.readline
    h,w=map(int,input().split())
    a=[list(map(int,input().split())) for _ in range(h)]
    b=[list(map(int,input().split())) for _ in range(h)]
    ofset = 80*164
    mask = (1 << (ofset*2)) - 1
    dp=[[0 for i in range(w)] for j in range(h)]
    dp[0][0] |= 1 << (a[0][0] - b[0][0] + ofset)
    dp[0][0] |= 1 << (b[0][0] - a[0][0] + ofset)
    for i in range(h):
        for j in range(w):
            if i < h - 1:
                A = abs(a[i+1][j] - b[i+1][j])
                dp[i+1][j] |= (dp[i][j] << A) & mask
                dp[i+1][j] |= (dp[i][j] >> A) & mask
            if j < w - 1:
                A = abs(a[i][j+1] - b[i][j+1])
                dp[i][j+1] |= (dp[i][j] << A) & mask
                dp[i][j+1] |= (dp[i][j] >> A) & mask
    ans = 10000000000
    for i in range(ofset, 80*330):
        if (dp[h-1][w-1]>>i)&1: ans = min(ans, i - ofset)
    for i in range(ofset):
        if (dp[h-1][w-1]>>i)&1: ans = min(ans, ofset - i)
    print(ans)
if __name__=='__main__':
  main()

Buggy submission (verdict: Runtime Error):
import sys
def main():
    input=sys.stdin.readline
    h,w=map(int,input().split())
    a=[list(map(int,input().split())) for _ in range(h)]
    b=[list(map(int,input().split())) for _ in range(h)]
    
    ofset = 80*164
    #mask = (1 << (ofset*2)) - 1
    dp=[[0 for i in range(w)] for j in range(h)]
    dp[0][0] |= 1 << (a[0][0] - b[0][0] + ofset)
    dp[0][0] |= 1 << (b[0][0] - a[0][0] + ofset)
    """
    for i in range(h):
        for j in range(w):
            if i < h - 1:
                A = abs(a[i+1][j] - b[i+1][j])
                dp[i+1][j] |= (dp[i][j] << A)
                dp[i+1][j] |= (dp[i][j] >> A)
            if j < w - 1:
                A = abs(a[i][j+1] - b[i][j+1])
                dp[i][j+1] |= (dp[i][j] << A)
                dp[i][j+1] |= (dp[i][j] >> A)
    ans = 10000000000
    """
    for i in range(ofset, 80*330):
        if (dp[h-1][w-1]>>i)&1:
            ans = i - ofset
            break
    for i in reversed(range(ofset)):
        if (dp[h-1][w-1]>>i)&1:
            ans = min(ans, ofset - i)
            break
    print(ans)
    
if __name__=='__main__':
  main()
Problem p02848 (python)

Fixed submission:
n = int(input())
s = list(input())
for i in range(len(s)):
  c = (ord(s[i]) + n - ord('A')) % 26
  c += ord('A')
  s[i] = chr(c)
print("".join(s))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
for i in range(len(s)):
  c = (ord(s[i]) + n - ord('A')) % 26
  c += ord('A')
  s[i] = chr(c)
 print(s)
Problem p02918 (python)

Fixed submission:
n, k = map(int, input().split())
s = input()
segment = 0
now = '#'
ans = 0
for i in s:
    if i!=now:
        segment+=1
        now = i
    else:
        ans+=1
for i in range(k):
    t = 0
    if segment > 2:
        t = 2
    elif segment == 2:
        t = 1
    segment, ans = segment-t, ans+t
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
segment = 0
now = '#'
ans = 0
for i in range(s):
    if i==now:
        segment+=1
        now = i
    else:
        ans+=1
for i in range(k):
    t = 0
    if segment > 2:
        t = 2
    elif segment == 2:
        t = 1
    segment, ans = segment-t, ans+t
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
segment = 0
now = '#'
ans = 0
for i in range(s):
    if i=now:
        segment+=1
        now = i
    else:
        ans+=1
for i in range(k):
    t = 0
    if segment > 2:
        t = 2
    elif segment == 2:
        t = 1
    segment, ans = segment-t, ans+t
print(ans)
Problem p03048 (python)

Fixed submission:
import numpy as np
R, G, B, N = map(int, input().split())
r = np.arange(0, int(N/R)+1)
g = np.arange(0, int(N/G)+1)
rg = r[:, np.newaxis]*R+g[np.newaxis, :]*G
mask = (rg<=N) & ((N-rg)%B==0)
print(np.sum(mask))

Buggy submission (verdict: Runtime Error):
import numpy as np
import pandas as pd

R, G, B, N = map(int, input().split())
r = np.arange(0, int(N/R)+1)
g = np.arange(0, int(N/G)+1)
rg = r[:, np.newaxis]*R+g[np.newaxis, :]*G
mask = (rg<=N) & ((N-rg)%B==0)
print(np.sum(mask))
Problem p03192 (python)

Fixed submission:
N = input()
count = 0
for i in range(len(N)):
    if N[i] == '2':
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [0 for i in range(N)]
for i in range(N):
    a[i] = int(input())
dp = [0 for i in range(N + 1)]
dp[0] = 0
for i in range(N):
    dp[i + 1] = (dp[i] + a[i]) % 2
if dp[i] == 1:
    print("first")
elif dp[i] == 0:
    if a[i] % 2 == 0:
        flag = 0
        for i in range(N):
            if a[i] == 1:
                flag = 1
        if flag == 1:
            print("first")
        else:
            print("second")
    else:
        print("first")
Problem p03195 (python)

Fixed submission:
N = int(input())
a = [0 for i in range(N)]
for i in range(N):
    a[i] = int(input())
dp = [0 for i in range(N + 1)]
dp[0] = 0
for i in range(N):
    dp[i + 1] = (dp[i] + a[i]) % 2
if dp[i] == 1:
    print("first")
elif dp[i] == 0:
    if a[i] % 2 == 0:
        flag = 0
        for i in range(N):
            if a[i] % 2 == 1:
                flag = 1
        if flag == 1:
            print("first")
        else:
            print("second")
    else:
        print("first")

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [0 for i in range(N)]
for i in range(N):
    a[i] = int(input())
dp = [0 for i in range(N + 1)]
dp[0] = 0
for i in range(N):
    dp[i + 1] = (dp[i] + a[i]) % 2
if dp[i] == 1:
    print("first")
elif dp[i] == 0:
    if a[i] % 2 == 0:
        ffag = 0
        for i in range(N):
            if a[i] == 1:
                flag = 1
        if flag == 1:
            print("first")
        else:
            print("second")
    else:
        print("first")
Problem p03219 (python)

Fixed submission:
a = list(map(int, input().split()))
print(int(a[0] + a[1]/2))

Buggy submission (verdict: Runtime Error):
a = input().split()
print(a[0] + a[1]/2)
Problem p03433 (python)

Fixed submission:
n = int(input())
a = int(input())
k = n%500<=a
print('Yes' if k else 'No')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = int(input())
k = N%500<=a
print('Yes' if k else 'No')
Problem p03525 (python)

Fixed submission:
def ans_is_zero():
    print(0)
    exit(0)

def solve():
    n=int(input())
    if n > 23: ans_is_zero()

    d=list(map(int,input().split()))
    for num in d:
        if num == 0: ans_is_zero()

    ans=0

    N = 1 << n
    for i in range(N):#left or right
        t=1
        ret = 100
        for j in range(n):
            if (i>>j)&1: num = d[j]
            else: num = 24 - d[j]

            if (t >> num)&1:
                ret = -1
                break
            t |= (1 << num)
        
        if ret == -1:
            continue

        if bin(t).count("1") < n + 1:#重複あり
            continue

        prev = 0
        for j in range(1, 24):
            if ((t>>j)&1) == 0: continue
            ret = min(ret, j - prev)
            prev = j

        ret = min(ret, 24-prev)
        ans = max(ans, ret)
    print(ans)
solve()

Buggy submission (verdict: Runtime Error):
def ans_is_zero():
    print(0)
    exit(0)

def solve():
    n=int(input())
    if n > 23: ans_is_zero()

    d=list(map(int,input().split()))
    for num in d:
        if num == 0: ans_is_zero()

    ans=0

    N = 1 << n
    for i in range(N):#left or right
        t=1

        for j in range(n):
            if (i>>j)&1: num = d[j]
            else: num = 24 - d[j]

            if (t >> num)&1:
                ret = -1
                break
        if ret == -1:
            continue

        if bin(t).count("1") < n + 1:#重複あり
            continue

        ret = 100
        prev = 0
        for j in range(1, 24):
            if ((t>>j)&1) == 0: continue
            ret = min(ret, j - prev)
            prev = j

        ret = min(ret, 24-prev)
        ans = max(ans, ret)
    print(ans)
solve()
Problem p03547 (python)

Fixed submission:
a, b = input().split()
d = {'A':0, 'B':1, 'C':2,'D':3, 'E':4, 'F':5}
if d[a]>d[b]:
    print('>')
elif d[a]<d[b]:
    print('<')
else:
    print('=')

Buggy submission (verdict: Runtime Error):
a, b = input().split()
d = {'A':0, 'B':1, 'C':2,'D':3, 'E':4}
if d[a]>d[b]:
    print('>')
elif d[a]<d[b]:
    print('<')
else:
    print('=')
Problem p02909 (python)

Fixed submission:
S=input()
if S=="Sunny":
    print("Cloudy")
elif S=="Cloudy":
    print("Rainy")
else:
    print("Sunny")

Buggy submission (verdict: Runtime Error):
import heapq
N,M=map(int, input().split())
A=list(map(int, input().split()))
for i in range(N):
    A[i]=-1*A[i]
heapq.heapify(A)
for i in range(M):
    q=heapq.heappop(A)
    q=q/2
    heapq.heappush(A,q)
ans=0
for i in range(N):
    ans+=-1*int(A[i])
print(ans)
Problem p02922 (python)

Fixed submission:
A,B=map(int,input().split())
if B==1:
    ans=0
elif 1<B and B<=A:
    ans=1
else :
    for k in range(2,100):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
ans=(B-1)//(A-1)
print(ans)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
ans=(A+B-3)//(A-1)
print(ans)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
ans=(A-1+B-1-1)//(A-1)
print(ans)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
ans=(A+B-1)//B
print(ans)

Buggy submission (verdict: Runtime Error):

A=int(input())
B=int(input())

if B<=A:
    ans=1
else:
    for k in range(2,100):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())

if B<=A:
    ans=1
else:
    for k in range(2,31):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
ans=(A+B-1)//A
print(ans)