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

Fixed submission:
#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
#def lcm_base(x, y):
#    interium=x//math.gcd(x, y)
#    return (interium*y)
#print(reduce(lcm_base, T))
ans=1
def grcode(x, y):
    if y==0:
        return (x)
    else:
        return grcode(y, x%y)
for i in range(N-1):
    T[i]=T[i]//grcode(T[i],T[i+1])
    T[i+1]=T[i]*T[i+1]
print(T[N-1])

Buggy submission (verdict: Runtime Error):
#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
#def lcm_base(x, y):
#    interium=x//math.gcd(x, y)
#    return (interium*y)
#print(reduce(lcm_base, T))
ans=1
def grcode(x, y):
    if y==0:
        return (x)
    else:
        return grcode(y, x%y)
#for i in range(N-1):
#    T[i]=T[i]//grcode(T[i],T[i+1])
#    T[i+1]=T[i]*T[i+1]
#print(T[N-1])
for i in range(N-1):
    T[i]=T[i]//math.gcd(T[i],T[i+1])
    T[i+1]=T[i]*T[i+1]
print(T[N-1])

Buggy submission (verdict: Runtime Error):
#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
#def lcm_base(x, y):
#    interium=x//math.gcd(x, y)
#    return (interium*y)
#print(reduce(lcm_base, T))
ans=1
for i in range(N-1):
    T[i]=T[i]//math.gcd(T[i], T[i+1])
for i in range(N):
    ans=ans*T[i]
print(ans)

Buggy submission (verdict: Runtime Error):
#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
#def lcm_base(x, y):
#    interium=x//math.gcd(x, y)
#    return (interium*y)
#print(reduce(lcm_base, T))
ans=1
for i in range(N-1):
    T[i]=T[i]/math.gcd(T[i], T[i+1])
for i in range(N):
    ans=ans*T[i]
print(int(ans))

Buggy submission (verdict: Runtime Error):
#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
def lcm_base(x, y):
    interium=x/math.gcd(x, y)
    return (interium*y)
print(reduce(lcm_base, T))

Buggy submission (verdict: Runtime Error):
#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
def lcm_base(x, y):
    interium=x//math.gcd(x, y)
    return (interium*y)
print(reduce(lcm_base, T))

