Harryxun/stf_run huggingface dataset:
n = int(input())
data = [[]]*(n+2)
data[0] = [-10**10, -10**10]
for i in range(1, n+1):
    x, l = map(int, input().split())
    data[i] = [x-l, x+l]
data[n+1] = [10**10, 10**10]
data.sort()
ans = n
if n == 2:
  if data[1][1] > data[2][0]:
    ans -= 1
else:
  for i in range(1, n):
    if data[i][1] > data[i+1][0] and data[i-1][1] > data[i][0]:
        ans -= 1
        data[i][0] = 0
        data[i][1] = 0
    
print(ans)


### FIXED CODE ###

h = int(input())
w = int(input())
n = int(input())
print(-(-n//max(h,w)))
s,w=map(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')
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    ll arr[n];
    map<ll,ll, greater<ll>>mp;
    for(ll i=0; i<n; i++ )
    {
        cin>>arr[i];
        mp[arr[i]]++;
    }
    ll c=0;
    ll ar=1;
    ll f=0;
    for(auto it=mp.begin(); it!=mp.end(); ++it)
    {
        ll s=it->second;
        if(c==0)
        {
            if(s>=4)
            {
                cout<<it->first*it->first<<endl;
                f=1;
                break;
            }
        }
        if(s>=2)
        {
            ar=ar*it->first;
            c++;
            if(c==2)
            {
                break;
            }
        }
    }
    if(c!=2&&f==0)
    {
        cout<<0<<endl;
    }
    else if(c==2&&f==0)
    {
        cout<<ar<<endl;
    }

}


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split(' ')))
x=0
y=0
a.sort()
a.reverse()
for i in range(len(a)-1):
    if a[i]==a[i+1]:
        x=a[i]
        p=i+1
        break
if x!=0:
    for i in range((p+1),len(a)-1):
        if a[i]==a[i+1]:
            y=a[i]
            break
print(x*y)
N, M = (int(i) for i in input().split())
P = [None for i in range(N+1)]
Tree = [list() for i in range(N+1)]
for index in range(M):
	L, R, D = (int(i) for i in input().split())
	Tree[L].append((R, D))
	Tree[R].append((L,-D))

def process(i):
	global P, Tree
	obj = Tree[i]
	if len(obj) != 0:
		if P[i] is None:
			P[i] = 0
		for j, d in obj:
			if P[j] is None:
				P[j] = P[i] + d
				process(j)
			else:
				if P[j] - P[i] != d:
					print("No")
					exit(0)

for i in range(1,N+1):
	process(i)

print("Yes")

### FIXED CODE ###

import sys

N, M = (int(i) for i in input().split())
P = [None for i in range(N+1)]
Graph = [list() for i in range(N+1)]
for index in range(M):
	L, R, D = (int(i) for i in input().split())
	Graph[L].append((R, D))
	Graph[R].append((L,-D))

def determine(i):
	if P[i] is not None:
		return
	P[i] = 0
	stack = [i]
	while len(stack) != 0:
		I = stack.pop()
		for j, d in Graph[I]:
			if P[j] is None:
				P[j] = P[I] + d
				stack.append(j)

def check(i):
	for j, d in Graph[i]:
		if P[j] - P[i] != d:
			print("No")
			exit(0)

for i in range(1,N+1):
	determine(i)

for i in range(1,N+1):
	check(i)

