Harryxun/stf_run huggingface dataset:
import sys
import numpy as np
from numba import njit

import math
n,k = map(int,input().split())
a = np.array(input().split(),np.int64)

@njit('i8,i8,i8[::1]',cache=True)
def solve(n,k,a):
    for i in range(k):
        new = np.zeros_like(a)
        for j in range(n):
            distance = j - a[j]
            if distance < 0:
                distance = 0
            last =  j + a[j]
            if last > n-1:
                last = n-1
            new[distance]+=1
            if last+1 < n:
                new[last+1]-=1
        a = np.cumsum(new)
        if np.all(a==n):
            break
    print(*a)

solve(n,k,a)

### FIXED CODE ###


import numpy as np
from numba import njit

import math

n,k = map(int,input().split())
a = np.array(input().split(),np.int64)

@njit
def solve(n,k,a):
    for i in range(k):
        new = np.zeros_like(a)
        for j in range(n):
            distance = j - a[j]
            if distance < 0:
                distance = 0
            last =  j + a[j]
            if last > n-1:
                last = n-1
            new[distance]+=1
            if last+1 < n:
                new[last+1]-=1
        a = np.cumsum(new)
        if np.all(a==n):
            break
    return a

a = solve(n,k,a)
print(" ".join(a.astype(str)))
# E
X, Y, NA, NB, NC = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
*C, = map(int, input().split())

A = sorted(A)[-X:]
B = sorted(B)[-Y:]
C = sorted(C)[::-1]

ans = sum(A) + sum(B)

i = 0
j = 0
for c in C:
    if A[i] < c or B[j] < c:
        if A[i] < B[j]:
            i += 1
            ans += c - A[i]
        else:
            j += 1
            ans += c - B[i]

print(ans)


### FIXED CODE ###

# E
X, Y, NA, NB, NC = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
*C, = map(int, input().split())

A = sorted(A)[-X:]
B = sorted(B)[-Y:]
C = sorted(C)[::-1]

ans = sum(A) + sum(B)


i = 0
j = 0
num_A = len(A)
num_B = len(B)
for c in C:
    if i < num_A and j < num_B:
        if A[i] < B[j] and A[i] < c:

            ans += c - A[i]
            i += 1
        elif A[i] >= B[j] and B[j] < c:

            ans += c - B[j]
            j += 1

    elif i < num_A:
        if A[i] < c:
            ans += c - A[i]
            i += 1

    elif j < num_B:
        if B[j] < c:
            ans += c - B[j]
            j += 1

    else:
        break

print(ans)
N,K= map(int,input().split())
H = list(map(int,input().split()))
H.sort()
s = 0
for i in range(K):
  s += H[i]
print(s+K) 


### FIXED CODE ###

N,K= map(int,input().split())
H = list(map(int,input().split()))
H.sort()
s = 0
for i in range(N-K):
  s += H[i]
print(s)
# -*- coding: utf-8 -*-
"""
A - Sorted Arrays
https://atcoder.jp/contests/agc013/tasks/agc013_a

"""
import sys
from typing import List


def solve(N, array):
    ans = 1
    prev = None
    direction = None

    for a in array:
        if prev == None:
            pass
        elif a > prev:
            if direction == 'd':
                ans += 1
                direction = None
            else:
                if a > prev:
                    direction = 'u'
        elif a < prev:
            if direction == 'u':
                ans += 1
                direction = None
            else:
                if a < prev:
                    direction = 'd'
        prev = a
    return ans


def main(args):
    N = int(input())
    array = [int(a) for a in input().split()]
    ans = solve(N, array)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
A - Sorted Arrays
https://atcoder.jp/contests/agc013/tasks/agc013_a

