Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = str(input())
r = []
g = []
b = []
for i in range(n):
    if s[i] == "R":
        r.append(i)
    elif s[i] == "G":
        g.append(i)
    else:
        b.append(i)
p = len(r)*len(g)*len(b)
for j in r:
    for k in g:
        for l in b:
            ls = [j,k,l]
            ls.sort()
            (a,c,d) = (ls[0],ls[1],ls[2])
            if (c-a) == (d-c):
                p -= 1
print(p)

Fixed submission:
n = int(input())
s = str(input())
r = 0
g = 0
b = 0
for i in range(n):
    if s[i] == "R":
        r += 1
    elif s[i] == "G":
        g += 1
    else:
        b += 1
p = r*g*b
for i in range(n-2):
    for j in range(int(n/2)+1):
        if i + 2*j >n-1:
            break
        if s[i] != s[i+j] and s[i] != s[i+2*j] and s[i+2*j] != s[i+j]:
            p -= 1
print(p)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = str(input())
r = []
g = []
b = []
for i in range(n):
    if s[i] == "R":
        r.append(i)
    elif s[i] == "G":
        g.append(i)
    else:
        b.append(i)
p = 0
for j in r:
    for k in g:
        for l in b:
            ls = [j,k,l]
            ls.sort()
            (a,c,d) = (ls[0],ls[1],ls[2])
            if (c-a) != (d-c):
                p += 1
print(p)

Fixed submission:
n = int(input())
s = str(input())
r = 0
g = 0
b = 0
for i in range(n):
    if s[i] == "R":
        r += 1
    elif s[i] == "G":
        g += 1
    else:
        b += 1
p = r*g*b
for i in range(n-2):
    for j in range(int(n/2)+1):
        if i + 2*j >n-1:
            break
        if s[i] != s[i+j] and s[i] != s[i+2*j] and s[i+2*j] != s[i+j]:
            p -= 1
print(p)
Buggy python submission (verdict: Runtime Error):
ls = list(map(str,input()))
a=[]
b=[]
c=[]
d=[]
e=[]
f=[]
n = len(ls)
for i in range(int((n-1)/2)):
    a.append(ls[i])
for j in range(int((n+1)/2),n):
    b.append(ls[j])
b.reverse()
if b != a:
    print('No')
else:
    if (n-1) % 4 ==0:
        for k in range(int((n-1)/4)):
            c.append(a[i])
        for l in range(int((n-1)/4),(n-1)/2):
            d.append(a[i])
        for m in range(int((n-1)/4)):
            e.append(b[i])
        for n in range(int((n-1)/4),int((n-1)/2)):
            f.append(b[i])
        d.reverse()
        f.reverse()
        if (c == d) and (e == f):
            print('Yes')
        else:
            print('No')
    else:
        for k in range(int((n-3)/4)):
            c.append(a[i])
        for l in range(int((n+1)/4),int((n-1)/2)):
            d.append(a[i])
        for m in range(int((n-3)/4)):
            e.append(b[i])
        for n in range(int((n+1)/4),int((n-1)/2)):
            f.append(b[i])
        d.reverse()
        f.reverse()
        if (c == d) and (e == f):
            print('Yes')
        else:
            print('No')
        


Fixed submission:
ls = list(map(str,input()))
a=[]
b=[]
c=[]
d=[]
e=[]
f=[]
n = len(ls)
for i in range(int((n-1)/2)):
    a.append(ls[i])
for j in range(int((n+1)/2),n):
    b.append(ls[j])
b.reverse()
if b != a:
    print('No')
