Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N=int(input())
X=[]
U=[]
for i in range(N):
    x,u=input().split()
    X.append(float(x))
    U.append(u)
    if U[i]=='BTC':
        X[i]=380000*x
print(sum(X))

Fixed submission:
N=int(input())
X=[]
U=[]
for i in range(N):
    x,u=input().split()
    X.append(float(x))
    U.append(u)
    if U[i]=='BTC':
        X[i]=380000*X[i]
print(sum(X))

Buggy python submission (verdict: Runtime Error):
N=int(input())
X=[]
U=[]
for i in range(N):
    x,u=input().split()
    X.append(int(x))
    U.append(u)
    if u=='BTC':
        X[i]=380000*x
print(sum(X))

Fixed submission:
N=int(input())
X=[]
U=[]
for i in range(N):
    x,u=input().split()
    X.append(float(x))
    U.append(u)
    if U[i]=='BTC':
        X[i]=380000*X[i]
print(sum(X))
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

A, B, Q = map(int, input().split())
INF = float('inf')
s = [- INF] + [int(input()) for i in range(A)] + [INF]
t = [- INF] + [int(input()) for i in range(B)] + [INF]

for i in range(Q):
    x = int(input())
    b, d = bisect.bisect_left(s, x), bisect.bisect_left(t, x)
    ans = INF
    for S in [s[b-1], s[b]]:
        for T in [t[d-1], t[d]]:
            d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
            ans = min(ans, d1, d2)
    print(ans)

Fixed submission:
import bisect

A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [- INF] + [int(input()) for i in range(A)] + [INF]
t = [- INF] + [int(input()) for i in range(B)] + [INF]

for i in range(Q):
    x = int(input())
    b, d = bisect.bisect_left(s, x), bisect.bisect_left(t, x)
    ans = INF
    for S in [s[b-1], s[b]]:
        for T in [t[d-1], t[d]]:
            d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
            ans = min(ans, d1, d2)
    print(ans)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
S=(range(1,M+1))
for i in range(N):
    K,*A=map(int,input().split())
    S&=set(A)
print(len(S))

Fixed submission:
N,M=map(int,input().split())
S=set(range(1,M+1))
for i in range(N):
    K,*A=map(int,input().split())
    S&=set(A)
print(len(S))

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
S=(range(1,M+1))
for i in range(N):
    K,*A=map(int,input().splirt())
    S&=set(A)
print(len(S))

Fixed submission:
N,M=map(int,input().split())
S=set(range(1,M+1))
for i in range(N):
    K,*A=map(int,input().split())
    S&=set(A)
print(len(S))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
x = list(map(int, input().split()))

x.sort()
diffx = [x[i+1]-x[i] for i in range(M-1)]

if M == 1:
    print(0)
else:
    for i in range(N-1):
        idx = diffx.index(max(diffx))
        diffx[idx] = 0
    print(sum(diffx))

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

x.sort()
diffx = [x[i+1]-x[i] for i in range(M-1)]
diffx.sort(reverse = True)

if M == 1:
    print(0)
else:
    tmp = sum(diffx[:(N-1)])
    print(x[-1] - x[0] - tmp)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = list(map(int, input().split())) + [0]*K

dp = [float('inf') for _ in range(N+K)]
dp[0] = 0
'配るdp'
for i in range(N):
    for j in range(1, K+1):
        dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j] - h[i]))

print(dp[N-1])

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split())) + [0]*K

dp = [float('inf') for _ in range(N+K)]
dp[0] = 0
'配るdp'
for i in range(N):
    for j in range(1, K+1):
        dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j] - h[i]))

print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
weight = []
value = []
for _ in range(N):
    w_tmp, v_tmp = map(int, input().split())
    weight.append(w_tmp)
    value.append(v_tmp)

dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(W+1):
    dp[0][i] = 0

for i in range(N):
    for j in range(W+1):
        if j - weight[i] >= 0:
            dp[i+1][j] = max(dp[i][j], dp[i][j - weight[i]] + v[i])
        else:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])

