Harryxun/stf_run huggingface dataset:
s = input()
a = set(s)
print('Yes' if len(a) == 2 and s.count(a[0]) == 2 and s.count(a[1]) == 2 else 'No')

### FIXED CODE ###

s = input()
a = list(set(s))
print('Yes' if len(a) == 2 and s.count(a[0]) == 2 and s.count(a[1]) == 2 else 'No')
n,m,x=map(int,input().split())
a=[list(map(int,input().split()))]
ans=[]
for bit in range(1<<n):
  total=0
  skill=[0]*m
  for i in range(n):
    if bit & (1<<i):
      total+=a[i][0]
      for j in range(m):
        skill[j]+=a[i][j]
  if all([k>K for k in skill]):
    ans.append(total)
print(min(total) if len(ans)>=1 else -1)
    
      
      

### FIXED CODE ###

n,m,x=map(int,input().split())
a=[list(map(int,input().split()))for i in range(n)]
ans=[]
for bit in range(1<<n):
  total=0
  skill=[0]*m
  for i in range(n):
    if bit & (1<<i):
      total+=a[i][0]
      for j in range(m):
        skill[j]+=a[i][j+1]
  if all([k>=x for k in skill]):
    ans.append(total)
print(min(ans) if len(ans)!=0 else -1)
num = input()

line = map(int, input().split())

line.sort(reverse=True)

if line[0] < sum(line):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

t, x = map(int, input().split())

print(t/x)
a, b = input().split()

def even_odd(a, b):
	if (a*b)%2 == 0:
		print("Even")
	else:
		print("Odd")

even_odd(a,b)

### FIXED CODE ###

a, b = map(int, input().split())
print("Even" if a*b % 2 == 0 else "Odd")
import sys
import copy
#import math
#import itertools
#import numpy as np
#import re

def func(x,m):
    return x**2%m

N,X,M=[int(c) for c in input().split()]
myset = {X}
mydict = {0:X}
A = []
A.append(X)
s = X
i = 0
i_stop = i
#i=0は計算したので1から
for i in range(1,N):
    A.append(func(A[i-1],M))
    if A[i] in myset:
        i_stop = i
        break
    myset.add(A[i])
    mydict[A[i]] = i
    s+=A[i]
    if i == N-1:
        print(s)
        sys.exit(0)
    if A[i] == 0:
        print(s)
        sys.exit(0)


#最後にA[i]が出現したのは？
A_repeat = A[mydict[A[i_stop]]:i_stop]

if len(A_repeat)!=0:
    s+=((N-1)-(i_stop-1))//len(A_repeat)*sum(A_repeat)

    for k in range(((N-1)-(i_stop-1))%len(A_repeat)):
        s+=A_repeat[k]



print(s) 

### FIXED CODE ###

import sys
import copy
#import math
#import itertools
#import numpy as np
#import re

def func(x,m):
    return x**2%m

N,X,M=[int(c) for c in input().split()]
myset = {X}
mydict = {X:0}
A = []
A.append(X)
s = X
i = 0
i_stop = i
#i=0は計算したので1から
for i in range(1,N):
    A.append(func(A[i-1],M))
    if A[i] in myset:
        i_stop = i
        break
    myset.add(A[i])
    mydict[A[i]] = i
    s+=A[i]
    if i == N-1:
        print(s)
        sys.exit(0)
    if A[i] == 0:
        print(s)
        sys.exit(0)

if i!=0:
    #最後にA[i]が出現したのは？
    A_repeat = A[mydict[A[i_stop]]:i_stop]
    s+=((N-1)-(i_stop-1))//len(A_repeat)*sum(A_repeat)

    for k in range(((N-1)-(i_stop-1))%len(A_repeat)):
        s+=A_repeat[k]

print(s)
# -*- coding: utf-8 -*-
import numpy as np

n,k,q= map(int(input()))

scores = np.array([k] * n)

for i in range(q):
    ans = int(input())
    scores[:ans-1] = scores[:ans-1] - 1
    scores[ans:] = scores[ans:] - 1

for r in scores:
    if r >= 0:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, Q, *A = map(int, read().split())

    B = [0] * N
    for a in A:
        B[a - 1] += 1

    ans = [0] * N
    for i, b in enumerate(B):
        if Q >= K + b:
            ans[i] = 'No'
        else:
            ans[i] = 'Yes'

    print('\n'.join(map(str, ans)))
    return


