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

Fixed submission:
from fractions import gcd

A,B = [int(zz) for zz in input().split()]

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

x = gcd(A,B)

print(len(set(prime_factorize(x)))+1)

Buggy submission (verdict: Runtime Error):
from math import gcd
from collections import Counter

A,B = [int(zz) for zz in input().split()]

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

x = gcd(A,B)

print(len(set(prime_factorize(x)))+1)
Problem p02953 (python)

Fixed submission:
N = int(input())
H = [int(zz) for zz in input().split()][::-1]
p = H[0]

for i in range(N):
    if H[i] > p:
        H[i] -= 1
        if H[i] > p:
            print('No')
            exit()
    p = H[i]

print('Yes')

Buggy submission (verdict: Runtime Error):
-- [Char]あるいは String を Int にする
toInt :: (String -> Int)
toInt x = read x ::Int

--入力を受け取り、[Int]にする
getInts = do
  x <- getLine
  let y = (map$toInt)$words x -- 半角スペースで分割してInt にする
  return y

main = do
  _ <- getInts
  x <- getInts

  if ok x 0 == 1
    then putStrLn "Yes"
    else putStrLn "No"
  where
    ok x n =
      if null x
        then 1
        else if head x >= n
          then ok (tail x) $ max n $ (head x) - 1
          else 0
Problem p02973 (python)

Fixed submission:
from bisect import bisect_left
from collections import deque
import sys
input = sys.stdin.readline

N = int(input())
A = [int(input()) for _ in range(N)]

q = deque([A[0]])
for i in range(1,N):
    insert_index = bisect_left(q,A[i])
    if insert_index == 0:
        q.appendleft(A[i])
    else:
        q[insert_index-1] = A[i]

print(len(q))

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
from collections import deque
import sys
input = sys.stdin.readline

N = int(input())
A = [int(input()) for _ in range(N)]

q = deque([A[0]])
for i in range(1,N):
    insert_index = bisect_left(q,A[i])
    if insert_index == 0:
        q.insert(0, A[i])
    else:
        q[insert_index-1] = A[i]

print(len(q))
Problem p02985 (python)

Fixed submission:
from collections import deque
import sys
input = sys.stdin.readline
MOD = 10**9+7

N,K = [int(zz) for zz in input().split()]
A = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = [int(zz)-1 for zz in input().split()]
    A[a].append(b)
    A[b].append(a)

dq = deque([0])
ans = K
check = [True]*N
check[0] = False
while dq:
    p = dq.popleft()
    if p == 0:
        cand = K-1
    else:
        cand = K-2
    for i in A[p]:
        if check[i]:
            check[i] = False
            ans = (ans*cand)%MOD
            cand -= 1
            dq.append(i)

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
import math

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

N,K = [int(zz) for zz in input().split()]
A = [[] for _ in range(N)]
B = [0]*N

for _ in range(N-1):
    a,b = [int(zz)-1 for zz in input().split()]
    A[a].append(b)
    A[b].append(a)
    B[a] += 1
    B[b] += 1

dq = deque([0])
check = [True]*N
check[0] = False
ans = K
tmp = 1
while dq:
    p = dq.pop()
    count = 0
    btmp = 0
    for i in A[p]:
        if check[i]:
            check[i] = False
            count += 1
            dq.append(i)
        else:
            btmp += 1

    if K-tmp-btmp > 0:
        ans *= permutations_count(K-tmp-btmp,count)
print(ans%(10**9+7))
Problem p02995 (python)

Fixed submission:
A,B,C,D = [int(i) for i in input().split()]

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

def lcm(a,b):
    return a*b//gcd(a,b)

E = lcm(C,D)

p = B-A+1

ac = p//C
if A%C+p%C >= C+1:
    ac += 1

ad = p//D
if A%D+p%D >= D+1:
    ad += 1

ae = p//E
if A%E+p%E >= E+1:
    ae += 1

print(p-(ac+ad-ae))

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

def lcm(a,b):
    return a*b//gcd(a,b)

A,B,C,D = [int(zz) for zz in input().split()]

bc = B//C
ac = (A-1)//C
bd = B//D
ad = (A-1)//D
bcd = B//lcm(C,D)
acd = (A-1)//lcm(C,D)

print(B-A-bc+ac-bd+ad+bcd-acd+1)
Problem p03007 (python)

Fixed submission:
from collections import deque

