Harryxun/stf_run huggingface dataset:
import fractions
from functools import reduce

def main():
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
	for i,aa in enumerate(a):
        j = 0

        while aa % 2 == 0:
            aa //= 2
            j+=1
        if i == 0:
            modtmp = j
        else:
            if modtemp != j:
                print(0)
                return

    for i,aa in enumerate(a):
        a[i] = aa//2
    tmp = lcm(*a)
    # print(tmp)
    cnt =0
    # print(a)

    up = m//tmp
    if up % 2 == 0:
        up = up//2
    else:
        up = up//2 + 1

    nowtmp = tmp
    cnt = 0
    ans = 0
    a.sort()
    # print(nowtmp)
    # print(up)
    before = 0
    before_aa = 0
    print(up)
    return
    for i, aa in enumerate(a):
        if before_aa == aa:
            continue
        if aa == 1:
            print(up)
            return
        if aa <= nowtmp and aa>before:
            cnt += 1

        elif aa> nowtmp :
            ans += cnt * up
            up -=1
            cnt = 0
            nowtmp += tmp
            before += tmp
    ans += cnt * up
    print(ans)

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
if __name__=='__main__':
    main()


### FIXED CODE ###

import fractions
from functools import reduce

def main():
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
    
    for i,aa in enumerate(a):
        j = 0

        while aa % 2 == 0:
            aa //= 2
            j+=1
        if i == 0:
            modtmp = j
        else:
            if modtmp != j:
                print(0)
                return

    for i,aa in enumerate(a):
        a[i] = aa//2
    tmp = lcm(*a)
    # print(tmp)
    cnt =0
    # print(a)

    up = m//tmp
    if up % 2 == 0:
        up = up//2
    else:
        up = up//2 + 1

    nowtmp = tmp
    cnt = 0
    ans = 0
    a.sort()
    # print(nowtmp)
    # print(up)
    before = 0
    before_aa = 0
    print(up)
    return
    for i, aa in enumerate(a):
        if before_aa == aa:
            continue
        if aa == 1:
            print(up)
            return
        if aa <= nowtmp and aa>before:
            cnt += 1

        elif aa> nowtmp :
            ans += cnt * up
            up -=1
            cnt = 0
            nowtmp += tmp
            before += tmp
    ans += cnt * up
    print(ans)

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
if __name__=='__main__':
    main()
s=list(input())
n=["k","e","y","e","n","c","e"]
ans=0
for i in n:
  for j in s:
    s.remove(j)
    if i==J:
      ans+=1
      break
  if ans==7:
    break
if ans=7:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

s = input()
for i in range(0, 8):
    if s[:i] + s[-(7-i):] == "keyence":
        print("YES")
        exit()
print("NO")
#copy code
l = map(int, raw_input().split())
 
print(int(l[0] + l[1] / 2))

### FIXED CODE ###

x, y = map(int, input().split())
print(x + y//2)
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(a)
ans = []
for i in range(m+1) :
  if a[i] < sum(a) / (4 * m) :
    continue
  else :
    ans.append(a[-1])

if len(ans) == m :
  print('Yes')
else :
  print('No')

### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = []
for i in range(m) :
  if a[i] < sum(a) / (4 * m) :
    continue
  else :
    ans.append(a[-1])

if len(ans) == m :
  print('Yes')
else :
  print('No')
N = int(input())
A = [int(i) for i in input().split())]

ans = 0

for i in range(0,N-1):
 for j in range(i+1,N):
  if sum(A[i:j])==0:
   ans +=1

print(ans)

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]

B = {}
B[0] = 1

s = 0
ans = 0

for a in A:
    s += a
    ans += B.get(s,0)
    B[s] = B.get(s,0)+1

print(ans)
z = input()
m,l = z.split()
s = int(m) * int(l)
n = int(m)*2 + int(l)*2

print({} {}.format(str(s),str(n)))

### FIXED CODE ###

