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

Fixed submission:
def isokay(S,T):
    if len(T)-len(S)!=1:
        return False
    else:
        for i in range(len(S)):
            if S[i]!=T[i]:
                return False
    return True

S=input()
T=input()

if isokay(S,T):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
x=str(input())
y=str(input())
def idx(x,y):
	if len(y)-len(x)!=1:
  		return False
	else:
  		for i in range(0,len(x)):
    		if x[i]!=y[i]:
      			return False
        return True
if idx(x,y):
  print("Yes")
else:
  print("No")
Problem p02921 (python)

Fixed submission:
s = input()
t = input()
count = 0
for i in range(3):
	if s[i] == t[i]:
		count += 1

print(count)

Buggy submission (verdict: Runtime Error):
s = input()
t = s[1]
s = s[0]
count = 0
for i in range(3):
	if s[i] == t[i]:
		count += 1

print(count)
Problem p02922 (python)

Fixed submission:
s = list(map(int,input().split()))
a = int(s[0])
b = int(s[1])

count = 0
while (b - (count*(a-1)+1)) > 0:
  count += 1
  
print(count)

Buggy submission (verdict: Runtime Error):
from sys import stdin
#a,b = [int(x) for x in stdin.readline().rstrip().split()]
"""
a,b = map(int,input().split())
s = input()
s = s.split(" ")
a = int(s[0])
b = int(s[1])
"""
s = list(map(int,input().split()))
a = int(s[0])
b = int(s[1])

count = 0
while b > 0:
  count += 1
  b -= (count*(a-1)+1):
    
print(count)

Buggy submission (verdict: Runtime Error):
from sys import stdin
a,b = [int(x) for x in stdin.readline().rstrip().split()]
"""
a,b = map(int,input().split())
s = input()
s = s.split(" ")
a = int(s[0])
b = int(s[1])
"""

count = 0
while b > 0:
  count += 1
  b -= (count*(a-1)+1):
    
print(count)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
"""
s = input()
s = s.split(" ")
a = int(s[0])
b = int(s[1])
"""

count = 0
while b > 0:
  count += 1
  b -= (count*(a-1)+1):
    
print(count)

Buggy submission (verdict: Runtime Error):
s = str(input())
s = s.split(" ")
a = int(s[0])
b = int(s[1])

count = 0
while b > 0:
  count += 1
  b -= (count*(a-1)+1):
    
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
s = s.split(" ")
a = int(s[0])
b = int(s[1])

count = 0
while b > 0:
  count += 1
  b -= (count*(a-1)+1):
    
print(count)
Problem p02969 (python)

Fixed submission:
r=int(input())
print(3*r*r)

Buggy submission (verdict: Runtime Error):
r=int(input())
return(3*r*r)
Problem p02971 (python)

Fixed submission:
N=int(input())
A=[int(input()) for n in range(N)]
m=max(A)
n=sorted(A,reverse=True)[1]
for i in range(N):
    if A[i]<m:
        print(m)
    else:
        print(n)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(input()) for n in range(N)]
#print(max(A[1:]))
#for i in range(1,N-1):
m=max(A)
for i in range(N):
	if A[i]<m:
    	print(m)
	else:
    	print(max(A[:i]+A[i+1:]))
#print(max(A[:N-1]))
Problem p02983 (python)

Fixed submission:
L,R=map(int,input().split())
# L <= i < j <= R
# (i*j)%2019 の最小値
M=[]
for i in range(L, R):
    for j in range(i+1, R+1):
        #print(i,j)
        M.append((i*j)%2019)
        if M[-1]==0:
            print(0)
            exit()
print(min(M))

Buggy submission (verdict: Runtime Error):
L,R=map(int,input().split())
# L <= i < j <= R
# (i*j)%2019 の最小値
M=[]
for i in range(L, R):
    for j in range(i+1, R+1):
        #print(i,j)
        M.append((i*j)%20119)
        if M[-1]==0:
			print(0)
		exit()
print(min(M))
Problem p03000 (python)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split()))
x=0
time=0
for i in range(N+1):
  if x<=X:
    time+=1
  if i<N:
    x+=L[i]
print(time)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
x=0
time=0
for i in range(N+1):
  if x<=X:
    time+=1
  if i<N:
    count+=1
print(time)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
x=0
time=0
while x<=X:
    x+=L[time]
    time+=1
print(time)
Problem p03399 (python)

