Harryxun/stf_run huggingface dataset:
N=int(input())
a=[int(i) for i in input().split()]
b,c,d,e,f,g,h,j,k=0,0,0,0,0,0,0,0,0
for i in range(N):
 if (a[i]<400):
  b=1
 elif (a[i]<800):
  c=1
 elif ([i]<1200):
  d=1
 elif (a[i]<1600):
  e=1
 elif (a[i]<2000):
  f=1
 elif ([i]<2400):
  g=1
 elif (a[i]<2800):
  h=1
 elif (a[i]<3200):
  j=1
 else:
  k += 1
min=b+c+d+e+f+g+h+j
max=min+k
if min==0:
 min=1
print (min,max)

### FIXED CODE ###

r,g,b=map(int, input().split())
if (r*100+g*10+b)%4==0:
 print ('YES')
else:
 print ('NO')
W = input()

count = 0
while True:
    line = input()
    if line == 'END_OF_TEXT'
        break

    for s in line.lower().split():
        if s == W:
            count += 1

print(count)

### FIXED CODE ###

W = input().lower()

count = 0
while True:
    line = input()
    if line == 'END_OF_TEXT':
        break

    for s in line.lower().split():
        if s == W:
            count += 1

print(count)
a,b,c = [int(s) for s in input().split(" ")]
  ret = min(a+b+1,c) + b
  print(ret)

### FIXED CODE ###

a,b,c = [int(s) for s in input().split(" ")]
ret = min(a+b+1,c) + b
print(ret)
D, N = map(int, input().split())
if D == 0:
  if N == 100:
    print(101)
  else:
  	print(N)
elif D == 1:
  if N == 10000:
    print(10100)
  else:
    print(N*100)
else:
  if N == 100
    print(1000100)
  else:
    print(N*10000)


### FIXED CODE ###

D, N = map(int, input().split())
if D == 0:
  if N == 100:
    print(101)
  else:
  	print(N)
elif D == 1:
  if N == 100:
    print(10100)
  else:
    print(N*100)
else:
  if N == 100:
    print(1010000)
  else:
    print(N*10000)
from collections import deque

n, m = map(int, input().split())
G = [list() for _ in range(n)]
for _ in range(m):
  a, b = map(int, input().split())
  a -= 1; b -= 1
  G[a].append(b)
  G[b].append(a)
Q = int(input())
queries = [tuple(map(int, input().split())) for _ in range(Q)][::-1]
dp = [[Q]*n for _ in range(11)]
for i, (v, d, _) in enumerate(queries):
  dp[v-1][d] = i
for d in range(10, 0, -1):
  for v in range(n):
    if dp[v][d] < Q:
      dp[v][d-1] = min(dp[v][d-1], dp[v][d])
      for x in G[v]:
        dp[x][d-1] = min(dp[x][d-1], dp[v][d])
queries.append((-1, -1, 0))
color = [queries[dp[v][0]][2] for v in range(n)]
print(*color, sep='\n')


### FIXED CODE ###

import sys

readline = sys.stdin.readline

ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))

def solve():
  n, m = nm()
  G = [list() for _ in range(n)]
  for _ in range(m):
    a, b = nm()
    a -= 1; b -= 1
    G[a].append(b)
    G[b].append(a)
  Q = int(input())
  queries = [tuple(nm()) for _ in range(Q)][::-1]
  dp = [[Q]*11 for _ in range(n)]
  for i in range(Q-1, -1, -1):
    v, d, _ = queries[i]
    dp[v-1][d] = i
    
  for d in range(10, 0, -1):
    for v in range(n):
      for x in G[v] + [v]:
        if dp[x][d-1] > dp[v][d]:
          dp[x][d-1] = dp[v][d]
          
  queries.append((-1, -1, 0))
  color = [queries[dp[v][0]][2] for v in range(n)]
  print(*color, sep='\n')
  return

solve()
import math
x = int(input())
i = 1

