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

Fixed submission:
from fractions import gcd
N = int(input())
life_list = list(map(int, input().split()))
ans = life_list[0]
for A in life_list:
  ans = gcd(ans, A)
        
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
life_list = list(map(int, input().split()))
life_list.sort()
while life_list[1] - life_list[0] > 0:
    if life_list[1] == life_list[0]:
        break
	life_list[1] = life_list[1] - life_list[0]
    life_list.sort()
        
print(life_list[0])
Problem p03307 (python)

Fixed submission:
N = int(input())
print(N if N%2 == 0 else N*2)

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

for i in range(N):
    A[i] -= i+1

A.sort()
print(A)
median = A[N//2]

for i in range(N):
    A[i] -= median
    A[i] = abs(A[i])
print(sum(A))
Problem p03774 (python)

Fixed submission:
N, M = map(int, input().split())
stu = []
che = []
for i in range(N):
  stu.append(list(map(int, input().split())))
for i in range(M):
  che.append(list(map(int, input().split())))
  
for i in stu:
  x, y = i[0], i[1]
  ans = 0
  tmp = 99999999999999
  for num, j in enumerate(che):
    if abs(x-j[0])+abs(y-j[1]) < tmp:
      tmp = abs(x-j[0])+abs(y-j[1])
      ans = num + 1
  print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
stu = []
che = []
for i in range(N):
  stu.append(list(map(int, input().split())))
for i in range(M):
  che.append(list(map(int, input().split())))
  
for i in stu:
  x, y = i[0], i[1]
  ans = 0
  tmp = 99999999999999
  for j in che:
    if abs(x-j[0])+abs(y-j[1]) < tmp:
      tmp = abs(x-j[0])+abs(y-j[1])
      ans = j + 1
  print(ans)
Problem p03803 (python)

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

if A == B:
  print("Draw")
elif A == 1:
  print("Alice")
elif B == 1:
  print("Bob")
elif A > B :
  print("Alice")
else:
  print("Bob")

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

if A == B:
  print("Draw")
elif A == 1:
  print("Alice")
elif B == 1:
  print("Bob")
elif A > B :
  print("Alice")
else:
  print("Bob")
Problem p03804 (python)

Fixed submission:
N, M = map(int, input().split())
data = []
for i in range(N):
  data.append(input())
input_data=[]
for i in range(M):
  input_data.append(input())
flag_1 = False
for i in range(N - M + 1):
  for j in range(N - M + 1):
    flag = True
    for k in range(M):
      for l in range(M):
        if data[i+k][j+l] != input_data[k][l]:
          flag = False
    if flag:
      flag_1 = True

if flag_1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
data = []
for i in range(N):
  data.append(input())
input_data=[]
for i in range(M):
  input_data.append(input())
flag_1 = False
for i in range(N - M + 1):
  for j in range(N - M + 1):
    if flag = False
    for k in range(M):
      for l in range(M):
        if data[i+k][j+l] != input_data[k][l]:
          flag = True
    if flag:
      flag_1 = True

if flag_1:
  print("Yes")
else:
  print("No")
Problem p03834 (python)

Fixed submission:
S = list(input().split(","))
print(S[0]+" "+S[1]+" "+S[2])

Buggy submission (verdict: Runtime Error):
S = list(input().split())
print(S[0]+" "+S[1]+" "+S[2])
Problem p03835 (python)

Fixed submission:
K, S = map(int, input().split())
cnt = 0
for i in range(K+1):
  for j in range(K+1):
    k = S - i -j
    if 0 <= k and k <= K:
      cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
K, S = map(int, input().split())
cnt = 0
for i in range(K+1):
  for j in range(K+1):
    k = S - i -j:
    if k <= 0 and S <= k:
      cnt += 1
print(cnt)
Problem p03038 (python)

Fixed submission:
def smaller(x, y):
	if x < y: return x
	return y
def larger(x, y):
	if x > y: return x
	return y

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
Asum = []
sum = 0
for i in range(0, N):
	sum += A[i]
	Asum.append(sum)
controllist = []
for i in range(0, M):
	controllist.append(list(map(int, input().split())))
controllist.sort(key = lambda v: v[1], reverse = True)
addlist = []
flag = False
for i in range(0, M):
	for j in range(0, controllist[i][0]):
		addlist.append(controllist[i][1])
		if len(addlist) == N:
			flag = True
			break
	if flag: break
sum = 0
for i in range(0, smaller(N, len(addlist))):
	sum += larger(A[i], addlist[i])
for i in range(len(addlist), N):
	sum += A[i]
print(sum)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
rewritelist = []
for i in range(0, M):
	rewritelist.append(map(int, input().split()))
A.sort()
rewritelist.sort(key = lambda val: val[1], reverse = True)
cardlist = []
for i in range(0, N):
	if rewritelist == []: break
	cardlist.append(rewritelist[0][1])
	rewritelist[0][0] -= 1
	if rewritelist[0][0] == 0: rewritelist.pop(0)
for i in range(0, len(cardlist)):
	if cardlist[i] <= A[i]: break
	A[i] = cardlist[i]
sum = 0
for i in range(0, N):
	sum += A[i]
print(sum)

Buggy submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())
A = map(int, raw_input().split())
rewritelist = []
for i in range(0, M):
	rewritelist.append(map(int, raw_input().split()))
