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

Fixed submission:
N, K = map(int,input().split())
listMap = [int(i) for i in input().split()]
minMin = float("inf")

if N == 1:
    minMin = listMap[0]

for j in range(N - (K - 1)):
    L = j
    R = j + (K - 1)
    sumL = abs(listMap[L]) + abs(listMap[L] - listMap[R])
    sumR = abs(listMap[R]) + abs(listMap[R] - listMap[L])
    sum = min(sumL, sumR)
    if sum < minMin:
        minMin = sum

print(minMin)

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
listMap = [int(i) for i in input().split()]
minMin = float("inf")
ans = 0
# 正の数 or 負の数 onlyなら別処理
if listMap[0] >= 0 or listMap[-1] <= 0:
    sorted(listMap)
    ans = abs(listMap[K - 1])

else:
    for j in range(N - K):
        L = j
        R = j + K - 1
        if listMap[L] <= 0 <= listMap[R]:
            sumLR = abs(listMap[L] - listMap[R])
            if sumLR < minMin:
                minMin = sumLR
                minL = L

    # 距離を確認
    if -listMap[minL] < listMap[minL + K - 1]:
        ans = -listMap[minL] * 2 + listMap[minL + K - 1]
    else:
        ans = listMap[minL + K - 1] * 2 + -listMap[minL]

print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
listMap = [int(i) for i in input().split()]
minMin = float("inf")
ans = 0
minLR = ""
# 正の数 or 負の数 onlyなら別処理
if listMap[0] >= 0 or listMap[-1] <= 0:
    sorted(listMap)
    ans = abs(listMap[K - 1])

else:
    for j in range(N - K):
        L = j
        R = j + K - 1
        if listMap[L] <= 0 <= listMap[R]:
            sumLR = abs(listMap[L] - listMap[R])
            if sumLR < minMin:
                minMin = sumLR
                ans = L

    # 距離を確認
    if -listMap[L] < listMap[R]:
        ans = -listMap[L] * 2 + listMap[R]
    else:
        ans = listMap[R] * 2 + -listMap[L]

print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
listMap = [int(i) for i in input().split()]
minMin = float("inf")
ans = 0
minLR = ""
# 正の数 or 負の数 onlyなら別処理
if listMap[0] >= 0 or listMap[-1] <= 0:
    sorted(listMap)
    ans = listMap[K - 1]

else:
    for j in range(N - K):
        L = j
        R = j + K - 1
        if listMap[L] <= 0 <= listMap[R]:
            sumLR = abs(listMap[L] - listMap[R])
            if sumLR < minMin:
                minMin = sumLR
                ans = L

    # 距離を確認
    if -listMap[L] < listMap[R]:
        ans = -listMap[L] * 2 + listMap[R]
    else:
        ans = listMap[R] * 2 + -listMap[L]

print(ans)
Problem p03287 (python)

Fixed submission:
from collections import defaultdict as dict
d = dict(int)
N, M = map(int,input().split())
A = [int(i) for i in input().split()]
sumA = [0 for i in range(N + 1)]
for i in range(N):
    sumA[i + 1] = (A[i] + sumA[i]) % M
ans = 0

for j in range(len(sumA)):
    ans += d[sumA[j]]
    d[sumA[j]] += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = [int(i) for i in input().split()]
sumA = [0 for i in range(N + 1)]
for i in range(1, N + 1):
    sumA[i] = (A[i] + A[i - 1]) % M
ans = 0

for j in range(N):
    ans += sumA[j:].count(sumA[j]) - 1

print(ans)
Problem p03415 (python)

Fixed submission:
ans = ""
for i in range(3):
  c = input()
  ans += c[i]
print(ans)

Buggy submission (verdict: Runtime Error):
for i in range(3):
  c = [input().split()]
  print(c[i])
Problem p03633 (python)