print(dp[N][W])

Fixed submission:
N, W = map(int, input().split())
weight = []
value = []
for _ in range(N):
    w_tmp, v_tmp = map(int, input().split())
    weight.append(w_tmp)
    value.append(v_tmp)

dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(W+1):
    dp[0][i] = 0

for i in range(N):
    for j in range(W+1):
        if j - weight[i] >= 0:
            dp[i+1][j] = max(dp[i][j], dp[i][j - weight[i]] + value[i])
        else:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])

print(dp[N][W])

Buggy python submission (verdict: Time Limit Exceeded):
N, Weight = map(int, input().split())
w = []
V = []
for _ in range(N):
    w_tmp, v = map(int, input().split())
    w.append(w_tmp)
    V.append(v)

dp = [[0 for i in range(Weight+1)] for j in range(N+1)]
for i in range(Weight+1):
    dp[0][i] = 0

for i in range(N):
    for j in range(Weight+1):
        if j - w[i] >= 0:
            dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+V[i])
        else:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])

print(dp[N][Weight])

Fixed submission:
N, W = map(int, input().split())
weight = []
value = []
for _ in range(N):
    w_tmp, v_tmp = map(int, input().split())
    weight.append(w_tmp)
    value.append(v_tmp)

dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(W+1):
    dp[0][i] = 0

for i in range(N):
    for j in range(W+1):
        if j - weight[i] >= 0:
            dp[i+1][j] = max(dp[i][j], dp[i][j - weight[i]] + value[i])
        else:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])

print(dp[N][W])
Buggy python submission (verdict: Runtime Error):
D=int(input())
if D=25:
    print('Christmas')
elif D=24:
    print('Christmas Eve')
elif D=23:
    print('Christmas Eve Eve')
elif D=22:
    print('Christmas Eve Eve Eve')

Fixed submission:
D=int(input())
if D==25:
    print('Christmas')
elif D==24:
    print('Christmas Eve')
elif D==23:
    print('Christmas Eve Eve')
elif D==22:
    print('Christmas Eve Eve Eve')
Buggy python submission (verdict: Runtime Error):
if input()=='1':
    print('Hello World')
else input()=='2':
    A=int(input())
    B=int(input())
    print(A+B)

Fixed submission:
N = int(input())
if N==1:
    print('Hello World')
else:
    A=int(input())
    B=int(input())
    print(A + B)

Buggy python submission (verdict: Runtime Error):
if input()=='1':
    print(Hello World)
else input()=='2':
    A=int(input())
    B=int(input())
    print(A+B)

Fixed submission:
N = int(input())
if N==1:
    print('Hello World')
else:
    A=int(input())
    B=int(input())
    print(A + B)

Buggy python submission (verdict: Runtime Error):
if input()='1':
    print(Hello World)
else input()=='2':
    A=int(input())
    B=int(input())
    print(A+B)

Fixed submission:
N = int(input())
if N==1:
    print('Hello World')
else:
    A=int(input())
    B=int(input())
    print(A + B)

Buggy python submission (verdict: Runtime Error):
if input()='1':
    print(Hello World)
else:
    A=int(input())
    B=int(input())
    print(A+B)

Fixed submission:
N = int(input())
if N==1:
    print('Hello World')
else:
    A=int(input())
    B=int(input())
    print(A + B)
Buggy python submission (verdict: Runtime Error):
N,Time=map(int,input().split())
C=[]
T=[]
for _ in range(N):
    c,t=map(int,input().split())
    C.append(c)
    T.append(t)

tmp=[]
for i in range(N):
    if T[i]<=Time:
        tmp.append(C[i])
print(min(tmp))

if tmp==[]:
    print('TLE')

Fixed submission:
N,Time=map(int,input().split())
C=[]
T=[]
for _ in range(N):
    c,t=map(int,input().split())
    C.append(c)
    T.append(t)

