Harryxun/stf_run huggingface dataset:
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
X = [0]*N
Y = [0]*N
X = [int(s) for s in X]
Y = [int(s) for s in Y]
A = 0
B = 0
for i in range(M):
    p[i],S[i] = input().split()
p = [int(s) for s in p]
for i in range(M):
    if S[i] == "AC":
        if Y[p[i]]==0:
            Y[p[i]]+=1
            A += 1
            B += X[p[i]]
    else:
        if Y[p[i]]==0:
            X[p[i]] += 1
print(str(A)+" "+str(B))      

### FIXED CODE ###

N,M = map(int, input().split())
p = [0]*M
S = [0]*M
for i in range(M):
    p[i],S[i] = input().split()
q = [int(s)-1 for s in p]
X = [0]*N
Y = [0]*N
A = 0
B = 0
for i in range(M):
    if S[i] == "AC":
        if Y[q[i]]==0:
            Y[q[i]]+=1
            A += 1
            B += X[q[i]]
    else:
        if Y[q[i]]==0:
            X[q[i]] += 1
print(str(A)+" "+str(B))
N = int(input())
W = list(map(int, input().split()))
ans = [abs(W[0:i+1] - W[i+1:]) for i in range(N-1)]
print(min(ans))


### FIXED CODE ###

N = int(input())
W = list(map(int, input().split()))
ww = []
for i in range(N):
  ww.append(sum(W[0:i+1]))
ans = [abs((2 * q) - ww[N-1]) for q in ww]
print(min(ans))
from collections import defaultdict


def add_num(i, adj, tmp, ans_lst, total):
    for p in adj[i]:
        ans_lst[p] = total + tmp[p]
        if adj[p]:
            add_num(p, adj, tmp, ans_lst, total + tmp[p])
    
    
N, Q = [int(i) for i in input().split()]

adj = [[] * N for _ in range(N)]
tmp = defaultdict(int)
ans_lst = [0] * N


for _ in range(N - 1):
    a, b = [int(i) - 1 for i in input().split()]
    adj[a].append(b)
    
for _ in range(Q):
    p, x = [int(i) for i in input().split()]
    tmp[p-1] += x


ans_lst[0] = tmp[0]
total = tmp[0]
add_num(0, adj, tmp, ans_lst, total)

print(*ans_lst, sep=' ')

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**6) #再帰の回数制限を増やす
input = sys.stdin.readline


def add_num(i, total, parent=-1):
    """隣接リストを取り出して深さ優先探索
    自分より上層の total のカウント数と部分木の頂点としてのカウント数を足す"""
    for p in adj[i]:
        if p != parent:
            ans_lst[p] = total + tmp[p]
            add_num(p, total + tmp[p], i)
    return
    
    
N, Q = [int(i) for i in input().split()]

adj = [[] for _ in range(N)] # 隣接リスト
tmp = [0] * N # 部分木の根としてのカウント数 
ans_lst = [0] * N # 答えのリスト

# 隣接リストの作成
for _ in range(N - 1):
    a, b = [int(i) - 1 for i in input().split()]
    adj[a].append(b)
    adj[b].append(a)

# ｔｍｐリストの作成
for _ in range(Q):
    p, x = [int(i) for i in input().split()]
    tmp[p-1] += x

ans_lst[0] = tmp[0]
total = tmp[0]
add_num(0, total)

print(*ans_lst, sep=' ')
a=input()
b=input()
ans=0
for i,j in a,b:
  if i != j:
    ans+=1
print(ans)

### FIXED CODE ###

a=input()
b=input()
ans=0
for i,j in zip(a,b):
  if i != j:
    ans+=1
print(ans)
import string

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

az = string.ascii_lowercase
counts = {}
 
for v in az:

    counts[v] = float("inf")
    for i in range(n):
        counts[v] = min(counts[v], s[i].count(v))
 

ans = ""
for k, v in sorted(counts.items()):
    ans += k*v