"""
import sys


def solve(N, array):
    ans = 1
    prev = None
    direction = None

    for a in array:
        if prev == None:
            pass
        elif a > prev:
            if direction == 'd':
                ans += 1
                direction = None
            else:
                if a > prev:
                    direction = 'u'
        elif a < prev:
            if direction == 'u':
                ans += 1
                direction = None
            else:
                if a < prev:
                    direction = 'd'
        prev = a
    return ans


def main(args):
    N = int(input())
    array = [int(a) for a in input().split()]
    ans = solve(N, array)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
import numpy as np

temp=list(map(int, input().split()))
temp=np.mean(temp)
if temp-int(temp)>0:
  output='IMPOSSIBLE'
else:
  output=temp
  
print(int(output))

### FIXED CODE ###

temp=input().split()
A=int(temp[0])
B=int(temp[1])

m=int((A+B)/2)

if m==(A+B)/2 and m>=0:
  print(int(m))
else:
  print('IMPOSSIBLE')
import sys
from collections import Counter

#[(105, 3), (120, 1), (106, 1), (119, 1)]
def selection(l1, l2, x ,y):
    
    #print('{}, {}'.format(x, y))
    
    #x yがlengthを超えたとき
    if x >= len(l1) or y >= len(l2):
        return x - 1, y - 1
    
    #それぞれの出現値が同じ場合
    if l1[x][0] == l2[y][0]:
            
        #出現回数が同じとき
        if l1[x][1] == l2[y][1]:
            return selection(l1, l2, x + 1 , y + 1)
    
    #出現回数を比較
    if l1[x][1] > l2[y][1]:
        return x , y - 1
        
    if l1[x][1] < l2[y][1]:
        return x - 1  , y
    
    return 0, 0

def main():
    input = sys.stdin.readline
    
    n = int(input())
    m = [int(i) for i in input().split()]
    
    even = [m[i] for i, _ in enumerate(m) if i % 2 == 0]
    odd = [m[i] for i, _ in enumerate(m) if i % 2 == 1]
    
    even_c = Counter(even).most_common()
    odd_c = Counter(odd).most_common()
    
    #print(even_c)
    #print(odd_c)
    
    e, o = selection(even_c, odd_c, 0 ,0)
    
    e = 0 if e < 0 else e
    o = 0 if o < 0 else o
    
    #print('{}, {}'.format(e, o))
    
    #全部ばらばら
    if (even_c[e][1] + odd_c[o][1] == 2):
        
        #0にならない
        ans = len(m) - 2
        ans = 1 if ans == 0 else ans
        print(ans)
        return
    
    #全部一緒
    if even_c[e][1] == odd_c[o][1] and even_c[e][0] == odd_c[o][0]:
        print(len(m) - even_c[e][1])
        return
    
    print( len(m) - (even_c[e][1] + odd_c[o][1]) )
    
    
if __name__ == '__main__':
    main()
    

### FIXED CODE ###

import sys
from collections import Counter
 
def main():
    input = sys.stdin.readline
    
    n = int(input())
    m = [int(i) for i in input().split()]
    
    #偶数列 奇数列
    even = [m[i] for i, _ in enumerate(m) if i % 2 == 0]
    odd = [m[i] for i, _ in enumerate(m) if i % 2 == 1]
    
    #頻値を取り出す
    even_c = Counter(even).most_common()
    odd_c = Counter(odd).most_common()
    
    ans = -1
    
    #print(even_c)
    #print(odd_c)
    #print(len(even_c))
    
    #最頻値の比較
    if even_c[0][0] != odd_c[0][0]:
        ans = len(m) - (even_c[0][1] + odd_c[0][1])
    
    #偶数列と奇数列の最頻値の数字が同じかつ、全て同じ数字じゃない
    elif even_c[0][0] == odd_c[0][0] and len(even_c) > 1:
        ans1 = len(m) - (even_c[0][1] + odd_c[1][1])
        ans2 = len(m) - (even_c[1][1] + odd_c[0][1])
        ans = ans1 if ans1 <= ans2 else ans2
    
    #全て同じ
    else:
        ans = even_c[0][1]
        
    #出力
    print(ans)
    
if __name__ == '__main__':
    main()
import sys

(sn, sm) = sys.stdin.readline().split()
n = int(sn)
m = int(sm)

flg = [0 for j in range(m)]
for i in range(n):
  sa = sys.stdin.readline().split()
  if len(sa) > 1:
	  for saj in sa[1:]:
    	aj = int(saj)
    	flg[aj - 1] += 1

suma = 0
for sumaj in flg:
  if sumaj == n:
    suma += 1
print(suma)

### FIXED CODE ###

import sys

(sn, sm) = sys.stdin.readline().split()
n = int(sn)
m = int(sm)

flg = [0 for j in range(m)]
for i in range(n):
  sa = sys.stdin.readline().split()
  if len(sa) > 1:
    for saj in sa[1:]:
      aj = int(saj)
      flg[aj - 1] += 1

suma = 0
for sumaj in flg:
  if sumaj == n:
    suma += 1
print(suma)
n,T=map(int,input().split())
c=[0]*n
t=[0]*n
ans=[]
for i in range(n):
    c[i],t[i]=map(int,input().split())
    if t[i]<=T:
        ans.append(c[i])
print(min(ans))
 


### FIXED CODE ###

n,T=map(int,input().split())
ans=9999
flag=0
for _ in range(n):
    c,t=map(int,input().split())
    if T>=t and c<ans:
        ans=c
        flag=1
if flag==0:
    print("TLE")
else:
    print(ans)
S, T= input().split()
A, B= int(input().split())
U= input().split()

if (S==U):
    print(A-1 B)
else:
    print(A B-1)

### FIXED CODE ###

S, T= input().split()
A, B= map(int, input().split())
U= input()
if (S == U):
    print(A-1,B)
elif (T == U):
    print(A,B-1)
else:
    print(A,B)
%%time
n = int(input())

# c = N - a*b
cnt = 0
for a in range(1, n, 1):
    for b in range(1, n, 1):
        if n <= a*b:
            break
        else:
            if a != b:
                cnt += 2
            else:
                cnt += 1
                break

print(cnt)

### FIXED CODE ###

n = int(input())

# c = N - a*b
cnt = 0
for a in range(1, n, 1):
    for b in range(1, n, 1):
        if n <= a*b:
            break
        else:
            if a != b:
                cnt += 2
            else:
                cnt += 1
                break

print(cnt)
w=input()

cnt=0
for i in w:
  if w[cnt] == w[cnt+1]:
    print("Bad")
  else:
    print("Good")
  cnt += 1



### FIXED CODE ###

w=input()

cnt=0
for i in w:
    if cnt+1 < len(w):
        if w[cnt] == w[cnt+1]:
            print("Bad")
            exit()
    cnt += 1

print("Good")
a, b = map(int, input().split())
if (a+b)% == 0:
  print((a+b)/2)
else:
  print('IMPOSSIBLE')

### FIXED CODE ###

a, b = map(int, input().split())
if (a+b)%2 == 0:
  print((a+b)//2)
else:
  print('IMPOSSIBLE')
A = int(input())
p = A
count = 0
if A = 1:
  count == 0
else:
  count =2
while A != 1:
  if A % 2 == 0:
    A = A // 2
    count = count + 1
  else:
    A = A * 3 + 1
    count = count + 1
print(count)

### FIXED CODE ###

A = int(input())
p = A
C = []
while A not in C:
  C.append(A)
  if A % 2 == 0:
    A = A//2
  else:
    A = A*3+1
print(len(C)+1)
a, b = int(input().split())
print(a*b)

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b)
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for _ in range(m)]
if n==1:
    c0=sc[0][1]
    for i in range(m):
        s=sc[i][0]
        c=sc[i][1]
        if c!=c0:
            print(-1)
            exit()
    print(c0)
    exit()
else:
    ans=10**5
    for i in range(10**(n-1),10**n):
        I=str(i)
        flag=True
        for j in range(m):
            s,c=sc[j][0],sc[j][1]
            if s==1 and c==0:
                print(-1)
                exit()
            if I[s-1]!=str(c):
                flag=False
                continue
        if flag:
            ans=i
    if ans==10**5:
        print(-1)
    else:
        print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
sc=[list(map(int,input().split())) for _ in range(m)]
for i in range(10**n):
    ans=str(i)
    if len(ans)==n and all(ans[s-1]==str(c) for s,c in sc):
        print(ans)
        exit()
print(-1)
import math
from functools import reduce
from itertools import combinations

n = int(input())
cnt=0
for i in range(1,n+1):
    for j in range(1,n+1):
        if(i==j):
            cnt += i
        else:
            cnt += gcd(i,i,j)*3

if(n>=3):
    my_list = list(range(1,n+1))
    x = combinations(my_list, 3)

    list_x = list(x)
    for i in list_x:
        cnt+= gcd(i[0],i[1],i[2])

print(cnt)


### FIXED CODE ###

import math

n = int(input())
cnt=0
for i in range(1,n+1):
    for j in range(1,n+1):
        t = math.gcd(i,j)
        for k in range(1,n+1):
            cnt +=  math.gcd(k,t)

print(cnt)
atodeyaruyo

### FIXED CODE ###

# ABC075 C - Bridge
def dfs(v):
    visited[v]=True
    for nv in range(n):
        if G[v][nv]==False:
            continue
        if visited[nv]:
            continue
        dfs(nv)

n,m = map(int,input().split())
G = [[False]*n for _ in range(n)]
ans = 0
visited = [False for _ in range(n)]
A,B = [],[]
for i in range(m):
    a,b = map(int,input().split())
    A.append(b-1)
    B.append(a-1)
    G[a-1][b-1]=G[b-1][a-1]=True

for i in range(m):
    G[A[i]][B[i]]=G[B[i]][A[i]]=False
    visited = [False for _ in range(n)]
    dfs(0)
    if all(visited):
        ans += 1
    G[A[i]][B[i]]=G[B[i]][A[i]]=True

print(m-ans)
N, K = map(int, input().split())
costs = list(map(int, input().split())) + [0] * 10010


def chmin(i, j, dp, costs):
    if dp[i+j] > dp[i] + abs(costs[i] - costs[i+j]):
        dp[i+j] = dp[i] + abs(costs[i] - costs[i+j])
        return True
    return False


dp = [float('inf')] * 100010
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        chmin(i, j, dp, costs)

print(dp[N-1])

### FIXED CODE ###

N, K = map(int, input().split())
vals = list(map(int, input().split()))
costs = [0] * 100010
for i in range(len(vals)):
    costs[i] = vals[i]

dp = [float('inf')] * 100010
dp[0] = 0
for i in range(1, N):
    for j in range(1, K+1):
        if i-j >= 0:
            dp[i] = min(dp[i], dp[i-j] + abs(costs[i] - costs[i-j]))

# print(dp)
print(dp[N-1])
N = input()
prime = 0
checked = 2
primeList = [2]

def is_prime(n):
    global checked
    if n <= checked:
        if n in primeList:
            return True
        else:
            return False
    else:#?´???°????????????n?????§????´???°????????????????????????
        for i in xrange(checked+1, n+1):
            isPrime = True
            for p in primeList:
                if i%p == 0:
                    #print "{}%{} == 0".format(i,p)
                    isPrime = False
                    break
            for p in xrange(checked+1, i):
                if i%p == 0:
                    #print "{}%{} == 0".format(i,p)
                    isPrime = False
                    break
            if isPrime:
                primeList.append(i)
        checked = n
        if primeList[-1] == n:
            return True
        else:
            return False
        

for _ in xrange(N):
    n = input()
    prime += 1 if is_prime(n) else 0
print prime

### FIXED CODE ###

N = input()
sum = 0
for _ in xrange(N):
    n = input()
    for i in xrange(2,n):
        if i > n/i:
            sum += 1
            break
        if n%i == 0:
            break
    else:
        sum += 1
print sum
import fractions

N, X = map(int, input().split())
x = list(map(int, input().split()))

y = []

x.sort()
for i in range(1, N):
    x1 = x[i] - x[i-1]
    y.append(x1)

d = x[0] - X if X == 1 else y[0]

for i in range(1, N-1):
    d = fractions.gcd(y[i], d)

print(d)


### FIXED CODE ###

import fractions

N, X = map(int, input().split())
x = list(map(int, input().split()))
y = []
x.insert(0, X)
x.sort()
for i in range(1, N+1):
    x1 = x[i] - x[i-1]
    y.append(x1)

d = y[0]

for i in range(1, len(y)):
    d = fractions.gcd(y[i], d)

print(d)
n = int(input())
counter  = 0
for i in range(10):
  if n mod i == 0:
    if(n / i <= 9):
      print("Yes")
      counter += 1
      break
  
if counter == 0:
  print("No")

### FIXED CODE ###

n = int(input())
counter  = 0
for i in range(1, 10):
  if n % i == 0:
    if(n / i <= 9):
      print("Yes")
      counter += 1
      break
  
if counter == 0:
  print("No")
import math
length, target = map(int, input().split(" "))
nums = sorted([int(n) for n in input().split(" ")])
minimum = min(nums)
odd, even, gcd = 0, 0, minimum
for n in nums:
    if n % 2 == 0:
        even = 1
    else:
        odd = 1
    gcd = math.gcd(gcd, n)
if target > max(nums):
    print("IMPOSSIBLE")
elif target in nums:
    print("POSSIBLE")
else:
    if gcd == 1:
        print("POSSIBLE")
    else:
        if target % gcd == 0:
            print("POSSIBLE")
        else:
            print("IMPOSSIBLE")
    
    
    

### FIXED CODE ###

import fractions 
length,target = (int(n) for n in raw_input().split(" "))
ball = [int(n) for n in raw_input().split(" ")]
gcd = ball[0]
for i in range(1,length):
    gcd = fractions.gcd(gcd,ball[i])
if target % gcd == 0 and target <= max(ball):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
import numpy as np 
H, W = map(int, input().split())
grid = []
for _ in range(H):
    grid.append([s for s in input()])

yoko = [[0 for _ in range(W)] for _ in range(H)]
tate =  [[0 for _ in range(W)] for _ in range(H)]

for h in range(H):
    cnt = 0
    for w in range(W):
        if grid[h][w] == ".":
            cnt += 1
        else:
            cnt = 0
        yoko[h][w] = cnt

for w in range(W):
    cnt = 0
    for h in range(H):
        if grid[h][w] == ".":
            cnt += 1
        else:
            cnt = 0
        tate[h][w] = cnt

tate = np.array(tate)
yoko = np.array(yoko)

for h in range(H):
    my_max = 0
    for w in range(W):
        if yoko[h][W - 1 - w] != 0:
            my_max = max(my_max, yoko[h][W - 1 - w])
            yoko[h][W - 1 - w] = my_max
        else:
            my_max = 0

tate = tate.T

for h in range(W):
    my_max = 0
    for w in range(H):
        if tate[h][H - 1 - w] != 0:
            my_max = max(my_max, tate[h][H - 1 - w])
            tate[h][H - 1 - w] = my_max
        else:
            my_max = 0
            
tate = tate.T

ans = -10000
for h in range(H):
    for w in range(W):
        ans = max(ans, tate[w][h] + yoko[w][h] - 1)
print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
grid = []
for _ in range(H):
    grid.append([s for s in input()])
    
left = [[0 for _ in range(W)] for _ in range(H)]
right = [[0 for _ in range(W)] for _ in range(H)]
up = [[0 for _ in range(W)] for _ in range(H)]
down = [[0 for _ in range(W)] for _ in range(H)]

for h in range(H):
    for w in range(W):
        if grid[h][w] == ".":
            if w == 0:
                left[h][w] = 1
            else:
                left[h][w] += left[h][w - 1] + 1

for h in range(H):
    for w in range(W)[::-1]:
        if grid[h][w] == ".":
            if w == W - 1:
                right[h][w] = 1
            else:
                right[h][w] += right[h][w + 1] + 1
            
for w in range(W):
    for h in range(H):
        if grid[h][w] == ".":
            if h == 0:
                up[h][w] = 1
            else:
                up[h][w] += up[h - 1][w] + 1
                
for w in range(W):
    for h in range(H)[::-1]:
        if grid[h][w] == ".":
            if h == H - 1:
                down[h][w] = 1
            else:
                down[h][w] += down[h + 1][w] + 1
                
ans = -10000
for h in range(H):
    for w in range(W):
        ans = max(ans, up[h][w] + down[h][w] + right[h][w] + left[h][w] - 3)
print(ans)
def getlist():
	return list(map(int, input().split()))

N, M = getlist()
S = getlist()
T = getlist()

L = [[1 for i in range(N + 1)] for j in range(M + 1)]
for i in range(1, N + 1):
	for j in range(1, M + 1):
		if S[i - 1] == T[j - 1]:
			L[j][i] = max(L[j - 1][i - 1] * 2, L[j - 1][i] + L[j][i - 1]) % 1000000007
		else:
			L[j][i] = (L[j - 1][i] + L[j][i - 1] - L[j - 1][i - 1])

print(L[M][N] %  % 1000000007)

### FIXED CODE ###

def getlist():
	return list(map(int, input().split()))

N, M = getlist()
S = getlist()
T = getlist()

L = [[1 for i in range(N + 1)] for j in range(M + 1)]
for i in range(1, N + 1):
	for j in range(1, M + 1):
		if S[i - 1] == T[j - 1]:
			L[j][i] = (L[j - 1][i] + L[j][i - 1]) % 1000000007
		else:
			L[j][i] = (L[j - 1][i] + L[j][i - 1] - L[j - 1][i - 1]) % 1000000007

print(L[M][N] % 1000000007)
import sys
from collections import deque


dx_list = [1, 0, -1, 0]
dy_list = [0, -1, 0, 1]
def bfs(h_len, w_len):
    max_cnt = 0
    while len(bfs_q)>0:
        u_list = bfs_q.popleft()
        h, w, cnt = u_list[0], u_list[1], u_list[2]
        max_cnt = max(max_cnt, cnt)
        for dx, dy in zip(dx_list, dy_list):
            x = w + dx
            y = h + dy
            if 0 <= x < w_len and 0 <= y < h_len and m[y][x] == 0:
                m[y][x] = 1
                bfs_q.append([y, x, cnt+1])
    return max_cnt


if __name__ == "__main__":
    input = sys.stdin.readline
    h_len, w_len = map(int, input().split())
    m = [[0]*h_len for _ in range(w_len)]
    a_list = []
    for _ in range(h_len):
        s = input()[:-1]
        a_list.append(s)
    bfs_q = deque([])
    for h, w_list in enumerate(a_list):
        for w, a in enumerate(w_list):
    	    if a == '#':
    		    m[h][w] = 1
    		    bfs_q.append([h, w, 0])
    ans = bfs(h_len, w_len)
    print(ans)
	

### FIXED CODE ###

def bfs(q_list):
    cnt = -1
    while q_list:
        cnt += 1
        new_q_list = []
        for h, w in q_list:
            if not m_list[h][w+1]:
                m_list[h][w+1] = True
                new_q_list.append((h, w+1))
            if not m_list[h+1][w]:
                m_list[h+1][w] = True
                new_q_list.append((h+1, w))
            if not m_list[h][w-1]:
                m_list[h][w-1] = True
                new_q_list.append((h, w-1))
            if not m_list[h-1][w]:
                m_list[h-1][w] = True
                new_q_list.append((h-1, w))
        q_list = new_q_list
    print(cnt)


if __name__ == "__main__":
    h_len, w_len = map(int, input().split())
    m_list = [[True for _ in range(w_len+2)]]
    for _ in range(h_len):
        m_list.append([True] + [s=='#' for s in input()] + [True])
    m_list.append([True for _ in range(w_len+2)])
    q_list = []
    for h in range(1, h_len+1):
        for w in range(1, w_len+1):
            if m_list[h][w]:
                q_list.append((h, w))
    bfs(q_list)
from itertools import permutations
n,m,r=map(int,input().split())
visit=list(map(int,input().split()))
dist=[[10**9]*n for i in range(n)]
for i in range(m):
  a,b,c=map(int,input().split())
  dist[a-1][b-1],dist[b-1][a-1]=c,c
for i in range(n):
  dist[i-1][i-1]=0
for i in range(n):
  for j in range(n):
    for k in range(n):
      dist[j][k]=min(dist[j][i]+dist[i][k])
ans=10**9
check=permutations(visit)
for i in check:
  c=0
  for j in range(r-1):
    c+=dist[i[j]][i[j+1]]
  if c<ans:ans=c
print(ans)

### FIXED CODE ###

from itertools import permutations
n,m,r=map(int,input().split())
visit=list(map(int,input().split()))
dist=[[10**9]*n for i in range(n)]
for i in range(m):
  a,b,c=map(int,input().split())
  dist[a-1][b-1],dist[b-1][a-1]=c,c
for i in range(n):
  dist[i-1][i-1]=0
for i in range(n):
  for j in range(n):
    for k in range(n):
      dist[j][k]=min(dist[j][k],dist[j][i]+dist[i][k])
ans=10**9
check=permutations(visit)
for i in check:
  c=0
  for j in range(1,r):
    c+=dist[i[j-1]-1][i[j]-1]
  if c<ans:ans=c
print(ans)
N = int(input())
A = list(map(int,input().split()))
A.sort()
c = Counter(A)
lst = [1] * (10**6+1)
res = 0

for i,a in enumerate(A):
  if lst[a] == 0: continue
  if i==N-1 or A[i+1] != a:
    res += 1
  for j in range(a, 10**6+1, a):
    lst[j] = 0

print(res)

### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int,input().split()))
A.sort()
c = Counter(A)
lst = [1] * (10**6+1)
res = 0

for i,a in enumerate(A):
  if lst[a] == 0: continue
  if i==N-1 or A[i+1] != a:
    res += 1
  for j in range(a, 10**6+1, a):
    lst[j] = 0

print(res)
import numpy as np

N, A, B = map(int, input().split())
H = np.zeros(shape=N, dtype='int64')
for _ in range(N):
    h = int(input())
    H[_] = h


def calc(num, a):
    a -= num * B
    a = (a - 1)//(A - B) + 1
    if sum(a[a > 0]) <= num:
        return True
    else:
        return False


start = 0
end = 10 ** 10

while end - start > 1:
    mid = (start + end) // 2
    if calc(mid, H.copy()):
        end = mid
    else:
        start = mid

print(end)


### FIXED CODE ###

import numpy as np

N, A, B = map(int, input().split())
H = np.zeros(shape=N, dtype='int64')
for _ in range(N):
    h = int(input())
    H[_] = h


def calc(num, a):
    a -= num * B
    a = (a - 1)//(A - B) + 1
    if sum(a[a > 0]) <= num:
        return True
    else:
        return False


start = 0
end = 10 ** 10

while end - start > 1:
    mid = (start + end) // 2
    if calc(mid, H.copy()):
        end = mid
    else:
        start = mid

print(end)
n,m,k = map(int, input().split())
ab = list(map(int, input().split())) + list(map(int, input().split()))
O = 0
ab.sort()
for i in range(len(ab)):
    k -= ab[i]
    if k < 0:
        break
    O +=1
print(O)


### FIXED CODE ###

a = int(input())

a = a + a**2 + a**3
print(a)
x, a, b = map(int, input().split())

if abs(x - a) < abs(x - b):
    print(A)
else:
    print(B)


### FIXED CODE ###

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

if abs(x - a) < abs(x - b):
    print("A")
else:
    print("B")