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

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

dp=[0 for i in range(N)]
dp[1]=abs(H[1]-H[0])

for i in range(2,N):
    dp[i]=min(dp[i-1]+abs(H[i]-H[i-1]),dp[i-2]+abs(H[i]-H[i-2]))
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
ls = len(s)
lt = len(t)


dp = [[0 for i in range(lt+1)] for j in range(ls+1)]
answer = ''

for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])

            
if ls + lt == 0:
  print('ok')
else:
  
  i = ls-1
  j = lt-1
  while (0<=i & 0<=j):
      if s[i] == t[j]:
          answer += s[i]
          i -= 1
          j -= 1
      elif dp[i+1][j+1] == dp[i+1][j]:
          j -= 1
      else:
          i -= 1
  print(answer[::-1])

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
ls = len(s)
lt = len(t)


dp = [[0 for i in range(lt+1)] for j in range(ls+1)]
answer = ''

for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])

            
if ls + lt == 0:
  print('')
else:
  
  i = ls-1
  j = lt-1
  while (0<=i & 0<=j):
      if s[i] == t[j]:
          answer += s[i]
          i -= 1
          j -= 1
      elif dp[i+1][j+1] == dp[i+1][j]:
          j -= 1
      else:
          i -= 1
  print(answer[::-1])

Buggy submission (verdict: Runtime Error):
def main():
    N,K=map(int,input().split())
    h=list(map(int,input().split()))

    ans=[0]*N
    ans[1]=abs(h[1]-h[0])


    for i in range(2,N):
        ans[i] = min(abs(h[i] - h[j]) + ans[j] for j in range(max(0,i-K),i))
    print(ans[N-1])
    
main()

Buggy submission (verdict: Runtime Error):
#B-Frog2
N,K=map(int,input().split())
h=list(map(int,input().split()))

dp=[0 for i in range(N)]
dp[1]=abs(h[1]-h[0])


for i in range(2,N):
    min_num=10000
    for j in range(max(0,i-K),i):
        if min_num>dp[j]+abs(h[i]-h[j]):
            min_num=dp[j]+abs(h[i]-h[j])
    dp[i]=min_num

print(dp)
Problem p03163 (python)

Fixed submission:
N,W=map(int,input().split())
DP=[[0 for j in range(W+1)]for i in range(N+1)]
for i in range(N):
    w,v=map(int,input().split())
    for j in range(1,W+1):
        if j>=w:
            DP[i+1][j]=max(DP[i][j-w]+v,DP[i][j])
        else:
            DP[i+1][j]=DP[i][j]
print(DP[N][W])

Buggy submission (verdict: Runtime Error):
#ナップザック問題
import numpy as np

N,W=map(int,input())
wv = np.array([list(map(int, input().split())) for i in range(0, N)])  


dp=np.zeros((N+1,W+1),dtype=int)
for n in range(0, N):  
    for w in range(0, W + 1):  
        if w < wv[n, 0]:  
            dp[n+1, w] = dp[n, w]  
        else:  
            dp[n+1, w] = max(dp[n, w], dp[n, w - wv[n, 0]] + wv[n, 1])  
print(dp[N,W])

Buggy submission (verdict: Runtime Error):
#ナップザック問題
import numpy as np

N = int(input())  
wv = np.array([list(map(int, input().split())) for i in range(0, N)])  
W = int(input()) 

dp=np.zeros((N+1,W+1),dtype=int)
for n in range(0, N):  
    for w in range(0, W + 1):  
        if w < wv[n, 0]:  
            dp[n+1, w] = dp[n, w]  
        else:  
            dp[n+1, w] = max(dp[n, w], dp[n, w - wv[n, 0]] + wv[n, 1])  
print(dp[N,W])
Problem p03164 (python)

