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

Fixed submission:
# ABC178D Manhattan
n = int(input())
z = []
w = []
for i in range(n):
    x,y = map(int, input().split())
    z.append(x-y)
    w.append(x+y)
    
z_ans = max(z)-min(z)
w_ans = max(w)-min(w)
print(max(z_ans,w_ans))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
X = []
Y = []
for _ in range(N):
    x,y = map(int, input().split())
    X.append(x)
    Y.append(y)
X = np.array(X)
Y = np.array(Y)
X_ = X.reshape((N,1))
Y_ = Y.reshape((N,1))
Z = np.abs(X-X_)+np.abs(Y-Y_)
z = Z.reshape((1,-1))
print(np.max(z))

Buggy submission (verdict: Runtime Error):
N = int(input())
X = []
Y = []
for _ in range(N):
    x,y = map(int, input().split())
    X.append(x)
    Y.append(y)
X = np.array(X)
Y = np.array(Y)
X_ = X.reshape((N,1))
Y_ = Y.reshape((N,1))
Z = np.abs(X-X_)+np.abs(Y-Y_)
z = Z.reshape((1,-1))
print(np.max(z))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
xy = list()
for i in range(N):
    x,y = map(int,input().split())
    xy.append([x,y])
XY = np.array(xy)

dif = np.expand_dims(XY,axis=1) - np.expand_dims(XY,axis=0)
dis = np.sum(np.abs(dif), axis=-1).astype(np.int64)


idx = np.unravel_index(np.argmax(dis),dis.shape)
print(dis[idx])

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
xy = list()
for i in range(N):
    x,y = map(int,input().split())
    xy.append([x,y])
XY = np.array(xy)

dif = np.expand_dims(XY,axis=1) - np.expand_dims(XY,axis=0)
dis = np.sum(np.abs(dif), axis=-1)


idx = np.unravel_index(np.argmax(dis),dis.shape)
#print(dif)
#print(dis)
#print(idx)
print(dis[idx])

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
xy = list()
for i in range(N):
    x,y = map(int,input().split())
    xy.append([x,y])
XY = np.array(xy)

dif = np.expand_dims(XY,axis=1) - np.expand_dims(XY,axis=0)
dis = np.sum(dif, axis=-1)


idx = np.unravel_index(np.argmax(dis),dis.shape)
#print(dis)
#print(idx)
print(dis[idx])
Problem p02630 (python)

Fixed submission:
import collections

N = int(input())
A = list(map(int, input().split()))
S = sum(A)
Q = int(input())
T = collections.Counter(A)
for i in range(Q):
    b, c = map(int, input().split())
    S += T[b]*(c-b)
    T[c] += T[b]
    T[b] = 0
    print(S)

Buggy submission (verdict: Runtime Error):


def main():
    n, *i = map(int, open(0).read().split())
    a = i[:n]　　＃数列Aのリスト
    _ = i[n]　　　＃Qのこと
    s = sum(a)　　＃数列Aの総和

    m = [0] * (10 ** 5 + 1)　　＃Aは1<A<10^5なのでラベル用リストを作成
    for x in a:　　　　　　　　　＃Aの個数をラベル化。リストmは個数を記録している
        m[x] += 1

    ans = []
    for b, c in zip(*[iter(i[n + 1:])] * 2):
        m[c] += m[b]　　　　　　＃ｃの個数にbの個数を足し算
        s += (c - b) * m[b]　　＃s:数列Aの総和に、(c-b)×(bの個数)を足し算
        m[b] = 0　　　　　　　　　＃bの個数はゼロに
        ans.append(s)　　　　　　＃リストansにSの変化を記録していく

    print("\n".join(map(str, ans)))


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

Fixed submission:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
import collections
N = int(input())

c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)

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

c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)
Problem p02683 (python)

Fixed submission:
import itertools
import numpy as np

N,M,X = map(int, input().split())
lista = [list(map(int,input().split())) for i in range(N)]

lista = np.array(lista)
judge = [X]*M
cost = 120000000000
data = [a for a in range(1,N+1)] # [1,2,3,...,N]

