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

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

answer = a * b

if answer % 2 == 0:
    print('Even')
else:
    print('Odd')

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

answer = a * b

if answer % == 0:
    print('Even')
else:
    print('Odd')

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

multi = a * b


if multi % 2 == 0:
    print('Even')
else:
    print('0dd')
Problem p03844 (python)

Fixed submission:
# 入力
A, op, B = input().split()

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

# 出力
if op == '+':
    print(A + B)
elif op == '-':
    print(A - B)

Buggy submission (verdict: Runtime Error):
# 入力
A = int(input())
op = input()
B = int(input())

if op == '+':
    print(A + B)
elif op == '-':
    print(A - B)
Problem p04011 (python)

Fixed submission:
N = int(input())    # 宿泊数
K = int(input())    # 単価が切り替わる泊数
X = int(input())    # 単価a
Y = int(input())    # 単価b


if N <= K:
    a = N * X
else:
    a = K * X + Y * (N - K)

print(a)

Buggy submission (verdict: Runtime Error):


N, K, X, Y = map(int, input().split())

a = N * X

b = K * X + (N - K) * Y

if N <= K:
    print(a)
else:
    print(b)

Buggy submission (verdict: Runtime Error):

N, K, X, Y = map(int, input().split())

a = N * X

b = K * X + (N - K) * Y

if N < K:
    print(a)
else:
    print(b)

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

if N <= K:
    print(N * X)

else:
    print(K * X + (N - K) * Y)

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

if N <= K:
    answer = N * X
    print(answer)

else:
    answer = K * X + (N - K) * Y
    print(answer)

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

# 高橋くんの宿泊数 N
# 宿泊費が変わる　 K
# 初期宿泊費      X
# K+1以降の宿泊費 Y

# subは宿泊数の超過分
sub = N - K

# もしNよりKが大きい場合、そのまま計算する
if N <= K:
    answer = N * X
    print(answer)
# KよりNが大きい場合 K * X + (N - K) * Y
else:
    answer = K * X + sub * Y
    print(answer)

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

# 高橋くんの宿泊数 N
# 宿泊費が変わる　 K
# 初期宿泊費      X
# K+1以降の宿泊費 Y

# subは宿泊数の超過分
sub = N - K

# もしNよりKが大きい場合、そのまま計算する
if N < K:
    answer = N * X
    print(answer)
# KよりNが大きい場合 K * X + (N - K) * Y
elif K < N:
    answer = K * X + sub * Y
    print(answer)

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


# 高橋くんの宿泊数 N
# 宿泊費が変わる　 K
# 初期宿泊費      X
# K+1以降の宿泊費 Y

# wは宿泊数の超過分
sub = N - K

# もしNよりKが大きい場合、そのまま計算する
if N < K :
    answer = N * X
    print(answer)
# KよりNが大きい場合
elif K < N:
    answer = K * X + Y * sub
    print(answer)

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


answer = 0
w = 0

# 高橋くんの宿泊数 N
# 宿泊費が変わる　 K
# 初期宿泊費      X
# K+1以降の宿泊費 Y

# wは宿泊数の超過分
if N - K >= 1:
    w = N - K
else:
    w = 0
# もしNよりKが大きい場合、そのまま計算する
#
if N < K :
    for i in range(N):
        answer = answer + X
    print(answer)
# KよりNが大きい場合
elif K < N:
    for i in range(K):
        answer = answer + X
    for i in range(w):
        answer = answer + Y
    print(answer)
Problem p02534 (python)

Fixed submission:
k=int(input())
print("ACL"*k)

Buggy submission (verdict: Runtime Error):
k=int(input())
print(ACL*k)
Problem p02601 (python)

Fixed submission:
a, b, c= map(int, input().split())
num= int(input())
for x in range(num):
    if a >= b and c >= a:
        b=b*2
    else:
        c=c*2
if b > a and c > b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, c= map(input().split())
num= int(input())
cot=0
for x in range(num):
    if a >= b and c >= a:
        b=b*2
    else:
        c=c*2
if b > a and c > b:
    print("Yes")
else:
    print("No")
Problem p02602 (python)

Fixed submission:
n,k= map(int, input().split())
num= [int (x) for x in input().split()]
for i in range(n-k):
    if num[i] < num[k+i]:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(){
    int a, b, c, num, eq=0;
    scanf("%d %d %d", &a, &b, &c);
    scanf("%d", &num);
    for(int i=0; i<num; ++i){
    if(a>=b && c>=a)
        b=b*2;

    else
        c=c*2;
    }
    if(b>a && c >b)
        printf("YES");
    else    
        printf("NO");
    
    ///printf("%d %d %d\n", a, b, c);
    printf("\n");
    
    return 0;
}
Problem p02772 (python)