else:
    if (n-1) % 4 ==0:
        for k in range(int((n-1)/4)):
            c.append(a[k])
        for l in range(int((n-1)/4),int((n-1)/2)):
            d.append(a[l])
        for m in range(int((n-1)/4)):
            e.append(b[m])
        for n in range(int((n-1)/4),int((n-1)/2)):
            f.append(b[n])
        d.reverse()
        f.reverse()
        if (c == d) and (e == f):
            print('Yes')
        else:
            print('No')
    else:
        for k in range(int((n-3)/4)):
            c.append(a[k])
        for l in range(int((n+1)/4),int((n-1)/2)):
            d.append(a[l])
        for m in range(int((n-3)/4)):
            e.append(b[m])
        for n in range(int((n+1)/4),int((n-1)/2)):
            f.append(b[n])
        d.reverse()
        f.reverse()
        if (c == d) and (e == f):
            print('Yes')
        else:
            print('No')
Buggy python submission (verdict: Runtime Error):
s = int(input())
if s in "AAA-BBB":
    print("No")
else:
    print("Yes")


Fixed submission:
s = input()
if s in "AAA-BBB":
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=[]
d=[]
if a % 2 == 0:
    s = int(100*a/8)
    t = int(100*(a+1)/8) + 1
else:
    s = int(100*a/8) + 1
    t = int(100*(a+1)/8) 
u = int(100*b/10) 
v = int(100*(b+1)/10) + 1
for i in range(s,t):
    c.append(i)
for j in range(u,v):
    d.append(j)
c_d = set(c) & set(d)
if (len(c_d)>=0):
    print(min(c_d))
else:
    print(-1)



Fixed submission:
a,b=map(int,input().split())
c=[]
d=[]
if a % 2 == 0:
    s = int(100*a/8)
    t = int(100*(a+1)/8) + 1
else:
    s = int(100*a/8) + 1
    t = int(100*(a+1)/8) 
u = int(10*b) 
v = int(10*(b+1)) 
for i in range(s,t):
    c.append(i)
for j in range(u,v):
    d.append(j)
c_d = set(c) & set(d)
if (len(c_d)>0):
    print(min(c_d))
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
q = int(input())
ls = [list(map(str,input().split())) for _ in range(q)]
def rev(ls):
    return ls[::-1]
def addi_f(s,t):
    return t+s
def addi_b(s,t):
    return s+t
for i in range(q):
    if ls[i] == ["1"]:
        s = rev(s)
    else:
        if ls[i][1] == "1":
            s = addi_f(s,ls[i][2])
        else:
            s = addi_b(s,ls[i][2])
print(s)
        

Fixed submission:
s = str(input())
q = int(input())
ls = [list(map(str,input().split())) for _ in range(q)]
a = -1
f = []
b = []
for i in range(q):
    if ls[i] == ["1"]:
        if a == -1:
            a = -2
        else:
            a = -1
    else:
        if a+int(ls[i][1]) == 0:
            f.append(ls[i][2])
        else:
            b.append(ls[i][2])
if a == -1:
    f = f[::-1]
    print("".join(f)+s+"".join(b))
else:
    b = b[::-1]
    print("".join(b)+s[::-1]+"".join(f))

Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
q = int(input())
ls = [list(map(str,input().split())) for _ in range(q)]
def rev(ls):
    return ls[::-1]
def addi_f(s,t):
    return t+s
def addi_b(s,t):
    return s+t
for i in range(q):
    if ls[i] == ["1"]:
        s = rev(s)
    else:
        if ls[i][1] == "1":
            s = addi_f(s,ls[i][2])
        else:
            s = addi_b(s,ls[i][2])
print(s)
        

Fixed submission:
s = str(input())
q = int(input())
ls = [list(map(str,input().split())) for _ in range(q)]
a = -1
f = []
b = []
for i in range(q):
    if ls[i] == ["1"]:
        if a == -1:
            a = -2
        else:
            a = -1
    else:
        if a+int(ls[i][1]) == 0:
            f.append(ls[i][2])
        else:
            b.append(ls[i][2])
if a == -1:
    f = f[::-1]
    print("".join(f)+s+"".join(b))
else:
    b = b[::-1]
    print("".join(b)+s[::-1]+"".join(f))
