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

Fixed submission:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

H,W = two_int()

maps = [list(input()) for i in range(H)]

import copy 
temp_maps = copy.deepcopy(maps)

#start調査
def solve(W,H,maps):
    start_X=0
    start_Y=0
    for x in range(W):
        for y in range(H):
            count=0

            if maps[y][x]=="#":
                count += 1

                if x+1 < W:
                    if maps[y][x+1]=="#":
                        count += 1     

                if y+1 < H:
                    if maps[y+1][x]=="#":
                        count += 1     

                if x-1 >= 0:
                    if maps[y][x-1]=="#":
                        count += 1     


                if y-1 >= 0:
                    if maps[y-1][x]=="#":
                        count += 1     

                if count==1:
                    return "No"
    return "Yes"

ans = solve(W,H,maps)
print(ans)

Buggy submission (verdict: Runtime Error):
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

H,W = two_int()

maps = [list(input()) for i in range(H)]

import copy 
temp_maps = copy.deepcopy(maps)

#start調査
def solve(W,H,maps):
    start_X=0
    start_Y=0
    for x in range(W):
        for y in range(H):
            count=0

            if maps[y][x]=="#":
                count += 1

                if x+1 < W:
                    if maps[y][x+1]=="#":
                        count += 1     

                if y+1 < H:
                    if maps[y+1][x]=="#":
                        count += 1     

                if now_x-1 >= 0:
                    if maps[y][x-1]=="#":
                        count += 1     


                if y-1 >= 0:
                    if maps[y-1][x]=="#":
                        count += 1     

                if count==1:
                    return "No"
    return "Yes"

ans = solve(W,H,maps)
print(ans)
Problem p03469 (python)

Fixed submission:
s=input()

data = s.split('/')
out = '2018/01/'+data[2]

print(out)

Buggy submission (verdict: Runtime Error):
s=input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])

minn_man = int(maney/10000)+1
minn_sen = int(maney / 1000 )+1
minn_go  = int(maney / 5000) +1
flg=True
for man in range(0,minn_man):
	for go in range(0,minn_go):
		for sen in range(0,minn_sen):
			if man+go+sen == maisuu:
				if man*10000+ go*5000 + sen*1000 == maney:
					print(str(man)+","+str(go)+","+str(sen))
					flg=False
		if flg!=True:
			break
	if flg!=True:
		break
if flg:
	print('-1,-1,-1')

Buggy submission (verdict: Runtime Error):
s=raw_input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])

minn_man = int(maney/10000)+1
minn_sen = int(maney / 1000 )+1
minn_go  = int(maney / 5000) +1
flg=True
for man in range(0,minn_man):
	for go in range(0,minn_go):
		for sen in range(0,minn_sen):
			if man+go+sen == maisuu:
				if man*10000+ go*5000 + sen*1000 == maney:
					print(str(man)+","+str(go)+","+str(sen))
					flg=False
		if flg!=True:
			break
	if flg!=True:
		break
if flg:
	print('-1,-1,-1')

Buggy submission (verdict: Runtime Error):
s=input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])

minn_man = int(maney/10000)
minn_go  = int((maney%10000)/5000)
minn_sen = int((maney%5000)/1000)
flg = True
min_maisuu = minn_man+minn_go+minn_sen
if min_maisuu <= maisuu <= maney/1000:
	minn_go  = maney / 5000 +1
	minn_sen = maney / 1000 +1
	minn_man += 1

	for man in range(0,minn_man):
		for go in range(0,minn_go):
			for sen in range(0,minn_sen):
				if man+go+sen == maisuu:
					if man*10000+ go*5000 + sen*1000 == maney:
						print(str(man)+","+str(go)+","+str(sen))
						flg=False
if flg:
	print('-1,-1,-1')

Buggy submission (verdict: Runtime Error):
s=input_raw()
print(s)

Buggy submission (verdict: Runtime Error):
s=raw_input()