if __name__ == '__main__':
    main()
import math

S = input()
K = int(input())
#print(S)
cnt = 1
ans = 0
for i in range(1,len(S)):
    if S[i] == S[i-1]:
        cnt += 1
    else:
        ans += cnt //2 
        cnt = 1
ans += cnt //2 
#print("ans", ans)    
ans *= K
#print("ans*K",ans)
if S[0] == S[-1]:
    cntf = 1
    cnte = 1
    for i in range(1,len(S)):
        #print(S[i], S[i-1] )
        if S[i] == S[i-1]:
            cntf += 1
        else:
            break
    #print("---------------")
    for i in range(1,len(S)):
        #print(S[-i], S[-i+1] )
        if S[-i-1] == S[-i]:
            cnte += 1
        else:
            break
    #print(cnte, cntf)
    if cnte % 2 ==1 and cntf % 2 ==1:
        #print("bbbb")
        ans += (K-1)  

if cnte == len(S):
    ans = len(S) * K // 2
print(ans)




### FIXED CODE ###

import math

S = input()
K = int(input())
#print(S)
cnt = 1
ans = 0
for i in range(1,len(S)):
    if S[i] == S[i-1]:
        cnt += 1
    else:
        ans += cnt //2 
        cnt = 1
ans += cnt //2 
#print("ans", ans)    
ans *= K
#print("ans*K",ans)

if S[0] == S[-1]:
    cntf = 1
    cnte = 1
    for i in range(1,len(S)):
        #print(S[i], S[i-1] )
        if S[i] == S[i-1]:
            cntf += 1
        else:
            break
    #print("---------------")
    for i in range(1,len(S)):
        #print(S[-i], S[-i+1] )
        if S[-i-1] == S[-i]:
            cnte += 1
        else:
            break
    #print(cnte, cntf)
    if cnte % 2 ==1 and cntf % 2 ==1:
        #print("bbbb")
        ans += (K-1)  

    if cnte == len(S):
        #print("aaa")
        ans = len(S) * K // 2
print(ans)
N=int(input())
if N/1000==0:
	N=0
else:
	N=(math.ceil(N/1000)+1)*1000-N
print(str(N))

### FIXED CODE ###

n = int(input())

if n % 1000 == 0:
  print(0)
else:
  print(1000-(n%1000))
import sys
from collections import defaultdict
from scipy.special import comb

input = sys.stdin.readline

n = int(input())
d = defaultdict(lambda: 0)

for i in range(n):
    s = list(str(input()).rstrip())
    s.sort()
    s = "".join(s)
    d[s] += 1   

ans = 0
for key in d.keys():
    if d[key] >= 2:
        ans += comb(d[key], 2, exact=True)
print(int(ans))

### FIXED CODE ###

import sys
from collections import defaultdict
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


input = sys.stdin.readline

n = int(input())
d = defaultdict(lambda: 0)

for i in range(n):
    s = list(str(input()).rstrip())
    s.sort()
    s = "".join(s)
    d[s] += 1   

ans = 0
for key in d.keys():
    if d[key] >= 2:
        ans += cmb(d[key], 2)
print(int(ans))
s,t=input().split();a,b=map(int,input().split());print(f"{a-1} {b}" if s==input()else f"{a} {b-1}")

### FIXED CODE ###

s,t=input().split();a,b=map(int,input().split());u=input();print("%d %d" %(a-1 if s==u else a,b-1 if s!=u else b))
n=int(input())
dic={}
for _ in range(n):
  s=input()
  s=sorted(s)
  if s not in dic:
    dic[s]=1
  else:
    dic[s]+=1
ans=0
for val in dic.values():
  ans+=val*(val-1)//2
print(ans)

### FIXED CODE ###

n=int(input())
arr=[input() for _ in range(n)]
dic={}
check='abcdefghijklmnopqrstuvwxyz'
for s in arr:
  count=[0]*26
  for i in range(10):
    for j in range(26):
      if s[i]==check[j]:
        count[j]+=1
        break
  count=tuple(count)
  if count not in dic:
    dic[count]=1
  else:
    dic[count]+=1
ans=0
for val in dic.values():
  ans+=val*(val-1)//2