z = input()
m,l = z.split()
s = int(m) * int(l)
n = int(m)*2 + int(l)*2

print("{} {}".format(str(s),str(n)))
N, X, M = [int(x) for x in input().split()]
copy = M

k = 0
while M % 2 == 0:
    k += 1
    M = M // 2
L = M

order = 1
if L != 1:
    e = 2 % L
    while e != 1:
        order += 1
        e = (2 * e) % L

A = [0] * (k + order)
A[1] = X
for i in range(2, k + order):
    A[i] = (A[i - 1] * A[i - 1]) % copy

S = sum(A[k:])
ans = 0
if N < k:
    ans = sum(A[1:N + 1])
else:
    q, r = (N - k - 1) // order, (N - k - 1) % order
    ans = sum(A[1:k]) + S * q + sum(A[k:k + r])

print(ans)

### FIXED CODE ###

N, X, M = [int(x) for x in input().split()]

A = [0] * (M + 1)
firstApearAt = {i:0 for i in range(M)}
A[1] =  X
firstApearAt[X] = 1
l, r = 1, 2
for i in range(2, M + 1):
    A[i] = (A[i - 1] * A[i - 1]) % M
    if firstApearAt[A[i]] > 0:
        r = i
        l = firstApearAt[A[i]]
        break
    firstApearAt[A[i]] = i

ans = 0
if N <= l - 1:
    ans = sum(A[1:N + 1])
else:
    q, p = (N - l + 1) // (r - l), (N - l + 1) % (r - l)
    ans = sum(A[1:l]) + q * sum(A[l:r]) + sum(A[l:l + p])

print(ans)
60 88 34
92 41 43
65 73 48
10
60
43
88
11
48
73
65
41
92
34

### FIXED CODE ###

a = [int(j) for i in range(3) for j in input().split(' ')]
n = int(input())
nn = [int(input()) for i in range(n)]

cnt = 0
for ni in nn:
  if ni in a:
    cnt += 1
    a[a.index(ni)] = 0

judge = "No"
for i in range(3):
  if sum(a[i::3])==0 or sum(a[i*3:i*3+3])==0:
    judge = "Yes"
    
if sum(a[::4])==0 or (a[2]+a[4]+a[6])==0:
  judge = "Yes"
  
print(judge)
while 1:
    n = int(raw_input())
    if n == 0: break
    L = [0]*n
    D = [0]*n
    for man in xrange(n):
        m,l = map(int,raw_input().split())
        L[man] = l
        t = 0
        for date in xrange(m):
            s,e = map(int,raw_input().split())
            t ^= ((1 << (e-6))-1) ^ ((1 << (s-6))-1)
        D[man] = t
    dp = [[0]*(1 << 17) for i in xrange(n)]
    dp[0][D[0]] = L[0]
    for i in xrange(1,n):
        for bit in xrange(1 << 17):
            if dp[i-1][bit] and bit&D[i] == 0:
                dp[i][bit|D[i]] = max(dp[i][bit|D[i]], dp[i-1][bit]+L[i])
        dp[i][D[i]] = max(dp[i][D[i]], L[i])
    print max(max(dp[i]) for i in xrange(n))

### FIXED CODE ###

from collections import defaultdict
while 1:
    n = int(raw_input())
    if n == 0: break
    L = [0]*n
    T = [0]*n
    for man in xrange(n):
        m,l = map(int,raw_input().split())
        L[man] = l
        t = 0
        for date in xrange(m):
            s,e = map(int,raw_input().split())
            t |= 2**(e-6)-2**(s-6)
        T[man] = t

    dp = defaultdict(int)
    for l,t in zip(L,T):
        for bit in dp.keys():
            if bit&t == 0:
                dp[bit|t] = max(dp[bit|t], dp[bit]+l)
        dp[t] = max(dp[t], l)
        
    print max(dp.values())
