Harryxun/stf_run huggingface dataset:
import numpy as np
N , M = map(int,input().split())
A = list(map(int,input().split()))
B_C = []
C = []
for i in range(M):
	B_C.append(list(map(int,input().split())))
B_C =np.array(B_C,dtype = np.int64)
B_C = B_C[np.argsort(B_C[:,1])]
not_change = N
A.sort()
A = np.array(A,dtype = np.int64)
k = M - 1
sum_num = 0
judge = 0 
while judge == 0:
	if not_change >= B_C[k][0]:
		if A[N - not_change] < B_C[k][1]:
			if A[N - not_change  + B_C[k][0]] < B_C[k][1]:
				sum_num += B_C[k][1] * B_C[k][0]
				not_change -= B_C[k][0]
				if not_change == 0:
					judge = 1
			else:
				while A[N - not_change] < B_C[k][1]:
					sum_num += B_C[k][1]
					not_change -= 1
				judge = 1
		else:
			judge = 1
	else:
		if A[N - not_change] < B_C[k][1]:
			if A[N-1] < B_C[k][1]:
				sum_num += B_C[k][1] * not_change
				not_change = 0
				judge = 1
			else:
				while A[N - not_change] < B_C[k][1]:
					sum_num += B_C[k][1]
					not_change -= 1
				judge = 1
		else:
			judge = 1
	k -= 1
	if k == -1:
		judge = 1


if not_change == 0:
	print(sum_num)
else:
	print(A[N-not_change:N].sum() + sum_num)
	
	


### FIXED CODE ###

import numpy as np
N , M = map(int,input().split())
A = list(map(int,input().split()))
B_C = []
C = []
for i in range(M):
	B_C.append(list(map(int,input().split())))
B_C =np.array(B_C,dtype = np.int64)
B_C = B_C[np.argsort(B_C[:,1])]
not_change = N
A.sort()
A = np.array(A,dtype = np.int64)
k = M - 1
sum_num = 0
judge = 0 
while judge == 0:
	if not_change > B_C[k][0]:
		if A[N - not_change] < B_C[k][1]:
			if A[N - not_change  + B_C[k][0]] < B_C[k][1]:
				sum_num += B_C[k][1] * B_C[k][0]
				not_change -= B_C[k][0]
				if not_change == 0:
					judge = 1
			else:
				while A[N - not_change] < B_C[k][1]:
					sum_num += B_C[k][1]
					not_change -= 1
				judge = 1
		else:
			judge = 1
	else:
		if A[N - not_change] < B_C[k][1]:
			if A[N-1] < B_C[k][1]:
				sum_num += B_C[k][1] * not_change
				not_change = 0
				judge = 1
			else:
				while A[N - not_change] < B_C[k][1]:
					sum_num += B_C[k][1]
					not_change -= 1
				judge = 1
		else:
			judge = 1
	k -= 1
	if k == -1:
		judge = 1


if not_change == 0:
	print(sum_num)
else:
	print(A[N-not_change:N].sum() + sum_num)
n = raw_input()
nums = map(int, raw_input().split()).reverse()
print " ".join(map(str, nums))

### FIXED CODE ###

n = raw_input()
nums = map(int, raw_input().split())
nums.reverse()
print " ".join(map(str, nums))
n = int(input())
a = list(map(int, input().split()))


def cal(n):
    result = 0
    totyu = 1
    for _ in range(n-1):
        if a[totyu] % 2 !=0:
            result += 1
            totyu += 2
        else :
            totyu += 2
    return result

if n % 2 == 0:
    n /= 2
else:
    n = n//2 +1 

print(cal(n))

### FIXED CODE ###

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

result = 0

for i in range(n):
    if (i+1) % 2 != 0 and a[i] % 2 != 0:
        result +=1
print(result)
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)].sort()

time=T[0]
count = 1
ans = 0

for i in range(1,N):
  if T[i]-time>K or count==C:
    time = T[i]
    count = 1
    ans += 1
  else:
    count += 1
if count>0:
  ans += 1
print(ans)
  


### FIXED CODE ###

N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T.sort()

time=T[0]
count = 1
ans = 0

