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

Fixed submission:
from heapq import *

n, m, s = map(int, input().split())
s = min([s, 50*n])
tree = [[] for _i in range(n+1)]
for _i in range(m):
    u, v, a, b = map(int, input().split())
    tree[u].append([v, a, b])
    tree[v].append([u, a, b])

cd = [[0,0]]
for _i in range(n):
    cd.append(list(map(int, input().split())))

dp = [[float('inf') for _i in range(50*n+1)] for _j in range(n+1)]
hq = [[0, 1, s]]
dp[1][s] = 0
heapify(hq)
while hq:
    t, p, g = heappop(hq)
    if g+cd[p][0] <= 50*n:
        x, y = t+cd[p][1], min([g+cd[p][0], 50*n])
        if dp[p][y] > x:
            dp[p][y] = x
            heappush(hq, [x, p, y])
    for x, y, z in tree[p]:
        if g-y >= 0 and dp[x][g-y] > t+z:
            dp[x][g-y] = t+z
            heappush(hq, [t+z, x, g-y])

for i in dp[2:]:
    print(min(i))

Buggy submission (verdict: Runtime Error):
from heapq import *

n, m, s = map(int, input().split())
tree = [[] for _i in range(n+1)]
for _i in range(m):
    u, v, a, b = map(int, input().split())
    tree[u].append([v, a, b])
    tree[v].append([u, a, b])

cd = [[0,0]]
for _i in range(n):
    cd.append(list(map(int, input().split())))

dp = [[float('inf') for _i in range(50*n+1)] for _j in range(n+1)]
hq = [[0, 1, s]]
dp[1][s] = 0
heapify(hq)
while hq:
    t, p, g = heappop(hq)
    if g+cd[p][0] <= 50*n:
        x, y = t+cd[p][1], min([g+cd[p][0], 50*n])
        if dp[p][y] > x:
            dp[p][y] = x
            heappush(hq, [x, p, y])
    for x, y, z in tree[p]:
        if g-y >= 0 and dp[x][g-y] > t+z:
            dp[x][g-y] = t+z
            heappush(hq, [t+z, x, g-y])

for i in dp[2:]:
    print(min(i))

Buggy submission (verdict: Runtime Error):
from heapq import *

n, m, s = map(int, input().split())
tree = [[] for _i in range(n+1)]
for _i in range(m):
    u, v, a, b = map(int, input().split())
    tree[u].append([v, a, b])
    tree[v].append([u, a, b])

cd = [[0,0]]
for _i in range(n):
    cd.append(list(map(int, input().split())))

dp = [[float('inf') for _i in range(50*n+1)] for _j in range(n+1)]
hq = [[0, 1, s]]
dp[1][s] = 0
heapify(hq)
visit = [[-1 for _i in range(50*n+1)] for _j in range(n+1)]
while hq:
    t, p, g = heappop(hq)

    if g+cd[p][0] <= 50*n:
        x, y = t+cd[p][1], min([g+cd[p][0], 50*n])
        if dp[p][y] > x:
            dp[p][y] = x
            heappush(hq, [x, p, y])
    for x, y, z in tree[p]:
        if g-y >= 0 and dp[x][g-y] > t+z:
            dp[x][g-y] = t+z
            heappush(hq, [t+z, x, g-y])

for i in dp[2:]:
    print(min(i))
Problem p02731 (python)

Fixed submission:
l = int(input())

print((l**3)/27)

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

result = []
for i in range(1,10**3):
    for j in range(i, 10**3):
        if l-i-j > 0:
            result.append(i*j*(l-i-j))
print(max(result))
Problem p02787 (python)

Fixed submission:
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
dp = [10**5 for _ in range(h+1)]
dp[0] = 0
for i in range(1,h+1):
    dp[i] = min([dp[max(0, i-pw)]+ma for pw, ma in ab])
print(dp[h])

