Harryxun/stf_run huggingface dataset:
p = {"JPY": 0, "BTC": 0}
for _ in range(int(input())):
    price, currency = input().split()
    price = int(price)
    p[currency] += price

print(p["JPY"] + 380000.0 * p["BTC"])

### FIXED CODE ###

p = {"JPY": 0, "BTC": 0}
for _ in range(int(input())):
    price, currency = input().split()
    price = float(price)
    p[currency] += price

print(p["JPY"] + 380000.0 * p["BTC"])
# Problem D - String Formation

# input process
S = input()
Q = int(input()) # query number

# initialization
sento = 1
mae = [] # mae queue
usiro = [] # usiro

# process
for i in range(Q):
    query_num = input()
    query_1 = int(query_num[0])
    # クエリが１の時
    if query_1==1 and sento==1:
        sento = 10
    elif query_1==1:
        sento = 1
    else: # query num 2
        n, f, c = query_num.split()
        f = int(f)
        if f==1: # 先頭追加処理
            # 先頭の位置によって変わる
            if sento==1:
                mae.append(c)
            else:
                usiro.append(c)
        else: # 末尾追加処理
            if sento==1:
                usiro.append(c)
            else:
                mae.append(c)

# output process
if sento==1:
    ans = ""
    mae.reverse()
    for m in mae:
        ans = ans + m
    ans = ans + S
    for u in usiro:
        ans = ans + s
    print(ans)
else:
    ans = ""
    usiro.reverse()
    for u in usiro:
        ans = ans + u
    ans = ans + S[::-1]
    for m in mae:
        ans = ans + m
    print(ans)


### FIXED CODE ###

# Problem D - String Formation

from collections import deque

# input process
S = input().replace("\n", "")
S = deque(list(S))
Q = int(input()) # query number

# initialization
sento = 1

# process
for i in range(Q):
    query_num = input()
    # クエリが１の時
    if query_num[0]=="1":
        # 反転処理
        if sento==1:
            sento = 10
        elif sento==10:
            sento = 1
    elif query_num[0]=="2":
        n, f, c = query_num.split()
        f = int(f)
        if f==1: # 先頭追加処理
            # 先頭の位置によって変わる
            if sento==1:
                S.appendleft(c)
            elif sento==10:
                S.append(c)
        elif f==2: # 末尾追加処理
            if sento==1:
                S.append(c)
            elif sento==10:
                S.appendleft(c)

# output process
if sento==1:
    print("".join(S))
else:
    print("".join(list(S)[::-1]))
import pandas as pd
N = input()
cum_numbers = input()

series_cum_numbers = pd.Series(list(map(int, cum_numbers.split(" "))))

student_order = series_cum_numbers.sort_values().index + 1

print(" ".join(map(str, list(student_order))))

### FIXED CODE ###

import numpy as np
N = input()
cum_numbers = input()

array_cum_numbers = np.array(list(map(int, cum_numbers.split(" "))))

studentId_order = array_cum_numbers.argsort() + 1

print(" ".join(map(str, list(studentId_order))))
#!/usr/bin/env python

s = input().strip()
k = int(input().strip())

flag = True
for i in range(k):
    if s[i] == '1':
        print(s[i])
        flag = False

if flag:
    print(s[1])


### FIXED CODE ###

#!/usr/bin/env python


def main():
    s = input().strip()
    k = int(input().strip())

    # 1桁目が、1以外のときは、1桁目を表示
    if s[0] != '1':
        print(s[0])
        return

    count_one = 0
    for c in s:
        if c == '1':
            count_one += 1
        else:
            break

    if k <= count_one:
        print(1)
    else:
        print(s[count_one])


main()
import sys
import math
def main():
    for line in sys.stdin:
        a,b = map(int, line.split())
        o1 = math.gcd(a, b)
        o2 = int(a * b / o1)
        print(o1, o2)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
def main():
    for line in sys.stdin:
        a,b = map(int, line.split())
        if a > b:
            a,b = b,a
        p = a * b #product

        while True:
            hoge = a
            a = b % a
            b = hoge
            if a == 0:
                gcd = b
                break

        lcm = p // gcd
        print(gcd, lcm)