print(ans)
#一個だけRE、わからねえ
#解答見る
h,w=map(int,input().split())

def go_next(I,J):
    global dp,w,h
    if 0<=I<h-1:
        if x[I+1][J]=="." and dp[I+1][J]>dp[I][J]+1:
            dp[I+1][J]=dp[I][J]+1
            go_next(I+1,J)
    if 0<I<=h-1:
        if x[I-1][J]=="." and dp[I-1][J]>dp[I][J]+1:
            dp[I-1][J]=dp[I][J]+1
            go_next(I-1,J)
    if 0<=J<w-1:
        if x[I][J+1]=="." and dp[I][J+1]>dp[I][J]+1:
            dp[I][J+1]=dp[I][J]+1
            go_next(I,J+1)
    if 0<J<=w-1:
        if x[I][J-1]=="." and dp[I][J-1]>dp[I][J]+1:
            dp[I][J-1]=dp[I][J]+1
            go_next(I,J-1)

x=[]
for i in range(h):
    x.append(list(input()))
#print(x)
c=0
for i in range(h):
    for j in range(w):
        if x[i][j]==".":
            c+=1
dp=[[10000000000 for i in range(w)]for j in range(h)]
dp[0][0]=1
go_next(0,0)
if dp[h-1][w-1]==10000000000:
    print(-1)
else:
    print(c-dp[h-1][w-1])


### FIXED CODE ###

#一個だけRE、わからねえ
#解答見る
import sys
sys.setrecursionlimit(1005)
h,w=map(int,input().split())

def go_next(I,J,n):
    n+=1
    global dp,w,h
    if n>1000:
        return
    if 0<=I<h-1:
        if x[I+1][J]=="." and dp[I+1][J]>dp[I][J]+1:
            dp[I+1][J]=dp[I][J]+1
            go_next(I+1,J,n)
    if 0<I<=h-1:
        if x[I-1][J]=="." and dp[I-1][J]>dp[I][J]+1:
            dp[I-1][J]=dp[I][J]+1
            go_next(I-1,J,n)
    if 0<=J<w-1:
        if x[I][J+1]=="." and dp[I][J+1]>dp[I][J]+1:
            dp[I][J+1]=dp[I][J]+1
            go_next(I,J+1,n)
    if 0<J<=w-1:
        if x[I][J-1]=="." and dp[I][J-1]>dp[I][J]+1:
            dp[I][J-1]=dp[I][J]+1
            go_next(I,J-1,n)

x=[]
for i in range(h):
    x.append(list(input()))
#print(x)
c=0
for i in range(h):
    for j in range(w):
        if x[i][j]==".":
            c+=1
dp=[[10000000000 for i in range(w)]for j in range(h)]
dp[0][0]=1
go_next(0,0,0)
if dp[h-1][w-1]==10000000000:
    print(-1)
else:
    print(c-dp[h-1][w-1])
N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N - 1)]
px = [list(map(int, input().split())) for i in range(Q)]

p = [[] for i in range(N + 1)]
result = [0 for i in range(N + 1)]
flag = [0 for i in range(N + 1)]

for i in range(N - 1):
    a = ab[i][0]
    b = ab[i][1]
    p[a].append(b)
    p[b].append(a)

for i in range(Q):
    result[px[i][0]] = result[px[i][0]] + px[i][1]


def dfs(point, result):
    flag[point] = 1
    for i in range(len(p[point])):
        next = p[point][i]
        if flag[next] != 1:
            result[next] = result[next] + result[point]
            dfs(next, result)
    return result


result = dfs(1, result)

print(*result[1:])

### FIXED CODE ###

N, Q = map(int,input().split()) # 複数の数字を変数に格納
List_ab = [list(map(int,input().split())) for i in range(N-1)] # [[1,2],[3,4],[5,6]]
List_px = [list(map(int,input().split())) for i in range(Q)] # [[1,2],[3,4],[5,6]]

count_list = [0]*N

List_ab.sort()

for i in range(Q):
    count_list[List_px[i][0]-1] += List_px[i][1]
        
for i in range(N-1):
    count_list[List_ab[i][1]-1] += count_list[List_ab[i][0]-1]
    
print(*count_list)
n,k,x,y=map(int,input().split())

