Harryxun/stf_run huggingface dataset:
import math
A, B, N = map(int, input().split())
# xはN以下
# int(A*x/B) - A*int(x/B)の最大値を求めたい

# g(x)はBごとに数値が変わるので、Bで区切って計算すれば計算量を減らせる。
# その区間で、Bで割った余りがB-1、つまり最後の点が一番高い数値を出す。
# よって、計算量はN%B

# まずは区間を出す
compute_range = list(range(0, math.ceil(N / B)))
# print(compute_range)
# この区間の中で、二分探索する
# 01だと1の方が数値が大きいことがわかったら、次はその中で末尾を取る。
# ただし、範囲外にはならないように


def h(x):
    return (int((A * x) / B) - A * int(x / B))


max_num = 0
for i in range(B):
    index = compute_range[-1] * B + i
    if index > N:
        continue
    max_num = max(max_num, h(index))

print(max_num)


### FIXED CODE ###


A, B, N = map(int, input().split())
# xはN以下
# int(A*x/B) - A*int(x/B)の最大値を求めたい


# print(compute_range)


def h(x):
    return int(int((A * x) / B) - A * int(x / B))


max_num = h(min(B - 1, N))
print(max_num)
n=int(input())
l=list(map(int,input().split()))
c=0
for i in range(n):
  for j in range(i,n):
    if 0 in l[i:j+1]:
      pass
    else:
      l[i:j+1]-=1
      c+=1
print(c)

### FIXED CODE ###

import numpy as np
n=int(input())
l=np.array(list(map(int,input().split())))
c=0
for i in range(n):
  for j in range(n-i):
    if 0 in l[i:n-j]:
      pass
    else:
      c+=min(l[i:n-j])
      l[i:n-j]=l[i:n-j]-np.array([min(l[i:n-j])]*(n-j-i))
print(c)
import sys
sys.setrecursionlimit(1000000)
N = int(input())

match = [[-1] * (N) for _ in range(N)]
c = 0
for i in range(N):
    for j in range(i+1, N):
        match[i][j] = c
        c += 1


def get_id(i, j):
    if i > j:
        i, j = j, i
    return match[i][j]


start = []
G = {k: [] for k in range(c)}
for i in range(N):
    L = map(int, input().split())
    pid = -1
    for i, l in enumerate(L):
        id = get_id(i, l-1)
        if i == 0:
            start.append(id)
        else:
            G[pid].append(id)
        pid = id

visited = [False]*c
calculated = [False]*c
dp = [-1]*c


def dfs(v):
    if dp[v] >= 0:
        return dp[v]
    visited[v] = True
    dp[v] = 1
    for nxt in G[v]:
        if visited[nxt] is True and calculated[nxt] is False:
            print(-1)
            exit()
        d = dfs(nxt)
        if d >= dp[v]:
            dp[v] = d+1
    calculated[v] = True
    return dp[v]


ans = 0
for i in start:
    res = dfs(i)
    ans = max(ans, res)
print(ans)


### FIXED CODE ###

from collections import deque

N = int(input())
L = [deque([int(i)-1 for i in input().split()]) for i in range(N)]

q = deque(range(N))
d = [0 for i in range(N)]
pairs = [-1 for i in range(N)]
while q:
    a = q.popleft()  # qの左端の選手のindexをpopleft
    if len(L[a]) == 0:
        continue
    b = L[a].popleft()

    if pairs[b] == a:  # bのリクエストがaなら
        d[a] = d[b] = max(d[a], d[b]) + 1
        q.append(a)
        q.append(b)
    else:
        pairs[a] = b
print(max(d) if not any(L) else -1)
N,K = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
a=0:
for i in h:
  if i>=h:
    a+=1
  else:
    break
print(a)

### FIXED CODE ###

N,K = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
a=0
for i in h:
  if i>=K:
    a+=1
  else:
    break
print(a)
N = int(input())
A = list(map(int,input().split()))
S = [0] * (10 ** 5)
for i,a in enumerate(A):
    S[a] = i + 1
    # print(A[i] + 1)
    # print(a)

for n in range(N + 1):
    if n != 0:
        print(S[n],end=" ")
        

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
S = [0] * (10 ** 5 + 2)
for i,a in enumerate(A):
    S[a] = i + 1
    # print(A[i] + 1)
    # print(a)

