Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10000)
n = int(input())
X = input()
nx = int(X, 2)
dp = [-1] * (10**6+1)
def f(n):
    if n < 10**6 and dp[n] > 0:
        return dp[n]
    pc = bin(n).count('1')
    nn = n%pc
    if nn == 0:
        return 1

    d = f(nn) + 1
    if n < 10**6:
        dp[n] = d
    return d

for i in range(n-1, -1, -1):
    # ibit目を反転させる # つまりi**2を引く
    tmp = pow(2, i)

    if (nx>>i)&1:
        nx -= tmp
        print(f(nx))
        nx += tmp
    else:
        nx += tmp
        print(f(nx))
        nx -= tmp

### FIXED CODE ###

n = int(input())
X = input()
pc = X.count('1')
nx = int(X, 2)

def f(n):
    c = 0
    while n > 0:
        n %= bin(n).count('1')
        c += 1
    return c

nxp = nx%(pc+1)
nxm = nx%(pc-1) if pc > 1 else 0
for i in range(n-1, -1, -1):
    if (nx>>i)&1:
        # 2**iを引く
        if pc-1 == 0:
            print(0)
            continue
        p = pow(2, i, pc-1)
        r = (nxm-p)%(pc-1)
    else:
        # 2**iを足す
        r = (nxp+pow(2, i, pc+1))%(pc+1)

    print(f(r) + 1)
N = input()
N = int(N)

a_sub = input().split(" ")
a = [int(n0) for n0 in a_sub]
# print(a)

b_sub = input().split(" ")
b = [int(n0) for n0 in b_sub]
# print(b)

c_sub = input().split(" ")
c = [int(n0) for n0 in c_sub]
# print(c)

score = 0
for xi in range(N):
    score = score + b[xi]
    if a[xi+1]==a[xi]+1 and xi<N:
        score = score + c[a[xi]-1]
        print(xi, c[xi])

print(score)


### FIXED CODE ###

N = input()
N = int(N)
print(N**3)
while 1:
    N,M = map(int,raw_input().split())
    if N == 0: break
    h = [int(raw_input()) for _ in range(N)]
    w = [int(raw_input()) for _ in range(M)]
    ans = 0
    H,W = h[:],w[:]
    for i in range(N):
        s = h[i]
        for j in range(i+1,N):
            s += h[j]
            H.append(s)
    for i in range(M):
        s = w[i]
        for j in range(i+1,M):
            s += w[j]
            W.append(s)
    for hi in H:
        for wi in W:
                if hi == wi: ans += 1
    print ans

### FIXED CODE ###

from collections import defaultdict

def getArray(a):
    d = defaultdict(int)
    n = len(a)
    for i in range(n):
        s = 0
        for j in range(i,n):
            s += a[j]
            d[s] += 1
    return d

while 1:
    N,M = map(int,raw_input().split())
    if N == 0: break
    h = [int(raw_input()) for _ in xrange(N)]
    w = [int(raw_input()) for _ in xrange(M)]
    H,W = getArray(h),getArray(w)
    print sum(H[hi]*W[hi] for hi in H)
n = int(input())
items = set()
for _ range(n):
  s = input()
  items.add(s)
print(len(items))

### FIXED CODE ###

n = int(input())
items = set()
for _ in range(n):
  s = input()
  items.add(s)
print(len(items))
N, M = map(int, input().split())
list = [list(map(int, input().split())) for _ in range(M)]
ans = ["0"]*M

for i in range(M):
    for  j in range(M):
            if list[i] == [1, 0] and list[i] != list[j] :
                print(-1)
                exit() #答えが0以外で先頭の数字が0になる場合
            elif list[i][0] == list[j][0] and list[i][1] != list[j][1]:
                print(-1)
                exit() #ある桁の数字が異なる場合
            elif list[i] == [1, 0] and N != 1:
                print(-1)
                exit() #Nが1でないのに答えが0になる場合
            elif list[i][0] > N:
                print(-1)
                exit() #指定の桁数よりも大きな桁の数が入力された場合
            

for i in range(M):
    for j in range(M):
        if list[i][0] == j+1 :
            ans[j] = str(list[i][1])

print(int("".join(ans)))


### FIXED CODE ###

n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]

for i in range(10**n): #n桁の数字の全パターン
  number =str(i)
  if len(number)==n and all([number[s-1]==str(c) for s,c in sc]):
      print(number) #all すべての要素がTrueならTrue
      exit()