Fixed submission:
n= int(input())
lista=[]
listanova=[]
for x in input().split():
	x= int(x)
	if x %2 ==0:
		lista.append(x)
for x in lista:
	if x %3==0 or x%5==0:
		listanova.append(x)

if len(lista)==len(listanova):
	print('APPROVED')
else:
	print('DENIED')

Buggy submission (verdict: Runtime Error):
    n= int(input())
    lista=[]
    listanova=[]
    for x in input().split():
    	x= int(x)
    	if x %2 ==0:
    		lista.append(x)
    for x in lista:
    	if x %3==0 or x%5==0:
    		listanova.append(x)
     
    if len(lista)==len(listanova):
    	print('APPROVED')
    else:
    	print('DENIED')
Problem p03578 (python)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]

num = {}
for v in a:
  if v in num:
    num[v] = num[v] + 1
  else:
    num[v] = 1
m = int(input())
t = [int(x) for x in input().split()]

ok = True
for v in t:
  if v not in num:
    ok = False
  elif num[v] <= 0:
    ok = False
  else:
    num[v] = num[v] - 1

if ok:
  print("YES")
else:
  print("NO")

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

num = {}
for v in a:
  if v in num:
    num[v] = num[v] + 1
  else:
    num[v] = 1
m = int(input())
t = [int(x) for x in input().split()]

ok = True
for v in t:
  if v not in num:
    ok = False
  elif num[v] <= 0:
    ok = False
  else:
    num[v] = num[v] - 1

if ok:
  print("YES")
else:
  ptint("NO")

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

num = {}
for v in a:
  if v in num:
    num[v] = num[v] + 1
  else:
    num[v] = 1
m = int(input())
t = [int(x) for x in input().split()]

ok = True
for v in t:
  if v not in num:
    ok = False
  elif num[v] <= 0:
    ok = False
  else:
    num[v] = num[v] - 1

if ok:
  print("Yes")
else:
  ptint("No")

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

num = {}
for v in a:
  if v in a:
    num[v] = num[v] + 1
  else:
    num[v] = 1
m = int(input())
t = [int(x) for x in input().split()]

ok = True
for v in t:
  if v not in num:
    ok = False
  elif num[v] <= 0:
    ok = False
  else:
    num[v] = num[v] - 1

if ok:
  print("Yes")
else:
  ptint("No")
Problem p02534 (python)

Fixed submission:
x = int(input())
print("ACL" * x)

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

if (b > c) or (a > d):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
#b>= x>= a and d>=x>=c

if (b<c )or (a < d):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
#b>= x>= a and d>=x>=c

if b<c or a < d:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
#b>= x>= a and d>=x>=c

if b<c and a < d:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
x = input()
print('acl'*x)

Buggy submission (verdict: Runtime Error):
x = input()
c = ''
for e in range(x):
	c+='acl'
print(c)
Problem p02675 (python)

Fixed submission:
n = input()

hon = ['2','4','5','7','9']
pon = ['0','1','6','8']
bon = ['3']

if n[-1] in bon:
    print('bon')
elif n[-1] in hon:
    print('hon')
elif n[-1] in pon:
    print('pon')

Buggy submission (verdict: Runtime Error):
k = int(input())
s = input()

if len(s) <= k:
    print(s)
else:
    print(s[:k+1]+'...')

Buggy submission (verdict: Runtime Error):
k = int(input())
s = input()

if len(s) <= k:
    print(s)
else:
    print(s[:k+1])

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

hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = 3

if n in hon:
    print(hon)
elif n in pon:
    print(pon)
elif n == bon:
Problem p02702 (python)

Fixed submission:
from functools import lru_cache



S=input()
count=[0 for i in range(2019)]
length=len(S)
#S=int(S)
S=S+'0'
S=S[::-1]
_S=0

base=1
for i,s in enumerate(S):
    _S=base*int(s)+_S
    count[_S%2019]+=1
    base*=10
    base=base%2019
    _S=_S%2019



retval=0
for key in range(2019):
    retval+=count[key]*(count[key]-1)//2


print(retval)

Buggy submission (verdict: Runtime Error):
from functools import lru_cache
from tqdm import tqdm