A.sort()
rewritelist.sort(key = lambda val: val[1], reverse = True)
cardlist = []
for i in range(0, N):
	if rewritelist == []: break
	cardlist.append(rewritelist[0][1])
	rewritelist[0][0] -= 1
	if rewritelist[0][0] == 0: rewritelist.pop(0)
for i in range(0, len(cardlist)):
	if cardlist[i] <= A[i]: break
	A[i] = cardlist[i]
sum = 0
for i in range(0, N):
	sum += A[i]
print(sum)
Problem p03107 (python)

Fixed submission:
def smaller(x, y):
	if x < y: return x
	else: return y

S = raw_input()
count = [0, 0]
for i in range(0, len(S)):
	count[int(S[i])] += 1

print smaller(count[0], count[1])*2

Buggy submission (verdict: Runtime Error):
def removable(s):
	lst = []
	for i in range(0, len(s)-1):
		if s[i] != s[i+1]:
			lst.append(i)
	return lst

S = raw_input()
max = 0
queue = [[S, 0]]
while queue != []:
	now = queue.pop(0)
	removelist = removable(now[0])
	if removelist == []:
		if max < now[1]: max = now[1]
	else:
		for i in range(0, len(removelist)):
			queue.append([now[0][:removelist[i]]+now[0][removelist[i]+2:], now[1]+2])
			print queue

print max
Problem p03127 (python)

Fixed submission:
def euc(x, y):
	if y == 0: return x
	return euc(y, x%y)

N = int(input())
A = list(map(int, input().split()))
ans = A[0]
for i in range(1, N):
	ans = euc(ans, A[i])
print(ans)

Buggy submission (verdict: Runtime Error):
def smaller(x, y):
	if x < y: return x
	return y

N = int(raw_input())
A = map(int, raw_input().split())
A.sort()
min1 = A[0]
for i in range(1, N):
	if A[i]%min != 0 and A[i]%min < min: min = A[i]%min
min2 = A[-1]
for i in range(1, N):
	if min2%A[i] == 0: min2 = A[i]
	else: min2 = min2%A[i] 
print smaller(min1, min2)
Problem p03834 (python)

Fixed submission:
inpt = input().split(',')
print(inpt[0]+' '+inpt[1]+' '+inpt[2])

Buggy submission (verdict: Runtime Error):
inpt = input.split(',')
print(inpt[0]+' '+inpt[1]+' '+inpt[2])