if __name__ == "__main__":
    main()
N = int(input())
HPs = list(map(int, input().split()))

while len(HPs) > 1:
    HPs.sort()
    for i in range(len(HPs)-1):
        HPs[i+1] = HPs[i+1] % HPs[0]
    HPs.remove(0)

print(HPs[0])

### FIXED CODE ###

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

while len(HPs) > 1:
    HPs.sort()
    for i in range(len(HPs)-1):
        HPs[i+1] = HPs[i+1] % HPs[0]
    while 0 in HPs:
        HPs.remove(0)

print(HPs[0])
def dp(v):# 頂点nから始まる最長経路を返す.
  if memo[v] != -1: return memo[v]
  to_list = Grap[v]
  answ = 0

  for to in to_list:
    answ = max(answ, dp(to)+1)
  memo[v] = answ
  return answ


N, M = map(int, input().split())
Grap = {j+1:[] for j in range(N)}
memo = {j+1: -1 for j in range(N)} # 各頂点からの最長経路をメモ. -1で初期化.

for _ in range(M):
  x, y = map(int, input().split())
  Grap[x].append(y)

ans = 0
for n in range(1,N+1):
  ans = max(ans, dp(n))
print(ans)




### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)
N, M = map(int, input().split())
G = [[] for _ in range(N+1)]
MEMO = [-1 for _ in range(N+1)]

for _ in range(M):
  x, y = map(int, input().split())
  G[x].append(y)


def dp_LP(v):# 頂点nから始まる最長経路を返す.
  if MEMO[v] != -1:
    return MEMO[v]
  else:
    ans = 0
    for i in G[v]:
      ans = max(ans, dp_LP(i)+1)
    MEMO[v] = ans

    return ans



answer = 0
for n in range(1,N+1):
  answer = max(answer, dp_LP(n))
print(answer)
INFTY = 10**9+7
N,M = map(int,input().split())
A = [int(input()) for _ in range(M)]
dp = [0 for _ in range(N+1)]
dp[0] = 1
dp[1] = 1
cur = 0
if A[0]==1:
    dp[1] = 0
    cur = 1
for i in range(2,N+1):
    if cur<M and i==A[cur]:
        cur += 1
    else:
        dp[i] = (dp[i-1]+dp[i-2])%INFTY
print(dp[N])

### FIXED CODE ###

INFTY = 10**9+7
N,M = map(int,input().split())
A = []
for _ in range(M):
    A.append(int(input()))
dp = [0 for _ in range(N+1)]
dp[0] = 1
dp[1] = 1
cur = 0
if M>0 and A[0]==1:
    dp[1] = 0
    cur = 1
for i in range(2,N+1):
    if M>0 and cur<M and i==A[cur]:
        cur += 1
    else:
        dp[i] = (dp[i-1]+dp[i-2])%INFTY
print(dp[N])
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7

N, M = MAP()
a = [INT() for _ in range(M)]

dp = [0]*(N+1)
dp[0] = 1
dp[1] = 1

if a[0] == 1:
	dp[1] = 0

for i in range(2, N+1):
	if i in a:
		dp[i] = 0
		dp[i+1] = dp[i-1]
	else:
		dp[i] = (dp[i-1] + dp[i-2])%mod

print(dp[N])



### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()

def Fibo(n):
	S = [1, 1]
	if n == 1:
		return 1
	for i in range(1, n):
		S.append(S[i] + S[i-1])

	return S[n]

if M == 0:
	print(Fibo(N)%mod)
	exit()

a = [INT()]
for i in range(1, M):
	a.append(INT())
	if a[i] == a[i-1]+1:
		print(0)
		exit()
m = [a[0]-1]
for i in range(1, M):
	m.append(a[i]-a[i-1]-2)
m.append(N-a[M-1]-1)



ans = 1
for n in m:
	ans *= Fibo(n)

print(ans%mod)
n = int(input())
s = input()

num_rgb = {'R':0, 'G':0, 'B':0}
num_list = []
for i in range(n):
    num_rgb[s[i]] += 1
    num_list.append(num_rgb.copy())

total = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        if s[i] == s[j]:
            continue
        target = ''
        if not (s[i] == 'R' or s[j] == 'R'):
            target = 'R'
        elif not (s[i] == 'G' or s[j] == 'G'):
            target = 'G'
        elif not (s[i] == 'B' or s[j] == 'B'):
            target = 'B'
        num = num_list[n-1][target]-num_list[j][target]
        if 2*j-i < n and s[j+j-i] == target:
            num -= 1
        total += num
print(total)


### FIXED CODE ###

s = input()
res = False
for c in s:
  if c == '7':
    res = True
    break
if res:
  print('Yes')
else:
  print('No')
s = input()
t = input()

print(sum[1 for i in range(3) if s[i] == t[i]])

### FIXED CODE ###

s = input()
t = input()

print(sum([1 for i in range(3) if s[i] == t[i]]))
k = int(input())
stack = list(range(1,10))
for i in range(k):
  num = stack.pop(0)
  if (m:=num%10) == 0:
    stack.append([num*10 + m,num*10+m+1])
  elif m == 9:
    stack.append([num*1 + m -1,num*10 + m])
  else:
    stack.append([num*10 + m -1,num*10 + m, num*10+ m + 1])
print(num)

### FIXED CODE ###

import queue
K = int(input())
q = queue.Queue()
for i in range(1,10):
    q.put(i)

for i in range(K):
    x = q.get()
    a = x%10
    if a !=0:
        q.put(10*x +a -1)
    q.put(10*x +a )
    if a != 9:
        q.put(10*x +a +1)
print(x)
#import sys
#lines = sys.stdin.readlines()
#lines = lines.split('\n')
n, c = input().split()
#n, c = lines[0].split()
n = int(n)
c = int(c)
x = [0]
v = [0]
sv = [0]
ssv = 0
for i in range(n):
    xx, vv = input().split()
#    xx, vv = lines[i + 1].split()
    xx = int(xx)
    vv = int(vv)
    x.append(xx)
    v.append(vv)
    ssv += vv
    sv.append(ssv)
ans = -10**15
for i in range(0, n + 1, 1):
    for j in range(-1, -n +  i - 1, -1):
        e1 = sv[i] - x[i]
        e2 = sv[-1] - sv[j - 1] - (c - x[j])
        e3 = e1 + e2 - x[i]
        e3 = e1 + e2 - (c - x[j])
        ans = max([ans, e1, e2, e3, e4])
print(ans)

### FIXED CODE ###

n, c = input().split()
n = int(n)
c = int(c)
x = [0]
v = [0]
gs1 = [0]
gs2 = [0]
gs3 = [0]
gs4 = [0]
s = 0
for i in range(n):
    xx, vv = input().split()
    xx = int(xx)
    vv = int(vv)
    x.append(xx)
    v.append(vv)
    s += vv
    f = s - xx
    gs1.append(max(gs1[-1], f))
    f = s - 2 * xx
    gs2.append(max(gs2[-1], f))
s = 0
for i in range(-1, -n - 1, -1):
    s += v[i]
    f = s - (c - x[i])
    gs3.append(max(gs3[-1], f))
    f = s - 2 * (c - x[i])
    gs4.append(max(gs4[-1], f))
ans = 0
for i in range(n + 1):
    ans = max(ans, gs1[i] + gs4[n - i], gs2[i] + gs3[n - i])
print(ans)
a,b=[input() for i in range(2)]
p=0
ans=0

for i in b:
  if i =='I':
    p+=1
  elif i =='D' and p>0:
    p-=1
  else:
    p-=1
  
  if ans<p:
    ans=p
 
print(ans)

### FIXED CODE ###

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

b=a[0]*a[1]
c=a[2]*a[3]

if b-c>0:
  print(b)

else:
  print(c)
n = int(input())
v = map(int, input().split())
c = map(int, input().split())

ans = 0
for i in range(n):
  if v[i] - c[i] > 0:
    ans += v[i] - c[i]

print(ans)

### FIXED CODE ###

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