for n in range(1,N + 1):
    if n == N + 1 or n == N:
        print(S[n])
    else:
        print(S[n],end=" ")
import sys
sys.setrecursionlimit(10**7)
def add_link(a, b):
    la = links[a]
    i, j = [(0, 1), (1, 0)][s[b] == 'B']
    if not la[i] and la[j]:
        able[a] = True
    la[i].add(b)
 
n, m = map(int, input().split())
s = input()
links = [[set(), set()] for _ in range(n)]
able = [False] * n
for line in sys.stdin.readlines():
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    add_link(a, b)
    add_link(b, a)
 
def erase(v):
  if s[v] == "A":
    l = 0
  else:
    l = 1
  for q in links[v][0]:
    if not able[q]:
      continue
    links[q][l].remove(v)
    if links[q][l] == set():
      able[q] = False
      erase(q)
  for q in links[v][1]:
    if not able[q]:
      continue
    links[q][l].remove(v)
    if links[q][l] == set():
      able[q] = False
      erase(q)

for i in range(n):
  if not able[i]:
    erase(i)
if any(able):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
n, m = map(int, input().split())
s = input()
links = [[] for _ in range(2*n)]
visit = [0] * n *2
for line in sys.stdin.readlines():
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    if s[a] == s[b]:
      links[a].append(b+n)
      links[b].append(a+n)
    else:
      links[a+n].append(b)
      links[b+n].append(a)
def dfs(v):
  visit[v] = 1
  for i in links[v]:
    if visit[i] == 1:
      print("Yes")
      exit()
    elif visit[i] == 0:
      dfs(i)
  visit[v] = -1
  
for i in range(n):
  if visit[i] == 0:
    dfs(i)
print("No")
from bisect import bisect_right
A,B,Q = map(int,input().split())
S = sorted([int(input()) for _ in range(A)])
T = sorted([int(input()) for _ in range(B)])
for _ in range(Q):
    x = int(input())
    inds = bisect_right(S,x)
    indt = bisect_right(T,x)
    if inds==A and indt==B:
        ans = max(x-S[inds-1],x-T[indt-1])
    elif inds==A and indt<B:
        if T[indt-1]>=S[inds-1]:
            ans = x-S[inds-1]
        else:
            ans = min(T[indt]-x+T[indt]-S[inds-1],x-T[indt-1])
    elif inds<B and indt==B:
        if S[inds-1]>=T[intd-1]:
            ans = x-T[indt-1]
        else:
            ans = min(S[inds]-x+S[inds]-T[indt-1],x-S[inds-1])
    else:
        ans = min(max(S[inds]-x,T[indt]-x),max(x-S[inds-1],x-T[indt-1]),S[inds]-x+S[inds]-T[indt-1],T[indt]-x+T[indt]-S[inds-1])
print(ans)

### FIXED CODE ###

from bisect import bisect_right
A,B,Q = map(int,input().split())
S = [int(input()) for _ in range(A)]
S.append(10**11)
S.insert(0,-10**11)
T = [int(input()) for _ in range(B)]
T.append(10**11)
T.insert(0,-10**11)
Ds = {i:0 for i in range(1,A+1)}
Ds[A+1] = 10**11
Ds[0] = 10**11
for i in range(1,A+1):
    ind = bisect_right(T,S[i])
    Ds[i] = min(T[ind]-S[i],S[i]-T[ind-1])
Dt = {j:0 for j in range(1,B+1)}
Dt[B+1] = 10**11
Dt[0] = 10**11
for j in range(1,B+1):
    ind = bisect_right(S,T[j])
    Dt[j] = min(S[ind]-T[j],T[j]-S[ind-1])
for _ in range(Q):
    x = int(input())
    inds = bisect_right(S,x)
    cnts = min(S[inds]-x+Ds[inds],x-S[inds-1]+Ds[inds-1])
    indt = bisect_right(T,x)
    cntt = min(T[indt]-x+Dt[indt],x-T[indt-1]+Dt[indt-1])
    print(min(cnts,cntt))
MOD = 10 ** 9 + 7
p3 = [1] * N
for i in range(1, N):
    p3[i] = p3[i - 1] * 3 % MOD
L = input()
N = len(L)
p2 = 1
total = 0
for i in range(N):
    if L[i] == "1":
        total = (total + p2 * p3[N - i - 1]) % MOD
        p2 = p2 * 2 % MOD