for i in range(1,N+1):
    j = list(itertools.combinations(data, i))
    for k in j:
        result = np.array([0]*(M+1))
        for l in k:
            result = result + lista[l-1]
        if all(result[1:]>=judge):
            if result[0]<cost:
                cost = result[0]
                m = k
c = 0

try:
    for i in m:
        c +=lista[i-1][0]
    
    print(c)
except:
    print(-1)

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np

N,M,X = map(int, input().split())
lista = [list(map(int,input().split())) for i in range(N)]

lista = np.array(lista)
judge = [X]*M
cost = 1200001
data = [a for a in range(1,N+1)] # [1,2,3,...,N]

for i in range(1,N+1):
  j = list(itertools.combinations(data, i))
  for k in j:
    result = np.array([0]*(M+1))
    for l in k:
      result = result + lista[l-1]
      if all(result[1:]>=judge):
        if reslut[0]<cost:
          cost = result[0]
          m = k
c = 0

try:
  for i in m:
    c +=lista[i-1][0]
    
  print(c)
  
except:
  print(-1)

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np

N,M,X = map(int, input().split())
lista = [list(map(int,input().split())) for i in range(N)]

lista = np.array(lista)
judge = [X]*M
cost = 1200001
data = [a for a in range(1,N+1)] # [1,2,3,...,N]

for i in range(1,N+1):
    j = list(itertools.combinations(data, i))
    for k in j:
        result = np.array([0]*(M+1))
        for l in k:
            result = result + lista[l-1]
        if all(result[1:]>=judge):
            if reslut[0]<cost:
                cost = result[0]
                m = k
c = 0

try:
    for i in m:
        c +=lista[i-1][0]
    
    print(c)
except:
Problem p02949 (python)

Fixed submission:
import sys
from collections import deque

    
def dfs(x,s):
    used = {s}
    search = deque([s])
    while search:
        ss = search.pop()
        for sss in x[ss]:
            if sss in used:
                continue
            used.add(sss)
            search.append(sss)
    return used


def bellmanford(edges):
    coins = [-float("inf")] * N
    coins[0] = 0
    for _ in range(N):
        f = True
        for u,v,c in edges:
            if coins[u] + c > coins[v]:
                coins[v] = coins[u] + c
                f = False
        if f:
            return max(0, coins[-1])
    return -1

N,M,P = map(int, input().split())
ABC = []
Adake = [[] for _ in range(N)]
Bdake = [[] for _ in range(N)]
for _ in range(M):
    A,B,C = map(int, input().split())
    ABC.append((A-1,B-1,C-P))
    Adake[A-1].append(B-1)
    Bdake[B-1].append(A-1)

U = dfs(Adake,0) & dfs(Bdake,N-1)
ABC = [(a,b,c) for (a,b,c) in ABC if a in U and b in U]

print(bellmanford(ABC))

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
N,M,P = map(int, input().split())
ABC = []
Adake = [[] for _ in range(M)]
Bdake = [[] for _ in range(M)]
for _ in range(M):
    A,B,C = map(int, input().split())
    ABC.append((A-1,B-1,C-P))
    Adake[A-1].append(B-1)
    Bdake[B-1].append(A-1)
    
def dfs(x,s):
    used = {s}
    search = deque([s])
    while search:
        ss = search.pop()
        for sss in x[ss]:
            if sss in used:
                continue
            used.add(sss)
            search.append(sss)
    return used

U = dfs(Adake,0) & dfs(Bdake,N-1)
ABC = [(a,b,c) for (a,b,c) in ABC if a in U and b in U]

dist = [-float("inf")]*N
dist[0]=0
    
for i in range(N):
    ju = True
    for a,b,c in ABC:
        if dist[a] + c > dist[b]:
            dist[b] = dist[a] + c
            ju = False
if ju:
    print(max(0,dist[-1]))
    sys.exit()
print(-1)

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
N,M,P = map(int, input().split())
ABC = []
Adake = [[] for _ in range(M)]
Bdake = [[] for _ in range(M)]
for _ in range(M):
    A,B,C = map(int, input().split())
    ABC.append((A-1,B-1,C-P))
    Adake[A-1].append(B-1)
    Bdake[B-1].append(A-1)
    
def dfs(x,s):
    used = {s}
    search = deque([s])
    while search:
        ss = search.pop()
        for sss in x[ss]:
            if sss in used:
                continue
            used.add(sss)
            search.append(sss)
    return used