if n>=k:
  print(k*x+(n-k)*y)

else:
  print(k*x)
      

### FIXED CODE ###

n = int(input())
k = int(input())
x= int(input())
y= int(input())

if n>k:
  print(k*x+(n-k)*y)

else:
  print(n*x)
N,Y=input().split()
N=int(N)
Y=int(Y)

a=[]
for i in range(N+1):
    for j in range(N-i+1):
        if 1000*i+5000*j+10000*(N-i-j)==Y:
            a.append(str(N-i-j))
            a.append(str(j))
            a.append(str(i))
    if len(a)!=0:
        break


if len(a)!=0:
    print(a[0]+' '+a[1]+' '+a[2])
else:
    print('-1 -1 -1')
        

### FIXED CODE ###

S=input()
S=S.replace('7','8',1)

print(S)
s = input()
k = int(input())
cnt  = 0
ans  = False
for i in range(k):
    if s[i] != '1':
        print(s[i])
        ans = True
if ans:
    print(1)

### FIXED CODE ###

s = input()
k = int(input())
ans  = True
for i in range(k):
    if s[i] != '1':
        print(s[i])
        ans = False
        break
if ans:
    print(1)
# -*- coding: utf-8 -*-

N = int(input())
X,L = [],[]

for _ in range(N):
    x,l = input().split()
    X.append(int(x))
    L.append(int(l))

remove=0
i=1
while (i < len(X)-1):
    if X[i+1]-X[i-1] <= L[i+1]+L[i-1]:
        X.pop(i)
        L.pop(i)
        remove+=1
    else:
        i+=1
print(N-remove)

### FIXED CODE ###

# -*- coding: utf-8 -*-

H,W,N = [int(input()) for _ in range(3)]

ans = N/max(H,W) if N%max(H,W)==0 else N/max(H,W)+1
print(int(ans))
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i):
    c, b = 1, 0
    while i > 0:
        c, b = c + b, c
        i -= 1
    return c
m = a[0] + 1
num = fibo(m - 2)
if M > 1 :
    for i in range(M - 1):
    m = a[i + 1] - a[i]
    if m > 1:
        num = num * fibo(m - 2)
    else:
        num = 0
        break
    num = num * fibo(N - a[M - 1] - 1)
elif M == 1:
    num = num * fibo(N - a[M - 1] - 1)
else :
    num = fibo(N)
print(num % 1000000007)


### FIXED CODE ###

N, M = map(int, input().split())
kaidan = [0] * (N + 1)
for i in range(M):
    tmp = int(input())
    kaidan[tmp] = -1
kaidan[0] = 1
for i in range(1,N + 1):
    if i == 1:
        if kaidan[i] != -1:
            kaidan[i] = 1
        else:
            kaidan[i] = 0
    else:
        if kaidan[i] != -1:
            kaidan[i] = kaidan[i -1] + kaidan[i - 2]
        else:
            kaidan[i] = 0
print(kaidan[N] % (10 ** 9 + 7))
S=input()
cnt=0
for c in S:
   cnt+=c=='o'
if cnt＞=8:
   print('YES')
else:
  print('NO')

### FIXED CODE ###

S=input()
cnt=0
for c in S:
   cnt+=c=='o'
if cnt+15-len(S)>=8:
   print('YES')
else:
  print('NO')
import math

X = int(input())

i = 0
while True:
   i += 1
   b = - math.pow((X - math.pow(i, 5)), float(1/5))
   if b.is_integer():
      print("%d %d" % (i, b))
      exit()

### FIXED CODE ###

import sys
x = int(input())

for i in range(-1000, 1001):
    for j in range(-1000, 1001):
        if i**5-j**5 == x:
            print(i, j)
            sys.exit()
N = int(input())
s = set(for i in range(N+1): int(input()))
print(len(s))


### FIXED CODE ###

N = int(input())
s = set(int(input()) for i in range(N))
print(len(s))
s,t=input(),input()
print(t+s)


### FIXED CODE ###

s,t=input().split()
print(t+s)
s=str(input())
t=str(input())
print(t+s)

### FIXED CODE ###