N = int(input())
A = [int(i) for i in input().split()]
p = deque()
m = deque()

A.sort(reverse=True)
for i in A:
    if i > 0:
        p.append(i)
    else:
        m.append(i)

ans = []
for _ in range(N-2):
    if p and m:
        if len(p) < len(m):
            tt = p.popleft()
            zz = m.pop()
            p.appendleft(tt-zz)
            ans.append([tt,zz])
        else:
            tt = m.pop()
            zz = p.popleft()
            m.append(tt-zz)
            ans.append([tt,zz])
    elif p:
        tt = p.pop()
        zz = p.popleft()
        m.append(tt-zz)
        ans.append([tt,zz])

    else:
        tt = m.popleft()
        zz = m.pop()
        p.append(tt-zz)
        ans.append([tt,zz])

if p and m:
    tt = p.pop()
    zz = m.pop()
    ans.append([tt,zz])
    print(tt-zz)

elif p:
    tt = p.popleft()
    zz = p.pop()
    ans.append([tt,zz])
    print(tt-zz)

else:
    tt = m.popleft()
    zz = m.pop()
    ans.append([tt,zz])
    print(tt-zz)

for i in range(N-1):
    tt,zz = ans[i]
    print(tt,zz)

Buggy submission (verdict: Runtime Error):
from collections import deque

N = int(input())
A = [int(i) for i in input().split()]
p = deque()
m = deque()

A.sort(reverse=True)
for i in A:
    if i > 0:
        p.append(i)
    else:
        m.append(i)

ans = []
for _ in range(N-2):
    if p and m:
        if len(p) < len(m):
            tt = p.popleft()
            zz = m.pop()
            p.appendleft(tt-zz)
            ans.append([tt,zz])
        else:
            tt = m.pop()
            zz = p.popleft()
            m.append(tt-zz)
            ans.append([tt,zz])
    elif p:
        tt = p.pop()
        zz = p.popleft()
        m.append(tt-zz)
        ans.append([tt,zz])

    else:
        tt = m.popleft()
        zz = m.pop()
        p.append(tt-zz)
        ans.append([tt,zz])

if p and m:
    tt = p.pop()
    zz = m.pop()
    ans.append([tt,zz])
    print(tt-zz)
else:
    tt = p.popleft()
    zz = p.pop()
    ans.append([tt,zz])
    print(tt-zz)

for i in range(N-1):
    tt,zz = ans[i]
    print(tt,zz)
Problem p03087 (python)

Fixed submission:
import itertools
N,Q = [int(i) for i in input().split()]
S = list(input())

li = [0]*N
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        li[i+1] = 1
ans = list(itertools.accumulate(li))
k = []
for j in range(Q):
    a,b = [int(i) for i in input().split()]
    k.append(ans[b-1]-ans[a-1])

[print(i) for i in k]

Buggy submission (verdict: Runtime Error):
N,Q = [int(i) for i in input().split()]
S = list(input())


q = [input().split() for _ in range(Q)]

li = []
for a,b in q:
    flag = 0
    for i in range(a,b):
        if S[i] == 'A':
            flag = 1
        if S[i] == 'C' and flag:
            li.append(i)

[print(i) for i in li]

Buggy submission (verdict: Runtime Error):
import sys.stdin.readline
input = readline

N,Q = [int(i) for i in input().split()]
S = input()

ans = []
for _ in range(Q):
    a,b = [int(i) for i in input().split()]
    ans.append(S[a-1:b].count('AC'))

[print(i) for i in ans]
Problem p03140 (python)

Fixed submission:
n = int(input())
a = list(input())
b = list(input())
c = list(input())
ans = 0
for i in range(n):
    k = [a[i], b[i], c[i]]
    ans += len(set(k))-1

print(ans)

Buggy submission (verdict: Runtime Error):
from statistics import mode
n = int(input())
a = list(input())
b = list(input())
c = list(input())
ans = 0
for i in range(n):
    k = [a[i], b[i], c[i]]
    if len(set(k)) != 3:
        flag = mode(k)
        ans += 3-k.count(flag)
    else:
        ans += 2

print(ans)
Problem p03163 (python)

Fixed submission:
n,k = [int(i) for i in input().split()]
w = []
v = []
for _ in range(n):
    a,b = [int(i) for i in input().split()]
    w.append(a)
    v.append(b)

dp = [[0 for _ in range(k+1)] for _ in range(n+1)]

