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

Fixed submission:
X, Y, A, B, C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
 
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
 
p.append(float("inf"))
q.append(float("inf")) 

Z = 0
while Z < C:
  if min(p[X - 1], q[Y - 1]) < r[Z]:
    if p[X - 1] < q[Y - 1]:
      X -= 1
      Z += 1
    else:
      Y -= 1
      Z += 1
    continue
  break
 
print(sum(p[:X]) + sum(q[:Y]) + sum(r[:Z]))

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
 
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
 
Z = 0
while Z < C:
  if min(p[X - 1], q[Y - 1], r[Z]) < r[Z]:
    if p[X - 1] < q[Y - 1]:
      X -= 1
      Z += 1
  	else:
      Y -= 1
      Z += 1
    continue
  break
 
print(sum(p[:X]) + sum(q[:Y]) + sum(r[:Z]))

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
 
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
 
Z = 0
while True:
  if p[X - 1] < r[Z]:
    X -= 1
    Z += 1
  elif q[Y - 1] < r[Z]:
    Y -= 1
    Z += 1
  else:
    break
 
print(sum(p[:X]) + sum(q[:Y]) + sum(r[:Z]))

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
 
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
 
Z = 0
while True:
  if p[X - 1] < r[Z]:
    X -= 1
    Z += 1
  else if q[Y - 1] < r[Z]:
    Y -= 1
    Z += 1
  else:
    break
 
print(sum(p[:X]) + sum(q[:Y]) + sum(r[:Z]))

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

Z = 0
while True:
  if max(p[X - 1], q[Y - 1], r[Z]) == r[Z]:
    if p[X - 1] < q[Y - 1]:
      X -= 1
      Z += 1
    else:
      Y -= 1
      Z += 1
  else:
    break

print(sum(p[:X]) + sum(q[:Y]) + sum(r[:Z]))

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

Z = 0
whlie True:
  if max(p[X - 1], q[Y - 1], r[Z]) == r[Z]:
    if p[X - 1] < q[Y - 1]:
      X -= 1
      Z += 1
    else:
      Y -= 1
      Z += 1
  else:
    break

print(sum(p[:X]) + sum(q[:Y]) + sum(r[:Z]))
Problem p02830 (python)

Fixed submission:
def main():
    N = int(input())
    row = input()
    S = row.split()[0]
    T = row.split()[1]
    result = ""
    for (s, t) in zip(S, T):
        result += s
        result += t
    print(result)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):

def main():
    N = int(input())
    row = input()
    for (s, t) in zip(row[:N], row[N:]):
        print(s+t, end="")
    print("") # 改行

    if __name__ == "__main__":
    main()
Problem p02732 (python)

Fixed submission:
def possibleCombos(num):
    num2 = num - 1
    return (num2*num2 + num2)//2
N = int(input())
A = [int(i) for i in input().split()]
data = [0] * (N+1)
total = 0
for i in A:

    data[i] +=1

for i in data:
    total += possibleCombos(i)
for i in A:
    result = total - possibleCombos(data[i]) + possibleCombos(data[i]-1)
    print(result)

Buggy submission (verdict: Runtime Error):
def possibleCombos(num):
    num2 = num - 1
    return (num2*num2 + num2)//2
N = int(input())
A = [int(i) for i in input().split()]
data = [0] * N
total = 0
for i in A:
    data[i] +=1
for i in data:
    total += possibleCombos(i)
for i in A:
    result = total - possibleCombos(data[i]) + possibleCombos(data[i]-1)
    print(result)
Problem p03455 (python)

Fixed submission:
a, b = input().split()
if (int(a) * int(b)) % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a, b = input(), input()
if (int(a) * int(b)) % 2 == 0:
  print("Even")
else:
  print("Odd")
Problem p03493 (python)

Fixed submission:
s = input()
c = s.count("1")
print(c)

Buggy submission (verdict: Runtime Error):
s = input()
c = s.count(1)
print(c)
Problem p04043 (python)

Fixed submission:
abc=list(map(int,input().split()))
if abc.count(5)==2 and abc.count(7)==1:
  print ("YES")
else:
  print ("NO")

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
s=[]
for i in range(n):
  s.append(input())
s.sort()
ans=""
for i in s:
  ans+=i
print(ans)
Problem p02774 (python)