ans = 0
for i in range(n):
  if v[i] - c[i] > 0:
    ans += v[i] - c[i]

print(ans)
N, X, M = map(int,input().split())

ans_list = [X]

for i in range(1,N):
    ans = ans_list[-1]**2%M
    if ans in ans_list:
        break
    else:
        ans_list.append(ans)

st_index = ans_list.index(ans)

if st_index == N-1:
    print(sum(ans_list))
else:
    total = sum(ans_list[:st_index])
    N -= st_index
    syo = N//(i-st_index)
    mod = N%(i-st_index)

    total += sum(ans_list[st_index:])*syo
    total += sum(ans_list[st_index:st_index+mod])
    print(total)

### FIXED CODE ###


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

ans_list = [X]
if N == 1:
    print(X)
else:
    for i in range(1,N):
        ans = ans_list[-1]**2%M
        if ans in ans_list:
            break
        else:
            ans_list.append(ans)

    st_index = ans_list.index(ans)

    if st_index == N-1:
        print(sum(ans_list))
    else:
        total = sum(ans_list[:st_index])
        N -= st_index
        syo = N//(i-st_index)
        mod = N%(i-st_index)

        total += sum(ans_list[st_index:])*syo
        total += sum(ans_list[st_index:st_index+mod])
        print(total)
n=int(input())
l=list(map(int,input().split()))
l.sort()
a=n/2
s=l.index(a-1)
t=l.index(a)
if s==t:
  print("0")
else:
  ans=t-s
  print(ans)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
l.sort()
a=int(n/2)
s=l[a-1]
t=l[a]
if s==t:
  print("0")
else:
  ans=t-s
  print(ans)
p = 998244353
n, k = map(int, input().split())
LRs = [tuple(map(int, input().split())) for _ in range(k)]
A = [0] * (2 * n)
for lj, rj in LRs:
    A[lj] += 1
    A[rj + 1] -= 1
s = 0
for i in range(1, n):
    s = (s + A[i]) % p
    for lj, rj in LRs:
        A[i + lj] += s
        A[i + rj + 1] -= s
print(s)


### FIXED CODE ###

p = 998244353
n, k = map(int, input().split())
LRs = []
for j in range(k):
    lj, rj = map(int, input().split())
    LRs.append((lj, rj))
A = [0] * (n + 1)
i0 = min(lj for lj, rj in LRs)
A[0] = 1
A[i0] = 1
for i in range(i0 + 1, n):
    A[i] = A[i - 1]
    for j in range(k):
        lj, rj = LRs[j]
        if i - lj >= 0:
            A[i] += A[i - lj]
        if i - 1 - rj >= 0:
            A[i] -= A[i - 1 - rj]
        A[i] %= p
print(A[n - 1])
S = input()
print('2018'+s[4:])

### FIXED CODE ###

S = input()
print('2018'+S[4:])
s = input()
t = input()
ss = sorted(s)
tt = sorted(t,reverse=True)
for n, w in zip(ss,tt):
  if n < w:
    print("Yes")
    exit()
  elif n > w:
    print("No")
    exit()
if len(ss) > len(tt):
  print("No")
else:
  print("Yes")

### FIXED CODE ###