Fixed submission:
N = int(input())
listClock = [int(input()) for i in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(x, y):
    g = gcd(x, y)
    # / で割ると小数判定になり、答えがイカれる。
    return x // g * y

ans = 1
for i in listClock:
    ans = lcm(ans, i)

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
listClock = [int(input()) for i in range(N)]
def gcd(x, y):
    while y > 0:
        x, y = y, x%y
    return x

def lcm(x, y):
    return x/gcd(x, y)*y

ans = 1

for i in listClock:
    ans = int(lcm(ans,i))

print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
N = int(input())
listClock = [int(input()) for i in range(N)]
def retLCM_base(a,b):
    return (a * b) // math.gcd(a, b)

def retLCM(*Num):
    return reduce(retLCM_base, Num, 1)

print(retLCM(*listClock))
Problem p02813 (python)

Fixed submission:
import math
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

def g(a):
    if a == []:
        return(1)
    else:
        b = sorted(a)
        for i in range(0,len(a)):
            if a[0] == b[i]:
                a.pop(0)
                return(i * math.factorial(len(a)) + g(a))

print(abs(g(P)-g(Q)))

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

def f(n):
    if n == 1:
        return(1)
    else:
        return(n * f(n-1))

def g(a):
    if a == []:
        return(1)
    else:
        b = sorted(a)
        for i in range(0,len(a)):
            if a[0] == b[i]:
                a.pop(0)
                return(i * f(len(a)) + g(a))

print(abs(g(P)-g(Q)))

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

def f(n):
    if n == 1:
        return(1)
    else:
        return(n * f(n-1))

def g(a):
    if a == []:
        return(1)
    else:
        b = sorted(a)
        for i in range(0,len(a)):
            if a[0] == b[i]:
                a.pop(0)
                return(i * f(len(a)) * g(a))

print(abs(g(P)-g(Q)))
Problem p03164 (python)

Fixed submission:
def solve(items, n, W):
    V = sum([v for _, v in items])
    dp = [float('inf')] * (V + 1)
    dp[0] = 0

    for w, v in items:
        for i in range(V, v-1, -1):
            dp[i] = min(dp[i], dp[i-v] + w)
    
    for i in range(V, -1, -1):
        if dp[i] <= W:
            return i

    return 0


def main():
    inp = lambda: [int(x) for x in input().split()]
    n, w = inp()
    items = [inp() for _ in range(n)]
    print(solve(items, n, w))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def solve(items, n, w):
    f = [[0] * (w + 1) for _ in range(n + 1)]
    for i in range(1, n + 1):
        wi, vi = items[i-1]
        for j in range(w + 1):
            f[i][j] = f[i-1][j]
            if j >= wi:
                f[i][j] = max(f[i][j], f[i-1][j-wi] + vi)
    return f[n][w]


def main():
    inp = lambda: [int(x) for x in input().split()]
    n, w = inp()
    items = [inp() for _ in range(n)]
    print(solve(items, n, w))


if __name__ == '__main__':
    main()
Problem p03170 (python)

Fixed submission:
def main():
    inp = lambda: [int(x) for x in input().split()]    
    n, k = inp()
    a = inp()
    min_a = min(a)
    dp = [False] * (k+1)
    for i in range(k + 1):
        if i < min_a:
            dp[i] = False
        elif i in a:
            dp[i] = True
        else:
            for j in a:
                if i >= j and not dp[i-j]:
                    dp[i] = True
                    break

    ans = "First" if dp[k] else "Second"
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    def f(k):
        if k < min_a:
            return False
        if k in a:
            return True
        if dp[k] != -1:
            return dp[k]
        for v in a:
            if k >= v:
                if not f(k-v):
                    dp[k] = True
                    return True
        dp[k] = False
        return False

    inp = lambda: [int(x) for x in input().split()]    
    n, k = inp()
    a = inp()
    min_a = min(a)
    dp = [-1] * (k+1)
    ans = "First" if f(k) else "Second"
    print(ans)


if __name__ == '__main__':
    main()
Problem p02730 (python)

Fixed submission:
s = input()
m = (len(s) - 1) // 2
l = s[:m]
r = s[(len(s) + 3) // 2 - 1:]


def check(s):
    mid = len(s) // 2
    if len(s) % 2 != 0:
        left = s[:mid]
        right = s[mid+1:]
    else:
        left = s[:mid]
        right = s[mid:]
    if left == right[::-1]:
        return True
    else:
        return False

if check(s) and check(r) and check(l):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
m = (len(s) - 1) / 2
l = s[:m]
r = s[(len(s) + 3) / 2 - 1:]


def check(s):
    mid = len(s) // 2
    left = s[:mid]
    right = s[mid+1:]
    if left == right[::-1]:
        return True
    else:
        return False

if check(s) and check(r) and check(l):
    print("Yes")
else:
    print("No")
Problem p02861 (python)

Fixed submission:
from itertools import permutations
from math import sqrt


def dis(i, j):
    ret = float((i[0] - j[0]) ** 2 + (i[1] - j[1]) ** 2)
    return sqrt(ret)


n = int(input())
xy = [list(map(float, input().split())) for i in range(n)]

p = list(permutations(list(range(n))))
sums = 0

for i in p:
    for j in range(len(i) - 1):
        sums += dis(xy[i[j]], xy[i[j + 1]])

print(sums / len(p))

Buggy submission (verdict: Runtime Error):
from math import sqrt


def dis(i, j):
    ret = float((i[0] - j[0]) ** 2 + (i[1] - j[1]) ** 2)
    return sqrt(ret)


n = int(input())
xy = [list(map(float, input().split())) for i in range(n)]

p = list(permutations(range(n)))

sums = 0
for i in p:
    for j in range(len(i) - 1):
        sums += dis(xy[i[j]], xy[i[j + 1]])

print(sums / len(p))
Problem p02995 (python)

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

f = (c * d) // fractions.gcd(c, d)

ret_b = b - (b // c + b // d - b // f)
ret_a = (a - 1) - ((a - 1) // c + (a - 1) // d - (a - 1) // f)
ans = ret_b - ret_a
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())

f = (c * d) // math.gcd(c, d)

ret_b = b - (b // c + b // d - b // f)
ret_a = (a - 1) - ((a - 1) // c + (a - 1) // d - (a - 1) // f)
ans = ret_b - ret_a
print(ans)
Problem p03030 (python)

Fixed submission:
n = int(input())

sp = []
for i in range(n):
    s, p = input().split()
    sp.append((s, int(p), i+1))

sp_sort = sorted(sp, key=lambda x: (x[0], -1 * x[1]))

for i in range(n):
    print(sp_sort[i][2])

Buggy submission (verdict: Runtime Error):
sp = []
for i in range(n):
    s, p = input().split()
    sp.append((s, int(p), i+1))

sp_sort = sorted(sp, key=lambda x: (x[0], -1 * x[1]))

for i in range(n):
    print(sp_sort[i][2])
Problem p03493 (python)

Fixed submission:
s = input()
c = 0
if s[0] == "1": c += 1
if s[1] == "1": c += 1
if s[2] == "1": c += 1
print(c)

Buggy submission (verdict: Runtime Error):
n = input()
s = list(map(int, input().split()))
c = 0
while True:
        exist = False
        #print(s)
        for i in range(len(s)):
                #print(i)
                if s[i]%2 != 0:
                        exist = True

        if exist:
                print(c)
                break
        for i in range(len(s)):
                s[i] = s[i]/2
        c += 1
Problem p02780 (python)

Fixed submission:

N,K = map(int,input().split())
P_List=list(map(int,input().split()))
#print(N,K)
#print(P_List)

def Kitaichi(p):
    result = 0
    for i in range(p):
        result += (i+1)*1/p
    #print(p,result)
    return result

def Kitaichi2(p):
    return (p+1)*0.5

kitaichi_list=[]
ruisekiwa_list=[]
ruisekiwa=0
for a in range(N):
    kitaichi_list.append(Kitaichi2(P_List[a]))
    ruisekiwa += Kitaichi2(P_List[a])
    ruisekiwa_list.append(ruisekiwa)

#print(kitaichi_list)
#print(ruisekiwa_list)
pre_max=0
temp_max=0
max_num=0
for j in range(N-(K-1)):
    if j == 0:
        temp_max = ruisekiwa_list[j+K-1] - 0
    else:
        temp_max = ruisekiwa_list[j+K-1] - ruisekiwa_list[j-1]
    

    if pre_max < temp_max:
        pre_max = temp_max
    temp_max=0

print(pre_max)

Buggy submission (verdict: Runtime Error):

N,K = map(int,input().split())
P_List=list(map(int,input().split()))
#print(N,K)
#print(P_List)

def Kitaichi(p):
    result = 0
    for i in range(p):
        result += (i+1)*1/p
    #print(p,result)
    return result

def Kitaichi2(p):
    return (p+1)*0.5

kitaichi_list=[]
ruisekiwa_list=[]
ruisekiwa=0
for a in range(N):
    kitaichi_list.append(Kitaichi2(P_List[a]))
    ruisekiwa += Kitaichi2(P_List[a])
    ruisekiwa_list.append(ruisekiwa)

#print(kitaichi_list)
#print(ruisekiwa_list)
pre_max=0
temp_max=0
max_num=0
for j in range(N-(K-1)):
    if j == 0:
        temp_max = ruisekiwa_list[j+K] - 0
    else:
        temp_max = ruisekiwa_list[j+K] - ruisekiwa_list[j-1]
    

    if pre_max < temp_max:
        pre_max = temp_max
    temp_max=0

print(pre_max)
Problem p02882 (python)

Fixed submission:
import math

a, b, x = map(int, input().split())

b_1 = x / (a ** 2)
area_1 = a * b_1
area_2 = (a * b) / 2

if b_1 == b:
    ans = 90
elif area_2 > area_1:
    # 三角形
    h = (a * b_1 * 2) / b
    ans = math.degrees(math.atan(h / b))
else:
    # 梯形
    upside_len = b_1 * 2 - b
    ans = math.degrees(math.atan(a / (b - upside_len)))

print(90 - ans)

Buggy submission (verdict: Runtime Error):
import math

a, b, x = map(int, input().split())

b_1 = x / (a ** 2)
area_1 = a * b_1
area_2 = (a * b) / 2

if area_2 > area_1:
    # 三角形
    h = (a * b_1 * 2) / b
    ans = math.degrees(math.atan(h / b))
else:
    # 梯形
    upside_len = b_1 * 2 - b
    ans = math.degrees(math.atan(a / (b - upside_len)))

print(90 - ans)
Problem p02918 (python)

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

s_c = []

left = 0
right = 0
for i in range(n - 1):
    if s[i] == s[i + 1]:
        right = i + 1
    else:
        s_c.append(''.join(s[left:right + 1]))
        i += 1
        left = i
        right = i
s_c.append(''.join(s[left:right + 1]))

s_c_len = len(s_c)
cc = 'R'
if s_c_len > 1 and s_c[1][0] == 'R':
    cc = 'L'

for i in range(k):
    if (2 * i + 1) > s_c_len - 1:
        break
    s_c[2 * i + 1] = cc * len(s_c[2 * i + 1])

ans_s = ''.join(s_c)
ans = 0
for i in range(n):
    if ans_s[i] == 'R' and i != n - 1 and ans_s[i + 1] == 'R':
        ans += 1
    elif ans_s[i] == 'L' and i != 0 and ans_s[i - 1] == 'L':
        ans += 1
print(ans)

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

s_c = []

left = 0
right = 0
for i in range(n - 1):
    if s[i] == s[i + 1]:
        right = i + 1
    else:
        s_c.append(''.join(s[left:right + 1]))
        i += 1
        left = i
        right = i
s_c.append(''.join(s[left:right + 1]))

cc = 'R'
if s_c[1][0] == 'R':
    cc = 'L'

s_c_len = len(s_c)
for i in range(k):
    if (2 * i + 1) > s_c_len - 1:
        break
    s_c[2 * i + 1] = cc * len(s_c[2 * i + 1])

ans_s = ''.join(s_c)
ans = 0
for i in range(n):
    if ans_s[i] == 'R' and i != n - 1 and ans_s[i + 1] == 'R':
        ans += 1
    elif ans_s[i] == 'L' and i != 0 and ans_s[i - 1] == 'L':
        ans += 1
print(ans)

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

s_c = []

left = 0
right = 0
for i in range(n - 1):
    if s[i] == s[i + 1]:
        right = i + 1
    else:
        s_c.append(''.join(s[left:right + 1]))
        i += 1
        left = i
        right = i
s_c.append(''.join(s[left:right + 1]))

cc = 'R'
if s_c[1][0] == 'R':
    cc = 'L'
for i in range(k):
    s_c[2 * i + 1] = cc * len(s_c[2 * i + 1])

ans_s = ''.join(s_c)
ans = 0
for i in range(n):
    if ans_s[i] == 'R' and i != n - 1 and ans_s[i + 1] == 'R':
        ans += 1
    elif ans_s[i] == 'L' and i != 0 and ans_s[i - 1] == 'L':
        ans += 1
print(ans)
Problem p03085 (python)

Fixed submission:
s = input()

dict = {'A': 'T', 'C': 'G', 'T': 'A', 'G': 'C'}
print(dict[s])

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

dict = {'A': 'T', 'C': 'G'}
print(dict[s])
Problem p03164 (python)

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

max_v = 100005

dp = [[float('inf')] * max_v for j in range(n + 1)]
dp[0][0] = 0

for i in range(n):
    for sum_v in range(max_v):
        if sum_v - item[i][1] >= 0:
            dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v - item[i][1]] + item[i][0])
        dp[i + 1][sum_v] = min((dp[i + 1][sum_v], dp[i][sum_v]))

for sum_v in reversed(range(max_v)):
    if dp[-1][sum_v] <= w:
        print(sum_v)
        break

Buggy submission (verdict: Runtime Error):
n, w = map(int, input().split())
item = [list(map(int, input().split())) for i in range(n)]

max_v = 100005

dp = [[float('inf') * max_v] for j in range(n + 1)]
dp[0][0] = 0

for i in range(n):
    for sum_v in range(max_v):
        if sum_v - item[i][1] >= 0:
            dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v - item[i][1]] + item[i][0])
        dp[i + 1][sum_v] = min((dp[i + 1][sum_v], dp[i][sum_v]))

for sum_v in reversed(range(max_v)):
    if dp[-1][sum_v] <= w:
        print(sum_v)
        break
Problem p02937 (python)

Fixed submission:
from bisect import bisect_right

s = input()
t = input()
obj = {}

loop_num = 0
temp_num = -1

for i in range(len(s)):
    char = s[i]
    if not (char in obj):
        obj[char] = [i]
    else:
        obj[char].append(i)

for i in range(len(t)):
    char = t[i]
    if not (char in obj):
        loop_num = -1
        break
    else:
        next_index = bisect_right(obj[char], temp_num)
        if next_index == len(obj[char]):
            loop_num += 1
            temp_num = obj[char][0]
        else:
            temp_num = obj[char][next_index]

if(loop_num == -1):
    print(-1)
else:
    print(loop_num * len(s) + temp_num + 1)

Buggy submission (verdict: Runtime Error):
import itertools

s = input()
t = input()
obj = {}

loop_num = 0
temp_num = -1

for i in range(len(s)):
    char = s[i]
    if not (char in obj):
        obj[char] = [i]
    else:
        obj[char].append(i)

for i in range(len(t)):
    char = t[i]
    if not (char in obj):
        loop_num = -1
        break
    else:
        next_num = next(itertools.ifilter(lambda x: x >= temp_num, obj[char]), None)
        if next_num == None:
            loop_num += 1
            temp_num = obj[char][0]
        else:
            temp_num = next_num

if(loop_num == -1):
    print(-1)
else:
    print(loop_num * len(s) + temp_num + 1)
Problem p02732 (python)

Fixed submission:
n = int(input())
numlist = [int(_) for _ in input().split()]
numdic = {}
nsum = 0

for i in range(n):
    if numlist[i] in numdic:
        numdic[numlist[i]] += 1
    else:
        numdic[numlist[i]] = 1

for k in numdic:
    nsum += numdic[k] * (numdic[k] - 1) // 2

for j in range(n):
    ans = nsum
    cal = numdic[numlist[j]]
    if cal >= 2:
        ans = ans - (cal-1)
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
numlist = [int(_) for _ in input().split()]
setnum = set(numlist)
nsum = 0

for i in setnum:
    dicnum[i] = numlist.count(i)
    if dicnum[i] >= 2:
        nsum += dicnum[i]*(dicnum[i]-1)//2
    else:
        del dicnum[i]

for j in range(n):
    ans = nsum
    if numlist[j] in dicnum:
        ans = ans - dicnum[numlist[j]] + 1
    print(ans)
Problem p02756 (python)

Fixed submission:
right = input()
Q = int(input())
flag = 0b1
left = ""
for i in range(Q):
    q = input()
    if q == "1":
        flag ^= 1
        continue
    m,f,c = q.split(" ")
    f = int(f)
    left += c*(1-flag)*(f-1)
    right += c*flag*(f-1)
    left += c*flag*(2-f)
    right += c*(1-flag)*(2-f)
if flag == 1:
    print(left[::-1]+right)
else:
    print(right[::-1]+left)

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
flag = 0b0
for i in range(q) :
    t = input()
    if t == 1 :
        flag ^= 1
        continue
    if (int(t[2]) - flag) == 1 :
        s = t[4] + s
    else :
        s = s + t[4]
if flag == 0 :
    print(s)
else :
    print(s[::-1])
Problem p03962 (python)

Fixed submission:
a, b, c = map(int, input().split())
count = 0
if a != b :
    count += 1
if a != c :
    count += 1
if b != c :
    count += 1
if a == b == c :
    count =1
print(count)

Buggy submission (verdict: Runtime Error):
wlist = []
for i in range(3) :
    w = input()
    if not w in wlist :
        wlist.append(w)
print(len(wlist))
Problem p03964 (python)

Fixed submission:
n = int(input())
votelist = [list(map(int, input().split())) for _ in range(n)]

chlist = votelist[0]
for i in range(1, n):
    x = max(-(chlist[0]*-1 // votelist[i][0]), -(chlist[1]*-1 // votelist[i][1]))
    chlist[0] = votelist[i][0] * x
    chlist[1] = votelist[i][1] * x
    
print(sum(chlist))

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
vlist = [input().split() for i in range(n)]
for m in range(n) :
    vlist[m] = [int(l) for l in vlist[m]]
for j in range(n-1) :
    if vlist[j][0] <= vlist[j+1][0] and vlist[j][1] <= vlist[j][1] :
        continue
    if vlist[j][0] > vlist[j+1][0] and vlist[j][0] > vlist[j][1] :
        vlist[j+1] = [int(k*(np.lcm(vlist[j][0], vlist[j+1][0]))/vlist[j+1][0]) for k in vlist[j+1]]
        continue
    elif vlist[j][1] > vlist[j+1][1] and vlist[j][1] > vlist[j][0]:
        vlist[j+1] = [int(k*(np.lcm(vlist[j][1], vlist[j+1][1]))/vlist[j+1][1]) for k in vlist[j+1]]
        continue
    elif vlist[j+1][0] > vlist[j+1][1] :
        vlist[j+1] = [int(k*(np.lcm(vlist[j][1], vlist[j+1][1]))/vlist[j+1][1]) for k in vlist[j+1]]
        continue
    else :
        vlist[j+1] = [int(k*(np.lcm(vlist[j][0], vlist[j+1][0]))/vlist[j+1][0]) for k in vlist[j+1]]
print(sum(vlist[n-1]))

Buggy submission (verdict: Runtime Error):
n = int(input())
vlist = [input().split() for i in range(n)]
for m in range(n) :
    vlist[m] = [int(l) for l in vlist[m]]
for j in range(n-1) :
    if vlist[j][0] <= vlist[j+1][0] and vlist[j][1] <= vlist[j][1] :
        continue
    if vlist[j][0] > vlist[j+1][0] and vlist[j][0] > vlist[j][1] :
        vlist[j+1] = [int(k*(np.lcm(vlist[j][0], vlist[j+1][0]))/vlist[j+1][0]) for k in vlist[j+1]]
        continue
    elif vlist[j][1] > vlist[j+1][1] and vlist[j][1] > vlist[j][0]:
        vlist[j+1] = [int(k*(np.lcm(vlist[j][1], vlist[j+1][1]))/vlist[j+1][1]) for k in vlist[j+1]]
        continue
    elif vlist[j+1][0] > vlist[j+1][1] :
        vlist[j+1] = [int(k*(np.lcm(vlist[j][1], vlist[j+1][1]))/vlist[j+1][1]) for k in vlist[j+1]]
        continue
    else :
        vlist[j+1] = [int(k*(np.lcm(vlist[j][0], vlist[j+1][0]))/vlist[j+1][0]) for k in vlist[j+1]]
print(sum(vlist[n-1]))

Buggy submission (verdict: Runtime Error):
for j in range(n-1) :
    if vlist[j][0] <= vlist[j+1][0] and vlist[j][1] <= vlist[j][1] :
        continue
    if vlist[j][0] > vlist[j+1][0] and vlist[j][0] > vlist[j][1] :
        vlist[j+1] = [int(k*(np.lcm(vlist[j][0], vlist[j+1][0]))/vlist[j+1][0]) for k in vlist[j+1]]
        continue
    elif vlist[j][1] > vlist[j+1][1] and vlist[j][1] > vlist[j][0]:
        vlist[j+1] = [int(k*(np.lcm(vlist[j][1], vlist[j+1][1]))/vlist[j+1][1]) for k in vlist[j+1]]
        continue
    elif vlist[j+1][0] > vlist[j+1][1] :
        vlist[j+1] = [int(k*(np.lcm(vlist[j][1], vlist[j+1][1]))/vlist[j+1][1]) for k in vlist[j+1]]
        continue
    else :
        vlist[j+1] = [int(k*(np.lcm(vlist[j][0], vlist[j+1][0]))/vlist[j+1][0]) for k in vlist[j+1]]
print(sum(vlist[n-1]))
Problem p03997 (python)

Fixed submission:
a, b, h = [int(input()) for i in range(3)]
print(int((a+b)*h/2))

Buggy submission (verdict: Runtime Error):
a, b, h = [int(input()) for i in range(3)]
print(int((a+b)*h/2)
Problem p04045 (python)

Fixed submission:
n, k = map(int, input().split())
list_num = [i for i in input().split()]
price = n
while True :
    i = 0
    for i in range(len(str(price))) :
        if str(price)[i] in list_num :
            price += 1
            break
    else :
        print(price)
        break

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
list_num = [input() for i in range(k)]
price = n
while True :
    i = 0
    for i in range(len(str(price))) :
        if str(price)[i] in list_num :
            price += 1
            break
    else :
        print(price)
        break
Problem p03160 (python)

Fixed submission:
n=int(input())
a=[int(s) for s in input().split()]
b=[0]*n
b[1]=abs(a[0]-a[1])
for i in range(2,n):
    b[i]=min(b[i-1]+abs(a[i]-a[i-1]),b[i-2]+abs(a[i]-a[i-2]))
print(b[n-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(s) for s in input().split()]
b=[0]*n
b[1]=abs(a[0]-a[1])
for i in range(2,n):
  b[i]=min(b[i-1]+abs(a[i]-a[i-1]),b[i-2]+as(a[i]-a[i-2]))
print(b[n-1])