tmp=[]
for i in range(N):
    if T[i]<=Time:
        tmp.append(C[i])
if tmp==[]:
    print('TLE')
else:
    print(min(tmp))
Buggy python submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
from collections import Counter
even=[]
odd=[]
for i in range(n):
    if i%2==0:
        even.append(v[i])
    else:
        odd.append(v[i])
E=Counter(even).most_common()
O=Counter(odd).most_common()
if E[0][0]!=O[0][0]:
    print(n-(E[0][1]+O[0][1]))
else:
    print(min(n-(E[1][1]+O[0][1]),n-(E[0][1]+O[1][1])))

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
from collections import Counter
even=[]
odd=[]
for i in range(n):
    if i%2==0:
        even.append(v[i])
    else:
        odd.append(v[i])
E=Counter(even).most_common()
O=Counter(odd).most_common()
E.append([0,0])
O.append([0,0])
if E[0][0]!=O[0][0]:
    print(n-(E[0][1]+O[0][1]))
else:
    print(min(n-(E[1][1]+O[0][1]),n-(E[0][1]+O[1][1])))
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from math import gcd

N, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x.sort()
diff = []
for i in range(N):
    diff.append(x[i+1] - x[i])

print(reduce(gcd, diff))

Fixed submission:
from functools import reduce
from fractions import gcd

N, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x.sort()
diff = []
for i in range(N):
    diff.append(x[i+1] - x[i])

print(reduce(gcd, diff))
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
field = []
for i in range(H):
    field.append(list(map(int, input().split())))

tmp = []
cnt = 0 
for i in range(H):
    if i % 2 == 0:
        for j in range(W):
            if j == W-1 and field[i][j] % 2 == 1:
                field[i][j] -= 1
                filed[i+1][j] += 1
                tmp.append(list((j, i, j, i+1)))
                cnt += 1
            elif field[i][j] % 2 == 1:
                field[i][j] -= 1
                field[i][j+1] += 1
                tmp.append(list((j, i, j+1, i)))
                cnt += 1
    else:
        for j in range(W)[::-1]:
            if j == 0 and field[i][j] % 2 == 1:
                field[i][j] -= 1
                field[i+1][j] += 1
                tmp.append(list((j, i, j, i+1)))
                cnt += 1
            elif field[i][j] % 2 == 1:
                field[i][j] -= 1
                field[i][j-1] += 1
                tmp.append(list((j, i, j-1, i)))
                cnt += 1

print(cnt)
for i in range(cnt):
    print(tmp[i])

Fixed submission:
H, W = map(int, input().split())
a = [list(map(int, input().split())) for i in range(H)]

ans = []

for i in range(H-1):
    for j in range(W):
        if a[i][j] % 2:
            a[i][j] -= 1
            a[i+1][j] += 1
            ans.append((i+1, j+1, i+2, j+1))

for i in range(W-1):
    if a[-1][i] % 2:
        a[-1][i] -= 1
        a[-1][i+1] += 1
        ans.append((H, i+1, H, i+2))

print(len(ans))
for row in ans:
    print(*row)
Buggy python submission (verdict: Runtime Error):
N = int(input())

ans = ''
while N != 0:
    r = N % 2
    N = (N - r) / (-2)
    ans += r

ans[::-1]
if N == 0:
    ans = '0'
    
print(ans)

Fixed submission:
N = int(input())

ans = ''
while N != 0:
    r = N % 2
    N = (N - r) // (-2)
    ans += str(r)

ans = ans[::-1]
if ans == '':
    ans = '0'

print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
a = list(map(int, input().split()))

b = [a[i] - i for i in range(N)]
median = np.median(b)

ans = 0
for i in range(N):
    ans += abs(b[i] - int(median))

print(ans)

Fixed submission:
import numpy as np

N = int(input())
a = list(map(int, input().split()))

b = [a[i] - i for i in range(N)]
median = np.median(b)

ans = 0
for i in range(N):
    ans += abs(b[i] - int(median))