def expo(x,i):
    while x % i == 0:
        x = x//i
    if x == 1:
        return True
    else:
        return False

while x >= 1:
    for j in range(2,int(math.sqrt(x))+1):
        if expo(x, j) == True:
            print(x)
            break
    if expo(x,j) == True:
        break
    else:
        x -= 1


### FIXED CODE ###

import math
x = int(input())
i = 1

def expo(x,i):
    while x % i == 0:
        x = x//i
    if x == 1:
        return True
    else:
        return False

if x > 4:
    while x >1:
        for j in range(2,int(math.sqrt(x))+1):
            if expo(x, j) == True:
                print(x)
                break
        if expo(x,j) == True:
            break
        else:
            x -= 1
else:
    print(1)
N = int(input())
A = list(map(int, input().split()))
count = 0

count = A.count(0)
A = [n for n in A if n != 0]

for i in range(N):
    num = A[i]
    for Aj in A[i+1:]:
        num += Aj
        if num == 0:
            count += 1

print(count)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
dic = {0:1}
sum_n = 0
count = 0


for a in A:
    sum_n += a
    if sum_n in dic:
        count += dic[sum_n]
        dic[sum_n] += 1
    else:
        dic[sum_n] = 1


print(count)
N, Y = map(int, input().split())
li = [[10*a+5*b+(N - a - b), a, b, N- a-b] for a in range(N+1) for b in range(N+1-a) if 10*a+5*b+(N - a - b) == Y//1000]
if len(li) == 0:
    print('-1 -1 -1')
else:
    x = li[0]
    print(f'{x[1]} {x[2]} {x[3]}')

### FIXED CODE ###

N, Y = map(int, input().split())
li = [[10*a+5*b+(N - a - b), a, b, N- a-b] for a in range(N+1) for b in range(N+1-a) if 10*a+5*b+(N - a - b) == Y//1000]
if len(li) == 0:
    print('-1 -1 -1')
else:
    x = li[0]
    print('{} {} {}'.format(x[1], x[2], x[3]))
from collections import deque
n,k=map(int, input().split())

A = deque(map(int, input().split()))
li = []
li2 = [0]*n
li.append(1)

next = 0
t=0
rep = False

for i in range(n):
    li.append(A[next])
    li2[next] = 1
    next = A[next]-1

    if li2[next] == 1:
        t = li.index(A[next])
        rep = True
        break

if rep == True:
    tmp = (k%len(li[t:])) - len(li[0:t])
    g=li[t:]
    print(g[tmp])
else:
    print(li[k-1])


### FIXED CODE ###

from collections import deque
n,k=map(int, input().split())

A = deque(map(int, input().split()))
li = []
li2 = [0]*n
li.append(1)

next = 0

t=0
rep = False

for i in range(k):
    if i == k:
        print(next+1)
        exit()

    if li2[next] == 1:
        t = li.index(next+1)
        rep = True
        li.pop()
        break

    li.append(A[next])
    li2[next] = 1
    next = A[next]-1


tmp = (k-t)%len(li[t:])
print(li[tmp+t])
K, S = map(int, input().split())
ct = 0
for i in range(K + 1):
    for j in range(K + 1):
        a = S - i - j
        if 0 <= a <= k:
            ct += 1

print(ct)


### FIXED CODE ###

K, S = map(int, input().split())
ct = 0
for i in range(K + 1):
    for j in range(K + 1):
        a = S - i - j
        if 0 <= a <= K:
            ct += 1

print(ct)
D = int(input())
if D = 25:
  print("Christmas")
elif D = 24:
  print("Christmas Eve")
elif D = 23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

### FIXED CODE ###

D = int(input())
if D == 25:
  print("Christmas")
elif D == 24:
  print("Christmas Eve")
elif D == 23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")
a=list(int(input().split()))
print(max(a)-min(a))

### FIXED CODE ###

*a,=map(int,input().split())
print(max(a)-min(a))
n = int(input())
str_n = str(n)
wa = 0
for i in range(len(str_n)):
    wa += int(str_n[i])
if x%wa==0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = int(input())
str_n = str(n)
wa = 0
for i in range(len(str_n)):
    wa += int(str_n[i])
if n%wa==0:
    print('Yes')
else:
    print('No')
import math
A, B, C, D = (int(x) for x in input().split())

C_ = int(B/C) - int(A/C)
if A%C == 0:                                                                                                                                                                                                
    C_ += 1                                                                                                                                                                                                 
D_ = int(B/D) - int(A/D)
if A % D == 0:                                                                                                                                                                                              
    D_ += 1                                                                                                                                                                                                 

E = C * D / math.gcd(C, D)
E_ = int(B/E) - int(A/E)

ans = B - A + 1 - C_ - D_ + E_
print(ans)


### FIXED CODE ###

import fractions
A, B, C, D = (int(x) for x in input().split())

C_ = int(B//C) - int((A-1)//C)
D_ = int(B//D) - int((A-1)//D)

E = int(C * D // int(fractions.gcd(C, D)))
E_ = int(B//E) - int((A-1)//E)

ans = B - A + 1 - C_ - D_ + E_
print(ans)
n = int(input())
a = list(map(int, input().split()))

a.sort(reverce = True)

alice = sum(a[0::2])
bob = sum(a[1::2])

print(alice - bob)


### FIXED CODE ###

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

alice = 0
bob = 0

a.sort(reverse = True)

i = 0

while True:
    if i >= n:
        break
    alice += a[i]
    i += 1
    if i >= n:
        break
    bob += a[i]
    i += 1

print(alice - bob)
S, W = int(input().split())

if(S > W):
  print("safe")
else:
  print("unsafe")

### FIXED CODE ###

S, W = map(int, input().split())

if(S > W):
  print("safe")
else:
  print("unsafe")
N = int(input())
A = list(int(i) for i in input().split())
count = 0

for i in A:
  if i <= 0:
    count += 1

A_abs = [abs(i) for i in A]
if count%2 == 0:
  print(sum(A_abs))
  
else:
  A_min = A.index(min(A_abs))
  A_abs[A_min] = A[A_min]*(-1)
  print(sum(A_abs))
  

### FIXED CODE ###

N = int(input())
A = list(int(i) for i in input().split())
count_m = 0
count_z = 0

for i in A:
  if i < 0:
    count_m += 1
  elif i == 0:
    count_z += 1

A_abs = [abs(i) for i in A]
if count_m%2 == 0 or (count_m+count_z)%2 == 0:
  print(sum(A_abs))
  
else:
  A_min = A_abs.index(min(A_abs))
  A_abs[A_min] = A_abs[A_min]*(-1)
  print(sum(A_abs))
n = int(input())

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

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

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

m = n-1
if m == 1:
    sumc = sum(c)
else:
    sumc = sum(c)
    tmp = a[m]
    sumc -= c[tmp-1]
ans = sum(b)
ans += sumc

print(ans)


### FIXED CODE ###


n = int(input())

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

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

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

m = n-1
ans = 0
for i in range(n):
    ans += b[a[i]-1]
    if (i>0)and(a[i] == a[i-1]+1):
        ans += c[a[i-1]-1]

print(ans)
import  numpy as mul
import math

N=int(input())
A=list(map(int,input().split()))
ans=mul.prod(A)

if int(math.log10(ans)) > 17:
	print("-1")
else:
	print(ans)

### FIXED CODE ###

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

ans=1
if 0 in A:
    ans = 0
else:
    A.sort(reverse=True)
    for a in A:
        if a > 10**18:
            ans = -1
            break
        else:
            ans *= a
            if ans > 10**18:
                ans = -1
                break
print(ans)
K,X = map(int, input().split())
if K*500 >= X:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',]
C = input()
print(l[l.index(C)+1])
input()
c=""


for i in range(1, len(a)):
    if a[i-1]=="?":
        c=c+"D"
    else:
        c=c+a[i-1]
        

print(c)


### FIXED CODE ###

a= input()
c=""
for i in range(0, len(a)):
    if a[i]=="?":
        c=c+"D"
    else:
        c=c+a[i]
print(c)
n = int(input())
#j = L0
j = 2
#k = L1
k = 1

if n == 0:
    print(2)
if n == 1:
    print(1)

for i in range(1,n):
    l = j + k
    j = k
    k = l

print(l)

### FIXED CODE ###

n = int(input())
#j = L0
j = 2
#k = L1
k = 1

if n == 0:
    print(2)
    exit(0)
if n == 1:
    print(1)
    exit(0)

for i in range(1,n):
    l = j + k
    j = k
    k = l

print(l)
abc = list(map(int, input().split()))
k = int(input())
mx = abc.pop(max(abc))
print(mx * k + sum(abc))

### FIXED CODE ###

abc = list(map(int, input().split()))
k = int(input())
mx = abc.pop(abc.index(max(abc)))
print(mx * pow(2, k) + sum(abc))
a, b, c, d = map(int, input().split())

if a > 0 and c > 0:
    ans = b * d
elif  b < 0 and d < 0:
    ans = a * c
elif a >= 0 and d <= 0:
    ans = a * d
elif b <= 0 and c >= 0:
    ans = b * c

    
print(ans)


### FIXED CODE ###

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

ans = []

ans.append(a * c)
ans.append(b * c)
ans.append(a * d)
ans.append(b * d)

print(max(ans))
def main():
    input()
    H=map(int,input().split())
    A=map(int,input().split())
    n=10**5+1

    def update_max(k,x):
        k += num_max-1
        seg_max[k] = x
        while k:
            k = (k-1)//2
            seg_max[k] = max(seg_max[k*2+1],seg_max[k*2+2])
    def query_max(p,q):
        if q<=p:
            return ide_ele_max
        p += num_max-1
        q += num_max-2
        res=ide_ele_max
        while q-p>1:
            if p&1 == 0:
                res = max(res,seg_max[p])
            if q&1 == 1:
                res = max(res,seg_max[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = max(res,seg_max[p])
        else:
            res = max(max(res,seg_max[p]),seg_max[q])
        return res
    ide_ele_max = 0
    num_max =2**(n-1).bit_length()
    seg_max=[ide_ele_max]*2*num_max

    for h,a in zip(H,A):
        update_max(h,query_max(0,h)+a)
    
    print(query_max(0,n))
main()

### FIXED CODE ###

def main():
    input()
    H=map(int,input().split())
    A=map(int,input().split())
    n=2*10**5+1

    def update_max(k,x):
        k += num_max-1
        seg_max[k] = x
        while k:
            k = (k-1)//2
            seg_max[k] = max(seg_max[k*2+1],seg_max[k*2+2])
    def query_max(p,q):
        if q<=p:
            return ide_ele_max
        p += num_max-1
        q += num_max-2
        res=ide_ele_max
        while q-p>1:
            if p&1 == 0:
                res = max(res,seg_max[p])
            if q&1 == 1:
                res = max(res,seg_max[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = max(res,seg_max[p])
        else:
            res = max(max(res,seg_max[p]),seg_max[q])
        return res
    ide_ele_max = 0
    num_max =2**(n-1).bit_length()
    seg_max=[ide_ele_max]*2*num_max

    for h,a in zip(H,A):
        update_max(h,query_max(0,h)+a)
    
    print(query_max(0,n))
main()
N = int(input())

ans = 0
dic = {"A": 0, "B": 0}
dic2 = {"AB": 0, "A": 0, "B": 0}
for i in range(N):
    S = list(str(input()))
    pre = S[0]
    for j in range(1, len(S)):
        if (S[j - 1] + S[j]) == "AB":
            ans += 1
    if S[-1] == "A":
        dic["A"] += 1
    if S[0] == "B":
        dic["B"] += 1

    if S[-1] == "A" and S[0] == "B":
        dic2["AB"] += 1
    elif S[-1] == "A":
        dic2["A"] += 1
    elif S[0] == "B":
        dic2["B"] += 1
if dic2["A"] == 0 and dic2["B"] == 0:
    print(ans + dic["AB"]//2)
else:
    print(ans + min(dic["A"], dic["B"]))


### FIXED CODE ###

N = int(input())

ans = 0
dic = {"A": 0, "B": 0}
dic2 = {"AB": 0, "A": 0, "B": 0}
for i in range(N):
    S = list(str(input()))
    pre = S[0]
    for j in range(1, len(S)):
        if (S[j - 1] + S[j]) == "AB":
            ans += 1
    if S[-1] == "A":
        dic["A"] += 1
    if S[0] == "B":
        dic["B"] += 1

    if S[-1] == "A" and S[0] == "B":
        dic2["AB"] += 1
    elif S[-1] == "A":
        dic2["A"] += 1
    elif S[0] == "B":
        dic2["B"] += 1

if dic2["A"] == 0 and dic2["B"] == 0:
    print(ans + max(dic2["AB"] - 1, 0))
else:
    print(ans + min(dic["A"], dic["B"]))
N = int(input())
a = list(map(int, input().split(" ")))

t = 1
for x in a:
    if x == t:
        t += 1
t -= 1

if t == 0:
    print(-1)
else:
    print(M-t)



### FIXED CODE ###


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

t = 1
for x in a:
    if x == t:
        t += 1
t -= 1

if t == 0:
    print(-1)
else:
    print(N-t)
#include<bits/stdc++.h>
using namespace std;

string s;

int main(){
  cin >> s;
  int sn  = 0:
  int n
  for(int i=0;i<s.size();i++){
    sn += s[i]-'0';
    n = 10*n+(s[i]-'0');
  if(n%sn!=0)cout<<"No"<<endl;
  else cout <<"Yes"<<endl
  return 0

### FIXED CODE ###

n = input()
sn=0
for i in n:
    sn += int(i)
n = int(n)
if n%sn==0:
    print("Yes")
else:
    print("No")
icase=0
if icase==0:
    n=int(input())

    f=[]
    for i in range(n):
        fi=map(int,input().split())
        f.append(fi)
    p=[]
    for i in range(n):
        pi=map(int,input().split())
        p.append(pi)
elif icase==1: 
    n=1
    f=[[1, 1, 0, 1, 0, 0, 0, 1, 0, 1]]
    p=[[3, 4, 5, 6, 7, 8, 9, -2, -3, 4, -2]]
elif icase==2: 
    n=2
    f=[[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]]
    p=[[0, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1],
       [0, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1]]
elif icase==3: 
    n=3
    f=[[1, 1, 1, 1, 1, 1, 0, 0, 1, 1],
       [0, 1, 0, 1, 1, 1, 1, 0, 1, 0],
       [1, 0, 1, 1, 0, 1, 0, 1, 0, 1]]
    p=[[-8, 6, -2, -8, -8, 4, 8, 7, -6, 2, 2],
       [-9, 2, 0, 1, 7, -5, 0, -2, -6, 5, 5],
       [6, -6, 7, -9, 6, -5, 8, 0, -9, -7, -7]]
    
import itertools
sumpmax=-10**11
for i in itertools.product([0,1], repeat=10):
    r=list(i)
    sump=0
    if sum(r)!=0:
        for jj in range(n):
            ci=0
            for j in range(10):
                ci=ci+r[j]*f[jj][j]
            sump=sump+p[jj][ci]
#            print(sump,r)
        sumpmax=max(sump,sumpmax)
print(sumpmax)
        


### FIXED CODE ###

icase=0
if icase==0:
    n=int(input())

    f=[]
    for i in range(n):
        fi=list(map(int,input().split()))
        f.append(fi)
    p=[]
    for i in range(n):
        pi=list(map(int,input().split()))
        p.append(pi)
elif icase==1: 
    n=1
    f=[[1, 1, 0, 1, 0, 0, 0, 1, 0, 1]]
    p=[[3, 4, 5, 6, 7, 8, 9, -2, -3, 4, -2]]
elif icase==2: 
    n=2
    f=[[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]]
    p=[[0, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1],
       [0, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1]]
elif icase==3: 
    n=3
    f=[[1, 1, 1, 1, 1, 1, 0, 0, 1, 1],
       [0, 1, 0, 1, 1, 1, 1, 0, 1, 0],
       [1, 0, 1, 1, 0, 1, 0, 1, 0, 1]]
    p=[[-8, 6, -2, -8, -8, 4, 8, 7, -6, 2, 2],
       [-9, 2, 0, 1, 7, -5, 0, -2, -6, 5, 5],
       [6, -6, 7, -9, 6, -5, 8, 0, -9, -7, -7]]
    
import itertools
sumpmax=-10**11
for i in itertools.product([0,1], repeat=10):
    r=list(i)
    sump=0
    if sum(r)!=0:
        for jj in range(n):
            ci=0
            for j in range(10):
                ci=ci+r[j]*f[jj][j]
            sump=sump+p[jj][ci]
#            print(sump,r)
        sumpmax=max(sump,sumpmax)
print(sumpmax)
a, b = (int(i) for i in input().split()) 

pan = "P"

for i in range(a):
    pan = "B" + pan + "P" + pan + "B"

count = 0

for i in range(b):
    if "P" == pan[i]:
        count += 1

print(count)

### FIXED CODE ###

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

a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + a[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-a[N-1])


print(f(N,X))
# B - Five Dishes
import math

n = []
for _ in range(5):
    n.append(int(input()))

mini = 10
for y, x in enumerate(n):
    rest = x % 10 
    if rest != 0:
        if rest < mini:
            mini = rest
            mini_num = y 
            
time = n.pop(mini_num)
for x in n:
    if x % 10 != 0:
        item = math.ceil(x/10)*10
        time += item
    elif x%10 == 0:
        time += x
    
print(time)

### FIXED CODE ###

# B - Five Dishes

n = []
for _ in range(5):
    n.append(int(input()))

time = 0
mini = 10
for x in n:
    rest = x%10
    if rest != 0:
        mini = min(rest, mini)
    while x%10 != 0:
        x += 1
    time += x
print(time-10+mini)
a=input()
b=input()

print(int(a)*int(b))


### FIXED CODE ###

a,b = input().split()

print(int(a)*int(b))
N, K = map(int, input().split)
A = N
h = list(map(int, input().split()))
for hantei in h:
    if K > hantei:
        A -= 1
    else:
        pass
print(A)

### FIXED CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
for hantei in h:
    if K > hantei:
        N -= 1
    else:
        pass
print(N)
N = int(input())
S = input()
count = 0
for i in range(1,N-1):
  if S[i-1] + S[i] + s[i+1] == "ABC":
    count = count + 1
print (count)

### FIXED CODE ###

N = int(input())
S = input()
print(S.count("ABC"))
n = int(input())
al = list(map(int, input().split()))

left = []
right = []

for i in range(n):
    if i % 2 == 0:
        right.append(al[i])
    else:
        left.append(al[i])

if n % 2 == 0:
    left = left[::-1]
    print(*left, *right, sep=' ')
else:
    right = right[::-1]
    print(*right, *left, sep=' ')


### FIXED CODE ###

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

left = []
right = []

for i in range(n):
    if i % 2 == 0:
        right.append(al[i])
    else:
        left.append(al[i])

if n % 2 == 0:
    ans = left[::-1] + right
else:
    ans = right[::-1] + left

print(*ans, sep=' ')
def GCD(x,y):

    if(x >= y):
        z = y
        w = x%y
    else:
        z = x
        w = y%x

    while(1):
        if(w != 0):
            v = w
            w = z%w
            z = v
        else:
            print(z)
            break
"""
    if(w != 0):
        if(x >=y)
        GCD(z,w)
    else:
        print(z)
"""

a = int(input())
b = int(input())
GCD(a,b)


### FIXED CODE ###

def GCD(x,y):

    if(x >= y):
        z = y
        w = x%y
    else:
        z = x
        w = y%x

    if(not(w == 0)):
        return GCD(z,w)
    else:
        return z

A = [int(i) for i in input().split()]
print(GCD(A[0],A[1]))

"""実行結果

100 55
5



66 77
11

"""
for x in raw_input:
    print int(x)**3

### FIXED CODE ###

for x in map(int, raw_input().split()):
    print int(x)**3
S = list(input())
K = int(input())

if len(S) == 1:
    print(K // 2)
else :
    pre = S[0]
    flg = 0
    cnt = 0
    cnt_list =[]
    
    for i in range(1, len(S)):
        cnt += 1
        if flg == 1:
            flg = 0
            pre = S[i]
            continue
        if S[i] == pre:
            cnt_list.append(cnt)
            flg = 1
        pre = S[i]

    S = reversed(S)
    pre = S[0]
    flg = 0
    cnt = 0
    cnt_list2 =[]
    
    for i in range(1, len(S)):
        cnt += 1
        if flg == 1:
            flg = 0
            pre = S[i]
            continue
        if S[i] == pre:
            cnt_list2.append(cnt)
            flg = 1
        pre = S[i]
    
    if S[0] == S[-1] and (S[-1] == S[-2] or S[0] == S[1]):
        print(min(len(cnt_list), len(cnt_list2))*K)
    elif S[0] == S[-1]:
        print(min(len(cnt_list), len(cnt_list2))*K+K)
    else :
        print(min(len(cnt_list), len(cnt_list2))*K)

### FIXED CODE ###

S = input()
K = int(input())
 
if len(S) == 1:
    print(K // 2)
    exit()

chkd, flg = 0, 1
cnt = 0
cnt_list =[]
 
for i in range(1, len(S)):
    cnt += 1
    if S[i] != S[i-1]:
        flg = 0
    if chkd == 1:
        chkd = 0
        continue
    if S[i] == S[i-1]:
        cnt_list.append(cnt)
        chkd = 1
 
# 2個連続の場合
S2 = S*2
chkd = 0
cnt = 0
cnt_list2 =[]
 
for i in range(1, len(S2)):
    cnt += 1
    if chkd == 1:
        chkd = 0
        continue
    if S2[i] == S2[i-1]:
        cnt_list2.append(cnt)
        chkd = 1

if flg: # 全部同じ場合
    print(len(S)*K // 2)
elif S[0] == S[-1]:
    print(len(cnt_list) + (len(cnt_list2)-len(cnt_list)) * (K - 1))
else :
    print(len(cnt_list)*K)
N = int(input())
if N % 2 ==0:
  print(N/2)

else:
  ptint(1+N/2)

### FIXED CODE ###

N = int(input())
if N % 2==0:
  print(int(N/2))
  
else:
  print(int((N/2)+1))
import sys
print("hoge")
  ``` 
if __name__ == "__main__":
  args = sys.argv
  print(args)

  num = args[0]
  slimes = args[1]

  tmp = []
  for i in range(0,len(smiles)):
    if len(tmp): 
      if slimes[i] == slimes[i+1] and slimes[i] != tmp[-1]:
          tmp.append(slimes[i])
    else:
      if slimes[i] == slimes[i+1]:
          tmp.append(slimes[i])

  print(len(tmp))    
  ```


### FIXED CODE ###

if __name__ == "__main__":
  num = input()
  slimes = input()

  tmp = []
  for i in range(0,len(slimes)):
    if len(tmp):
      if slimes[i] != tmp[-1]:
          tmp.append(slimes[i])
    else:
      tmp.append(slimes[i])
  print(len(tmp))