for i in range(1,N):
  if T[i]-time>K or count==C:
    time = T[i]
    count = 1
    ans += 1
  else:
    count += 1
if count>0:
  ans += 1
print(ans)
import statistics
import math

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

B = []
C = []
D = []
E = []
ureshimi = []
k = 0
l = 0

sumA = sum(A)
sumBC = sum(A[0:2])
sumDE = sum(A) - sumBC

s = 0
mannnaka = 0

for i in range(N-2):
    s += A[i]
    if i == N - 3:
        mannnaka = N - 3
    elif s + A[i + 1] > sumA / 2:
        mannnaka = i
        break



saisho = max(0, mannnaka - 7)
saigo = min(N - 4, mannnaka + 5)

sumBC = sum(A[0:saisho + 2])
sumDE = sum(A) - sumBC


for i in range(saisho, saigo):
    BC = A[0 : i + 2]
    s = sum(A[0 : k])
    for j in range(k, i + 2):
        s += BC[j]
        if j == i + 1:
            k = j 
            B = BC[0 : j ]
            C = BC[j  : N - i]
            break
        elif s + BC[j + 1] > sumBC / 2:
            k = j
            if BC[j + 1] / 2 >= sumBC / 2 - s:
                B = BC[0 : j + 1]
                C = BC[j + 1 : i + 2]
            else:
                B = BC[0 : j + 2]
                C = BC[j + 2 : i + 2]
            break
    sumBC += A[i + 2]
    DE = A[i + 2 : N + 1]
    s = sum(DE[0:l - i + 1 ])
    for j in range(l - i + 1 , N - i - 2):
        if j == N - i - 3:
            l = j + i 
            D = DE[0 : j ]
            E = DE[j  : N - i]
            break
        elif s + DE[j ] > sumDE / 2:
            l = j + i
            if DE[j ] / 2 >= sumDE / 2 - s:
                D = DE[0 : j ]
                E = DE[j : N - i]
            else:
                D = DE[0 : j + 1]
                E = DE[j + 1 : N - i]
            break
        s += DE[j]
    sumDE -= A[i + 2]

    ureshimi.append(max(sum(B), sum(C), sum(D), sum(E)) - min(sum(B), sum(C), sum(D), sum(E)))



print(min(ureshimi))

### FIXED CODE ###

import statistics
import math

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


ureshimi = []
k = 0
l = 2

B = 0
C = 0
D = 0
E = 0

sumBC = sum(A[0:2])
sumDE = sum(A) - sumBC

for i in range(2, N - 1):
    for j in range(k, i):
        if j == i - 1:
            k = j
            C = sumBC - B
            break
        elif B + A[j] >= sumBC / 2:
            if sumBC / 2 - B  > A[j] / 2:
                B += A[j]
                k = j + 1
                C = sumBC - B
                break
            else:
                k = j
                C = sumBC - B
                break
        B += A[j]
    for j in range(l, N):
        if j == N - 1:
            l = j
            E = sumDE - D
            break
        elif D + A[j] >= sumDE / 2:
            if sumDE / 2 - D > A[j] / 2:
                D += A[j]
                l = j + 1
                E = sumDE - D
                break
            else:
                l = j
                E = sumDE - D
                break
        D += A[j]
    ureshimi.append(max([B, C, D, E]) - min([B, C, D, E]))
    sumBC += A[i]
    sumDE -= A[i]
    D -= A[i]
        

print(min(ureshimi))
#ABC102C
N=int(input())
A=list(map(int, input().split()))
B=[0]*N
b=0
ans=0
for i in range(N):
    B[i]=A[i]-(i+1)
B_sorted=sorted(B)
if N%2==0:
    b=(B[N/2]+B[N/2-1])//2