print(ans)

Buggy python submission (verdict: Runtime Error):
import statistics

N = int(input())
a = list(map(int, input().split()))

b = [a[i] - i for i in range(N)]
median = statistics.median(b)

ans = 0
for i in range(N):
    ans += abs(b[i] - int(median))

print(ans)

Fixed submission:
import numpy as np

N = int(input())
a = list(map(int, input().split()))

b = [a[i] - i for i in range(N)]
median = np.median(b)

ans = 0
for i in range(N):
    ans += abs(b[i] - int(median))

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
K = int(input())

substr = []
for i in range(len(s)):
    for j in range(i+1, K):
        if len(s) >= K:
            substr.append(s[i:j])
        else:
            if j == len(s)+1:
                break
            substr.append(s[i:j])

substr = list(set(substr))
substr.sort()
print(substr[K-1])

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

substr = []
for i in range(len(s)):
    for j in range(i+1, i+K+1):
        if len(s) >= K:
            substr.append(s[i:j])
        else:
            if j == len(s)+1:
                break
            substr.append(s[i:j])

substr = list(set(substr))
substr.sort()

print(substr[K-1])
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = [input() for i in range(H)]

dx = [-1, 0, 0, 1]
dy = [0, 1, -1, 0]
for i in range(H):
    for j in range(W):
        flag = False
        for k in range(4):
            if s[i][j] == '#':
                nx = j + dx[k]
                ny = i + dy[k]
                if nx < 0 or nx >= W or ny < 0 or ny >= H:
                    continue
                if s[nx][ny] == '#':
                    flag = True
            else:
                flag = True
        if flag == False:
            print('No')
            exit()        

print('Yes')

Fixed submission:
H, W = map(int, input().split())
s = [input() for i in range(H)]

dx = [-1, 0, 0, 1]
dy = [0, 1, -1, 0]
for i in range(H):
    for j in range(W):
        flag = False
        for k in range(4):
            if s[i][j] == '#':
                nx = j + dx[k]
                ny = i + dy[k]
                if nx < 0 or nx >= W or ny < 0 or ny >= H:
                    continue
                if s[ny][nx] == '#':
                    flag = True
            else:
                flag = True
        if flag == False:
            print('No')
            exit()        

print('Yes')

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = [input() for i in range(H)]

dx = [-1, 0, 0, 1]
dy = [0, 1, -1, 0]
for i in range(H):
    for j in range(W):
        flag = False
        for k in range(4):
            if s[i][j] == '#':
                nx = i + dx[k]
                ny = j + dy[k]
                if nx < 0 or nx >= W or ny < 0 or ny >= H:
                    continue
                if s[nx][ny] == '#':
                    flag = True
            else:
                flag = True
        if flag == False:
            print('No')
            exit()        

print('Yes')

Fixed submission:
H, W = map(int, input().split())
s = [input() for i in range(H)]

dx = [-1, 0, 0, 1]
dy = [0, 1, -1, 0]
for i in range(H):
    for j in range(W):
        flag = False
        for k in range(4):
            if s[i][j] == '#':
                nx = j + dx[k]
                ny = i + dy[k]
                if nx < 0 or nx >= W or ny < 0 or ny >= H:
                    continue
                if s[ny][nx] == '#':
                    flag = True
            else:
                flag = True
        if flag == False:
            print('No')
            exit()        

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

if K == 0:
    print(N*N)
    exit()