print(ans)

### FIXED CODE ###

a,b,c = map(int,input().split())
if 2*b == a+c:
  print("YES")
else:
  print("NO")
import math

def gcd(a, b):
	while b > 0:
		a, b = b, a % b
	return a

def list_gcd(l):
    if len(l) == 0:
      return 0
    elif len(l) == 1:
      return l[0]
    elif len(l) == 2:
      return gcd(l[0], l[1])
    else:
      m = l[1:]
      return gcd(l[0], list_gcd(m))

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

if N == 2:
  print(max(A))
else:
  m = -1
  for i in range(N):
    L = [A[j] for j in range(0, i)]
    R = [A[j] for j in range(i+1, N)]
    m = max(m, gcd(list_gcd(L),list_gcd(R)))
  print(m)

### FIXED CODE ###


def gcd(a, b):
	while b > 0:
		a, b = b, a % b
	return a


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

if N == 2:
  print(max(A))
else:

  L = [0 for j in range(N+1)]
  R = [0 for j in range(N+1)]
  
  for j in range(N):
    L[j+1] = gcd(L[j], A[j])
  for j in reversed(range(N)):
    R[j] = gcd(R[j+1], A[j])

    m = -1
  for j in range(N):
    m = max(m, gcd(L[j], R[j+1]))
  print(m)
a=sorted(list(int(input()) for _ in range(int(input()))),reverse=True)
print(sum(a[::2])-sum(a[1::2]))

### FIXED CODE ###

input()
a=sorted(list(map(int,input().split())),reverse=True)
print(sum(a[::2])-sum(a[1::2]))
H,W=map(int,input().split())
f=H*W
d=[[0]*f for _ in range(f)]


s=[input() for _  in range(H)]
    
for i in range(H):
    for j in range(W-1): 
        cnt=W*i+j
        d[cnt+1][cnt]=s[i][j]==s[i][j+1]=="."
        d[cnt][cnt+1]=s[i][j]==s[i][j+1]=="."
       
for i in range(H-1):
    for j in range(W): 
        cnt=W*i+j
        d[cnt][cnt+W]=s[i][j]==s[i+1][j]=="."
        d[cnt+W][cnt]=s[i][j]==s[i+1][j]=="."
        
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
csr=np.array(d)


ans=-1
for i in range(H):
    for j in range(W): 
        cnt=W*i+j
        k=shortest_path(csr, indices=cnt)
        for q in range(f):
            if k[q]>=f+1:k[q]=-1
        ans=max(ans,max(k))