U = dfs(Adake,0) & dfs(Bdake,N-1)
ABC = [(a,b,c) for (a,b,c) in ABC if a in U and b in U]

dist = [-float("inf")]*N
dist[0]=0
    
for i in range(N):
    for a,b,c in ABC:
        if dist[a] + c > dist[b]:
            dist[b] = dist[a] + c
            if i == N-1 and b == N-1:
                print(-1)
                sys.exit()
if dist[-1] == -float("inf"):
    print(-1)
elif dist[-1]<0:
    print(0)
else:
    print(dist[-1])
Problem p03061 (python)

Fixed submission:
import math
from collections import deque
N = int(input())
A = list(map(int,input().split()))

M = 0
L = deque([0])
R = deque([0])
for i in range(1,N+1):
    L.append(math.gcd(L[-1],A[i-1]))
    R.appendleft(math.gcd(R[0],A[N-i]))
for j in range(N):
    m = math.gcd(L[j],R[j+1])
    M = max(M,m)
print(M)

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

ans = 1
for i in range(N):
    g = reduce(math.gcd,A[:i]+A[i+1:])
    ans = max(ans,g)
print(ans)
Problem p03087 (python)

Fixed submission:
N,Q = map(int, input().split())
S = input()
count = [0]*N
for i in range(1,N):
    count[i] += count[i-1]
    if S[i-1:i+1] == "AC":
        count[i] += 1
for i in range(Q):
    l,r = map(int, input().split())
    print(count[r-1]-count[l-1])

Buggy submission (verdict: Runtime Error):
import itertools

N,Q = map(int, input().split())
S = input()
a = list(itertools.accumulate([i for i in S]))

for i in range(Q):
    l,r = map(int, input().split())
    b = a[r-1][l-1:]
    print(b.count('AC'))
Problem p03160 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
points = [0]*N
points[1] = abs(H[1]-H[0])
for i in range(2,N):
    points[i] = min(points[i-2]+abs(H[i-2]-H[i]), points[i-1]+abs(H[i-1]-H[i]))
print(points[-1])

Buggy submission (verdict: Runtime Error):
def step_memo(H):
    N = len(H)
    memo = ["E"]*N
    n = N-1
    def step(n):
        if n == 0:
            memo[0] = 0
            return memo[0]
        elif n == 1:
            memo[1] = abs(H[1]-H[0])
            return memo[1]
        elif memo[n] != "E":
            return memo[n]
        else:
            memo[n]= min(step(n-2)+abs(H[n-2]-H[n]), step(n-1)+abs(H[n-1]-H[n]))
            return memo[n]
    return step(n)

N = int(input())
H = list(map(int, input().split()))
print(step_memo(H))

Buggy submission (verdict: Runtime Error):
def step_memo(H):
    N = len(H)
    memo = [0]*N
    n = N-1
    def step(n):
        if n == 0:
            return 0
        elif n == 1:
            memo[1] = abs(H[1]-H[0])
            return memo[1]
        elif memo[n] != 0:
            return memo[n]
        else:
            memo[n]= min(step(n-2)+abs(H[n-2]-H[n]), step(n-1)+abs(H[n-1]-H[n]))
            return memo[n]
    return step(n)

S = int(input())
T = list(map(int, input().split()))
print(step_memo(T))

Buggy submission (verdict: Runtime Error):
def step_memo(H):
    N = len(H)
    memo = [0]*N
    n = N-1
    def step(n):
        if n == 0:
            return 0
        elif n == 1:
            memo[1] = abs(H[1]-H[0])
            return memo[1]
        elif memo[n] != 0:
            return memo[n]
        else:
            memo[n]= min(step(n-2)+abs(H[n-2]-H[n]), step(n-1)+abs(H[n-1]-H[n]))
            return memo[n]
    return step(n)

N = int(input())
H = list(map(int, input().split()))
print(step_memo(H))
Problem p03212 (python)

Fixed submission:
N = input()

def dfs(A):
    if int(A) > int(N):
        return 0
    if all(A.count(c) for c in "753") >0:
        ans = 1
    else:
        ans = 0
        
    for i in "357":
        A += i
        ans += dfs(A)
        A = A[:-1]
        
    return ans

