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

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

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

ans = 0
pen = 0

for _ in range(m):
  p,s = input().split()
  p = int(p)
  
  if ls[p] == None:
    pass
  elif s == "WA":
    ls[p] += 1
  else:
    pen += ls[p]
    ls[p] = None
    ans +=1
print(ans,pen)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())

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

pen = 0

for _ in range(m):
  p,s = input().split()
  p = int(p)
  
  if ls[p] == None:
    pass
  elif s == "WA":
    ls[p] += 1
  else:
    pen += ls[p]
    ls[p] = None
print(sum(ls),pen)
Problem p02861 (python)

Fixed submission:
n = int(input())

ls = [list(map(int,input().split())) for _ in range(n)]

sum = 0
for i in range(n-1):
  for j in range(i+1,n):
    sum += ((ls[i][0]-ls[j][0])**2+(ls[i][1]-ls[j][1])**2)**0.5
    
print(sum*2/n)

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

ls = [map(int(input().split())) for _ in range(n)]

sum = 0
for i in range(n-1):
  for j in range(1,n):
    sum += ((ls[i][0]-ls[j][0])**2+(ls[i][1]-ls[j][1])**2)**0.5
    
print(sum*2/n)
Problem p02899 (python)

Fixed submission:
n = int(input())
 
ls = list(map(int,input().split()))
 
ans = [None]*n
 
for i in range(n):
  ans[ls[i]-1] = i+1
  
print(" ".join(map(str,ans)))

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

ls = list(map(int,input().split()))

ans = [None]*n

for i in range(n):
  ans[ls[i]-1] = i+1
  
print(" ".join(ans))
Problem p02900 (python)

Fixed submission:
def main():
  import fractions
  import math

  a,b = map(int,input().split())
  g = fractions.gcd(a,b)
  
  d = [1]
  num = 2

  while num**2 <= g:
    #print("num",num)
    if g%num == 0:
      d.append(num)
    while g%num == 0 and g>1:
      g = g//num
      #print(g)
    num += 1
  
  print(len(d) + (g > 1))

if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
import fractions
import math

a,b = map(int,input().split())

if a>b:
  a,b = b,a
  
n=fractions.gcd(a,b)

t = [True]*(2*n)
d = [1]

for i in range(2, n):
  if t[i] is False:
    continue
  if n % i == 0:
    d.append(i)
    for j in range(i+1, n):
      if j%i==0:
        t[j] = False
print(len(d))
Problem p02939 (python)

Fixed submission:
s = input()
n = len(s)

i = 0
tmp = ''
ans = 0
while i<n:
  
  if s[i] == tmp:
    if i == n-1:
      break
    tmp = s[i]+s[i+1]
    i+=2
  else:
    tmp = s[i]
    i+=1
  ans +=1
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
st = 0
ans = 0

finished = [b[i] == a[i] for i in range(n)]
fcount = sum(finished)
while fcount<n and ans>=0:
  for i in range(st,n):
    if not finished[i] and (b[i-1] <= b[i] >= b[(i+1) % n]):
      ans += (b[i]-a[i])//(b[i-1] + b[(i+1) % n])
      b[i] =a[i]+(b[i]-a[i]) % (b[i-1] + b[(i+1) % n])
      
      #print(b)
      if b[i] == a[i]:
        finished[i] = True
        fcount += 1
      elif b[i] < a[i]:
        ans = -1
        break
      st =(i-1)%n
      break
    elif i == n-1:
      st = 0
      
print(ans)
Problem p02995 (python)

Fixed submission:
def gcd(a, b):
  while b:
    a, b = b, a % b
  return a


a,b,c,d = map(int,input().split())