Buggy submission (verdict: Runtime Error):
import numpy as np
h, n = map(int, input().split())
ab = np.array([list(map(int, input().split())) for _ in range(n)])

a = ab[:, 0]
b = ab[:, 1]

dp = np.zeros(10**9, dtype=np.int)

for i in range(1,h+1):
    dp[i] = min(dp[i-a]+b)

print(dp[h])
Problem p02804 (python)

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

a.sort()

result = 0
mod = 10**9+7

 
def cmb(n, r, mod=mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
n = 10**5+1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
 
for i in range( 2, n+1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


if k==1:
    print(0)
else:
    result = 0
    for i in range(N-k+1):
        result += (a[N-i-1]-a[i])*cmb(N-1-i, k-1)
        result %= mod

    print(result%mod)

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

a.sort()

result = 0
mod = 10**9 +7

def solve(x, y):
    if x == 0:
        return 1
    else:
        r = 1
        for i in range(y-x+1, y+1):
            r = (r*i)%mod
        for i in range(1, x+1):
            r //= i
        return r

s, l = 0, 0
x = solve(k-1, n-1)
for i in range(n-k+1):
    s += a[i]*x
    l += a[n-i-1]*x
    x = (x*(n-k-i))//(n-1-i)
print((l-s)%mod)
Problem p02838 (python)

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
result = [0 for _ in range(120)]
for i in a:
    x = format(i, "060b")[::-1]
    for j in range(60):
        result[j] = result[j]+(x[j]=="1")
result = [(n-i)*i for i in result]
for i in range(70):
    result[i+1] += result[i]//2
    result[i] = result[i]%2    
print(int("".join(map(str, result[::-1])), 2)%mod)
Problem p02844 (python)

Fixed submission:
n = int(input())
s = list(input())[::-1]
result = 0
for i in range(1000):
    x = format(i, "03")
    j = 0
    p = 0
    while p < n:
        if s[p]==x[j]:
            j += 1
            if j == 3:
                result += 1
                break
        p += 1

print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(int, list(input())))
numbers = [0 for _i in range(1000)]
right, left = [[0 for _j in range(10)] for _i in range(n)], [[0 for _j in range(10)] for _i in range(n)]
for i in range(1, n):
    left[i] = left[i-1].copy()
    left[i][s[i-1]] += 1
for i in range(2, n+1):
    right[-i] = right[-i+1].copy()
    right[-i][s[-i+1]] += 1

for i in range(n):
    for x in range(10):
        for y in range(10):
            if right[i][x]>0 and left[i][y]>0:
                numbers[100*x+10*s[i]+y] = 1
print(sum(numbers))
Problem p02854 (python)

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

result = [[a[0], sum(a[1:])]]
for i in range(1, n):
    result.append([result[-1][0]+a[i], result[-1][1]-a[i]])
h = []
for i in range(len(result)):
    h.append(abs(result[i][0]-result[i][1]))
print(min(h))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
r = 0
counter = 0
while r < s//2:
    r += a[counter]
    counter += 1
x = sum(a[:counter])
y = sum(a[counter+1:])
if x <= y:
    x += a[counter]
else:
    y += a[counter]
print(abs(x-y))
Problem p02900 (python)

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


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
a, b = map(int, input().split(' '))
gc = gcd(a, b)
r = []
r = factorization(gc)
if r[0][0] == 1:
    print(1)
else:
    print(len(r)+1)

Buggy submission (verdict: Runtime Error):
import math
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
a, b = map(int, input().split(' '))
gc = math.gcd(a, b)
r = []
r = factorization(gc)
if len(r) == 1:
    print(1)
else:
    print(len(r)+1)
Problem p02901 (python)

Fixed submission:
n, m = map(int, input().split(' '))
dp = [10**9 for _ in range(2**n)]
dp[0] = 0
for i in range(m):
    a, b = map(int, input().split(' '))
    c = list(map(int, input().split(' ')))
    num = 0
    for j in range(b):
        num += 1 << (c[j]-1)
    for s in range(2**n):
        if dp[s|num] >= dp[s] + a:
            dp[s|num] = dp[s] + a
if dp[-1] == 10**9:
    print(-1)
else:
    print(dp[-1])

Buggy submission (verdict: Runtime Error):
def main():
    n ,m = map(int, input().split(' '))
    inf = 10**9
    bit_dp = [inf for _ in range(2**(n))]
    bit_dp[0] = 0
    for i in range(m):
        a, b = map(int, input().split(' '))
        c = list(map(int, input().split(' ')))
        bit_n = 0
        for i in c:
            bit_n |= 1 << i-1
        for i in range(2**(n)):
            if bit_dp[i|bit_n] > bit_dp[i] + a:
            bit_dp[i|bit_n] = bit_dp[i] + a
    if bit_dp[-1] >= inf:
        print(-1)
    else:
        print(bit_dp[-1])
if __name__ == '__main__':
    main()
Problem p02909 (python)

Fixed submission:
s = str(input())
if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
def main():
    from heapq import heapify, heappush, heappop
    from math import floor
    n, m = list(map(int, input().split(' ')))
    a = list(map(int, input().split(' ')))
    a = [x*(-1) for x in a]
    heapify(a)
    for _ in range(m):
        x = floor(-heappop(a)/2)*(-1)
        heappush(a, x)
     
    print(-sum(a))
main()
Problem p02913 (python)

Fixed submission:
n = int(input())
s = input()
j = 1
result = [0]
end = n//2 + 1
for i in range(n):
    while (j < n-1) and (s[i:j] in s[:i]+"0"+s[j:]):
        j += 1
    result.append(j-i-1)
print(max(result))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
j = 1
y = s[1:]
x = s[0]
result = [0]
end = n//2 + 2
for i in range(end):
    while (j < end) and (x in y):
        x = x+s[j]
        y = s[:i]+s[j+1:]
        j += 1
    result.append(j-i-1)
    y = s[:i+1] + s[j+1:]
    x = x[1:]
print(max(result))
Problem p02928 (python)

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

mod = 10**9 + 7
x = (k*(k+1)//2)%mod
y = (k*(k-1)//2)%mod

r = 0
for i in range(n):
    right = sum(a[i] > j for j in a[i:])
    left = sum(a[i] > j for j in a[:i+1])
    r = (r+((right*x) + (left*y))%mod)%mod
print(r)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7
print(sum((r+((sum(a[i]>j for j in a[i:])*(k*(k+1)//2)%mod)+(sum(a[i]>j for j in a[:i+1])*(k*(k-1)//2)%mod))%mod)%mod for i in range(n)))
Problem p02937 (python)

Fixed submission:
def main():
    s = str(input())
    t = str(input())
    if set(t) <= set(s):
        x = -1
        counter = 0
        for i in t:
            x = s.find(i, x+1)
            if x == -1:
                counter += 1
                x = s.find(i)
        print(x+1+counter*len(s))
    else:
        print(-1)
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    s = str(input())
    t = str(input())
    n = len(s)-1
    m = len(t)-1
    result = 0
    point = 0
    counter = 0
    i = t[0]
    c = 1
    while c <= m:
        print(point, t[c])
        if i in s[point:]:
            x = s[point:].index(i)
            result += x + 1
            point += x + 1
            i = t[c]
            c += 1
            counter = 0
        else:
            result += n + 2 - point
            point = 0
            counter += 1
            if counter >= 2:
                print(-1)
                sys.exit()
    print(result)
if __int__ == '__main__':
    main()
Problem p02963 (python)

Fixed submission:
s = int(input())

y = s//10**9
x = s%10**9
if x == 0:
    result = [0,0,10**9,1,x,y]
else:
    result = [0,0,10**9,1,10**9-x,y+1]
print(*result)

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

y = s//10**9
x = s%10**9
if x == 0:
    result = [0,0,10**9,1,x,y+]
else:
    result = [0,0,10**9,1,10**9-x,y+1]
print(*result)

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

a = s % (10**9)
b = s - a * 10**9

print(' '.join([0,0,1,1000000000,b,a]))

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

a = s % (10**9)
b = s - a * 10**9

print(' '.join([0,0,1,1000000000,b,a]))
Problem p02971 (python)

Fixed submission:
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_s = sorted(a, reverse=True)
hantei = a_s[:2]
del a_s
for i in range(n):
    if a[i] == hantei[0]:
        print(hantei[1])
    else:
        print(hantei[0])

Buggy submission (verdict: Runtime Error):

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

for i in range(n):
    if i == 1:
        print(max(a[2:]))
    elif i == n-1:
        print(max(a[:n-1]))
    else:
        print(max(a[i+1:],a[:i]))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

for i in range(n):
    if i == 1:
        result = a[2:]
        print(max(result))
    elif i == n-1:
        result = a[:n-1]
        print(max(result))
    else:
        result = a[:i] + a[i+1:]
        print(max(result))

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

for i in range(n):
    a.append(int(input()))

for i in range(n):
    if i == 1:
        result = a[2:]
        print(max(result))
    elif i == n-1:
        result = a[:n-1]
        print(max(result))
    else:
        result = a[:i] + a[i+1:]
        print(max(result))
Problem p02996 (python)

Fixed submission:
import sys
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key= lambda x:x[1])
time = 0
for i in ab:
    time += i[0]
    if time <= i[1]:
        continue
    else:
        print("No")
        sys.exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
print("Yes")
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key= lambda x:x[1])
time = 0
for i in ab:
    time += i[0]
    if time <= i[1]:
        continue
    else:
        print("No")
        sys.exit()
print("Yes")
Problem p02999 (python)

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

if x  >= a :
    print(10)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
3 5
Problem p03026 (python)

Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(10**9)

n = int(input())
tree = [[] for _i in range(n)]
for _i in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

c = deque(sorted(list(map(int, input().split())), reverse=True))
visit = [-1 for _i in range(n)]
visit[0] = c.popleft()

def solve(p):
    r = 0
    for i in tree[p]:
        if visit[i] < 0:
            visit[i] = c.popleft()
            r += visit[i]
            r += solve(i)
    return r
x = solve(0)
print(x)
print(*visit)

Buggy submission (verdict: Runtime Error):
n = int(input())
tree = [[] for _i in range(n)]
for _i in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
from collections import deque
c = deque(sorted(list(map(int, input().split())), reverse=True))
visit = [-1 for _i in range(n)]

def solve(p):
    for i in tree[p]:
        if visit[i] < 0:
            visit[i] = c.popleft()
            solve(i)
solve(0)
print(*visit)
Problem p03032 (python)

Fixed submission:
import heapq
n, k = map(int, input().split())
v = list(map(int, input().split()))

result = []
for i in range(min(n, k)+1):
    for j in range(min(n, k)+1-i):
        x = v[:i]+v[n-j:]
        c = k - (i + j)
        x.sort()
        for t in range(min(len(x), c)):
            if x[0]<0:
                x.pop(0)
            else:
                break
        result.append(sum(x))
print(max(result))

Buggy submission (verdict: Runtime Error):
from collections import deque
import heapq
n, k = map(int, input().split())
v = list(map(int, input().split()))

result = []
for i in range(k):
    for j in range(k-i):
        jue = []
        heapq.heapify(jue)
        for ii in range(i):
            heapq.heappush(jue, v[ii])
        for jj in range(j):
            heapq.heappush(jue, v[-jj-1])
        for le in range(min(k-i-j, len(jue))):
            heapq.heappop(jue)
        result.append(sum(jue))

print(max(result))

Buggy submission (verdict: Runtime Error):
from collections import deque
import heapq
n, k = map(int, input().split())
v = list(map(int, input().split()))

result = []
for i in range(k):
    for j in range(k-i):
        jue = []
        heapq.heapify(jue)
        for ii in range(i):
            heapq.heappush(jue, v[ii])
        for jj in range(j):
            heapq.heappush(jue, v[-jj-1])
        for le in range(min(k-i-j, i+j)):
            heapq.heappop(jue)
        result.append(sum(jue))

print(max(result))

Buggy submission (verdict: Runtime Error):
from collections import deque
import heapq
n, k = map(int, input().split())

v = deque(list(map(int, input().split())))
j = []
heapq.heapify(j)

def solve(hep, jue, c, end=k):
    if c==k:
        return sum(hep)
    result = [0]
    if len(jue)!=0:
        x, y = hep.copy(), jue.copy()
        heapq.heappush(x, y.pop())
        result.append(solve(x, y, c+1))

        x, y = hep.copy(), jue.copy()
        heapq.heappush(x, y.popleft())
        result.append(solve(x, y, c+1))


    if len(hep)!=0:
        x, y = hep.copy(), jue.copy()
        y.append(heapq.heappop(x))
        result.append(solve(x, y, c+1))

        x, y = hep.copy(), jue.copy()
        y.appendleft(heapq.heappop(x))
        result.append(solve(x, y, c+1))

    return max(result)


print(solve(j, v, 0))
Problem p03044 (python)

Fixed submission:
from collections import deque

n = int(input())
visit = [-1 for _ in range(n+1)]
friends = [[] for _ in range(n+1)]
for i in range(n-1):
    u, v, w = map(int, input().split())
    friends[u].append([v, w])
    friends[v].append([u, w])

q = deque([1])
visit[1] = 0
while q:
    position = q.popleft()
    for i, cost in friends[position]:
        if visit[i] < 0:
            visit[i] = visit[position] + cost
            q.append(i)

for i in visit[1:]:
    print(i%2)

Buggy submission (verdict: Runtime Error):
n = int(input())
uvw = []
for i in range(n-1):
    uvw.append(list(map(int, input().split(' '))))
result = [0]*n
for i in range(n-1):
    if uvw[i][2]%2 == 0:
        result[uvw[i][0]-1] = 1
        result[uvw[i][1]-1] = 1
if sum(result) == n:
    result[uvw[0][1]-1] = 0
    result[uvw[0][2]-1] = 0
for i in result:
    print(i)

Buggy submission (verdict: Runtime Error):
n = int(input())
uvw = []
for i in range(n-1):
    uvw.append(list(map(int, input().split(' '))))
result = [0]*n
for i in range(n-1):
    if uvw[i][2]%2 == 0:
        result[uvw[i][0]] = 1
        result[uvw[i][1]] = 1
for i in result:
    print(i)
Problem p03049 (python)

Fixed submission:
n = int(input())
r = 0
a = 0
b = 0
ab = 0
for _i in range(n):
    s = input()
    r += s.count("AB")
    B = 0
    A = 0
    if s[-1]=="A":
        a += 1
    if s[0]=="B":
        b += 1
    if s[-1]=="A" and s[0]=="B":
        ab += 1
if ab == a and ab == b:
    print(r+max(0, ab-1))
else:
    print(r+min(a, b))

Buggy submission (verdict: Runtime Error):
n = int(input())
r = 0
a = 0
b = 0
for _i in range(n):
    s = input()
    r += s.count("AB")
    B = 0
    if s[-1]=="A":
        if b > 0:
            b -= 1
            r += 1
        else:
            A += 1
    if s[0]=="B":
        if a > 0:
            a -= 1
            r += 1
        else:
            B += 1
    a += A
    b += B


print(r)
Problem p03061 (python)

Fixed submission:
#125
from fractions import gcd
n = int(input())
a = [int(x) for x in input().split(' ')]

m_r = [0]
for i in range(n-1):
    m_r.append(gcd(m_r[-1], a[i]))

m_l = [0]
for i in range(1, n):
    m_l.append(gcd(m_l[-1], a[-i]))

m = []
for i in range(n):
    m.append(gcd(m_r[i], m_l[-i-1]))
print(max(m))

Buggy submission (verdict: Runtime Error):
#125
import fractions
n = int(input())
a = [int(x) for x in input().split(' ')]
all_m = []
for i in range(1,n-1):
    a_1 = a[:i]
    a_2 = a[i+1:]
    m_1 = a_1[0]
    m_2 = a_2[0]
    for j in range(len(a_1)-1):
        m_1 = fractions.gcd(m_1,a_1[j+1])
    for j in range(len(a_2)-1):
        m_2 = fractions.gcd(m_2,a_2[j+1])
    all_m.append(fractions.gcd(m_1,m_2))
m = a[1]
for j in range(1,n-1):
    m = fractions.gcd(m,a[j+1])
all_m.append(m)
m = a[0]
for j in range(n-2):
    m = fractions.gcd(m,a[j+1])
all_m.appendm(m)
print(max(all_m))

Buggy submission (verdict: Runtime Error):
#125
import fractions
n = int(input())
a = [int(x) for x in input().split(' ')]
all_m = []
for i in range(1,n-1):
    a_1 = a[:i]
    a_2 = a[i+1:]
    m_1 = a_1[0]
    m_2 = a_2[0]
    for j in range(len(a_1)-1):
        m_1 = fractions.gcd(m_1,a_1[j+1])
    for j in range(len(a_2)-1):
        m_2 = fractions.gcd(m_2,a_2[j+1])
    all_m.append(fractions.gcd(m_1,m_2))
m = a[1]
for j in range(1,n):
    m = fractions.gcd(m,a[j+1])
all_m.append(m)
m = a[0]
for j in range(n-1):
    m = fractions.gcd(m,a[j+1])
all_m.appendm(m)
print(max(all_m))

Buggy submission (verdict: Runtime Error):
#125
import 
n = int(input())
a = [int(x) for x in input().split(' ')]
all_m = []
for i in range(1,n-1):
    a_1 = a[:i]
    a_2 = a[i+1:]
    m_1 = a_1[0]
    m_2 = a_2[0]
    for j in range(len(a_1)-1):
        m_1 = math.gcd(m_1,a_1[j+1])
    for j in range(len(a_2)-1):
        m_2 = math.gcd(m_2,a_2[j+1])
    all_m.append(fractions.gcd(m_1,m_2))
m = a[1]
for j in range(1,n):
    m = math.gcd(m,a[j+1])
all_m.append(fractions.gcd(m))
m = a[0]
for j in range(n-1):
    m = math.gcd(m,a[j+1])
all_m.append(fractions.gcd(m))
print(max(all_m))
Problem p03067 (python)

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

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

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
b=0
w=S.count(".")
ans=b+w
for s in S:
    if s=="#":
        b+=1
    else:
        w-=1
    ans=min(ans, b+w)
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
b=0
w=S.count(".")
ans=b+w
for s in S:
  if s=="#":
    b+=1
  else:
    w-=1
  ans=min(ans, b+w)
print(ans)

Buggy submission (verdict: Runtime Error):
    N=int(input())
    S=input()
    b=0
    w=S.count(".")
    ans=b+w
    for s in S:
      if s=="#":
        b+=1
      else:
        w-=1
      ans=min(ans, b+w)
    print(ans)
Problem p03069 (python)

Fixed submission:
N=int(input())
S=input()
b=0
w=S.count(".")
ans=b+w
for s in S:
    if s=="#":
        b+=1
    else:
        w-=1
    ans=min(ans, b+w)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
count_b_l = 0
count_w_r = 0
for i in range(len(s)):
    if s[i] == '.':
        count_w_r += 1
result = []
for i in range(len(s)):
    if s[i] == '#':
        count_w_l += 1
    else:
        count_b_r -= 1
    result.append(count_b_l+count_w_r)
print(min(result))