Buggy submission (verdict: Runtime Error):
inpt = input.split(',')
print inpt[0]+' '+inpt[1]+' '+inpt[2]
Problem p03018 (python)

Fixed submission:
s = input()
t = s.replace('BC', 'D')

a = 0 # 連続するaの数
ans = 0 # 答え

for i in t:
    if i == 'A':
        a += 1
    elif i == 'D':
        ans += a
    else:
        a = 0

print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())

cnt = 0
# print(s, cnt)

i = 0
while i < len(s)-2:
    # print(i)
    if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
        s[i] = 'B'
        s[i+1] = 'C'
        s[i+2] = 'A'
        cnt = cnt + 1
        i = i - 1
        if i < 0:
            i = 0
        print(i, s, cnt)
    else:
        i = i + 1

print(cnt)
Problem p03127 (python)

Fixed submission:
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest118-C
#  https://atcoder.jp/contests/abc118/tasks/abc118_c
#  ref https://note.nkmk.me/python-gcd-lcm/

def gcd(small,big):
	if big < small:
		big,small = small,big
	if small == 0:
		return big
	else:
		return gcd(big % small,small)

def solveProblem(PowerGauge):
	nowGcd = 0
	for i in range(0,len(PowerGauge),+1):
		nowGcd = gcd(nowGcd,PowerGauge[i])
	answer = nowGcd
	return answer


if __name__ == '__main__':
	_ = int(input().strip())
	An = list(map(int,input().strip().split(' ')))
	solution = solveProblem(An)
	print("{}".format(solution))

Buggy submission (verdict: Runtime Error):
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest118-C
#  https://atcoder.jp/contests/abc118/tasks/abc118_c
#  ref https://note.nkmk.me/python-gcd-lcm/
import math
from functools import reduce

def gcdList(lists):
	allGcd = reduce(math.gcd,lists)
	return allGcd

def solveProblem(PowerGauge):
	answer = gcdList(PowerGauge)
	return answer


if __name__ == '__main__':
	_ = int(input().strip())
	An = list(map(int,input().strip().split(' ')))
	solution = solveProblem(An)
	print("{}".format(solution))
Problem p03745 (python)

Fixed submission:
# _*_ coding:utf-8 _*_
#  Atcoder_Grand_Contest013-A
#  TODO https://atcoder.jp/contests/agc013/tasks/agc013_a


def solveProblem(allNumber,aList):
	flag = "Flat"
	count = 1
	for i in range(allNumber - 1):
		b = aList[i + 1] - aList[i]
		if flag == "Plus":
			if b < 0:
				flag = "Flat"
				count = count+1
		elif flag == "Minus":
			if b > 0:
				flag = "Flag"
				count = count+1
		else:
			if b > 0:
				flag = "Plus"
			elif b < 0:
				flag = "Minus"
	answer = count
	return answer

if __name__ == '__main__':
	N = int(input().strip())
	As = list(map(int,input().split()))
	solution = solveProblem(N,As)
	print("{}".format(solution))

Buggy submission (verdict: Runtime Error):
# _*_ coding:utf-8 _*_
#  Atcoder_Grand_Contest013-A
#  TODO https://atcoder.jp/contests/agc013/tasks/agc013_a


def solveProblem(allNumber,aList):
	flag = "Flat"
	count = 1
	for i in range(allNumber - 1):
		b = aList[i + 1] - aList[i]
		if flag == "Plus":
			if b < 0:
				flag = "Flat"
				count = count+1
		elif flag == "Minus":
			if b > 0:
				flag = "Flag"
				count = count+1
		else:
			if b > 0:
				flag = "Plus"
			elif b < 0:
				flag = "Minus"
		answer = count
	return answer

if __name__ == '__main__':
	N = int(input().strip())
	As = list(map(int,input().split()))
	solution = solveProblem(N,As)
	print("{}".format(solution))

Buggy submission (verdict: Runtime Error):
# _*_ coding:utf-8 _*_
#  Atcoder_Grand_Contest013-A
#  TODO https://atcoder.jp/contests/agc013/tasks/agc013_a