Fixed submission:
import numpy as np

N,K = [int(i) for i in input().split()]
n = np.array([int(i) for i in input().split()])
n=np.sort(n)

mn = n[np.where(n<0)]
mz = n[np.where(n==0)]
mp = n[np.where(n>0)]

#cn = len(mn)
##cp = len(mp)
#cz = len(mz)
#tcn = cn*cp

#if cn*cp < K <= cn*cp + (N-cz)*cz + cz*(cz-1)//2:
#    print(0)
#    exit(0)

M = 10**18
m = -1*M-1
pos = 0

while M-m > 1:
    a = 0
    pos=(M+m)//2
    a+=np.searchsorted(n,pos//mp,side="right").sum()
    if pos >= 0: a+=len(mz)*N
    a+=N*len(mn) - np.searchsorted(n,-(-pos//mn),side="left").sum()
    a-=np.count_nonzero(n*n <= pos)
    a=a//2
    if a >= K:
        M=pos
    else:
        m=pos
#print(M,m)
print(M)

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

N,K = [int(i) for i in input().split()]
n = np.array([int(i) for i in input().split()])
n=np.sort(n)

mn = n[np.where(n<0)]
mz = n[np.where(n==0)]
mp = n[np.where(n>0)]

M = 10**18
m = -1*M-1
pos = 0

while M-m > 1:
    a = 0
    pos=(M+m)//2
    a+=np.searchsorted(n,pos//mp,side="right").sum()
    a+=cz*N
    a+=N*len(mn) - np.searchsorted(n,-(-pos//mn),side="left").sum()
    a-=np.count_nonzero(n*n <= pos)
    a=a//2
    if a >= K:
        M=pos
    else:
        m=pos
#print(M,m)
print(M)

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

N,K = [int(i) for i in input().split()]
n = np.array([int(i) for i in input().split()])
n=np.sort(n)

mn = n[np.where(n<0)]
mz = n[np.where(n==0)]
mp = n[np.where(n>0)]

#cn = len(mn)
#cp = len(mp)
#cz = len(mz)
#tcn = cn*cp

#if cn*cp < K <= cn*cp + (N-cz)*cz + cz*(cz-1)//2:
#    print(0)
#    exit(0)

M = 10**18
m = -1*M-1
pos = 0

while M-m > 1:
    a = 0
    pos=(M+m)//2
    a+=np.searchsorted(n,pos//mp,side="right").sum()
    a+=cz*N
    a+=N*len(mn) - np.searchsorted(n,-(-pos//mn),side="left").sum()
    a-=np.count_nonzero(n*n <= pos)
    a=a//2
    if a >= K:
        M=pos
    else:
        m=pos
#print(M,m)
print(M)
Problem p02780 (python)

Fixed submission:
import numpy as np

N,K = [int(i) for i in input().split()]
n = np.array([int(i) for i in input().split()])
n=(n+1)
t=np.empty(N+1)
t[0] = 0
t[1:]=np.cumsum(n)
print(max(t[K:]-t[:-K])*0.5)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K = [int(i) for i in input().split()]
n = np.array([int(i) for i in input().split()])
n=(n+1)
t=np.empty(N+1)
t[0] = 0
t=np.cumsum(n)
print(max(t[K:]-t[:-K])*0.5)

Buggy submission (verdict: Runtime Error):
N,K = [int(i) for i in input().split()]
n = [int(i) for i in input().split()]
max=0
idx=0
for i in range(N-K+1):
    tmp = sum(n[i:i+K]) 
    if tmp  > max:
        max=tmp 
        idx=i

tmp=0
for i in range(K):
    tmp += sum(range(1,d[i]+1))/d[i]
print(tmp)
Problem p02784 (python)

Fixed submission:
N,K = [int(x) for x in input().split()]
n=[int(x) for x in input().split()]
print("Yes" if sum(n)>=N else "No")

Buggy submission (verdict: Runtime Error):
N,K = [int(x) for x in input().split()]
n=[int(x) for x in input().split()]
print("Yes" if sum(n)=>N else "No")
Problem p02791 (python)

Fixed submission:
import numpy as np

N = int(input())
n = [int(x) for x in input().split()]
n=np.array(n)

a=1
pos=0
for i in range(1,N):
    if n[pos] > n[i] :
        a+=1
        pos=i
print(a)

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

a=1
for i in range(1,N):
    if np.min(n[:i]) < n[i] : continue
    else: a+=1   
print(a)
Problem p02811 (python)

Fixed submission:
N,M= [int(i) for i in input().split()]
print("Yes" if N*500 >= M else "No")

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce
N,M= [int(i) for i in input().split()]
n = [int(i) for i in input().split()]
#print(n)
n=sorted(set(n),reverse = True)
bs = n[0]
#print(n)
#c=len(n)


def lcm_b(a, b):
        #print("base",a,b)
        return (a * b) // fractions.gcd(a, b)

def lcm_o():
        global n
        return reduce(lcm_b, n)

def chk(v):
        global n
        for i in range(1,30):
                if v%2 == 1:break
                v = v//2
        t=2**(i-1)
        for j in range(len(n)):
                if n[j] % t == 0 and (n[j] / t) % 2 == 1:
                        n[j] = int(n[j]/t)
                else: return 0
        return i-1

if len(n) > 0:
        
        c = chk(n[-1])
        
        if  c != 0:
                v = lcm_o()*(2**(c-1))
                
                if v > M:
                        print(0) 
                else:
                        v = M//v
                        if v%2==1: v+=1
                        print(int(v//2))
        
        else: print(0)
elif N==1:
        v = int(bs*0.5)
        v = M//v
        if v%2==1: v+=1
        print(int(v//2))
Problem p02812 (python)

Fixed submission:
N= int(input())
M= input()
print(M.count("ABC"))

Buggy submission (verdict: Runtime Error):
N= int(input())
M= input()
print(M.find("ABC")
Problem p02841 (python)

Fixed submission:
n=[]
for i in range(2):
	n.append([int(x) for x in input().split()])
print(1 if n[0][0]!=n[1][0] else 0)

Buggy submission (verdict: Runtime Error):
for i in range(2):
	n.append([int(x) for x in input().split()])
print(1 if n[0][0]!=n[1][0] else 0)
Problem p02842 (python)

Fixed submission:
import math
N=int(input())
a=math.ceil(N/1.08)
b=math.floor(a*1.08)
print(a if N==b else ":(")

Buggy submission (verdict: Runtime Error):
N=int(input())
a=math.ceil(N/1.08)
b=math.floor(a*1.08)
print(a if N==b else ":(")
Problem p02861 (python)

Fixed submission:
import itertools
import numpy as np


N = int(input())
n=[]
s=range(N)
for i in range(N):
    n.append([int(x) for x in input().split()])
Q = list(itertools.permutations(s))
L=0
for i in range(int(len(Q))):
    for j in range(N-1):
        L+= np.sqrt((n[Q[i][j+1]][0] - n[Q[i][j]][0])**2 + (n[Q[i][j+1]][1] - n[Q[i][j]][1])**2)
print(L/(len(Q)))

Buggy submission (verdict: Runtime Error):
N = int(input())
n=[]
s=range(N)
for i in range(N):
    n.append([int(x) for x in input().split()])
Q = list(itertools.permutations(s))
L=0
for i in range(int(len(Q)/2)):
    for j in range(N-1):
        L+= np.sqrt((n[Q[i][j+1]][0] - n[Q[i][j]][0])**2 + (n[Q[i][j+1]][1] - n[Q[i][j]][1])**2)
print(L/(len(Q)/2))
Problem p02983 (python)

Fixed submission:
L,R= [int(i) for i in input().split()]
n=[]
for i in range(R-L+1):	
	for j in range(i+1,R-L+1):
		a = ((L+i)*(L+j))%2019
		if a == 0:
			print(0)
			exit()
		else: 
			n.append(((L+i)*(L+j))%2019)
print(min(n))

Buggy submission (verdict: Runtime Error):
L,R= [int(i) for i in input().split()]
n=[]
for i in range(R-L+1):	
	for j in range(i+1,R-L+1):
		a = (L+i)*(L+j)%2019
		if a == 0:
			print(0)
			exit()
		else 
			n.append((L+i)*(L+j)%2019)
print(min(n))
Problem p02999 (python)

Fixed submission:
N,Y= [int(i) for i in input().split()]

if N < Y:
	print(0)
else:
	print(10)

Buggy submission (verdict: Runtime Error):
N,Y= [int(i) for i in input().split()]

if N < X:
	print(0)
else:
	print(10)

Buggy submission (verdict: Runtime Error):
N,Y= [int(i) for i in input().split()]

if N < X:
	print(0)
else:
	print(10)
Problem p03086 (python)

Fixed submission:
N = input()
a=0
b=0
for i in range(len(N)):
	if N[i] == 'A' or N[i] ==  'T' or N[i] ==  'C' or N[i] ==  'G' :
		a+=1
	else: 
		if a > b: b = a
		a=0

print(max(b,a))

Buggy submission (verdict: Runtime Error):
a=0
b=0
for i in range(len(N)):
	if N[i] == 'A' or N[i] ==  'T' or N[i] ==  'C' or N[i] ==  'G' :
		a+=1
	else: 
		if a > b: b = a
		a=0

print(b)
Problem p03285 (python)

Fixed submission:
N= int(input())
a=N//7
if N%7 == 0 or N%4 ==0:
	print("Yes")
	exit()
for i in range(a):
	if (N-(a-i)*7)%4 == 0:
		print("Yes")
		exit()
print("No")

Buggy submission (verdict: Runtime Error):
N= int(input())
a = N//7
for i in range(a):
	if (N-(a-i)*7)%4 == 0:
		print("Yes")
		exit()
prin("No")
Problem p03293 (python)

Fixed submission:
A = input()
B = input()
for i in range(len(A)):
    if A == B:
        print("Yes")
        exit()
    A = (A+A[0])[1:]
print("No")

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
for i in range(len(A)):
　　if A == B:
　　　　print("Yes")
　　　　exit()
　　A = (A+A[0])[1:]
print("No")

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
for i in range(len(A)):
　　if(A == B):
　　　　print("Yes")
　　　　exit()
　　A = (A+A[0])[1:]
print("No")

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
for i in range(len(A)):
if(A == B):
　　print("Yes")
　　exit()
　　A = (A+A[0])[1:]
print("No")
Problem p02934 (python)

Fixed submission:
int(input())
a = list(map(int, input().split()))
print("{:.10f}".format(1/sum(list(map(lambda x: 1/x, a)))))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
print("{:.10f}"sum(list(map(lambda x: 1/x, a))))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
print("{:.10f}"sum((map(lambda x: 1/x, a))))
Problem p02946 (python)

Fixed submission:
k, x = list(map(int, input().split()))
print(' '.join([str(i) for i in range(x-k+1, x+k)]))

Buggy submission (verdict: Runtime Error):
k, x = list(map(int, input().split()))
print(' '.join([i for i in range(x-k+1, x+k)]))
Problem p03292 (python)

Fixed submission:
a, b, c = map(int, raw_input().split())
list = [a, b, c]
list.sort()
cost = (list[2] - list[1]) + (list[1] - list[0])
print(cost)

Buggy submission (verdict: Runtime Error):
class Queue:
    def __init__(self):
        self.items = []

    def enqueue(self, item):
        self.items.insert(0, item)

    def dequeue(self):
        return self.items.pop()

    def size(self):
        return len(self.items)

    def self(self):
        return self.items

s = raw_input()
t = raw_input()
q = Queue()

j = 0
S = list(s)
L = len(s)
while j < L :
    q.enqueue(S[L - (j + 1)])
    j += 1

flag = False
i = 0
while i < q.size():
    x = q.dequeue()
    q.enqueue(x)
    if (list(t) == q.self()):
        flag = True
        break
    i += 1

if flag:
    print('Yes')
else:
    print('No')
Problem p02727 (python)

Fixed submission:
def merge(A,B):
    C = []
    i = 0
    j = 0
    while i < len(A) and j < len(B):
        if A[i]>B[j]:
            C.append(A[i])
            i += 1
        else:
            C.append(B[j])
            j += 1

    if len(A)-i>len(B)-j:
        C.extend(A[i:])
    else:
        C.extend(B[j:])

    return C

X,Y,A,B,C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))

# P = [3,63,12,5,6]
# Q = [3,5,6,7,8]
# R = [13,5,6,8,23,5]
# X = 3
# Y = 2

# P = [63,12,6]
# Q = [8,7]

# i = 2
# j = 2
# C = [63,12,8,7]


P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

S = merge(P[:X],Q[:Y])
S = merge(S,R)

score = 0
for i in range(X+Y):
    score += S[i]
print(score)

Buggy submission (verdict: Runtime Error):
def merge(A,B):
    C = []
    i = 0
    j = 0
    while i < len(A) and j < len(B):
        if A[i]>B[j]:
            C.append(A[i])
            i += 1
        else:
            C.append(B[j])
            j += 1

    if len(A)>len(B):
        C.extend(A[i:])
    else:
        C.extend(B[j:])

    return C

X,Y,A,B,C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))


P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

S = merge(P[:X],Q[:Y])
S = merge(S,R)

score = 0
for i in range(X+Y):
    score += S[i]
print(score)
Problem p02843 (python)

Fixed submission:
def fun(N,V):
    cnt = 0

    for i in range(5):
        cnt += V // (5-i)
        V = V % (5-i)
        if V == 0:
            break

    if cnt<=N and V==0:
        flag = False
        print(1)
    else:
        flag = True
    
    return flag

def main():
    X = int(input())

    flag = True
    N = X//100
    V = X-N*100

    while flag:
        if N >= V/5:
            flag = fun(N,V)
            N -= 1
            V += 100
        else:
            flag = False
            print(0)

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def fun(N,V):
    cnt = 0

    for i in range(5):
        cnt += V // (5-i)
        V = V % 5
        if V == 0:
            break

    if cnt<=N:
        flag = False
        print(1)
    
    return flag

def main():
    X = int(input())

    flag = True
    N = X//100
    V = X-N*100

    while flag:
        if N >= V/5:
            flag = fun(N,V)
            N -= 1
            V += 100
        else:
            flag = False
            print(0)

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def fun(N,V):
    cnt = 0

    for i in range(5):
        cnt += V // (5-i)
        V = V % 5
        if V == 0:
            break

    if cnt<=N:
        flag = False
        print(1)
    
    return flag

X = int(input())

flag = True
N = X//100
V = X-N*100

while flag:
    if N >= V/5:
        flag = fun(N,V)
        N -= 1
        V += 100
    else:
        flag = False
        print(0)

Buggy submission (verdict: Runtime Error):
def fun(N,V):
    cnt = 0

    for i in range(5):
        cnt += V // (5-i)
        V = V % 5
        if V == 0:
            break

    if cnt<=N:
        flag = False
        print(1)
    
    return flag

X = int(input())

flag = True
N = X//100
V = X-N*100

while flag:
    if N > V/5:
        flag = fun(N,V)
        N -= 1
        V += 100
    else:
        flag = False
        
        print(0)
Problem p03071 (python)

Fixed submission:
a=list(map(int,input().split()))
sum=0;
if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

print(sum)

Buggy submission (verdict: Runtime Error):
a=[int(input()) for i in range(2)]
sum=0;
if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

print(sum)

Buggy submission (verdict: Runtime Error):
a=[int(input()) for i in range(2)]
sum=0;
if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

print(sum)
Problem p02837 (python)

Fixed submission:
import itertools

# load
N = int(input())
a = []
x = []
y = []
for i in range(N):
  a.append(int(input()))
  xtmp = []
  ytmp = []
  for j in range(a[i]):
    xtmp2, ytmp2 = map(int, input().split())
    xtmp.append(xtmp2)
    ytmp.append(ytmp2)
  x.append(xtmp)
  y.append(ytmp)

#print('x:%s' % x)
#print('y:%s' % y)
#print(x[0][0])

# honest?

contra = False
stop = False
for r in range(N+1):
  for v in itertools.combinations(range(N), r):
    h = [1] * N
    for t in range(len(v)):
      h[v[t]] = 0

    for i in range(N):
      for j in range(a[i]):
      	if h[i] == 1 and (h[x[i][j]-1] != y[i][j]): # contradiction
          contra = True
          #print('contra: h:%s, i:%d, j:%d, h[x[i][j]-1]:%d, y[i][j]:%d' % (h, i, j, h[x[i][j]-1], y[i][j]))
          break
      if contra:
        contra = False
        break
    else:
      stop = True
      #print('answer? h: %s' % h)
      break
  if stop:
    break
    
print(sum(h))

Buggy submission (verdict: Runtime Error):
# load
N = int(input())
a = []
x = []
y = []
for i in range(N):
  a.append(int(input()))
  for j in range(a[i]):
    xtmp, ytmp = map(int, input().split())
    x.append(xtmp)
    y.append(ytmp)

# honest?
b = 0
for i in range(N):
  b += (2**i)

b = format(b, 'b') # string representing binary

contradiction = False
while True:
  for i in range(N):
    if int(b[i]) == 1 and (int(b[x[i]-1]) != y[i]):
      contradiction = True
      break
  if contradiction:
    contradiction = False
    b = format(int(b, 2) - 1, 'b')
  else:
    break

h = 0
for i in range(N):
  h += int(b[i])

print(h)
Problem p02814 (python)

Fixed submission:
from fractions import gcd
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

def lcm(values):
    ans = values[0]
    for i in range(1, len(values)):
        ans = ans * values[i] // gcd(ans, values[i])
    return ans

def count_div2(value):
    count = 0
    while value % 2 == 0:
        count += 1
        value //= 2
    return count

min_value = lcm(A)
amount = M * 2 // min_value

div2 = count_div2(A[0])
if any([count_div2(a) != div2 for a in A]):
    print(0)
else:
    print((amount + 1) // 2)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

def lcm(values):
    ans = values[0]
    for i in range(1, len(values)):
        ans = ans * values[i] // gcd(ans, values[i])
    return ans

def count_div2(value):
    count = 0
    while value % 2 == 0:
        count += 1
        value //= 2
    return count

min_value = lcm(A)
amount = M * 2 // min_value

div2 = count_div2(A[0])
if any([count_div2(a) != amount_div2 for a in A]):
    print(0)
else:
    print((amount + 1) // 2)
Problem p02866 (python)

Fixed submission:
import sys
import collections

N = int(input())
D = list(map(int,input().split()))

if D[0] != 0:
    print(0)
    sys.exit()
DD = collections.Counter(D)
max_key = max(DD.keys())
result = 1
last_v = 0
for k in range(max_key + 1):
    if not k in DD:
        print(0)
        sys.exit()
    v = DD[k]
    if k == 0:
        if v > 1:
            print(0)
            sys.exit()
        last_v = v
        continue
    result *= last_v ** v
    last_v = v
print(result % 998244353)

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

N = int(input())
D = list(map(int,input().split()))

if D[0] != 0 or D[1] == 0:
    print(0)
    sys.exit()
DD = collections.Counter(D)
result = 1
for i in range(N - 1) - 1:
    if DD[i + 1] == 0:
        print(0)
        sys.exit()
    result *= DD[i] ** DD[i + 1]
print(result % 998244353)
Problem p02909 (python)

Fixed submission:
S = input()

dict = {"Sunny": "Cloudy", "Cloudy": "Rainy", "Rainy": "Sunny"}
print(dict[S])

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

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

for i in range(M):
  if (A[N - 1] < A[N - 2]):
    a = A.pop(-1)
    bisect.insort(A, a)
  A[N - 1] /= 2.0
amount = 0
for a in A:
  amount += math.floor(a)
print(amount)
Problem p02801 (python)

Fixed submission:
from sys import stdin

C = input()
c = ord(C)

print(chr(c + 1))

Buggy submission (verdict: Runtime Error):
from sys import stdin

C = input()

print(chr(ord(C + 1)))
Problem p02811 (python)

Fixed submission:
from sys import stdin
K, X = [int(x) for x in stdin.readline().rstrip().split()]

if X <= K*500:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from sys import stdin
K, X = [int(x) for x in stdin.readline().rstrip().split()]

if X =< K*500:
    print("Yes")
else:
    print("No")
Problem p02909 (python)

Fixed submission:
from sys import stdin
A = stdin.readline().rstrip()

weather = ["Sunny", "Cloudy", "Rainy", "Sunny"]

for i in range(len(weather)):
    if A == weather[i]:
        t = i
        break
    else:
        i += 1


print(weather[t+1])

Buggy submission (verdict: Runtime Error):
from sys import stdin
A = stdin.readline().rstrip()

weather = ["Sunny", "Cloudy", "Rainy", "Sunny"]

for i in round(len(weather) - 1):
    if A == weather[i]:
        t = i
        break
    else:
        i += 1


print(weather[t+1])