print(dfs("0"))

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

if n_int<357:
  print(0)
else:
  counter__ = 0
  for k in range(3 ,len(n)+1):
    counter__ += recursive_f([])
    def recursive_f(A):
      if len(A) == k:
        A_ = int("".join(map(str,A)))
        counter = 0
        if len(set(A)) == 3 and A_ <= n_int:
          counter += 1
        return counter
      counter_ = 0
      for i in [3,5,7]:
        A.append(i)
        counter_ += recursive_f(A)
        A.pop()
      return counter_
        
print(counter__)

Buggy submission (verdict: Runtime Error):
n=input()           #  str 575
n_int = int(n)    #  int 575

if n_int<357:
    print(0)
else:
    counter__ = 0
    for k in range(3 ,len(n)+1):
        counter__ += recursive_f([])

        def recursive_f(A):
            if len(A) == k:     # Aはリスト[7,7,7]
                A_ = int("".join(map(str,A)))    # A_はint 777
                counter = 0
                # print(A_)
                if len(set(A)) == 3 and A_ <= n_int:
                    counter += 1
                return counter

            counter_ = 0

            for i in [3,5,7]:
                A.append(i)
                counter_ += recursive_f(A)
                A.pop()

            return counter_
        
print(counter__)

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

if n_int<357:
  print(0)
else:
  counter__ = 0
  for k in range(3 ,len(n)+1):
    counter__ += recursive_f([])

    def recursive_f(A):
      if len(A) == k:     # Aはリスト[7,7,7]
        A_ = int("".join(map(str,A)))    # A_はint 777
        counter = 0
        # print(A_)
        if len(set(A)) == 3 and A_ <= n_int:
          counter += 1
          return counter

        counter_ = 0

        for i in [3,5,7]:
          A.append(i)
          counter_ += recursive_f(A)
          A.pop()

          return counter_
        
print(counter__)
Problem p03244 (python)

Fixed submission:
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
a = Counter(v[::2]).most_common()
b = Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])

if a[0][0]!=b[0][0]:
    print(n-a[0][1]-b[0][1])
else:
    print(min(n-a[1][1]-b[0][1],n-a[0][1]-b[1][1]))

Buggy submission (verdict: Runtime Error):
n = int(input())
v = list(map(int, input().split()))
a = sorted(([i,v[::2].count(i)] for i in set(v[::2])), key=lambda x:x[1])
b = sorted(([j,v[1::2].count(j)] for j in set(v[1::2])),key=lambda x:x[1])
if a[-1]!=b[-1]:
    print(n-a[-1][1]-b[-1][1])
elif len(a) == 1 and len(b) == 1:
    print(min(a[-1][1],b[-1][1]))
elif len(a) ==1:
    print(n-a[-1][1]-b[-2][1])
elif len(b) ==1:
    print(n-a[-2][1]-b[-1][1])
else:
    print(min(n-a[-2][1]-b[-1][1],n-a[-1][1]-b[-2][1])
Problem p03262 (python)

Fixed submission:
import bisect
import math
from functools import reduce

def gcd(A):
    return reduce(math.gcd, A)

N,X = map(int, input().split())
x = sorted(map(int, input().split()))
bisect.insort(x,X)
ans = [x[i+1]-x[i] for i in range(N)] 
if N ==1:
    print(x[1]-x[0])
else:
    print(gcd(ans))

Buggy submission (verdict: Runtime Error):
from functols import reduce
from fractions import gcd
N,X = map(int, input().split())
x =[abs(X-int(i)) for i in input().split()]
print(reduce(gcd,x))
Problem p03309 (python)

Fixed submission:
import statistics
N = int(input())
A = [int(a)-i-1 for i,a in enumerate(input().split(),1)]
b = statistics.median_low(A)
c = statistics.median_high(A)
d = sum(map(lambda x:abs(x-b),A))
e = sum(map(lambda x:abs(x-c),A))
print(min(d,e))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(a)-i-1 for i,a in enumerate(input().split(),1)]
A.sort()
b = int(sum(a)/len(a))
c = 10**9
for j in range(b-10, b+11):
    k = sum(map(lambda x:abs(x-j), A))
    c = min(c,k)