data = s.split('/')
out = '2018/01/'+data[2]

print(out)

Buggy submission (verdict: Runtime Error):
s=raw_input()

data = s.split('/')

length = len(data)

out = '2018'
for i in range(1,length):
	out += '/'+data[i]

print(out)
Problem p03471 (python)

Fixed submission:
s=input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])
 
minn_man = int(maney/10000)+1
minn_go  = int(maney / 5000) +1
for man in range(0,minn_man):
	for go in range(0,minn_go):
		# for sen in range(0,minn_sen):
		sen = maisuu - go - man
		if sen>=0:
			if man*10000+ go*5000 + sen*1000 == maney:
				print(str(man)+" "+str(go)+" "+str(sen))
				exit()
print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
s=input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])
 
minn_man = int(maney/10000)+1
minn_go  = int(maney / 5000) +1
for man in range(0,minn_man):
	for go in range(0,minn_go):
		# for sen in range(0,minn_sen):
		sen = maisuu - go - man
		if sen>0:
			if man*10000+ go*5000 + sen*1000 == maney:
				print(str(man)+" "+str(go)+" "+str(sen))
				return 
print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
s=raw_input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])

minn_man = int(maney/10000)+1
minn_sen = int(maney / 1000 )+1
minn_go  = int(maney / 5000) +1
flg=True

for man in range(0,minn_man):
	for go in range(0,minn_go):
		for sen in range(0,minn_sen):
			if man+go+sen == maisuu:
				if man*10000+ go*5000 + sen*1000 == maney:
					if flg:
						break
					print(str(man)+","+str(go)+","+str(sen))
					flg=False
if flg:
	print('-1,-1,-1')

Buggy submission (verdict: Runtime Error):
s=input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])

minn_man = int(maney/10000)+1
minn_sen = int(maney / 1000 )+1
minn_go  = int(maney / 5000) +1

for man in range(0,minn_man):
	for go in range(0,minn_go):
		for sen in range(0,minn_sen):
			if man+go+sen == maisuu:
				if man*10000+ go*5000 + sen*1000 == maney:
					print(str(man)+","+str(go)+","+str(sen))
					flg=False
if flg:
	print('-1,-1,-1')

Buggy submission (verdict: Runtime Error):
s=input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])

minn_man = int(maney/10000)

if min_maisuu <= maisuu <= maney/1000:
	minn_go  = maney / 5000 +1
	minn_sen = maney / 1000 +1
	minn_man += 1

	for man in range(0,minn_man):
		for go in range(0,minn_go):
			for sen in range(0,minn_sen):
				if man+go+sen == maisuu:
					if man*10000+ go*5000 + sen*1000 == maney:
						print(str(man)+","+str(go)+","+str(sen))
						flg=False
if flg:
	print('-1,-1,-1')

Buggy submission (verdict: Runtime Error):
s=input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])

minn_man = int(maney/10000)
minn_go  = int((maney%10000)/5000)
minn_sen = int((maney%5000)/1000)
flg = True
min_maisuu = minn_man+minn_go+minn_sen
if min_maisuu <= maisuu <= maney/1000:
	minn_go  = maney / 5000 +1
	minn_sen = maney / 1000 +1
	minn_man += 1

	for man in range(0,minn_man):
		for go in range(0,minn_go):
			for sen in range(0,minn_sen):
				if man+go+sen == maisuu:
					if man*10000+ go*5000 + sen*1000 == maney:
						print(str(man)+","+str(go)+","+str(sen))
						flg=False
if flg:
	print('-1,-1,-1')
Problem p03479 (python)

Fixed submission:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

X,Y=input_int()
count=0
while X<=Y:
    count+=1
    X*=2
print(count)

Buggy submission (verdict: Runtime Error):
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

X,Y=input_int()

import math

print(int(math.log2(Y) - math.log2(X))+1)
Problem p03565 (python)