print(-1)
S = input()
S_list = [S[i:i+1] for i in range(S)]
count = 0
for k in range(len(S)):
  if S_list[k]==o:
    count += 1
  else:
    pass
print(700 + 100*count)

### FIXED CODE ###

S = input()
S_list = [S[i:i+1] for i in range(len(S))]
count = 0
for k in range(len(S)):
  if S_list[k] == 'o':
    count += 1
  else:
    pass
print(700 + 100 * count)
N = int(input())
arr = map(int,input().split())
_sum = []
_del = []
for i in range(N):
  _sum.append(arr[i]+i+1)
  _del.append(i+1-arr[i])

### FIXED CODE ###

N = int(input())
arr = list(map(int,input().split()))
cnt_arr = [0]*N
ans = 0
for i in range(N):
  if arr[i]+i+1<N:
    cnt_arr[arr[i]+i+1] += 1
  if i+1-arr[i]>0:
    ans += cnt_arr[i+1-arr[i]]

print(ans)
lst=[]
N=int(input())
h = map(int, input().split())
c=1
A=list(h)
B=len(A)
for i in range(B):
 if len(lst)<A[i]:
  c=0
  break
 elif len(lst)==A[i]:
  lst.append(1)
 else:
  lst[A[i]]+=1
  if lst[A[i]]==4:
   c=0
   break
 if A[i]==0:
  c*=1
 elif lst[A[i]-1]-lst[A[i]]+1<=0:
  if A[i]==1:
   c*=(4-lst[A[i]])
  else:
   c=0
   break
 else:
  c*=(lst[A[i]-1]-lst[A[i]]+1)
if lst[0]==1:
 c*=3
else:
 c*=6
print(c%1000000007)


### FIXED CODE ###

N=int(input())
A= list(map(int,input().split()))
B=[0,0,0]
C=1
for i in range(N):
 E=0
 F=0
 for j in range(3):
  if A[i]==B[j]:
   E+=1
   if E==1:
    B[j]+=1
    F=j
 C*=E
 C%=1000000007
print(C)
from itertools import permutations

while True:
	n = input()
	k = input()
	if n == k == 0: break
	nums = [raw_input() for i in xrange(n)]
	result = set("".join(p) for p in permutations(nums, k))
	print len(result)

### FIXED CODE ###

import sys
from itertools import permutations
 
def main():
	while True:
		line = raw_input()
		if line == "0 0": break
		n = int(line)
		k = input()
		nums = [raw_input().strip() for i in xrange(n)]
		result = set(["".join(p) for p in permutations(nums, k)])
		print (len(result))

if __name__ == '__main__':
	sys.exit(main())
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

n, cc = getMN()
jikan = [0 for i in range(100001)]
for i in range(n):
    s, t, c = getlist()
    jikan[s] += 1
    jikan[t+1] -= 1

accum = [0]
for j in jikan:
    accum.append(accum[-1]+j)

print(max(accum))

### FIXED CODE ###

import sys
import math
import copy
import itertools
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def solve():
    n,C = getList()
    li = []

    start = [[0] * 100100 for i in range(31)]
    end = [[0] * 100100 for i in range(31)]
    pt = [0] * 100100

    for i in range(n):
        s, t, c = getList()
        start[c][s] += 1
        end[c][t] += 1
        pt[s] += 1
        pt[t+1] -= 1

    for i in range(100099):
        pt[i+1] += pt[i]

    ans = 0
    for i in range(100100):
        tmp = pt[i]
        for j in range(31):
            if start[j][i] and end[j][i]:
                tmp -= 1
        ans = max(ans, tmp)

    print(ans)






def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()
sum=26
count=0
n = int(input())
k = ord('a')-1
while(sum<n) :
  count+=1
  sum+=26**(count+1)

current=n
mozi=''
mozi1=''
for i in range(count+1) :
  mozi+='z'
if current==sum :
  print(mozi)
else :
  for i in reversed(range(count+1)) :
    c=current//26**i

    mozi1+=chr(c+k)
    current = current % 26 ** i
  print(mozi1)

### FIXED CODE ###

n,k = map(int, input().split())
a_list=list(map(int, input().split()))
a_list=sorted(a_list)
print(sum(a_list[:k]))
import sys
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索
#import numpy as np  # 1.8.2
#import scipy  # 0.13.3

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    xy = ii2nnn(N)
    dic = defaultdict(lambda: 0)
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            dx = xy[i][0] - xy[j][0]
            dy = xy[i][1] - xy[j][1]
            if dx == 0 and dy == 0:
                continue
            dic[(dx, dy)] += 1
    n = N - max(dic.values())
    print(n)