for i in range(n):
    for j in range(k+1):
        if j >= w[i]:
            dp[i+1][j] = max(dp[i][j-w[i]]+v[i], dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]
print(dp[-1][-1])

Buggy submission (verdict: Runtime Error):
import random
import copy

def get_population():
    population = []
    for i in range(individual_length):
        population.append([random.randint(0,1) for j in range(gene_length)])
    return population

def evaluate(pop):
    pop.sort(reverse=True)
    return pop

def two_point_crossover(parent1, parent2):
    r1 = random.randint(0, gene_length-1)
    r2 = random.randint(r1, gene_length-1)
    child = copy.deepcopy(parent1)
    child[r1:r2] = parent2[r1:r2]
    return child

def mutate(parent):
    r = random.randint(0, gene_length-1)
    child = copy.deepcopy(parent)
    child[r] = 1 if child[r]==0 else 0
    return child

def fitness(pop):
    value = 0
    weoght = 0
    for i in range(N):
        if pop[i]:
            value += L[i][1]
            weoght += L[i][0]
    if weoght <= W:
        return value
    else:
        return 0

N,W = [int(zz) for zz in input().split()]
L = [[0,0] for _ in range(N)]

for i in range(N):
    p,q = [int(zz) for zz in input().split()]
    L[i][0] = p
    L[i][1] = q

gene_length = N # 遺伝子長
individual_length = 30 # 個体数
generation = 1000 # 世代数
elite_rate = 0.2 # エリート選択の割合

pop = evaluate([(fitness(p), p) for p in get_population()])

for i_episode in range(generation):

    eva = evaluate(pop)
    elites = eva[:int(len(pop)*elite_rate)]

    pop = elites
    while len(pop) < individual_length:
        if random.random() < mutate_rate:
            m = random.randint(0, len(elites)-1)
            child = mutate(elites[m][1])
        else:
            m1 = random.randint(0, len(elites)-1)
            m2 = random.randint(0, len(elites)-1)
            child = two_point_crossover(elites[m1][1], elites[m2][1])
        pop.append((fitness(child), child))

eva = evaluate(pop)
print(pop[0][0])

Buggy submission (verdict: Runtime Error):
import numpy as np
n,w = map(int, input().split())

items = list(map(int, input().split()) for _ in range(n))
dp = np.zeros(w+1, dtype='int32')

for weight, value in items:
    dp[weight:] = np.maximum(dp[weight:], dp[:w-weight+1] + value)
print(dp.max())
Problem p03262 (python)

Fixed submission:
N,X = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]

if N == 1:
    print(abs(L[0]-X))
else:
    P = [0]*N
    P[0] = abs(min(L) - X)
    for i in range(1,N):
        P[i] = abs(L[i]-L[i-1])

    def gcd( x, y ):
        while y != 0:
            x, y = y, x%y
        return x

    ans = gcd(P[0],P[1])

    for i in range(2,N):
        ans = gcd(ans,P[i])

    print(ans)

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

P = [0]*N
P[0] = abs(min(L) - X)
for i in range(1,N):
    P[i] = abs(L[i]-L[i-1])

def gcd( x, y ):
    while y != 0:
        x, y = y, x%y
    return x

ans = gcd(P[0],P[1])

for i in range(2,N):
    ans = gcd(ans,P[i])

print(ans)
Problem p03273 (python)

Fixed submission:
H,W = [int(zz) for zz in input().split()]
L = [list(input()) for _ in range(H)]

p = ['.']*W
while p in L:
    L.remove(p)
    H -= 1

L2 = [[0]*H for _ in range(W)]
for h in range(H):
    for w in range(W):
        L2[w][h] = L[h][w]


q = ['.']*H
while q in L2:
    L2.remove(q)
    W -= 1

ans = [[0]*W for _ in range(H)]
for h in range(H):
    for w in range(W):
        print(L2[w][h], end="")
    print()

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

l = [[]for _ in range(a)]
m = [[]for _ in range(b)]

for i in range(a):
    l[i] = list(input())
    for j in range(b):
        m[j].append(l[i][j])

p = []
for i in range(a):
    if l[i].count('.') == b:
        p.append(i)

q = []
for i in range(b):
    if m[i].count('.') == a:
        q.append(i)

count=0
for i in p:
    l.pop(i-count)
    count+=1

count=0
for i in q:
    for j in range(len(l)):
        l[j].pop(i-count)
        count+=1