Fixed submission:
S=input()
T=input()

s_len =len(S)
t_len =len(T)

flg=False

if s_len >= t_len:
    for head in range(len(S)-t_len,-1,-1):
        flg=True
        for s,t in zip(S[head:head+t_len],T):
            if not(s==t or "?"==s):
                flg=False
        if flg:
            break


if flg:
    S=list(S)
    S[head:head+t_len] = T
    S="".join(S)
    S=S.replace("?","a")
    print(S)
else:
    print("UNRESTORABLE")

Buggy submission (verdict: Runtime Error):
S=input()
T=input()

s_len =len(S)
t_len =len(T)

for head in range(len(S)-t_len,0,-1):
    flg=True
    for s,t in zip(S[head:head+t_len],T):
        if not(s==t or "?"==s):
            flg=False
    if flg:
        break


if flg:
    S=list(S)
    S[head:head+t_len] = T
    S="".join(S)
    S=S.replace("?","a")
    print(S)
else:
    print("UNRESTORABLE")
Problem p03696 (python)

Fixed submission:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))
# import sys
# input = sys.stdin.readline

N=one_int()
S=one_str()

head = 0
tail = 0

point=0
for a in S:
    if a =="(":
        point+=1
    else:
        point -=1
    if point<0:
        head += 1
        
        #ここで先頭にカッコをつけるのでその分のポイントは差し引き０
        point += 1


print("("*head + S + abs(point)*")")

Buggy submission (verdict: Runtime Error):
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))
# import sys
# input = sys.stdin.readline

N=one_int()
S=one_str()

first_start_index=S.index("(")

count=0
for i in range(first_start_index, N):
    if S[i]=="(":
        count += 1
    else:
        count -= 1

#count　がプラス   => その分閉じカッコが後ろにつく
#count  がマイナス => その分開始カッコが銭湯に付く
ans=S
if count >0:
    ans+= ")"*count
else:
    ans = "("*int(abs(count)) +ans

ans = first_start_index*"(" + ans

print(ans)
Problem p03786 (python)

Fixed submission:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))
# import sys
# input = sys.stdin.readline

import itertools as it

N=one_int()

A=many_int()

A=sorted(A)
sums_A=list(it.accumulate(A))

for i in range(N-1, -1, -1):
    if 2*sums_A[i-1] < A[i]: 
        break

print(N-i)

Buggy submission (verdict: Runtime Error):
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))
# import sys
# input = sys.stdin.readline

N=one_int()

A=many_int()

A=sorted(A)
sums_A=list(it.accumulate(A))

for i in range(N-1):
    if 2*sums_A[i] < A[i+1]: 
        break

if len(set(A))==1:
    print(N)
else:
    print(N-i-1)
Problem p03818 (python)

Fixed submission:
N=int(input())

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

#重複した値だけを集めて消す

sets={}
for i in A:
    if i in sets:
        sets[i]+=1
    else:
        sets[i]=1

duplicate=0
for k,v in sets.items():
    if v>1:
        duplicate+=(v-1)

duplicate %=2

print(len(set(A))-duplicate)

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

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

#重複した値だけを集めて消す

sets={}
for i in A:
    if i in sets:
        sets[i]+=1
    else:
        sets[i]=1

sets

duplicate=0
for k,v in sets.items():
    if v>1:
        duplicate+=(v-1)

duplicate %=2

print(set(A))-duplicate
Problem p03830 (python)

Fixed submission:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))
# import sys
# input = sys.stdin.readline

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

    return arr

N=one_int()

dicts={}
for i in range(2,N+1):
    lists = factorization(i)
    for item in lists:
        if item[0] != 1:
            if item[0] in dicts:
                dicts[item[0]] += item[1]
            else:
                dicts[item[0]] = item[1]

div=10**9 + 7
ans=1

for k,v in dicts.items():
    ans *= (v+1)%div

print(ans%div)