print("Yes")
N, K = map(int, input().split())
h = [(int(input()) for _ in range(N)]
fin = h[K-1] - h[0]
for i in range(1, N-K+1):
  t = h[i+K-1] - h[i]
  if fin > t :
    fin = t
print(fin)


### FIXED CODE ###

N, K = map(int, input().split())
h = sorted(list(int(input()) for _ in range(N)))
fin = h[K-1] - h[0]
for i in range(1, N-K+1):
  t = h[i+K-1] - h[i]
  if fin > t :
    fin = t
print(fin)
K, X = map(int,input().split())

if 500*K >= X:
  print('Yes')
  else:
    print('No')

### FIXED CODE ###

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

if 500*K >= X:
  print('Yes')
else:
  print('No')
import math

def is_prime(x):
    if x < 2: return False # 2未満に素数はない
    if x == 2 or x == 3 or x == 5: return True # 2,3,5は素数
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False # 2,3,5の倍数は合成数

    # ためし割り: 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True
	

N = int(input())
count = 0
a_list = []

for i in range(5550):
	a = 10 * i + 1
	if is_prime(a):
		a_list.append(a)
		count += 1
		if count == N:
			break

print (' '.join(map(str, a_list)))

### FIXED CODE ###

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

if b >= a:
	print (a)
else:
	print (a-1)
N = int(input())
S = list(input())
  
numberABC = 0

for i in range(0, N):
  if S[i] == 'A':
    if S[i + 1] == 'B':
      if S[i + 2] == 'C':
          numberABC += 1
print(numberABC)



### FIXED CODE ###

N = int(input())
S = input()

count = 0 

for i in range (N - 2):
  if S[i:i + 3] == 'ABC':
    count += 1

print(count)
import sys
sys.setrecursionlimit(10 ** 10)
n = int(input())
adjacent_list = [[] for i in range(n+1)]
data = []
edgedata = {}
for i in range(n-1):
    a, b = list(map(int, input().split()))
    data.append([a,b])
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
max_node = 0
finished = set()
for i in range(1,n):
    if len(adjacent_list[i]) > max_node:
        max_node = i
k = len(adjacent_list[max_node])
def dfs(node, num):
    node_list = sorted(adjacent_list[node], key = lambda x:len(adjacent_list[x]))
    color_list = [i for i in range(1,k+1) if i != num]
    c_i = 0
    finished.add(node)
    for i in node_list:
        if i not in finished:
            s = min(node, i)
            t = max(node, i)
            vv = str(s)+str(t)
            edgedata[vv] = color_list[c_i]
            dfs(i, color_list[c_i])
            c_i += 1
dfs(k,-1)
print(k)
for i in data:
    sss = (str(i[0]) + str(i[1]))
    print(edgedata[sss])
#output k

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)
n = int(input())
#隣接リスト
adjacent_list = [[] for i in range(n+1)]
#入力されたデータを保存しておくやつ
data = [None] * (n - 1)
#最終的に色を入れておくやつ。
#edgedata[(1,2)] => 1->2の辺の色を入れておく
edgedata = {}
for i in range(n-1):
    a, b = list(map(int, input().split()))
    data[i] = [a, b]
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
#つながってるノードが一番多いやつを保存しておく
max_node = 0
#探索が終わったやつを入れる
finished = set()
for i in range(1,n):
    if len(adjacent_list[i]) > len(adjacent_list[max_node]):
        max_node = i
#kには色の種類を入れる
k = len(adjacent_list[max_node])
#print("k => {}".format(k))
def dfs(node, num):
    #隣接リストの中身を、つながってるノード順にソート
    node_list = sorted(adjacent_list[node], key = lambda x:len(adjacent_list[x]))
    #さっきつかったいろは使わないようにする
    color_list = [i for i in range(1,len(node_list) + 2) if i != num]
    c_i = 0
    finished.add(node)
    for i in node_list:
        #まだ見てなかったら、dfsを掛ける
        if i not in finished:
            #小さいほうから大きいほうに文字を並べ、ハッシュに値を保存
            #print("{}".format(color_list))
            #print("c_i =>{}  node =>{}".format(c_i,node))
            edgedata[(min(node, i), max(node, i))] = color_list[c_i]
            #color_list[c_i]は使ったので、使った色として引数で渡す。
            dfs(i, color_list[c_i])
            #この色は使ったから、一個ずらす
            c_i += 1
#一番のノードを根とし、dfsをかける
dfs(k,-1)
print(k)
for i in data:
    print(edgedata[tuple(i)])
#output k
import math
import sys
import itertools
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
x,y = IL()
N = len(s)

xlist = []
ylist = []