Buggy python submission (verdict: Runtime Error):
import sys
n,m = map(int,input().split())
ls = [list(map(int,input().split())) for _ in range(m)]
ls.sort()
ans = []
di=[[] for _ in range(n)]
if n == 1:
    print(ls[0][1])
    sys.exit()
for i in range(m):
    di[ls[i][0]-1].append(ls[i][1])
for j in range(len(di)):
    if di[j] != []:
        di[j] = list(set(di[j]))
        if len(di[j]) > 1:
            print(-1)
            sys.exit()
for l in range(n):
    if l == 0:
        if di[l] == []:
            ans.append(str(1))
        elif 0 in di[l]:
            print(-1)
            sys.exit()
        else:
            ans.append(str(di[l][0]))
    else:
        if di[l] == []:
            ans.append(str(0))
        else:
            ans.append(str(di[l][0]))
print("".join(ans))

    
    
    

Fixed submission:
import sys
n,m = map(int,input().split())
inf = float("inf")
ls = [-inf]*n
for i in range(m):
    a,b = map(int,input().split())
    if ls[a-1] == -inf:
        ls[a-1] = b
    elif ls[a-1] != b:
        print(-1)
        sys.exit()
if ls[0] == 0:
    if n != 1:
        print(-1)
        sys.exit()
    else:
        print(0)
        sys.exit()
for j in range(n):
    if ls[j] == -inf:
        if j == 0 and n == 1:
            print(0)
            sys.exit()
        elif j == 0 and n != 1:
            ls[j] = 1
        else:
            ls[j] = 0
ls = list(map(str,ls))
print("".join(ls))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
ls = list(map(int,input().split()))
for i in range(len(ls)):
    if ls.count(ls[i]) > 1:
        print("NO")
        sys.exit()
    else:
        continue
print("YES")


Fixed submission:
import collections
n = int(input())
ls = list(map(int,input().split()))
if len(ls) == len(collections.Counter(ls)):
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = list(map(int,input().split()))
a = 0
for i in range(len(ls)):
    if ls.count(ls[i]) > 1:
        a += 1
        break
    else:
        continue
if a > 0:
    print("NO")
else:
    print("YES")


Fixed submission:
import collections
n = int(input())
ls = list(map(int,input().split()))
if len(ls) == len(collections.Counter(ls)):
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
n = int(input())
ls = list(map(int, input().split()))
for i in range(0,n-1):
    for u in range(0, n-1):
        if ls(i) == ls(u):
            print("No")
else:
    print("Yes")

Fixed submission:
import collections
n = int(input())
ls = list(map(int,input().split()))
if len(ls) == len(collections.Counter(ls)):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
ls = list(map(int,input().split()))
a = []
b = []
for i in range(n):
    p = (ls[i]+1)/2
    a.append(p)
for j in range(n+1-k):
    q = sum(a[j:j+k])
    b.append(q)
print(max(b))


Fixed submission:
n,k = map(int,input().split())
ls = list(map(int,input().split()))
l,p = 0,0
for i in range(n):
    if l < k:
        p += (1+ls[i])/2
        l += 1
        continue
    if i == k:
        now = p
    now = now-((1+ls[i-k])/2)+((1+ls[i])/2)
    p = max(p,now)
print(p)

Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
ls = list(map(int,input().split()))
for i in range(len(ls)):
    if ls.count(ls[i]) > 1:
        print("NO")
        sys.exit()
    else:
        continue
print("YES")


Fixed submission:
n,k = map(int,input().split())
ls = list(map(int,input().split()))
l,p = 0,0
for i in range(n):
    if l < k:
        p += (1+ls[i])/2
        l += 1
        continue
    if i == k:
        now = p
    now = now-((1+ls[i-k])/2)+((1+ls[i])/2)
    p = max(p,now)
print(p)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
ls = list(map(int,input().split()))
a = []
b = []
for i in range(n):
    p = (ls[i]+1)/2
    a.append(p)