Buggy submission (verdict: Runtime Error):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**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([n, 1])

    return arr

N=one_int()

dicts={}
for i in range(2,N+1):
    lists = factorization(i)
    for item in lists:
        if item[0] != 1:
            if item[0] in dicts:
                dicts[item[0]] += item[1]
            else:
                dicts[item[0]] = item[1]

div=10**9 + 7
ans=1

for k,v in dicts.items():
    ans *= (v+1)%div

print(ans%div)
Problem p04031 (python)

Fixed submission:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N=one_int()
X=many_int()

sort_X=sorted(X)
min_X = sort_X[0]
max_X = sort_X[-1]

min_num = 0
min_sum = 99999999999
for i in range(min_X, max_X+1):
    temp_sum = 0
    for j in X:
        temp_sum += (j-i)**2
    
    if temp_sum < min_sum:
        min_sum = temp_sum
        min_num = i

print(min_sum)

Buggy submission (verdict: Runtime Error):
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N=one_int()
X=many_int()

sort_X=sorted(X)
min_X = sort_X[0]
max_X = sort_X[1]

min_num = 0
min_sum = 99999999999
for i in range(min_X, max_X+1):
    temp_sum = 0
    for j in X:
        temp_sum += (j-i)**2
    
    if temp_sum < min_sum:
        min_sum = temp_sum
        min_num = i

print(min_num)
Problem p04043 (python)

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

hoge=set([A,B,C])
if hoge==set([5,7]):
    if A+B+C==17:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
A,B,C=map(int,input().split())

hoge=set([A,B,C])
if hoge==set([5,7]):
    if A+B+C=17:
        print("YES")
    else:
        print("NO")
Problem p02677 (python)

Fixed submission:
import math
inputs = input().split()
A, B, H, M = int(inputs[0]), int(inputs[1]), int(inputs[2]), int(inputs[3])
num_diff = H*5+M/12 - M

ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(2 * math.pi * ( num_diff / 60 )))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
inputs = input().split()
A, B, H, M = int(inputs[0]), int(inputs[1]), int(inputs[2]), int(inputs[3])
num_diff = H*5+M/12 - M

ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(2 * math.pi( num_diff / 60 ))

print(ans)

Buggy submission (verdict: Runtime Error):
import math
inputs = input().split()
A, B, H, M = int(inputs[0]), int(inputs[1]), int(inputs[2]), int(inputs[3])
num_diff = H*5 - M
ans1=ans2=ans3=0
if num_diff > 30:
    ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(( (30 -(num_diff)) * 6 )/180 * math.pi) )
#    print('case 1')
#elif num_diff < 0:
#	ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(( (30 +(num_diff)) * 6 )/180 * math.pi) )
#	print('case 2')
else:
	if H <=6 and M <=30:
	    ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(( (num_diff) * 6 )/ 135 * math.pi) )
#	    print('case 3')
	elif H >=6 and M >= 30:
	    ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(( (num_diff) * 6 )/ 135 * math.pi) )
#	    print('case 4')

print(ans)

Buggy submission (verdict: Runtime Error):
import math
inputs = input().split()
A, B, H, M = int(inputs[0]), int(inputs[1]), int(inputs[2]), int(inputs[3])
num_diff = H*5 - M
ans1=ans2=ans3=0
if num_diff > 30:
    ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(( (30 -(num_diff)) * 6 )/180 * math.pi) )
    print('case 1')
#elif num_diff < 0:
#	ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(( (30 +(num_diff)) * 6 )/180 * math.pi) )
#	print('case 2')
else:
	if H <=6 and M <=30:
	    ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(( (num_diff) * 6 )/ 135 * math.pi) )
	    print('case 3')
	elif H >=6 and M >= 30:
	    ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(( (num_diff) * 6 )/ 135 * math.pi) )
	    print('case 4')

print(ans)
Problem p03284 (python)