n = int(input())
l = list(map(int,input().split()))
import bisect
l.sort()
count = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        count += bisect.bisect_left(l[j+1:],l[a]+l[b])
        # print(l,a,b,s)
print(count)

### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
l = list(map(int,input().split()))
import bisect
l.sort()
count = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        count += bisect.bisect_left(l,l[i]+l[j]) - j - 1
print(count)
a,b = map(int,input())
ans = a-2*b
if ans <= 0:
  print(0)
else:
  print(ans)

### FIXED CODE ###

a,b = map(int,input().split())
ans = a-2*b
if ans <= 0:
  print(0)
else:
  print(ans)
import math

divisor=[1]
stack=[]
#eiclidean algorithm
A,B=map(int,input().split())
p=max(A,B)
q=min(A,B)
int2=0
gcd=0
while True:
    int2=p%q
    if int2==0:
        gcd=q
        break
    else:
        p=q
        q=int2

stack.append(gcd)
for i in range(2,math.ceil(math.sqrt(gcd))+1):
    if gcd%i==0:
        p=gcd//i
        stack.append(p)
        for x in divisor:
            if i%x==0 and x!=1:
                break
        else:
            divisor+=[i]

while len(stack)!=0:
    p=stack.pop()
    for x in divisor:
        if i%x==0 and x!=1:
            break
    else:
        divisor+=[p]


print(len(divisor))


### FIXED CODE ###

N=int(input())
count=0
for i in range(N+1):
    if i%2==1:
        count+=1

print(count/N)
a=int(input())
b=int2((a+1)/2)
print(b)

### FIXED CODE ###

# -*- coding: utf-8 -*-
a=int(input())
b=int((a+1)/2)
print(b)
A,B,C = map(int,input().split())
x = C-A+B
print(X)
if X < 0
print(0)

### FIXED CODE ###

A,B,C = map(int,input().split())
X = C - A + B
if X < 0:
    X = 0
print(X)
2 print(len(list(filter(lambda x: len(str(x)) % 2 == 1, range(1, int(input()) + 1)))))

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1, n+1):
    if 1 <= i < 10 or 100 <= i < 1000 or 10000 <= i < 100000:
        ans += 1
print(ans)
n=int(input())
l=list(map(int,input().split()))
ans=0
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)
if n==1:
    ans=x[0]
else:
    element = gcd(x[0], x[1])
    if n==2:
      ans=element
    else:
        for i in range(2,n):
            element=gcd(element,x[i])
        ans=element
print(ans)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
ans=0
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)
if n==1:
    ans=l[0]
else:
    element = gcd(l[0], l[1])
    if n==2:
      ans=element
    else:
        for i in range(2,n):
            element=gcd(element,l[i])
        ans=element
print(ans)
N,W=map(int,input().split())
Wlist=[]
Vlist=[]
for i in range(N):
  w,v=map(int,input().split())
  Wlist+=[w]
  Vlist+=[v]
dp=[[0 for p in range(W+1)] for i in range(N)]
for i in range(W+1):
  if i>=Wlist[0]:
    dp[0][i]=Vlist[0]
for i in range(1,N):
  wi=Wlist[i]
  for j in range(W+1):
    if j-wi>=0:
      dp[i][j]=max(dp[i-1][j-wi]+Vlist[i],dp[i-1][j])
    else:
      dp[i][j]=max(dp[i-1][j],dp[i][j])
print(max(dp[N-1]))

### FIXED CODE ###

N=int(input())
H=list(map(int,input().split()))
dplist=[0 for i in range(N)]
dplist[0]=0
dplist[1]=abs(H[1]-H[0])
for i in range(2,N):
  dplist[i]=min(dplist[i-1]+abs(H[i]-H[i-1]),dplist[i-2]+abs(H[i-2]-H[i]))
print(dplist[N-1])
x, y, z = map(int, input().split())
print(z + " " + x + " " + y)


### FIXED CODE ###