a,b = map(int,input().split())
if (a+b)//2 == (a+b)/2:
  print((a+b)//2)
else:
  print((a+b)//2 + 1)
def fx(n):
  cnt = 0

  for i in range(1,10000):
    if (i+1+1)**2 - i*1 - 1*1 - 1*i > n: break
    for j in range(1, 10000):
      if (1+j+1)**2 - 1*j - j*1 - 1*1 > n : break
      for k in range(1, 10000):
        formula = (i+j+k)**2 - i*j - j*k - k*i
        if formula == n:
          cnt+=1
        if formula >= n:
          break
  
  return cnt


n = int(input())
for i in range(1,n+1):
  print(fx(i))



### FIXED CODE ###

l, r, d = input().split()
l = int(l)
r = int(r)
d = int(d)

cnt = 0
for n in range(l, r+1):
  if n%d == 0:
    cnt += 1

print(cnt)
import math
A,B,C,D = (int(i) for i in input().split())

X = (C * D) // math.gcd(C, D)
Y = (C + D) // math.gcd(C, D) - 1

#print(X,Y)

#count = (B - A) // X * Y 
#print(count)


N = A % X 
N_S = N-1
UA = Y - (N_S // C + N_S // D)

#print(UA)
M = B % X
UB = M // C + M // D
if M == 0:
    UB = 0
#print(UB)


SA =  A + ( X - N )
SB =  B - M 
#print(SA,SB)
count = (SB - SA) // X * Y 

#print(count)
add = count + UA + UB
    
Z = B - A - add + 1
print(Z)

### FIXED CODE ###

import fractions
a,b,c,d = map(int,input().split())
e = c * d // fractions.gcd(c,d)

c_count = b // c - (a - 1) // c
d_count = b // d - (a - 1) // d
e_count = b // e - (a - 1) // e

ans = b - a + 1 - c_count - d_count + e_count
print(ans)
A = list(map(int, input().split()))
print(int(A[0]*A[1]))

### FIXED CODE ###

from decimal import Decimal

a,b = map(Decimal, input().split())
ans = a*b
print(int(ans))
import math
v = int(math.sqrt(N))
return v*v

### FIXED CODE ###

import math
n = int(input())
v = int(math.sqrt(n))
print(v*v)
n, m = map(int, input().split())
broken = []
for i in range(m):
    broken.append(int(input()))
    
num = [0] * n
num[0] = int(0 not in broken)
num[1] = int(1 not in broken)

for i in range(2, n):
    if i in broken:
        num[i] = 0
    else:
        num[i] = (num[i-1] + num[i-2])%1000000007
        
if n <= 1:
    print(num[n])
else:
    print((num[n-1]+num[n-2])%1000000007)

### FIXED CODE ###

n, m = map(int, input().split())
broken = []
for i in range(m):
    broken.append(int(input()))
    
num = [-1] * (n + 1)
num[0] = 1
num[1] = 1


for i in broken:
    num[i] = 0

for i in range(2, n):
    if num[i] == -1:
        num[i] = (num[i-1] + num[i-2])%1000000007
        
if n <= 1:
    print(num[n])
else:
    print((num[n-1]+num[n-2])%1000000007)
from scipy.special import comb

ARGS=input().split()
N=int(ARGS[0])
M=int(ARGS[1])

COMB=int(comb(N, 2) + comb(M, 2))

print(str(COMB))

### FIXED CODE ###

import math

ARGS=input().split()
N=int(ARGS[0])
M=int(ARGS[1])
R=2

COMB=0
if N >= R:
    COMB=math.factorial(N) // math.factorial(N - R) // math.factorial(R)
if M >= R:
    COMB+=math.factorial(M) // math.factorial(M - R) // math.factorial(R)

print(str(COMB))
n = int(input())
b = [int(x) for x in input().split()]
a = 1
max = 10**18

for i in b:
  a *= i
  
a = -1 if a > max else a
print(r)

### FIXED CODE ###

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

if 0 in l:
    r=0
else:
    r = 1
    for x in range(n):
        r = r * l[x]
        if r > 10**18:
            r=-1
            break
  
print(r)
a, b=map(int, input(),split())
if (a*b)% 2:
 print("Odd")
else:
 print("Even")

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
S = input()

# 桁数
N = len(S)
MOD = 10**9 + 7

# dp[i][j] := Sの上からi桁目までを考えた時、それを13で割った余りがjになる方法の数
dp = [[0 for _ in range(13)]for _ in range(N + 1)]

# １桁目について
if S[0] == "?":
    # ?に0, 1, ..., 9を入れることができる
    for i in range(10):
        dp[1][i] = 1
else:
    dp[1][S[0]] = 1

# 1, 2, ..., N-1桁から、
# 2, 3, ..., N桁についての遷移を考える
for i in range(1, N):
    for j in range(13):
        if S[i] == "?":
            for k in range(10):
                dp[i + 1][(j * 10 + k) % 13] += dp[i][j]
                dp[i + 1][(j * 10 + k) % 13] %= MOD
        else:
            dp[i + 1][(j * 10 + int(S[i])) % 13] += dp[i][j]
            dp[i + 1][(j * 10 + int(S[i])) % 13] %= MOD

print(dp[N][5] % MOD)


### FIXED CODE ###

S = str(input())

# 桁数
N = len(S)
MOD = 10**9 + 7

# dp[i][j] := Sの上からi桁目までを考えた時、それを13で割った余りがjになる方法の数
dp = [[0 for _ in range(13)]for _ in range(N + 1)]

# １桁目について
if S[0] == "?":
    # ?に0, 1, ..., 9を入れることができる
    for i in range(10):
        dp[1][i] = 1
else:
    dp[1][int(S[0])] = 1

# 1, 2, ..., N-1桁から、
# 2, 3, ..., N桁についての遷移を考える
for i in range(1, N):
    for j in range(13):
        if S[i] == "?":
            for k in range(10):
                dp[i + 1][(j * 10 + k) % 13] += dp[i][j]
                dp[i + 1][(j * 10 + k) % 13] %= MOD
        else:
            dp[i + 1][(j * 10 + int(S[i])) % 13] += dp[i][j]
            dp[i + 1][(j * 10 + int(S[i])) % 13] %= MOD

print(dp[N][5] % MOD)
kekka = ""
num = []
hantei = "OK"
INF = input().split()
gyosu = int(INF[1])
keta = int(INF[0])
out = []
for l in range(keta):
  out.append(0)


for i in range(gyosu):
  num.append([int(j) for j in input().split()])

for j in range(gyosu - 1):
  for k in range(gyosu - 1):
    if num[j][0] == num[k + 1][0]:
      if num[j][1] != num[k + 1][1]:
        hantei = "NG"
          
  if num[j][0] == keta:
    if num[j][1] == 0:
      hantei ="NG"

if hantei == "NG":
  print("-1")
else:
  for m in range(gyosu):
    out[(num[m][0] - 1)] = num[m][1]
    #print(out)
if hantei == "OK":
  print(kekka)

### FIXED CODE ###

import math

N = int(input())
P = math.floor(N / 2)
P = P + N % 2
print(P)
import numpy as np

H, W, M = map(int, list(input().split()))
hw = [list(map(int, list(input().split()))) for i in range(M)]

sh = [0] * H
sw = [0] * W
bomb = np.zeros((H, W), dtype=int)
for i in range(M):
    sh[hw[i][0] - 1] += 1
    sw[hw[i][1] - 1] += 1
    bomb[hw[i][0] - 1, hw[i][1] - 1] = 1

h_list = [i for i, x in enumerate(sh) if x == max(sh)]
w_list = [i for i, x in enumerate(sw) if x == max(sw)]

print(6)


### FIXED CODE ###

H, W, M = map(int, input().split())
hw = []
sh = [0] * H
sw = [0] * W
for i in range(M):
    h, w = map(int, input().split())
    hw.append((h - 1, w - 1))

    sh[h - 1] += 1
    sw[w - 1] += 1

mh = max(sh)
mw = max(sw)

count = 0
for i in range(M):
    if sh[hw[i][0]] == mh and sw[hw[i][1]] == mw:
        count += 1

if sh.count(mh) * sw.count(mw) > count:
    print(mh + mw)
else:
    print(mh + mw - 1)
A,B,C,K=list(map(int,input().split()))

while True:
    nokori=K
    if A<=nokori:
        maisu1=A
        nokori=nokori-maisu1
    else:
        maisu1=nokori
        break

    if B<=nokori:
        maisu2=B
        nokori=nokori-maisu2
    else:
        maisu2=nokori
        break
    
    if C<=nokori:
        maisu3=A
        nokori=nokori-maisu3
        break
    else:
        maisu3=nokori
        break

print(maisu1-maisu3)

### FIXED CODE ###

A,B,C,K=list(map(int,input().split()))
nokori=K
maisu1=0
maisu2=0
maisu3=0
while True:
    if A<=nokori:
        maisu1=A
        nokori=nokori-maisu1
    else:
        maisu1=nokori
        break

    if B<=nokori:
        maisu2=B
        nokori=nokori-maisu2
    else:
        maisu2=nokori
        break
    
    maisu3=nokori
    break

print(maisu1-maisu3)
from math import degrees, atan2
from collections import defaultdict

MOD = 10**9+7
N = int(input())
# y, xの順に渡すので注意
# print(math.degrees(math.atan2(3**(1/2), 1)))

points = [list(map(int, input().split())) for _ in range(N)]
tmp = defaultdict(int)
hoge = defaultdict(lambda: defaultdict(int))
for i in range(N):
    a, b = points[i]  # bをy座標, aをx座標と考える
    v = degrees(atan2(b, a))
    if v > 0:
        tmp[degrees(atan2(b, a)) % -90] += 1
        tmp[degrees(atan2(b, a)) % 90] += 1
    else:
        tmp[degrees(atan2(b, a)) % -90] += 1
        tmp[degrees(atan2(b, a)) % 90] += 1
# 90になる
# 絶対値にしてmod90で同じものがあるかどうか
# 数えることができている


ans = pow(2, N, MOD)
print(ans)
for k, v in tmp.items():
    if k > 0:
        ans -= v * tmp[k%(-90)]
    else:
        ans -= v * tmp[k%(90)]
print(ans-1)


### FIXED CODE ###

from math import gcd

N = int(input())
# 常にy座標の方を正にする
zero = 0
d = {}
for _ in range(N):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        zero += 1
        continue
    # 最大公約数で割って互いに素である状態にする（既約分数にする）
    g = gcd(a, b)
    a //= g
    b //= g
    # 常にbを正の状態に保つ
    if b < 0:
        a = -a
        b = -b
    if b == 0 and a == -1:
        a = 1

    if a > 0:
        if (a, b) in d:
            d[(a, b)][0] += 1
        else:
            d[(a, b)] = [1, 0]
    else:
        if (b, -a) in d:
            d[(b, -a)][1] += 1
        else:
            d[(b, -a)] = [0, 1]
MOD = 10**9+7
ans = 1
for (a, b), (k, l) in d.items():
    ans *= (pow(2, k, MOD)-1) + (pow(2, l, MOD)-1) + 1
    ans %= MOD
ans += zero
ans -= 1
print(ans%MOD)
N,K = map(int,input().split())
 
P = [0 for i in range(N)]
m = 0
for i in range(K):
  a = int(input())
  b = list(int,input().split())
  for j in range(a):
    P[b[j]-1] = 1
    j += 1
    
for l in range(N):
  if P[l] == 0:
    m += 1
    
print(m)


### FIXED CODE ###

S = input()

if S =='ABC':
  print('ARC')
else:
  print('ABC')
li = list(input())
if li[0]==li[5] && li[1]==li[4] && li[2]==li[3]:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

l = list(input())
m = list(input())
if int(l[0]==m[2]) & int(l[1]==m[1]) & int(l[2]==m[0]):
  print("YES")
else:
  print("NO")
N = int(input())
L = list(map(int,input().split()))
count = 0
L.sort()
for i in range(N-2):
    for j in range(i+1,N-1):
        maxi = L[i] + L[j]
        mini = abs(L[i] - L[j]) 
        for k in range(j+1,N):
            if maxi > L[k] > mini:
                count += 1 
print(count)


### FIXED CODE ###

n = int(input())
S = input()
ans = S[0]
count = 1
for i in range(1,n):
    if S[i] != ans[-1]:
        ans += S[i]
        count += 1
print(count)
S=str(input())

if S.count('R')==0:
  print(0)
if S.count('R')==1:
  print(1)
if S.count('R')==2 and not moji.count('RR') ==1:
  print(1)
if S.count('RR')==1:
  print(2)
if S.count('RRR')==1:
  print(3)
  

### FIXED CODE ###

S=str(input())
 
if S.count('R')==0:
  print(0)
if S.count('R')==1 :
  print(1)
if S.count('R')==2 and not S.count('RR') ==1:
  print(1)
if S.count('RR')==1 and not S.count('RRR')==1:
  print(2)
if S.count('RRR')==1:
  print(3)