Fixed submission:
def A():
    a = input().split()
    if len(a) ==2:            
        n = int(a[0])
        k = int(a[1])
        if n % k != 0:
            print(1)
        else:
            print(0)


if __name__ =='__main__':
    A()

Buggy submission (verdict: Runtime Error):
def B():
    n = int(input())
    mul4 = n % 4
    mul8 = n % 8
    mul7 = n % 7
    mul6 = n % 6
    mul11 = n % 11

    YES='Yes'
    NO='No'

    if mul4==0 or mul7==0 or mul11==0:
        print(YES)
    elif mul7 % 4==0:
        print(YES)
    elif mul8 % 7==0:
        print(YES)
    elif n==30 or n==60 or n==90:
        print(YES)
    else:
        print(NO)
        

if __name__ =='__main__':
    B()
Problem p03292 (python)

Fixed submission:

def A():
    s = input().split()
    a = [int(n) for n in s]
    a.sort()
    a.reverse()
    
    a_i = a[0]
    sum = 0
    for x in a[1:]:
        sum += abs(a_i - x)
        a_i = x 
    
    print(sum)

if __name__ =='__main__':
    A()

Buggy submission (verdict: Runtime Error):

def B():
    s1 = input()
    s2 = input()
    
    YES = 'Yes'
    NO = 'No'
    
    result = NO
    for i in range(len(s1)):
        p = s1[i:] + s1[:i]
        if(p in s2):
            result = YES
    
    print(result)

if __name__ =='__main__':
    B()

Buggy submission (verdict: Runtime Error):
def A():
    a = input().split()
    try:
        for x in a:
            x = int(x)
    except:
        exit(1)
    a.sort()
    a.inverse()
    
    a_i = a[0]
    sum = 0
    for x in a[1:]:
        sum += abs(a_i - x)
        a_i = x 
    
    print(sum)


if __name__ =='__main__':
    A()
Problem p02681 (python)

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

Buggy submission (verdict: Runtime Error):
S = input()
T = in@ut()

if(S==T[:-1]):
  print("Yes")
else:
  print("No")
Problem p02700 (python)

Fixed submission:
A, B, C, D = [int(n) for n in input().split(' ')]
 
while True:
  C -= B
  if C <=0:
    print("Yes")
    break
  A-=D
  if A<=0:
    print("No")
    break

Buggy submission (verdict: Runtime Error):
A, B, C, D = [int(n) for n in input().split(' ')]

while True:
  C -= B
  if C <=0:
    print("Yes")
    break
  A-=D
  if A<=:
    print("No")
    break
Problem p02713 (python)

Fixed submission:
import math
K=int(input())
ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        tmp=math.gcd(i,j)
        for k in range(1,K+1):
            ans+=math.gcd(tmp,k)         
print(ans)

Buggy submission (verdict: Runtime Error):
import math

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())
sum = 0
for i in range(1, K+1):
  for j in range(1, K+1):
    for k in range(1, K+1):
      sum += gcd(i,j,k)
print(sum)
Problem p02812 (python)

Fixed submission:
N = int(input())
S = input()
 
cnt = 0
for i in range(N-2):
    if S[i] == 'A':
        if S[i+1] == 'B':
            if S[i+2] == 'C':
                cnt += 1
 
print(cnt)

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

cnt = 0
for i in range(N):
    if S[i] == 'A':
        if S[i+1] == 'B':
            if S[i+2] == 'C':
                cnt += 1

print(cnt)
Problem p02865 (python)

Fixed submission:
N = int(input())
a = []
 
for x in range(1, N):
    y = N-x
    if x == y:
        continue
    if x > y:
        break
    a.append([x, y])
 
print(len(a))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = []
 
for x in range(1, N):
    y = N-x
    if x == y:
        continue
    a.append([x, y])
 
print(len(a))
N = int(input())
a = []

for x in range(1, N):
    y = N-x
    if x == y:
        continue
    if x > y:
        break
    a.append([x, y])

