Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n = int(input())
a = input().split()
b = []

for i in range(n):
    if i%2==0:
        b.append(a[i])
    else:
        b.insert(0, a[i])

if n%2==0:
    print(" ".join(b))
else:
    print(" ".join(b[::-1]))


Fixed submission:
# -*- coding: utf-8 -*-
n = int(input())
a = input().split()
b = [a[0], []]
last = b[1]

for i in range(1,n):
    if i%2==0:
        last.append(a[i])
        last.append([])
        last = last[1]
    else:
        b = [a[i],b]

ret = []
for _ in range(n):
    ret.append(b[0])
    b = b[1]

if n%2==0:
    print(" ".join(ret))
else:

    print(" ".join(ret[::-1]))
Buggy python submission (verdict: Time Limit Exceeded):
# coding=utf-8

INF = 10**9 + 1
n = int(input())
V = []

for _ in range(n):
    line = input().split(" ")
    V.append((int(line[0]), int(line[1])))

def cost(vi, ui):
    v = V[vi]
    u = V[ui]
    return min(abs(v[0]-u[0]), abs(v[1]-u[1]))

mincost = [INF for _ in range(n)]
used = [False for _ in range(n)]

mincost[0] = 0
ret = 0

while True:
    v = -1
    for u in range(n):
        if not used[u] and (v==-1 or mincost[u]<mincost[v]):
            v = u
    if v==-1:
        break

    used[v] = True
    ret += mincost[v]

    for u in range(n):
        mincost[u] = min(mincost[u], cost(v,u))

print(ret)


Fixed submission:
# -*- coding: utf-8 -*-
n = int(input())
ax = []
ay = []
for i in range(n):
    x,y = map(int, input().split())
    ax.append((x,i))
    ay.append((y,i))

ax.sort()
ay.sort()

edge = []
for i in range(n-1):
    v = ax[i][1]
    u = ax[i+1][1]
    c = abs(ax[i][0]-ax[i+1][0])
    edge.append((c,v,u))

    v = ay[i][1]
    u = ay[i+1][1]
    c = abs(ay[i][0]-ay[i+1][0])
    edge.append((c,v,u))

edge.sort()



class UnionFind():
    def __init__(self, n):
        self.par = [i for i in range(n)]
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return

        if x<y:
            self.par[y] = x
        else:
            self.par[x] = y
    def same(self, x, y):
        return self.find(x) == self.find(y)

t = UnionFind(n)
res = 0
for e in edge:
    cost = e[0]
    v = e[1]
    u = e[2]

    if not t.same(v,u):
        # print((v,u,cost))
        t.unite(v,u)
        res += cost

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n,W = map(int, input().split())
iw,v = map(int, input().split())
d = {
    0: [v]
    ,1: []
    ,2: []
    ,3: []
}
for _ in range(1,n):
    w,v = map(int,input().split())
    d[w-iw].append(v)

for i in range(4):
    d[i] = sorted(d[i], reverse=True)

ret = -1
for i in range(n+1):
    if i*iw>W:
        break
    for j in range(n-i+1):
        if i*iw+j*(iw+1)>W:
            break
        for k in range(n-(i+j)+1):
            if i*iw+j*(iw+1)+k*(iw+2)>W:
                break
            for l in range(n-(i+j+k)+1):
                if i*iw+j*(iw+1)+k*(iw+2)+l*(iw+3)>W:
                    continue
                V = sum(d[0][:i])+sum(d[1][:j])+sum(d[2][:k])+sum(d[3][:l])
                ret = max(ret, V)
print(ret)


Fixed submission:
# -*- coding: utf-8 -*-
n,W = map(int, input().split())
iw,v = map(int, input().split())
d = {
    0: [v]
    ,1: []
    ,2: []
    ,3: []
}
for _ in range(1,n):
    w,v = map(int,input().split())
    d[w-iw].append(v)

for i in range(4):
    d[i] = sorted(d[i], reverse=True)

ret = -1
for i in range(min(n,len(d[0]))+1):
    if i*iw>W:
        break
    for j in range(min(n-i,len(d[1]))+1):
        if i*iw+j*(iw+1)>W:
            break
        for k in range(min(n-(i+j),len(d[2]))+1):
            if i*iw+j*(iw+1)+k*(iw+2)>W:
                break
            for l in range(min(n-(i+j+k),len(d[3]))+1):
                if i*iw+j*(iw+1)+k*(iw+2)+l*(iw+3)>W:
                    continue
                V = sum(d[0][:i])+sum(d[1][:j])+sum(d[2][:k])+sum(d[3][:l])
                ret = max(ret, V)