def solveProblem(allNumber,aList):
	flag = "Flat"
	count = 1
	for i in range(allNumber - 1):
		b = aList[i + 1] - aList[i]
		if flag == "Plus":
			if b < 0:
				flag = "Flat"
				count = count+1
		elif flag == "Minus":
			if b > 0:
				flag = "Flag"
				count = count+1
		else:
			if b > 0:
				flag = "Plus"
			elif b < 0:
				flag = "Minus"
		answer = count
	return answer

if __name__ == '__main__':
	N = int(input().strip())
	As = list(map(int,input().split()))
	solution = solveProblem(N,As)
	print("{}".format(solution))
Problem p03835 (python)

Fixed submission:
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest051-B
#  https://atcoder.jp/contests/abc051/tasks/abc051_b
from itertools import product
def  queueAnswer(maxValue,sumNumber):
	baseList = list(range(0,maxValue+1,1))
	xyPool = product(baseList,baseList)
	counter = 0
	for x,y in xyPool:
		z = sumNumber - x - y
		if ( 0 <= z ) and ( z <= maxValue):
			counter = counter + 1

	answer = counter
	return answer


if __name__ == '__main__':
	k,s = map(int,input().strip().split(' '))
	solution=queueAnswer(k,s)
	print(solution)

Buggy submission (verdict: Runtime Error):
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest051-B
#  https://atcoder.jp/contests/abc051/tasks/abc051_b
def  queueAnswer(maxValue,sumNumber):
	counter = 0
	for x in range(0,maxValue+1,1):
		for y in range(0,maxValue+1,1):
			for z in range(0,maxValue+1,1):
				thisSum = x+y+z
				if  thisSum=sumNumber:
					counter = counter + 1
	answer = counter
	return answer


if __name__ == '__main__':
	k,s = map(int,input().strip().split(' '))
	solution=queueAnswer(k,s)
	print(solution)
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
l=[-1]*(n+1)
for i in range(m):
    idx=int(input())
    l[idx]=0
mod=10**9+7
if n!=1:
    if l[1]==-1:
        if l[2]==-1:
            l[1]=1;l[2]=2
        else:
            l[1]==1
    else:
        if l[2]==-1:
            l[2]=1
    if n>2:
        for i in range(3,n+1):
            if l[i]==-1:
                l[i]=(l[i-1]+l[i-2])%mod
            else:
                continue
    print(l[-1])
else:
    if l[1]==-1:
        print(1)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[-1]*(n+1)
for i in range(m):
    idx=int(input())
    l[idx]=0
mod=10**9+7
if l[1]==-1:
    if l[2]==-1:
        l[1]=1;l[2]=2
    else:
        l[1]==1
else:
    if l[2]==-1:
        l[2]=1

for i in range(3,n+1):
    if l[i]==-1:
        l[i]=(l[i-1]+l[i-2])%mod
    else:
        continue
print(l[-1])
Problem p03077 (python)

Fixed submission:
n=int(input())
lst=[int(input()) for i in range(5)]
m=min(lst)
import math
print(math.ceil(n/m)+4)

Buggy submission (verdict: Runtime Error):
n=int(input())
lst=[int(input()) for i in range(5)]
l=[0]*5
l.insert(0,n)
def counting(l,lst,ans):
    if l[5]==n:
        return ans
    else:
        for i in range(5,0,-1):
            res=min(l[i-1],lst[i-1])
            l[i]+=res
            l[i-1]-=res
        ans+=1
        return counting(l,lst,ans)
print(counting(l,lst,0))
Problem p03135 (python)

Fixed submission:
T,X=(int(i) for i in input().split()) 
print(T/X)

Buggy submission (verdict: Runtime Error):
T X=(int(i) for i in input().split()) 
print(T/X)
Problem p03207 (python)