print(len(a))
提出情報

Buggy submission (verdict: Runtime Error):
N = input()
a = []

for x in range(1, N):
    y = N-x
    if x == y:
        continue
    a.append([x, y])

print(len(a))
Problem p02705 (python)

Fixed submission:
import math

R = (int)(input())

print(2*math.pi*R)

Buggy submission (verdict: Runtime Error):
import math

R = (int)input()

print(2*math.pi*R)
Problem p02606 (python)

Fixed submission:
import sys
input = sys.stdin.readline

l,r,d = map(int,input().split())
cnt=0
for i in range(l,r+1):
    if i%d==0:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

l,r,d = map(int,input().split())
cnt=0
for i in range(l,r+1):
    if i%d=0:
        cnt+=1
print(cnt)
Problem p02814 (python)

Fixed submission:
def main():
    """"ここに今までのコード"""
    import sys
    input = sys.stdin.readline
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    #A.sort()
    if n==1:
        ans=(m//(A[0]//2)+1)//2
        print(int(ans))
        exit()
    from fractions import gcd
    kou=A[0]*A[1]//gcd(A[0],A[1])
    for a in A:
        kou=a*kou//gcd(a,kou)
        if (kou//a)%2==0:
            print(0)
            exit()
    kou//=2
    #print(kou)
    ans=(m//kou+1)//2
    print(int(ans))
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    """"ここに今までのコード"""
    import sys
    input = sys.stdin.readline
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    #A.sort()
    if n==1:
        ans=(m//(A[0]//2)+1)//2
        print(int(ans))
        exit()
    from fractions import gcd
    kou=A[0]*A[1]//gcd(A[0],A[1])
    from bisect import bisect_right as br
    c=br(A,A[-1]//2)
    for a in A:
        kou=a*kou//gcd(a,kou)
    for a in range(min(c+1,n))
        if (kou//A[a])%2==0:
            print(0)
            exit()
    kou//=2
    #print(kou)
    ans=(m//kou+1)//2
    print(int(ans))
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    """"ここに今までのコード"""
    import sys
    input = sys.stdin.readline
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    A.sort()
    if n==1:
        ans=(m//(A[0]//2)+1)//2
        print(int(ans))
        exit()
    from fractions import gcd
    kou=A[0]*A[1]//gcd(A[0],A[1])
    for a in A:
        kou=A[a]*kou//gcd(a,kou)
        if (kou//a)%2==0:
            print(0)
            exit()
    kou//=2
    #print(kou)
    ans=(m//kou+1)//2
    print(int(ans))
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
A=list(map(int,input().split()))
for i in range(n):
    A[i]/=2
from fractions import gcd
kou=A[0]*A[1]/gcd(A[0],A[1])
for a in A:
    kou=a*kou/gcd(a,kou)
#print(kou)
ans=(m//kou+1)//2
print(int(ans))
Problem p02837 (python)

Fixed submission:
n=int(input())
a=[]
for i in range(n):
    m=int(input())
    a.append(list(list(map(int,input().split())) for i in range(m)))

ans=0
for i in range(2**n):
    r=1
    ib=list(format(i,"b").zfill(n))
    for j in range(n):
        if ib[j]=="1":
            for k in range(len(a[j])):
                if int(ib[a[j][k][0]-1])!=a[j][k][1]:
                    r=0
    if r==1:
        ans=max(ans,ib.count("1"))
print(ans)

Buggy submission (verdict: Runtime Error):

n=int(input())
a=[0]*n
g=[[0]*n for _ in range(n)]
for i in range(n):
    a[i]=int(input())
    for j in range(a[i]):
        x,y=map(int,input().split())
        g[i][x]=y
count=0
for i in range(n):
    for j in range(n):
        if i==j:
            break
        else:
            if g[i][j]==0 and g[j][i]==0:
                count+=1
print(count)