print(ret)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from math import sqrt,ceil,log10

n = int(input())

nsr = sqrt(n)

x = -1
for i in range(1,ceil(nsr)):
    if n%i==0:
        x = n//i

ret = ceil(log10(x))
if 10**(ret)==int(x):
    print(ret+1)
else:
    print(ret)


Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())

def cntd(x):
    digits = 0

    while x/10>0:
        x = x//10
        digits += 1
    return digits

ans = cntd(n)

a = 1
while a*a<=n:
    if n%a!=0:
        a += 1
        continue

    b = n//a
    cur = max(cntd(a), cntd(b))
    if ans>cur:
        ans = cur
    a += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from math import sqrt,ceil,log10

n = int(input())

nsr = sqrt(n)

for i in range(ceil(nsr),n+1):
    if n%i==0:
        ret = ceil(log10(i))
        if 10**ret==int(i):
            print(ret+1)
        else:
            print(ret)
        exit()


Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())

def cntd(x):
    digits = 0

    while x/10>0:
        x = x//10
        digits += 1
    return digits

ans = cntd(n)

a = 1
while a*a<=n:
    if n%a!=0:
        a += 1
        continue

    b = n//a
    cur = max(cntd(a), cntd(b))
    if ans>cur:
        ans = cur
    a += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
x = int(input())

if x<=6:
    print(1)
    exit()
if x<=11:
    print(2)
    exit()

r = x%11
ret = x//11
if r<=6:
    print(2*ret+1)
elif t<=11:
    print(2*ret+2)
else:
    print(2*ret)


Fixed submission:
# -*- coding: utf-8 -*-
x = int(input())

if x<=6:
    print(1)
    exit()
if x<=11:
    print(2)
    exit()

r = x%11
ret = x//11
if r==0:
    print(2*ret)
elif r<=6:
    print(2*ret+1)
elif r<=11:
    print(2*ret+2)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
INF = 10**10
n,m = map(int, input().split())
d = [[INF for _ in range(n)] for _ in range(n)]
el = []