print(int(ans)

### FIXED CODE ###

H,W=map(int,input().split())
f=H*W
d=[[0]*f for _ in range(f)]


s=[input() for _  in range(H)]
    
for i in range(H):
    for j in range(W-1): 
        cnt=W*i+j
        d[cnt+1][cnt]=s[i][j]==s[i][j+1]=="."
        d[cnt][cnt+1]=s[i][j]==s[i][j+1]=="."
       
for i in range(H-1):
    for j in range(W): 
        cnt=W*i+j
        d[cnt][cnt+W]=s[i][j]==s[i+1][j]=="."
        d[cnt+W][cnt]=s[i][j]==s[i+1][j]=="."
        
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
csr=np.array(d)


ans=-1
k=shortest_path(csr)
for i in range(f):   
    for q in range(f):
            if k[i][q]>=f+1:k[i][q]=-1

    ans=max(ans,max(k[i]))

print(int(ans))
import numpy as np
n=int(input())
S=np.array(sorted([int(input()) for i in range(n)]))
for i in range(n-1):
    S=np.append(S,S[i+1:]+S[:n-i-1])
ans=0
for i in range(len(S)):
    if S[i]%10!=0:
        ans=max(ans,S[i])
print(ans)

### FIXED CODE ###

n=int(input())
S=sorted([int(input()) for i in range(n)])
ans=sum(S)
if ans%10==0:
    for i in range(n):
        if (ans-S[i])%10!=0:
            ans-=S[i]
            break
print(ans if ans%10!=0 else 0)
import math
N,X=map(int,input().split())
x=list(map(int,input().split()))
d=abs(x[0]-X)
for i in range(1,len(x)):
    d=math.gcd(d,abs(x[i]-X))
print(d)

### FIXED CODE ###

import fractions
N,X=map(int,input().split())
x=list(map(int,input().split()))
d=abs(x[0]-X)
if N==1:
    print(d)
    exit()
for i in range(1,len(x)):
    d=fractions.gcd(d,abs(x[i]-X))
print(d)
n=int(input())
a=list(map(int,input().split()))
if len(set(a))=1:
  print(n//2)
else:
  x=[]
  y=[]
  cnt=0
  for i in a:
    if cnt%2==0:
      x.append(i)
      cnt+=1
    else:
      y.append(i)
      cnt+=1
  s=list(set(x))
  t=list(set(y))
  o=0
  p=0
  for i in s:
    o=max(o,x.count(i))
  for i in t:
    p=max(p,y.count(i))
  print(n-o-p)

### FIXED CODE ###

from collections import Counter

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

if a.count(a[0])==n:
    print(n//2)
    exit()


x=a[::2]
y=a[1::2]

xx=Counter(x)
yy=Counter(y)

xxx=xx.most_common()
yyy=yy.most_common()

if xxx[0][0]!=yyy[0][0]:
    print(n-xxx[0][1]-yyy[0][1])

else:
    print(min(n-xxx[1][1]-yyy[0][1],n-xxx[0][1]-yyy[1][1]))
import sys
import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
sys.setrecursionlimit(10**7)

n, m, l = [int(i) for i in sys.stdin.readline().split()]
graph = [[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a, b, c = [int(i) for i in sys.stdin.readline().split()]
    a -= 1
    b -= 1
    graph[a][b] = c
    graph[b][a] = c

res = floyd_warshall(csgraph_from_dense(graph))
res = np.where(res <= l, np.ones_like(res), np.zeros_like(res))

new_res = floyd_warshall(csgraph_from_dense(res))
new_res[new_res == np.inf] = 0
q = int(input())
for j in range(q):
    s, t = [int(i) for i in sys.stdin.readline().split()]
    s -= 1
    t -= 1
    dis = new_res[s, t]
    print(int(dis) - 1)

### FIXED CODE ###

import sys
import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall, csgraph_to_dense
from scipy.sparse import issparse
sys.setrecursionlimit(10**7)

n, m, l = [int(i) for i in sys.stdin.readline().split()]
graph = [[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a, b, c = [int(i) for i in sys.stdin.readline().split()]
    a -= 1
    b -= 1
    graph[a][b] = c
    graph[b][a] = c

res = floyd_warshall(csgraph_from_dense(graph))
if issparse(res):
    res = csgraph_to_dense(res)
res = np.where(res <= l, 1, 0)
new_res = floyd_warshall(res)
new_res[new_res == np.inf] = 0
q = int(input())
for j in range(q):
    s, t = [int(i) for i in sys.stdin.readline().split()]
    s -= 1
    t -= 1
    dis = new_res[s, t]
    print(int(dis) - 1)
N=int(input())
pr=10**9+7
a=0
l=[0]*N
C=[int(input())-1 for i in range(N)]
for i in range(N-1):
    if C[i]==C[i+1]:
        continue
    a,l[C[i]]=(l[C[i]]+a)%pr,(l[C[i]]+a+1)%pr
a+=l[C[-1]]
print((a+1)%pr)

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
N=int(input())
pr=10**9+7
a=0
l=[0]*(2*10**5)
C=[int(input())-1 for i in range(N)]
for i in range(N-1):
    if C[i]==C[i+1]:
        continue
    a,l[C[i]]=(l[C[i]]+a)%pr,(l[C[i]]+a+1)%pr
a+=l[C[-1]]
print((a+1)%pr)
def a_multiple_array_(N, A, B):
    ans = 0  # ボタンを押した回数
    for k in range(N - 1, -1, -1):  # 末尾から貪欲に決めていく
        remainder = (A[k] + ans) % B[k]  # A[k]+ansが現在のA[k]の値
        if remainder != 0:  # 定義の仕方より、reminderは非負整数
            ans += B[k] - remainder
    return ans

N = int(Input())
A, B = [], []
for _ in range(N):
    a, b = [int(i) for i in input().split()]
    A.append(a)
    B.append(b)
print(a_multiple_array_(N, A, B))

### FIXED CODE ###

def a_multiple_array_(N, A, B):
    ans = 0  # ボタンを押した回数
    for k in range(N - 1, -1, -1):  # 末尾から貪欲に決めていく
        remainder = (A[k] + ans) % B[k]  # A[k]+ansが現在のA[k]の値
        if remainder != 0:  # 定義の仕方より、reminderは非負整数
            ans += B[k] - remainder
    return ans

N = int(input())
A, B = [], []
for _ in range(N):
    a, b = [int(i) for i in input().split()]
    A.append(a)
    B.append(b)
print(a_multiple_array_(N, A, B))
import math

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

if N == K:
    print(1)
    quit()
else:
    one_index = A.index(1)
    l = one_index #1の左側にある数字の数
    r = N - one_index - 1 #1の右側にある数字の数

    assert l < r

    print(114514)


### FIXED CODE ###

input_line = input().split()

num_array = int(input_line[0])
num_equal = int(input_line[1])

input_line = input() # 無視

equalized = 1
i = 0
while equalized < num_array:
    equalized += (num_equal - 1)
    # print(i, equalized)
    i += 1

print(str(i))
import bisect

N, M = [int(i) for i in input().split()]
alist = [int(i) for i in input().split()]
alist.sort()
inputs = [[int(i) for i in input().split()] for j in range(M)]
inputs.sort(key=lambda x:x[1], reverse=True)

for i in range(N):
    if inputs[0][1] > alist[i]:
        alist[i] = inputs[0][1]
        inputs[0][0] -= 1
        if inputs[0][0] == 0:
            inputs.pop(0)
    else:
        break
print(sum(alist))


### FIXED CODE ###

import bisect

N, M = [int(i) for i in input().split()]
alist = [int(i) for i in input().split()]
alist.sort()
inputs = [[int(i) for i in input().split()] for j in range(M)]
inputs.sort(key=lambda x:x[1], reverse=True)

for i in range(N):
    if len(inputs) == 0:
        break
    if inputs[0][1] > alist[i]:
        alist[i] = inputs[0][1]
        inputs[0][0] -= 1
        if inputs[0][0] == 0:
            inputs.pop(0)
    else:
        break
print(sum(alist))
H, K = map(int, input().split())
hp = list(map(input().split()))
hp_sorted = sorted(hp, reverse=True)
hp_new = hp_sorted[K:]
print(sum(hp_new))

### FIXED CODE ###

H, K = map(int, input().split())
hp = list(map(int, input().split()))
hp.sort(reverse=True)
print(sum(hp[K:]))
a,b = input().split()
A = a * int(b)
B = b * int(a)

lis=[A,B]
true_list = lis.sort()
print(true_list[0])

### FIXED CODE ###

a,b = input().split()
A = int(a * int(b))
B = int(b * int(a))

if A >= B:
    print(str(A))
else:
    print(str(B))
H, W = map(int, input().split())
S = [input() for _ in range(H)]
M = [(0, 0)]


def dfs(x, y, c):
    cc = float('inf')
    for xx, yy in [(x + 1, y), (x, y + 1), (x - 1, y), (x, y - 1)]:
        if (H, W) == (yy + 1, xx + 1):
            return c + 1
        if 0 <= yy < H and 0 <= xx < W and S[yy][xx] == '.' and \
                (xx, yy) not in M:
            M.append((xx, yy))
            cc = min(cc, dfs(xx, yy, c + 1))
    return cc


def main():
    ans = 0
    for i in range(H):
        ans += S[i].count('.')
    c = dfs(0, 0, 1)
    if c == float('inf'):
        print(-1)
    else:
        print(ans - c)


main()


### FIXED CODE ###

H, W = map(int, input().split())
S = [input() for _ in range(H)]


def bfs():
    q = [(0, 0)]
    nq = []
    m = []
    c = 1
    while len(q) > 0:
        while len(q) > 0:
            x, y = q.pop(0)
            for xx, yy in [(x + 1, y), (x, y + 1), (x - 1, y), (x, y - 1)]:
                if (H, W) == (yy + 1, xx + 1):
                    return c + 1
                if 0 <= yy < H and 0 <= xx < W and S[yy][xx] == '.' and \
                        (xx, yy) not in m:
                    m.append((xx, yy))
                    nq.append((xx, yy))
        q = nq
        nq = []
        c += 1
    return -1


def main():
    ans = 0
    for i in range(H):
        ans += S[i].count('.')
    c = bfs()
    if c == -1:
        print(-1)
    else:
        print(ans - c)


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

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)

    return divisors

import numpy as np
baisuu_count = np.zeros(N)
b = []
for i in reversed(range(N)):
    a = A[i]
    if (baisuu_count[i] // 2 == 1 and a == 0) or (baisuu_count[i] // 2 == 0 and a == 1):
        b.append(i + 1)
        divisors = np.array(make_divisors(i + 1))
        baisuu_count[divisors] += 1


if len(b) == 0:
    print(0)
else:
    print(len(b))
    for _b in range(len(b)):
        print(_b + 1)


### FIXED CODE ###

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

ans = [0] * n

for i in reversed(range(1, n+1)):
    count = 0
    for j in range(2 * i, n + 1, i):
        count += ans[j-1]

    if count % 2 != a[i-1]:
        ans[i-1] = 1

print(sum(ans))
for i in range(n):
    if ans[i] == 1:
        print(i + 1)
import sys
a = list(sys.stdin.read().split())
t = [[int(n[:-1] or 0), int(n[-1])] for n in a]
t = list(zip(*t))
ans = (sum(t[0]) + (len(u := list(filter(lambda n: n > 0, t[1]))) - 1)) * 10 + min(u)
print(ans)

### FIXED CODE ###

import sys
a = list(sys.stdin.read().split())
t = list(zip(*[[int(n[:-1] or 0), int(n[-1])] for n in a]))
print((sum(t[0]) + len((u := sorted(filter(lambda n: n > 0, t[1])))[:0:-1])) * 10 + (u and u[0] or 0))
A=input()
B=input()
print((6-A-B))

### FIXED CODE ###

A=int(input())
B=int(input())
print((6-A-B))
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
 
n, m, q = map(int, input().split())
vec = []
a = []
b = []
c = []
d = []
for _ in range(q):
    i, j, k, l = map(int, input().split())
    a.append(i - 1)
    b.append(j - 1)
    c.append(k)
    d.append(l)
it = a + b
it = list(set(it))
for i in range(1, m+1):
    for j in range(len(it)):
        vec.append(i)
na = []
nb = []
for i in range(q):
    for j in range(len(it)):
        if a[i] == it[j]:
            na.append(j)
        if b[i] == it[j]:
            nb.append(j)
ans = 0
for x in combinations(vec, len(it)):
    cnt = 0
    for i in range(q):
        if x[nb[i]] - x[na[i]] == c[i]:
            cnt += d[i]
    #print(x, cnt)
    if ans < cnt:
        ans = cnt
print(ans)
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations, combinations_with_replacement
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

n, m, q = map(int, input().split())
a = []
b = []
c = []
d = []
for _ in range(q):
    i, j, k, l = map(int, input().split())
    a.append(i - 1)
    b.append(j - 1)
    c.append(k)
    d.append(l)
it = a + b
it = list(set(it))
na = []
nb = []
for i in range(q):
    for j in range(len(it)):
        if a[i] == it[j]:
            na.append(j)
        if b[i] == it[j]:
            nb.append(j)
ans = 0
for x in combinations_with_replacement(range(1, m+1), len(it)):
    cnt = 0
    for i in range(q):
        if x[nb[i]] - x[na[i]] == c[i]:
            cnt += d[i]
    if ans < cnt:
        ans = cnt
print(ans)

### FIXED CODE ###

from itertools import combinations_with_replacement

n, m, q = map(int, input().split())
a = []
b = []
c = []
d = []
for _ in range(q):
    i, j, k, l = map(int, input().split())
    a.append(i - 1)
    b.append(j - 1)
    c.append(k)
    d.append(l)
it = a + b
it = list(set(it))
na = []
nb = []
for i in range(q):
    for j in range(len(it)):
        if a[i] == it[j]:
            na.append(j)
        if b[i] == it[j]:
            nb.append(j)
ans = 0
for x in combinations_with_replacement(range(1, m+1), len(it)):
    cnt = 0
    for i in range(q):
        if x[nb[i]] - x[na[i]] == c[i]:
            cnt += d[i]
    if ans < cnt:
        ans = cnt
print(ans)
N = int(input())
I = list(map(int, input().split()))
ans = 1

kMax = 10**18

if 0 in I:
    print(0)
    exit()

for i in map(int, input().split()):
    ans *= i
    if ans > kMax:
        print(-1)
        exit()
print(ans)



### FIXED CODE ###

N = int(input())
I = list(map(int, input().split()))
ans = 1

kMax = 10**18

if 0 in I:
    print(0)
    exit()

for i in I:
    ans *= i
    if ans > kMax:
        print(-1)
        exit()
print(ans)
a,b,c,d,e,f=map(int, input().split())

indxmax=0.0
wmax=0
emax=0
elmt=100*e/(100+e)
a31=int(f/100/a)+1
b31=int(f/100/b)+1
c31=int(f/c)+1
for ai in range(a31):
    for bi in range(b31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
#            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                dii=max(0,int((w/100*e-c*ci)/d))
#                for di in range(d31):
                for di in range(dii-1,dii+2):
                    diii=max(0,di)
#                    indx=(c*ci+d*diii)*100/w
                    indx=100*(c*ci+d*diii)/(w+c*ci+d*diii)
                    if indxmax<indx and elmt-indx>=0.0 and w+c*ci+d*diii<=f:
                        wmax=int(w+c*ci+d*diii)
                        indxmax=indx 
                        emax=int(c*ci+d*diii)
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax

### FIXED CODE ###

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

indxmax=0.0
wmax=0
emax=0
elimit=(100*e)/(100+e)
c31=int(f/c)+1
for ai in range(0,f+1,a):
    for bi in range(0,f-ai+1,b):
        w=100*ai+100*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
#            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            c31=(w*e)//100+c
            for ci in range(0,c31,c):
#                for di in range(d31):
                for di in range(0,c31-ci,d):
                    indx=(ci+di)*100/w
                    if indxmax<indx and e-indx>=0.0 and w+ci+di<=f:
                        wmax=w+ci+di
                        indxmax=indx 
                        emax=ci+di
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)
A,B,K=input().split(" ")
if K<=A:
  A -= K
  print(str(A),str(B))
else:
  A = 0
  B -= K - A
  print(str(A),str(B))
  

### FIXED CODE ###

A,B,K = input().split(" ")
A = int(A)
B = int(B)
K = int(K)

if K>=A:
  K -=A
  A = 0
  if K>=B:
    B = 0
  else:
    B -=K
else:
  A -=K
print(A,B)
[S, T] = input().split()
[A, B] = input().split()
U = input()
 
if U == S:
    print(f"{int(A)-1} {B}")
else:
    print(f"{A} {int(B) - 1}")

### FIXED CODE ###

[S, T] = input().split()
[A, B] = [int(x) for x in input().split()]
U = input()

if U == S:
    print(A-1, B)
else:
    print(A, B-1)
N = int(input())
listL = [int(i) for i in raw_input().split()]
maxL = max(listL)
sum = 0
for i in range(N):
    sum = sum + listL[i]

sum = sum - maxL

if maxL < sum:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N = int(input())
listL = [int(i) for i in raw_input().split()]
maxL = max(listL)
sum = 0
for i in range(N):
    sum = sum + listL[i]

sum = sum - maxL

if maxL < sum:
    print("Yes")
else:
    print("No")
i=lambda:map(int,input().split())
N,Q=i()
adj=[[] for _ in range(N)]
for _ in range(N-1):
  a,b=i()
  adj[a-1].append(b-1)
  adj[b-1].append(a-1)
V = [0 for _ in range(N)]
for _ in range(Q):
  p,x=i()
  V[p-1]+=x
def dfs(cur, prv):
  for nxt in adj[cur]:
    if nxt == prv: continue
    V[nxt] += V[cur]
    dfs(nxt, cur)
dfs(0,-1)
print(' '.join(map(str, V)))

### FIXED CODE ###

i=lambda:map(int,input().split())
N,Q=i()
adj=[[] for _ in range(N)]
for _ in range(N-1):
  a,b=i()
  adj[a-1].append(b-1)
  adj[b-1].append(a-1)
V = [0 for _ in range(N)]
for _ in range(Q):
  p,x=i()
  V[p-1]+=x
par = [-1 for _ in range(N)]
q = [0]
for cur in q:
  if par[cur] != -1: V[cur] += V[par[cur]]
  for nxt in adj[cur]:
    if nxt == par[cur]: continue
    par[nxt] = cur
    q.append(nxt)
print(' '.join(map(str, V)))
N=int(input())
A=list(map(int,input().split()))
a_1=sum(A)
count=0
for i in range(0,len(A)-1):
    if A[i]>A[i+1]:
        A[i+1]=A[i]
a_2=sum(A)
print(a_2-a_1)
        
    

### FIXED CODE ###

import math
N,X,T=map(int,input().split())
print(math.ceil(N/X)*T)
n,k = map(int,input().split())
s = input()

S = ord(s[k+1])
C =  chr(int(S)+26)

print(C)

### FIXED CODE ###

N, K = map(int, input().split())
S = input()
 
print(S[0:K-1] + S[K-1].lower() + S[K:N])
N, M = list(map(int, input().split()))
ins = True
ans = [0]*N
ok = True
for i in range(M):
    s, c = list(map(int, input().split()))
    if s==1 and c==0:
        ok = False
    if ans[s-1]==0 or ans[s-1]==c:
        ans[s-1] = c
    else:
        ok = False
    if s == 1:
        ins = True
    else:
        ins = False
answer = []
if ok == True:
    for i in range(len(ans)):
        answer.append(str(ans[i]))
    if ins==False:
        answer[0]=1
    print(''.join(answer))
else:
    print('-1')


### FIXED CODE ###


#C
N, M = list(map(int, input().split()))
ins = False
ans = [0]*N
ok = True
for i in range(M):
    s, c = list(map(int, input().split()))
    if N != 1 and s==1 and c==0:
        ok = False
    if ans[s-1]==0 or ans[s-1]==c:
        ans[s-1] = c
    else:
        ok = False
    if s == 1:
        ins = True
    else:
        ins = False
answer = []
if ok == True:
    for i in range(len(ans)):
        answer.append(str(ans[i]))
    #if N != 1 and ins==False:
    if N != 1 and answer[0]=='0':
        answer[0]='1'
    if N == 1 and M == 0:
        print(0)
    else:
        print(''.join(answer))
else:
    print('-1')