print((total + p2 * p3[N - i - 1]) % MOD)

### FIXED CODE ###

MOD = 10 ** 9 + 7
L = input()
N = len(L)
total = 0
one_count = 0
pow2, pow3 = [1], [1]
p2, p3 = 1, 1
for i in range(N):
    p2 = p2 * 2 % MOD
    p3 = p3 * 3 % MOD
    pow2.append(p2)
    pow3.append(p3)
for i in range(N):
    if L[i] == "1":
        total = (total + pow2[one_count] * pow3[N - i - 1]) % MOD
        one_count += 1
print((total + pow2[one_count] * pow3[N - i - 1]) % MOD)
_=input()
S=input()

"""
S=""
import random
AL=["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
for i in range(10):
    t=int(random.random()*20)
    S+=AL[t]
    print(AL[t])
    print(S)
print(S)
"""
obj={}
L=[]
r=1
for i in S:
    if i in L:
        obj[S[i]]+=1
        r=r*(1+1/(2**obj[i]))
    else:
        r*=2
        obj[i]=0
        L.append(i)

    if r>(10**9+7):
        r-=(10**9+7)
        
print(r-1)


### FIXED CODE ###

N=int(input())
S=input()
R=""
L=[]
obj={}
for s in S:
    if s not in L:
        R+=s
        L.append(s)
        obj[s]=1
    else:
        obj[s]+=1

out=1
for a in obj.keys():
    out*=(obj[a]+1)
    if out>10**9+7:
        out=out%(10**9+7)
print(out-1)
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

AB = [0] * (K * K)
for itra, a in enumerate(A):
  if itra >= K:
    break
  for itrb, b in enumerate(B):
    AB[itra * K + itrb] = (a + b)
    if itrb >= K - 1:
      break
    
AB.sort(reverse=True)    
    
ABC = [0] * (K * K)
for itrab, ab in enumerate(AB):
  if itrab >= K:
    break
  for itrc, c in enumerate(C):
    ABC[itrab * K + itrc] = (ab + c)
    if itrc >= K - 1:
      break
    
ABC.sort(reverse=True)
for itr, i in enumerate(ABC):
  print(i)
  if itr >= K - 1:
    break


### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a <= k:
  ans = 'Yay!'
else:
  ans = ':('
print(ans)
# -*- coding: utf-8 -*-
btc = 380000.0
y=0
for i in range(int(input())):
    x, u = input().split()
    x = int(x)
    if u = "BTC":
         y = y + x * btc
    else:
        y = x
print(y)


### FIXED CODE ###

# -*- coding: utf-8 -*-
btc = 380000.0
y = 0.0
for i in range(int(input())):
    x, u = input().split()
    x = float(x)
    if u == "BTC":
         y += x * btc
    else:
        y += x

print(y)
a=int(input())
int res = 0
for i in range(1,1000):
  for j in range(2,10):
    if res<i**j and i**j<=a:
        res=i**j
print(res)

### FIXED CODE ###

a=int(input())

res=0

for i in range(1,1000):
    for j in range(2,10):
        if res<i**j and i**j<=a:
            res=i**j

print(res)
a=input()
b=input()
c=input()

count7=0

if a==7:
    count7=count7+1
if b==7:
    count7=count7+1
if c==7:
    count7=count7+1

if count7==1:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

a,b,c=(int(x) for x in input().split())

count7=0

if a==7:
    count7=count7+1
if b==7:
    count7=count7+1
if c==7:
    count7=count7+1

if count7==1:
    print("YES")
else:
    print("NO")
S = input()
if s[0] == S[1] and S[1] == S[2]:
  print("No")
else:
  print("Yes")
  

### FIXED CODE ###

S = input()
if S[0] == S[1] and S[1] == S[2]:
  print("No")
else:
  print("Yes")
a,b = map(int,input().split())
if a+b == 15:
	print('+')
elif a*b == 15:
	print('*')
else
	print('x')

### FIXED CODE ###

a,b = map(int,input().split())
if a+b == 15:
	print('+')
elif a*b == 15:
	print('*')
else:
	print('x')
a,b,c = map(int, input().split())
 
if a**2 + 2*math.sqrt(a*b)+b**2 < c**2:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

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

if (c-a-b)>0 and 4*a*b<(c-a-b)**2:
  print('Yes')
