Harryxun/stf_run huggingface dataset:
import sys
N, L, T = [int(x) for x in input().strip().split(" ")]

xys = []
candidates = []
for line in sys.stdin:
    x, y = line.strip().split(" ")
    x, y = int(x), int(y)
    xys.append((x,y))
    candidates.append((x + (1 if y == 1 else -1) * T)%L)

x0, y0 = xys[0]

dxs = []
pr_x = None
counter = 0
for x, y in xys[1:]:
    if y != y0:
        if pr_x == None:
            if y0 == 1:
                a = (x - x0)
        else:
            dxs.append(x - pr_x)
        pr_x = x
        counter += 1
if pr_x == None:
    for x in candidates:
        print(x)
    sys.exit()
if y0 == 2:
    a = (L - pr_x) + x0

ree = (2*T)%L
num_round = (2*T)//L
ree = ree - a
if ree < 0:
    max_i = 0
else:
    for i, dx in enumerate(dxs if y0 == 1 else dxs[::-1]):
        ree = ree - dx
        if ree < 0:
            max_i = i + 1
            break
    else:
        max_i = counter

c_n = num_round * counter + max_i

rep = ( 
        ((1 if y0 == 1 else -1) * (c_n % N) % N),
        ((x0 + (1 if y0 == 1 else -1) * (T % L)) % L)
        )
result = []

candidates = sorted(candidates)

for i, c in enumerate(candidates):
    if c == rep[1]:
        start = i - rep[0]
        break

for j in range(N):
    if ree != 0:
        print(candidates[(start + j) % N])
    else:
        1/0


### FIXED CODE ###


import sys
N, L, T = [int(x) for x in input().strip().split(" ")]

xys = []
candidates = []
for line in sys.stdin:
    x, y = line.strip().split(" ")
    x, y = int(x), int(y)
    xys.append((x,y))
    candidates.append((x + (1 if y == 1 else -1) * T)%L)

x0, y0 = xys[0]

dxs = []
pr_x = None
counter = 0
for x, y in xys[1:]:
    if y != y0:
        if pr_x == None:
            if y0 == 1:
                a = (x - x0)
        else:
            dxs.append(x - pr_x)
        pr_x = x
        counter += 1

if pr_x == None:
    for x in candidates:
        print(x)
    sys.exit()
if y0 == 2:
    a = (L - pr_x) + x0

ree = (2*T)%L
num_round = (2*T)//L
ree = ree - a
if ree <= 0:
    max_i = 0
else:
    for i, dx in enumerate(dxs if y0 == 1 else dxs[::-1]):
        ree = ree - dx
        if ree <= 0:
            max_i = i + 1
            break
    else:
        max_i = counter

if ree == 0 and y0 == 2:
    max_i += 1

c_n = num_round * counter + max_i

rep = ( 
        ((1 if y0 == 1 else -1) * (c_n % N) % N),
        ((x0 + (1 if y0 == 1 else -1) * (T % L)) % L)
        )


candidates = sorted(candidates)

for i, c in enumerate(candidates):
    if c == rep[1]:
        start = i - rep[0]
        break

for j in range(N):
    print(candidates[(start + j) % N])
a,b,c=map(int,input().split())
s=set(a,b,c)
if len(s)==2:
  print('Yes')