Buggy submission (verdict: Runtime Error):
#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
def lcm_base(x, y):
    return (x//math.gcd(x, y)*y)
print(reduce(lcm_base, T))

Buggy submission (verdict: Runtime Error):
#ABC070C
import math
from functools import reduce
#N=int(input())
T=[int(input()) for i in range(N)]
def lcm_base(x, y):
    return (x//math.gcd(x, y)*y)
print(reduce(lcm_base, T))

Buggy submission (verdict: Runtime Error):
#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
print(reduce(lcm_base, T))
Problem p03673 (python)

Fixed submission:
#ABC066C
n=int(input())
a=list(map(int, input().split()))
flg=n%2
half=n//2
front=[0]*(half+flg)
back=[0]*(half)
for i in range(half):
    front[half+flg-1-i]=a[2*i-flg+1]
    back[i]=a[2*i+flg]
if flg==1:
    front[0]=a[n-1]
print(' '.join(map(str, front+back)))

Buggy submission (verdict: Runtime Error):
#ABC066C
n=int(input())
a=list(map(int, input().split()))
front=[]
back=[]
flg=n%2
for i in range(n//2):
    front.insert(0, a[2*i-flg+1])
    #back.append(a[2*i+flg])
back=[a[2*i+flg] for i in range(n)]
if flg==1:
    front.insert(0, a[n-1])
print(' '.join(map(str, front+back)))
Problem p03854 (python)

Fixed submission:
S=str(input())
S=S.replace('eraser','1')
S=S.replace('erase','2')
S=S.replace('dreamer','3')
S=S.replace('dream','4')
S=S.replace('1','')
S=S.replace('2','')
S=S.replace('3','')
S=S.replace('4','')
if len(S)==0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
    print("NO")
else:
    print("YES"
Problem p03999 (python)

Fixed submission:
S=str(input())
formula=[""]*(len(S)*2-1)
ans=0
for i in range(len(S)*2-1):
    if i%2==0:
        formula[i]=S[i//2]
place=pow(2,len(S)-1)-1
for i in range(place+1):
    for j in range(len(bin(i))-2):
        #strしたbinには0bのprefixが付く。
        if int(str(bin(i))[-j-1])==1:
            formula[2*j+1]="+"
    ans+=eval(''.join(formula))
    for k in range((len(formula)-1)//2):
        formula[2*k+1]=""
print(ans)

Buggy submission (verdict: Runtime Error):
S=str(input())
formula=[""]*(len(S)*2-1)
ans=0
for i in range(len(S)*2-1):
    if i%2==0:
        formula[i]=S[i//2]
place=pow(2,len(S)-1)-1
for i in range(place+1):
    for j in range(len(bin(i))-2):
        #strしたbinには0bのprefixが付く。
        if int(str(bin(i))[-j-1])==1:
            formula[2*j+1]="+"
    ans+=eval(''.join(formula))
    for k in range((len(formula)-1)/2):
        formula[2*k+1]=""
print(ans)

Buggy submission (verdict: Runtime Error):
S=str(input())
formula=[""]*(len(S)*2-1)
ans=0
for i in range(len(S)*2-1):
    if i%2==0:
        formula[i]=S[i//2]
place=pow(2,len(S)-1)-1
for i in range(place+1):
    for j in range(len(bin(i))-2):
        #strしたbinには0bのprefixが付く。
        if int(str(bin(i))[-j-1])==1:
            formula[2*j+1]="+"
    ans+=eval(''.join(formula))
    for k in range(len(bin(i))-2):
        formula[2*k+1]=""
print(ans)

Buggy submission (verdict: Runtime Error):
S=str(input())
formula=[""]*(len(S)*2-1)
ans=0
for i in range(len(S)*2-1):
    if i%2==0:
        formula[i]=S[i//2]
place=pow(2,len(S)-1)-1
for i in range(place+1):
    for j in range(len(bin(i))-2):
        #strしたbinには0bのprefixが付く。
        if int(str(bin(i))[-j-1])==1:
            formula[2*j+1]="+"
    ans+=eval(''.join(formula))
    for k in range(len(bin(i))-2):
        formula[2*j+1]=""
print(ans)
Problem p03296 (python)

Fixed submission:
n=int(input())
a=input().split(' ')

count = 0
i=0
while i<n-1:
	if a[i]==a[i+1]:
		count+=1
		i+=2
	else:
		i+=1
print(count)

Buggy submission (verdict: Runtime Error):
import random
n=int(input())
a=input().split(' ')

count = 0
for i in range(n-1):
	if a[i]==a[i+1]:
		count+=1
		if i<n-1:
			while True:
				a[i+1]=random.randint(1,n)
				if a[i+1]!=a[i+2]:
					 break
				else:
					continue
print(count)
Problem p03448 (python)

Fixed submission:
a = input()
b= input()
c= input()
x= input()

n = 0
for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			sum = 500*i + 100*j + 50*k
			if sum == x:
				n+=1

print n

Buggy submission (verdict: Runtime Error):
a=int(input())
b,c=map(int,input().split())
s=input()
print("{} {}".format(a+b+c,s))



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


i=input()
print(count('1'))




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

n=0
flag = 1

while flag:
	for i in range(len(a)):
		if a[i]%2==0:
			a[i]=a[i]//2
		else:
			flag = 0
	n=n+1

print(n-1)


a=int(input())
b=int(input())
c=int(input())
x=int(input())

count=0
for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			sum = 500*i+100*j+50*k
			if(x%50==0 and sum == x):
				count+=1

print(count)
Problem p03455 (python)

Fixed submission:
i = raw_input().split(' ')
result =int(i[0])*int(i[1])
if result%2==0:
	print 'Even'
else:
	print 'Odd'

Buggy submission (verdict: Runtime Error):
i = raw_input().split(' ')
num = int(str(i[0]+str(i[1])))
for i in range(100):
	if i*i==num:
		print 'Yes'
	else:
		print 'No'
ethan:work ethan$
Problem p03456 (python)

Fixed submission:
i = raw_input().split(' ')
num = int(str(i[0]+str(i[1])))
flag = 'null'
for i in range(1000):
	if i*i==num:
		flag= 'Yes'
	else:
		pass

if flag == 'Yes':
	print 'Yes'
else:
	print 'No'

Buggy submission (verdict: Runtime Error):
i = raw_input().split(' ')
num = int(str(i[0]+str(i[1])))
for i in range(100)
	if i*i==num:
		print 'Yes'
	else:
		print 'No'
Problem p03493 (python)

Fixed submission:
i=input()
print(i.count('1'))

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

n=0
flag = 1

while flag:
	for i in range(len(a)):
		if a[i]%2==0:
			a[i]=a[i]//2
		else:
			flag = 0
	n=n+1

print(n-1)

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

n=0
flag = 1

while flag:
	for i in range(len(a)):
		if a[i]%2==0:
			a[i]=a[i]//2
		else:
			flag = 0
	n=n+1

print(n-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
n=0
flag = 1

while flag:
	for i in range(len(a)):
		if a[i]%2==0:
			a[i]=a[i]/2
		else:
			flag = 0
	n=n+1

print(n-1)

Buggy submission (verdict: Runtime Error):
i=input()
print(count('1'))
Problem p03296 (python)

Fixed submission:
N = int(input())
L = list(map(int,input().split()))
count = 0

for i in range(0,N-1):
    if L[i] == L[i+1]:
        L[i+1] = 101
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
import fractions
T = int(input())

L = []
for i in range(0,T):
    L = list(map(int, input().split()))
    A = L[0]
    B = L[1]
    C = L[2]
    D = L[3]

    ans = "Yes"
    if A < B: #前提条件
        ans = "No"
    elif D < B: #前提条件
        ans = "No"
    elif B - C <= 1: #BとCの差が1より小さければ何が来てもOK
        ans = "Yes"
    elif C < B-fractions.gcd(B,D)+(A%fractions.gcd(B,D)):
        ans = "No"


    print(ans)
    L = []
Problem p03297 (python)

Fixed submission:
import fractions
T = int(input())

L = []
for i in range(0,T):
    L = list(map(int, input().split()))
    A = L[0]
    B = L[1]
    C = L[2]
    D = L[3]

    ans = "Yes"
    if A < B: #前提条件
        ans = "No"
    elif D < B: #前提条件
        ans = "No"
    elif B - C <= 1: #BとCの差が1より小さければ何が来てもOK
        ans = "Yes"
    elif C < B-fractions.gcd(B,D)+(A%fractions.gcd(B,D)):
        ans = "No"


    print(ans)
    L = []

Buggy submission (verdict: Runtime Error):
import math
T = int(input())

L = []
for i in range(0,T):
    L = list(map(int, input().split()))
    A = L[0]
    B = L[1]
    C = L[2]
    D = L[3]

    ans = "Yes"
    if A < B: #前提条件
        ans = "No"
    elif D < B: #前提条件
        ans = "No"
    elif B - C <= 1: #BとCの差が1より小さければ何が来てもOK
        ans = "Yes"
    elif C < B-math.gcd(B,D)+(A%math.gcd(B,D)):
        ans = "No"


    print(ans)
    L = []
Problem p03309 (python)

Fixed submission:
from statistics import median
N = int(input())
AList = list(map(int, input().split()))
 
L = []
m = 0
for j in range(1, N+1):
    L.append(AList[j-1] - j)
m = median(L)
 
p = 0
for j in range(1, N+1):
    p += abs(AList[j-1] - j - m)
 
print(int(p))

Buggy submission (verdict: Runtime Error):
import sys
import math
N = input()
AList = list(map(int, input().split()))
listnum = 1000000000

low = -1000000000
high = 1000000000

mode = 1
a1 = 0
a2 = 0
while(True):
    p1 = math.floor((abs(low) + abs(high))/3) + low
    p2 = high - math.floor((abs(low) + abs(high))/3) 

    for j in range(1,int(N)+1):
        a1 += abs(AList[j-1] -(p1 + j))
    for j in range(1,int(N)+1):
        a2 += abs(AList[j-1] -(p2 + j))

    if a1 == a2 or abs(a1-a2) == 1:
        print(min(a1,a2))
        sys.exit()
    elif a1 < a2:
        high = p2
    else:
        low = p1        
    a1 = 0
    a2 = 0
Problem p03359 (python)

Fixed submission:
a,b = input().split()
a = int(a)
b = int(b)
ans = 0
if a <= b:
    ans = a
else:
    ans = a - 1
print(ans)

Buggy submission (verdict: Runtime Error):
H,W = input().split()
H,W = int(H),int(W)
nodes = [list(input()) for i in range(H)]


if H == 1 and W == 1 and nodes[0][0] == ".":
    print("No")
    quit()
if H == 1 and W == 1 and nodes[0][0] == "#":
    print("Yes")
    quit()


for i in range(H):
    for j in range(W):
        if nodes[i][j] == "#":
            flag = False
            if i - 1 >= 0:
                if nodes[i-1][j] == "#":
                    flag = True
            if i + 1 < H:
                if nodes[i+1][j] == "#":
                    flag = True
            if j - 1 >= 0:
                if nodes[i][j-1] == "#":
                    flag = True
            if j + 1 < W:
                if nodes[i][j+1] == "#":
                    flag = True

            if flag == False:
                print("No")
                quit()

print("Yes")
Problem p03361 (python)

Fixed submission:
H,W = input().split()
H,W = int(H),int(W)
nodes = [list(input()) for i in range(H)]


if H == 1 and W == 1 and nodes[0][0] == ".":
    print("No")
    quit()
if H == 1 and W == 1 and nodes[0][0] == "#":
    print("Yes")
    quit()


for i in range(H):
    for j in range(W):
        if nodes[i][j] == "#":
            flag = False
            if i - 1 >= 0:
                if nodes[i-1][j] == "#":
                    flag = True
            if i + 1 < H:
                if nodes[i+1][j] == "#":
                    flag = True
            if j - 1 >= 0:
                if nodes[i][j-1] == "#":
                    flag = True
            if j + 1 < W:
                if nodes[i][j+1] == "#":
                    flag = True

            if flag == False:
                print("No")
                quit()

print("Yes")

Buggy submission (verdict: Runtime Error):
H,W = input().split()
H,W = int(H),int(W)
nodes = [list(input()) for i in range(H)]


if H == 1 and W == 1 and nodes[0][0] == ".":
    print("No")
    quit()

for i in range(len(nodes)):
    for j in range(len(nodes)):
        if nodes[i][j] == "#":
            flag = False
            if i - 1 >= 0:
                if nodes[i-1][j] == "#":
                    flag = True
            if i + 1 < H:
                if nodes[i+1][j] == "#":
                    flag = True
            if j - 1 >= 0:
                if nodes[i][j-1] == "#":
                    flag = True
            if j + 1 < W:
                if nodes[i][j+1] == "#":
                    flag = True

            if flag == False:
                print("No")
                quit()

print("Yes")
Problem p03407 (python)

Fixed submission:
S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
a = 'No'
if C <= A + B:
    a = 'Yes'
print(a)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input().split()
B = input().split()

L = {}
for i in range(len(A)):
    for j in range(len(B)):
        c = int(A[i]) + int(B[j])
        if c in L:
            del L[c] 
        else:
            L[c] = c
a = 0
for i in L.values():
    a = a ^ i
print(a)
Problem p03455 (python)

Fixed submission:
item = input().split(' ')
if ((int(item[0]) * int(item[1])) % 2) == 0:
    print('Even')
else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
T=0
X=1
Y=2
item = input()
tabiji = [[0,0,0]]
for i in range(1, int(item)+1):
    tabiji.append(input().split(' '))

a='Yes'
for i in range(0, len(tabiji)-1):
    time = int(tabiji[i+1][T]) - int(tabiji[i][T])
    dX = int(tabiji[i+1][X]) - int(tabiji[i][X])
    dY = int(tabiji[i+1][Y]) - int(tabiji[i][Y])
    for j in range(time):
        if dX > 0:
            dX -= 1
        elif dX < 0:
            dX += 1
        elif dY > 0:
            dY -= 1
        elif dY < 0:
            dY += 1
        if dX == 0 and dY == 0 and (time - j+1) % 2 == 1:
            a = 'No'
            break
        elif dX == 0 and dY == 0 and (time - j+1) % 2 == 0:
            break
    if dX != 0 or dY != 0:
        a = 'No'

print(a)
Problem p04001 (python)

Fixed submission:
S = input()
R = 0
S = list(S)
temp = []
for i in range(2**(len(S)-1)):
    for m in range(len(S)-1):
        if i+1 & 2**(m) > 0:
            temp.append(S[m] + "+")
        else:
            temp.append(S[m])
    temp.append(S[len(S)-1])
    temp = "".join(temp)
    R += eval(temp)
    temp = []    
print(R)

Buggy submission (verdict: Runtime Error):
S = input()
R = 0
S = list(S)
temp = []
if len(S)-1 == 0:
    R = int(S)
for i in range(2**(len(S)-1)):
    for m in range(len(S)-1):
        if i+1 & 2**(m) > 0:
            temp.append(S[m] + "+")
        else:
            temp.append(S[m])
    temp.append(S[len(S)-1])
    temp = "".join(temp)
    R += eval(temp)
    temp = []    
print(R)
Problem p03302 (python)

Fixed submission:
def main():
    inputs = input()
    data = inputs.split(" ")
    data = [int(d) for d in data]
    m = max(data)
    ans = 15
    if int(m) > 15:
        print("x")
    else:
        s = sum(data)
        if data[0] * data[1] == 15:
            print("*")
        elif s == 15:
            print("+")
        else:
            print("x")
        
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def sum_ans(data):
    if sum(data) == 15:
        print("+")


def main():
    inputs = input()
    data = inputs.split(" ")
    m = max(data)
    ans = 15
    if m > 15:
        print("x")
    else:
        sum_ans()
        if data[0] * data[1] == 15:
            print("*")
        elif data[0] * data[1] < 15:
            print("x")
        
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def sum_ans(data):
    if sum(data) == 15:
        print("+")


def main():
    inputs = input()
    data = inputs.split(" ")
    m = max(data
    ans = 15
    if m > 15:
        print("x")
    else:
        sum_ans()
        if data[0] * data[1] == 15:
            print("*")
        elif data[0] * data[1] < 15:
            print("x")
        
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def sum_ans = (data):
    if sum(data) == 15:
        print("+")


def main():
    inputs = input()
    data = inputs.split(" ")
    m = max(data
    ans = 15
    if m > 15:
        print("x")
    else:
        sum_ans()
        if data[0] * data[1] == 15:
            print("*")
        elif data[0] * data[1] < 15:
            print("x")
        
if __name__ == "__main__":
    main()
Problem p03296 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
count = 0

if N != 2:
    for i in range(1,N-1):
        if a[i] == a[i-1]:
            a[i] = a[i+1] + 1
            count = count + 1
else:
    if a[0] == a[1]:
        a[0] = a[1]+1
        count = count + 1

if a[N-2] == a[N-1]:
    count = count + 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
count = 0

if N != 2:
    for i in range(1,N):
        if a[i] == a[i-1]:
            a[i] = a[i+1] + 1
            count = count + 1
else:
    if a[0] == a[1]:
        count = count + 1


print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
count = 0
a = []
b = input()
c = b.split()
for i in range(N):
    a.append(int(c[i]))

for i in range(1,N):
    if a[i] == a[i-1]:
        a[i] = a[i+1] + 1
        count = count + 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
count = 0
a = list(map(int,input().split()))


for i in range(1,N):
    if a[i] == a[i-1]:
        a[i] = a[i+1] + 1
        count = count + 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
count = 0
a = list(map(int,input().split()))


for i in range(1,N):
    if a[i] == a[i-1]:
        a[i] = a[i+1] + 1
        count = count + 1

print(count)
Problem p03328 (python)

Fixed submission:
a,b = map(int, input().split())
c = b-a
d = 0

for i in range(1,c):
    d = i + d

print(d - a)

Buggy submission (verdict: Runtime Error):
c = 0
A =input().split(" ")
a,b = A[0],A[1]
for i in range(1,a-b):
    c = c + i
print(a-c)
Problem p03385 (python)

Fixed submission:
S = input().replace("a","",1).replace("b","",1).replace("c","",1)
if S:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
A,B,K =map(int,input().split())
for i in range(A,B+1):
    if i < (A + K) :
        print(i)
    elif i > (B - K):
        print(i)

Buggy submission (verdict: Runtime Error):
A,B,K =map(int,input().split())
for i in range(A,B+1):
    if i < (A + K) or i > (B - K):
        print(i)
Problem p03316 (python)

Fixed submission:
N0 = int(input())
N1 = list(map(int,str(N0)))
S_N = 0

for i in range(len(N1)):
    S_N += N1[i]

if N0 % S_N == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N0 = int(input())
N1 = list(map(int,str(N0)))
S_N = 0

for i in range(len(N)):
    S_N += N1[i]

if N0 % S_N == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N0 = int(input())
N1 = list(map,N0)
S_N = 0

for i in range(len(N1)):
    S_N += N1[i]

if N0 % S_N == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N0 = int(input())
N1 = list(map,N0)
S_N = 0

for i in range(len(N)):
    S_N += N[i]

if N % S_N == 0:
    print('Yes')
else:
    print('No')
Problem p03741 (python)

Fixed submission:
n = int(input())
ar = list(map(int,input().split()))
su = [0]*n
su[0]=ar[0]
for i in range(1,n):
    su[i] = ar[i] + su[i-1]

# +
ans1,off = 0,0
for i in range(0,n):
    if i%2 == 0:
        if su[i] + off <= 0:
            ans1 += 1-(su[i]+off)
            off += 1-(su[i]+off)
    else:
        if su[i] + off >= 0:
            ans1 += (su[i]+off+1)
            off -= (su[i]+off+1)

# -
ans2,off = 0,0
for i in range(0,n):
    if i%2 != 0:
        if su[i] + off <= 0:
            ans2 += 1-(su[i]+off)
            off += 1-(su[i]+off)
    else:
        if su[i] + off >= 0:
            ans2 += (su[i]+off+1)
            off -= (su[i]+off+1)
print(min(ans1,ans2))

Buggy submission (verdict: Runtime Error):
import sys,time
X, Y = map(int,input().split())
time.sleep((X%7)/5)
Problem p03363 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = [0]
for i in range(n):
    s.append(s[-1] + a[i])
s.sort()
result = 0

count = 1
for i in range(n):
    if s[i] == s[i+1]:
        count += 1
    else:
        result += count * (count - 1) // 2
        count = 1
result += count * (count - 1) // 2

print(result)

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

s = []
for i in range(n):
    s.append(list(input()))

result = 0
for offset in range(n):
    is_symmetry = True
    for i in range(n):
        for j in range(i+1, n):
            if s[i][(j+offset)%n] != s[j][(i+offset)%n]:
                is_symmetry = False
                break
        if not is_symmetry:
            break
    if is_symmetry:
        result += n
        # print('offset: %i' % offset)

print(result)
Problem p03297 (python)

Fixed submission:
import fractions 
n=int(input())
for _ in range(n):
    a,b,c,d=map(int,input().split())
    if d<b:
        print("No")
        continue
    elif a<b:
        print("No")
        continue
    elif c>=b:
        print("Yes")
        continue
    g=fractions.gcd(b,d)
    h=((b-1-a%b)//g)*g
    if a%b+h>c:
        print("No")
        continue
    print("Yes")

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
for _ in range(n):
    a,b,c,d=map(int,input().split())
    if d<b:
        print("No")
        continue
    elif a<b:
        print("No")
        continue
    g=math.gcd(b,d)
    h=1
    if 1+h>c:
        print("No")
        continue
    print("Yes")

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
for _ in range(n):
    a,b,c,d=map(int,input().split())
    if d<b:
        print("No")
        continue
    elif a<b:
        print("No")
        continue
    g=math.gcd(b,d)
    h=int((b-1-1)/g)*g
    if a%b+h>c:
        print("No")
        continue
    print("Yes")

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
for _ in range(n):
    a,b,c,d=map(int,input().split())
    if d<b:
        print("No")
        continue
    elif a<b:
        print("No")
        continue
    g=math.gcd(b,d)
    h=1
    if a%b+h>c:
        print("No")
        continue
    print("Yes")
Problem p03302 (python)

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

check=0
if a[0]+a[1]==15:
    check=1
elif a[0]*a[1]==15:
    check=2

if check==1:
    print("+")
elif check==2:
    print("*")
else:
    print("x")

Buggy submission (verdict: Runtime Error):

strings=[input() for string in range(2)]
string=strings[0]
num=int(strings[1])
i=0
check=True

while check:
    s=string[i:i+num]
    if len(s)<num:
        check=False
    print(s)
    i=i+num

Buggy submission (verdict: Runtime Error):

a=int(input().split())
check=0
if a[0]+a[1]==15:
    check=1
elif a[0]*a[1]=15:
    check=2

if check==1:
    print("+")
elif check==2:
    print("*")
else:
    print("x")