else:
  print('No')
S = int(input())
h = int(S / 3600)
r1 = int(S % 3600)
m = int(r1 / 60)
r2 = int(r % 60)
s = r2
print(":".join([str(h), str(m), str(s)]))

### FIXED CODE ###

S = int(input())
h = int(S / 3600)
r1 = int(S % 3600)
m = int(r1 / 60)
r2 = int(r1 % 60)
s = r2
print(":".join([str(h), str(m), str(s)]), end = "\n")
# -*- coding: utf-8 -*-
length, count = list(map(int, input().split()))

words = []
for i in range(count):
  words.append(input())

words = sorted(words)

r = ''.join(words)
print(r)

### FIXED CODE ###

# -*- coding: utf-8 -*-
count, length = list(map(int, input().split()))

words = []
for i in range(count):
  s = input()
  if len(s) != length:
    continue
  words.append(s)

words = sorted(words)

r = ''.join(words)
print(r)
import math

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

### FIXED CODE ###

import fractions

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

print((a * b) // fractions.gcd(a, b))
a,p=map(int,input().split(' '))
print(int((3*a+p)/2)

### FIXED CODE ###

a,p=map(int,input().split(' '))
print(int((3*a+p)/2))
# -*- coding: utf-8 -*-
     
id, gate = map(int, input().split())
for i in range(gate)
    a = [list(map(int,input().split()))]
b = []

for i in range(gate)
    c = range(a[i, 0], a[i, 1])
    b.extend(c)

d = range(id)

d = set(d)
b = set(b)

list = list(b&d)
print(len(list))

### FIXED CODE ###

n, m = map(int, input().split())

ans = 0
L, R = 0, 114514

for i in range(m):
    l, r = map(int, input().split())
    L, R = max(L, l), min(R, r)

print(R - L + 1 if R - L + 1 >= 1 else 0)
n, q = map(int, input().split())
g = [[] for i in range(n+1)]
c = [0 for i in range(n+1)]
ans = [0 for i in range(n+1)]
for i in range(n-1):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)
for i in range(q):
    p, x = map(int, input().split())
    c[p] += x

def dfs(now, fro, point):
    point += c[now]
    ans[now] = point
    for i in g[now]:
        if i==fro:
            continue
        dfs(i, now, point)

dfs(1, -1, 0)
for i in range(1, n+1):
    print(ans[i], end='')
    if i!=n:
        print(' ', end='')


### FIXED CODE ###

def main():
    from collections import deque
    n, q = map(int, input().split())
    g = [[] for i in range(n+1)]
    point = [0 for i in range(n+1)]
    for i in range(n-1):
        a, b = map(int, input().split())
        g[a].append(b)
        g[b].append(a)
    for i in range(q):
        p, x = map(int, input().split())
        point[p] += x

    q = deque([[1,0]])
    for j in range(n):
        now = q.pop()
        point[now[0]] += point[now[1]]
        for i in g[now[0]]:
            if i==now[1]:
                continue
            q.append([i,now[0]])
    for i in range(1, n+1):
        print(point[i], end='')
        if i!=n:
            print(' ', end='')

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

added = As[0] + As[1]
xored = 0
for A in As[2:]:
    xored ^= A

anded = added - xored
if anded % 2 == 1:
    print(-1)
    exit()
else:
    anded >>= 1

left_stones_l_A0 = '' # <= A[0] for sure.
left_stones_e_A0 = '' #not sure if this is <= A[0].
for i, (a, x) in enumerate(zip(format(anded, '045b'), format(xored, '045b'))):
    if x == '0':
        if a == '0':
            left_stones_l_A0 += '0'
            left_stones_e_A0 += '0'
        else:
            left_stones_l_A0 += '1'
            left_stones_e_A0 += '1'
    else:
        if a == '0':
            if int(left_stones_l_A0 + '1' + '1' * (44 - i), base = 2) <= As[0]:
                left_stones_l_A0 += '1'
            else:
                left_stones_l_A0 += '0'
            if int(left_stones_e_A0 + '1' + '0' * (44 - i), base = 2) <= As[0]:
                left_stones_e_A0 += '1'
            elif int(left_stones_e_A0 + '0' + '0' * (44 - i), base = 2) <= As[0]:
                left_stones_e_A0 += '0'
            else:
                left_stones_e_A0 = left_stones_l_A0
                raise ValueError
        else:
            print(-1)
            exit()

if int(left_stones_e_A0, base = 2) <= As[0]:
    ans = As[0] - int(left_stones_e_A0, base = 2)
else:
    ans = As[0] - int(left_stones_l_A0, base = 2)

if 0 <= ans < As[0]:
    print(ans)
else:
    print(-1)


### FIXED CODE ###

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

added = As[0] + As[1]
xored = 0
for A in As[2:]:
    xored ^= A

anded = added - xored
if anded % 2 == 1:
    print(-1)
    exit()
else:
    anded >>= 1

left_stones_l_A0 = '' # <= A[0] for sure.
left_stones_e_A0 = '' #not sure if this is <= A[0].
for i, (a, x) in enumerate(zip(format(anded, '045b'), format(xored, '045b'))):
    if x == '0':
        if a == '0':
            left_stones_l_A0 += '0'
            left_stones_e_A0 += '0'
        else:
            left_stones_l_A0 += '1'
            left_stones_e_A0 += '1'
    else:
        if a == '0':
            if int(left_stones_l_A0 + '1' + '1' * (44 - i), base = 2) <= As[0]:
                left_stones_l_A0 += '1'
            else:
                left_stones_l_A0 += '0'
            if int(left_stones_e_A0 + '1' + '1' * (44 - i), base = 2) <= As[0]:
                left_stones_e_A0 += '1'
                left_stones_l_A0 = left_stones_e_A0
            elif int(left_stones_e_A0 + '1' + '0' * (44 - i), base = 2) <= As[0]:
                left_stones_l_A0 = left_stones_e_A0 + '0'
                left_stones_e_A0 += '1'
            elif int(left_stones_e_A0 + '0' + '0' * (44 - i), base = 2) <= As[0]:
                left_stones_e_A0 += '0'
            else:
                left_stones_e_A0 = left_stones_l_A0
        else:
            print(-1)
            exit()

if int(left_stones_e_A0, base = 2) <= As[0]:
    ans = As[0] - int(left_stones_e_A0, base = 2)
else:
    ans = As[0] - int(left_stones_l_A0, base = 2)

if 0 <= ans < As[0]:
    print(ans)
else:
    print(-1)
height,width,a,b = map(int,input().split())
table = [[0 for i in range(width)] for j in range(height)]
replacement = a*height
i = 0
j = 0
while replacement != 0:
    # print('replace:',i,j)
    table[i][j] = 1
    replacement -= 1
    if replacement%a == 0:
        # print('shift')
        i += 1
        # print(i)
    j += 1
# print('made table:',table)
flag = []
for j in range(width):
    x = sum(table[i][j] for i in range(height)) 
    flag += [b == min(x,height-x)]
if all(flag):
    print(table)
else:
    print('No')

### FIXED CODE ###

H,W,A,B = map(int,input().split())

for i in range(H):
    if i < B:
        print('1'*A+'0'*(W-A))
    else:
        print('0'*A+'1'*(W-A))

# height,width,a,b = map(int,input().split())
# if a != 0 and b != 0:
#     table = [['0' for i in range(width)] for j in range(height)]
#     replacement = a*height
#     i = 0
#     j = 0
#     while replacement != 0:
#         # print('replace:',i,j)
#         table[i][j] = '1'
#         replacement -= 1
#         if replacement%a == 0:
#             # print('shift')
#             i += 1
#             # print(i)
#         j =(j+1)%width
        
#     # print('made table:',table)
#     flag = []
#     for j in range(width):
#         x = sum(int(table[i][j]) for i in range(height)) 
#         flag += [b == min(x,height-x)]
#     if all(flag):
#         for i in range(height):
#             print(''.join(table[i]))
#     else:
#         print('No')
# else:
#     if a == 0:
#         for i in range(b):
#             print('1'*width)
#         for i in range(height-b):
#             print('0'*width)
#     else:
#         for i in range(height):
#             print('1'*a+'0'*(width-a))
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(a, b):
    if 1<a and a<9:
        if 1<b and b<9:
            answer='yay!'
        else:
            answer=':('
    return answer

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_a, str_b] = line.split(' ')
    return (int(str_a), int(str_b))