f = 0
cnt = 0
for i in range(N):
  if s[i] == "F":
    cnt += 1
  elif s[i] == "T":
    if f == 0:
      xlist.append(cnt)
      f = 1
    else:
      ylist.append(cnt)
      f = 0
    cnt = 0
else:
  if f == 0:
    xlist.append(cnt)
  else:
    ylist.append(cnt)

#print(xlist)
#print(ylist)

Xsum = sum(xlist)
Ysum = sum(ylist)

if (Xsum-x)%2 != 0:
  print("No")
  exit()
else:
  Xnum = (Xsum-x)//2
if (Ysum-y)%2 != 0:
  print("No")
  exit()
else:
  Ynum = (Ysum-y)//2

XDP = [[0]*(Xnum+1) for _ in range(len(xlist)+1)]
YDP = [[0]*(Ynum+1) for _ in range(len(ylist)+1)]
XDP[0][0] = 1
YDP[0][0] = 1

for i in range(1,len(xlist)+1):
  for j in range(Xnum+1):
    if XDP[i-1][j] == 1:
      XDP[i][j] = 1
      if j+xlist[i-1] < Xnum+1:
        XDP[i][j+xlist[i-1]] = 1
#print(XDP)
for i in range(1,len(ylist)+1):
  for j in range(Ynum+1):
    if YDP[i-1][j] == 1:
      YDP[i][j] = 1
      if j+ylist[i-1] < Ynum+1:
        YDP[i][j+ylist[i-1]] = 1
#print(YDP)
if XDP[-1][-1] == 1 and YDP[-1][-1] == 1:
  print("Yes")
else:
  print("No")
"""
FFTFFTFFFFTFFFFTFFTFFTFFFFTFFFFTFFTFF
2 2

"""

### FIXED CODE ###

#import numpy as np
import math
import sys
import itertools
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
x,y = IL()
N = len(s)

xlist = []
ylist = []

f = 0
cnt = 0
for i in range(N):
  if s[i] == "F":
    cnt += 1
  elif s[i] == "T":
    if f == 0:
      xlist.append(cnt)
      f = 1
    else:
      ylist.append(cnt)
      f = 0
    cnt = 0
else:
  if f == 0:
    xlist.append(cnt)
  else:
    ylist.append(cnt)

x -= xlist.pop(0)
Xsum = sum(xlist)
Ysum = sum(ylist)

if (Xsum-x)%2 != 0:
  print("No")
  exit()
else:
  Xnum = (Xsum-abs(x))//2
if (Ysum-y)%2 != 0:
  print("No")
  exit()
else:
  Ynum = (Ysum-abs(y))//2

#print(Xnum,Ynum)

XDP = [[0]*(abs(Xnum)+1) for _ in range(len(xlist)+1)]
YDP = [[0]*(abs(Ynum)+1) for _ in range(len(ylist)+1)]

XDP[0][0] = 1
YDP[0][0] = 1

for i in range(1,len(xlist)+1):
  for j in range(Xnum+1):
    if XDP[i-1][j] == 1:
      XDP[i][j] = 1
      if j+xlist[i-1] < Xnum+1:
        XDP[i][j+xlist[i-1]] = 1
#print(Xnum)
#print(xlist)
#print(XDP)

for i in range(1,len(ylist)+1):
  for j in range(Ynum+1):
    if YDP[i-1][j] == 1:
      YDP[i][j] = 1
      if j+ylist[i-1] < Ynum+1:
        YDP[i][j+ylist[i-1]] = 1
#print(Ynum)
#print(ylist)
#print(YDP)

if XDP[-1][-1] == 1 and YDP[-1][-1] == 1:
  print("Yes")
else:
  print("No")
N, W = [int(i) for i in input().split()]
weight, value = [], []

for i in range(N):
    w, v = [int(i) for i in input().split()]
    weight.append(w); value.append(v);
weight += [0]*100
value += [0]*100

dp = [[0 for _ in range(110)] for _ in range(100100)]

for i in range(N):
    for j in range(W+1):
        if (j-weight[i] >= 0):
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-weight[i]] + value[i])
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])

print(dp[N][W])

### FIXED CODE ###