Fixed submission:
N=int(input())
price=[int(input()) for i in range(N)]
price.sort(reverse=True)
price[0]=price[0]//2
a=sum(price)
print(a)

Buggy submission (verdict: Runtime Error):
N=int(input())
price=[]
for i in range(N):
    price.append(int(input()))
price.sort(Reverse=True)
price[0]=price[0]//2
sum(price)

Buggy submission (verdict: Runtime Error):
N=int(input())
price=[int(input() for i in range(N)]
price.sort()
price[0]=price[0]//2
sum(price)
Problem p03208 (python)

Fixed submission:
N,K=(int(i) for i in input().split())
hlist=[int(input()) for i in range(N)]
hlist.sort()
dif=[]
for j in range(N-K+1):
    dif.append(hlist[j+K-1]-hlist[j])
print(min(dif))

Buggy submission (verdict: Runtime Error):
N,K=(int(i) for i in input().split())
hlist=[int(input()) for l in range(N)]
hlist.sort()
for j in range(N-K+2):
    dif=[hlist[j+k]-hlist[j]]
print(min(dif))

Buggy submission (verdict: Runtime Error):
N,K=(int(i) for i in input().split())
hlist=[]
for _ in range(N):
    hlist.append(int(input()))
hlist.sort()
for j in range(N-K+2):
    dif=[hlist[j+k]-hlist[j]]
print(min(dif))
Problem p03307 (python)

Fixed submission:
N=int(input())
from fractions import gcd
print(2*N//gcd(2,N))

Buggy submission (verdict: Runtime Error):
N=int(input())
import fraction
print(2*N//fraction.gcd(2,N))

Buggy submission (verdict: Runtime Error):
N=int(input())
import math
print(2*N//math.gcd(2,N))

Buggy submission (verdict: Runtime Error):
N=int(input())
import math
print(2*n//math.gcd(2,N))
Problem p03315 (python)

Fixed submission:
S=input()
a=0
for i in S:
  if i=='+':
    a+=1
  else:
    a-=1
print(a)

Buggy submission (verdict: Runtime Error):
S=list(input())
a=0
for i in S:
  if i==='+':
    a+=1
  else:
    a-=1
print(a)

Buggy submission (verdict: Runtime Error):
S=input()
a=0
for i in S:
  if i==='+':
    a+=1
  else:
    a-=1
print(a)

Buggy submission (verdict: Runtime Error):
S=input()
a=0
for i in range(4):
  if i==='+':
    a+=1
  else:
    a-=1
print(a)
Problem p03345 (python)

Fixed submission:
a,b,c,k=(int(i) for i in input().split())
def ans(x):
  if abs(x)>=10e18:
    return 'Unfair'
  else:
    return x
if k%2==0:
  print(ans(a-b))
else:
  print(ans(b-a))

Buggy submission (verdict: Runtime Error):
a,b,c,k=(int(i) for i in input().split())
def ans(x):
  if abs(x)>=10e18:
    return 'Unfair'
  else:
    return x
if k==0
  print(ans(a-b))
else:
  print(ans(b-a))
Problem p03011 (python)

Fixed submission:
p,q,r = map(int, input().split())
print(min(p+q,q+r,r+p))

Buggy submission (verdict: Runtime Error):

P=int(input())
Q=int(input())
R=int(input())

if P+Q<=Q+R:
    if P+Q<=R+P:
        print(P+Q)
    else:
        print(R+P)
elif Q+R<P+Q:
    if Q+R<=R+P:
        print(Q+R)
    else:
        print(R+P)

Buggy submission (verdict: Runtime Error):
P=int(input())
Q=int(input())
R=int(input())
a=P+Q
b=Q+R
c=R+P

if a<=b:
    if a<=c:
        print(a)
    else:
        print(c)
elif b<a:
    if b<=c:
        print(b)
    else:
        print(c)

Buggy submission (verdict: Runtime Error):
P=input()
Q=input()
R=input()
p=int(P)
q=int(Q)
r=int(R)
a=p+q
b=q+r
c=r+p

if a<=b:
    if a<=c:
        print(a)
    else:
        print(c)
elif b<a:
    if b<=c:
        print(b)
    else:
        print(c)

Buggy submission (verdict: Runtime Error):
P=input()
Q=input()
R=input()
p=int(P)
q=int(Q)
r=int(R)
a=p+q
b=q+r
c=r+p

if a<=b:
    if a<=c:
        print(a)
    else:
        print(c)
elif b<=a:
    if b<=c:
        print(b)
    else:
        print(c)
Problem p03107 (python)

Fixed submission:
s=input();
l=len(s)
zero,one=0,0
for i in s:
	if i=='0': zero+=1
	else: one+=1
print(min(zero, one)*2)

Buggy submission (verdict: Runtime Error):
s = input();
l = len(s)
zero=0,one=0
for i in s:
	if i=='0': zero+=1
	else one+=1
print(min(zero, one))
Problem p03127 (python)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
	ans = gcd(ans, a[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import random

n = int(input())
m = [int(i) for i in input().split()]

while True:
	a = m.pop(random.randrange(n)); n -= 1
	b = m.pop(random.randrange(n)); n -= 1
	a -= b
	m.extend([a, b]); n += 2
	print(m)
	for i in m:
		if i <= 0:
			m.remove(i); n -= 1
	if len(m) == 1: print(m[0]); exit()
Problem p03041 (python)

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

for i in range(len(S)):
    if i == k - 1:
        print(S[i].swapcase(), end="")
    else:
        print(S[i], end="")
print()

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

n1 = int(N / 100 % 100)
n2 = N % 100

if n1 > 12 and n2 > 0:
    print("YYMM")
elif n2 > 12 and n1 > 0:
    print("MMYY")
elif n1 < 13 and n2 < 13:
    print("AMBIGUOUS")
else:
    print("NA")

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

n1 = int(N / 100 % 100)
n2 = N % 100

if n1 == 0 or n2 == 0:
    print("NA")
elif n1 > 12:
    print("YYMM")
elif n2 > 12:
    print("MMYY")
elif n1 < 12:
    print("AMBIGUOUS")
Problem p03017 (python)

Fixed submission:
n,a,b,c,d = ( int(i) for i in input().split())
s = input()

a_to_c = s[(a-1)+1:(c-1)-1 +1]

possibility = True

if c>d:
    b_to_d = s[(b-1)-1:(d-1)+1 +1]
    if "##" in a_to_c or "..." not in b_to_d:
        possibility = False
else:
    b_to_d = s[(b-1)+1:(d-1)-1 +1]
    if "##" in a_to_c or "##" in b_to_d:
        possibility = False

if possibility:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,a,b,c,d = ( int(i) for i in input().split())
s = input()

a_to_c = s[a:(c-1)-1]
b_to_d = s[b-1:d-1]

possibility = True

if c>d:
    b_to_d = s[(b-1)-1:(d-1)+1]
    if "##" in a_to_c or "..." not in b_to_d
        possibility = False
else:
    b_to_d = s[(b-1)+1:(d-1)-1]
    if "##" in a_to_c or "##" in b_to_d:
        possibility = False

if possibility:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,a,b,c,d = ( int(i) for i in input().split())
s = input()

a_to_c = s[a-1:c-1]
b_to_d = s[b-1:d-1]
if (b-1)-1 >= 0:
    b_to_d2 = s[b-1-1:d-1]
else:
    b_to_d2 = s[b-1:d-1]

possibility = True

if a_to_c.find("##")!=-1 or b_to_d.find("##")!=-1:
    possibility = False
if c>d:
    if s[d-1]='#':
        if not(s[b-3:d-1].find("...")!=-1):
            possibility = False
    if not(b_to_d2.find('...')!=-1):
        possibility = False


if possibility:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,a,b,c,d = ( int(i) for i in input().split())
s = input()

a_to_c = s[a-1:c-1]
b_to_d = s[b-1:d-1]
if (b-1)-2 >= 0:
    b_to_d2 = s[b-1-2:d-1]
elif:
    b_to_d2 = s[b-1:d-1]

possibility = True

if a_to_c.find("##")!=-1 or b_to_d.find("##")!=-1:
    possibility = False
if c>d:
    if not(b_to_d2.find('...')!=-1):
        possibility = False

if possibility:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,a,b,c,d = ( int(i) for i in input().split())
s = input()

a_to_c = s[a-1:c-1]
b_to_d = s[b-1:d-1]
if (b-1)-2 < 0:
    b_to_d2 = s[b-1:d-1]
elif:
    b_to_d2 = s[b-1-2:d-1]

possibility = True

if a_to_c.find("##")!=-1 or b_to_d.find("##")!=-1:
    possibility = False
if c>d:
    if not(b_to_d2.find('...')!=-1):
        possibility = False

if possibility:
    print("Yes")
else:
    print("No")
Problem p03265 (python)

Fixed submission:
import math
x1, y1, x2, y2 = map(int, input().split())

diffx = x1 - x2
diffy = y1 - y2

len_of_v = int((diffx ** 2 + diffy ** 2) ** 0.5)

if diffx == 0:
    x3 = x2 + diffy
    x4 = x1 + diffy
    y3 = y2
    y4 = y1
elif diffy == 0:
    x3 = x2
    x4 = x1
    y3 = y2 - diffx
    y4 = y1 - diffx
else:
    grad = diffy / diffx
    counter_grad = -1 / grad

    x3 = x2 + diffy
    y3 = y2 + diffy * counter_grad

    x4 = x1 + diffy
    y4 = y1 + diffy * counter_grad

print(round(x3), round(y3), round(x4), round(y4))

Buggy submission (verdict: Runtime Error):
import math
x1, y1, x2, y2 = map(int, input().split())

diffx = x1 - x2
diffy = y1 - y2

len_of_v = int((diffx ** 2 + diffy ** 2) ** 0.5)

if diffx == 0:
    x3 = x2 + diffy
    x4 = x1 + diffy
    y3 = y2
    y4 = y1
else:
    grad = diffy / diffx
    counter_grad = -1 / grad

    x3 = x2 + diffy
    y3 = y2 + diffy * counter_grad

    x4 = x1 + diffy
    y4 = y1 + diffy * counter_grad

print(int(x3), round(y3), int(x4), int(y4))
Problem p03036 (python)

Fixed submission:
r, D, x = map(int, input().split())


for i in range(10):
  x = (r * x) - D
  print(x)

Buggy submission (verdict: Runtime Error):
r, D, x = map(int, input().split)


for i in range(10):
  x = (r * x) - D
  print(x)
Problem p03073 (python)

Fixed submission:
S = [ i for i in input()]

if len(S) <= 1:
  print(0)
  exit()

zerone = ['0', '1']
a = 0
b = 0

def is_even(num):
  return 0  if num % 2 == 0 else 1

for i in range(len(S)):
  if S[i] != zerone[is_even(i)]:
    a += 1
  else:
    b += 1

print(a if a < b else b)

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

middle = S[1:-1]
white = middle.count('.')
black = middle.count('#')

if (S.count('.') == 0 or S.count('#') == 0) or ((S.count('.') == 1 and S[0] == '.') or (S.count('#') == 1 and S[-1] == '#')):
  print('0')
else:
  if white < black:
    if S[-1] == '.':
      print(white+1)
    else:
      print(white)
  else:
    if S[0] == '#':
      print(black+1)
    else:
      print(black)
Problem p03127 (python)

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

ans = 0
for i in range(N):
    ans = gcd(ans, A[i])

print(ans)

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

ans = 0
for i in range(N):
    ans = gcd(ans, A[i])

print(ans)