for i in range(len(l)):
    for j in l[i]:
        print(j,end='')
    print()
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

p = 0
for i in s:
    if p == k-1:
        print(i)
        exit()
    if i != '1':
        print(i)
        exit()
    p += 1
print(i)

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

if K == 1:
    print(S[0])
    exit()
else:
    for i in range(K):
        if S[i] != '1':
            print(S{i})
            exit()
print(1)
Problem p03296 (python)

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
count=0

for i in range(n-1):
    if li[i] == li[i+1]:
        li[i+1] = 0
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split()))
count=0

for i in range(n-1):
    if li[i] == li[i+1]:
        li[i+1] = li[i]*li[i+2]+1
        count += 1

print(count)
Problem p03436 (python)

Fixed submission:
from collections import deque
import numpy as np

H,W = [int(i) for i in input().split()]
l = [list(input()) for _ in range(H)]
check = [[False]*W for _ in range(H)]
ans = [[0]*W for _ in range(H)]

q = deque()
q.append([0,0])
check[0][0] = True

while q:
    i,j = q.popleft()
    for next_i, next_j in [[i+1,j], [i-1,j], [i,j+1], [i,j-1]]:
        if 0 <= next_i < H and 0 <= next_j < W:
            if not check[next_i][next_j] and l[next_i][next_j] != '#':
                q.append([next_i,next_j])
                check[next_i][next_j] = True
                ans[next_i][next_j] = ans[i][j]+1

cnt = 0
for i in range(H):
    for j in range(W):
        if l[i][j] == '.':
            cnt += 1

if ans[H-1][W-1]:
    print(cnt-ans[H-1][W-1]-1)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
from collections import deque
import numpy as np

H,W = [int(zz) for zz in input().split()]
map = [['#']*(W+2) for _ in range(H+2)]

ans = 0
for i in range(1,H+1):
    tmp = input()
    s = list('#'+tmp+'#')
    map[i] = s
    ans += tmp.count('#')

check = [[1]*(W+2) for _ in range(H+2)]
count = [[0]*(W+2) for _ in range(H+2)]
q = deque([(1,1)])
check[1][1] = 0
while q:
    x,y = q.popleft()
    for i,j in [(1,0),(0,1),(-1,0),(0,-1)]:
        if check[x+i][y+j] and map[x+i][y+j] == '.':
            check[x+i][y+j] = 0
            q.append((x+i,y+j))
            count[x+i][y+j] = count[x][y]+1
zz = count[H][W]
if zz == 0:
    print(-1)
else:
    count = set((np.array(count)).flatten())
    for i in count:
        if i > zz:
            ans -= 1
    print(H*W-len(count)-ans)
Problem p03476 (python)

Fixed submission:
import math
from itertools import accumulate


def is_prime(n):
    if n == 1:
        return 0

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return 0

    return 1


Q = int(input())
L = [0]*Q
R = [0]*Q

for i in range(Q):
    L[i], R[i] = list(map(int, input().split()))

min_L = min(L)
max_R = max(R)

check = []
for i in range(min_L, max_R+1):
    if (i % 2 == 1):
        flg = (is_prime(i) and is_prime((i+1)/2))
    else:
        flg = 0
    check.append(flg)

# 累積和
check = [0] + check
check = list(accumulate(check))

for i in range(Q):
    print(check[R[i] - min_L + 1] - check[L[i] - min_L])

Buggy submission (verdict: Runtime Error):
import math
from itertools import accumulate

def is_prime(n):
    if n == 1: return 0

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return 0
    return 1

Q = int(input())
L = [0]*Q
R = [0]*Q

for j in range(Q):
    L[j],R[j] = [int(i) for i in input().split()]