N, W = [int(i) for i in input().split()]
weight, value = [], []

for i in range(N):
    w, v = [int(i) for i in input().split()]
    weight.append(w); value.append(v);
weight.append(0)
value.append(0)

dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

for i in range(N):
    for j in range(W+1):
        if (j-weight[i] >= 0):
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-weight[i]] + value[i])
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])

print(dp[N][W])
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N):
  if i % 2 == 0 AND A[i]%2 == 1:
    ans += 1
print(ans)

### FIXED CODE ###

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

ans = 0
for i in range(N):
  if i % 2 == 0 and A[i]%2 == 1:
    ans += 1
print(ans)
a,b,n = map(int, input().split())
M = [0]*(n+1)
for x in range(0,n+1):
    M[x] = int(a*x/b) - a*int(x/b)

print(max(M))

### FIXED CODE ###

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

if a[0]*a[1]<=a[2]:
  return a[0]*a[1]

else:
  return a[2]

### FIXED CODE ###

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

if a[0]*a[1]<=a[2]:
  print(a[0]*a[1])
  
else:
  print(a[2])
S, W = int(map, 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")
import numpy as np
def main():
    n = int(input())
    A = np.array(list(map(int, input().split())))
    limit = 10 ** 18

    if np.any(A=0):
        print(0)
    else:
        ans = 1
        for i in range(n):
            ans *= A[i]
            if ans > limit:
                print(-1)
                exit()

        print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)
    limit = 10 ** 18
    #print(A)

    if A[-1] == 0:
        print(0)
    elif A[0] > limit:
        print(-1)
    else:
        ans = A[0]
        for i in range(1, n):
            ans *= A[i]
            if ans > limit:
                print(-1)
                exit()

        print(ans)


if __name__ == "__main__":
    main()
n,d = map(int,input()split())
if n%(2*d+1) == 0:
  print(n%(2*d+1))
else:
  print(n%(2*d+1)+1)

### FIXED CODE ###