Fixed submission:
"""
E-Knapsack2
Wが10**9まであるのでdpの置き方を工夫する。
dp[i]:=価値がiのときのナップザックの重さ
"""
N,W = map(int,input().split())
dp = [0]+[W+1]*(N*10**3)
for i in range(N):
    w,v = map(int,input().split())
    for j in range(N*10**3+1-v)[::-1]:
        dp[j+v] = min(dp[j+v],dp[j]+w)
for i in range(N*10**3+1)[::-1]:
    if dp[i]<=W:
        print(i)
        exit()

Buggy submission (verdict: Runtime Error):
""""
E-Knapsack2
Wが10**9まであるのでdpの置き方を工夫する。
dp[i]:=価値がiのときのナップザックの重さ
""""
N,W = map(int,input().split())
dp = [0]+[W+1]*(N*10**3)
for i in range(N):
    w,v = map(int,input().split())
    for j in range(N*10**3+1-v)[::-1]:
        dp[j+v] = min(dp[j+v],dp[j]+w)
for i in range(N*10**3+1)[::-1]:
    if dp[i]<=W:
        print(i)
        exit()
Problem p03165 (python)

Fixed submission:
s = input()
t = input()
ls = len(s)
lt = len(t)


dp = [[0 for i in range(lt+1)] for j in range(ls+1)]
answer = ''

for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])


i = ls-1
j = lt-1
while (0 <= i) & (0 <= j):
    if s[i] == t[j]:
        answer += s[i]
        i -= 1
        j -= 1
    elif dp[i+1][j+1] == dp[i+1][j]:
        j -= 1
    else:
        i -= 1
if len(answer) == 0:
  print('')
else:
  print(answer[::-1])

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


s = input()
t = input()
ls = len(s)
lt = len(t)

dp = np.array([[""]*(lt+2)]*(ls+2), dtype=object)
dp2 = np.zeros(((ls+2), (lt+2)))

for i in range(ls):
    flag = 0
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + s[i]
            dp2[i+1][j+1] = dp2[i][j] + 1
        else:
            if dp2[i][j+1] > dp2[i+1][j]:
                dp[i+1][j+1] = dp[i][j+1]
                dp2[i+1][j+1] = dp2[i][j+1]
            else:
                dp[i+1][j+1] = dp[i+1][j]
                dp2[i+1][j+1] = dp2[i+1][j]
print(dp[ls][lt])

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


s = input()
t = input()
ls = len(s)
lt = len(t)

dp = np.array([[""]*(ls+2)]*(lt+2), dtype=object)
dp2 = np.zeros(((ls+2), (lt+2)))

for i in range(ls):
    flag = 0
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + s[i]
            dp2[i+1][j+1] = dp2[i][j] + 1
        else:
            if dp2[i][j+1] > dp2[i+1][j]:
                dp[i+1][j+1] = dp[i][j+1]
                dp2[i+1][j+1] = dp2[i][j+1]
            else:
                dp[i+1][j+1] = dp[i+1][j]
                dp2[i+1][j+1] = dp2[i+1][j]
print(dp[ls][lt])

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


s = input()
t = input()
ls = len(s)
lt = len(t)

dp = np.array([[""]*(ls+2)]*(lt+2), dtype=object)
dp2 = np.zeros(((ls+2), (lt+2)))

for i in range(ls):
    flag = 0
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + s[i]
            dp2[i+1][j+1] = dp2[i][j] + 1
        else:
            if dp2[i][j+1] > dp2[i+1][j]:
                dp[i+1][j+1] = dp[i][j+1]
                dp2[i+1][j+1] = dp2[i][j+1]
            else:
                dp[i+1][j+1] = dp[i+1][j]
                dp2[i+1][j+1] = dp2[i+1][j]
print(dp[ls][lt])
Problem p03219 (python)