S=input()
count=[0 for i in range(2019)]
length=len(S)
#S=int(S)
S=S+'0'
S=S[::-1]
_S=0

base=1
for i,s in enumerate(S):
    _S=base*int(s)+_S
    count[_S%2019]+=1
    base*=10
    base=base%2019
    _S=_S%2019



retval=0
for key in range(2019):
    retval+=count[key]*(count[key]-1)//2


print(retval)
Problem p02741 (python)

Fixed submission:
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K=int(input())
print(l[K-1])

Buggy submission (verdict: Runtime Error):
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K=int(input())
print(l[K])
Problem p03005 (python)

Fixed submission:
N, K=[int(i) for i in input().split(" ")]
if K==1:
    print(0)
else:
    print(N-K)

Buggy submission (verdict: Runtime Error):
N, K=[int(i) for i in input().spit(" ")]
if K==1:
    print(0)
else:
    print(N-K)
Problem p03006 (python)

Fixed submission:
import itertools
from collections import Counter
import sys
N=int(input())
balls=[]

for i in range(N):
    x,y=[int(j) for j in input().split(" ")]
    balls.append((x,y))

pqs=[]
if N==1:
    print(1)
    sys.exit()
for i in itertools.permutations(balls,2):
    p=i[1][0]-i[0][0]
    q=i[1][1]-i[0][1]
    pqs.append((p,q))

c=Counter(pqs)
c=dict(c)
c=sorted(c.items(),key=lambda w:w[1],reverse=True)
print(N-c[0][1])

Buggy submission (verdict: Runtime Error):
import itertools
from collections import Counter
N=int(input())
balls=[]

for i in range(N):
    x,y=[int(j) for j in input().split(" ")]
    balls.append((x,y))

pqs=[]
for i in itertools.permutations(balls,2):
    p=i[1][0]-i[0][0]
    q=i[1][1]-i[0][1]
    pqs.append((p,q))

c=Counter(pqs)
c=dict(c)
c=sorted(c.items(),key=lambda w:w[1],reverse=True)
print(N-c[0][1])
Problem p03007 (python)

Fixed submission:
import bisect

N=int(input())
A=[int(i) for i in input().split(" ")]
A=sorted(A)
traceback=[]

if A[0]>=0:
    minus=[A[0]]
    plus=A[1::]
elif A[-1]<=0:
    minus=A[:-1:]
    plus=[A[-1]]
else:
    index=bisect.bisect_left(A,0)
    minus=A[:index:]
    plus=A[index::]

print(sum(plus)-sum(minus))
m=minus.pop(0)
for p in plus[:-1:]:
    print(m,p)
    m=m-p
print(plus[-1],m)
p=plus[-1]-m
for m in minus:
    print(p,m)
    p=p-m

Buggy submission (verdict: Runtime Error):
import bisect

N=int(input())
A=[int(i) for i in input().split(" ")]
A=sorted(A)
traceback=[]

if A[0]>=0:
    minus=[A[0]]
    plus=A[1::]
elif A[-1]<=0:
    minus=A[:-1:]
    plus=A[-1]
else:
    index=bisect.bisect_left(A,0)
    minus=A[:index:]
    plus=A[index::]

print(sum(plus)-sum(minus))
m=minus.pop(0)
for p in plus[:-1:]:
    print(m,p)
    m=m-p
print(plus[-1],m)
p=plus[-1]-m
for m in minus:
    print(p,m)
    p=p-m
Problem p03032 (python)

Fixed submission:
from functools import lru_cache
import numpy as np

N,K=[int(i) for i in input().split(" ")]
V=[int(i) for i in input().split(" ")]

retval=0
for left in range(max(N+1,K+1)):
    for right in range(min(N-left+1,K-left+1)):
        modoseru=K-(left+right)
        temoto=np.asarray(sorted(V[:left:]+V[N-right::]))
        modosu=min(np.sum(temoto<0),modoseru)
        retval=max(sum(temoto[modosu::]),retval)

print(retval)

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

N,K=[int(i) for i in input().split(" ")]
V=[int(i) for i in input().split(" ")]

@lru_cache()
def value(V,k,hands):
    if k==0:
        return sum(hands)
    else:
        retval=sum(hands)
        try:
            retval=max(value(V[1::],k-1,sorted(hands+[V[0]])),retval)
        except:
            pass
        try:
            p2=value(V[:-1:],k-1,sorted(hands+[V[-1]]))
            retval=max(retval,p2)
        except:
            pass
        try:
            p3=value(V+[hands[0]],k-1,hands[1::])
            retval=max(p3,retval)
        except:
            pass
        try:
            p4=value([hands[0]]+V,k-1,hands[1::])
            retval=max(p4,retval)
        except:
            pass
        return retval