for j in range(n+1-k):
    q = sum(a[j:j+k])
    b.append(q)
print(max(b))

Fixed submission:
n,k = map(int,input().split())
ls = list(map(int,input().split()))
l,p = 0,0
for i in range(n):
    if l < k:
        p += (1+ls[i])/2
        l += 1
        continue
    if i == k:
        now = p
    now = now-((1+ls[i-k])/2)+((1+ls[i])/2)
    p = max(p,now)
print(p)
Buggy python submission (verdict: Runtime Error):
while True:
    h,a = map(int, input().split())
    x = h // a
    y = h / a
    if x == y:
        print(x)
    else:
        print(x + 1)


Fixed submission:
h,a = map(int, input().split())
x = h // a
y = h / a
if x == y:
    print(x)
else:
    print(x + 1)
Buggy python submission (verdict: Runtime Error):
while True:
    h,n = map(int, input().split())
    ls = list(map(int, input().split()))
    if sum(ls) >= h:
        print("Yes")
    else:
        print("No")


Fixed submission:
h,n = map(int, input().split())
ls = list(map(int, input().split()))
if sum(ls) >= h:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
while True:
    h,n = map(int, input().split())
    ls = list(map(int, input().split()))
    if sum(ls) >= h:
        print("Yes")
    else:
        print("No")


Fixed submission:
h,n = map(int, input().split())
ls = list(map(int, input().split()))
if sum(ls) >= h:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
ls = list(map(int,input().split()))
a = 0
for i in range(n):
    for j in range(i):
        if ls[i] =< ls[j]:
            continue    
        else:
            a += 1
            break
print(n - a)


Fixed submission:
n,m = map(int,input().split())
if n == m:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
ls = [int(x) for x in input().split()]
a = 0
for i in range(n):
    for j in range(i):
        if ls[i] =< ls[j]:
            continue    
        else:
            a += 1
            break
print(n - a)


Fixed submission:
n = int(input())
ls = list(map(int,input().split()))
min = ls[0]
k = 1
for i in range(1,n):
    if ls[i] < min:
        min = ls[i]
        k += 1
print(k)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = list(map(int,input().split()))
a = 0
for i in range(n):
    for j in range(i):
        if ls[i] > ls[j]:
            a += 1
            break
        else:
            continue
print(n - a)


Fixed submission:
n = int(input())
ls = list(map(int,input().split()))
min = ls[0]
k = 1
for i in range(1,n):
    if ls[i] < min:
        min = ls[i]
        k += 1
print(k)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ls = list(map(int,input().split()))
a = 0
for i in range(n):
    for j in range(i):
        if ls[i] =< ls[j]:
            continue    
        else:
            a += 1
            break
print(n - a)


Fixed submission:
n = int(input())
ls = list(map(int,input().split()))
min = ls[0]
k = 1
for i in range(1,n):
    if ls[i] < min:
        min = ls[i]
        k += 1
print(k)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = list(map(int,input().split()))
a = 0
for i in range(n):
    for j in range(i):
        if ls[i] > ls[j]:
            a += 1
            break
        else:
            continue
    
print(n - a)


Fixed submission:
n = int(input())
ls = list(map(int,input().split()))
min = ls[0]
k = 1
for i in range(1,n):
    if ls[i] < min:
        min = ls[i]
        k += 1
print(k)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = list(map(int,input().split()))
a = 0
for i in range(n):
    for j in range(i):
        if ls[i] > ls[j]:
            a += 1
            break
        else:
            continue
    
print(n - a)


Fixed submission:
n = int(input())
ls = list(map(int,input().split()))
min = ls[0]
k = 1
for i in range(1,n):
    if ls[i] < min:
        min = ls[i]
        k += 1