li = []
for i in range(min(L),max(R)+1,1):
    if i%2 == 1:
        li.append(is_prime(i) * is_prime((i+1)//2))
    else:
        li.append(0)

ans = [0]
ans += list(itertools.accumulate(li))

for i,j in zip(L,R):
    print(ans[j-min(L)+1] - ans[i-min(L)])
Problem p03698 (python)

Fixed submission:
s = list(input())

if len(s) == len(set(s)):
    print('yes')
else:
    print('no')

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

if len(s) == len(set(s)):
    print('yes')
else:
    print('no')
Problem p03998 (python)

Fixed submission:
from collections import deque

A = deque(list(input()))
B = deque(list(input()))
C = deque(list(input()))

tmp = A.popleft()
while True:
    if tmp == 'a':
        if len(A) == 0:
            print('A')
            break
        else:
            tmp = A.popleft()

    elif tmp == 'b':
        if len(B) == 0:
            print('B')
            break
        else:
            tmp = B.popleft()

    else:
        if len(C) == 0:
            print('C')
            break
        else:
            tmp = C.popleft()

Buggy submission (verdict: Runtime Error):
A = list(input())
B = list(input())
C = list(input())

for _ in range(A.count('a')):
    A.remove('a')

for _ in range(B.count('b')):
    B.remove('b')

for _ in range(C.count('c')):
    C.remove('c')

tmp = A.pop()
while True:
    if tmp == 'a':
        if len(A) == 0:
            print('A')
            exit()
        else:
            tmp = A.pop()

    if tmp == 'b':
        if len(B) == 0:
            print('B')
            exit()
        else:
            tmp = B.pop()

    if tmp == 'c':
        if len(C) == 0:
            print('C')
            exit()
        else:
            tmp = C.pop()
Problem p03424 (python)

Fixed submission:
n = int(input())
lis = input().split()
for i in range(n):
  if lis[i] == 'Y':
    print('Four')
    break
  else:
    if i == n-1:
    	print('Three')

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = input().split()
count = 0
for i in range(n):
  if lis[i] == 'Y':
    print('Four')
    break
  else:
    if(count == n-1)
    print('Three')
    count++

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = input().split()
for i in range(n):
  if lis[i] == 'Y':
    print('Four')
    break
  else:
    if i == n-1
    print('Three')
Problem p03497 (python)

Fixed submission:
lis = list(map(int, input().split()))
lis2 = input().split()
n = lis[0]
k = lis[1]
d = {}

for i in range(n):
    if lis2[i] not in d.keys():
       d[lis2[i]] = 1
    else:
        d[lis2[i]] += 1 
        
if len(list(d.values())) <= k:
    print(0)
else:
    a = list(d.values())
    a.sort()
    a.reverse()
    swap = 0
    for i in range(k,len(a)):
        swap += a[i]
    print(swap)

Buggy submission (verdict: Runtime Error):
lis = list(map(int, input().split()))
lis2 = list(map(int, input().split()))
n = lis[0]
k = lis[1]
d = {}

for i in range(n):
    if lis2[i] not in d.keys():
       d[lis2[i]] = 1
    else:
        d[lis2[i]] += 1 
        
if len(b) <= k:
    print(0)
else:
    a = list(d.values())
    a.sort()
    a.reverse()
    swap = 0
    for i in range(k,len(a)):
        swap += a[i]
    print(swap)

Buggy submission (verdict: Runtime Error):
lis2 = list(map(int, input().split()))
n = lis[0]
k = lis[1]
d = {}

for i in range(n):
    if lis2[i] not in d.keys():
       d[lis2[i]] = 1
    else:
        d[lis2[i]] += 1 
        
if len(b) <= k:
    print(0)
else:
    a = d.values()
    a.sort()
    a.reverse()
    swap = 0
    for i in range(k,len(a)):
        swap += a[i]
    print(swap)

Buggy submission (verdict: Runtime Error):
lis = list(map(int, input().split()))
lis2 = list(map(int, input().split()))
n = lis[0]
k = lis[1]
a = []
b = []
for i in range(n):
    if lis2[i] not in a:
        a.append(lis2[i])
        count = 0
        for j in range(i+1,n):
            if lis2[j] == lis2[i]:
                count += 1
        b.append(count)

if len(b) <= k:
    print(0)
else:
    b.sort()
    b.reserve()
    swap = 0
    for i in range(k,len(b)):
        swap += b[i]
    print(swap)

Buggy submission (verdict: Runtime Error):
lis = list(map(int, input().split()))
lis2 = list(map(int, input().split()))
n = lis[0]
k = lis[1]
a = []
b = []
for i in range(n):
    if lis2[i] not in a:
        a.append(lis2[i])
        count = 0
        for j in range(i+1,n):
            if lis[j] == lis[i]:
                count += 1
        b.append(count)

if len(b) <= k:
    print(0)
else:
    b.sort()
    b.reserve()
    swap = 0
    for i in range(k,len(b)):
        swap += b[i]
    print(swap)

Buggy submission (verdict: Runtime Error):
lis = list(map(int, input().split()))
lis2 = list(map(int, input().split()))
n = lis[0]
k = lis[1]
a = []
b = []
for i in range(n):
    if lis2[i] not in a
        a.append(lis2[i])
        count = 0
        for j in range(i+1,n)
            if lis[j] == lis[i]
                count += 1
        b.append(count)

if len(b) <= k
    print(0)
else:
    b.sort()
    b.reserve()
    swap = 0
    for i in range(k,len(b))
        swap += b[i]
    print(swap)

Buggy submission (verdict: Runtime Error):
lis = list(map(int, input().split()))
n = lis[0]
k = lis[1]
a = []
b = []
for i in range(n):
	if lis[i] not in a
		a.append(lis[i])
		count = 0
		for j in range(i+1,n)
			if lis[j] == lis[i]
				count += 1
		b.append(count)
if len(b) <= k
	print(0)
else:
	b.sort()
	b.reserve()
	swap = 0
	for i in range(k,len(b))
		swap += b[i]
	print(swap)
Problem p03836 (python)

Fixed submission:
lis = list(map(int, input().split()))
a=lis[0]
b=lis[1]
c=lis[2]
d=lis[3]
x=c-a
y=d-b
 
for i in range(x):
    print('R', end='')
for i in range(y):
    print('U', end='')
for i in range(x):
    print('L', end='')
for i in range(y+1):
    print('D', end='')
for i in range(x+1):
    print('R', end='')
for i in range(y+1):
    print('U', end='')
print('L', end='')
print('U', end='')
for i in range(x+1):
    print('L', end='')
for i in range(y+1):
    print('D', end='')
print('R',end='')

Buggy submission (verdict: Runtime Error):
lis = list(map(int, input().split()))
a=lis[0], b=lis[1], c=lis[2], d=lis[3]
x=c-a, y=d-b

for i in range(x):
    print('R', end='')
for i in range(y):
    print('U', end='')
for i in range(x):
    print('L', end='')
for i in range(y+1):
    print('D', end='')
for i in range(x+1):
    print('R', end='')
for i in range(y+2):
    print('U', end='')
for i in range(x+2):
    print('L', end='')
for i in range(y+1):
    print('D', end='')
print('R',end='')
Problem p02628 (python)

Fixed submission:
N, K = map(int, input().split(" "))
p = list(map(int, input().split(" ")))
 
p.sort()
print(sum(p[:K]))

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

sort(p)
print(sum(p[:K]))
Problem p02639 (python)

Fixed submission:
x = list(map(int, input().split(" ")))
ans = 0
for i in range(5):
	if x[i] == 0:
		ans = i + 1
        
print(ans)

Buggy submission (verdict: Runtime Error):
x = list(map(int, input().split(" ")))
ans = 0
for i in range(5):
	if x[i] == 0:
    	ans = i + 1
        
print(ans)
Problem p03076 (python)

Fixed submission:
dish = []
for i in range(5):
    dish.append(int(input()))
tmp1 = sum([d // 10 + (d % 10 > 0) for d in dish]) * 10
tmp2 = sum(sorted([d % 10 for d in dish if d % 10 > 0])[:1])
if tmp2 > 0:
    print(tmp1 + tmp2 - 10)
else:
    print(tmp1)

Buggy submission (verdict: Runtime Error):
dish = []
for i in range(5):
    dish.append(int(input()))
print(sum([d // 10 + (d % 10 > 0) for d in dish]) * 10 + sorted([d % 10 for d in dish if d % 10 > 0])[0] - 10)
Problem p03096 (python)

Fixed submission:
N = int(input())
C = [int(input()) for _ in range(N)]

MOD = 10 ** 9 + 7
recent = [-1 for _ in range(max(C))]
hist = []

ans = 1
for i in range(N):
    c = C[i] - 1
    if recent[c] >= 0 and recent[c] != i-1:
        ans = (ans + hist[recent[c]]) % MOD
    recent[c] = i
    hist.append(ans)
    
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
C = [int(input()) for _ in range(N)]

MOD = 10 ** 9 + 7
recent = [-1 for _ in range(N)]
hist = []

ans = 1
for i in range(N):
    c = C[i] - 1
    if recent[c] >= 0 and recent[c] != i-1:
        ans = (ans + hist[recent[c]]) % MOD
    recent[c] = i
    hist.append(ans)
    
print(ans)