Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import numpy as np

N, M = [int(x) for x in stdin.readline().split()]
A = np.array([int(a) for a in stdin.readline().split()], dtype=np.int64)

cumsum_remainders = (np.hstack([0, A]) % M).cumsum() % M

total = 0
for remainder in np.unique(cumsum_remainders):
    count = (cumsum_remainders == remainder).sum()
    total += count * (count - 1) // 2
print(total)


Fixed submission:
from sys import stdin
from collections import Counter
import numpy as np

N, M = [int(x) for x in stdin.readline().split()]
A = np.array([int(a) for a in stdin.readline().split()], dtype=np.int64)

cum_remainders = (np.hstack([0, A]) % M).cumsum() % M

remainder_counts = Counter(cum_remainders)
combinations = 0
for count in remainder_counts.values():
    combinations += count * (count - 1) // 2
print(combinations)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import numpy as np

N, M = [int(x) for x in stdin.readline().split()]
A = np.array([int(a) for a in stdin.readline().split()], dtype=np.int64)

B = (np.hstack([0, A]) % M).cumsum() % M

total = 0
for remainder in np.unique(B):
    count = (B == remainder).sum()
    total += count * (count - 1) // 2
print(total)


Fixed submission:
from sys import stdin
from collections import Counter
import numpy as np

N, M = [int(x) for x in stdin.readline().split()]
A = np.array([int(a) for a in stdin.readline().split()], dtype=np.int64)

cum_remainders = (np.hstack([0, A]) % M).cumsum() % M

remainder_counts = Counter(cum_remainders)
combinations = 0
for count in remainder_counts.values():
    combinations += count * (count - 1) // 2
print(combinations)
Buggy python submission (verdict: Runtime Error):
S = input()

if S[0] == 'A' and S[2:-1].count('C') == 1 and sum([c.isupper for c in S]) == 2:
    print('AC')
else:
    print('WA')


Fixed submission:
from sys import stdin

S = stdin.readline().rstrip()

cond1 = S[0] == 'A'
cond2 = S.count('C', 2, -1) == 1
cond3 = S.replace('A', '').replace('C', '').islower()

if cond1 and cond2 and cond3:
    print('AC')
else:
    print('WA')
Buggy python submission (verdict: Runtime Error):
a = map(int,input().split())
print(sum(a) - max(a))

Fixed submission:
a = list(map(int,input().split()))
print(sum(a) - max(a))
Buggy python submission (verdict: Runtime Error):
r, d, x = map(int, input().split())
for _ in range(10):
	x = x * r - d
    print(x)


Fixed submission:
r, d, x = map(int, input().split())
for _ in range(10):
    x = x * r - d
    print(x)
Buggy python submission (verdict: Runtime Error):
D = int(input)
print('Christmas' + ' Eve' * (25 - D))


Fixed submission:
D = int(input())
print('Christmas' + ' Eve' * (25 - D))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]

def f(a, offset=0):
    ans = 0
    # if len(a) % 2 == 0:
    #     last = a[0]
    # else:
    init = n // 2 + offset
    last = a[init]
    for i in range(n - 1):
        j = i // 2 if i % 2 == 0 else n - 1 - i // 2
        if j == init:
            break
        ans += abs(a[j] - last)
        last = a[j]
    return ans

# print(f(sorted(a)))
# print(f(sorted(a, reverse=True)))
a = sorted(a)
arev = sorted(a, reverse=True)
print(max(
    f(a),
    f(arev),
    f(a, offset = 1),
    f(arev, offset = 1),
))


Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]