print(c)
Problem p03386 (python)

Fixed submission:
A,B,K = map(int, input().split())
if B - A + 1> 2*K:
    a = list(range(A, A+K))
    b = list(range(B-K+1,B+1))
    c = sorted(set(a+b))
    print(*c, sep="\n")
else:
    print(*range(A,B+1), sep="\n")

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

if B-A+1<= 2*K:
    print(*range(A,B+1), sep="\n")
else:
    a = list(range(A,A+K))
    b = list(range(B-K+1,B+1))
    C = set(a,b)
    print(*C, sep="\n")

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

if B-A+1<= 2*K:
    print(*range(A,B+1), sep="\n")
else:
    a = list(range(A,A+K))
    b = list(range(B-K+1,B+1))
    C = set(a,b)
    print(*C, sep="\n")
Problem p03457 (python)

Fixed submission:
n = int(input())
t_ = 0
xy_ = [0,0]
for _ in range(n):
    t, *xy = map(int, input().split())
    ta = t - t_
    xya = [abs(xy[0]-xy_[0]), abs(xy[1]-xy_[1])]
    if sum(xya) > ta or (ta - sum(xya))%2 != 0:
        print("No")
        break
    t_ = t
    xy_ = xy
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
he = input()
lista = []
counter1, counter2 = 0,0

while True:
    inp = tuple(map(int,input().split()))
    if not inp:
        break
    counter1 += 1
    print(inp)
    
    if (abs(inp[1])+abs(inp[2])) in range(inp[0], 0, -2):
        counter2 += 1
    else:
        break

if counter1 == counter2:
    print('Yes')
else:
    print('No')

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

lista = []
while True:
    inpy = tuple(map(int, input().split()))
    if inpy:
        lista.append(inpy)
    else:
        break

counter = 0
for challenge in range(len(lista)):
    inp = lista[challenge]
   
    if sum(inp[1:]) <= inp[0] and sum(inp[1:]) >= -inp[0]:
        if inp[0] % 2 == 0 and sum(inp[1:]) % 2 ==0:
            counter += 1
            # print('Yes')
        elif inp[0] % 2 != 0 and sum(inp[1:]) % 2 != 0:
            counter += 1
            # print('Yes')
        else:
            pass
            # print('No')
    else:
        pass
        # print('No')

if counter == len(lista):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
he = input()
lista = []
counter1, counter2 = 0,0

while True:
    inp = tuple(map(int,input().split()))
    if not inp:
        break
    counter1 += 1
    print(inp)
    if (inp[1]+inp[2]+inp[0]) % 2 == 0: 
        counter2 += 1
    else:
        break

if counter1 == counter2:
    print('Yes')
else:
    print('No')

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

lista = []
while True:
    inpy = tuple(map(int, input().split()))
    if inpy:
        lista.append(inpy)
    else:
        break

counter = 0
for challenge in range(len(lista)):
    inp = lista[challenge]
   
    if sum(inp[1:]) <= inp[0] and sum(inp[1:]) >= -inp[0]:
        if inp[0] % 2 == 0 and sum(inp[1:]) % 2 ==0:
            counter += 1
            # print('Yes')
        elif inp[0] % 2 != 0 and sum(inp[1:]) % 2 != 0:
            counter += 1
            # print('Yes')
        else:
            pass
            # print('No')
    else:
        pass
        # print('No')

if counter == 2:
    print('Yes')
else:
    print('No')
Problem p03565 (python)

Fixed submission:
S = input()
s = len(S)
T = input()
t = len(T)

key = 0
for i in range(s-t,-1,-1):
    for j,k in enumerate(S[i:i+t]):
        if k == T[j] or k =="?":
            pass
        else:
            break
    else:
        key = i
        break
    key = 100
if key == 100 or s<t:
    print("UNRESTORABLE")
else:
    ans = S[0:i]+T+S[i+t:]
    ans = ans.replace("?","a")
    print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
s = len(S)
T = input()
t = len(T)
key = 0
for i in range(0,s-t+1):
    for j,k in enumerate(S[i:i+t]):
        if k == T[j] or k =="?":
            pass
        else:
            break
    else:
        key = i
        break
    key = 100