def main():
    a, b = readQuestion()
    answer = solve(a, b)
    print(answer)
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(a, b):
    if a>8 or b>8:
        answer=':('
    else:
        answer='Yay!'
    return answer

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_a, str_b] = line.split(' ')
    return (int(str_a), int(str_b))

def main():
    a, b = readQuestion()
    answer = solve(a, b)
    print(answer)
    
if __name__ == '__main__':
    main()
#!/usr/bin/python                                                                                                                                 
# -*- coding: utf-8 -*-                                                                                                                           

import sys


def main():
    station = ""
    for c in range(ord('a'), ord('z') + 1):
        station += chr(c)
    for c in range(ord('A'), ord('Z') + 1):
        station += chr(c)

    while True:
        n = int(sys.stdin.readline())
        if n == 0:
            return

        l = sys.stdin.readline()
        l = map(lambda x: int(x), l.split())

        s = sys.stdin.readline().rstrip()
        res = ""
        for i, x in enumerate(s):
            index = ord(x) - (ord('a') if x.islower() else ord('A') + 26) - l[i % len(l)]
            res += station[index]
        print res

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/python                                                                                                                                 
# -*- coding: utf-8 -*-                                                                                                                           

import sys


def main():
    station = ""
    for c in range(ord('a'), ord('z') + 1):
        station += chr(c)
    for c in range(ord('A'), ord('Z') + 1):
        station += chr(c)

    while True:
        n = int(sys.stdin.readline())
        if n == 0:
            return 0

        l = sys.stdin.readline()
        l = map(lambda x: int(x), l.split())

        s = sys.stdin.readline().rstrip()
        res = ""
        for i, x in enumerate(s):
            index = ord(x) - (ord('a') if x.islower() else ord('A') + 26) - l[i % len(l)]
            index %= len(station)
            res += station[index]
        print res

