Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# A
n,m = map(int, input().split())
s = str(input())
t = str(input())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(a,b):
    return a*b/gcd(a,b)
l=int(lcm(n,m))
si = ti= 0
ss = tt = 1
for i in range(l):
    if ss<i:
        ss=int(ss+l/n)
        si+=1
    if tt<i:
        tt=int(tt+l/m)
        ti+=1
    if ss<=l and tt<=l and i<=ss and i<=tt and ss==tt:
        if s[si]!=t[ti]:
            print('-1')
            break
else:
    print(l)

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

u = gcd(n,m)
l = n*m//u
x = n//u
y = m//u
for i in range(u):
    # print(n, m, u, l, i, i*x, s[i*x], i*y, t[i*y])
    if s[i * x] != t[i * y]:
        print(-1)
        break
else:
    print(l)

Buggy python submission (verdict: Time Limit Exceeded):
# A
n,m = map(int, input().split())
s = str(input())
t = str(input())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(a,b):
    return a*b/gcd(a,b)
l=int(lcm(n,m))
ss = [i for i in range(1,l+1,int(l/n))]
# print(ss)
tt = [i for i in range(1,l+1,int(l/m))]
# print(tt)
ii = list(set(ss)&set(tt))
# print(ii)
for x in ii:
    if s[ss.index(x)] != t[tt.index(x)]:
        print('-1')
        break
else:
    print(l)

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

u = gcd(n,m)
l = n*m//u
x = n//u
y = m//u
for i in range(u):
    # print(n, m, u, l, i, i*x, s[i*x], i*y, t[i*y])
    if s[i * x] != t[i * y]:
        print(-1)
        break
else:
    print(l)
Buggy python submission (verdict: Runtime Error):
# 27
n,x = list(map(int, input().split()))
aa = list(map(int, input().split()))
aa.sort()
ans = 0
for a in aa:
    if x<a:
        break
    ans+=1
    x-=ai
else:    #for else文 - breakすると入らないことを利用=ループ完遂した場合の終端処理
    if x>0:
        ans-=1
print(ans)

Fixed submission:
# 27
n,x = map(int, input().split())
aa = list(map(int, input().split()))
aa.sort()
ans = 0
for a in aa:
    if x<a:
        break
    ans+=1
    x-=a
else:    #for else文 - breakすると入らないことを利用=ループ完遂した場合の終端処理
    if x>0:
        ans-=1
print(ans)

Buggy python submission (verdict: Runtime Error):
# 27
n,x = list(map(int, input().split()))
aa = list(map(int, input().split()))
aa.sort()
ans = 0
for a in aa:
    if x<a:
        break
    ans+=1
    x-=ai
else:    #for else文 - breakすると入らないことを利用=ループ完遂した場合の終端処理
    if x>0:
        ans-=1
print(num)

Fixed submission:
# 27
n,x = map(int, input().split())
aa = list(map(int, input().split()))
aa.sort()
ans = 0
for a in aa:
    if x<a:
        break
    ans+=1
    x-=a
else:    #for else文 - breakすると入らないことを利用=ループ完遂した場合の終端処理
    if x>0:
        ans-=1
print(ans)

Buggy python submission (verdict: Runtime Error):
# 27
n,x = list(map(int, input().split()))
aa = list(map(int, input().split()))
aa.sort()
ans = 0
for a in aa:
    if x<a:
        break
    ans+=1
    x-=ai
else:
    if x>0:
        ans-=1
print(num)

Fixed submission:
# 27
n,x = map(int, input().split())
aa = list(map(int, input().split()))
aa.sort()
ans = 0
for a in aa:
    if x<a:
        break
    ans+=1
    x-=a
else:    #for else文 - breakすると入らないことを利用=ループ完遂した場合の終端処理
    if x>0:
        ans-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
# 3
import math

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

def f(m,a):
    ans=0
    for i in a:
        ans+=m%i
    return ans

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    ans=numbers[0]
    for i in range(1,len(numbers)):
        ans=lcm_base(ans,numbers[i])
    return ans

m= lcm_list(a)-1
print(f(m,a))

Fixed submission:
# 3
import math

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

def f(m,a):
    ans=0
    for i in a:
        ans+=m%i
    return ans

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

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    ans=numbers[0]
    for i in range(1,len(numbers)):
        ans=lcm_base(ans,numbers[i])
    return ans