print(k)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
H,W = map(int,input().split())
field = [list(input()) for _ in range(H)]
dist = [[-1]*W for _ in range(H)]
dx = [1,0,-1,0]
dy = [0,1,0,-1]
mx = 0
for h in range(H):
    for w in range(W):
        if field[h][w] == "#":
            continue
        dist = [[-1]*W for _ in range(H)]
        dist[h][w] = 0
        que = deque([])
        que.append([h,w])
        while que != deque([]):
            u,v = que.pop()
            for dir in range(4):
                nu = u + dx[dir]
                nv = v + dy[dir]

                if (nu < 0) or (nu >= H) or (nv < 0) or (nv >= W):
                    continue
                if field[nu][nv] == "#":
                    continue
                if dist[nu][nv] != -1:
                    if dist[nu][nv] < dist[u][v] + 1:
                        continue
            
                que.append([nu,nv])
                dist[nu][nv] = dist[u][v] + 1
            
            
        for i in range(H):
            for j in range(W):
                if mx < dist[i][j]:
                    mx = dist[i][j]
    
print(mx)

Fixed submission:
from collections import deque
H,W = map(int,input().split())
field = [list(input()) for _ in range(H)]
dist = [[-1]*W for _ in range(H)]
dx = [1,0,-1,0]
dy = [0,1,0,-1]
mx = 0
for h in range(H):
    for w in range(W):
        if field[h][w] == "#":
            continue
        dist = [[-1]*W for _ in range(H)]
        dist[h][w] = 0
        que = deque([])
        que.append([h,w])
        while que != deque([]):
            u,v = que.popleft()
            for dir in range(4):
                nu = u + dx[dir]
                nv = v + dy[dir]

                if (nu < 0) or (nu >= H) or (nv < 0) or (nv >= W):
                    continue
                if field[nu][nv] == "#":
                    continue
                if dist[nu][nv] != -1:
                    continue
            
                que.append([nu,nv])
                dist[nu][nv] = dist[u][v] + 1
            
            
        for i in range(H):
            for j in range(W):
                if mx < dist[i][j]:
                    mx = dist[i][j]
    
print(mx)
Buggy python submission (verdict: Runtime Error):
k,x =map(int,input().split()))
if k*500 >= x:
    print("Yes")
else:
    print("No")


Fixed submission:
k,x =map(int,input().split())
if k*500 >= x:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input()
p = 0
for i in range(n):
    if a[i] == "A":
        if a[i+1] == "B":
            if a[i+2] == "C":
                p += 1
print(p)

Fixed submission:
n = int(input())
a = input()
p = 0
for i in range(n-2):
    if a[i] == "A":
        if a[i+1] == "B":
            if a[i+2] == "C":
                p += 1
print(p)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int,input().split())
for i in range(k):
    if a >= 1:
        a -= 1
    elif b >= 1:
        b -= 1
    else:
        continue
print(str(a)+" "+str(b))

Fixed submission:
a,b,k = map(int,input().split())
if k >= a:
    if k-a >= b:
        print(str(0)+" "+str(0))
    else:
        print(str(0)+" "+str(b-k+a))
else:
    print(str(a-k)+" "+str(b))
Buggy python submission (verdict: Time Limit Exceeded):
x,y = map(int,input().split())
def combinations_count(n, r): #組み合わせ(nCr)
    import math
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
if 1/2 <= y/x <= 2 and (x+y)/3 % 1 == 0:
    yy = (x+y)/3
    u = y - yy
    r = yy - u
    print(combinations_count(yy, min(r,yy-r))%(10**9+7))
else:
    print(0)

Fixed submission:
x,y = map(int,input().split())
def comb(n,m,p=10**9+7):
    if n < m : return 0
    if n < 0 or m < 0:return 0
    m = min(m, n-m)
    top = bot = 1
    for i in range(m):
        top = top*(n-i) % p
        bot = bot*(i+1) % p
    bot = pow(bot, p-2, p)
    return top*bot % p
if 1/2 <= y/x <= 2 and (x+y)/3 % 1 == 0:
    yy = int((x+y)/3)
    u = int(y - yy)
    r = int(yy - u)
    print(comb(yy,r)%(10**9+7))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())