if __name__ == '__main__':
    main()
A=list(map(int,input().split()))
A = A.sort
print(A[1]*A[2]/2)



### FIXED CODE ###

A=list(map(int,input().split()))
A.sort()
print(round(A[0]*A[1]/2))
N = int(input())
X=list(map(int, input().split())) 
print(X)
X_max = max(X)
X_min = min(X)

answerlist = []
for i in range(X_min,X_max):
  newX = [(n-i)**2 for n in X]
  print(newX)
  total = sum(newX)
  answerlist.append(total)
  
print(min(answerlist))

### FIXED CODE ###

N = int(input())
X=list(map(int, input().split())) 
X_max = max(X)
X_min = min(X)
 
answerlist = []
for i in range(X_min,X_max+1):
  newX = [(n-i)**2 for n in X]
  total = sum(newX)
  answerlist.append(total)
  
print(min(answerlist))
from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# from operator import xor
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    S=[int(input()) for i in range(N)]
    ls=[]
    for i in range(1, N + 1):
        for j in combinations(S,i):
            val=sum(j)
            if val%10!=0:
                ls.append(val)

    print(max(ls,default=0))


resolve()

### FIXED CODE ###

def resolve():
    N=int(input())
    S=sorted([int(input()) for i in range(N)])
    total=sum(S)
    if total%10!=0:
        print(total)
    else:
        for i in range(N):
            if S[i]%10!=0:
                print(total-S[i])
                break
            elif i==N-1:print(0)


resolve()
import pandas as pd
N = int(input())
city_score = [[i for i in input().split()] for i in range(N)]
all = list()
for i in range(N):
    all.append([city_score[i][0], int(city_score[i][1])*-1, i+1])
df = pd.DataFrame(all, columns=['city', 'score', 'index'])
df = df.sort_values(["city","score"])
result = list(df["index"].values)
for i in result:
    print(i)

### FIXED CODE ###

N = int(input())
city_score = [[i for i in input().split()] for i in range(N)]
city = list()
score = list()
all = list()
for i in range(N):
    city.append(city_score[i][0])
    score.append(city_score[i][1])
    all.append([city_score[i][0], int(city_score[i][1]), i+1])
    
while(True):
    min_word = "zzzzzzzzzz"
    max_score = -1
    ans = 0
    index = 0
    for i in range(len(all)):
        if((all[i][0] < min_word) or (all[i][0] == min_word and all[i][1] > max_score)):
                max_score = all[i][1]
                min_word = all[i][0]
                ans = all[i][2]
                index = i
    print(ans)
    all.pop(index)
    #print(all)
    if(len(all) == 0):
        break