print(value(V,K,[]))
Problem p03090 (python)

Fixed submission:
import itertools
N=int(input())

def returnSplit(N):
    if N%2==0:
        return [[i+1,N-i] for i in range(N//2)]
    else:
        return returnSplit(N-1)+[[N]]


blocks=returnSplit(N)
retval=[]

for i in range(len(blocks)):
    for j in range(i+1,len(blocks)):
        for k in itertools.product(blocks[i],blocks[j]):
            retval.append(k)


print(len(retval))
for i in retval:
    print("{0} {1}".format(*i))

Buggy submission (verdict: Runtime Error):
import itertools
N=int(input())

def returnSplit(N):
    if N%2==0:
        return [[i+1,N-i] for i in range(N//2)]
    else:
        return [[N],*returnSplit(N-1)]


blocks=returnSplit(N)
retval=[]

for i in range(len(blocks)):
    for j in range(i+1,len(blocks)):
        for k in itertools.product(blocks[i],blocks[j]):
            retval.append(k)


print(len(retval))
for i in retval:
    print("{0} {1}".format(*i))
Problem p03139 (python)

Fixed submission:
N,A,B=[int(i) for i in input().split(" ")]
maximum=min(A,B)
minimum=max(A+B-N,0)
print(maximum,minimum)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M=[int(i) for i in input().split(" ")]
 
G=np.zeros((N,N),dtype=np.int)
for i in range(N+M-1):
    A,B=[int(j)-1 for j in input().split(" ")]
    G[A][B]=1
for i in range(M):
    x=np.sum(G,axis=0).argmax()
    y=np.sum(G,axis=1).argmax()
    G[y][x]-=1
 
for l in G.T:
    if np.sum(l)==0:
        print("0")
    else:
        print(l.argmax()+1)
Problem p03302 (python)

Fixed submission:
a,b=(int(i) for i in input().split(" "))
if a+b==15:
 print("+")
elif a*b==15:
 print("*")
else:
 print("x")

Buggy submission (verdict: Runtime Error):
n,m,d=(int(i) for i in input().split(" "))
if d==0:

    print(((n-d)*(n**(m-2))*(m-1))/(n**m))
else:
    print((2*(n-d)*(n**(m-2))*(m-1))/(n**m))
Problem p03323 (python)

Fixed submission:
A,B=[int(i) for i in input().split(" ")]
if A<=8 and B<=8:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
try:
    A=int(input())
    B=int(input())
except:
    A,B=[int(i) for i in input().split(" ")]
if A<=8 and B<=8:
    print("Yay!")
else:
    print(":(")
Problem p03943 (python)

Fixed submission:
line=input()
line=line.split(" ")
 
a=int(line[0])
b=int(line[1])
c=int(line[2])
 
if a+b==c:
 print("Yes")
elif b+c==a:
 print("Yes")
elif c+a==b:
 print("Yes")
else:
 print("No")

Buggy submission (verdict: Runtime Error):
line=input()
line.split(" ")
 
a=int(line[0])
b=int(line[1])
c=int(line[2])
 
if a+b==c:
 print("Yes")
elif b+c==a:
 print("Yes")
elif c+a==b:
 print("Yes")
else:
 print("No")

Buggy submission (verdict: Runtime Error):
if a+b==c:
 print("yes")
elif b+c==a:
 print("yes")
elif a+c==b:
 print("yes")
else:
 print("no")
Problem p03944 (python)

Fixed submission:
whn=input().split(" ")
W=int(whn[0])
H=int(whn[1])
N=int(whn[2])
a=[]
for i in range(N):
    a.append(input().split(" "))

left=0
right=W
top=H
bottom=0

for i in range(N):
    if a[i][2]=="1":
        if left<int(a[i][0]):
            left=int(a[i][0])
    elif a[i][2]=="2":
        if right>int(a[i][0]):
            right=int(a[i][0])
    elif a[i][2]=="3":
        if bottom<int(a[i][1]):
            bottom=int(a[i][1])
    elif a[i][2]=="4":
        if top>int(a[i][1]):
            top=int(a[i][1])


if left>=right:
    print(0)
elif top<=bottom:
    print(0)
else:
    print((top-bottom)*(right-left))

Buggy submission (verdict: Runtime Error):
import sys

inputdata=sys.stdin.readlines()
whn=int(inputdata[0].split( ))
W=whn[0]
H=whn[1]
N=whn[2]
data1=[]
data2=[]
data3=[]
data4=[]
for i in inputdata:
	if i[-1]=="1":
		data1.append(int(i.split( )))
	elif i[-1]=="2":
		data2.append(int(i.split( )))
	elif i[-1]=="3":
		data3.append(int(i.split( )))	
	elif i[-1]=="4":
		data4.append(int(i.split( )))
		
a=0
for i in data1:
	if a<i:
		a=i
b=W
for i in data2:
	if b>i:
		b=i

c=0
for i in data3:
	if c<i:
		c=i					
d=H
for i in data4:
	if d>i:
		d=i
 		
if c>=d:
 	print("0")
elif b<=a:
 	print("0")
else:
 	print(str((d-c)*(b-a)))
Problem p02548 (python)

Fixed submission:
N=int(input())
def test(n):
    buf=0
    for i in range(1,n):
        if i**2 > n:
            break
        if i**2 == n:
            buf+=1
            break
        if n%i==0:
            buf+=2
    return buf

ans=0
for i in range(N-1):
    ans+=int((N-1)/(i+1))

print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
ans=1
def test(n):
    buf=0
    for i in range(1,n):
        if i**2 > n:
            break
        if i**2 == n:
            buf+=1
            break
        if n%i==0:
            buf+=2
    return buf

def ans(n):
    if n==2:
        return 1
    return test(n-1) + ans(n - 1)

print(ans(N))
Problem p02784 (python)

Fixed submission:
H,N=map(int,input().split())
A=list(map(int,input().split()))
s=0
flg=True
for i in range(N):
  s+=A[i]
  if s>=H:
    print('Yes')
    flg=False
    break
if flg:
	print('No')

Buggy submission (verdict: Runtime Error):
import sys
H,N=map(int,input().split())
A=map(int,input().split())
s=0
for i in range(N):
  s+=A[i]
  if s>=H:
    print('Yes')
    sys.exit()
print('No')
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,intput().split())
print(a," ",b," ",c)
Problem p02730 (python)

Fixed submission:
s=input()
n=len(s)
def p(s):
  return s==s[::-1]
if p(s):
  if p(s[:(n-1)//2]):
    if p(s[(n+1)//2:]):
      print('Yes')
      exit()
    else:
      print('No')
      exit()
print('No')

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
def p(s):
  return s==s[::-1]
if p(s[:(n-1)//2]):
  if p(s[(n+1)//2:]):
    print('Yes')
    exit()
   else:
    print('No')
    exit()
print('No')

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
def p(s):
  return s==s[::-1]
if p(s[:(n-1)//2]):
  if p(s[(n+1)//2:]):
    print('Yes')
   else:
    print('No')
print('No')
Problem p02558 (python)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

class UnionFind():
    def __init__(self, n):
        self.n = n
        # parents[i]: 要素iの親要素の番号
        # 要素iが根の場合、parents[i] = -(そのグループの要素数)
        self.parents = [-1] * n
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    # 要素xが属するグループの要素数を返す
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    # 要素xが属するグループに属する要素をリストで返す
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    # 全ての根の要素をリストで返す
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    # グループの数を返す
    def group_count(self):
        return len(self.roots())
    # 辞書{根の要素: [そのグループに含まれる要素のリスト], ...}を返す
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    # print()での表示用
    # all_group_members()をprintする
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N, Q = MAP()
uf = UnionFind(N)

for _ in range(Q):
    t, u, v = MAP()
    if t == 0:
        uf.union(u, v)
    else:
        print(1 if uf.same(u, v) else 0)

Buggy submission (verdict: Runtime Error):
import networkx as nx
def MAP(): return map(int, input().split())
n,q=MAP()
g=nx.utils.UnionFind(range(n))
for _ in range(q):
    t,u,v=MAP()
    if t==0:g.union(u,v)
    else:print(1 if g[u]==g[v] else 0
Problem p02658 (python)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

if 0 in A:
	print(0)
	exit()
	
ans = 1
for a in A:
	ans *= a
	if ans > 10**18:
		print(-1)
		break
else:
	print(ans)

Buggy submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
if 0 in A:
	print(0)
	exit()

ans = 1

for a in A:
	ans *= a
	if ans > 10**18:
		print(-1)
		exit()
print(ans)