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

Fixed submission:
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO"

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]
Problem p03852 (python)

Fixed submission:
c=input()
if c in "aiueo":
    print("vowel")
else:
    print("consonant")

Buggy submission (verdict: Runtime Error):
c=input()
x=[a,e,i,o,u]
if x in c:
    print("vowel")
else:
    print("consonant")
Problem p03860 (python)

Fixed submission:
s=input()
print('A'+s[8]+'C')

Buggy submission (verdict: Runtime Error):
a,b,c=imput().split()
print('A'+b[0]+'C')
Problem p02772 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans="APPROVED"
for i in range (n):
  if a[i]%2==0:
    if a[i]%3!=0 and a[i]%5!=0:
      ans="DENIED"
    
    
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans="APPROVED"
for i in range n:
  if a[i]%2==0:
    if a[i]%15!=0:
      ans="DENIED"
    
print(ans)
Problem p02778 (python)

Fixed submission:
s=input()
a=len(s)
print("x"*a)

Buggy submission (verdict: Runtime Error):
s=input()
a=len(s)
print(x*a)
Problem p02783 (python)

Fixed submission:
H,A =map(int,input().split())
print(H//A+(1 if not H%A==0 else 0))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=sum(map(int,input().split()))
print("Yes" if a>=s else "No")

Buggy submission (verdict: Runtime Error):
H,A =map(int,input())
print((H//A)+1)
Problem p02784 (python)

Fixed submission:
a,b=map(int,input().split())
s=sum(map(int,input().split()))
print("Yes" if s>=a else "No")

Buggy submission (verdict: Runtime Error):
a,b = input().split()
 
print(min(a*int(b),b*int(a) ) )

Buggy submission (verdict: Runtime Error):
a,b = input().split()
 
print(min(a*int(b),b*int(a) ) )

Buggy submission (verdict: Runtime Error):
a,b =　input().split()
 
print(min(a*int(b),b*(int(a) ) )

Buggy submission (verdict: Runtime Error):
a,b　=　input().split()
 
print(min(a*int(b),b*(int(a)))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=sum(map(int,input().split()))
print("Yes" ifs>=a else "No")
Problem p02789 (python)

Fixed submission:
N,M=map(int,input().split())
print("Yes" if N==M else "No")

Buggy submission (verdict: Runtime Error):
a, b=input().split()
 
print(min(a＊(int(b)),b＊(int(a) ) )

Buggy submission (verdict: Runtime Error):
a, b=input().split()
 
print(min(a*(int(b)),b*(int(a) ) )

Buggy submission (verdict: Runtime Error):
a,b=input().split()
 
print(min(a*int(b),b*(int(a) ) )

Buggy submission (verdict: Runtime Error):
a,b=input().split()
print(min(a*int(b),b*(int(a)))
Problem p02801 (python)

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

Buggy submission (verdict: Runtime Error):
n,k,m=map(int,input().split())
a=list((map(int,input(),split()))
ans=max(0,n*m-sum(a))
print(ans if n*m-s<=k else -1)

Buggy submission (verdict: Runtime Error):
c=input()
print(chr(ord(c)+1)
Problem p02909 (python)

Fixed submission:
weather=["Rainy","Cloudy","Sunny"]
print(weather[-1+weather.index(input())])

Buggy submission (verdict: Runtime Error):
weather=["Sunny","Cloudy","Rainy"]
print(weather[1+weather.index(input())]

Buggy submission (verdict: Runtime Error):
weather=["Sunny","Cloudy","Rainy"]
print(chr(1+(weather.index(input))))
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
print((a+b)//2 if (a+b)%2==0 else "IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
k=(a+b)//2
print(k if ((a>=k and b<=k) or (a<=K and b>=k)) and k%2==0 else "IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
k=(a+b)/2
print(k if ((a>=k and b<=k) or (a<=K and b>=k)) and k%2==0 else "IMPOSSIBLE")
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
print(input（）.count('1'))

Buggy submission (verdict: Runtime Error):
print(input（）.count('1'))

Buggy submission (verdict: Runtime Error):
print(input.count('1'))
Problem p03681 (python)

Fixed submission:
N,M = map(int,input().split())
ans = 1
if abs(N-M) >= 2:
  print(0)
elif abs(N-M) == 1:
  for i in range(1,min(N,M)+1):
    ans *= i
    ans = ans % (10**9 + 7)
  ans = ans**2 * max(N,M)
  ans = ans % (10**9 + 7)
  print(ans)
elif abs(N-M) == 0:
  for i in range(1,N+1):
    ans *= i
    ans = ans % (10**9 + 7)
  ans = ans**2
  ans *= 2
  ans = ans % (10**9 + 7)
  print(ans)

Buggy submission (verdict: Runtime Error):
ans = 1
if abs(N-M) >= 2:
  print(0)
elif abs(N-M) == 1:
  for i in range(1,min(N,M)+1):
    ans *= i
    ans = ans % (10**9 + 7)
  ans = ans**2 * max(N,M)
  ans = ans % (10**9 + 7)
  print(ans)
elif abs(N-M) == 0:
  for i in range(1,N+1):
    ans *= i
    ans = ans % (10**9 + 7)
  ans = ans**2
  ans *= 2
  ans = ans % (10**9 + 7)
  print(ans)
Problem p03059 (python)

Fixed submission:
A, B, T = map(int, input().split())
print(int(((T+0.5)//A)*B))

Buggy submission (verdict: Runtime Error):
A, B, T = map(int, input().split())
print(((T+0.5)//B)*a)
Problem p03494 (python)

Fixed submission:
input()
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
    A = [a/2 for a in A]
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
input()
A = list(map(int, input().split()))
count == 0
while all(a % 2 == 0 for a in A)
	A == [a/2 for a in A]
  	count += 1
print(count)
Problem p02646 (python)

Fixed submission:
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
if a >=0 and b>=0 :
    if a+v*t >= b+ w*t:
        print("YES")
    else:
        print("NO")
elif a <0 and b >=0:
    if a+v*t >= b + w*t:
        print("YES")
    else :
        print("NO")
else :
    if -a+v*t >= -b + w*t:
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
if a >=0 and b>=0 :
    if a+v*t >= b+ w*t:
        print("YES")
    else:
        print("NO")
elif a < 0 and b >= 0 :
    if -a+v*t >= b + w*t:
        print("YES")
    else :
        print("NO")
else :
    if v*t - w*t >= -(a-b):
        print("YES")
    else :
        print("NO")
Problem p02675 (python)

Fixed submission:
a=input()
b=(a[-1])
if b == "3":
  print("bon")
elif b == "0" or b =="1" or b =="6" or b =="8":
  print("pon")
else :
  print("hon")

Buggy submission (verdict: Runtime Error):
a=int(print())
b=print(a[-1])
if b == 3:
  print(a+"bon")
elif b ==0 or 1 or 6 or 8:
  print(a+"pon")
else :
  print(a+"hon")
Problem p02681 (python)

Fixed submission:
n=input()
m=input()

M=(m[:-1])
if n ==M :
  print("Yes")
else : 
  print("No")

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

if a + b >= k :
    print(a)
elif a > k :
    print(k)
else :

    print(2*a - k + b)
Problem p03448 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if 500 * i + 100 * j + 50 * k == x:
                ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, c, x = list(map(int,input().split()))
ans = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if 500 * i + 100 * j + 50 * k == x:
                ans += 1
print(ans)
Problem p02612 (python)

Fixed submission:
N=int(input())
an=N//1000
ans=(an+1)*1000-N
if N%1000==0:
  print(0)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
an=N//1000
ans=(an+1)*1000-N
if an==0:
  print(0)
else:
  print(ans)
Problem p02628 (python)

Fixed submission:
N,K=map(int,input().split())
P=list(map(int,input().split()))
P=sorted(P)
ans=0
for i in range(K):
    ans+=P[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
P=list(map(int,input().split()))
P=sorted(P)
ans=0
for i in range(K):
    ans+=P(i)
print(ans)
Problem p02630 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
BC = []
for i in range(Q):
    BC.append(list(map(int,input().split())))

num = [0]*(10**5+1)

S = []
 
#1 iterlation
S.append(sum(A))
for i in range(N):
    num[A[i]]+=1

    
for j in range(Q):
    if num[BC[j][0]] != 0:
        #Bに当たる交換するものがある時
        B = BC[j][0]
        C = BC[j][1]
        S.append(S[-1] + (C - B)*num[B] )
        #S[-1]で合計の一番最新のもの
        dammy = num[B]
        num[B] = 0
        num[C] += dammy
 
    else:
        B = BC[j][0]
        C = BC[j][1]
        S.append(S[-1])

        
for i in range(1,Q+1):
    print(S[i])

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

trans=[[] for _ in range(Q)]
for i in range(Q):
    B,C=map(int,input().split())
    trans[i].append(B)
    trans[i].append(C)

S=sum(A)
#まずはじめの合計求める

num=[0]
#これに数の出現回数をプロットする
for i in range(1,10**5+1):
    cnt=A.count(i)
    num[i]=cnt

for i in range(Q):
    B=trans[i][0]
    C=trans[i][1]
    change=num[B]*(C-B)
    num[C]+=num[B]
    num[B]-=num[B]
    S+=change
    print(S)
Problem p02641 (python)

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

if N==0:
    print(X)
else:
    if X<min(P):
        ans=X
        print(ans)
    
    elif X in range(min(P),max(P)+1):
        #大した大きい数じゃないので全探索すればいい
        ans_len=200 #ひとまずの仮定
        for i in range(250):
            if i in P:
                continue
            else:
                l=abs(X-i)
                if l < ans_len:
                    ans_len=l
                    ans=i
        print(ans)
                
    else:
        ans=X
        print(ans)

Buggy submission (verdict: Runtime Error):
X,N=map(int,input().split())
P=list(map(int,input().split()))
 
if N==0:
    print(X)
else:
    if X<min(P):
        ans=X
        print(ans)
    
    elif X in range(min(P),max(P)+1):
        #大した大きい数じゃないので全探索すればいい
        ans_len=200 #ひとまずの仮定
        for i in range(min(P),max(P)+1):
            if i in P:
                continue
            else:
                l=abs(X-i)
                if l < ans_len:
                    ans_len=l
                    ans=i
        print(ans)
                
    else:
        ans=X
        print(ans)

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

if N==0:
    print(X)
else:
    if X<min(P):
        ans=X
        print(ans)
    
    elif X in range(min(P),max(P)+1):
        #大した大きい数じゃないので全探索すればいい
        ans_len=200 #ひとまずの仮定
        for i in range(min(P),max(P)+1):
            if i in P:
                continue
            else:
                l=abs(X-i)
                if l < ans_len:
                    ans_len=l
                    ans=i
        print(ans)
                
    else:
        ans=X
        print(ans)

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

if N==0:
    print(X)
    exit(0)

if X<min(P):
    ans=X
    print(ans)
    
elif X in range(min(P),max(P)+1):
    #大した大きい数じゃないので全探索すればいい
    ans_len=200 #ひとまずの仮定
    for i in range(min(P),max(P)+1):
        if i in P:
            continue
        else:
            l=abs(X-i)
            if l < ans_len:
                ans_len=l
                ans=i
    print(ans)
                
else:
    ans=X
    print(ans)

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

if N==0:
    print(X)
    exit()

if X<min(P):
    ans=X
    print(ans)
    
elif X in range(min(P),max(P)+1):
    #大した大きい数じゃないので全探索すればいい
    ans_len=200 #ひとまずの仮定
    for i in range(min(P),max(P)+1):
        if i in P:
            continue
        else:
            l=abs(X-i)
            if l < ans_len:
                ans_len=l
                ans=i
    print(ans)
                
else:
    ans=X
    print(ans)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans=1
for i in range(N):
  ans*=i
if ans > 10**18:
  print(-1)
else:
  print(ans)
Problem p02658 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
if 0 in A:
    print(0)
else:
    ans=1
    for i in range(N):
        ans*=A[i]
        if ans >10**18:
            break
    if ans > 10**18:
      print(-1)
    else:
      print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=map(int,input().split())
ans=1
for i in range(N):
  ans*=A[i]
  if ans > 10**18:
    break
if ans > 10**18:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=map(int,input().split())
ans=1
for i in range(N):
  ans*=A[i]
if ans > 10**18:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(mao(int,input().split()))
ans=1
for i in range(N):
  ans*=i
if ans > 10**18:
  print(-1)
else:
  print(ans)
Problem p02675 (python)

Fixed submission:
N=int(input())

def yomikata(N):
    N_firstdigit=N%10
    if N_firstdigit==3:
        print("bon")
    #elif N_firstdigit==0 or 1 or 6 or 8: このように条件は省略して書いてはだめらしい!
    elif N_firstdigit==0 or N_firstdigit==1 or N_firstdigit==6 or N_firstdigit==8:
        print("pon")
    else:
        print("hon")
        
yomikata(N)

Buggy submission (verdict: Runtime Error):
#この解答を自分で写経してみる
N,M=map(int,input().split())
AB=[map(int,input().split()) for _ in range(M)]
#map関数を格納したリストを作る
#この_表記で繰り返すという文化に慣れよう

links=[[] for _ in range(N+1)]
#移動先を出力する
#リストの入れ子にしたかったら、最初から入れ子として定義しないといけない
#何か + for _ in range(M)　で、何かをM回繰り返す
for a,b in AB:
#map関数それぞれに対して、値を抽出する
    links[a].append(b)
    links[b].append(a)

from collections import deque
result=[-1]*(N+1)
#これで[-1,-1,,,]のリストは作れる
#各部屋ごとの出力先

q=deque([1])
#始点の定義
while len(q)>0:
    i=q.popleft()
    for j in links[i]:
        if result[j] ==-1:
            result[j] = i
            #新しいものをどんどん加えていくことで、層がどんどん深くなっていく
            q.append(j)
print("yes")
print("\n".join(str(i) for i in result[2:] ))

Buggy submission (verdict: Runtime Error):
K=int(input())
S=input()

def moji(S,K):
    if len(S)<=K:
        print(S)
    else:
        T=""
        for i in range(len(S)):
            if i <K:
                 T+=S[i]
            if i >=K:
                continue
        T+="..."
        print(T)

moji(S,K)

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

def yomikata(N):
    N_firstdigit=N%10
    if N_firstdigit==3:
        print("bon")
    #elif N_firstdigit==0 or 1 or 6 or 8: このように条件は省略して書いてはだめらしい!
    elif N_firstdigit==0 or N_firstdigit==1 or N_firstdigit==6 or N_firstdigit==8:
        print("pon")
    else:
        print("hon")
        
yomikata(N)

Buggy submission (verdict: Runtime Error):
def yomikata(N):
    N_firstdigit=N%10
    if N_firstdigit==3:
        print("bon")
    elif N_firstdigit==0 or 1 or 6 or 8:
        print("pon")
    else:
        print("hon")

yomikata(N)

Buggy submission (verdict: Runtime Error):
def yomikata(N):
    N_firstdigit=N%10
    if N_firstdigit==3:
        print("bon")
    elif N_firstdigit==0 or 1 or 6 or 8:
        print("pon")
    else:
        print("hon")

yomikata(N)
Problem p03031 (python)

Fixed submission:
N, M = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(M)]  #sの各要素のはじめはk
p = list(map(int, input().split()))
ans = 0

# 0をoffとして2進数でパターンを表現

for i in range(2 ** N):
    ptn = bin(i)[2:].rjust(N, "0")  # N桁の2進表現にする,さらに0を足している（左に）
    light = True  # 着目している電球が点灯していないときはこれがFalseになる
    for j in range(M):
        tmp = 0  # 着目している電球について、スイッチのonの個数をカウントする
        for n in range(1, s[j][0] + 1):
            if ptn[s[j][n] - 1] == "1":
                tmp += 1
        if tmp % 2 != p[j] % 2:
            light = False
    if light:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
#１行目の『N M』の取得
N,M=map(int,input().split())

#2-(M+1)行目の取得
switch_li=[[] for _ in range(M)] 
#M個の入れ子のリスト、スイッチの個数、スイッチ何がついているか
for i in range(M):
    li=list(map(int,input().split()))
    switch_li[i].extend(li)
    #appendではなくてextendを使ってリストを展開してから結合する

#スイッチの個数は正直データとして要らないので消す
#del li[0] で値消せる
for i in range(M):
    del switch_li[i][0]
#これでついているスイッチだけを格納したM列の入れ子リストができた

#M+2行目のPの取得
P=list(map(int,input().split()))

#スイッチのつき方の全探索する
#スイッチはN個あり、それが着くか付かないかで、場合の数は、2**N通り
switch_bit=[[] for _ in range(2**N)]
for i in range(2**N):
    for j in range(N):
        if (i>>j)&1==1:
            switch_bit[i].append(j+1)
        else:
            continue
#これで全ての組み合わせを抽出できた（スイッチonのものだけが記載される）

#switch_bitそれぞれについて条件を満たすのかどうか判定する
#まずスイッチ3で考えてみる(具体的でまず考えた方がわかりやすい)、その後それを一般化する
#switch_li{2}の要素をfor文で回して、スイッチonのものに含まれている場合は、リストに追加する
#それを最後に2で割って値を比べる
#まずスイッチ３のままコード書いてあとでそれを修正する
#今は何かスイッチ光っているものが入力されているとする（ここではswitch_bit[i]とする）
#実際実行することを考えると、iでスイッチ光るものを固定（switch_bit）し、j=3でスイッチを固定して光るかどうか判定する


#スイッチのつく組みが与えられている時に、電球がつくかどうか判定する関数を作る
def light_or_not(x,i):
    li=[]
    for k in switch_li[x-1]:
        if k in switch_bit[i]:
            li.append(k)
        else:
            continue
    if len(li)==0:
        return False
    elif len(li)%2==P[x-1]:
        return True
    else:
        return False
    
ans=0
for i in range(2**N):
    for j in range(1,N+2):
        if j==N+1:
            ans+=1
        elif light_or_not(j,i):
            continue
        else:
            break
print(ans)
Problem p03006 (python)

Fixed submission:
from collections import Counter

N = int(input())

xys = []
for _ in range(N):
    xys.append(tuple(map(int, input().split())))

sub = []
for x1, y1 in xys:
    for x2, y2 in xys:
        if x1 != x2 or y1 != y2:
            sub.append((x1 - x2, y1 - y2))

if not sub:
    print(1)
    exit(0)

c = Counter(sub)
m = max(c.values())

print(N - m)

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

N = int(input())

xys = []
for _ in range(N):
    xys.append(tuple(map(int, input().split())))

sub = []
for x1, y1 in xys:
    for x2, y2 in xys:
        if x1 != x2 or y1 != y2:
            sub.append((x1 - x2, y1 - y2))

c = Counter(sub)
m = max(c.values())

print(N - m)
Problem p03087 (python)

Fixed submission:
import numpy as np

N, Q = map(int, input().split())
S = input()
ls, rs = [], []
for _ in range(Q):
    l, r = input().split()
    ls.append(int(l)-1)
    rs.append(int(r)-1)

arr = np.zeros(N, np.int)
# flag = False
# for i in range(N):
#     if S[i] == 'A':
#         flag = True
#     elif S[i] == 'C' and flag:
#         arr[i - 1] = 1
#     else:
#         flag = False
for i, (a, c) in enumerate(zip(S, S[1:])):
    if a == 'A' and c == 'C':
        arr[i] = 1

cum = np.cumsum(arr)

for l, r in zip(ls, rs):
    if l == 0:
        print(cum[r-1])
    else:
        print(cum[r-1] - cum[l-1])

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

N, Q = map(int, input().split())
S = input()
ls, rs = [], []
for _ in range(Q):
    l, r = map(int, input().split())
    ls.append(l-1)
    rs.append(r-1)

arr = np.zeros(N, np.int)
# flag = False
# for i in range(N):
#     if S[i] == 'A':
#         flag = True
#     elif S[i] == 'C' and flag:
#         arr[i - 1] = 1
#     else:
#         flag = False

for i, a, c in enumerate(zip(S, S[1:])):
    if a == 'A' and c == 'C':
        arr[i] = 1

for l, r in zip(ls, rs):
    print(np.sum(arr[l:r]))
Problem p02658 (python)

Fixed submission:
import numpy as np
N = int(input())
list = list(map(int,input().split()))
ans = np.prod(list)
if ans > 10**18 or ans == 0:
  ans = -1
if 0 in list:
  ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a,b = input().split()
n = b.find('.')
if n > 0:
  bi = int(b[:n])
  bf = int(b[n+1:])
else:
  bi,bf = int(b),0
  
ans = str(math.floor(int(a)*(bi*100+bf)))
N = ans.find('.')
if N > 0:
  ai = int(ans[:n-2])
else:
  ai = int(int(ans)/100)
print(ai)

Buggy submission (verdict: Runtime Error):
import math
a,b = input().split()
n = b.find('.')
if n > 0:
  bi = int(b[:n])
  bf = int(b[n+1:])
else:
  bi,bf = int(b),0
  
ans = str(math.floor(int(a)*(bi*100+bf)))
N = ans.find('.')
if N > 0:
  ai = int(ans[:n-2])
else:
  ai = int(ans/100)
print(ai)
Problem p03106 (python)

Fixed submission:
A,B,K = map(int,input().split())
count = min(A,B)
k = 0
while count > 0:
  if A%count == 0 and B%count == 0:
    k += 1
  if k == K:
    print(count)
    break
  else:
    count -= 1

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
count = min(A,B)
k = 0
while count > 0:
  if A%count == 0 nad B%count == 0:
    k += 1
  if k == K:
    print(count)
    break
  else:
    count -= 1
Problem p03545 (python)

Fixed submission:
Astr = input()
Aint = [0]*4
for i in range(4):
  Aint[i] = int(Astr[i])
q = [1,1,1]
ans = 7-Aint[0]

while sum(q) != -3:
  a = [0]*3
  for i in range(3):
    a[i] = Aint[i+1]*q[i]
  if sum(a) == ans:
    print(str(Aint[0])+"{:+}{:+}{:+}".format(a[0],a[1],a[2])+"=7")
    break
  elif q[2] == 1:
    q[2] = -1
  elif q[1] == 1:
    q[1] = -1
    q[2] = 1
  else:
    q[0] = -1
    q[1] = 1
    q[2] = 1

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int,list(input()))
s = (sum([A,B,C,D])-7)//2
c = [1,1,1]
for a,n in enumerate([A,B,C,D]):
  if s == n:
    c[i] = -1
    s = 0
  else:
    for i in [1,-1]:
      for j in [1,-1]:
        for k in [1,-1]:
          if A+B*i+C*j+D*k == 7:
            c[0] = i
            c[1] = j
            c[2] = k
            s = 0
            break
print(str(A)+'{:+}{:+}{:+}'.format(B*c[0],C*c[1],D*c[2])+"=7")
Problem p02645 (python)

Fixed submission:
S = input()
print(S[0]+S[1]+S[2])

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if W >= V:
    print("NO")
else:
    C = abs(A - B)
    X = V - W
    if C // X > T:
        print("NO")
    else:
        print("YES")
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = 1
for i in range(N):
    B = B * A[i]
    if B > 10 ** 18:
        print(-1)
        break
print(B)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
import numpy as np
B = np.prod(A)
if B <= 10 ** 18:
    print(B)
else:
    print(-1)
Problem p02658 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
prod = 1
def main()
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
    if prod > 1000000000000000000:
        print(-1)
        return
    print(prod)
main()

Buggy submission (verdict: Runtime Error):

N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    B = B * A[i]
    if B > 10 ** 18:
        print(-1)
        break
if B <= 10 ** 18:
    print(B)
Problem p02681 (python)

Fixed submission:
S = input()
T = input()
if T == S + T[-1]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
if T = S + T[-1]:
    print("Yes")
else:
    print("No")
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if X == 500 * a + 100 * b + 50 * c:
                count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
        if X == 500 * a + 100 * b + 50 * c:
            count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A + 1):
    for b in range(B + 1):
        fo c in range(C + 1):
        if X == 500 * a + 100 * b +50 * c:
            count = count + 1
print(count)