x, y, z = map(str, input().split())
print(z + " " + x + " " + y)
h = input()
count = 0
count_1 = 1
count_2 = 1
while True:
    if h == 1:
        print(count_2)
        break
    else:
        h = h // 2
        count_1 = count_1 * 2
        count_2 += count_1

### FIXED CODE ###

h = int(input())
count = 0
count_1 = 1
count_2 = 1
while True:
    if h == 1:
        print(count_2)
        break
    else:
        h = h // 2
        count_1 = count_1 * 2
        count_2 += count_1
import sys
from collections import deque
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsm = lambda: map(str, sys.stdin.readline().split())

n, k = nm()
v = nl()
d = deque(v)
ans = 0
for m in range(k + 1):
    for p in range(m + 1):
        lis = copy.copy(d)
        neg = []
        summ = 0
        for i in range(p):
            if len(lis) == 0:
                break
            l = lis.popleft()
            summ += l
            if l < 0:
                neg.append(l)
        for j in range(m - p):
            if len(lis) == 0:
                break
            l = lis.pop()
            summ += l
            if l < 0:
                neg.append(l)
        neg.sort()
        for o in range(k - m):
            if o < len(neg):
                summ -= neg[o]
            else:
                break
        ans = max(ans, summ)
print(ans)


### FIXED CODE ###

import sys
from collections import deque
import copy
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsm = lambda: map(str, sys.stdin.readline().split())

n, k = nm()
v = nl()
d = deque(v)
ans = 0
for m in range(k + 1):
    for p in range(m + 1):
        lis = copy.copy(d)
        neg = []
        summ = 0
        for i in range(p):
            if len(lis) == 0:
                break
            l = lis.popleft()
            summ += l
            if l < 0:
                neg.append(l)
        for j in range(m - p):
            if len(lis) == 0:
                break
            l = lis.pop()
            summ += l
            if l < 0:
                neg.append(l)
        neg.sort()
        for o in range(k - m):
            if o < len(neg):
                summ -= neg[o]
            else:
                break
        ans = max(ans, summ)
print(ans)
n = input()
print(n**3)

### FIXED CODE ###

print(int(input())**3)
a,b,c=map(int,input().split())
print(max(a,b,c)*10 + sorted(nums)[-2] + min(a,b,c))

### FIXED CODE ###

a,b,c=map(int,input().split())
print(a+b+c+max(a,b,c)*9)
b, c = map(int, input().split())
if b < c:
  print('0')
  else:
    print('10')


### FIXED CODE ###

a = input().split()
if a[0] < a[1]:
  print('0')
else:
  print('10')
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:    A -= 1
else: B -= 1
print(A, B)

### FIXED CODE ###

S = input()
print(''.join(['x' for x in S]))
def resolve():
    n = int(input())
    x_list = list(map(int, input().split()))
    mn =　10**9
    for i in range(1, max(x_list)+1):
        sm = 0
        for x in x_list:
            sm += (x-i)**2
        if mn > sm:
            mn = sm  
    print(mn)
resolve()

### FIXED CODE ###

def resolve():
    n = int(input())
    x_list = list(map(int, input().split()))
    mn = 10**9
    for i in range(1, max(x_list)+1):
        sm = 0
        for x in x_list:
            sm += (x-i)**2
        if mn > sm:
            mn = sm  
    print(mn)
resolve()
a,b,c=input().split()
print(a+" "+b+" "+c)

### FIXED CODE ###

a=input()
l=a.split(",")
print(l[0]+" "+l[1]+" "+l[2])
a, b = map(int, input())
print(int((a + b ) / 2))


### FIXED CODE ###

a, b = map(int, input().split())
c = (a + b) / 2
if c == int(c): print(int(c))
else: print(int(c + 1))
S = list(input())
if S[2] == S[3]　and S[4] == S[5]:
    print("Yse")
else:
    print("No")


### FIXED CODE ###