main()


### FIXED CODE ###

import sys
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索
#import numpy as np  # 1.8.2
#import scipy  # 0.13.3

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    xy = ii2nnn(N)
    if N == 1:
        print(1)
        return
    dic = defaultdict(lambda: 0)
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            dx = xy[i][0] - xy[j][0]
            dy = xy[i][1] - xy[j][1]
            if dx == 0 and dy == 0:
                continue
            dic[(dx, dy)] += 1
    n = N - max(dic.values())
    print(n)

main()
N = int(input())
l = list(map(int, input().split())
         
L = [i for i in l if i % 2 == 0]

K = [i for i in L if i % 3 != 0]

J = [i for i in K if i % 5 != 0]
         
if len(J) == 0:
         print("APPROVED")
else:
         print("DENIED")

### FIXED CODE ###

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

L = [i for i in l if i % 2 == 0]
K = [i for i in L if i % 3 != 0]
J = [i for i in K if i % 5 != 0]

if len(J) == 0:
		print("APPROVED")
else:
        print("DENIED")
N = int(input())
v = list(map(int,input().split()))
v.sort()
for i in range(N-1):
	v[i+1] = (v[i] + v[i+1])/2
print(v[N])

### FIXED CODE ###

N = int(input())
v = list(map(int,input().split()))
v.sort()
for i in range(N-1):
	v[i+1] = (v[i] + v[i+1])/2
print(v[N-1])
問題文
ある3日間の天気予報が、長さ 3の文字列Sとして与えられます。
Sのi(1≤i≤3)文字目が S のとき、i日目の天気予報が晴れだったことを、
C のときは曇りだったことを、
R のときは雨だったことを意味します。

また3日間の実際の天気が、長さ 3の文字列Tとして与えられます。
Tの i (1≤i≤3)文字目が S のとき、i日目の実際の天気が晴れだったことを、
C のときは曇りだったことを、
R のときは雨だったことを意味します。
3日間で天気予報が的中した日が何日あるかを出力してください。

制約
SおよびTは長さ 3の文字列である。
SおよびTは S, C, R のみからなる。

S =[]
T =[]
i = random.choice(S,C,R)

S[0] ='i'
S[1] ='i'
S[2] ='i'

T[0] ='i'
T[1] ='i'
T[2] ='i'

if S[0]=T[0]:
  correct += 1
  if S[1]=T[1]:
    correct += 1
    if S[2]=S[2]:
      correct += 1

print(correct)


### FIXED CODE ###

S=input()
T=input()

ans=0
for s,t in zip(S,T):
  if s==t:
    ans+=1
print(ans)
a, b, x = map(int, input().split())
a -= 1
print ((b // x) - (a // x))

### FIXED CODE ###

print('A'+input().split()[1][0]+'C')
cnt = 0
n = int(input())
for i int range(1, n + 1):
  p = int(input())
  if int(i) != p :
    cnt += 1
    if cnt >= 2:
      break
if cnt <= 1 :
  print("YES")
else :
   print("NO")


### FIXED CODE ###

cnt = 0
n = int(input())
p = list(map(int, input().split()))
for i in range(1, n + 1):
  if int(i) != p[i - 1] :
    cnt += 1
    if cnt >= 3:
      break
if cnt <= 2 :
  print("YES")
else :
   print("NO")
def solve():
    ans = ["0"]*len(s)
    ans[0] = "1"
    for i in range(len(s)):
        a = ((s[i]== 1) and c[i]==0)
        b = False
        for j in range(len(s)):
            b = b or (s[i] == s[j] and (not i==j) and not c[i]==c[j])
        if a or b:
            print(-1)
            exit()
        ans[s[i]-1] = str(c[i])
    ans = "".join(ans)
    print(ans)



    return




n, m = [int(s) for s in input().split(" ")]
s = []
c = []
for i in range(m):
    si, ci = [int(s) for s in input().split(" ")]
    s.append(si)
    c.append(ci)
solve()


### FIXED CODE ###




def solve():
    ans = ["0"]*n
    if not n==1:
        ans[0] = "1"
    for i in range(len(s)):
        a = ((s[i]== 1) and c[i]==0) and (not n == 1)
        b = False
        for j in range(len(s)):
            b = b or (s[i] == s[j] and (not i==j) and not c[i]==c[j])
        if a or b:
            print(-1)
            exit()
        ans[s[i]-1] = str(c[i])
    ans = "".join(ans)
    print(ans)



    return




n, m = [int(s) for s in input().split(" ")]
s = []
c = []
for i in range(m):
    si, ci = [int(s) for s in input().split(" ")]
    s.append(si)
    c.append(ci)
solve()
h_state=[0]*n

def water(n,h,h_state):
    for i in range(n):
        if h_state[i]<h[i]:
            l=i
            break
        elif i==n-1 and h_state[i]<h[i]:
            l=i
        else:
            l=i+1
    
    for j in range(l,n):
        if h_state[j]==h[j]:
            r=j-1
            break
        else:
            r=j
    
    for k in range(l,r+1):
        h_state[k]+=1

cnt=0
while h_state != h:
    for i in range(n):
        if h_state[i]<h[i]:
            cnt+=1
            water(n,h,h_state)
            break
print(cnt)
        

### FIXED CODE ###

n=int(input())
h=[int(x) for x in input().split()]

h_state=[0]*n

def water(n,h,h_state):
    for i in range(n):
        if h_state[i]<h[i]:
            l=i
            break
        elif i==n-1 and h_state[i]<h[i]:
            l=i
        else:
            l=i+1
    
    for j in range(l,n):
        if h_state[j]==h[j]:
            r=j-1
            break
        else:
            r=j
    
    for k in range(l,r+1):
        h_state[k]+=1

cnt=0
while h_state != h:
    for i in range(n):
        if h_state[i]<h[i]:
            cnt+=1
            water(n,h,h_state)
            break
print(cnt)
n = int(input())
if n % 2 != 0:
  print(n/2+1)
 else:
  print(n/2)

### FIXED CODE ###

n = int(input())
print((n+1)//2)
a = list(map(int,input().sprit()))
for i in range(a[0])
	b =  list(map(int,input().sprit()))
b.sort()
c = 0
for i in range(a[1])
	c += b[i]
print(b)

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
total = 0
for i in range(k):
    total+=p[i]
print(total)
n = int(input())
first = int(input())
min = first
max = first
sum = first
for i in range(n-1):
	x = int(input())
	if x > max:
		max = x
	if x < min:
		min = x
	sum += x

print(min, max, sum)

### FIXED CODE ###

n = int(input())
nums = list(map(int,input().split()))
min = nums[0]
max = nums[0]
sum = 0
for x in range(n):
	if nums[x] > max:
		max = nums[x]
	if nums[x] < min:
		min = nums[x]
	sum += nums[x]

print(min, max, sum)
n = int(input())
a = [0] + list(map(int, input().split()))
for i in range(n // 2, 0, -1):
    a[i] ^= a[i * 2::i]

s = [i for i, b in enumerate(a) if b]
print(len(s))
print(*s)


### FIXED CODE ###

n = int(input())
aaa = list(map(int, input().split()))
aaa = [0] + aaa
for i in range(n // 2, 0, -1):
    b = 0
    j = i * 2
    while n >= j:
        b ^= aaa[j]
        j += i
    aaa[i] ^= b

ans = [i for i, b in enumerate(aaa) if b]
print(len(ans))
print(*ans)
if S == 'ABC':
  S = 'ARC'
else:
  S = 'ABC'
  
print(S)

### FIXED CODE ###

S = input()

if S == 'ABC':
  S = 'ARC'
else:
  S = 'ABC'
  
print(S)
#高さは後から決まりそう、中心を決める
#x,y,nで動かす三重ループ

n=int(input())
xyh=[list(map(int,input().split())) for i in range(n)]
XYH=[i for i in xyh if i[2]!=0]
n=len(XYH)
d=[0,0]
f=0
if n==1:
    k
else:
    n=len(XYH)
    d=[0,0]
    f=0
    for i in range(101):
        for j in range(101):
            l=abs(XYH[0][0]-i)+abs(XYH[0][1]-j)+XYH[0][2]
            for k in range(n):
                if l!=abs(XYH[k][0]-i)+abs(XYH[k][1]-j)+XYH[k][2]:
                    break
            else:
                f=1
                d=[i,j]

            if f==1:
                break

        if f==1:
            break

    d.append(abs(XYH[0][0]-i)+abs(XYH[0][1]-j)+XYH[0][2])
    print(" ".join(map(str,d)))


### FIXED CODE ###

#高さは後から決まりそう、中心を決める
#x,y,nで動かす三重ループ

n=int(input())
xyh=[list(map(int,input().split())) for i in range(n)]
XYH=[i for i in xyh if i[2]!=0]
n=len(XYH)
d=[0,0]
f=0
if n==1:
    d=[XYH[0][0],XYH[0][1],XYH[0][2]]
    print(" ".join(map(str,d)))
else:
    n=len(XYH)
    d=[0,0]
    f=0
    for i in range(101):
        for j in range(101):
            l=abs(XYH[0][0]-i)+abs(XYH[0][1]-j)+XYH[0][2]
            for k in range(n):
                if l!=abs(XYH[k][0]-i)+abs(XYH[k][1]-j)+XYH[k][2]:
                    break
            else:
                f=1
                d=[i,j]

            if f==1:
                break

        if f==1:
            break

    d.append(abs(XYH[0][0]-i)+abs(XYH[0][1]-j)+XYH[0][2])
    print(" ".join(map(str,d)))
import bisect

N=int(input())
S=list(input())
Q=int(input())
L=[[] for i in range(150)]

for i in range(N):
    L[ord(S[i])].append(i)

#print(L)

for i in range(Q):
    
    Type,q1,q2=map(str,input().split())
    if Type=='1':
        q1=int(q1)-1
        L[ord(S[q1])].remove(q1)
        L[ord(q2)].append(q1)
        L[ord(q2)]=sorted(L[ord(q2)])
    else:
        q1,q2=int(q1)-1,int(q2)-1
        cnt=0
        for j in range(97,123):
            if len(L[j])!=0:
                L[j]=sorted(L[j])
                n=bisect.bisect_left(L[j],q1)
                #print(j,n)
                if n<len(L[j]) and L[j][n]<=q2:
                    cnt+=1
                    #print(str(j),'<')
        print(cnt)

### FIXED CODE ###

import bisect

N=int(input())
S=list(input())
Q=int(input())

alphabet="abcdefghijklmnopqrstuvwxyz"
bag={l:[] for l in alphabet}
for i in range(N):
    bag[S[i]].append(i+1)
#print(bag)

for i in range(Q):
    Type,a,b=input().split()
    if Type=='1':
        a=int(a)
        if S[a-1]!=b:
            bag[S[a-1]].remove(a)
            S[a-1]=b
            bisect.insort(bag[b],a)
    else:
        cnt=0
        a,b=int(a),int(b)
        for l in alphabet:
            bl=len(bag[l])
            if bl>0:
                left=bisect.bisect_left(bag[l],a)
                if left!=bl and bag[l][left]<=b:
                        cnt+=1
        print(cnt)
def output(S,T,i,j):
  op = ""
  for k in S[:j-i]:
    if k == "?":
      op += "a"
    else:
      op += k
  op += T
  if j-i+len(T) < len(S):
    for k in S[j-i+len(T):]:
      if k == "?":
        op += "a"
      else:
        op += i
  return op


S = input()
T = input()
SS = len(S)
TT = len(T)
cand = []
if TT > SS:
  print("UNRESTORABLE")
else:
  for i,t in enumerate(T):
    for j,s in enumerate(S):
      c = 0
      if ((t == s) or (s == "?")) and (i <= j) and (TT - i <= SS - j):
        for ss, tt in zip(S[j-i:j-i+TT+1], T):
          if ss != tt and ss != "?":
            break
          else:
            c += 1
        if c == TT:
          cand.append(output(S,T,i,j))
  cand.sort()
  cand.append("UNRESTORABLE")
  print(cand[0])

### FIXED CODE ###

def output(S,T,i,j):
  op = ""
  for k in S[:j-i]:
    if k == "?":
      op += "a"
    else:
      op += k
  op += T
  if j-i+len(T) < len(S):
    for k in S[j-i+len(T):]:
      if k == "?":
        op += "a"
      else:
        op += k
  return op


S = input()
T = input()
SS = len(S)
TT = len(T)
cand = []
if TT > SS:
  print("UNRESTORABLE")
else:
  for i,t in enumerate(T):
    for j,s in enumerate(S):
      c = 0
      if ((t == s) or (s == "?")) and (i <= j) and (TT - i <= SS - j):
        for ss, tt in zip(S[j-i:], T):
          if ss != tt and ss != "?":
            break
          else:
            c += 1
        if c == TT:
          cand.append(output(S,T,i,j))
  cand.sort()
  cand.append("UNRESTORABLE")
  print(cand[0])
INPUT_STR = input()


match_patterns = [
    ''.join(list(reversed('dream'))),
    ''.join(list(reversed('dreamer'))),
    ''.join(list(reversed('erase'))),
    ''.join(list(reversed('eraser')))
]

reversed_input = ''.join(list(reversed(INPUT_STR)))


def is_concatted_string(string: str):
    if len(string) == 0:
        return True
    else:
        for pattern in match_patterns:
            if string.startswith(pattern):
                string = string[len(pattern):]
                return is_concatted_string(string)


if is_concatted_string(reversed_input):
    print("YES")
else:
    print("NO")


### FIXED CODE ###

INPUT_STR = input()


match_patterns = [
    ''.join(list(reversed('dream'))),
    ''.join(list(reversed('dreamer'))),
    ''.join(list(reversed('erase'))),
    ''.join(list(reversed('eraser')))
]

string = ''.join(list(reversed(INPUT_STR)))


def is_concatted_string(string):
    string = ''.join(list(reversed(string)))
    while len(string) != 0:
        for pattern in match_patterns:
            if string.startswith(pattern):
                string = string[len(pattern):]
                if len(string) == 0:
                    return True
                break
        else:
            return False
    return False


if INPUT_STR != '' and is_concatted_string(INPUT_STR):
    print('YES')
else:
    print('NO')
A,B = list(map(int,input().split()))

aaa = []

for i in range(1,min(A,B)):
    if A%i == 0 and B%i == 0:
        aaa.append(i)
        
count = 0

for i in range(len(aaa)):
    if isprime(aaa[i]) == True:
        count += 1
        
print(count+1)

### FIXED CODE ###

from fractions import gcd
 
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    # divisors.sort()
    return divisors
  
def isPrime(n):
  if n < 2:
    # 2未満は素数でない
    return False
  if n == 2:
    # 2は素数
    return True
  for p in range(2, int(n**0.5)+1):
      if n % p == 0:
        # nまでの数で割り切れたら素数ではない
        return False
  # nまでの数で割り切れなかったら素数
  return True
 
A,B = list(map(int,input().split()))
 
aaa = []
 
aaa = make_divisors(gcd(A,B))
        
count = 0
 
for i in range(len(aaa)):
    if isPrime(aaa[i]) == True:
        count += 1
        
print(count+1)
n,k  = map(int,input().split())

if n>=k:
    if n%k != 1 or n%k != 2 or n%k != 0:
        print(n%(k-1))
    else:
        print(n%k)
elif n<k:
    print(n)

### FIXED CODE ###

n,k  = map(int,input().split())
print(min(n%k, abs(k-n%k)))
a, b = input().split()

int_a = int(a)
int_b = int(b)

a_List = ''
b_List = ''

for i in range(int_a):
    b_List = b_List + b

for i in range(int_b):
    a_List = a_List + a


# print('a_List : ' + a_List)
# print('b_List : ' + b_List)

a_List = int(a_List)
b_List = int(b_List)

if a_List => b_List:
    print(a_List)

else:
    print(b_List)

### FIXED CODE ###


a, b = input().split()

int_a = int(a)
int_b = int(b)

a_List = ''
b_List = ''

for i in range(int_a):
    b_List = b_List + b

for i in range(int_b):
    a_List = a_List + a


# print('a_List : ' + a_List)
# print('b_List : ' + b_List)

a_List = int(a_List)
b_List = int(b_List)

if a_List >= b_List:
    print(a_List)

else:
    print(b_List)
from collections import defaultdict
from operator import sub

def main():
    N = int(input())
    balls = [tuple(map(int,input().split())) for _ in range(N)]
    d = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            d[tuple(map(sub, balls[i], balls[j]))] += 1
    try:
        mmax = max(d.values())
    except ValueError:
        print(100)
    mmax = int(N - mmax)
    print(mmax)


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import defaultdict
from operator import sub

def main():
    N = int(input())
    balls = [tuple(map(int,input().split())) for _ in range(N)]
    d = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            d[tuple(map(sub, balls[i], balls[j]))] += 1
    try:
        mmax = N - max(d.values(), default=0)
        print(mmax)
    except ValueError:
        print(100)

if __name__ == '__main__':
    main()