else:
    b=(B[N//2])
for i in range(N):
    ans+=abs(A[i]-(b+i+1))
print(int(ans))

### FIXED CODE ###

#ABC102C
N=int(input())
A=list(map(int, input().split()))
B=[0]*N
b=0
ans=0
for i in range(N):
    B[i]=A[i]-(i+1)
B_sorted=sorted(B)
if N%2==0:
    b=(B_sorted[int(N/2)]+B_sorted[int(N/2-1)])//2
else:
    b=(B_sorted[N//2])
for i in range(N):
    ans+=abs(A[i]-(b+i+1))
print(int(ans))
N, Y = map(int,input().split())
for i in range(N+1):
  for j in range(N+1):
    if Y == 10000*i + 5000*j + 1000*(N-i-j):
      print(i," ",j," ",k)
      break
  else:
    continue
  break
else:
  print("-1 -1 -1")

### FIXED CODE ###

N, Y = map(int,input().split())
for i in range(N+1):
  for j in range(N+1):
    if Y == 10000*i + 5000*j + 1000*(N-i-j) and N-i-j >= 0:
      print(i," ",j," ",N-i-j)
      break
  else:
    continue
  break
else:
  print("-1 -1 -1")
s = list(input())
k = int(input())
S = s
cnt = 0
cnt_2 = 0
flow = 0
flow_2 = 0


for i in range(len(s)):
    if s[flow] == s[flow+1]:
        cnt += 1
        flow += 2
    else:
        flow += 1

    if flow >= len(s):
        break
# --------------------------

for i in range(len(s)):
    S.append(s[i])

for i in range(len(S)):
    if S[flow_2] == S[flow_2+1]:
        cnt_2 += 1
        flow_2 += 2
    else:
        flow_2 += 1

    if flow_2 >= len(S):
        break

if k == 1:
    print(cnt)
else:
    print(cnt + (cnt_2 - cnt) * (k-1))

    

### FIXED CODE ###

s = list(input())
k = int(input())
S = s.copy()
S_3 =s.copy()
cnt = 0
cnt_2 = 0
cnt_3 = 0


for i in range(1, len(s)):
    if s[i-1] == s[i]:
        cnt += 1
        s[i] = "A"

# --------------------------

for i in range(len(s)):
    S.append(S[i])

for i in range(1, len(S)):
    if S[i-1] == S[i]:
        cnt_2 += 1
        S[i] = "A"

# if k == 1:
#     print(cnt)
# else:
#     print(cnt + (cnt_2 - cnt) * (k-1))

# ---------------------------------------

for i in range(len(S)):
    S_3.append(S_3[i])

for i in range(1, len(S_3)):
    if S_3[i-1] == S_3[i]:
        cnt_3 += 1
        S_3[i] = "A"

# --------------------------------------

if k == 1:
    print(cnt)
elif k == 2:
    print(cnt_2)
elif k == 3:
    print(cnt_3)
elif cnt_2 - cnt == cnt_3 - cnt_2:
    print(cnt + (cnt_2 - cnt) * (k-1))
else:
    if k % 2 == 0:
        print(int(cnt + (cnt_2 - cnt) * (k / 2) + (cnt_3 - cnt_2) * (k / 2 - 1)))
    else:
        print(int(cnt + (cnt_2 - cnt) * ((k - 1) / 2) + (cnt_3 - cnt_2) * ((k - 1) / 2)))
n,q = map(int,input().split())
s = input()
anslist = []
anslist2 = [0]*q
for i in range(n):
  if s[i] == 'A' and s[i+1] == 'C':
    anslist.append([i+1,i+2])
for i in range(q):
  l,r = map(int,input().split())
  cnt = 0
  for j in range(len(anslist)):
    if l <= anslist[j][0] and anslist[j][1] <= r:
      cnt += 1
  anslist2[i] = cnt
for i in range(q):
  print(anslist2[i])


### FIXED CODE ###

n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split()))for i in range(q)]

a = [0]*n
p = 0
for i in range(1,n):
    if s[i-1] == 'A' and s[i] == 'C':
        p += 1
    a[i] = p
ans = []
for i in range(q):
    ans.append(a[lr[i][1]-1]-a[lr[i][0]-1])
for i in range(q):
    print(ans[i])
# coding: utf-8

line = raw_input()
result = ''
for s in line:
    if s.isalpha():
        if s.isupper():
            result += s.lower()
        else:
            result += s.upper()
    else:
       print result += s

print result

### FIXED CODE ###

# coding: utf-8

line = raw_input()
print ''.join([((s.lower() if s.isupper() else s.upper()) if s.isalpha() else s) for s in line])
k = int(input())
a,b = map(int,input().split())
ans = 0
for i in range(a//k,b//k+1):
  if a <= k * i <= b:
    ans = 1
if ans = 1:
  print('OK')
else:
  print('NG')

### FIXED CODE ###

k = int(input())
a,b = map(int,input().split())
ans = 0
for i in range(a//k,b//k+1):
  if a <= k * i <= b:
    ans = 1
if ans == 1:
  print('OK')
else:
  print('NG')
import numpy as np

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

if((a>c or b>c or (a+b)>c):
	print('No')
elif((a+b+(np.sqrt(a*b)*2)) < c):
	print('Yes')
else:
	print('No')


### FIXED CODE ###

import numpy as np
import decimal

a, b, c = map(decimal.Decimal, input().split())

if((a+b+(np.sqrt(a)*np.sqrt(b)*2)) < c):
	print('Yes')
else:
	print('No')
import numpy as np

H,W,M=map(int,input().split())
hw = np.zeros([H,W],dtype=int)
for i in range(M):
  h,w=map(int,input().split())
  hw[h-1,w-1] = 1

sum1 = hw.sum(1)
sum2 = hw.sum(0)

sum1 = sorted(enumerate(sum1),key=lambda x:x[1],reverse=True)
sum2 = sorted(enumerate(sum2),key=lambda x:x[1],reverse=True)

ans=0
for idx1,val1 in sum1[:min(3,len(sum1))]:
  for idx2,val2 in sum2:
    tmp = val1+val2-hw[idx1,idx2]
    ans = max(ans,tmp)
    
print(ans)

### FIXED CODE ###

from collections import defaultdict

H,W,M=map(int,input().split())
hw = defaultdict(int)
sum1=[0]*H
sum2=[0]*W
for i in range(M):
  h,w=map(int,input().split())
  hw[(h-1,w-1)] += 1
  sum1[h-1] += 1
  sum2[w-1] += 1

sum1 = sorted(enumerate(sum1),key=lambda x:x[1],reverse=True)
sum2 = sorted(enumerate(sum2),key=lambda x:x[1],reverse=True)

max1,max2=set([sum1[0][0]]),set([sum2[0][0]])
for i in range(1,H):
  if sum1[i][1]<sum1[0][1]:
    break
  else:
    max1.add(sum1[i][0])
    
for i in range(1,W):
  if sum2[i][1]<sum2[0][1]:
    break
  else:
    max2.add(sum2[i][0])

ans = sum1[0][1]+sum2[0][1]
count=0
for k in hw.keys():
  h,w=k
  if h in max1 and w in max2:
    count += 1
    
if count < len(max1)*len(max2):
  print(ans)
else:
  print(ans-1)
x=int(input())
for i in range(-1000,1000):
  for j in range(-1000,1000):
    if i**5-j**5==x:
      print(i,j)
      exit()

### FIXED CODE ###

s=input()
if s=="ABC":
  print("ARC")
else:
  print("ABC")
def A(w, v, n,V):
    mem=[0 for i in range(V+1)]
    if n == 0 or V == 0:
        return 0
 
    for i in range(n):
        for j in range(V,w[i]-1,-1):
            mem[j] = max(mem[j], v[i]+ mem[j - w[i]])
    return mem[V]
n,V=input().split()
n,V=int(n),int(V)
 
w=[0]*n
v=[0]*n
for i in range(n):
  x,y=input().split()
  w[i],v[i]=int(x),int(y)
 
print(A(w,v,n,V))

### FIXED CODE ###

def fragOptimalJump(h,n):
    dp=[0]*(n+1)
    dp[2]=abs(h[1]-h[2])
    for i in range(3,n+1):
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
    return dp[n]
  
N=int(input())
read = [int(n) for n in input().split()]
H=[0]+read
print(fragOptimalJump(H,N))
a, b, c = map(int, input().split())
if a + b + 1 >= c:
    c = b + c
    
elif a + b > c:
    c = a + b  + 1 + b
input(c)    
  

### FIXED CODE ###

a, b, c = map(int, input().split())
if c <= a+b:
    print(b+c)
else:
    print(2*b+a+1)
from functools import reduce
from fractions import gcd
import numpy as np

MOD = 10**9+7

def main():
    N = int(input())
    a = [int(i) for i in input().split()]
    A = np.array(a)

    lcm = np.lcm.reduce(A)
    B = lcm // A

    print(np.sum(B) % MOD)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from functools import reduce
from fractions import gcd

MOD = 10**9+7

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def main():
    N = int(input())
    a = [int(i) for i in input().split()]

    lcm = reduce(lcm_base, a, 1)
    
    ans = 0
    for i in a:
        ans += lcm // i

    print(ans % MOD)


if __name__ == "__main__":
    main()
import sys

h,w = [int(i) for i in input().split()]

sys.setrecursionlimit(100000)

s = [['#']*(w+2)] + [['#']+list(input())+['#'] for _ in range(h)] + [['#']*(w+2)]
#print(s)

cost = [[-1 if s[y][x] == '#' else float('inf') for x in range(w+2)] for y in range(h+2)]
cost[1][1] = 0
#print(cost)

move_que = [[1,1]]

def list_flatten(nested_list):
  flat_list = []
  fringe = [nested_list]
  
  while len(fringe) > 0:
    node = fringe.pop(0)
    if isinstance(node, list):
      fringe = node + fringe
    else:
      flat_list.append(node)

  return(flat_list)
      
def move(place):
  y,x = place
  if cost[y+1][x] != -1 or cost[y+1][x] != float('inf'):
      cost[y+1][x] = cost[y][x]+1
      move_que.append([y+1,x])       
      
  if cost[y-1][x] != -1 or cost[y-1][x] != float('inf'):
      cost[y-1][x] = cost[y][x]+1
      move_que.append([y-1,x])
  
  if cost[y][x+1] != -1 or cost[y][x+1] != float('inf'):
      cost[y][x+1] = cost[y][x]+1
      move_que.append([y,x+1])
  
  if cost[y][x-1] != -1 or cost[y][x-1] != float('inf'):
      cost[y][x-1] = cost[y][x]+1
      move_que.append([y,x-1])
  
while len(move_que) != 0:
  move(move_que[0])
  move_que = move_que[1:]

#print(cost)

if cost[h][w] == float('inf'):
  print(-1)
else:
  while_num = list_flatten(s).count('.')
  print(while_num - (cost[h][w]+1))


### FIXED CODE ###

import sys

h,w = [int(i) for i in input().split()]

sys.setrecursionlimit(100000)

s = [['#']*(w+2)] + [['#']+list(input())+['#'] for _ in range(h)] + [['#']*(w+2)]
#print(s)

cost = [[-1 if s[y][x] == '#' else float('inf') for x in range(w+2)] for y in range(h+2)]
cost[1][1] = 0
#print(cost)

def list_flatten(nested_list):
  flat_list = []
  fringe = [nested_list]
  
  while len(fringe) > 0:
    node = fringe.pop(0)
    if isinstance(node, list):
      fringe = node + fringe
    else:
      flat_list.append(node)

  return(flat_list)
      
def move(y,x):
  if cost[y+1][x] != -1:
    if cost[y+1][x] > cost[y][x]+1:
      cost[y+1][x] = cost[y][x]+1
      move(y+1,x)
      
  if cost[y-1][x] != -1:
    if cost[y-1][x] > cost[y][x]+1:
      cost[y-1][x] = cost[y][x]+1
      move(y-1,x)
  
  if cost[y][x+1] != -1:
    if cost[y][x+1] > cost[y][x]+1:
      cost[y][x+1] = cost[y][x]+1
      move(y,x+1)
  
  if cost[y][x-1] != -1:
    if cost[y][x-1] > cost[y][x]+1:
      cost[y][x-1] = cost[y][x]+1
      move(y,x-1)
  

move(1,1)

#print(cost)

if cost[h][w] == float('inf'):
  print(-1)
else:
  while_num = list_flatten(s).count('.')
  print(while_num - (cost[h][w]+1))
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
for i in range(max(a) + k +1):
  s = [x % i for x in a]
  if sum(s) % i == 0:
    print(i)
    break
    


### FIXED CODE ###

n, k = map(int, input().split())
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)

    # divisors.sort()
    return divisors

ans = 1

for div in make_divisors(sum(a)):
    mod_div = []
    for ai in a:
        mod_div.append(ai % div)
    mod_div.sort()

    tmp_p = n * div - sum(mod_div)
    tmp_m = 0

    for i, x in enumerate(mod_div):
        tmp_m += x
        tmp_p -= div - x
        if tmp_m == tmp_p and tmp_m <= k:
            ans = max(div, ans)

print(ans)
N, Q = map(int, input().split())
S = input()
AC = []
ans = []
AC.append(0)
for i in range(1,N+1):
    if S[i - 1] == "A" and S[i] == "C":
        AC.append(AC[i - 1] + 1)
    else:
        AC.append(AC[i - 1])
for _ in range(Q):
    l, r = map(int, input().split())
    ans.append(AC[r - 1] - AC[l - 1])
print("\n".join(map(str,ans)))

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
AC = []
ans = []
AC.append(0)
for i in range(1,N):
    if S[i - 1] == "A" and S[i] == "C":
        AC.append(AC[i - 1] + 1)
    else:
        AC.append(AC[i - 1])
for _ in range(Q):
    l, r = map(int, input().split())
    ans.append(AC[r - 1] - AC[l - 1])
print("\n".join(map(str,ans)))
if max(A, C) < min(B, D):
    print(min(B, D) - max(A, C))
else:
    print(0)

### FIXED CODE ###

A, B, C, D = map(int, input().split())
if A < C and B < D:
    print(max(0, B - C))
elif C <= A and B < D:
    print(max(0, B - A))
elif A < C and D <= B:
    print(max(0, D - C))
else:
    print(max(0, D - A))
a = int(input())
s  = input()
if n >= 3200:
  print(s)
else:
  print('red')

### FIXED CODE ###

a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print('red')
if float(c) - float(a+b)+2*(math.sqrt(a*b) > 0) :
  print ("Yes")
else :
  print ("No")


### FIXED CODE ###

# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
#import numpy as np
from decimal import *
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())

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

if (c-a-b)**2 > 4*a*b and (c-a-b) > 0:
  print ("Yes")
else :
  print ("No")
s=input()
print(700+100*lsit(s).count('o'))

### FIXED CODE ###

s=input()
print(700+100*list(s).count('o'))
import math
a,b = map(int,input().split())
def lcm(x, y):
    return int((x * y) / math.gcd(x, y))

print(lcm(a, b))

### FIXED CODE ###

import fractions
a,b = map(int,input().split())
print(int((a * b) / fractions.gcd(a, b)))
n = int(input())
if n = len(set(input().split())):
    print('YES')
else:
    print('NO')

### FIXED CODE ###

n = int(input())
if n == len(set(input().split())):
    print('YES')
else:
    print('NO')
import math
N = int(input())
print(math.factorial(N)%(10**9+7)

### FIXED CODE ###

import math
N = int(input())
print(math.factorial(N)%(10**9+7))
def hex(x , y):

    ans = ""

    if int(x, 16) < int(y, 16):
        ans = "<"
    elif int(x, 16) > int(y, 16):
        ans = ">"
    else:
        ans = "="

    return ans

def main():
    x , y = map(int , input().split())
    print(hex(x , y))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def hex(x , y):

    ans = ""

    if int(x, 16) < int(y, 16):
        ans = "<"
    elif int(x, 16) > int(y, 16):
        ans = ">"
    else:
        ans = "="

    return ans

def main():
    x , y = map(str , input().split())
    print(hex(x , y))

if __name__ == '__main__':
    main()
import sys
sys.setrecursionlimit(1000000)
 
N,K = map(int,input().split())
a = list(map(int,input().split()))

b = []
b.append(0)

now = 0

for i in range(N):
    now = now + a[i]
    b.append(now)
    
ans = 0
#cur = N

for i in range(N):
    for j in range(i,N+1):
        if N - j < 0:
            break
        if K <= b[N-i] - b[N-j]:
            ans += N - j + 1
            #print(ans)
            break
        else:
            #cur = cur - j
            continue
            
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
 
X,A = map(int,input().split())

if X < A:
    print(0)
else:
    print(10)
#!/usr/bin/env python
# coding: utf-8

# In[29]:


def func():
    N,Q = map(int, input().split())
    ab = []
    nodes = {}
    for _ in range(N-1):
        ab.append(list(map(int, input().split())))
    ab = sorted(ab,key=lambda x:x[0])
    graph = {}
    for a,b in ab:
        if a not in graph:
            graph[a] = [b]
        else:
            graph[a].append(b)
    cnt = [0]*N
    for j in range(Q):
        p,x = map(int, input().split())
        calc(graph,p,cnt,x)
    print(*cnt)


# In[30]:


def calc(graph,node,cnt,x):
    cnt[node-1] += x
    if node in graph:
        for n in graph[node]:
            calc(graph,n,cnt,x)
    return cnt


# In[31]:


if __name__ == "__main__":
    func()


# In[ ]:






### FIXED CODE ###

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

# In[32]:


from collections import deque


# In[37]:


def func():
    N,Q = map(int, input().split())
    graph = [[] for _ in range(N)]
    for _ in range(N-1):
        a,b = map(int, input().split())
        a,b = a-1,b-1
        graph[a].append(b)
        graph[b].append(a)
    cnt = [0]*N
    for j in range(Q):
        p,x = map(int, input().split())
        cnt[p-1] += x
    q = deque([[0,-1,cnt[0]]])
    d = [-1]*N
    while q:
        cur,fr,p = q.popleft()
        d[cur] = p
        for nex in graph[cur]:
            if nex == fr:
                continue
            q.append([nex,cur,p+cnt[nex]])
    ans = []
    for i in range(N):
        ans.append(d[i])
    print(*ans)


# In[38]:


if __name__ == "__main__":
    func()


# In[ ]:
num = []
while True:
    m,f,r = map(int, raw_input().split())
    if m = -1:
        m = 0
    if f = -1:
        f = 0

    ans = m + f
    if m == f == r == -1:
        break

    if ans >= 80:
        num.append("A")
    elif (65 <= ans) and (ans < 80):
        num.append("B")
    elif (50 <= ans) and (ans < 65):
        num.append("C")
    elif (30 <= ans) and (ans < 50):
        if r >= 50:
            num.append("C")
    else:
        num.append("F")

for i in range(len(num)):
    print num[i]

### FIXED CODE ###

num = []
while True:
    m,f,r = map(int, raw_input().split())

    ans = m + f
    if m == f == r == -1:
        break
    if (m == -1) or (f == -1):
        num.append("F")
    elif ans >= 80:
        num.append("A")
    elif (65 <= ans) and (ans < 80):
        num.append("B")
    elif (50 <= ans) and (ans < 65):
        num.append("C")
    elif (30 <= ans) and (ans < 50):
        if r >= 50:
            num.append("C")
        else:
            num.append("D")
    else:
        num.append("F")

for i in range(len(num)):
    print num[i]
a,b = map(int, input().split())

if a <= 5:
  print(0)
elif 6 <= a and a <= 12:
  print(b/2)
elif 13 <= a:
  print(b)

### FIXED CODE ###

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

if a <= 5:
  print(0)
elif 6 <= a and a <= 12:
  print(int(b/2))
elif 13 <= a:
  print(b)
def training(n):
    if n==1:
        return 1
    else:
        x=training(n-1)*n
        return x%mod
import sys
sys.setrecursionlimit(n+1)
n=int(input())
mod=10**9+7
print(training(n))

### FIXED CODE ###

n=int(input())
import math 
print(math.factorial(n)%((10**9)+7))
import difflib;print(difflib.SequenceMatcher(None,'CODEFESTIVAL2016',input())*100//16)

### FIXED CODE ###

s=list('CODEFESTIVAL2016');t=list(input());print(sum([1 for i in range(16) if s[i]!=t[i]]))