else:
  print('No)


### FIXED CODE ###

a,b,c=map(int,input().split())
S=[a,b,c]
s=set(S)
if len(s)==2:
  print('Yes')
else:
  print('No')
import sys
k, x = map(int, sys.stdin.readline())
if k*500 >= x:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

import sys
k, x = map(int, sys.stdin.readline().split())
if k*500 >= x:
  print('Yes')
else:
  print('No')
M = int(input())
P = [input().split() for i in range(M)]
print(len(set(P)))

### FIXED CODE ###

M = int(input())
P = [input() for i in range(M)]
print(len(set(P)))
a,b = map(int, input().split())
print(max(a+b,a*b,a-b)

### FIXED CODE ###

a,b = map(int, input().split())
print(max(a+b,a*b,a-b))
import sys
x1=[int(i)for i in input().split()]
x2=[int(i)for i in input().split()]
for i in range(6):
    if x2[i]==x1[0]:
        if x2[5-i]==x1[5]:
            count=i
            break
if x2[count]==x1[0] and x2[5-count]==x1[5]:
    if count==0 or count==5:
        if count==5:
            for i in range(2):
                x2[1],x2[0]=x2[0],x2[1]
                x2[5],x2[1]=x2[1],x2[5]
                x2[4],x2[5]=x2[5],x2[4]
    else:
        if count==1 or count==4:
            while x1[0]!=x2[0]:
                x2[1],x2[0]=x2[0],x2[1]
                x2[5],x2[1]=x2[1],x2[5]
                x2[4],x2[5]=x2[5],x2[4]
        else:
            while x1[0]!=x2[0]:
                x2[3],x2[0]=x2[0],x2[3]
                x2[5],x2[3]=x2[3],x2[5]
                x2[2],x2[5]=x2[5],x2[2]
    for i in range(4):
        if x2[2]==x1[2] and x2[3]==x1[3] and x2[4]==x1[4] and x2[1]==x1[1] :
            print('Yes')
            break
        else:
            x2[1],x2[2]=x2[2],x2[1]
            x2[2],x2[4]=x2[4],x2[2]
            x2[4],x2[3]=x2[3],x2[4]
        if i==3:
            print('No')
else:
    print("No")

### FIXED CODE ###

import sys
x1=[int(i)for i in input().split()]
x2=[int(i)for i in input().split()]
for i in range(6):
    if x2[i]==x1[0]:
        count=i
        if x2[5-i]==x1[5]:
            break
if x2[count]==x1[0] and x2[5-count]==x1[5]:
    if count==0 or count==5:
        if count==5:
            for i in range(2):
                x2[1],x2[0]=x2[0],x2[1]
                x2[5],x2[1]=x2[1],x2[5]
                x2[4],x2[5]=x2[5],x2[4]
    else:
        if count==1 or count==4:
            while x1[0]!=x2[0] or x1[5]!=x2[5]:
                x2[1],x2[0]=x2[0],x2[1]
                x2[5],x2[1]=x2[1],x2[5]
                x2[4],x2[5]=x2[5],x2[4]
        else:
            while x1[0]!=x2[0] or x1[5]!=x2[5]:
                x2[3],x2[0]=x2[0],x2[3]
                x2[5],x2[3]=x2[3],x2[5]
                x2[2],x2[5]=x2[5],x2[2]
    for i in range(4):
        if x2[2]==x1[2] and x2[3]==x1[3] and x2[4]==x1[4] and x2[1]==x1[1] :
            print('Yes')
            break
        else:
            x2[1],x2[2]=x2[2],x2[1]
            x2[2],x2[4]=x2[4],x2[2]
            x2[4],x2[3]=x2[3],x2[4]
        if i==3:
            print('No')
else:
    print("No")
n=int(input())
s=input()

nsl=['{:03}'.format() for i in range(1000)]

res=0
for ns in nsl:
  idx=0
  for char in s:
    if char == ns[idx]:
      idx+=1
      if idx == 3:
        res+=1
        break
print(res)

### FIXED CODE ###

n=int(input())
s=input()

nsl=['{:03}'.format(i) for i in range(1000)]

res=0
for ns in nsl:
  idx=0
  for char in s:
    if char == ns[idx]:
      idx+=1
      if idx == 3:
        res+=1
        break
print(res)
a=input().split(" ")
sum1=a[0]+a[1]
sum2=a[0]+a[2]
sum3=a[1]+a[2]

if sum1+sum2==sum3 or sum1+sum3==sum2 or sum2+sum3==sum1
	print("Yes")
else:
	print("No")


### FIXED CODE ###

a=input().split(" ")
sum1=int(a[0])+int(a[1])
sum2=int(a[0])+int(a[2])
sum3=int(a[1])+int(a[2])

if sum1==int(a[2]) or sum2==int(a[1]) or sum3==int(a[0]):
	print("Yes")
else:
	print("No")
n = int(input())
a = list(map(int,input().split()))

for i in a:
    if i > n:
        a.pop(i)

ans = 0
for j in range(len(a)):
    for k in range(j+1, len(a)):
        #print(j,k)
        if  a[j] + a[k] == abs(j - k):
           #print(j,k, a[j],a[k])
           ans = ans + 1

print(ans)

### FIXED CODE ###

n = int(input())

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

c = {}
for i in range(n):
    if a[i] + i + 1 not in c.keys():
        c[a[i]+i+1] = 1
    else:
        c[a[i]+i+1] += 1

#print(c)

ans = 0
for i in range(n):
    if i + 1 - a[i] not in c.keys():
        pass
    else:
        ans += c[i + 1 - a[i]]

print(ans)
# AtCoder Beginner Contest 111
# C - /\/\/\/
# https://atcoder.jp/contests/abc111/tasks/arc103_a
from collections import Counter

N, *A = map(int, open(0).read().split())

ev = A[0::2]
od = A[1::2]

ev_C = Counter(ev)
od_C = Counter(od)

ev_most = ev_C.most_common()[0][1]
od_most = od_C.most_common()[0][1]
ev_second = ev_C.most_common()[1][1]
od_second = od_C.most_common()[1][1]


if ev == od:
    print(N//2)
else:
    print(min(
        N-ev_most-od_most,
        N-ev_most-od_second,
        N-ev_second-od_most
    ))


### FIXED CODE ###

# AtCoder Beginner Contest 111
# C - /\/\/\/
# https://atcoder.jp/contests/abc111/tasks/arc103_a
from collections import Counter

N, *A = map(int, open(0).read().split())

ev = A[0::2]
od = A[1::2]

ev_C = Counter(ev)
od_C = Counter(od)


if ev == od and ev_C.most_common()[0][1] == N//2:
    print(N//2)
else:
    ans = N
    ev_common = ev_C.most_common()
    od_common = od_C.most_common()
    ev_most = ev_common[0][1]
    od_most = od_common[0][1]
    if ev_common[0][0] == od_common[0][0]:
        ev_second = ev_common[1][1]
        od_second = od_common[1][1]
        ans = min(ans, N-ev_most-od_second)
        ans = min(ans, N-ev_second-od_most)
    else:
        ans = min(ans, N-ev_most-od_most)

    print(ans)
print("NYoe s"[int(input())[:4]=="YAKI"::2])

### FIXED CODE ###

print("NYoe s"[input()[:4]=="YAKI"::2])
N,M =map(int,input().split())
A = [0]*(N*M*1000000)
B = [0]*M
C = [0]*M
ans = int(0)

A = list(map(int, input().split()))
for i in range(M):
    B[i],C[i] = list(map(int,input().split()))
    for j in range(B[i]):
        A.append(C[i])

A.sort()

S = int(N)

for i in range(M):
    S +=B[i]

for i in range(S-1,S-N-1,-1):
    ans += A[i]

print(ans)


### FIXED CODE ###

from heapq import heappush, heappop

# input
N,M =map(int,input().split())
A = [0]*N
B = [0]*M
C = [0]*M

A = list(map(int, input().split()))
A.sort()
for i in range(M):
    B[i],C[i] = list(map(int,input().split()))


def solve():

    pairs = zip(C, B)
    sortedpairs = sorted(pairs, key=lambda x: x[0])
    for i in range(M):
        B[i]=sortedpairs[i][1]
        C[i]=sortedpairs[i][0]

    ansA=[0]*N
    for j in range(N):
        ansA[j] = A[j]

    p = int(0)
    j = int(0)
    while  j<N and M>=1+p :
        jd = int(0)
        if ansA[j] >= C[M - 1 - p]:
            break
        while  B[M-1-p]-jd>0 :
            if j==N : break
            if ansA[j]>=C[M-1-p] :
                break
            else:
                ansA[j]=C[M-1-p]
            jd +=1
            j +=1

        p +=1

    ans = int(0)
    for j in range(N):
        ans += ansA[j]

    print(ans)

solve()
n = input()
a = [int(c) for c in n]
if(a[len(n)] == 3):
    print('bon')
elif(a[len(n)] == 0 or 1 or 6 or 8):
    print('pon')
else:
    print('hon')

### FIXED CODE ###

n = input()
a = [int(c) for c in n]
if(a[-1] == 3):
    print('bon')
elif(a[-1] == 0):
  print('pon')
elif(a[-1] == 1):
  print('pon')
elif(a[-1] == 6):
  print('pon')
elif(a[-1] == 8):
  print('pon')
elif(a[-1] == 2):
  print('hon')
elif(a[-1] == 4):
  print('hon')
elif(a[-1] == 5):
  print('hon')
elif(a[-1] == 7):
  print('hon')
elif(a[-1] == 9):
  print('hon')
N = int(input())
    d = list(map(int,input().split()))

    d.sort()
    i = len(d)//2
    print(d[i]-d[i-1])

### FIXED CODE ###

N = int(input())
d = list(map(int,input().split()))

d.sort()
i = len(d)//2
print(d[i]-d[i-1])
# -*- coding: utf-8 -*-
A,B,C=map(int,input().split())
print(max(A*10+B+C, B*10+C+A C*10+A+B))

### FIXED CODE ###

# -*- coding: utf-8 -*-
A,B,C=map(int,input().split())
print(max(A*10+B+C, B*10+C+A,  C*10+A+B))
N = input()

def num(n):
  return list(map(int,n))

if(N%sum(num(N)) == 0):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = int(input())
digitSum = sum(list(map(int,str(N))))
if(N % digitSum == 0):
  print('Yes')
else:
  print('No')
n, k = map(int, input().split())
p = list(map(int, input().split()))

def S(n):
  return n * (n + 1) // 2

b = 0
s = sum(p[:k])
for i in range(k, n):
  tmp = s - p[i - k] + p[i]
  if tmp > s:
    s = tmp
    b = i
ans = 0
for i in range(b, b + k):
  ans += S(p[i]) / p[i]
  
print(ans)
  

 

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))

ans = 0
for i in range(k):
    ans += (p[i] + 1) / 2
t = ans
for i in range(k, n):
    t += (p[i] + 1) / 2 - (p[i - k] + 1) / 2
    ans = max(ans, t)

print(ans)
from sys import exit

n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

if max(c) < 0:
    print(max(c))
    exit()

res = 0
for i in range(n):
    score = []
    s = 0
    pos = i
    visited = [False] * n
    while True:
        if visited[pos]:
            break

        visited[pos] = True
        s += c[p[pos]-1]
        score.append(s)
        pos = p[pos] - 1

    loop = len(score)

    if k < loop:
        res = max(res, max(score[:k]))
    elif score[-1] <= 0:
        res = max(res, max(score))
    else:
        res = max(res, score[-1] * (k // loop) + max(score[:k%loop]))

print(res)

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

if max(c) < 0:
    res = max(c)
else:
    res = 0

for i in range(n):
    score = []
    s = 0
    pos = i
    visited = [False] * n
    loop = 0
    while True:
        if visited[pos]:
            break

        visited[pos] = True
        s += c[p[pos]-1]
        score.append(s)
        pos = p[pos] - 1
        loop += 1

    if k < loop:
        res = max(res, max(score[:k]))
    elif score[-1] <= 0:
        res = max(res, max(score))
    elif k % loop == 0:
        res = max(res, score[-1] * (k // loop), score[-1] * (k // loop - 1) + max(score))
    else:
        res = max(res, score[-1] * (k // loop) + max(score[:k%loop]), score[-1] * (k // loop - 1) + max(score))

print(res)
from collections import deque


h, w = map(int, input().split())
hs, ws = set(range(h)), set(range(w))
a = []
d = deque([])
memo = [[None] * w for j in hs]
move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
a = [list(input()) for i in hs]
for i in hs:
    for j in ws:
        if a[i][j] == '#':
            d.append([i, j])
            memo[i][j] = 0


def d_list_update(d, hmax, wmax):
    dh, dw = d.popleft()
    for i, j in move:
        if (0 <= dh + i < hmax) and (0 <= dw + j < wmax) and not(memo[dh + i][dw + j]):
            memo[dh + i][dw + j] = memo[dh][dw] + 1
            d.append([dh + i, dw + j])
    return d


hw = set(range(h*w))
for i in hw:
    d = d_list_update(d, h, w)
    if not d:
        break
ans = max([max(e) for e in memo])
print(ans)

### FIXED CODE ###

from collections import deque
 
 
h, w = map(int, input().split())
hs, ws = set(range(h)), set(range(w))
d = deque()
memo = [[-1] * w for j in hs]
move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
a = tuple(input() for _ in hs)
b = [[i, j] for i in hs for j in ws if a[i][j] == '#']
for i, j in b:
    d.append((i, j))
    memo[i][j] = 0
while d:
    dh, dw = d.popleft()
    for i, j in move:
        dhn, dwn = dh + i, dw + j
        if (0 <= dhn < h) and (0 <= dwn < w) and (memo[dhn][dwn] < 0):
            d.append((dhn, dwn))
            memo[dhn][dwn] = memo[dh][dw] + 1
ans = max([max(e) for e in memo])
print(ans)
n=input()
while True:
  if n%4==0:
    print("YES")
    break
  n-=7
  if n<0:
    print("NO")
    break

### FIXED CODE ###

n=int(input())
while True:
  if n%4==0:
    print("Yes")
    break
  n-=7
  if n<0:
    print("No")
    break
n, k = map(int,input().split())
a = sorted(list(map(int,input().split())))
print(sum(a[:k]))

### FIXED CODE ###

a = input()
if a == a.upper():
    print("A")
else:
    print("a")
O = input()
E = input()

ans = ""

for i in range(len(O)):
  ans += O[i] + E[i]

if len(O) > len(E):
  ans += O[-1]

print(ans)

### FIXED CODE ###

O = input()
E = input()

ans = ""

for i in range(len(E)):
  ans += O[i] + E[i]

if len(O) > len(E):
  ans += O[-1]
  
print(ans)
lst = list(map(int, input().split()))

for i in lst:
  i == 0:
    print(i)
    exit()

### FIXED CODE ###

lst = list(map(int, input().split()))
for i in range(5):
    if lst[i] == 0:
        print(i + 1)
        exit()
import math

INF = 10 ** 9
A,B,H,M = map(int,input().split())

rad_H = (360*H/12) + (0.5 * M)
rad_M = 360*M/60
diff = abs(rad_H-rad_M)

if diff > 180:
	diff = diff - 180

temp = (A ** 2) + (B ** 2) -(2*A*B*math.cos(math.radians(diff))) 
ans = math.sqrt(temp)

print(ans)


### FIXED CODE ###

N = input()

if int(N[-1]) == 2 or int(N[-1]) == 4 or int(N[-1]) == 5 or int(N[-1]) == 7 or int(N[-1]) == 9:
	print("hon")
elif int(N[-1]) == 0 or int(N[-1]) == 1 or int(N[-1]) == 6 or int(N[-1]) == 8:
	print("pon")
else:
	print("bon")
count = [0 for i in range(26)]
while(1):
    try:
        str = str(raw_input().lower())
    except EOFError:
            break
    
    for i in range(len(str)):
        k = 97
        for j in range(26):
            if str[i] == chr(k):
                count[j] += 1
            k += 1

k = 97
for i in range(26):
    print "%s : %d" % (chr(k), count[i])
    k += 1
            

### FIXED CODE ###

count = [0 for i in range(26)]
while(1):
    try:
        str = raw_input().lower()
    except EOFError:
            break
    
    for i in range(len(str)):
        k = 97
        for j in range(26):
            if str[i] == chr(k):
                count[j] += 1
            k += 1

k = 97
for i in range(26):
    print "%s : %d" % (chr(k), count[i])
    k += 1
A=input()
B=input()

B.reverse()

if A==B:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

A=list(input())
B=list(input())

B.reverse()

if A==B:
    print("YES")
else:
    print("NO")
N = int(input())
A = [list(map(int,input()).split()) for _ in range(N)]
cnt = 0
for i in range(N):
    l,r = A[i]
    cnt += r-l+1
print(cnt)

### FIXED CODE ###

N = int(input())
cnt = 0
for _ in range(N):
    l,r = map(int,input().split())
    cnt += r-l+1
print(cnt)
A,B, C, D = map(int,input().split())
if A <= C and min(D, B)-C >= 0:
    print(min(D, B)-C)
elif A > C and min(D, B)-A >= 0:
    print(min(D, B)-A)
else:
    print(0)

### FIXED CODE ###

N = input()
print (["No","Yes"][N[0] == N[2]])
def f(x):
  if z[x]==-1:
  	z[x]=max([f(i) for i in v[x]]+[-1])+1
  return z[x]
n,m=map(int,raw_input().split())
v=[[] for _ in xrange(n)]
for x,y in [map(int,raw_input().split()) for _ in xrange(m)]:
  v[x-1].append(y-1)
z=[-1]*n
for i in xrange(n):
  if z[i]==-1:
    f(i)
print max(z)

### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(1<<30)
def f(x):
  if z[x]==-1:
  	z[x]=max([f(i) for i in v[x]]+[-1])+1
  return z[x]
n,m=map(int,raw_input().split())
v=[[] for _ in xrange(n)]
for x,y in [map(int,raw_input().split()) for _ in xrange(m)]:
  v[x-1].append(y-1)
z=[-1]*n
for i in xrange(n):
  if z[i]==-1:
    f(i)
print max(z)
N = int(input())
lst_A = list(map(int, input().split()))
lst_rod_num = [0] * (N + 1)
a, b = 0, 0
lst_ans = []


for a in lst_A:
    lst_rod_num[a] += 1


cnt = 0
for i in range(N - 1, -1, -1):
    if lst_rod_num[i] >= 2:
        lst_ans.append(i)
        cnt += 1
    if cnt == 2:
        a = lst_ans[0]
        b = lst_ans[1]
        break
ans = a * b


print(ans)

### FIXED CODE ###

N = int(input())
lst_A = list(map(int, input().split()))
lst_A.sort(reverse=True)
cur_a = -1
lst_ans = []


for i, a in enumerate(lst_A):
    if cur_a == a:
        lst_ans.append(a)
        cur_a = -1
        if len(lst_ans) == 2:
            break
    else:
        cur_a = a


ans = lst_ans[0] * lst_ans[1] if len(lst_ans) else 0
print(ans)
a = int(input())
b = int(input())

c = a + b
d = a - b
e = a * b
ary = [c, d, e]
f = max(ary)
print ("Max:", f)

### FIXED CODE ###

a,b = map(int,input().split())
print(max([a+b,a-b,a*b]))
n, m = [int(i) for i in input().split()]


def fact(x):
    a = []
    for i in range(2, int(x ** 0.5) + 1):
        if x % i == 0:
            j = 0
            while x % i == 0:
                x //= i
                j += 1
        a.append((i, j))
    if x != 1:
        a.append((x,1))
    return a


f = fact(m)


def conv(a, b):
    c = 1
    for i in range(b, b - a, -1):
        c *= i
    for i in range(1, a + 1):
        c //= i
    return c % (10 ** 9 + 7)


ans = 1
for i in f:
    ans *= conv(n - 1, n + i[1] - 1)
    ans %= 10 ** 9 + 7
print(ans)


### FIXED CODE ###

n, m = [int(i) for i in input().split()]
prime = 10 ** 9 + 7

def fact(x):
    a = []
    for i in range(2, int(x ** 0.5) + 1):
        if x % i == 0:
            j = 0
            while x % i == 0:
                x //= i
                j += 1
            a.append((i, j))
    if x != 1:
        a.append((x,1))
    return a


f = fact(m)
def kai(x):
    a = 1
    for i in range(a, x + 1):
        a *= i
        a %= prime
    return a

def conv(a, b):
    c = kai(b)
    c *= pow(kai(a), prime - 2, prime)
    c %= prime
    c *= pow(kai(b - a), prime - 2, prime)
    return c % prime


ans = 1
for i in f:
    ans *= conv(n - 1, n + i[1] - 1)
    ans %= prime
print(ans)
n = int(input())
s = str(input())

if n%2==1:
  print('No')
else:
  if s[:n/2]==s[n/2:]:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

n = int(input())
s = str(input())
t = int(n/2)

if n%2==1:
  print('No')
else:
  if s[:t]==s[t:]:
    print('Yes')
  else:
    print('No')
import sys

cubes = list(input()) # 入力受付
stack = []
count = 0

for cube in cubes:
    print(stack, cube)
    if not stack:
        stack.append(cube)
    elif stack[-1] != cube:
        print(stack, cube)
        count += 2
        stack.pop()
    else:
        stack.append(cube)
print(count)


### FIXED CODE ###

import sys

cubes = list(input()) # 入力受付
stack = []
count = 0

for cube in cubes:
    if not stack:
        stack.append(cube)
    elif stack[-1] != cube:
        count += 2
        stack.pop()
    else:
        stack.append(cube)
print(count)
import fractions

N,X = map(int,input().split())
x = [int(input()) for i in range(N)]
x.append(X)
x.sort()
y = [0]*N
for i in range(N):
    y[i] = x[i+1]-x[i]

answer = fractions.gcd(y[0],y[1])
for i in range(2,N):
    answer = fractions.gcd(answer,y[i])

print(answer)


### FIXED CODE ###

import fractions

N,X = map(int,input().split())
x = [int(i) for i in input().split()]
x.append(X)
x.sort()
y = [0]*N
for i in range(N):
    y[i] = x[i+1]-x[i]

if len(y) == 1:
    print(y[0])
else:
    answer = fractions.gcd(y[0],y[1])
    for i in range(2,N):
        answer = fractions.gcd(answer,y[i])
    print(answer)
import sys
input = sys.stdin.readline
from functools import reduce
from operator import xor


def read():
    M, K = map(int, input().strip().split())
    return M, K


def solve(M, K):
    seq = [str(0) for i in range(2**(M+1))]
    if K == 0:
        for i in range(2**M):
            seq[2*i] = str(i)
            seq[2*i+1] = str(i)
    else:
        # K ... 0 K rev(...) 0, xor(...) == K の形を作れればOK
        S = [a for a in range(2**M) if a not in (0, K)]
        if M == 1 or reduce(xor, S) != K:
            return -1
        j = 0
        for i in range(2**M-2):
            j += 1
            if j == K:
                j += 1
            seq[i+1] = str(j)
            seq[2**(M+1) - i - 2] = str(j)
        seq[0] = str(K)
        seq[2**M] = str(K)
    return " ".join(seq)
    


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))


### FIXED CODE ###

import sys
input = sys.stdin.readline
from functools import reduce
from operator import xor


def read():
    M, K = map(int, input().strip().split())
    return M, K


def solve(M, K):
    seq = [str(0) for i in range(2**(M+1))]
    if K == 0:
        for i in range(2**M):
            seq[2*i] = str(i)
            seq[2*i+1] = str(i)
    else:
        if K >= 2**M:
            return -1
        # (A) K ... 0 K 0 rev(...), xor(...) == K の形を作れればOK
        S = [a for a in range(2**M) if a not in (0, K)]
        if len(S) == 0 or reduce(xor, S) != K:
            return -1
            
        j = 0
        for i in range(2**M-2):
            j += 1
            if j == K:
                j += 1
            seq[i+1] = str(j)
            seq[2**(M+1) - i - 1] = str(j)
        seq[0] = str(K)
        seq[2**M] = str(K)
        
    return " ".join(seq)


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))
#! usr/bin/env python
# coding: utf-8

char_list = []
while(True):
    str_in = input()
    if str_in=="":
        break
    char_list.append([i for i in str_in.lower()])
# print(char_list)
char_dict = {i:0 for i in "abcdefghijklmnopqrstuvwxyz"}
for i in range(len(char_list)):
    for j in char_list[i]:
        if j in char_dict:
            char_dict[j] += 1
# print(char_dict)
for i in char_dict:
    print(i+" : {0}".format(char_dict[i]))



### FIXED CODE ###

import sys

char_list = []
for line in sys.stdin:
    char_list.append([j for j in line.lower()])
char_dict = {i:0 for i in "abcdefghijklmnopqrstuvwxyz"}
for i in range(len(char_list)):
    for j in char_list[i]:
        if j in char_dict:
            char_dict[j] += 1
for i in char_dict:
    print(i+" : {0}".format(char_dict[i]))
x = int(input())
if x = 3,5,7:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

x = int(input())
if x == 3 or x == 5 or x == 7:
  print("YES")
else:
  print("NO")