n,d=map(int, input().split())
if n%(2*d+1) == 0:
    print(n//(2*d+1))
else:
    print(n//(2*d+1)+1)
import sys

N = int(input())
A = sorted(list(map(int,input().split())))
amari = 10**9 + 7

if N % 2 == 0:
    ans = list(int(i) for i in range(1,N,2)*2)

else:
    ans = list(int(i) for i in range(0,N,2)*2)
    A.insert(0,0)

if ans == A:
    print(2**(N//2) % amari)
else:
    print("0")

### FIXED CODE ###

N = int(input())
A = sorted(list(map(int,input().split())))
amari = 10**9 + 7
ans = []
han = 0

if N % 2 == 0:
    han = 1
else:
    han = 0
    A.insert(0,0)


ans = list(int(i) for i in range(han,N,2))
ans += ans
ans.sort()

if ans == A:
    print(2**(N//2) % amari)
else:
    print("0")
N=int(input())
D,X=list(map(int,input().split(" ")))
A=[]

for i in range(N):
  A.append(int(input()))

S=0
  
for i in range(N):
  for j in range(100):
    if (1+j*A[i])>D:
      S+=j
      break
  
print(S+X)

### FIXED CODE ###

A=int(input())
B=int(input())
C=int(input())
D=int(input())

S=0

if A>=B:
  S+=B
else:
  S+=A

if C>=D:
  S+=D
else:
  S+=C

print(S)
Copy
Copy

    N = int(input())
    S = input()
    max_cnt = 0
    for i in range(N):
      li1 = [0]*26
      li2 = [0]*26
      cnt = 0
      for j in S[i:]:
        li[ord(j)-97]+=1
      for j in S[:i]:
        li[ord(j)-97]+=1
      for j in range(26):
        if(li1[j]>0 and li2[j]>0):
          cnt += 1
      max_cnt = max(max_cnt,cnt)
    print(max_cnt)

### FIXED CODE ###

N = int(input())
S = input()
max_cnt = 0
for i in range(N):
  li1 = [0]*26
  li2 = [0]*26
  cnt = 0
  for j in S[i:]:
    li1[ord(j)-97]+=1
  for j in S[:i]:
    li2[ord(j)-97]+=1
  for j in range(26):
    if(li1[j]>0 and li2[j]>0):
      cnt += 1
  max_cnt = max(max_cnt,cnt)
print(max_cnt)
import math
A, B = map(int, input().split())
print((A * B) // math.gcd(A, B))

### FIXED CODE ###

import fractions
A, B = map(int, input().split())
print((A * B) // fractions.gcd(A, B))
import math
A, B = map(int, input().split())
print(A * B / math.gcd(A, B))

### FIXED CODE ###

import fractions
A, B = map(int, input().split())
print(A * B // fractions.gcd(A, B))
a,b,c=map(int,input().split())
if a==b==c:
    print(1)
elif a==b or b==c or a==b:
    print(2)
else:
    print(3)3 3 33

### FIXED CODE ###

a=input().split()
b=set(a)
print(len(b))
a = raw_input('input a:')
b = raw_input('input b:')

if  a > b :
print("a > b")
if  a < b :
print("a < b")
if  a == b :
print("a == b")

### FIXED CODE ###

a,b=map(int,raw_input().split())
if a > b:
    print 'a > b'
elif a < b:
    print 'a < b'
else:
    print 'a == b'
N = int(input())

l = []
for _ in range(N) :
    ll = list(map(int, input().split()))
    l.append(ll)

#print(l)

dic = {}

for i in range(1, N) :
    #subl.append([l[i][0] - l[i-1][0], l[i][1] - l[i-1][1]])
    #k = 1000000001*(l[i][0] - l[i-1][0]) + l[i][1] - l[i-1][1]
    k = str(l[i][0] - l[i-1][0]) + '+' + str(l[i][1] - l[i-1][1])

    if l[i][0] - l[i-1][0] == 0 and l[i][1] - l[i-1][1] == 0:
        continue

    if k not in dic :
        dic[k] = 1
    else :
        dic[k] += 1

print(dic)

if len(dic) == 0 :
    print(N)
else :
    print(N - max(dic.values()))


### FIXED CODE ###

N, K = map(int, input().split())
if K == 1 :
    print(0)
else :
    print(N-K)
import java.util.*;
import java.io.*;
public class main {
	public static void main (String[] args) {
		Scanner input = new Scanner(System.in);
		String w = input.next();
		int i;
		int n=w.length();
		for(i=0 ;i<n ;i++) {
			System.out.print("x");
		}		
	}

}


### FIXED CODE ###

s=input()
i=0
o="x"*len(s)
print(o)
n = int(input())
a = list(map(int,input().split()))
a_n4 = a_4 = [x for x in a if x%4!=0]
a_4 = [x for x in a if x%4==0]
a_2 = [x for x in a if x%4!=0 and x%2==0]

if (len(a_n4)<=1+len(a_4) and len(a_2)<=1) or (len(a_n4)<=len(a_4) and len(a_2)>1) ):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

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

c = [0,0,0,0]
for x in a:
    c[x % 4] += 1

# if (c[1]==0) and (c[3]==0):
#     print('Yes')

if c[1] + c[3] < c[0] + 1:
    print('Yes')
elif (c[1] + c[3] == c[0] + 1)and(c[2] == 0):
    print('Yes')
else:
    print('No')
S=input()
count=0

for i in range(0,len(S)-4):
    check3=int(S[i])+int(S[i+1])+int(S[i+2])+int(S[i+3])
    for j in range(i+5,len(S)+1):
        check3+=int(S[j-1])
        check3%=3
        if check3==0:
            if int(S[i:j])%673==0:
                count+=1
                
print(str(count))

### FIXED CODE ###

S,W=map(int,input().split()) 
if S<=W:
    print('unsafe')
else:
    print('safe')
src/contest/abc/abc153/c.py

### FIXED CODE ###


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

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

h.sort(reverse=True)

print(sum(h[min(n,k):]))
x, k, d = map(int, input().split())
if (x - k*d > 0 and x > 0) or (x + k*d < 0 and x < 0):
    print(abs(x) - k*d )
else:
    if x % d == 0:
        if ((x/d) % 2) == (k % 2):
            print(0)
        else:
            print(d)
    else:
        y = abs(x)
        if (y % d < d - (y % d) and ((y - (y % d)) / d) % 2 == k % 2) or (y % d > d - (y % d) and ((y - (y % d)) / d) % 2 != k % 2):
            print(y % d)
        else:
            print(d - (y % d))
            

### FIXED CODE ###

t = input()
if (abs(len(t))<=3) and (t in 'S' or 'R'):
    if t[0]=='R' and t[1]=='R' and t[2]=='R':
        print(3)
    elif (t[0]=='R' and t[1]=='R' and t[2]!='R') or (t[0]!='R' and t[1]=='R' and t[2]=='R'):
        print(2)
    elif t[0]!='R' and t[1]!='R' and t[2]!='R':
        print(0)
    else:
        print(1)
else:
    print('false')
S = str(input())

 c = 0
 ma = 0
 for i in S:
     c = 0
     for k,j in enumerate(S):
         if ( k != 0 and k != len(S) and j != i and S[k-1] != a and S[k+1] != a):
             c += 1
     ma = min(ma, c)

 print(ma)



### FIXED CODE ###

def check(s, S):
    for i in S:
        if (i != s):
            return True
    return False

S = str(input())
T = S

m = 1000
for s in S:
    num = 0
    T = S
    while (check(s, T)):
        num += 1
        K = []
        for i in range(0, len(T) - 1):
            if s == T[i+1]:
                K.append(T[i+1])
            else:
                K.append(T[i])
        T = K
    m = min(m, num)

print(m)
import collections
N=int(input())
A=list(map(int,input().split()))

A1=[]
A2=[]
for i in range(len(A)):
    if i%2==0:
        A1.append(A[i])
    else:
        A2.append(A[i])
        
B1=collections.Counter(A1)
B2=collections.Counter(A2)


if B1.most_common(2)[0][1]==B2.most_common(2)[0][1] and B1.most_common(2)[0][1]==int(N/2):
    print(int(N/2))
else:
    
    if B1.most_common(1)==B2.most_common(1):
        if B1.most_common(2)[1][1]>=B2.most_common(2)[1][1]:
            ans=N-B1.most_common(2)[1][1]-B2.most_common(2)[0][1]
        else:
            ans=N-B2.most_common(2)[1][1]-B1.most_common(2)[0][1]
    elif B1.most_common(2)[0][0]==B2.most_common(2)[0][0]:
        if B1.most_common(2)[0][1]>=B1.most_common(2)[0][1]:
            ans=N-B1.most_common(2)[0][1]-B2.most_common(2)[1][1]
        else:
            ans=N-B2.most_common(2)[0][1]-B1.most_common(2)[1][1]
    else:
        ans=N-B1.most_common(2)[0][1]-B2.most_common(2)[0][1]
    print(ans)

### FIXED CODE ###

n=input()
N=[]
for i in range(3):
    N.append(n[i])
for j in range(3):
    if N[j]=="1":
        N[j]="9"
    else:
        N[j]="1"
print("".join(N))
lis=list(map(int, list(input() for i in range(3)))

tn=0

while len(l[tn])>0:
    if l[tn][0]=="a":
        l[tn]=l[tn][1:]
        tn=0
    elif l[tn][0]=="b":
        l[tn]=l[tn][1:]
        tn=1
    elif l[tn][0]=="c":
        l[tn]=l[tn][1:]
        tn=2
if tn==0:
    print("A")
elif tn==1:
    print("B")
elif tn==2:
    print("C")


### FIXED CODE ###

a, b, h=map(int, list(input() for i in range(3)))
print((a+b)*h//2)
print(s.replace(',', '')

### FIXED CODE ###

print(*input().split(','))
line = raw_input()
a = line.split(" ")
s = a[0] * a[1]
len = 2 * s
print str(s) + " " + str(len)

### FIXED CODE ###

line = raw_input()
lis = line.split()
a = int(lis[0])
b = int(lis[1])
s = a * b
len = 2 * (a + b)
print str(s) + " " + str(len)
h,w = map(int, input().split())
    for i in range(h):
        print("#"*w)
    print()


### FIXED CODE ###

#
# 5a
#

def main():
    while True:
        H, W = map(int, input().split())
        if H == W == 0:
            break
        for i in range(H):
            print("#"*W)
        print()


if __name__ == '__main__':
    main()
N = int(input())

A=[]
for i in range(N):
    a, b, c = map(int, input().split())
    A.append([a, b, c])

A.sort(key=lambda x:-x[2])

for x in range(0, 101):
    for y in range(0, 101):
        H = A[0][2]+abs(A[0][0]-x)+abs(A[0][1]-y)
        Flag = True
        for i in range(1, N):
            if A[i][2] > 0:
                    if H != A[i][2]+abs(A[i][0]-x)+abs(A[i][1]-y):
                        Flag = False
                        break
            else:
                if H > abs(A[i][0]-x)+abs(A[i][1]-y):
                    Flag = False
                    break
        if Flag == True:
            print(x, y, h)

### FIXED CODE ###

N = int(input())

A=[]
for i in range(N):
    a, b, c = map(int, input().split())
    A.append([a, b, c])

A.sort(key=lambda x:-x[2])

for x in range(0, 101):
    for y in range(0, 101):
        H = A[0][2]+abs(A[0][0]-x)+abs(A[0][1]-y)
        Flag = True
        for i in range(1, N):
            if A[i][2] > 0:
                    if H != A[i][2]+abs(A[i][0]-x)+abs(A[i][1]-y):
                        Flag = False
                        break
            else:
                if H > abs(A[i][0]-x)+abs(A[i][1]-y):
                    Flag = False
                    break
        if Flag == True:
            print(x, y, H)
N, Q = map(int, input().split())
S = " " + input()
l = []
r = []
for _ in range(Q):
    _l, _r = map(int, input().split())
    l.append(_l)
    r.append(_r)
dp = [0] * (N + 2) #i文字目から何個ACがあるか
cnt = 0
for i in range(1, N):
    if S[-i] == "C" and S[-i-1] == "A":
            cnt += 1
    dp[N-i] = cnt
print(dp)
ans = 0
for q in range(Q):
    ans = dp[l[q]] - dp[r[q] + 1]
    if S[r[q]] == "A" and S[r[q] + 1] == "C":
        ans -= 1
    print(ans)

### FIXED CODE ###

N, Q = map(int, input().split())
S = " " + input()
l = []
r = []
for _ in range(Q):
    _l, _r = map(int, input().split())
    l.append(_l)
    r.append(_r)
dp = [0] * (N + 2) #i文字目から何個ACがあるか
cnt = 0
for i in range(1, N):
    if S[-i] == "C" and S[-i-1] == "A":
            cnt += 1
    dp[N-i] = cnt
#print(dp)
ans = 0
for q in range(Q):
    ans = dp[l[q]] - dp[r[q] + 1]
    if r[q] < N:
        if S[r[q]] == "A" and S[r[q] + 1] == "C":
            ans -= 1
    print(ans)
n,a,b,c,d = map(int,input().split())
s = input()
flg = False
if c < d:
    #最後まで動かす
    flg = True
else:#c>d
    if '...' in s[a-1:]:
        flg = True
        if not('...' in s[:d-1]):
            flg = False
        else if ('...' in s[a-1:b]):
            flg = False
if '##' in s:
    flg = False
if flg:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

n,a,b,c,d = map(int,input().split())
s = input()
flg = False
if c < d:
    #最後まで動かす
    flg = True
else:#c>d
    if '...' in s[b-2:d+1]:
        flg = True
if '##' in s[a-1:max(d,c)-1]:
    flg = False
if flg:
    print('Yes')
else:
    print('No')
import math
A,B = map(int, input().split())
c = A*B
print(math.floor(c))


### FIXED CODE ###

from decimal import Decimal
A,B = input().split()
b = Decimal(B)
print(int(int(A)*b))