S = list(input())
if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")
N = int(input())
Ss=[input() for s in range(N)]
count = [s.count("AB") for s in Ss if "AB" in s]
headcount = len([s for s in Ss if s[0]=="B"])
outcount = len([s for s in Ss if s[-1]=="A"])
if headcount==outcount:
    print(sum(count) + min(headcount, outcount)-1)
else:
    print(sum(count)+min(headcount,outcount))

### FIXED CODE ###

R, G, B, N = list(map(int, input().split()))

cnt = 0
for r in range(N//R + 1):
    for g in range((N - r*R)//G + 1):
        if (N-r*R-g*G) % B == 0:
            cnt += 1

print(cnt)
A,B,K = map(int, input().split())
X = list(range(A,B+1))

for _ in sorted(set(X[:K]) | set(X[-K:])):
  print(_)

### FIXED CODE ###

A,B,K = map(int, input().split())
X = range(A,B+1)

for _ in sorted(set(X[:K]) | set(X[-K:])):
  print(_)
import sys
a, b, c = map(int,sys.stdin.readline().split())
d = c - a - b
if d > 0 && d * d > 4 * b * a:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import sys
a, b, c = map(int,sys.stdin.readline().split())
d = c - a - b
if d > 0 and d * d > 4 * b * a:
  print("Yes")
else:
  print("No")
N, M = map(int, input().split())
lst = [0] * N
if M == 0 and N != 1:
    lst[0] = 1
else:
    dic = {}
    for _ in range(M):
        s, c = map(int, input().split())
        n = dic.get(s)
        if n is not None and n != c:
            print(-1)
            exit()
        dic[s] = c

for k, v in dic.items():
    lst[k - 1] = v

if N != 1 and lst[0] == 0:
    print(-1)
    exit()

if len(lst) != 0 and lst[0] == 0:
    lst[0] = 1

print("".join(map(str, lst)))


### FIXED CODE ###

N, M = map(int, input().split())
if M == 0:
    if N == 1:
        print(0)
    else:
        print("1" + "0" * (N - 1))
    exit()

dic = {}
for _ in range(M):
    s, c = map(int, input().split())
    if s == 1 and c == 0 and N != 1:
        print(-1)
        exit()
    n = dic.get(s)
    if n is not None and n != c:
        print(-1)
        exit()
    dic[s] = c

lst = [0] * N
for k, v in dic.items():
    lst[k - 1] = v

if len(lst) != 1 and lst[0] == 0:
    lst[0] = 1

print("".join(map(str, lst)))
n = int(input())
s = input()
a = ''
for i in range(0,len(s)):
   cc = 65+ (ord(s[i]) + n - 65)%26
   a += chr(cc)

print(a)

### FIXED CODE ###

a = {'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1}
s = input()

ans = a.get(s)
print(ans)
s = input()
if abs(c-a) > abs(b-a):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

s = input()
a, b, c = [int(_) for _ in s.split()]
a, b, c = [_-a for _ in (a, b, c)]

if b * c > 0 and abs(b) > abs(c):
    print("Yes")
else:
    print("No")
A = int(input())
B = int(input())
C = int(input())
X = int(input())
res=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i + 100*j + 50*k == X:
                res + = 1
print(res)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())
res=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i + 100*j + 50*k == X:
                res += 1
print(res)
_=input();s=list(map(int, input().split()));print("TFhoruere"["Y"in s::2])

### FIXED CODE ###

_=input();s=input().split();print("TFhoruere"["Y"in s::2])
r=input()
print(r**2)

### FIXED CODE ###

r=int(input())
print(r**2)
import sys
from collections import Counter

def ii(): return int(sys.stdin.readline())
def li(): return list(map(int, sys.stdin.readline().split()))

if __name__ == "__main__":
    n = ii()
    a = li()
    c = Counter(a)
    del_list = []
    for k, v in c.items():
        if v >= 2:
            del_list.append(k)
    for k in del_list:
        del c[k]
    a = sorted(list(c.keys()))
    max_a = a[-1]
    if len(a) == 0:
        print(0)
        exit()
    b = [True] * (max_a + 1)
    def sived(x):
        for not_ans in range(x+x, max_a + 1, x):
            b[not_ans] = False
    for i in a:
        if b[i]:
            sived(i)
    ans = 0
    for i in a:
        if b[i]:
            ans += 1
    print(ans)


### FIXED CODE ###

import sys
from collections import Counter

def ii(): return int(sys.stdin.readline())
def li(): return list(map(int, sys.stdin.readline().split()))

if __name__ == "__main__":
    n = ii()
    a = li()
    a = sorted(a)
    a_max = a[-1]
    sive = [True] * (a_max + 1)

    def sived(x):
        for non_ans in range(x, a_max+1, x):
            sive[non_ans] = False
    ans = 0
    for i in range(len(a)-1):
        if sive[a[i]]:
            sived(a[i])
            if a[i] != a[i+1]:
                ans += 1
    if sive[a_max]:
        ans += 1
    print(ans)
#coding:utf-8
x=int(raw_input())  # 1 # 一つの数字のみ
# w, a, b =map(int,raw_input().split())  # 2 3  # 二つの数字
sums=0
for i in range(14145):
    sums += i
    # if x == place:
    # print sum
    # print i
    if sums < x:
        pass
    elif sums >= x:
        print i
        break

### FIXED CODE ###

#coding:utf-8
# x=int(raw_input())  # 1 # 一つの数字のみ
x,y=map(str,raw_input().split())  # 2 3  # 二つの数字
# x,z=raw_input()  # 文字列
# print x,y,z
# sum =/ x[0]+y[0]+y[1]
# s = z[0]
if x =="H":
    print y
elif x =="D":
    if y=="D":
        print "H"
    elif y=="H":
        print "D"
elif x =="D":
    if y =="D":
        print"D"
    elif y =="H":
        print"H"
# prin?t x,y
#!/usr/bin/env python

def q_sort(a):
        if len(a)==1:
                return a
        pivot  = a[len(a)/2]
        return q_sort([i for i in a if i < pivot ]) + [pivot] + q_sort([i for i in a if pivot < i])



n = int( raw_input() )
array =  [ int(i) for i in raw_input().split(" ") ]
for i in q_sort(array):
        print i,

### FIXED CODE ###

#!/usr/bin/env python

import random



def get_2nd(a,b,c):
        l = [a,b,c]
        l.sort()
        return l[1]

def q_sort(a):
        if a==[]:
                return []
        l = len(a)
        pivot = get_2nd(a[0],a[l/2],a[l-1])
        return q_sort([i for i in a if i < pivot ]) + [i for i in a if i == pivot ] + q_sort([i for i in a if pivot < i])



n = int( raw_input() )
array =  [ int(i) for i in raw_input().split(" ") ]
random.shuffle(array)
for i in q_sort(array):
        print i,
from operator import itemgetter

n = int(input())
s = [[x, *(input().split())] for x in range(n)]

s = sorted(s, key = itemgetter(2), reverse=True)
s = sorted(s, key = itemgetter(1))

for i in s:
    print(i[0]+1)

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
    s, p = input().split()
    a.append([s, int(p), i])

a.sort(key=lambda x:x[1], reverse=True)
a.sort(key=lambda x:x[0])

for x in a:
    print(x[2]+1)
N,A,B,C = map(int,input().split())
data = {
  "A":A,
  "B":B,
  "C":C
}
select = []
S = list(input() for _ in range(N))
for i in range(N):
  s = S[i]
  if data[s[0]] == data[s[1]] ==0:
    print("No")
    exit(0)
  elif data[s[0]] > data[s[1]]:
    data[s[0]] -= 1
    data[s[1]] += 1
    select.append(s[1])
  elif data[s[0]] < data[s[1]]
    data[s[0]] += 1
    data[s[1]] -= 1
    select.append(s[0])
  else:
    ss = S[i+1]
    if i == N -1:
      select.append(s[0])
    elif s[0] in ss:
      data[s[0]] += 1
      data[s[1]] -= 1
      select.append(s[0])
    else:
      data[s[0]] -= 1
      data[s[1]] += 1
      select.append(s[1])
    
print("Yes")
for i in select:
  print(i)

### FIXED CODE ###

N,A,B,C = map(int,input().split())
data = {
  "A":A,
  "B":B,
  "C":C
}
select = []
S = list(input() for _ in range(N))
for i in range(N):
  s = S[i]
  if data[s[0]] == data[s[1]] ==0:
    print("No")
    exit(0)
  elif data[s[0]] > data[s[1]]:
    data[s[0]] -= 1
    data[s[1]] += 1
    select.append(s[1])
  elif data[s[0]] < data[s[1]]:
    data[s[0]] += 1
    data[s[1]] -= 1
    select.append(s[0])
  elif i == N-1:
    select.append(s[0])
  elif s[0] in S[i+1]:
    data[s[0]] += 1
    data[s[1]] -= 1
    select.append(s[0])
  else:
    data[s[0]] -= 1
    data[s[1]] += 1
    select.append(s[1])
print("Yes")
for i in select:
  print(i)
n,x=(int(i) for i in input().split())
d=0
c=0
for i in range(n):
  l=int(input())
  d=d+l
  if d<=x:
    c=c+1
  elif d>x:
    print(c)
    break

### FIXED CODE ###

n,x=(int(i) for i in input().split())
d=0
c=1
l=[int(i) for i in input().split()]
for i in range(n):
  d=d+l[i]
  if d<=x:
    c=c+1
  elif d>x:
    break
print(c)
N,K = map(int, input().split())
A =[0]
B=list(map(int, input().split()))
for m in range(N):
    A.append(B[m])
place=set([])
i=1
count=0
while i not in place:
    place.add(i)
    i=A[i]
    count+=1
if count>=K:
    print(place[K])
else:
    loop=[i]
    start=i
    j=A[i]
    count+=1
    while j!=start:
        loop.append(j)
        j=A[j]
        count+=1
    if count>=K:
        print(loop[K-len(place)-1])
    else:
        num=(K-count)%len(loop)
        print(loop[num])

### FIXED CODE ###

N,K = map(int, input().split())
A =[0]
B=list(map(int, input().split()))
for m in range(N):
    A.append(B[m])
place=set([])
p=[]
i=1
count=0
while i not in place:
    place.add(i)
    p.append(i)
    i=A[i]
    count+=1
if count>K:
    print(p[K])
else:
    loop=[i]
    start=i
    j=A[i]
    count+=1
    while j!=start:
        loop.append(j)
        j=A[j]
        count+=1
    if count>K:
        print(loop[K-len(p)])
    else:
        num=(K-count)%len(loop)
        print(loop[num])
x=input()
x=list(x)
s=0
t=0
ans=0
for i in range(len(x)):
    if x[i]="S":
        s+=1

    else:
        if s==0:
            ans+=1
        else:
            s-=1

print(ans+s)

### FIXED CODE ###

x=list(input())
s=0
t=0
ans=0
for i in range(len(x)):
    if x[i]=="S":
        s+=1

    else:
        if s==0:
            ans+=1
        else:
            s-=1

print(ans+s)
a,b = list(map(int,input().split()))
aaa = list(map(int,input().split()))

result = [0]*a
for i in range(a):
    h = aaa[i]
    j = int(sum(aaa) / (4*b))

    if h > j:
        result[i] = 1
    else:
        result[i] = 0

if result.count(1) >= b:
    ans = "yes"
else:
    ans = "no"

print(ans)

### FIXED CODE ###

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

print(c,a,b)