def f(a, offset=0):
    global n
    ans = 0
    # if len(a) % 2 == 0:
    #     last = a[0]
    # else:
    init = min(n // 2 + offset, n - 1)
    last = a[init]
    for i in range(n - 1):
        j = i // 2 if i % 2 == 0 else n - 1 - i // 2
        if j == init:
            break
        ans += abs(a[j] - last)
        last = a[j]
    return ans

# print(f(sorted(a)))
# print(f(sorted(a, reverse=True)))
a = sorted(a)
arev = sorted(a, reverse=True)
print(max(
    f(a),
    f(arev),
    f(a, offset = 1),
    f(arev, offset = 1),
))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
s = input()
t = input()

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


l = n * m // gcd(n, m)

ok = True
nn = l // n
mm = l // m

for i in range(l):
    if i % nn == 0 and i % mm == 0:
        if i // nn > n:
            continue
        if i // mm > m:
            continue
        if s[i // nn] != t[i // mm]:
            ok = False

print(l if ok else -1)


Fixed submission:
n, m = map(int, input().split())
s = input()
t = input()

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


l = n * m // gcd(n, m)

ok = True
nn = l // n
mm = l // m

i = 0
j = 0

while True:
    if i < j:
        i += nn
    elif j < i:
        j += mm
    else:
        if i // nn < n and j // mm < m:
            if s[i // nn] != t[j // mm]:
                ok = False
        else:
            break
        i += nn
    #print(i, j, nn, mm)

print(l if ok else -1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
l1 = [li for i, li in enumerate(l) if i % 2 == 0]
l2 = [li for i, li in enumerate(l) if i % 2 == 1]
print(l1, l2)
def cnt(l):
    d = {}
    for li in l:
        if li in d:
            d[li] += 1
        else:
            d[li] = 1
    d = [(li, cnt) for li, cnt in d.items()]
    d = sorted(d, key=lambda di: di[0], reversed=True)
    return d

k1 = cnt(l1)[:2]
k2 = cnt(l2)[:2]

ans = 10000000
if k1[0][0] != k2[0][0]:
    ans = n - k1[0][1] - k2[0][1]
else:
    if len(k1) == 2:
        ans = n - k1[1][1] - k2[0][1]
    if len(k2) == 2:
        ans = min(ans, n - k1[0][1] - k2[0][1])
    if ans == 10000000:
        ans = n - max(k1[0][1], k2[0][1])
print(ans)




Fixed submission:
n = int(input())
l = list(map(int, input().split()))
l1 = [li for i, li in enumerate(l) if i % 2 == 0]
l2 = [li for i, li in enumerate(l) if i % 2 == 1]
def cnt(l):
    d = {}
    for li in l:
        if li in d:
            d[li] += 1
        else:
            d[li] = 1
    d = [(li, cnt) for li, cnt in d.items()]
    return sorted(d, key=lambda di: di[1], reverse=True)

k1 = cnt(l1)[:2]
k2 = cnt(l2)[:2]
ans = 10000000
if k1[0][0] != k2[0][0]:
    ans = n - k1[0][1] - k2[0][1]
if len(k1) == 2:
    ans = min(ans, n - k1[1][1] - k2[0][1])
if len(k2) == 2:
    ans = min(ans, n - k1[0][1] - k2[1][1])
if ans == 10000000:
    ans = n - max(k1[0][1], k2[0][1])
print(ans)
Buggy python submission (verdict: Runtime Error):
n, m, d = map(int, input().split())
if d == 0:
    print(f'{n * (m - 1) / (n * n):.10f}')
else:
    print(f'{2 * (n - d) * (m - 1) / (n * n):.10f}')


Fixed submission:
n, m, d = map(int, input().split())
if d == 0:
    ans = n * (m - 1) / (n * n)
else:
    ans = 2 * (n - d) * (m - 1) / (n * n)
print('{0:.10f}'.format(ans))
Buggy python submission (verdict: Runtime Error):
print('ABC' if int(intput()) < 1000 else 'ABD')


Fixed submission:
print('ABC' if int(input()) < 1000 else 'ABD')
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
K = int(input())
n = len(S)

ans = []
st = set()

for i in range(n):
    for j in range(i + 1, n + 1):
        sub = S[i:j]
        # print(sub)
        if sub in st:
            continue
        st.add(sub)
        ans.append(sub)
        ans.sort()
        # print(ans)
        if len(ans) > K:
            ans = ans[:K]

print(ans[-1])


Fixed submission:
S = input()
K = int(input())
n = len(S)

ans = []
st = set()

for i in range(n):
    for j in range(i + 1, min(n + 1, i + 1 + K)):
        sub = S[i:j]
        # print(sub)
        if sub in st:
            continue
        st.add(sub)
        ans.append(sub)
        ans.sort()
        # print(ans)
        if len(ans) > K:
            ans = ans[:K]

print(ans[-1])
Buggy python submission (verdict: Runtime Error):
S = input()
if len(S) < 26:
    for i in range(26):
        c = chr(i + ord('a'))
        if c not in S:
            print(S + c)
            break
else:
    tmp = 26
    for i in range(len(S) - 1, 0, -1):
        if ord(S[i - 1]) < ord(S[i]):
            break
        tmp = i
    tmp -= 1
    if tmp == 0:
        print(-1)
    c = ord(S[:tmp][-1])
    suf = S[tmp:]
    print(S[:tmp - 1] + chr(min([ord(si) for si in suf if ord(si) > c])))


Fixed submission:
S = input()
if len(S) < 26:
    for i in range(26):
        c = chr(i + ord('a'))
        if c not in S:
            print(S + c)
            break
else:
    tmp = 26
    for i in range(len(S) - 1, 0, -1):
        if ord(S[i - 1]) < ord(S[i]):
            break
        tmp = i
    tmp -= 1
    if tmp == 0:
        print(-1)
    else:
        c = ord(S[:tmp][-1])
        suf = S[tmp:]
        print(S[:tmp - 1] + chr(min([ord(si) for si in suf if ord(si) > c])))
Buggy python submission (verdict: Runtime Error):
s = input()
s[3] = '8'
print(s)


Fixed submission:
s = input()
s = s[0:3] + '8' + s[4:]
print(s)
Buggy python submission (verdict: Runtime Error):

N = int(input())
inp = [int (x) for x in input().split(" ")]

refs = [0 for _ in range(N)]
k = len(inp) - 1
rev = True
for i in range(N):
    refs[i] = k
    if k == 1 and rev:
        k = -2
        rev = False
    if k == 0 and rev:
        k = -1
        rev = False
    k = k - 2 if rev else k + 2

#print(" ".join([str(x) for x in refs]))


for i in range(N):
    refs[i] = inp[refs[i]]

print(" ".join([str(x) for x in refs]))


Fixed submission:
x = [int(i) for i in input().split(" ")]
x.sort()
print(x[0] + x[1])
Buggy python submission (verdict: Runtime Error):
# input
NW = [int(x) for x in input().split(" ")]
N = NW[0]
W = NW[1]

w = []
v = []

for _ in range(N):
	wv = [int(x) for x in input().split(" ")]
	w.append(wv[0])
	v.append(wv[1])

# 品物i-Nまでを使って容量Wのナップサックにいれられる品物の価値の総和の最大値
def rec(i, Wrec):
	if i >= N:
		return 0

	a = -1
	if Wrec - w[i] >= 0:
		a = v[i]+rec(i+1, Wrec-w[i])
	return max(
		a, #品物iを入れる
		rec(i+1, Wrec) #品物iを入れない
		)

print(rec(0,W))

Fixed submission:
words = input().split(" ")

shiritori = "YES"

end = None

for word in words:
	if end is not None:
		if end != word[0]:
			shiritori = "NO"
			break
	end = word[-1]

print(shiritori)

Buggy python submission (verdict: Runtime Error):

T = int(input().split(" ")[1])
t = [int(x) for x in input().split(" ")]
t.append(100000000000)

ret = 0

for i in range(len(t)-1):
	ret += min(T,t[i+1] - t[i])

print(ret)

Fixed submission:
words = input().split(" ")

shiritori = "YES"

end = None

for word in words:
	if end is not None:
		if end != word[0]:
			shiritori = "NO"
			break
	end = word[-1]

print(shiritori)
Buggy python submission (verdict: Runtime Error):
inputs = [int(x) for x in input().split(" ")]
A = inputs[0]
B = inputs[1]


if A > B:
	print("GREATER")
elif A < B:
	print("LESS")
else:
	print("EQUAL")

Fixed submission:

A = int(input())
B = int(input())


if A > B:
	print("GREATER")
elif A < B:
	print("LESS")
else:
	print("EQUAL")
Buggy python submission (verdict: Runtime Error):
(A, B, C) = [int(x) for x in input().split(" ")]

if b - a == c - b:
	print("YES")
else:
	print("NO")


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

if B - A == C - B:
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Runtime Error):
import sys

S = input()

while S:
    prefix = S[0:5]
    if prefix == 'dream':
        if S[5:7] == 'er':
            if len(S) >= 8 and S[7] == 'a':
                S = S[5:]
            else:
                S = S[7:]
        else:
            S = S[5:]
    elif prefix == 'erase':
        if len(S) >= 6 and S[5] == 'r':
            S = S[6:]
        else:
            S = S[5:]
    else:
        print('NO')
        sys.exit(0)
    print(S)
print('YES')


Fixed submission:
import sys

S = input()

while S:
    prefix = S[0:5]
    if prefix == 'dream':
        if S[5:7] == 'er':
            if len(S) >= 8 and S[7] == 'a':
                S = S[5:]
            else:
                S = S[7:]
        else:
            S = S[5:]
    elif prefix == 'erase':
        if len(S) >= 6 and S[5] == 'r':
            S = S[6:]
        else:
            S = S[5:]
    else:
        print('NO')
        sys.exit(0)
    # print(S)
print('YES')

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

S = input()

while S:
    prefix = S[0:5]
    if prefix == 'dream':
        if S[5:7] == 'er':
            if len(S) > 8 and S[7] == 'a':
                S = S[5:]
            else:
                S = S[7:]
        else:
            S = S[5:]
    elif prefix == 'erase':
        if S[5] == 'r':
            S = S[6:]
        else:
            S = S[5:]
    else:
        print('NO')
        sys.exit(0)
    # print(S)
print('YES')


Fixed submission:
import sys

S = input()

while S:
    prefix = S[0:5]
    if prefix == 'dream':
        if S[5:7] == 'er':
            if len(S) >= 8 and S[7] == 'a':
                S = S[5:]
            else:
                S = S[7:]
        else:
            S = S[5:]
    elif prefix == 'erase':
        if len(S) >= 6 and S[5] == 'r':
            S = S[6:]
        else:
            S = S[5:]
    else:
        print('NO')
        sys.exit(0)
    # print(S)
print('YES')

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

S = input()

while S:
    prefix = S[0:5]
    if prefix == 'dream':
        if S[5:7] == 'er':
            if S[7] == 'a':
                S = S[5:]
            else:
                S = S[7:]
        else:
            S = S[5:]
    elif prefix == 'erase':
        if S[5] == 'r':
            S = S[6:]
        else:
            S = S[5:]
    else:
        print('NO')
        sys.exit(0)
    # print(S)
print('YES')


Fixed submission:
import sys

S = input()

while S:
    prefix = S[0:5]
    if prefix == 'dream':
        if S[5:7] == 'er':
            if len(S) >= 8 and S[7] == 'a':
                S = S[5:]
            else:
                S = S[7:]
        else:
            S = S[5:]
    elif prefix == 'erase':
        if len(S) >= 6 and S[5] == 'r':
            S = S[6:]
        else:
            S = S[5:]
    else:
        print('NO')
        sys.exit(0)
    # print(S)
print('YES')
Buggy python submission (verdict: Runtime Error):
import math
import Decimal
a,b,c=map(int, input().split())

if a+2*math.sqrt(a*b)+b<c:
  print('Yes')
else:
  print('No')


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


if c-a-b<0:
  print('No')

elif 4*b*a<(c-a-b)**2:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
def main():
  d=deque(list(input()))
  Q=int(input())
  for i in range(Q):
    q=list(map(str, input().split()))
    if q[0]=='1':
      d.reverse()
    else:
      if q[1]=='1':
        d.appendleft(q[2])
      else:
        d.append(q[2])
  print(''.join(list(d)))
main()

Fixed submission:
from collections import deque
def main():
  d=deque(list(input()))
  Q=int(input())
  rev=0
  for i in range(Q):
    q=list(map(str, input().split()))
    if q[0]=='1':
      rev+=1
    else:
      if (int(q[1])+rev)%2==1:
        d.appendleft(q[2])
      else:
        d.append(q[2])
  if rev%2==0:
    print(''.join(list(d)))
  else:
    d.reverse()
    print(''.join(list(d)))
main()
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
P=list(map(int, input().split()))

ans=0
for i in range(N):
  flag=True
  for j in range(i):
    if P[i]>P[j]:
      flag=False
      break
  if flag:
    ans+=1
print(ans)

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

ans=1
mi=P[0]
for i in range(1,N):
  if P[i]<=mi:
    ans+=1
    mi=P[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
N=int(input())
A=list(map(int, input().split()))

MOD=int(10**9+7)

g=A[0]
for i in range(1, N):
    g = (g*A[i])//fractions.gcd(g, A[i])
ans=0
for i in range(N):
  ans+=(g//A[i])%MOD
  ans%=MOD
print(ans)

Fixed submission:
import fractions
N=int(input())
A=list(map(int, input().split()))

MOD=10**9+7

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

g=A[0]
for i in range(1, N):
    g = g*A[i]//fractions.gcd(g, A[i])
ans=0
g%=MOD
for i in range(N):
  ans+=g*modinv(A[i],MOD)
  ans%=MOD
print(ans)

Buggy python submission (verdict: Runtime Error):
import fractions
N=int(input())
A=list(map(int, input().split()))

MOD=10**9+7

g=A[0]
for i in range(1, N):
    g = g*A[i]//fractions.gcd(g, A[i])
ans=0
for i in range(N):
  ans+=int(g/A[i])%MOD
  ans%=MOD
print(ans)

Fixed submission:
import fractions
N=int(input())
A=list(map(int, input().split()))

MOD=10**9+7

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

g=A[0]
for i in range(1, N):
    g = g*A[i]//fractions.gcd(g, A[i])
ans=0
g%=MOD
for i in range(N):
  ans+=g*modinv(A[i],MOD)
  ans%=MOD
print(ans)
Buggy python submission (verdict: Runtime Error):
from itertools import permutations as p
N=int(input())
l=list(p(range(1,N+1)))

A=tuple(map(int, input().split()))
B=tuple(map(int, input().split()))

fa=True
fb=True
for i in range(len(l)):
  if l[i]==A and fa:
    idx_a=i
    fa=False
  elif l[i]==B and fb:
    idx_b=i
    fb=False
  if (not fa) and (not fb):
    break
print(abs(idx_a-idx_b))
  

Fixed submission:
from itertools import permutations as p
N=int(input())
l=list(p(range(1,N+1)))

A=tuple(map(int, input().split()))
B=tuple(map(int, input().split()))

fa=True
fb=True
for i in range(len(l)):
  if l[i]==A and fa:
    idx_a=i
    fa=False
  if l[i]==B and fb:
    idx_b=i
    fb=False
  if (not fa) and (not fb):
    break
print(abs(idx_a-idx_b))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
temp=list(map(int, input().split()))
N=temp[0]
A=temp[1]
B=temp[2]
cnt=0
if (B-A)%2==1:
  if A-1<=N-B:
    cnt=A
    B-=A
    A=1
  else:
    cnt=N-B+1
    A+=(N-B)+1
    B=N
while A!=B:
    if B-A>=2:
      A+=1
      B-=1
      cnt+=1
print(cnt)

Fixed submission:
import sys
temp=list(map(int, input().split()))
N=temp[0]
A=temp[1]
B=temp[2]
cnt=0
if (B-A)%2==1:
  if A-1<=N-B:
    cnt=A
    B-=A
    A=1
  else:
    cnt=N-B+1
    A+=(N-B)+1
    B=N
if A!=B:
  cnt+=(B-A)//2
print(cnt)
Buggy python submission (verdict: Runtime Error):
import os
import math
import itertools
import numpy as np

N=int(input())
A=np.zeros((8,2)).astype(int)
for i in range(N):
  temp=list(map(int, input().split()))
  A[i,0]=temp[0]
  A[i,1]=temp[1]


  
def distance(x1,y1,x2,y2):
  return math.sqrt((x1-x2)**2+(y1-y2)**2)



order=list(itertools.permutations(range(N)))

tab=np.zeros((N,N))
for i in range(N):
  for j in range(i+1,N):
    tab[i,j]=distance(A[i,0],A[i,1],A[j,0],A[j,1])
    tab[j,i]=distance(A[i,0],A[i,1],A[j,0],A[j,1])
    
ret=0
C=math.factorial(N)      
for i in range(C):
  o=order[i]
  for j in range(1,N):
    ret+=tab[o[j],o[j-1]]
print(ret/C)
    

Fixed submission:
import os
import math
import itertools
import numpy as np

N=int(input())
A=np.zeros((8,2)).astype(int)
for i in range(N):
  temp=list(map(int, input().split()))
  A[i,0]=temp[0]
  A[i,1]=temp[1]


  
def distance(x1,y1,x2,y2):
  return math.sqrt((x1-x2)**2+(y1-y2)**2)



order=list(itertools.permutations(range(N)))

tab=np.zeros((N,N))
for i in range(N):
  for j in range(i+1,N):
    tab[i,j]=distance(A[i,0],A[i,1],A[j,0],A[j,1])
    tab[j,i]=distance(A[i,0],A[i,1],A[j,0],A[j,1])
    
ret=0
C=math.factorial(N)      
for i in range(C):
  o=order[i]
  for j in range(1,N):
    ret+=tab[o[j],o[j-1]]
print(ret/C)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a=input().split()
sum=0
for i in a:
  sum+=int(a)>=k
print(sum)

Fixed submission:
n, k = map(int, input().split())
a=input().split()
sum=0
for i in a:
  sum+=int(int(i)>=k)
print(sum)
Buggy python submission (verdict: Runtime Error):
if input()=='Sunny':
  print('Cloudy')

elif input()=='Cloudy':
  print('Rainy')

else:
  print('Sunny') 

Fixed submission:
w=input()

if w=='Sunny':
  print('Cloudy')

elif w=='Cloudy':
  print('Rainy')

else:
  print('Sunny')
Buggy python submission (verdict: Runtime Error):
line=input()

a=['R','U','D']
b=['L','U','D']
flag=True

for i in range(len(line)):
  if (i+1)%2==1:
    if line[i] not in a:
      fline=input()

a=['R','U','D']
b=['L','U','D']
flag=True

for i in range(len(line)):
  if not flag:
    print(flag)
    break
  if (i+1)%2==1:
    if line[i] not in a:
      flag=False
      print('No')
  else:
    if line[i] not in b:
      flag=False
      print('No')
if flag==True:
  print('Yes') lag==False
      print('No')
      break
  else:
    if line[i] not in b:
      flag==False
      print('No')
      break

if flag:
  print('Yes')         

Fixed submission:
line=input()

a=['R','U','D']
b=['L','U','D']
flag=True

for i in range(len(line)):
  if not flag:
    break
  if (i+1)%2==1:
    if line[i] not in a:
      flag=False
      print('No')
  else:
    if line[i] not in b:
      flag=False
      print('No')
if flag==True:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N,K,Q=map(int, input().split())

import numpy as np
p=np.zeros(N).astype(int)+K

for i in range(Q):
  j=int(input())-1
  p[j]=p[j]+1
  p=p-1
  
for i in range(N):
  if p[i]<1:
    print('No')
  else:
    print('Yes')

Fixed submission:
import sys
input = sys.stdin.readline

N,K,Q=map(int, input().split())

p=[-Q]*N

for i in range(Q):
  j=int(input())-1
  p[j]=p[j]+1

for i in range(N):
  if p[i]+K<1:
    print('No')
  else:
    print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N,K,Q=map(int, input().split())

import numpy as np
p=np.zeros(N).astype(int)+K

for i in range(Q):
  j=int(input())-1
  p[j]=p[j]+1
  p=p-1
  
for i in range(N):
  if p[i]<1:
    print('No')
  else:
    print('Yes')

Fixed submission:
import sys
input = sys.stdin.readline

N,K,Q=map(int, input().split())

p=[-Q]*N

for i in range(Q):
  j=int(input())-1
  p[j]=p[j]+1

for i in range(N):
  if p[i]+K<1:
    print('No')
  else:
    print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int, input().split())

import numpy as np
p=np.zeros(N).astype(int)+K

for i in range(Q):
  j=int(input())-1
  p[j]=p[j]+1
  p=p-1
  
for i in range(N):
  if p[i]<1:
    print('No')
  else:
    print('Yes')

Fixed submission:
import sys
input = sys.stdin.readline

N,K,Q=map(int, input().split())

p=[-Q]*N

for i in range(Q):
  j=int(input())-1
  p[j]=p[j]+1

for i in range(N):
  if p[i]+K<1:
    print('No')
  else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
temp=list(map(int, input().split()))
N=temp[0]
M=temp[1]

import numpy as np
a=np.zeros(M).astype(int)
b=np.zeros(M).astype(int)

check=np.zeros(M).astype(int)

for i in range(M):
  temp=list(map(int, input().split()))
  a[i]=temp[0]-1
  b[i]=temp[1]-1  

bridge=np.zeros(N-1).astype(int)
  
while(sum(check)!=M):
  cnt=np.zeros(N-1).astype(int)
  for i in range(M):
    if check[i]:
      continue
    cnt[a[i]:b[i]]+=1
    
  
  #カウント最大の橋を切る
  val=0
  for i in range(N-1):
    if val<cnt[i]:
      val=cnt[i]
      idx=i
  bridge[idx]=1
  for i in range(M):
    if check[i]:
      continue
    for j in range(a[i],b[i]):
      if bridge[j]:
        check[i]=1
print(sum(bridge))

Fixed submission:
import numpy as np

temp=list(map(int, input().split()))
N=temp[0]
M=temp[1]

A=np.zeros((M,2)).astype(int)

for i in range(M):
  temp=list(map(int, input().split()))
  temp[0]-=1
  temp[1]-=1
  A[i]=temp
idx=A[:,1].argsort()
a=[0]*M
b=[0]*M
for i in range(M):
  a[i]=A[idx[i],0]
  b[i]=A[idx[i],1]
flag=False
x=-1
ans=0
for i in range(M):
  if a[i]>x:
    x=b[i]-1
    ans+=1
print(ans)