l=list(map(str,input().split()))
print(l[1]+l[0])
while 1:
    nums = int(input())
    if nums != 0:
        stars = list(map(int,input().split()))
        cnt = [0 for i in range((2*31)-1)]
        for x in stars:
            cnt[x] += 1
        m = max(cnt)
        if m > nums/2:
            res = cnt.index(m)
            print(res)
        else:
            print("NO COLOR")
    else:break

### FIXED CODE ###

while 1:
    nums = int(input())
    if nums != 0:
        d = {}
        stars = list(map(int,input().split()))
        for x in stars:
            if x not in d:
                d[x] = 1
            else:
                d[x] += 1

        key = list(d.keys())
        val = list(d.values())
        m = int(max(val))
        if m > nums/2:
            res = key[val.index(m)]
            print(res)
        else:
            print("NO COLOR")
    else:break
p={} #調理時間
q={} #調理時間/10のあまり
r={} #注文-次の注文までの時間
for i in range(5):
    p[i] = int(input())
    q[i] = p[i] % 10
    if q[i] != 0:
        r[i] = p[i] + 10 - q[i]

maxloss = 0
maxlossnum = 0
for i in range(5):
    if maxloss < r[i] - p[i]:
        maxloss = r[i] - p[i]
        maxlossnum = i

time = int(0)
for i in range(5):
    if i != maxlossnum:
        time += r[i]
    else:
        time += p[i]

print(time)

### FIXED CODE ###

p={} #調理時間
r={} #注文-次の注文までの時間
for i in range(5):
    p[i] = int(input())
    r[i] = int((p[i] + 9) /10) * 10
    #print(r[i])

"""
for i in range(5):
    print(p[i],end=' ')
print('')

for i in range(5):
    print(r[i],end=' ')
print('')
"""
lastnum = 0
for i in range(1,5):
    if r[lastnum] - p[lastnum] < r[i] - p[i]:
        lastnum = i

#print(lastnum)

time = 0
for i in range(5):
    if i != lastnum:
        time += r[i]
    else:
        time += p[i]

print(time)
a = int(input())
print(a * (a ** 3 - 1) / (a - 1))

### FIXED CODE ###

a = int(input())
print(a * (1 + a * (1 + a)))
n = int(input())
s = list(input())
c = 0
b = s[:n-1].count('#')
w = s[:n-1].count('.')
for i in range(n-1):
 if s[i] == '#' and s[i + 1] == '.':
  c += 1
  s[i +1] = '#'

print(min(c,b,w))

### FIXED CODE ###

a,b,c = map(int,input().split())
 
if c == min(a,b,c):
 print('No')
elif c == max(a,b,c):
 print('No')
else:
 print('Yes')
n, q = map(int, input().split())
t = [[] for i in range(n)]# 空の2次元配列を作る
for i in range(n-1):
    a, b = map(int, input().split())
    t[a - 1].append(b -1)
    t[b - 1].append(a -1)
# 配列は０から始まるから１、２、３、４の木を０、１、２、３として扱ってる
# 配列の０番目（つまり頂点０）が持つ値がその頂点が持つリンクとなる

v = [0] * (n) #空の配列を作る
for j in  range(q):# 0からqまで
    a, b = map(int, input().split())
    v[a-1] += b


def csum(now, bef):  # 累積和
    for nxt in t[now]:
        if nxt != bef:
            v[nxt] += v[now]
            csum(nxt, now)

csum(0, -1)
print(*v)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input=sys.stdin.readline

n, q = map(int, input().split())
t = [[] for i in range(n)]# 空の2次元配列を作る
for i in range(n-1):
    a, b = map(int, input().split())
    t[a - 1].append(b -1)
    t[b - 1].append(a -1)
# 配列は０から始まるから１、２、３、４の木を０、１、２、３として扱ってる
# 配列の０番目（つまり頂点０）が持つ値がその頂点が持つリンクとなる

v = [0] * (n) #空の配列を作る
for j in  range(q):# 0からqまで
    a, b = map(int, input().split())
    v[a-1] += b


def csum(now, bef):  # 累積和
    for nxt in t[now]:
        if nxt != bef:
            v[nxt] += v[now]
            csum(nxt, now)

csum(0, -1)
print(*v)
x = int(input())
for b in range(10000000):
    tmp=x+b**5
    if tmp**0.2==int(tmp**0.2):
        print(int(tmp**0.2),b)
        exit()
    tmp=x-b**5
    if tmp**0.2==int(tmp**0.2):
        print(int(tmp**0.2),-b)
        exit()