for _ in range(m):
    a,b,c = map(int,input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c
    el.append([a-1,b-1,c])

for k in range(n):
    for i in range(n):
        for j in range(n):
            if i==j:
                d[i][j] = 0

            d[i][j] = min(d[i][j], d[i][k]+d[k][j])

ret = 0
for ei in range(m):
    a = el[ei][0]
    b = el[ei][1]
    c = el[ei][2]
    flag = False
    for s in range(n):
        for t in range(n):
            if d[s][a]+c+d[b][t]==d[s][t]:
                flag = True
                break
        if flag:
            break
    if not flag:
        ret += 1
print(ret)


Fixed submission:
# -*- coding: utf-8 -*-
INF = 10**10
n,m = map(int, input().split())
d = [[INF for _ in range(n)] for _ in range(n)]
el = []

for _ in range(m):
    a,b,c = map(int,input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c
    el.append([a-1,b-1,c])

for k in range(n):
    for i in range(n):
        for j in range(n):
            if i==j:
                d[i][j] = 0

            d[i][j] = min(d[i][j], d[i][k]+d[k][j])

ret = 0
for ei in range(m):
    a = el[ei][0]
    b = el[ei][1]
    c = el[ei][2]
    flag = False
    for s in range(n):
        if d[s][a]+c==d[s][b]:
            flag = True
            break
    if not flag:
        ret += 1
print(ret)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def f(s):
    # print(s)
    if s.startswith("dream"):
        return f(s[5:]) or f(s[7:])
    elif s.startswith("erase"):
        return f(s[5:]) or f(s[6:])
    elif s=="":
        return True
    else:
        return False

if f(input()):
    print("YES")
else:
    print("NO")


Fixed submission:
# -*- coding: utf-8 -*-

s = input()[::-1]
w = [
    "dream"[::-1]
    ,"dreamer"[::-1]
    ,"erase"[::-1]
    ,"eraser"[::-1]
]

while len(s)>0:
    if s.startswith(w[0]):
        s = s[len(w[0]):]
    elif s.startswith(w[1]):
        s = s[len(w[1]):]
    elif s.startswith(w[2]):
        s = s[len(w[2]):]
    elif s.startswith(w[3]):
        s = s[len(w[3]):]
    else:
        break

if len(s)==0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n = int(input())

for k in range(1,n+1):
    s = k*(k+1)//2
    if s==n:
        res = set(range(1,k+1))
        break
    if s>=n and (s-n)<=k:
        res = set(range(1,k+1))
        res.remove(s-n)

for r in res:
    print(r)


Fixed submission:
# -*- coding: utf-8 -*-
n = int(input())

for k in range(1,n+1):
    s = k*(k+1)//2
    if s==n:
        res = set(range(1,k+1))
        break
    if s>=n and (s-n)<=k:
        res = set(range(1,k+1))
        res.remove(s-n)
        break

for r in res:
    print(r)
Buggy python submission (verdict: Runtime Error):
import unittest


class TestFunc(unittest.TestCase):
    def test_1(self):
        self.assertEqual(fun(5,8,[50,30,40,10,20]),2)
        self.assertEqual(fun(3,2,[100,50,200]),1)
        self.assertEqual(fun(10,100,[7,10,4,5,9,3,6,8,2,1]),2)
        self.assertEqual(fun(5,2,[1,2,3,2,4]),1)




def fun(n,t,a):
    aa = []
    b = None
    s = None
    for i in range(n):
        m = -1
        for j in range(i+1,n):
            if a[j]>a[i] and a[j]-a[i]>m:
                m = a[j]-a[i]
        if m>0:
            aa.append(m)

    c = aa[0]
    ans = 1
    for i in range(1,len(aa)):
        if c<aa[i]:
            c = aa[i]
            ans = 1
        elif c==aa[i]:
            ans += 1

    return ans


if __name__=='__main__':
    #unittest.main()                                                                                                                                                              

    n,t = [int(x) for x in raw_input().split(" ")]
    a = [int(x) for x in raw_input().split(" ")]
    print(fun(n,t,a))


Fixed submission:
s = raw_input()

ans = 0
c = s[0]

for i in range(1,len(s)):
    if c!=s[i]:
        ans += 1
        c = s[i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import unittest


class TestFunc(unittest.TestCase):
    def test_1(self):
        self.assertEqual(fun(5,8,[50,30,40,10,20]),2)
        self.assertEqual(fun(3,2,[100,50,200]),1)
        self.assertEqual(fun(10,100,[7,10,4,5,9,3,6,8,2,1]),2)
        self.assertEqual(fun(5,2,[1,2,3,2,4]),1)




def fun(n,t,a):
    aa = []
    b = None
    s = None
    for i in range(n):
        m = -1
        for j in range(i+1,n):
            if a[j]>a[i] and a[j]-a[i]>m:
                m = a[j]-a[i]
        if m>0:
            aa.append(m)

    c = aa[0]
    ans = 1
    for i in range(1,len(aa)):
        if c<aa[i]:
            c = aa[i]
            ans = 1
        elif c==aa[i]:
            ans += 1

    return ans


if __name__=='__main__':
    #unittest.main()                                                                                                                                                              

    n,t = [int(x) for x in raw_input().split(" ")]
    a = [int(x) for x in raw_input().split(" ")]
    print(fun(n,t,a))


Fixed submission:
import unittest

class TestFunc(unittest.TestCase):
    def test_1(self):
        self.assertEqual(fun(5,8,[50,30,40,10,20]),2)
	self.assertEqual(fun(3,2,[100,50,200]),1)
        self.assertEqual(fun(10,100,[7,10,4,5,9,3,6,8,2,1]),2)
        self.assertEqual(fun(5,2,[1,2,3,2,4]),1)

def fun(n,t,a):
    aa = []
    b = None
    s = None
    for i in range(n):
	if b!=None:
            if s==None:
		if b<a[i]:
                    s = a[i]
                else:
                    b = a[i]
            elif s<=a[i]:
                s = a[i]
            elif s>b:
                aa.append(s-b)
		if b>a[i]:
                    b = a[i]
		s = None
	else:
            b = a[i]

    if b!=None and s!= None and s-b>0:
	aa.append(s-b)

    c = aa[0]
    ans = 1
    for i in range(1,len(aa)):
	if c<aa[i]:
            c = aa[i]
            ans = 1
	elif c==aa[i]:
            ans += 1

    return ans


if __name__=='__main__':
    #unittest.main()                                                                                                                                                              

    n,t = [int(x) for x in raw_input().split(" ")]
    a = [int(x) for x in raw_input().split(" ")]
    print(fun(n,t,a))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n,x = map(int, input().split())

if x==1 or x==2*n-1:
    print("No")
    exit()
if n==2:
    print("Yes")
    print(1)
    print(2)
    print(3)

ret = [0 for _ in range(2*n-1)]
if x!=2:
    ret[n-1] = x-1
    ret[n] = x
    ret[n+1] = x+1
    ret[n+2] = x-2
    d = [x-2,x-1,x,x+1]
else:
    ret[n-1] = x+1
    ret[n] = x
    ret[n+1] = x-1
    ret[n+2] = x+2
    d = [x-1,x,x+1,x+2]
i = 0
j = 1
while i<2*n-1:
    if ret[i]==0:
        while j in d:
            j += 1
        ret[i] = j
        j += 1
    i += 1
print("Yes")
for x in ret:
    print(x)


Fixed submission:
# -*- coding: utf-8 -*-
n,x = map(int, input().split())

if x==1 or x==2*n-1:
    print("No")
    exit()
if n==2:
    print("Yes")
    print(1)
    print(2)
    print(3)
    exit()

ret = [0 for _ in range(2*n-1)]
if x!=2:
    ret[n-1-1] = x-1
    ret[n-1] = x
    ret[n+1-1] = x+1
    ret[n+2-1] = x-2
    d = [x-2,x-1,x,x+1]
else:
    ret[n-1-1] = x+1
    ret[n-1] = x
    ret[n+1-1] = x-1
    ret[n+2-1] = x+2
    d = [x-1,x,x+1,x+2]
i = 0
j = 1
while i<2*n-1:
    if ret[i]==0:
        while j in d:
            j += 1
        ret[i] = j
        j += 1
    i += 1
print("Yes")
for x in ret:
    print(x)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n = int(input())
t = []
a = []
for _ in range(n):
    line = input().split(" ")
    t.append(int(line[0]))
    a.append(int(line[1]))

T = t[0]
A = a[0]

for i in range(1,n):
    c = 1
    tt = t[i]
    aa = a[i]
    while T>tt or A>aa:
        c += 1
        tt = t[i]*c
        aa = a[i]*c
    T = tt
    A = aa

print(T+A)


Fixed submission:
# -*- coding: utf-8 -*-
import math
n = int(input())
T = 1
A = 1
for _ in range(n):
    line = input().split(" ")
    t = int(line[0])
    a = int(line[1])
    c = max((T+t-1)//t, (A+a-1)//a)
    T = c*t
    A = c*a

print(A+T)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
line = input().split(" ")
n = int(line[0])
a = int(line[1])
x = [int(i) for i in input().split(" ")]

X = max(max(x), a)

dp = [[[0 for s in range(n*X+1)] for k in range(n+1)] for j in range(n+1)]

dp[0][0][0] = 1

for j in range(n+1):
    for k in range(n+1):
        for s in range(n*X+1):
            if j>0 and s<x[j-1]:
                dp[j][k][s] = dp[j-1][k][s]
            elif j>0 and k>0 and s>=x[j-1]:
                dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-x[j-1]]

ret = 0
for k in range(1,n+1):
    ret += dp[n][k][k*a]
print(ret)


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

offset = 300
dp = [[0]*600 for _ in range(n+1)]
dp[0][offset] = 1
for i in range(1,n+1):
    x = xl[i-1]-a
    for j in range(-300,300):
        dp[i][offset+j] = dp[i-1][offset+j]
        if 600>offset+j-x>=0:
            dp[i][offset+j] += dp[i-1][offset+j-x]

print(dp[n][offset]-1)
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int, input().split())

if min(a,b)<0 and max(a,b)>0:
    print("Zero")
    exit()
if min(a,b)>0:
    print("Positive")
    exit()

cnt = 0
for i in range(min(a,b),max(a,b)+1):
    if i<0:
        cnt += 1

if cnt%2==0:
    print("Positive")
else:
    print("Negative")

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

if min(a,b)<0 and max(a,b)>0:
    print("Zero")
    exit()
if min(a,b)>0:
    print("Positive")
    exit()


c = -min(a,b) - max(a,b) + 1

if c%2==0:
    print("Positive")
else:
    print("Negative")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import heapq
from typing import List, Tuple, Dict
from dataclasses import dataclass, field

import scipy
import numpy as np
from numba import jit

D = int(input())  # 日数 D = 365
C = np.array(list(map(int, input().split())), dtype='int32')  # 満足度の下がりやすさ 26個
S = np.array([list(map(int, input().split())) for _ in range(D)], dtype='int32')  # d日目にコンテストiを行ったときの満足度


@dataclass()
class Node:
    value: int
    plan: List[int]
    last: List[int]

    def __lt__(self, other) -> bool:
        return self.value > other.value  # PriorityQueueで最大値が欲しいので逆に


def calc_last(plan: List[int]) -> List[int]:
    res = [0 for _ in range(26)]

    for d, p in enumerate(plan):
        res[p - 1] = d + 1

    return res


def calc_satisfaction(plan: List[int]) -> int:
    assert len(plan) == D
    res = 0
    last = [0 for _ in range(26)]

    for d in range(D):
        p = plan[d] - 1
        res += S[d][p]
        last[p] = d + 1

        for i in range(26):
            res -= C[i] * (d + 1 - last[i])

    return res


def calc_score(plan: List[int]) -> int:
    return max(10 ** 6 + calc_satisfaction(plan), 0)


def calc_dissatisfaction(d: int, last: List[int]) -> int:
    return sum([C[i] * (d - last[i]) for i in range(26)])


CAPACITY = 26

queue: List[Node] = [Node(0, [], [0 for _ in range(26)])]
for d in range(D):
    next_queue: List[Node] = []

    heapq.heapify(queue)
    cnt = 0
    while queue and cnt < CAPACITY:
        cnt += 1
        node = heapq.heappop(queue)
        dis = calc_dissatisfaction(d + 1, node.last)

        for i in range(26):
            s = S[d][i] + C[i] * (d + 1 - node.last[i]) - dis

            next_queue.append(
                Node(
                    node.value + s,
                    node.plan + [i + 1],
                    node.last[:i] + [d + 1] + node.last[i + 1:]
                ),
            )

    queue = next_queue

res_node = heapq.heappop(queue)
print(res_node, file=sys.stderr)
print('\n'.join(map(str, res_node.plan)))


Fixed submission:
from dataclasses import dataclass, field

import scipy
import numpy as np
from numba import jit


@dataclass()
class Node:
    date: int
    value: int
    result: list = field(default_factory=list)

    def __lt__(self, other) -> bool:
        return self.value < other.value

    def output(self) -> str:
        assert len(self.result) == 365
        return '\n'.join(self.result)


D = int(input())  # 日数 D = 365
C = np.array(list(map(int, input().split())), dtype=int)  # 満足度の下がりやすさ 26個
S = np.array([list(map(int, input().split())) for _ in range(D)], dtype=int)  # d日目にコンテストiを行ったときの満足度

for d in range(D):
    t = 0
    max_s = 0
    for i, s in enumerate(S[d]):
        if s > max_s:
            t = i
            max_s = s

    print(t + 1)
Buggy python submission (verdict: Time Limit Exceeded):
from dataclasses import dataclass
from collections import deque


@dataclass
class Query:
    now: int
    prev: int
    cost: int


N, M = map(int, input().split())
E = [[] for _ in range(N + 1)]

for e in range(M):
    a, b = map(int, input().split())
    E[a].append(b)
    E[b].append(a)

res = [-1 for _ in range(N + 1)]
cost = [float('inf') for _ in range(N + 1)]
cost[1] = 0

queue = deque()

for next in E[1]:
    queue.append(Query(next, 1, 1))

while len(queue):
    q = queue.popleft()
    if cost[q.now] > q.cost:
        res[q.now] = q.prev
        cost[q.now] = q.cost

    for next in E[q.now]:
        if cost[next] > q.cost + 1:
            queue.append(Query(next, q.now, q.cost + 1))

for r in res[2:]:
    if r == -1:
        print('No')
        exit()

print('Yes')
for r in res[2:]:
    print(r)


Fixed submission:
from dataclasses import dataclass
from collections import deque


@dataclass
class Query:
    now: int
    prev: int
    cost: int


N, M = map(int, input().split())
E = [[] for _ in range(N + 1)]

for e in range(M):
    a, b = map(int, input().split())
    E[a].append(b)
    E[b].append(a)

res = [-1 for _ in range(N + 1)]
cost = [float('inf') for _ in range(N + 1)]
cost[1] = 0

queue = deque()

for next in E[1]:
    queue.append(Query(next, 1, 1))

while len(queue):
    q = queue.popleft()
    if cost[q.now] > q.cost:
        res[q.now] = q.prev
        cost[q.now] = q.cost

        for next in E[q.now]:
            if cost[next] > q.cost + 1:
                queue.append(Query(next, q.now, q.cost + 1))

for r in res[2:]:
    if r == -1:
        print('No')
        exit()

print('Yes')
for r in res[2:]:
    print(r)
Buggy python submission (verdict: Runtime Error):
print(len(set([input() for _ in range(int(input()))]))

Fixed submission:
print(len(set([input() for _ in range(int(input()))])))
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd

K = int(input())

res = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            res += gcd(gcd(a, b), c)

print(res)

Fixed submission:
from math import gcd

K = int(input())

res = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            res += gcd(gcd(a, b), c)

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd

K = int(input())

res = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            res += gcd(gcd(a, b), c)

print(res)

Fixed submission:
from math import gcd

K = int(input())

res = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            res += gcd(gcd(a, b), c)

print(res)
Buggy python submission (verdict: Runtime Error):
S = input()

if len(set(list(S))) !BBA
= 1:
    print('Yes')
else:
    print('No')


Fixed submission:
S = input()

if len(set(list(S))) != 1:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))

res = float('inf')

for i in range(min(X, 1), max(X, 100) + 1):
    tmp = 0
    for x in X:
        tmp += (i - x) ** 2

    res = min(tmp, res)

print(res)

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

res = float('inf')

for i in range(-100, 101):
    tmp = 0
    for x in X:
        tmp += (i - x) ** 2

    res = min(tmp, res)

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
H, N = map(int, input().split())
M = [tuple(map(int, input().split())) for _ in range(N)]

dp = [float('inf') for _ in range(H + 1)]

dp[0] = 0

for a, b in M:
    for i in range(H+1):
        d = min(H, i + a)
        dp[d] = min(dp[d], dp[i] + b)

print(dp[H])

Fixed submission:
H, N = map(int, input().split())
M = [tuple(map(int, input().split())) for _ in range(N)]

dp = [float('inf') for _ in range(H + 1)]

dp[0] = 0

for a, b in M:
    for i in range(H+1):
        d = min(H, i + a)
        dp[d] = min(dp[d], dp[i] + b)

print(dp[H])
Buggy python submission (verdict: Runtime Error):
N, K, S = map(int, input().split())

M = 10 ** 9

res = [S for _ in range(K)]

res += [("1" if S == M else str(S+1)) for _ in range(N-K)]

print(" ".join(res))

Fixed submission:
N, K, S = map(int, input().split())

M = 10 ** 9

res = [str(S) for _ in range(K)]

res += [("1" if S == M else str(S+1)) for _ in range(N-K)]

print(" ".join(res))

Buggy python submission (verdict: Runtime Error):
N, K, S = map(int, input().split())

M = 10 ** 9

res = [S for _ in range(K)]

res += [(1 if S == M else S+1) for _ in range(N-K)]

print(" ".join(res))

Fixed submission:
N, K, S = map(int, input().split())

M = 10 ** 9

res = [str(S) for _ in range(K)]

res += [("1" if S == M else str(S+1)) for _ in range(N-K)]

print(" ".join(res))

Buggy python submission (verdict: Runtime Error):
N, K, S = map(int, input.split())

M = 10 ** 9

res = [S for _ in range(K)]

res += [(1 if S == M else S+1) for _ in range(N-K)]

print(" ".join(res))

Fixed submission:
N, K, S = map(int, input().split())

M = 10 ** 9

res = [str(S) for _ in range(K)]

res += [("1" if S == M else str(S+1)) for _ in range(N-K)]

print(" ".join(res))

Buggy python submission (verdict: Runtime Error):
N, K, S = map(int, input.split())

M = 10 ** 9

res = [S for _ in range(K)]

res += [1 if S == M else S+1 for _ in range(N-K)]

print(" ".join(res))

Fixed submission:
N, K, S = map(int, input().split())

M = 10 ** 9

res = [str(S) for _ in range(K)]

res += [("1" if S == M else str(S+1)) for _ in range(N-K)]

print(" ".join(res))