Fixed submission:
train1=int(input())
train2=int(input())
bus1=int(input())
bus2=int(input())
print(min(train1,train2)+min(bus1,bus2))

Buggy submission (verdict: Runtime Error):
train1=int(input())
train2=int(input())
bus1=int(input())
bus2=int(input())
print(min(train1,train2)+min(bus1+bus2))
Problem p03844 (python)

Fixed submission:
s=input()
s=s.split(" ")
a=s[0]
b=s[1]+s[2]
print(int(a)+int(b))

Buggy submission (verdict: Runtime Error):
s=input()
a=s[0]
b=s[1]+s[2]
print(int(a)+int(b))
Problem p03944 (python)

Fixed submission:
W,H,N=map(int,input().split())
X=[w for w in range(W+1)]
Y=[h for h in range(H+1)]
for n in range(N):
    w,h,a=map(int,input().split())
    if a==1:
        X=[x for x in X if x>=w]
    elif a==2:
        X=[x for x in X if x<=w]
    elif a==3:
        Y=[y for y in Y if y>=h]
    else:
        Y=[y for y in Y if y<=h]
if len(X)<2 or len(Y)<2:
  print(0)
else:
  print((len(X)-1)*(len(Y)-1))

Buggy submission (verdict: Runtime Error):
W,H,N=map(int,input().split())
X=[w for w in range(W+1)]
Y=[h for h in range(H+1)]
#print(X,Y)
for n in range(N):
    w,h,a=map(int,input().split())
    if a==1:
        X=[x for x in X if x>=w]
    elif a==2:
        X=[x for x in X if x<=w]
    elif a==3:
        Y=[y for y in Y if y>=h]
    else:
        Y=[y for y in Y if y<=h]
    #print(X,Y)
#print(max(0,(len(X)-1)*(len(Y)-1)))
print(max(0,(X[-1]-X[0])*(Y[-1]-Y[0])))
Problem p04011 (python)

Fixed submission:
days=int(input())
k=int(input())
yen_until_k=int(input())
yen_after_k=int(input())
if days <= k:
  print(days*yen_until_k)
else:
  print(k*yen_until_k+(days-k)*yen_after_k)

Buggy submission (verdict: Runtime Error):
days=int(input())
k=int(input())
yen_until_k=int(input())
yen_after_k=int(input())
if days <= k:
  print(days*yen_until_k)
else:
  print(k*yen_until_k+(n-k)*yen_after_k)
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())

listans = ["0"] * n
ans = 0

for i in range(m):
    s, c = map(str, input().split())
    if n > 1 and s == "1" and c == "0":
        ans = -1
    if listans[int(s)-1] != c:
        if listans[int(s)-1] == "0":
            listans[int(s)-1] = c
        else :
            ans = -1

if ans == 0:
    if n > 1 and listans[0] == "0":
        listans[0] = "1"
    ans = int("".join(listans))

print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())

listans = [-1] * n
ans = 0

for i in range(m):
    s, c = map(int, input().split())
    if s == 1 and c == 0:
        ans = -1
    if listans[int(s)-1] != c:
        if listans[int(s)-1] == "0":
            listans[int(s)-1] = c
        else :
            ans = -1

if ans == 0:
    if n > 1 and listans[0] == "0":
        listans[0] = "1"
    ans = int("".join([str(li) for li in listans]))

print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())

listans = [0] * n
ans = 0

for i in range(m):
    s, c = map(str, input().split())
    if listans[int(s)-1] == 0:
        listans[int(s)-1] = int(c)
    elif listans[int(s)-1] != int(c):
        ans = -1

if listans[0] == 0:
    ans = -1
else :
    if ans == 0:
        ans = int("".join(listans))

print(ans)
Problem p02900 (python)

Fixed submission:
a, b = map(int, input().split())


while b:
    a, b = b, a % b

# aが最大公約数になっている

if a == 1 :
    print(1)