tot = b - a + 1
e = c*d//gcd(c,d)
ans = tot - (b//c-(a-1)//c) - (b//d-(a-1)//d) + (b//e-(a-1)//e)
print(int(ans))

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

tot = b - a + 1
e = c*d//math.gcd(c,d)
ans = tot - (b//c-(a-1)//c) - (b//d-(a-1)//d) + (b//e-(a-1)//e)
print(int(ans)  )
Problem p02999 (python)

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

if x>=a:
  print(10)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
w,h,x,y = map(int,input().split())


num = 0

if w%2 is 0 and h%2 is 0:
  if w//2 is x and h//2 is y:
  	num = 1
    num = 2/0
print(w*h/2,num)
Problem p03001 (python)

Fixed submission:
w,h,x,y = map(int,input().split())


num = 0

if w/2 == x and h/2 == y:
  num = 1
print(w*h/2,num)

Buggy submission (verdict: Runtime Error):
w,h,x,y = map(int,input().split())


num = 0

if w%2 is 0 and h%2 is 0:
  if w//2 is x and h//2 is y:
  	num = 1;a = 2/0
print(w*h/2,num)

Buggy submission (verdict: Runtime Error):
w,h,x,y = map(int,input().split())


num = 0

if w%2 is 0 and h%2 is 0:
  if w//2 is x and h//2 is y:
  	num = 1;num = 2/0
print(w*h/2,num)
Problem p03047 (python)

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

print(n-k+1)

Buggy submission (verdict: Runtime Error):
R,G,B,N = map(int,input().split())
a = sorted([R,G,B],reverse=True) 
R,G,B = a[0],a[1],a[2]

count = 0
for r in range(N//R+1):
  if r*R>N:break
  for g in range(N//G+1):
    if r*R+g*G>N: break
    for b in range(N//B+1):
      if  (r)*R+(g)*G+(b)*B == N:
        count += 1
print(count)
Problem p03059 (python)

Fixed submission:
l = list(map(int,input().split(" ")))
A = l[0]
B = l[1]
T = l[2]

print((T//A)*B)

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int,input().split(" ")))

count = 0
s = 1000000000
add = 0
for num in arr:
  if num < 0:
    count += 1
  s = min(s, abs(num))
  add += abs(num)

print(add-(count%2)*abs(s)*2)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
  
n = int(input())
arr = list(map(int,input().split(" ")))
list.sort(arr)

memoa = [None for i in range(n)]
memoa[0] = arr[0]
memob = [None for i in range(n)]
memob[0] = arr[-1]
for i in range(1,n):
  memoa[i] = gcd(memoa[i-1],arr[i])
  memob[i] = gcd(memob[i-1],arr[i])

m = 0
for i in range(len(arr)):
  if i is 0:
    ans = memob[n-2]
  elif i is n-1:
    ans = memoa[n-2]
  else:
    ans = gcd(memoa[i-1],memob[n-i-2])
      
  m = max(m, ans)
print(m)
Problem p03071 (python)

Fixed submission:
arr = list(map(int,input().split(" ")))
a = arr[0]
b = arr[1]

if a==b:
  print(2*a)
else:
  print(2*max(a,b)-1)

Buggy submission (verdict: Runtime Error):
k = int(input().split(" ")[1])
s = input()

arr = []
if s[0] is "0": 
  arr.append(0)
arr.append(1)
for i in range(1,len(s)):
  if s[i-1] is s[i]:
    arr[-1] += 1
  else:
    arr.append(1)
if s[-1] is "0": 
  arr.append(0)

t = 2*k+1
if t>len(s):
  print(len(s))
else:
  temp = sum(arr[0:t])
  m = temp
  for i in range(2,len(arr)-t+1,2):
    m = max(m,temp-arr[i-2]-arr[i-1]+arr[i+t-2]+arr[i+t-1])
  print(m)
#print(arr)
Problem p03136 (python)

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

a = sorted(a)

if sum(a[0:-1]) <= a[-1]:
  print("No")
else:
  print("Yes")

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

a = sorted(a)

if sum(a[0:-1]) > a[-1]:
  print("No")
else:
  print("Yes")

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

a = sorted(a)

if sum(a[0:-2]) > a[-1]:
  print("No")
else:
  print("Yes")
Problem p03162 (python)

Fixed submission:
N = int(input())
dp = [[0 for i in range(3)] for _ in range(N+1)] 

for i in range(1,N+1):
  ai,bi,ci = map(int,input().split())
  
  dp[i][0] = ai + max(dp[i-1][1],dp[i-1][2])
  dp[i][1] = bi + max(dp[i-1][0],dp[i-1][2])
  dp[i][2] = ci + max(dp[i-1][1],dp[i-1][0])
  
print(max(dp[N]))

Buggy submission (verdict: Runtime Error):
N = int(input())
dp = [[0 for _ in range(N+1)] for i in range(3)]

for i in range(1,N+1):
  ai,bi,ci = map(int,input().split())
  
  dp[i][0] = ai + max(dp[i-1][1],dp[i-1][2])
  dp[i][1] = bi + max(dp[i-1][0],dp[i-1][2])
  dp[i][2] = ci + max(dp[i-1][1],dp[i-1][0])
  
print(max(dp[N]))
Problem p02684 (python)

Fixed submission:
import math
from collections import defaultdict


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    visited = [-1 for _ in range(N)]
    visited[0] = 0

    current = 0
    th = -1
    per_loop = -1
    for i in range(1, N+1):
        current = A[current] - 1

        if visited[current] >= 0:
            # print(i, current, visited[current])
            per_loop = i - visited[current]
            th = visited[current]
            break
        else:
            visited[current] = i

    current = 0
    # print(th, per_loop)

    if K < th:
        num_rep = K
    else:
        num_rep = th + (K - th) % per_loop

    for i in range(num_rep):
        current = A[current] - 1

    print(current + 1)


if __name__ == '__main__':
    main()

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


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


def main():
    N, M, K = map(int, input().split())
    const = 998244353

    def hoge(k):
        return comb(N - 1, k) * M * ((M - 1) ** (N - k - 1))

    ans = sum([hoge(k) for k in range(K + 1)])

    print(ans % const)


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

Fixed submission:
import math


def main():
    X = int(input())

    MAX = 10 ** 9

    for b in range(0, MAX + 1):
        # b = 1,2,3...
        a = math.pow(abs(b ** 5 + X), 1 / 5)
        # print(f'b={b} a={a}')
        # print(f'b={b} a={a}')
        if round(a) ** 5 == abs(b ** 5 + X):
            if b ** 5 + X > 0:
                print(int(a), b)
                return
            else:
                print(-int(a), b)
                return

        # b = -1, -2, -3
        a = math.pow(abs(- b ** 5 + X), 1 / 5)
        # print(f'b={-b} a={a}')
        if round(a) ** 5 == abs(- b ** 5 + X):
            if - b ** 5 + X > 0:
                print(int(a), -b)
                return
            else:
                print(-int(a), -b)
                return

    raise ValueError()


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math


def main():
    X = int(input())

    MAX = int(math.pow(10 ** 10, 1 / 5))

    for b in range(0, MAX + 1):
        # b = 1,2,3...
        a = math.pow(abs(b ** 5 + X), 1 / 5)
        # print(f'b={b} a={a}')
        if a == int(a):
            if b ** 5 + X > 0:
                print(int(a), b)
            else:
                print(-int(a), b)
            return

        # b = -1, -2, -3
        a = math.pow(abs(- b ** 5 + X), 1 / 5)
        # print(f'b={-b} a={a}')
        if a == int(a):
            if - b ** 5 + X > 0:
                print(int(a), b)
            else:
                print(-int(a), b)
            return

    raise ValueError()


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math


def main():
    X = int(input())

    MAX = int(math.pow(10 ** 10, 1 / 5))

    for b in range(0, MAX + 1):
        a = math.pow(abs(b ** 5 + X), 1 / 5)
        # print(f'b={b} a={a}')
        if a == int(a):
            print(int(a), b)
            return

        a = math.pow(abs(b ** 5 - X), 1 / 5)
        # print(f'b={-b} a={a}')
        if a == int(a):
            print(-int(a), b)
            return

    raise ValueError()


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math


def main():
    X = int(input())

    MAX = 10**9
    MIN = 10**(-10)

    for B in range(0, MAX+1):
        a = math.pow(B**5 + X, 1/5)
        if abs(a - int(a)) < MIN:
            print(int(a), B)
            return

        a = math.pow(- B ** 5 + X, 1 / 5)
        if abs(a - int(a)) < MIN:
            print(int(a), B)
            return


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

Fixed submission:
import math

def main():

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

    a_l = A / 0.08
    a_m = (A + 1) / 0.08

    b_l = B / 0.1
    b_m = (B + 1) / 0.1

    l = max(a_l, b_l)
    m = min(a_m, b_m)

    c = math.ceil(l)

    if c < m:
        print(int(c))
    else:
        print(-1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

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

a_l = A / 0.08
a_m = (A+1) /0.08

l = max(a_l, b_l)
m = min(a_m, b_m)

c = math.ceil(l)

if c < m:
  print(int(c))
else:
  print(-1)
Problem p03323 (python)

Fixed submission:
a, b = (int(i) for i in input().split())

if a <= 8 and b <= 8:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
# a, b = (int(i) for i in input().split())
a = int(input())
b = int(input())

if a <= 8 and b <= 8:
    print('Yay!')
else:
    print(':(')
Problem p02922 (python)

Fixed submission:
import math

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

x = (B-1)/(A-1)

print(math.ceil(x))

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

print(math.ceil(B / A))
Problem p02995 (python)

Fixed submission:
from fractions import gcd

A, B, C, D = map(int, input().split())


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


nbc = B - B // C
nbd = B - B // D
nbl = B - B // lcm(C, D)

nac = A - 1 - ((A - 1) // C)
nad = A - 1 - ((A - 1) // D)
nal = A - 1 - ((A - 1) // lcm(C, D))

b = nbc + nbd - nbl
a = nac + nad - nal

print(b - a)

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

A, B, C, D = map(int, input().split())

np = (B - A + 1) + (-(B - A) // C)
nq = (B - A + 1) + (-(B - A) // D)


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


npq_ = (B - A + 1) + (-(B - A) // lcm(C, D))
print(np + nq - npq_ - 1)

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

A, B, C, D = map(int, input().split())

np = (B - A + 1) + (-(B - A) // C)
nq = (B - A + 1) + (-(B - A) // D)


def coprime(a, b):
    return gcd(a, b) == 1


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


if coprime(C, D) == True:
    npq = (B - A + 1) + (-(B - A) // (C * D))
    print(np + nq - npq)
else:
    npq_ = (B - A + 1) + (-(B - A) // lcm(C, D))
    print(np + nq - npq_ - 1)

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

A, B, C, D = map(int, input().split())

np = (B - A + 1) + (-(B - A) // C)
nq = (B - A + 1) + (-(B - A) // D)


def coprime(a, b):
    return gcd(a, b) == 1


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


if coprime(C, D) == True:
    npq = (B - A + 1) + (-(B - A) // (C * D))
    print(np + nq - npq)
else:
    npq_ = (B - A + 1) + (-(B - A) // lcm(C, D))
    print(np + nq - npq_ - 1)
Problem p03043 (python)

Fixed submission:
import numpy as np
import math

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


prob = []
if N >= K:
    p_e = (1 / N) * (N - K + 1)
    for i in range(1, K):
        p_i = (1 / N) * ((1 / 2) ** (math.ceil(np.log2(K / i))))
        prob.append(p_i)

else:
    p_e = 0
    for i in range(1, N+1):
        p_i = (1 / N) * ((1 / 2) ** (math.ceil(np.log2(K / i))))
        prob.append(p_i)


s = sum(prob) + p_e
print("{:.12f}".format(s))

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
 
N, K = map(int, input().split())
 
 
prob = []
if N >= K:
    p_e = (1 / N) * (N - K + 1)
    for i in range(1, K):
        p_i = (1 / N) * ((1 / 2) ** (math.ceil((np.log2(K / i))))
        prob.append(p_i)
else:
    p_e = 0
    for i in range(1, N+1):
        p_i = (1 / N) * ((1 / 2) ** (math.ceil((np.log2(K / i))))
        prob.append(p_i)
 
summer = sum(prob) + p_e
 
print("{:.12f}".format(summer))
Problem p03047 (python)

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

print(N-K+1)

Buggy submission (verdict: Runtime Error):
N, K = mapt(int, input().split())

print(N-K+1)
Problem p03624 (python)

Fixed submission:
S = sorted(list(set(input())))

alphabet = list('abcdefghijklmnopqrstuvwxyz')

for i in range(len(alphabet)):
    if alphabet[i] not in S:
        print(alphabet[i])
        exit()

print('None')

Buggy submission (verdict: Runtime Error):
S = sorted(list(set(input())))

alphabet = list('abcdefghijklmnopqrstuvwxyz')

if alphabet == S:
    print('None')
    exit()
elif len(S) == 1 and S[0] == 'a':
    print('b')
    exit()

for i in range(len(alphabet)):
    if S[i] == alphabet[i]:
        continue
    else:
        print(alphabet[i])
        exit()

Buggy submission (verdict: Runtime Error):
S = sorted(list(set(input())))

alphabet = list('abcdefghijklmnopqrstuvwxyz')

if alphabet == S:
    print('None')
    exit()

for i in range(len(alphabet)):
    if S[i] == alphabet[i]:
        continue
    else:
        print(alphabet[i])
        exit()
Problem p02658 (python)

Fixed submission:
ans = 1
flag = 0

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

if 0 in a:
    print(0)
else:
    for i in range(n):
        ans *= a[i]
        if ans > 1000000000000000000:
            flag = 1
            print(-1)
            break
    
    if flag == 0:
        print(ans)

Buggy submission (verdict: Runtime Error):
import operator
num = int(input())
a = list(map(int, input().split()))
result = reduce(operator.mul,a)
if result > 1000000000000000000:
    print(-1)
else:
    print(result)
Problem p02677 (python)

Fixed submission:
from sys import stdin
import sys, math

a, b, h, m = [int(x) for x in stdin.readline().rstrip().split()]

x = 30*h + 0.5*m
y = 6*m

z = abs(x-y)
if z > 180: z = 360 - z

c = a**2 + b**2 - 2*a*b*math.cos(math.radians(z))
c = math.sqrt(c)

print(c)

Buggy submission (verdict: Runtime Error):
from sys import stdin
import sys, math

a, b, h, m = [int(x) for x in stdin.readline().rstrip().split()]

x = 30*h + 0.5*m
y = 6*m

c = a**2 + b**2 - 2*a*b*abs(math.cos(math.radians(z)))
c = math.sqrt(c)

print(c)
Problem p02678 (python)

Fixed submission:
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque

n,m = [int(x) for x in stdin.readline().rstrip().split()]

d = {}
for i in range(m):
    a,b = [int(x) for x in stdin.readline().rstrip().split()]

    if a not in d:
        d[a] = [b]
    else:
        d[a].append(b)

    if b not in d:
        d[b] = [a]
    else:
        d[b].append(a)

sol = {}

m = [1]
while True:
    next_m = []
    for mm in m:
        b = d[mm]
        for bb in b:
            if bb not in sol:
                sol[bb] = mm
                next_m.append(bb)

    if len(next_m) == 0: break
    m = next_m

sol = sorted(sol.items())

print("Yes")
for v in sol[1:]:
    print(v[1])

Buggy submission (verdict: Runtime Error):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque

n,m = [int(x) for x in stdin.readline().rstrip().split()]

d = {}
for i in range(n):
    a,b = [int(x) for x in stdin.readline().rstrip().split()]

    if a not in d:
        d[a] = [b]
    else:
        d[a].append(b)

    if b not in d:
        d[b] = [a]
    else:
        d[b].append(a)

sol = {}

m = [1]
while True:
    next_m = []
    for mm in m:
        b = d[mm]
        for bb in b:
            if bb not in sol:
                sol[bb] = mm
                next_m.append(bb)

    if len(next_m) == 0: break
    m = next_m

sol = sorted(sol.items())

print("Yes")
for v in sol[1:]:
    print(v[1])
Problem p02787 (python)

Fixed submission:
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)


H, N = list(map(int, input().split()))
a = []
for i in range(N):
    a.append(list(map(int, input().split())))


dp = [0 for i in range(H+1)]

for h in range(1, H+1):
    dp[h] = min([dp[max(0, h-a[i][0])] + a[i][1] for i in range(N)])

print(dp[H])

Buggy submission (verdict: Runtime Error):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)


H, N = list(map(int, input().split()))
a = []
for i in range(N):
    a.append(list(map(int, input().split())))


dp = [0 for i in range(H+1)]

for h in range(1, H+1):
    dp[h] = min([dp[h-a[i][0]] + a[i][1] for i in range(N)])

print(dp[H])
Problem p02789 (python)

Fixed submission:
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N, M = map(int, input().split())

if N-M == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
if N-M == 0:
  print("Yes")
 else:
  print("No")
Problem p02910 (python)

Fixed submission:
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

S  = input()

for i in range(len(S)):
    if i % 2 == 0:
        if S[i] != 'R' and S[i] != 'U' and S[i] != 'D':
            print("No")
            sys.exit()
    else:
        if S[i] != 'L' and S[i] != 'U' and S[i] != 'D':
            print("No")
            sys.exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353
import numpy

S  = input()

for i in range(len(S)):
    if i % 2 == 0:
        if S[i] != 'R' and S[i] != 'U' and S[i] != 'D':
            print("No")
            sys.exit()
    else:
        if S[i] != 'L' and S[i] != 'U' and S[i] != 'D':
            print("No")
            sys.exit()

print("Yes")
Problem p02911 (python)

Fixed submission:
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

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

g = [0 for i in range(N)]

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

for i in range(N):
    if Q - g[i] >= K:
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353
import numpy

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

g = [0 for i in range(N)]

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

for i in range(N):
    if Q - g[i] >= K:
        print("No")
    else:
        print("Yes")