ans = 0
for b in range(N+1):
    ans += max(0, b-K)*(N//b) + max(0, N%b-K+1)
print(ans)

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

if K == 0:
    print(N*N)
    exit()

ans = 0
for b in range(1, N+1):
    ans += max(0, b-K)*(N//b) + max(0, N%b-K+1)
print(ans)
Buggy python submission (verdict: Runtime Error):
from itertools import combinations

N = int(input())
S = [input() for i in range(N)]

m = []
a = []
r = []
c = []
h = []
for i in range(N):
    if S[i][0] == 'M':
        m.append(S[i])
    elif S[i][0] == 'A':
        a.append(S[i])
    elif S[i][0] == 'R':
        r.append(S[i])
    elif S[i][0] == 'C':
        c.append(S[i])
    elif S[i][0] == 'H':
        h.append(S[i])

cnt = []
cnt.append(m.count)
cnt.append(a.count)
cnt.append(r.count)
cnt.append(c.count)
cnt.append(h.count)

com = list(combinations(range(5), 3))

ans = 0
for i in com:
    ans += cnt[i[0]]*cnt[i[1]]*cnt[i[2]]
print(ans)  

Fixed submission:
from itertools import combinations

N = int(input())
S = [input() for i in range(N)]

m = []
a = []
r = []
c = []
h = []
for i in range(N):
    if S[i][0] == 'M':
        m.append(S[i])
    elif S[i][0] == 'A':
        a.append(S[i])
    elif S[i][0] == 'R':
        r.append(S[i])
    elif S[i][0] == 'C':
        c.append(S[i])
    elif S[i][0] == 'H':
        h.append(S[i])

cnt = []
cnt.append(len(m))
cnt.append(len(a))
cnt.append(len(r))
cnt.append(len(c))
cnt.append(len(h))

com = list(combinations(range(5), 3))

ans = 0
for i in com:
    ans += cnt[i[0]]*cnt[i[1]]*cnt[i[2]]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
T = []
coo = [(0, 0)]
for i in range(N):
    t, x, y = map(int, input().split())
    T.append(t)
    coo.append((x, y))

for i in range(N):
    dxdy = coo[i+1][0] - coo[i][0] + coo[i+1][1] - coo[i][1]
    if dxdy <= t[i+1] - t[i]:
        pass
    else:
        print('No')
        exit()
print('Yes')

Fixed submission:
N = int(input())
T = [0]
coo = [(0, 0)]
for i in range(N):
    t, x, y = map(int, input().split())
    T.append(t)
    coo.append((x, y))

for i in range(N):
    dxdy = coo[i+1][0] - coo[i][0] + coo[i+1][1] - coo[i][1]
    rt = (T[i+1] - T[i]) % 2
    rdxdy = dxdy % 2
    if dxdy <= T[i+1] - T[i] and rt == rdxdy:
        pass
    else:
        print('No')
        exit()
print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

cnt = Counter(A)

ans = 0
for i in range(len(cnt)):
    if cnt.most_common()[i][1] % 2 != 0:
        ans += 1

print(ans)

Fixed submission:
from collections import Counter

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

cnt = Counter(A)

ans = 0
for i in cnt.values():
    if i % 2 != 0:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

b = [0]*(10**5)
for i in a:
    if i == 10**5:
        b[i-1] += 1
        b[i] += 1
    elif i == 0:
        b[i] += 1
        b[i+1] += 1
    else:
        b[i-1] += 1
        b[i] += 1
        b[i+1] += 1

print(max(b))

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

b = [0]*(10**5+1)
for i in a:
    if i == 10**5:
        b[i-1] += 1
        b[i] += 1
    elif i == 0:
        b[i] += 1
        b[i+1] += 1
    else:
        b[i-1] += 1
        b[i] += 1
        b[i+1] += 1

print(max(b))
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
N = int(input())
A = list(map(int, input().split()))

x = 0
for i in range(H):
    ans = []
    for j in range(W):
        ans.append(x+1)
        A[i] -= 1
        if A[i] == 0:
            x += 1
    if i % 2 == 0:
        print(*ans)
    else:
        print(*ans[::-1])

Fixed submission:
H, W = map(int, input().split())
N = int(input())
A = list(map(int, input().split()))

x = 0
for i in range(H):
    ans = []
    for j in range(W):
        ans.append(x+1)
        A[x] -= 1
        if A[x] == 0:
            x += 1
    if i % 2 == 0:
        print(*ans)
    else:
        print(*ans[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
s = [[] for i in range(N+1)]
e = [[] for i in range(N+1)]
for i in range(M):
    a, b = map(int, input().split())
    s[a].append(b)
    e[b].append(a)

for i in s[1]:
    for j in e[N]:
        if i == j:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')

Fixed submission:
N, M = map(int, input().split())
s = [[] for i in range(N+1)]
e = [[] for i in range(N+1)]
for i in range(M):
    a, b = map(int, input().split())
    s[a].append(b)
    e[b].append(a)

for i in s[1]:
    if N in s[i]:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input(),split())

if a + b < 10:
    print(a + b)
else:
    print('error')

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

if a + b < 10:
    print(a + b)
else:
    print('error')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [int(input()) for i in range(n)]

ans = []
for i in range(1<<n):
    x = 0
    for j in range(n):
        if (i>>j) & 1:
            x += s[j]
    if x % 10 == 0:
        ans.append(0)
    else:
        ans.append(x)

print(max(ans))

Fixed submission:
n = int(input())
s = [int(input()) for i in range(n)]

sum_s = sum(s)
if sum_s % 10 != 0:
    print(sum_s)
    exit()

if all([1 if x % 10 == 0 else 0 for x in s]):
    print(0)
else:
    for i in range(n):
        if s[i] % 10 == 0:
            s[i] = 101
    s.sort()
    ans = sum_s - s[0]
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())

cnt = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i + j + k == S:
                cnt += 1

print(cnt)

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

cnt = 0
for i in range(K+1):
    for j in range(K+1):
        if 0 <= S - (i + j) <= K:
            cnt += 1 

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

cnt = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i + j + k == S:
                cnt += 1

print(cnt)

Fixed submission:
sx, sy, tx, ty = map(int, input().split())

dx, dy = tx-sx, ty-sy
ans = ''
ans += 'U'*dy
ans += 'R'*dx
ans += 'D'*dy
ans += 'L'*dx
ans += 'L'
ans += 'U'*(dy+1)
ans += 'R'*(dx+1)
ans += 'DR'
ans += 'D'*(dy+1)
ans += 'L'*(dx+1)
ans += 'U'

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1
for i in a:
    ans *= i

if ans > 10**18:
    print(-1)
else:
    print(ans)


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

if 0 in a:
    print(0)
    exit(0)

ans = 1
for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit(0)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(100000)

def main():
    n = int(input())
    a = list(map(int, input().split()))

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

    lcm = 1
    for i in a:
        g = gcd(lcm, i)
        lcm *= i // g

    ans = 0
    mod = 10**9 + 7
    for i in a:
        ans += lcm // i
        ans %= mod
    print(ans)

main()


Fixed submission:
import sys
sys.setrecursionlimit(100000)

def main():
    n = int(input())
    a = list(map(int, input().split()))

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

    lcm = 1
    for i in a:
        g = gcd(lcm, i)
        lcm *= i // g

    ans = 0
    mod = 10**9 + 7
    for i in a:
        ans += lcm // i
    ans %= mod
    print(ans)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(100000)


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

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

lcm = 1
for i in a:
    g = gcd(lcm, i)
    lcm *= i//g

ans = 0
mod = 10**9 + 7
for i in a:
    ans += lcm//i
    ans %= mod
print(ans)


Fixed submission:
import sys
sys.setrecursionlimit(100000)

def main():
    n = int(input())
    a = list(map(int, input().split()))

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

    lcm = 1
    for i in a:
        g = gcd(lcm, i)
        lcm *= i // g

    ans = 0
    mod = 10**9 + 7
    for i in a:
        ans += lcm // i
    ans %= mod
    print(ans)

main()
Buggy python submission (verdict: Runtime Error):
a = input().split()
s = {}
for i in a:
    s |= i
print(len(s))

Fixed submission:
a = input().split()
s = {a[0]}
for i in a:
    s |= {i}
print(len(s))