else :
    def factorization(a):
        arr = []
        temp = a
        for i in range(2, int(-(-a**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([a, 1])

        return arr

    print(int(len(factorization(a)) + 1))

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


while b:
    a, b = b, a % b

# aが最大公約数になっている

if a == 1 :
    print(1)
    exit

def factorization(a):
    arr = []
    temp = a
    for i in range(2, int(-(-a**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([a, 1])

    return arr

print(len(factorization(a) + 1))

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


while b:
    a, b = b, a % b

# aが最大公約数になっている

if a == 1 :
    print(1)
    break

def factorization(a):
    arr = []
    temp = a
    for i in range(2, int(-(-a**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([a, 1])

    return arr

print(len(factorization(a) + 1))
Problem p02909 (python)

Fixed submission:
w = input()

if w == 'Sunny' :
    print('Cloudy')
elif w == 'Cloudy' :
    print('Rainy')
else :
    print('Sunny')

Buggy submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
 
C = [0] * n
 
for a in range(q) :
    C[int(input())-1] += 1
 
sum_c = sum(C)
 
for i in range(n) :
    minus = sum_c - C[i]
    if minus < k :
        print('Yes')
    else :
        print('No')
Problem p03433 (python)

Fixed submission:
n = int(input())
a = int(input())

if n % 500 <=a :
    print('Yes')
else :
    print('No')

Buggy submission (verdict: Runtime Error):
c = []
c_diff = []
 
for i in range(3) :
    c.append([int(x) for x in input().split()])
 
for i in range(3) :
    c_diff.append([c[i][j] - c[i][0] for j in range(3)])
 
if c_diff[0] == c_diff[1] == c_diff[2] :
    print('Yes')
else :
    print('No')
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())

s = []

for i in range(n) :
    s.append(input())

s.sort()

print(*s, sep='')

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())

s = []

for i in range(l) :
    s.append(input())

s.sort()

print(*s, sep='')
Problem p02573 (python)

Fixed submission:
"""
UnionFindにはいろいろな実装があるが, 本問ではparents配列にノード数を保持する実装だと非常に簡単に解ける. 
以下のようにしてノード数を保持する.
自身が子のとき, 親ノード番号を格納する.
自身が根のとき, ノード数を負の数で格納する.
つまり,　負の数のときは自身が根であり, その絶対値がその木のノード数を表す.
初期化時は、すべてのノードを−1で初期化する.
"""

N,M = map(int,input().split())

#UnionFind木の実装
#-1で初期化し、併合のたびに-1していく
par = [-1] * N  #親
rank = [0] * N #木の深さ

#木の根を求める
def find(x):
    #par[x]が負のとき(自分が代表のとき)、自身を返す
    if par[x] < 0:
        return x
    else:
        return find(par[x])

#xとyの属する集合を併合
def unite(x,y):
    x = find(x)
    y = find(y)
    #もとから同じ集合のときは何もしない
    if (x == y):
        return
    #x側を常に小さくする
    if par[x] > par[y]:
            x, y = y, x
    
    #x側に併合する、その際xの代表にノード数を加算する
    par[x] += par[y]
    par[y] = x
    

#xとyが同じ集合に属するかどうか
def same(x,y):
    return find(x) == find(y)

for i in range(M):
    x,y = map(int,input().split())
    x -= 1; y -= 1
    unite(x,y)


ans = min(par)

print(abs(ans))

Buggy submission (verdict: Runtime Error):

#スタック、キューを使う
from collections import deque

N,M = map(int,input().split())

G = [ set() for row in range(N)]

for i in range(M):
    A,B = map(int,input().split())
    G[A-1].add(B-1)
    G[B-1].add(A-1)

for i in range(N):
    G[i] = set(G[i])

#1グループに所属する最大数
ans = 0

#友達グループの数
count = 0

#各頂点の状態を色で表す WHITE:未訪問 GRAY:訪問中 BLACK:訪問完了
color = ['WHITE' for i in range(N)]

#訪問途中の頂点を退避しておくスタック
S = deque()

#次の要素を取り出す
def next(u):    
    #G[u]に格納されているまだ未訪問のノードを返す
    for i in range(len(G[u])):
        if color[G[u][i]] == 'WHITE':
            return G[u][i]
    return -1

def dfs(u):
    #始点uをスタックに追加
    S.append(u)
    color[u] = 'GRAY'
    global count
    count += 1
    #dequeは空のとき偽を返す
    while S:
        u = S[-1]    #スタックの頂点をuに格納
        v = next(u)
        #uに未訪問の隣接ノードがある
        if v != -1:
            color[v] = 'GRAY'
            count += 1
            S.append(v)
        else:
            S.pop()
            color[u]='BLACK'

#未訪問のuを始点として深さ優先探索
for i in range(N):
    count = 0
    if color[i] == 'WHITE':
        dfs(i)
        if count >= ans:
            ans = count

print(ans)
Problem p02918 (python)

Fixed submission:

#L,Rの境界の数だけで処理を済ませる
#⇒いちいち書いてあるとおりに実装しない。

#内側の不幸な人を(RLの人)を消せば幸福な人が2人増える (全部Rに変えていくイメージ)
# ⇒着目するのは RL でも LR　でもどっちでもいい。
#  LRに注目する場合はこのあとのコードのRとLに関連する部分が逆になるだけ
#端っこなら１人増える
#幸福な人の最大値は N - 1

N,K = map(int,input().split())
S = input()

#端以外の人のせいで不幸な人の数
count = 0
#端の人のせいで不幸な人の数
edge_count = 0

#端のせいで不幸な人
if S[0] == 'L':
    edge_count += 1
if S[N-1] == 'R':
    edge_count += 1 

#端以外のせいで不幸になっている人の数を数える (RLを探す)
for i in range(N-1):
    if S[i] == 'R':
        if S[i+1] == 'L':
            count += 1

#最初の時点で幸せになれる人の数
happy = N  - (count*2 + edge_count)

#操作回数KがRLの数より小さい
if count >= K:
    print(min(N-1, K * 2 + happy  ))
#操作回数K がRLの数より大きい
else:
    print(min(N-1, K * 2 + happy + (min(edge_count,K - count) )))

Buggy submission (verdict: Runtime Error):

#L,Rの境界の数だけで処理を済ませる
#⇒いちいち書いてあるとおりに実装しない。

#内側の不幸な人を(RLの人)を消せば幸福な人が2人増える (全部Rに変えていくイメージ)
# ⇒着目するのは RL でも LR　でもどっちでもいい。
#  LRに注目する場合はこのあとのコードのRとLに関連する部分が逆になるだけ
#端っこなら１人増える
#幸福な人の最大値は N - 1

N,K = map(int,input().split())
S = input()

#端以外の人のせいで不幸な人の数
count = 0
#端の人のせいで不幸な人の数
edge_count = 0

#端のせいで不幸な人
if S[0] == 'L':
    edge_count += 1
if S[N-1] == 'R':
    edge_count += 1 

#端以外のせいで不幸になっている人の数を数える (RLを探す)
for i in range(N):
    if S[i] == 'R':
        if S[i+1] == 'L':
            count += 1

#最初の時点で幸せになれる人の数
happy = N  - (count*2 + edge_count)

#操作回数KがRLの数より小さい
if count >= K:
    print(min(N-1, K * 2 + happy  ))
#操作回数K がRLの数より大きい
else:
    print(min(N-1, K * 2 + happy + (min(edge_count,K - count) )))
Problem p02995 (python)

Fixed submission:

import fractions

#入力
A,B,C,D = map(int,input().split())

l = C * D / fractions.gcd(C, D)
l = int(l)

#条件を満たすB以下の整数の個数
Bn = B -  (B//C + B//D - B//l) 

#条件を満たすA-1以下の整数の個数
An = (A-1) - ((A-1)//C + (A-1)//D - (A-1)//l) 

print(Bn-An)

Buggy submission (verdict: Runtime Error):

import math

A,B,C,D = map(int,input().split())

U = B - A + 1

nA = ( math.floor(B / C) ) - (math.ceil(A / C)) +1

nB = ( math.floor(B / D) ) - (math.ceil(A / D)) +1

saisyoukoubaisuu = C * D / math.gcd(C, D)

saisyoukoubaisuu = int(saisyoukoubaisuu)

nAB = (B//saisyoukoubaisuu) -(B//saisyoukoubaisuu) + 1

print( U -(nA + nB - nAB) )

Buggy submission (verdict: Runtime Error):

import math

A,B,C,D = map(int,input().split())
count = 0

U = B - A + 1

nA = ( math.floor(B / C) ) - (math.ceil(A / C)) +1

nB = ( math.floor(B / D) ) - (math.ceil(A / D)) +1

saisyoukoubaisuu = C * D / math.gcd(C, D)

saisyoukoubaisuu = int(saisyoukoubaisuu)

nAB = (B//saisyoukoubaisuu) -(B//saisyoukoubaisuu) + 1

print( U -(nA + nB - nAB) )

Buggy submission (verdict: Runtime Error):

import math

A,B,C,D = map(int,input().split())
count = 0

U = B - A + 1

nA = ( math.floor(B / C) ) - (math.ceil(A / C)) +1

nB = ( math.floor(B / D) ) - (math.ceil(A / D)) +1

saisyoukoubaisuu = C * D / math.gcd(C, D)

saisyoukoubaisuu = int(saisyoukoubaisuu)

nAB = (B//saisyoukoubaisuu) -(B//saisyoukoubaisuu) + 1

print( U -(nA + nB - nAB) )
Problem p03035 (python)

Fixed submission:


A,B = map(int,input().split())

if A >= 13 :
    print(B)
elif A >= 6 :
    print(B//2)
else :
    print(0)

Buggy submission (verdict: Runtime Error):

import copy

N,M = map(int,input().split())

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

B =[]
C =[]

tA = []
ans = sum(A)

for i in range(M):
    b,c = map(int,input().split())
    B.append(b)
    C.append(c)

for i in range(N):
    for j in range(M):
        tA = copy.copy(A)
        for k in range(B[j]):
            if tA[i] < C[j]:
                tA[i] = C[j]
        if sum(tA) > ans:
            ans = sum(tA)

print (ans)
Problem p03087 (python)

Fixed submission:
"""
N,Q = map(int,input().split())
S = input()

for i in range(Q):
    lq,rq = map(int,input().split())
    s = S[lq-1:rq]
    count = 0
    while(s.find('A') != -1):
        j = s.find('A')
        if(s[j:j+2] == 'AC'):
            count+=1
            s = s[j+2:]
        else:
            s = s[j+1:]
    print(count)
"""
#愚直なやり方だとTLEになってしまう。
#累積和とよばれるテクニックを使う
#https://qiita.com/drken/items/56a6b68edef8fc605821#問題-3-atcoder-abc-122-c---get-ac

N,Q = map(int,input().split())
S = input()

#区間配列
a = [0] * len(S)
#累積和配列
s = [0] * (len(S) +1)

#左がAである文字Cは何番目にあるか求める
for i in range(len(S)):
    if S[i] == 'C':
        if S[i-1] == 'A':
            a[i] = 1 #i番目に'AC'のCがある (添字が0から始まるため実際にはi-1番目 i番目は'A')

#累積和を計算する
for i in range(1,len(a)+1):
    s[i] = s[i-1] + a[i-1]

#区間内にその文字があるか求める

for i in range(Q):
    lq,rq = map(int,input().split())
    print(s[rq] - s[lq])

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

for i in range(Q):
    lq,rq = map(int,input().split())
    s = S[lq-1:rq]
    count = 0
    while(s.find('A') != -1):
        j = s.find('A')
        if(s[j+1] == 'C'):
            count+=1
            s = s[j+2:]
        else:
            s = s[j+1:]
    print(count)
Problem p03160 (python)

Fixed submission:
N = int(input())
H = [int(x) for x in input().split()]
dp = [0] * N
dp[0] = 0
dp[1] = abs(H[1] - H[0])
for i in range(2, N):
    dp[i] = min(dp[i-1]+abs(H[i]-H[i-1]), dp[i-2]+abs(H[i]-H[i-2]))
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]

# 無限大の値
f_inf = float('inf')

# DP テーブルを初期化　(最小化問題なので INF に初期化)
dp = [f_inf] * n

# 初期条件
dp[0] = 0

# 足場 i-1 から足場 i へ移動する。コストは|h[i]−h[i-1]|
# 足場 i-2 から足場 i へと移動する コストは |h[i]−h[i-2]|
for i in range(1, n):
    dp[i] = chmin(dp[i], dp[i - 1] + abs(h[i] - h[i-1]))
    # 一番目の足場では一つ前しか存在しない
    if i > 1:
        dp[i] = chmin(dp[i], dp[i - 2] + abs(h[i] - h[i -2]))

print(dp[n-1])
Problem p02576 (python)

Fixed submission:
n,x,t = map(int,input().split())
cnt = -((-n)//x)
print(t*cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
h,w,m = map(int,input().split())
bomb = list(tuple(map(lambda x: int(x)-1,input().split())) for i in range(m))
Map= np.zeros((h,w))
for i in bomb:
    Map[i] = 1
    
bombx = np.count_nonzero(Map,axis=0)
bomby = np.count_nonzero(Map,axis=1)
maxx = max(bombx)
maxy = max(bomby)
maxx_index = np.where(bombx == maxx)
maxy_index = np.where(bomby == maxy)

flag = 0
for i in maxx_index[0]:
    for j in maxy_index[0]:
        if Map[i][j] == 0:
            flag = 1
if flag == 0:
    print(maxx+maxy)
else:
    print(maxx+maxy-1)
Problem p02658 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
ans = 1

if 0 in A:
  ans = 0
else:
  for i in range(n):
    ans = ans*A[i]
    if ans > 10**18:
        ans = -1
        break
 
print(ans)

Buggy submission (verdict: Runtime Error):
def main()
n = int(input())
A = list(map(int,input().split()))
ans = 1
 
for i in range(n):
    ans = ans*A[i]
    if 0 in A:
        print(0)
        return
    elif ans > 10**18:
      print(-1)
      return
 
print(ans)

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

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

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

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

Buggy submission (verdict: Runtime Error):
n = input()
A = list(map(int,input().split()))
ans = 1

for i in range(n):
	ans = ans*A[i]

print(ans)
Problem p03309 (python)

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

for i in range(n):
    l[i] = l[i] - i-1
l.sort()
if n % 2 == 1:
    print(sum(list(map(lambda x: abs(x-l[((n//2))]),l))))
else:
    print(min(sum(list(map(lambda x: abs(x-l[(n//2)-1]),l))),sum(list(map(lambda x: abs(x-l[(n//2)]),l)))))

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

for i in range(n):
    l[i] = l[i] - i-1
print(sorted(l))
if n % 2 == 1:
    print(sum(list(map(lambda x: x-l[((n//2)+1)],l))))
else:
    print(max(sum(list(map(lambda x: x-l[(n//2)],l))),sum(list(map(lambda x: x-l[((n//2)+1)],l)))))
Problem p03316 (python)

Fixed submission:
nlist = list(map(int,input()))
rev_n = list(reversed(nlist))
sn = sum(nlist)
n = 0

for i in range(len(nlist)):
    n += rev_n[i]*(10**i) 
if n%sn == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
nlist = list(map(int,input()))
rev_n = reversed(nlist)
sn = sum(nlist)
n = 0

for i in range(len(nlist)):
    n += rev_n[i]*(10**i) 
if n%sn == 0:
    print("Yes")
else:
    print("No")
Problem p03323 (python)

Fixed submission:
a,b = map(int,input().split())
if a<9 and b<9:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a<9 || b<9:
  print("Yay!")
else:
  print(":(")
Problem p02630 (python)

Fixed submission:
n = int(input())
sum = 0
a_list = list(map(int, input().split()))
num = [0] * (10 ** 5 + 1)
for i in range(n):
    num[a_list[i]] += 1
    sum += a_list[i]

q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    sum += (c - b) * num[b]
    num[c] += num[b]
    num[b] = 0
    print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
sum = 0
a_list = list(map(int, input().split()))
# print(a_list)
num = [0] * 10 ** 5
for i in range(n):
    num[a_list[i]] += 1
    sum += a_list[i]

q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    sum += (c - b) * num[b]
    num[c] += num[b]
    num[b] = 0
    print(sum)
Problem p02747 (python)

Fixed submission:
import numpy as np
import fractions

s=str(input())
if(len(s)%2==1):
    print("No")
    exit(0)
for i in range(len(s)-1):
    if(i%2==0):
        if(s[i]!='h' or s[i+1]!='i'):
            print("No")
            exit(0)
    if(s[i]!='h' and s[i]!='i'):
        print("No")
        exit(0)
if(s[len(s)-1]!='h' and s[len(s)-1]!='i'):
    print("No")
    exit(0)
print("Yes")

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

s=str(input())
for i in range(len(s)):
    if(i%2==0):
        if(s[i]!='h' or s[i+1]!='i'):
            print("No")
            exit(0)
    if(s[i]!='h' and s[i]!='i'):
        print("No")
        exit(0)
print("Yes")
Problem p02765 (python)

Fixed submission:


a,b=map(int,input().split())
if(a>=10):
    print(b)
else:
    print(b+(100*(10-a)))

Buggy submission (verdict: Runtime Error):
INF=int(float('inf'))

a,b=map(int,input().split())
if(a>=10):
    print(b)
else:
    print(b+(100*(10-a)))
Problem p02817 (python)

Fixed submission:
List=list(map(str,input().split()))
List.reverse()
print(''.join(List))

Buggy submission (verdict: Runtime Error):
a=input.sprit()
a=''.join(a)
print(a)