if key == 100:
    print("UNRESTORABLE")
else:
    ans = S[0:i]+T+S[i+t:]
    ans = ans.replace("?","a")
    print(ans)
Problem p03722 (python)

Fixed submission:
import sys
N,M = map(int, input().split())
abc = [[] for _ in range(N)]
for i in range(M):
    a,b,c = map(int, input().split())
    abc[a-1].append((b-1,c))
    
S = [-float("inf")]*N
S[0] = 0
T = [0]
m = 0
n = 0
j = False
while T:
    t = T.pop(0)
    m += 1
    for tb,tc in abc[t]:
        if S[tb] < S[t]+tc:
            S[tb] = S[t]+tc
            T.append(tb)
    if m > M+1:
        d = abc[tb]
        if N-1 in list(d[i][0] for i in range(len(d))):
            j = True
        n += 1
    if n > M:
        if j:
            print("inf")
            sys.exit()
        else:
            break

print(S[-1])

Buggy submission (verdict: Runtime Error):
#ABC061D
from collections import deque
N,M = map(int,input().split())

ABC = []
Adake = [[] for _ in range(M)]
Bdake = [[] for _ in range(M)]
for i in range(M):
    a,b,c = map(int, input().split())
    ABC.append((a-1,b-1,-c))
    Adake[a-1].append(b-1)
    Bdake[b-1].append(a-1)

def dfs(X,s):
    used = {s}
    search = deque([s])
    while search:
        ss = search.pop()
        for sss in X[ss]:
            if sss in used:
                continue
            used.add(sss)
            search.append(sss)
    return used

U = dfs(Adake,0) & dfs(Bdake,N-1)
ABC = [(a,b,c) for (a,b,c) in ABC if a in U and b in U]

INF = float('inf')
dist = [INF] * N
dist[0] = 0
for i in range(N):
    for a,b,c in ABC:
        if dist[b] > dist[a] + c:
            dist[b] = dist[a] + c
            if i==N-1 and b == N-1:
                print('inf')
                exit()
print(-dist[-1])
Problem p04044 (python)

Fixed submission:
N, L = map(int, input().split())
lists = []
for i in range(N):
    lists.append(input())

lists.sort()
print(''.join(lists))

Buggy submission (verdict: Runtime Error):
L, N = map(int, input().split())
lists = []
for i in range(N):
    lists.append(input())
print(''.join(sorted(lists)))

Buggy submission (verdict: Runtime Error):
L,N = map(int, input().split())
list=[]
for i in range(N):
  list.append(input())

print(''.join(sorted(list))
Problem p02742 (python)

Fixed submission:
a = [int(c) for c in input().split()]
r = a[0]*a[1]
if a[0] == 1 or a[1] == 1:
    print(1)
elif r % 2 == 0:
    print(int(r/2))
else:
    print(int(r/2+1))

Buggy submission (verdict: Runtime Error):
a = [int(c) for c in input().split()]
r = a[0]*a[1]
if a[0] == 1 or a[1] == 1:
    print(1)
else r % 2 == 0:
    print(int(r/2))
else:
    print(int(r/2+1))
Problem p03048 (python)

Fixed submission:
import sys
import copy
import math
import itertools
import numpy as np
import re

R,G,B,N = [int(c) for c in input().split()]
cnt = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if r*R+g*G <= N and (N-r*R-g*G)%B == 0:
            cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import sys
import copy
import math
import itertools
import numpy as np
import re

R,G,B,N = [int(c) for c in input().split()]
cnt = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if r*R+g*G <= N and (N-r*R-g*G)%B == 0:
            cnt += 1
print(cnt)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
# ABC169
# C Multiplication 3
A, B = map(str, input().split())
A = int(A)
B = int(B[0]+B[2]+B[3])
x = A * B
x = x // 100
print(int(x))
Problem p02700 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
while True:
    if (c - b) <= 0:
        print("Yes")
        exit()
    else:
        c = c - b
        if a - d <= 0:
            print("No")
            exit()
        else:
            a = a - d

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
while True:
    if (c - b) <= 0:
        print("Yes")
        exit()
    else:
        c = c - d
        if a - d <= 0:
            print("No")
            exit()
        else:
            a = a -