### FIXED CODE ###

x = int(input())
A=[a**5 for a in range(500)]
for b in range(10000):
    tmp=x+b**5
    if tmp in A:
        print(A.index(tmp),b)
        exit()
    tmp=x-b**5
    if tmp in A:
        print(A.index(tmp),-b)
        exit()
import sys
sys.setrecursionlimit(20000)

N = int(input())
d = {}
e = [[] for _ in range(N)]
dd = [-1]*N
for _ in range(N-1):
    u, v, w = list(map(int, input().split()))
    e[u-1].append(v-1)
    e[v-1].append(u-1)
    d[(u-1,v-1)]= d[(v-1,u-1)] = w

def dfs(i, _d):
    dd[i] = _d
    for c in e[i]:
        if dd[c]!=-1: continue
        dfs(c, _d+d[(i,c)])

dfs(0,0)
for _dd in dd:
    print(_dd%2)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N = int(input())
d = {}
e = [[] for _ in range(N)]
dd = [-1]*N
for _ in range(N-1):
    u, v, w = list(map(int, input().split()))
    e[u-1].append(v-1)
    e[v-1].append(u-1)
    d[(u-1,v-1)]= d[(v-1,u-1)] = w

def dfs(i, _d):
    dd[i] = _d
    for c in e[i]:
        if dd[c]!=-1: continue
        dfs(c, _d+d[(i,c)])

dfs(0,0)
for _dd in dd:
    print(_dd%2)
A,B,C=map（int,input().split())

ans=0

if A-B<C:
    ans=C-(A-B)

print(ans)

### FIXED CODE ###

A,B,C=map(int,input().split())

ans=0

if A-B<C:
    ans=C-(A-B)

print(ans)
# coding=utf-8

tile = input()

cor_list = ["10"*50000, "01"*50000]

diff_1 = int("0b"+tile, 2) ^ int("0b"+cor_list[0][:len(tile)], 2)  
diff_2 = int("0b"+tile, 2) ^ int("0b"+cor_list[1][:len(tile)], 2)

score_1 = sum([int(s) for s in bin(diff_1)[2:]])
score_2 = sum([int(s) for s in bin(diff_2)[2:]])
print(min[score_1, score_2])

### FIXED CODE ###

tile = input()

cor_list = ["10"*50000, "01"*50000]

diff_1 = int("0b"+tile, 2) ^ int("0b"+cor_list[0][:len(tile)], 2)  
diff_2 = int("0b"+tile, 2) ^ int("0b"+cor_list[1][:len(tile)], 2)

score = [0, 0]
score[0] = sum([int(s) for s in bin(diff_1)[2:]])
score[1] = sum([int(s) for s in bin(diff_2)[2:]])