if x > ((a**2)*b)/2:
    print(math.degrees(math.atan((2*(b-x/(a**2))/a)))
else:
    print(math.degrees(math.atan((a*(b**2))/(2*x))))

Fixed submission:
import math
a,b,x = map(int,input().split())
if x > ((a**2)*b)/2:
    print(math.degrees(math.atan((2*(b-x/(a**2))/a))))
else:
    print(math.degrees(math.atan((a*(b**2))/(2*x))))

Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())
if x > ((a**2)*b)/3:
    print(math.degrees(math.atan((2*(b-x/(a**2))/a)))
else:
    print(math.degrees(math.atan((a*(b**2))/(2*x))))

Fixed submission:
import math
a,b,x = map(int,input().split())
if x > ((a**2)*b)/2:
    print(math.degrees(math.atan((2*(b-x/(a**2))/a))))
else:
    print(math.degrees(math.atan((a*(b**2))/(2*x))))
Buggy python submission (verdict: Runtime Error):
n = int(input())
ls = list(map(int,input().split()))
a = [0 for j in range(n)]
for i in range(n):
    a[i] = [ls[i],str(i+1)]
a.sort()
for k in range(n):
    print(a[k][1],end=' ')

Fixed submission:
n = int(input())
if n % 2 == 0:
    print(0.5)
else:
    print((int(n/2)+1)/n)
Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
ls = list(map(int,input().split()))
if len(list(set(ls))) <=2 and abs(list(set(ls))[0]-list(set(ls))[1]) <=1:
    print("Yes")
    sys.exit()
mx = ls[0]
for i in range(n-1):
    if (ls[i+1] - ls[i]) == -1:
        ls[i] -= 1
        if ls[i] < mx:
            print("No")
            sys.exit()
        else:
            mx = ls[i]
    elif ls[i+1] - ls[i] <-1:
        print("No")
        sys.exit()
    else:
        if ls[i] > mx:
            mx = ls[i]
print("Yes")

Fixed submission:
import sys
n = int(input())
ls = list(map(int,input().split()))
mx = -float("inf")
for i in ls:
    if i < mx:
        if i + 1 != mx:
            print("No")
            sys.exit()
        else:
            mx = i + 1
    else:
        mx = i
print("Yes")

Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
ls = list(map(int,input().split()))
if len(list(set(ls))) <=2 and abs(list(set(ls))[0]-list(set(ls))[1]) <=1:
    print("Yes")
    sys.exit()
mx = ls[0]
for i in range(n-1):
    if (ls[i+1] - ls[i]) == -1:
        ls[i] -= 1
        if ls[i] < mx:
            print("No")
            sys.exit()
        else:
            mx = ls[i]
    elif ls[i+1] - ls[i] <-1:
        print("No")
        sys.exit()
    else:
        if ls[i] > mx:
            mx = ls[i]
print("Yes")

Fixed submission:
import sys
n = int(input())
ls = list(map(int,input().split()))
mx = -float("inf")
for i in ls:
    if i < mx:
        if i + 1 != mx:
            print("No")
            sys.exit()
        else:
            mx = i + 1
    else:
        mx = i
print("Yes")

Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
ls = list(map(int,input().split()))
for i in range(n-1):
    if (ls[i+1] == ls[i]) or (ls[i+1] - ls[i] >=1):
        continue
    elif ls[i+1] - ls[i] == -1 :
        ls[i] = ls[i] - 1
        if ls[i+2] - ls[i+1] <0:
             print("No")
             sys.exit()
    else:
        print("No")
        sys.exit()
print("Yes")

Fixed submission:
import sys
n = int(input())
ls = list(map(int,input().split()))
mx = -float("inf")
for i in ls:
    if i < mx:
        if i + 1 != mx:
            print("No")
            sys.exit()
        else:
            mx = i + 1
    else:
        mx = i
print("Yes")