m= lcm_list(a)-1
print(f(m,a))

Buggy python submission (verdict: Runtime Error):
# 3
import math
from functools import reduce

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

def f(m,a):
    ans=0
    for i in a:
        ans+=m%i
    return ans

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

m= lcm_list(a)-1
# print(m)
print(f(m,a))

Fixed submission:
# 3
import math

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

def f(m,a):
    ans=0
    for i in a:
        ans+=m%i
    return ans

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

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    ans=numbers[0]
    for i in range(1,len(numbers)):
        ans=lcm_base(ans,numbers[i])
    return ans

m= lcm_list(a)-1
print(f(m,a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
def digitsum(x):
    array = list(map(int, list(str(x))))
    return sum(array)

dsum = [digitsum(a)+digitsum(n-a) for a in range(1,int(n/2))]
print(min(dsum))

Fixed submission:
n = int(input())
def digitsum(x):
    array = list(map(int, list(str(x))))
    return sum(array)

dsum = [digitsum(a)+digitsum(n-a) for a in range(1,int(n/2)+1)]
print(min(dsum))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

li,ri = 0,0
ans = 1
xor = 0
add = 0
for li in range(N-1):
    ri = li+1
    xor = A[li]
    add = A[li]
    ans += 1
    while ri < N and li <= ri:
        if xor ^ A[ri] == add + A[ri]:
            xor ^= A[ri]
            add += A[ri]
            ri += 1
            ans += xor == add
            # print(f'2   li:{li} ri:{ri} {A[li:ri]} ans:{ans} xor:{xor} add:{add}')
        else:
            break

print(ans)

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

li,ri = 0,0
ans = 0
xor = A[li]
add = A[li]
while ri < N and li <= ri:
    if xor == add:
        ans += ri - li +1
        ri += 1
        if ri < N:
            xor ^= A[ri]
            add += A[ri]
    else:
        if li < N:
            xor ^= A[li]
            add -= A[li]
        li += 1

print(ans)

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

li,ri = 0,0
ans = 1
xor = 0
add = 0
for li in range(N-1):
    ri = li+1
    xor = A[li]
    add = A[li]
    ans += 1
    while ri < N and li <= ri:
        if xor ^ A[ri] == add + A[ri]:
            xor ^= A[ri]
            add += A[ri]
            ri += 1
            ans += xor == add
            # print(f'2   li:{li} ri:{ri} {A[li:ri]} ans:{ans} xor:{xor} add:{add}')
        else:
            break

print(ans)

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

li,ri = 0,0
ans = 0
xor = A[li]
add = A[li]
while ri < N and li <= ri:
    if xor == add:
        ans += ri - li +1
        ri += 1
        if ri < N:
            xor ^= A[ri]
            add += A[ri]
    else:
        if li < N:
            xor ^= A[li]
            add -= A[li]
        li += 1

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

count=0
for i in range(n+1):
    for j in range(i+1,n+1):
        # print(aa[i:j], sum(aa[i:j]))
        summary = sum(aa[i:j])
        if summary==0:
            count+=1
print(count)

Fixed submission:
from collections import Counter
from itertools import accumulate
n = int(input())
aa = list(map(int, input().split()))

s =[0] +  list(accumulate(aa))
# print(s)
ans=0
for x in Counter(s).values():
    ans+= x * (x-1) //2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# ABC093B
a,b,k = map(int,input().split())
for x in range(a,b+1):
    if x<a+k or x>b-k:
        print(x)

Fixed submission:
# ABC093B
a,b,k = map(int,input().split())
xx =[]
for x in range(a,a+k):
    if x>b:
        break
    xx.append(x)
for x in range(b+1-k,b+1):
    if x<a:
        break
    xx.append(x)
for x in sorted(list(set(xx))):
    print(x)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=input()
import re
r = '[0-9]{}-[0-9]{}'.format(a,b)
if re.match(r'%s' % r, s) <> None:
    print('Yes')
else:
    print('No')


Fixed submission:
a,b=map(int,input().split())
s=input()
if s.count('-')==1 and s.index('-') ==a:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=input()
import re
r = '[0-9]{}-[0-9]{}'.format(a,b)
if re.match(r'%s' % r, s) <> None:
    print('Yes')
else:
    print('No')


Fixed submission:
a,b=map(int,input().split())
s=input()
if s.count('-')==1 and s.index('-') ==a:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
# 075B
h,w = map(int, input().split())
ss = [list(map(str,str(input()))) for _ in range(h)]
# print(ss)
def count_bombs(ss,i,j):
    count=0
    if ss[i][j]=='#':
        return '#'
    for y in [-1,0,1]:
        for x in [-1,0,1]:
#             print(i+y, x+j, count)
            if 0<=i+y<h and 0<=j+x<w and ss[i+y][j+x]=='#':
                count+=1
    return str(count)

for i in range(h):
    for j in range(w):
        ss[i][j] = count_bombs(ss,i,j)
#         print('## ',i,j,ss[i][j])
for s in ss:
    print(''.join(s))

Fixed submission:
# 073B
n = int(input())
ll = [list(map(int, input().split())) for _ in range(n)]
ans=0
for l in ll:
    ans += l[1] - l[0]+1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
aa = list(map(int, input().split()))

if n==1:
    print(1)
else:
    mode = None
    ans = 1
    for i in range(n-1):
        if aa[i] != aa[i+1]:
            if mode == None:
                mode = aa[i]<aa[i+1]
            if (aa[i] < aa[i+1]) != mode:
                ans+=1
                mode = aa[+1]<aa[i+2]
        # print(aa[i], aa[i+1], aa[i]<aa[i+1],  mode, ans)
    print(ans)


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

if n==1:
    print(1)
else:
    mode = None
    ans = 1
    for i in range(n-1):
        if aa[i] != aa[i+1]:
            if mode == None:
                mode = aa[i]<aa[i+1]
            elif (aa[i] < aa[i+1]) != mode:
                ans+=1
                mode = None
        # print(aa[i], aa[i+1], aa[i]<aa[i+1],  mode, ans)
    print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
aa = [0] * m
bb = [0] * m
cc = [0] * m
dd = [0] * m

for i in range(n):
    aa[i], bb[i] = map(int, input().split())
for i in range(m):
    cc[i], dd[i] = map(int, input().split())

distance = []
for i in range(n):
    d = [abs(aa[i] - cc[j]) + abs(bb[i] - dd[j]) for j in range(m)]
    print(d.index(min(d))+1)

Fixed submission:
n,m = map(int, input().split())
aa = [0] * n
bb = [0] * n
cc = [0] * m
dd = [0] * m

for i in range(n):
    aa[i], bb[i] = map(int, input().split())
for i in range(m):
    cc[i], dd[i] = map(int, input().split())

for i in range(n):
    d = [abs(aa[i] - cc[j]) + abs(bb[i] - dd[j]) for j in range(m)]
    print(d.index(min(d))+1)

Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
aa = [0] * m
bb = [0] * m
cc = [0] * m
dd = [0] * m

for i in range(n):
    aa[i], bb[i] = map(int, input().split())
for i in range(m):
    cc[i], dd[i] = map(int, input().split())

distance = []
for i in range(n):
    d = []
    for j in range(m):
        d_ = abs(aa[i] - cc[j]) + abs(bb[i] - dd[j])
        d.append(d_)
    distance.append(d)
for d in distance:
    print(d.index(min(d))+1)

Fixed submission:
n,m = map(int, input().split())
aa = [0] * n
bb = [0] * n
cc = [0] * m
dd = [0] * m

for i in range(n):
    aa[i], bb[i] = map(int, input().split())
for i in range(m):
    cc[i], dd[i] = map(int, input().split())

for i in range(n):
    d = [abs(aa[i] - cc[j]) + abs(bb[i] - dd[j]) for j in range(m)]
    print(d.index(min(d))+1)

Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
aa = [0] * m
bb = [0] * m
cc = [0] * m
dd = [0] * m

for i in range(n):
    aa[i], bb[i] = map(int, input().split())
for i in range(m):
    cc[i], dd[i] = map(int, input().split())

distance = []
for i in range(n):
    d = []
    for j in range(m):
        d_ = abs(aa[i] - cc[j]) + abs(bb[i] - dd[j])
        d.append(d_)
        print('({}, {})  ({}, {}) :{}'.format(aa[i],bb[i],cc[j],dd[j], d_))
    distance.append(d)
for d in distance:
    print(d.index(min(d))+1)

Fixed submission:
n,m = map(int, input().split())
aa = [0] * n
bb = [0] * n
cc = [0] * m
dd = [0] * m

for i in range(n):
    aa[i], bb[i] = map(int, input().split())
for i in range(m):
    cc[i], dd[i] = map(int, input().split())

for i in range(n):
    d = [abs(aa[i] - cc[j]) + abs(bb[i] - dd[j]) for j in range(m)]
    print(d.index(min(d))+1)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = [0]*M
b = [0]*M
for i in range(M):
    a_, b_ = map(int,input().split())
    # 配列の添字としたいので-1
    a[i] = a_ -1
    b[i] = b_ -1

route = [0]*N  # 通過済
connect=[[0]*M for _ in range(M)]
def dfs(now, depth):
    # print("#"*depth,now, depth)
    # 通過済ならNG
    if route[now]: return 0
    # depth = Nなら達成
    if depth == N: return 1
    
    route[now] = 1
    ans = 0
    for i in range(N):
        if connect[now][i]:
            ans += dfs(i, depth+1)
    route[now] = 0
    return ans

for i in range(M):
    connect[a[i]][b[i]] = connect[b[i]][a[i]] = 1

# for xx in connect:
#     print(xx)
print(dfs(0,1))

Fixed submission:
N,M = map(int,input().split())
a = [0]*M
b = [0]*M
for i in range(M):
    a_, b_ = map(int,input().split())
    # 配列の添字としたいので-1
    a[i] = a_ -1
    b[i] = b_ -1

route = [0]*N  # 通過済
connect=[[0]*N for _ in range(N)]
def dfs(now, depth):
    # print("#"*depth,now, depth)
    # 通過済ならNG
    if route[now]: return 0
    # depth = Nなら達成
    if depth == N: return 1
    
    route[now] = 1
    ans = 0
    for i in range(N):
        if connect[now][i]:
            ans += dfs(i, depth+1)
    route[now] = 0
    return ans

for i in range(M):
    connect[a[i]][b[i]] = connect[b[i]][a[i]] = 1

# for xx in connect:
#     print(xx)
print(dfs(0,1))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
aa = [0]*n
bb = [0]*n
for i in range(n):
    aa[i],bb[i] = map(int, input().split())
ans = 0
for i in range(1,n+1):
    cnt = 0
    if aa[-i] % bb[-i] > 0:
        cnt = ((aa[-i] - 1) // bb[-i] +1) * bb[-i] - aa[-i]
        # print(aa[-i], bb[-i], cnt, aa)
        ans += cnt
        aa = list(map(lambda x: x + cnt, aa))
    
print(ans)

Fixed submission:
n = int(input())
aa = [0]*n
bb = [0]*n
for i in range(n):
    aa[i],bb[i] = map(int, input().split())
ans = 0
for i in range(1,n+1):
    cnt = 0
    cur = aa[-i] + ans
    if cur % bb[-i] > 0:
        cnt = ((cur - 1) // bb[-i] +1) * bb[-i] - cur
        # print(cur, bb[-i], cnt, aa)
        ans += cnt
    
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
tt = list(map(int, input().split()))
m = int(input())
drinks = [list(map(int,input().split())) for _ in range(m)]

ans = sum(tt)
for i in range(m):
    print(ans - (tt[i] - drinks[i][1]))

Fixed submission:
n = int(input())
tt = list(map(int, input().split()))
m = int(input())
drinks = [list(map(int,input().split())) for _ in range(m)]

ans = sum(tt)
for i in range(m):
    print(ans - (tt[drinks[i][0]-1] - drinks[i][1]))
Buggy python submission (verdict: Runtime Error):
w,h,n = map(int,input().split())
paint = [list(map(int,input().split())) for _ in range(n)]
x1,x2,y1,y3 = 0,w,0,h
for p in paint:
    if p[2] == 1:
        x1 = p[0]
    elif p[2] == 2:
        x2 = p[0]
    elif p[2] == 3:
        y1 = p[1]
    else:
        y2 = p[1]
print( max(0,(x2-x1)*(y2-y1)))


Fixed submission:
w,h,n = map(int,input().split())
paint = [list(map(int,input().split())) for _ in range(n)]
x1,x2,y1,y2 = 0,w,0,h
for p in paint:
    if p[2] == 1:
        x1 = max(x1,p[0])
    elif p[2] == 2:
        x2 = min(x2,p[0])
    elif p[2] == 3:
        y1 = max(y1,p[1])
    else:
        y2 = min(y2,p[1])
print(0 if x1>x2 or y1>y2 else (x2-x1)*(y2-y1))

Buggy python submission (verdict: Runtime Error):
w,h,n = map(int,input().split())
paint = [list(map(int,input().split())) for _ in range(n)]
x1,x2,y1,y3 = 0,w,0,h
for p in paint:
    if p[2] == 1:
        x1 = p[0]
    elif p[2] == 2:
        x2 = p[0]
    elif p[2] == 3:
        y1 = p[1]
    else:
        y2 = p[1]
print( (x2-x1)*(y2-y1))


Fixed submission:
w,h,n = map(int,input().split())
paint = [list(map(int,input().split())) for _ in range(n)]
x1,x2,y1,y2 = 0,w,0,h
for p in paint:
    if p[2] == 1:
        x1 = max(x1,p[0])
    elif p[2] == 2:
        x2 = min(x2,p[0])
    elif p[2] == 3:
        y1 = max(y1,p[1])
    else:
        y2 = min(y2,p[1])
print(0 if x1>x2 or y1>y2 else (x2-x1)*(y2-y1))
Buggy python submission (verdict: Runtime Error):
r = input()
print(3 * r * r)

Fixed submission:
r = input()
r = int(r)
print(3 * r * r)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = int(input())
a = [int(input()) for _ in range(n)]
# それぞれの色の最大値を入れる筒のリスト
t = []

for i in a:
    # それぞれの色のどの値よりも小さかったとき
    idx = bisect.bisect_left(t, i)
    # print(i, idx)
    if idx == 0:
        t.insert(0, i)
    # 効率的な色の探索
    else:
        t[idx-1] = i
    # print(t)

print(len(t))

Fixed submission:
import bisect

n = int(input())
a = [int(input()) for _ in range(n)]
# それぞれの色の最大値を入れる筒のリスト
t = [a[-1]]

for i in reversed(a[:-1]):
    # それぞれの色のどの値よりも小さかったとき
    idx = bisect.bisect_left(t, i+1)
    # print(i, idx)
    if idx == len(t):
        t.append(i)
    # 効率的な色の探索
    else:
        t[idx] = i
    # print(t)

print(len(t))

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

n = input()
a = []
n = int(n)

for i in range(n):
    a.append(int(input()))

# それぞれの色の最大値を入れる筒のリスト
t = []

for i in a:
    # それぞれの色のどの値よりも小さかったとき
    # 筒よりも小さかったとき
    if len(t) > 0 and i < t[0]:
        t.insert(0, i)
    # 筒よりも大きかったとき
    idx = bisect.bisect_left(t, i)
    t[idx-1] = i
    # print(t)

print(len(t))


Fixed submission:
import bisect

n = int(input())
a = [int(input()) for _ in range(n)]
# それぞれの色の最大値を入れる筒のリスト
t = [a[-1]]

for i in reversed(a[:-1]):
    # それぞれの色のどの値よりも小さかったとき
    idx = bisect.bisect_left(t, i+1)
    # print(i, idx)
    if idx == len(t):
        t.append(i)
    # 効率的な色の探索
    else:
        t[idx] = i
    # print(t)

print(len(t))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = input()
a = []
n = int(n)

for i in range(n):
    a.append(int(input()))

# それぞれの色の最大値を入れる筒のリスト
t = []

for i in a:
    # それぞれの色のどの値よりも小さかったとき
    idx = bisect.bisect_left(t, i)
    # print(i, idx)
    if idx == 0:
        bisect.insort_left(t, i)
    # 効率的な色の探索
    else:
        t[idx-1] = i
    # print(t)

print(len(t))


Fixed submission:
import bisect

n = int(input())
a = [int(input()) for _ in range(n)]
# それぞれの色の最大値を入れる筒のリスト
t = [a[-1]]

for i in reversed(a[:-1]):
    # それぞれの色のどの値よりも小さかったとき
    idx = bisect.bisect_left(t, i+1)
    # print(i, idx)
    if idx == len(t):
        t.append(i)
    # 効率的な色の探索
    else:
        t[idx] = i
    # print(t)

print(len(t))

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = []
n = int(n)

for i in range(n):
    a.append(int(input()))

t = [[a[0]]]

for i in a[1:]:
    flg = 0
    for j, m in enumerate(t):
        if m[-1] < i:
            t[j].append(i)
            flg = 1
            break
    if flg == 0:
        t.append([i])

print(len(t))






Fixed submission:
import bisect

n = int(input())
a = [int(input()) for _ in range(n)]
# それぞれの色の最大値を入れる筒のリスト
t = [a[-1]]

for i in reversed(a[:-1]):
    # それぞれの色のどの値よりも小さかったとき
    idx = bisect.bisect_left(t, i+1)
    # print(i, idx)
    if idx == len(t):
        t.append(i)
    # 効率的な色の探索
    else:
        t[idx] = i
    # print(t)

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

s = input()
int a = 0

for i in range len(s):
    if i % 2 == 0:
        if a[i] != "R":
            a++
    if i % 2 == 1:
        if a[i] != "L":
            a++
    if a == len(s):
        print('Yes')
    else:
        print('NO')
  
  

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

for i in range (n):
    if i % 2 == 1:
        if s[i] != "R":
            a=a+1
    if i % 2 == 0:
        if s[i] != "L":
            a=a+1
if a == len(s):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
s = input()

isOdd = True
for i in range(len(s)):
    if i % 2 == 1:
        if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
            isOdd = False

isEven = True
for i in range(len(s)):
    if i == 0 or i % 2 == 0:
        if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
            isEven = False

if isOdd == True or isEven == True:
    print("Yes")
else:
    print("No")

Fixed submission:
s = input()

isOdd = True
for i in range(len(s)):
    if i % 2 == 1:
        if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
            isOdd = False

isEven = True
for i in range(len(s)):
    if i == 0 or i % 2 == 0:
        if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
            isEven = False

if isOdd == True and isEven == True:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = [int(input()) for i in range(6)]

# アンテナと距離に分ける
i = [a[0], a[1], a[2], a[3], a[4]]
k = a[5]

flag = False
itr = 0
while True:
  x = itr
  while True:
    x++
    if 
      break
    else if(i[itr] - i[x]) > k:
      flag = True
  itr++
  if itr == 5
    break
    
if flag
  print(":(")
else
  print("Yay!")

Fixed submission:
a = [int(input()) for i in range(6)]

# アンテナと距離に分ける
i = [a[0], a[1], a[2], a[3], a[4]]
k = a[5]

flag = False
itr = 0
while True:
  x = itr
  while True:
    x+=1
    if x >= 5:
      break
    elif(i[x] - i[itr]) > k:
      flag = True
  itr+=1
  if itr == 5:
    break
    
if flag:
  print(":(")
else:
  print("Yay!")
Buggy python submission (verdict: Runtime Error):
import sys

def chmin(a,i,b):
  if a[i] > b:
    a[i] = b
    #print(a)
    return True
  else:
    return False

n,k = map(int,input().split())
h = list( map(int,input().split()))
dp = [sys.maxsize for i in range(n)]

dp[0] = 0
#print(n,h)
#print(dp)

for i in range(len(dp)):
  for j in range(k+1):
    if i - j >= 0:
      #chmin(dp,i, abs(h[i]-h[i-j])+dp[i-j])
      dp[i] = min(dp[i], abs(h[i]-h[i-j])+dp[i-j])

#print(dp)   
print(dp[-1])


Fixed submission:
import sys

def chmin(a,i,b):
  if a[i] > b:
    a[i] = b
    #print(a)
    return True
  else:
    return False

n = int(input())
h = list( map(int,input().split()))
dp = [sys.maxsize for i in range(n)]

dp[0] = 0
#print(n,h)
#print(dp)

for i in range(len(dp)):
  if i - 1 >= 0:
    chmin(dp,i, abs(h[i]-h[i-1])+dp[i-1])

  if i - 2 >= 0:
    chmin(dp,i, abs(h[i]-h[i-2])+dp[i-2])
    
#print(dp)   
print(dp[-1])