print(min(score))
import re
s = input()
if re.match("^(dream|dreamer|erase|eraser)+$, s):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import re
S = input()
'''
メタ文字：
^ = 文字列の先頭、
| = OR
+ = 直前のパターンを1回以上繰り返し、
$ = 文字列の末尾
'''
if re.match("^(dream|dreamer|erase|eraser)+$", S):
    print('YES')
else:
    print('NO')
a,b,n=map(int,input().split())
List=list(range(n+1))
List_ans=[]
for list in List:
    List_ans.append(int(a*list/b)-a*int(list/b))
print(max(List_ans))

### FIXED CODE ###

# floor(a/b)=(a-(a%b))/b
# ax%b=a(x%b)%b
a,b,n=map(int,input().split())
if(n>=b-1):
    print(a*(b-1)//b)
else:
    print(a*n//b)
N=int(input())
A=list(map(int,input().split()))
min_,max_=min(A),max(A)
ans=None

if max_-min_ > 1:
    ans=False
elif max_-min_ == 1:
    A=max_
    y=len([a for a in A if a==max_])
    x=N-y
    nc=A-x
    ans=(A-x)>0 and y >=2*(A-x)
else:
    ans=N>=2*min_ or min_+1==N

print("Yes" if ans else "No")


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
min_,max_=min(A),max(A)

def f(n,k):
    return n%k==0 if k>0 else False

ans=None
if max_-min_ > 1:
    ans=False
elif max_-min_ == 1:
    k=max_
    nk=len([a for a in A if a==max_])
    nk1=N-nk
    ans=f(nk,k-nk1)
else:
    ans=f(N,min_) or f(N,min_+1)

if ans is True:
    print("Yes")
else:
    print("No")
x = input()
print(x**3)

### FIXED CODE ###

x =int(input())
print(x**3)
a,b,c,d=map(int,input().split())
print([["Balanced,"Left"][a+b>c+d],"Right"][a+b<c+d])

### FIXED CODE ###

a,b,c,d=map(int,input().split())
print([["Balanced","Left"][a+b>c+d],"Right"][a+b<c+d])
W,H,x,y=map(int,input().split())
if x=W/2 and y=H/2
    print(W*H/2,1)
elif not x or not y:
    print(W*H/2,0)
elif x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,0)
else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W)),0)
"""else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W),min(H*H*x/y,H*W-H*H*x/y),min(W*W*y/x,H*W-W*W*y/x)),0)"""


### FIXED CODE ###

W,H,x,y=map(int,input().split())
if x==W/2 and y==H/2:
    print(W*H/2,1)
elif not x or not y:
    print(W*H/2,0)
elif x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,0)
else:
    print(W*H/2,0)
a, b, x = map(int, input().split())
q = x//a
k = len(str(q))
ary = []
for i in range(k-1, k+1):
	if len(str((x-b*i)//a)) == i:
		if (x-b*i)//a > 10**9:
			if a * 10**9 + b * 10 <= x:
				ary.append(10**9)
		else:
			ary.append(min((x-b*i)//a, 10 ** i - 1))
if len(ary) == 0:
	print (0)
else:
	print (max(ary))


### FIXED CODE ###

n = input()

if n == "SAT":
	print (1)
elif n == "SUN":
	print (7)
elif n == "MON":
	print (6)
elif n == "TUE":
	print (5)
elif n == "WED":
	print (4)
elif n == "THU":
	print (3)
else:
	print (2)
N = int(input())
S = []
while True:
    Si = input()
    if Si:
        S.append(Si)
    else:
        break
g = S[: N]
print(g)


### FIXED CODE ###

n = int(input())
s = set(input() for _ in range(n))
print(len(s))
n,m = list(map(int,input().split()))
n_l = []
for i in range(n):
    l = list(map(int,input().split()))
    for j in range(l[0]):
        n_l.append(l[j+1])
    
cnt = 0
for i in range(1,m+1):
    if n_l.count(i) == n:
        cnt += 1

print(cnt)

### FIXED CODE ###

a,b = list(map(int,input().split()))
print(a+b if b%a == 0 else b-a)
n, k = map(int, input().split())
p = list(map(int, input().split()))

total_expects = []
# 1回のサイコロについて
for i in range(0, n):    
    # 1個のサイコロの期待値リスト
    expect = [q * (1 / p[i]) for q in range(1, p[i]+1)]
    total_expects.append(sum(expect))

print(max([sum(total_expects[i:i+k]) for i in range(0, k)]))

### FIXED CODE ###

s, t = map(str, input().split())
a, b = map(int, input().split())
u = str(input())

if u == s:
    print(a-1, b)
elif u == t:
    print(a, b-1)
else:
    print(a, b)
import math
from functools import reduce

def gcd(nums):
    return reduce(math.gcd, nums)

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

x_sorted = x
x_sorted.append(X)
x_sorted.sort()

diff = []
for i, xi in enumerate(x_sorted):
    if i == 0:
        continue
    else:
        diff.append(xi - x_sorted[i-1])

print(gcd(diff))




### FIXED CODE ###

from functools import reduce

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

def gcd_list(nums):
    return reduce(gcd, nums)

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

x_sorted = x
x_sorted.append(X)
x_sorted.sort()

diff = []
for i, xi in enumerate(x_sorted):
    if i == 0:
        continue
    else:
        diff.append(xi - x_sorted[i-1])

print(gcd_list(diff))
n=int(input())
a=[]
for i in range(n):
    a[i]=int(input())
if a.count(1)==len(a):
    print("first")
else:
    print("second")


### FIXED CODE ###

N = int(input())
a = 0
for i in range(N):
    a += int(input())%2
 
if a > 0:
    print("first")
else:
    print("second")