Fixed submission:
A,B=map(int,input().split())
print(A+B//2)

Buggy submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
minn=10**10
for i in range(n):
  if minn>abs((t*(1000)-6*H[i])-a*1000):
    ans = H[i]
    minn=t*(1000)-6*H[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
minn=10**10
for i in range(n):
  if minn>abs((t*(1000)-6*H[i])-a):
    ans = H[i]
    minn=t*(1000)-6*H[i]
print(ans)
Problem p03220 (python)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
minn=10**10
for i in range(n):
  if minn>abs((t*(1000)-6*H[i])-a*1000):
    ans = i
    minn=abs((t*(1000)-6*H[i])-a*1000)
print(ans+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
H=list(map(int,inpt().split()))
minn=10**10
for i in range(n):
  if minn>abs((t*(1000)-6*H[i])-a):
    ans = H[i]
    minn=t*(1000)-6*H[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
H=list(map(int,inpt().split()))
minn=10**10
for i in range(n):
  if minn>t*(1000)-6*H[i]:
    ans = H[i]
    minn=t*(1000)-6*H[i]
print(ans)
Problem p03239 (python)

Fixed submission:
N,T=map(int,input().split())
cc=1001
for i in range(N):
  c,t=map(int,input().split())
  if cc>c and T>=t:
    cc=c
if cc==1001:
  print("TLE")
else:
  print(cc)

Buggy submission (verdict: Runtime Error):
N,T=map(int,input().split())
cc=1000
for i in range(N):
  c,t=map(int,input().split())
  if cc>c and T=>t:
    cc=c
if cc==1000:
  print("TLE")
else:
  print(cc)
Problem p03243 (python)

Fixed submission:
n=list(map(int,input()))
if n[0]<n[1] or (n[0]==n[1] and n[0]<n[2]):
  print(str(n[0]+1)*3)
else:
  print(str(n[0])*3)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n[0]=<n[1] or (n[0]==n[1] and n[0]=<n[2]):
  print(str(n[0]+1)*3)
else:
  print(str(n[0])*3)
Problem p03251 (python)

Fixed submission:
n, m, x, y = map(int, input().split())
xx = list(map(int, input().split()))
yy = list(map(int, input().split()))
xxx = max(xx + [x])
yyy = min(yy + [y])
if xxx < yyy:
    print("No War")
else:
    print("War")

Buggy submission (verdict: Runtime Error):
n,m,x,y=map(int,input().split())
xx=list(map(int,input().split()))
yy=list(map(int,input().split()))
xxx=max(xx+list(x))
yyy=min(yy+list(y))
if xxx<yyy:
  print("No War")
else:
  print("War")
Problem p03261 (python)

Fixed submission:
n=int(input())
check=[]
s=input()
check.append(s)
ans=0
for i in range(n-1):
  keep=s[-1]
  s=input()
  if keep != s[0]:
    ans=1
  if str(s) in check:
    ans = 1
  else:
    check.append(s)
print(["Yes","No"][ans])

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=0
for i in range(n):
  keep=s[-1]
  s=input()
  if keep != s[0]:
    ans=1
  else:
    continue
print(["Yes","No"][ans])
Problem p03289 (python)

Fixed submission:
s = input()
n = len(s)
ans = 1
if s[0] != "A":
    ans *= 0
if not (97 <= ord(s[1]) <= 122):
    ans *= 0
if not (97 <= ord(s[-1]) <= 122):
    ans *= 0

check = 0
for i in range(1, n - 1):
    if s[i] == "C":
        check += 1
print(["WA", "AC"][ans & (check == 1)])

Buggy submission (verdict: Runtime Error):
rint("a", ord("a"))
print("z", ord("z"))

s = input()
n = len(s)
ans = 1
if s[0] != "A":
    ans *= 0
if not (97 <= ord(s[1]) <= 122):
    ans *= 0
if not (97 <= ord(s[-1]) <= 122):
    ans *= 0

check = 0
for i in range(1, n - 1):
    if s[i] == "C":
        check += 1
print(["WA", "AC"][ans & (check == 1)])
Problem p03292 (python)

Fixed submission:
S=list(map(int,input().split()))
A=sorted(S)

print(A[2]-A[0])

Buggy submission (verdict: Runtime Error):
S=input().split()
A=sorted(S)
print(S[2]-S[0])
Problem p03369 (python)

Fixed submission:
S=input()
ans=700
for i in S:
  if i=="o":
    ans+=100
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq

N,X = map(int,input().split())
m=[]
for _ in range(N):
    M = int(input())
    m.append(M)

sum_m = sum(m)
heapq.heapify(m)
min_m = heapq.heappop(m)

ans = N

A=X-sum_m
while A-min_m >0:
    A-=min_m
    ans+=1
print(ans)
Problem p03377 (python)

Fixed submission:
A,B,X=map(int,input().split())
if A+B>=X and A<=X:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
A,B,X=map(int,input().split())
if B<=X-A:
  print("YES")
eles:
  print("NO")

Buggy submission (verdict: Runtime Error):
A,B,X=map(int,input().split())
if B<==X-A:
  print("YES")
eles:
  print("NO")
Problem p03415 (python)

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

Buggy submission (verdict: Runtime Error):
for i in range(3):
  s=input()
  ans+=s[i]
print(ans)
Problem p03424 (python)

Fixed submission:
n=int(input())
lis=list(input().split())
ans=0
for i in range(n):
  if lis[i] == "Y":
    ans=1
print(["Three","Four"][ans])

Buggy submission (verdict: Runtime Error):
n=int(input())
lis=list(map(int,input().split()))
ans=0
for i in range(n):
  if i == "P":
    ans=1
print(["Three","Four"][ans])
Problem p03455 (python)

Fixed submission:
S=list(input().split())
print("Odd") if int(S[0])*int(S[1])%2==1 else print("Even")

Buggy submission (verdict: Runtime Error):
print("Odd") if int(input())*int(input())%2==1 else print("Even")
Problem p03469 (python)

Fixed submission:
print("2018"+input()[4:])

Buggy submission (verdict: Runtime Error):
S=input()
S[3]="8"
print(S)
Problem p03470 (python)

Fixed submission:
n=int(input())
keep=[]
for i in range(n):
  keep.append(int(input()))

print(len(set(keep)))

Buggy submission (verdict: Runtime Error):
n=int(input)
for i in range(n):
  keep.append(int(input()))

print(len(set(keep)))
Problem p03477 (python)

Fixed submission:
A,B,C,D=map(int,input().split())
e=A+B-C-D
print("Balanced")if e==0 else print(["","Left","Right"][int(e/abs(e))])

Buggy submission (verdict: Runtime Error):
A,B,C,D=map(int,input())
e=A+B-C-D
print("Balanced")if e==0 else print(["Left",0,"Right"][e/abs(e)])

Buggy submission (verdict: Runtime Error):
A,B,C,D=map(int,input())
e=A+B-C-D
print("Balanced")if e==0 else print(["Left","Right"][e/abs(e)])
Problem p03485 (python)

Fixed submission:
a,b=map(int,input().split())
print(int((a+b-0.01)//2+1))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
print((a+b-0.01)//2+1)
Problem p03493 (python)

Fixed submission:
S=input()
print(int(S[0])+int(S[1])+int(S[2]))

Buggy submission (verdict: Runtime Error):
print(sum(list(int,input().split())))
Problem p03502 (python)

Fixed submission:
s=input()
ss=int(s)
keep=0
for i in range(len(s)):
  keep+=int(s[i])
if ss%keep==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
ss=int(s)
keep=0
for i in range(len(s)):
  keep+=int(i)
if ss%keep==0:
  print("Yes")
else:
  print("No")
Problem p03543 (python)

Fixed submission:
n=input()
a=0
for i in range(2):
  if n[i]==n[i+1] and n[i+1]==n[i+2]:
    a=1
print(["No","Yes"][a])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=0
for i in range(2):
  if n[i]==n[i+1] and n[i+1]==n[i+2]:
    a=1
print(["No","Yes"][a])
Problem p03547 (python)

Fixed submission:
S=input()
A=ord(S[0])
B=ord(S[2])

if A>B:
  print(">")
elif A<B:
  print("<")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
a,b=map(input().split())
A=chr(a)
B=chr(b)
if A>B:
  print(">")
elif A<B:
  print("<")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
A=chr(a)
B=chr(b)
if A>B:
  print(">")
elif A<B:
  print("<")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
A=ord(a)
B=ord(b)
if A>B:
  print(">")
elif A<B:
  print("<")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
if A>B:
  print(">")
elif A<B:
  print("<")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
A,B=int(input())
if A>B:
  print(">")
elif A<B:
  print("<")
else:
  print("=")
Problem p03565 (python)

Fixed submission:
s = input()
t = input()

s_length = len(s)
t_length = len(t)

ans = ''
keep = ''
remind = 0
checker = False
for i in range(s_length):
    if (i + t_length) <= s_length:
        check = True
        for j in range(t_length):
            if (s[i + j] != t[j]) & (s[i + j] != '?'):
                check = False
        if check:
            checker = True
            ans = keep + t
            remind = i + t_length
    if s[i] == '?':
        keep += 'a'
    else:
        keep += s[i]
ans = ans + keep[remind:]

if checker:
    print(ans)
else:
    print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
s_length = len(s)
t_length = len(t)

ans = ''
keep = ''
check = False
ans_remind = 0

for i in range(s_length):
    if s[i] == t[0]:
        check2 = True
        for j in range(t_length):
            if (s[i + j] != t[j]) & (s[i + j] != '?'):
                check2 = False
        if check2:
            check = True
            ans = keep + t
            ans_remind = i + t_length

    if s[i] == '?':
        keep += 'a'
        i += 1
    else:
        keep += s[i]
        i += 1

ans = ans + keep[ans_remind:]
if check:
    print(ans)
else:
    print('UNRESTORABLE')
Problem p03657 (python)

Fixed submission:
a,b=map(int,input().split())
if a*b*(a+b)%3==0:
  print("Possible")
else:
  print("Impossible")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=sorted(a)
ans=0
for i in range(1,k+1):
  ans+=b[(-1)*i]
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a*b*(a+b)%3==0:
  print(""Possible")
else:
        print("Impossible")

Buggy submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
S=sum(a)
SS=0
mi=abs(S-SS)
for i in range(N):
  S=S-a[i]
  SS=SS+a[i]
  if mi>=abs(S-SS):
    mi=abs(S-SS)
print(mi)
Problem p03679 (python)

Fixed submission:
x,a,b=map(int,input().split())
if a>=b:
  print("delicious")
elif x+a>=b:
  print("safe")
else:
  print("dangerous")

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
print("delicious")if a>b print("safe")elif x+a>b else print("dangerous")
Problem p03680 (python)

Fixed submission:
n = int(input())
lis = []
for i in range(n):
    lis.append(int(input()))

k = 1
ans = 0
m = 0
while k != 2 and m < n:
    k = lis[k - 1]
    m += 1
if k == 2:
    print(m)
else:
    print("-1")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
def check_num(a,b):
    if b>N+1:
        return -1
    if A[a]==2:
        return b
    else:
        return check_num(int(A[a])-1,b+1)
print(check_num(0,1))
Problem p03796 (python)

Fixed submission:
N=int(input())
ans=1
for i in range(1,N+1):
    ans=(ans*i)%1000000007
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
N=int(input())
ans=1
for i in range(1,n+1):
    ans=(ans*i)%1000000007
print(ans%(10**9+7))
Problem p03836 (python)

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

higth = ty - sy
width = tx - sx

ans = ''
ans += 'U' * higth
ans += 'R' * width
ans += 'D' * higth
ans += 'L' * width
ans += 'L' + 'U' * (higth + 1)
ans += 'R' * (width + 1) + 'D'
ans += 'R' + 'D' * (higth + 1)
ans += 'L' * (width + 1) + 'U'
print(ans)

Buggy submission (verdict: Runtime Error):
X=list(map(int,input().split()))
#X軸に並行
if X[2]-X[0]==0:
    if X[3]-X[1]>0:
        q=X[3]-X[1]
        U="U"
        D="D"
    else:
        q=X[1]-X[3]
        U="U"
        D="D"
    print(U*(q+1)+R*2+D*(q+2)+L*2+U+L+U*q+R*2+D*q+L)
#Y軸に並行
if X[3]-X[1]==0:
    if X[2]-X[0]>0:
        p=X[2]-X[0]
        R="R"
        L="L"
    else:
        p=X[0]-X[2]
        R="L"
        L="R"
    print(R*(p+1)+U*2+L*(p+2)+D*2+R+D+R*p+U*2+L*p+D)

if X[2]-X[0]!=0 and X[3]-X[1]!=0
    if X[2]-X[0]>0:
        p=X[2]-X[0]
        R="R"
        L="L"
    else:
        p=X[0]-X[2]
        R="L"
        L="R"
    if X[3]-X[1]>0:
        q=X[3]-X[1]
        U="U"
        D="D"
    else:
        q=X[1]-X[3]
        U="D"
        D="U"
    print(U*p+R*(q+1)+D*(p+1)+L*(q+1)+U+L+U*(p+1)+R*(q+1)+D*(p+1)+L*q)

Buggy submission (verdict: Runtime Error):
X=list(map(int,input().split()))
#X軸に並行
if X[2]-X[0]==0:
    if X[3]-X[1]>0:
        q=X[3]-X[1]
        U="U"
        D="D"
    else:
        q=X[1]-X[3]
        U="U"
        D="D"
    print(U*(q+1)+R*2+D*(q+2)+L*2+U+L+U*q+R*2+D*q+L)
#Y軸に並行
if X[3]-X[1]==0:
    if X[2]-X[0]>0:
        p=X[2]-X[0]
        R="R"
        L="L"
    else:
        p=X[0]-X[2]
        R="L"
        L="R"
    print(R*(p+1)+U*2+L*(p+2)+D*2+R+D+R*p+U*2+L*p+D)

if X[2]-X[0]!=0 or X[3]-X[1]!=0
    if X[2]-X[0]>0:
        p=X[2]-X[0]
        R="R"
        L="L"
    else:
        p=X[0]-X[2]
        R="L"
        L="R"
    if X[3]-X[1]>0:
        q=X[3]-X[1]
        U="U"
        D="D"
    else:
        q=X[1]-X[3]
        U="D"
        D="U"
    print(U*p+R*(q+1)+D*(p+1)+L*(q+1)+U+L+U*(p+1)+R*(q+1)+D*(p+1)+L*q)

Buggy submission (verdict: Runtime Error):
X=list(map(int.input().split()))
if X[2]-X[0]>0:
    p=X[2]-X[0]
    U="U"
    D="D"
else:
    p=X[0]-X[2]
    U="D"
    D="U"

if X[3]-X[1]>0:
    q=X[3]-X[1]
    R="R"
    L="L"
else:
    q=X[1]-X[3]
    R="L"
    L="R"
    
print(U*p+R*(q+1)+D*(p+1)+L*(q+1)+U+L+U*(p+1)+R*(q+1)+D*(p+1)+L*q)

Buggy submission (verdict: Runtime Error):
X=list(map(int.input().split()))
ans=""
if X[2]-X[0]>0:
    p=X[2]-X[0]
    U="U"
    D="D"
else:
    p=X[0]-X[2]
    U="D"
    D="U"

if X[3]-X[1]>0:
    q=X[3]-X[1]
    R="R"
    L="L"
else:
    q=X[1]-X[3]
    R="L"
    L="R"
    
print(U*p+R*(q+1)+D*(p+1)+L*(q+1)+U+L+U*(p+1)+R*(q+1)+D*(p+1)+L*q
Problem p03854 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10000)

s = 'HAKUTYUMU' + input()


while s != 'HAKUTYUMU':
    next_s = s

    if s[-5:] == 'dream':
        next_s = s[:-5]
    if s[-7:] == 'dreamer':
        next_s = s[:-7]
    if s[-5:] == 'erase':
        next_s = s[:-5]
    if s[-6:] == 'eraser':
        next_s = s[:-6]

    if s == next_s:
        print('NO')
        exit()

    s = next_s

print('YES')

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

s = 'HAKUTYUMU' + input()


def check(s):
    next_s = s

    if s[-5:] == 'dream':
        next_s = s[:-5]
    if s[-7:] == 'dreamer':
        next_s = s[:-7]
    if s[-5:] == 'erase':
        next_s = s[:-5]
    if s[-6:] == 'eraser':
        next_s = s[:-6]

    if s == 'HAKUTYUMU':
        return True

    if s == next_s:
        return False

    return check(next_s)


if check(s):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
s = 'HAKUTYUMU' + input()


def check(s):
    next_s = s

    if s[-5:] == 'dream':
        next_s = s[:-5]
    if s[-7:] == 'dreamer':
        next_s = s[:-7]
    if s[-5:] == 'erase':
        next_s = s[:-5]
    if s[-6:] == 'eraser':
        next_s = s[:-6]

    if s == 'HAKUTYUMU':
        return True

    if s == next_s:
        return False

    return check(next_s)


if check(s):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
s = 'HAKUTYUMU' + input()


def check(s):
    next_s = s

    if s[-5:] == 'dream':
        next_s = s[:-5]
    if s[-7:] == 'dreamer':
        next_s = s[:-7]
    if s[-5:] == 'erase':
        next_s = s[:-5]
    if s[-6:] == 'eraser':
        next_s = s[:-6]

    if s == 'HAKUTYUMU':
        return True

    if s == next_s:
        return False

    return check(next_s)


if check(s):
    print('YES')
else:
    print('NO')
Problem p04043 (python)

Fixed submission:
A=list(map(int,input().split()))
ans=sorted(A)
if ans==[5,5,7]:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
A=list(map(input().split()))
ans=sorted(A)
if ans==[5,5,7]:
  print('YES')
else:
  print('NO')
Problem p02617 (python)

Fixed submission:
n = int(input())
ans = n*(n+1)*(n+2)//6
for i in range(n-1):
  a, b = map(int, input().split())
  if b < a:
    a, b = b, a
  ans -= a*(n-b+1)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = n*(n+1)*(n+2)//6
for i in range(n):
  a, b = map(int, input().split())
  if b < a:
    a, b = b, a
  ans -= a*(n-b+1)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = n*(n+1)*(n+2)//6
for i in range(n-1):
  a, b = map(int, input.split())
  ans -= a*(n-b+1)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = n*(n+1)*(n+2)//6
for i in range(n):
  a, b = map(int, input.split())
  ans -= a*(n-b+1)
print(ans)
Problem p03136 (python)

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

L.sort()

if sum(L[:-1]) > L[-1]:
    ans = "Yes"
else: ans = "No"

print(ans)

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

L.sort
if sum(L[:-1]) > L[-1]
    ans = "Yes"
else: ans = "No"

print(ans)
Problem p03262 (python)

Fixed submission:
def gcd(a, b):

	while b:

		a, b = b, a % b

	return a

N, X = map(int, input().split())
x = list(map(int, input().split()))

x2 = [abs(i-X) for i in x]

D = x2[0]
for i in range(N-1):
    D = gcd(D, x2[i+1])

print(D)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if a<b:
        temp = a
        a = b
        b = temp

    r = a%b
    
    while r>0:
        r = a%b
        a = b
        b = r
    
    return b

        

N, X = map(int, input().split())
x = list(map(int, input().split()))

x2 = [abs(i-X) for i in x]

D = x2[0]
for i in range(N-1):
    D = gcd(D, x2[i+1])

print(D)