Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
input = sys.stdin.readline
h, w = [int(x) for x in input().strip().split()]
m = [[0 for _ in range(w)] for _ in range(h)]
for hi in range(h):
    for wi, s in enumerate(input().strip()):
        m[hi][wi] = s

c = [[float('inf')] * (h*w) for _ in range(h*w)]
for i in range(h*w):
    c[i][i] = 0

for hi in range(h):
    for wi in range(w):
        #print(hi, wi)
        if m[hi][wi] == '#':
            continue
        for offset in [(0, 1), (-1, 0), (0, -1), (1, 0)]:
            if hi+offset[0] < 0 or hi+offset[0] == h:
                continue
            if wi+offset[1] < 0 or wi+offset[1] == w:
                continue
            if m[hi+offset[0]][wi+offset[1]] == '#':
                continue
            #print('offset = {}'.format(offset))
            #print('hi*w+wi = {}'.format(hi*w+wi), '(hi+offset[0])*w+(wi+offset[1]) = {}'.format((hi+offset[0])*w+(wi+offset[1])))
            c[hi*w+wi][(hi+offset[0])*w+(wi+offset[1])] = 1

#print('-- cost --')
#for ci in c:
#    print(ci)

for k in range(h*w):
    for i in range(h*w):
        for j in range(h*w):
            c[i][j] = min(c[i][j], c[i][k]+c[k][j])

ans = 0
#print('-- total cost --')
#for ci in c:
#    print(ci)

for ci in c:
    for cii in ci:
        if cii != 0 and cii != float('inf'):
            ans = max(ans, cii)

print(ans)

### FIXED CODE ###

import sys
from collections import deque
from copy import deepcopy

input = sys.stdin.readline
h, w = [int(x) for x in input().strip().split()]
m = [['#' for _ in range(w+2)] for _ in range(h+2)]
hs = []
ws = []
for hi in range(1, h+1):
    for wi, s in enumerate(input().strip(), start=1):
        m[hi][wi] = s
        if s == '.':
            hs.append(hi)
            ws.append(wi)

def bfs(hs, ws, m):
    cost = 0
    q = deque([])
    m[hs][ws] = '#'
    for offset in [(0, 1), (-1, 0), (0, -1), (1, 0)]:
        if m[hs+offset[0]][ws+offset[1]] == '.':
            q.append((hs+offset[0], ws+offset[1]))
    while q:
        cost += 1
        q_ = deque(q)
        q = deque([])
        for h, w in q_:
            m[h][w] = '#'
            for offset in [(0, 1), (-1, 0), (0, -1), (1, 0)]:
                if m[h+offset[0]][w+offset[1]] == '.':
                    m[h+offset[0]][w+offset[1]] = '#'
                    q.append((h+offset[0], w+offset[1]))

    return cost, h, w

maxi = -1
for hss, wss in zip(hs, ws):
    maxi_, hh, ww = bfs(hss, wss, deepcopy(m[:]))
    maxi = max(maxi, maxi_)

print(maxi)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
INF = float("inf")


def LCS(S, T):
    lenS, lenT = len(S), len(T)
    DP = [[[] for __ in range(lenT+1)] for _ in range(lenS+1)]
    for i in range(lenS):
        for j in range(lenT):
            if S[i] == T[j]:
                if len(DP[i+1][j+1]) < len(DP[i][j])+1:
                    DP[i+1][j+1] = DP[i][j]+[S[i]]
            if len(DP[i+1][j+1]) < len(DP[i+1][j]):
                DP[i+1][j+1] = DP[i+1][j]
            if len(DP[i+1][j+1]) < len(DP[i][j+1]):
                DP[i+1][j+1] = DP[i][j+1]
    return "".join(DP[-1][-1])


def solve(S: str, T: str):
    print(LCS(S, T))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    t = next(tokens)  # type: str
    solve(s, t)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(S: str, T: str):
    lenS, lenT = len(S), len(T)
    DP = [[0]*(lenT+1) for _ in range(lenS+1)]
    for i in range(lenS):
        for j in range(lenT):
            if S[i] == T[j]:
                DP[i+1][j+1] = max(DP[i][j]+1, DP[i+1][j+1])
            DP[i+1][j+1] = max(DP[i+1][j], DP[i][j+1], DP[i+1][j+1])

    ans = ""
    i, j = lenS, lenT
    while i > 0 and j > 0:
        if DP[i][j] == DP[i-1][j]:
            i -= 1
        elif DP[i][j] == DP[i][j-1]:
            j -= 1
        else:
            ans = S[i-1] + ans
            i -= 1
            j -= 1
    print(ans)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    t = next(tokens)  # type: str
    solve(s, t)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

X=input()
flg = True
while flg and len(X):
    flg = False
    for i in range(len(X)-1):
        if X[i]=='S' and X[i+1] =='T':
            if i<len(X)-1:
                X=X[:i]+X[i+2:]
            else:
                X=X[:i]
            flg = True
            break
print(len(X))

### FIXED CODE ###

X=input()
ans = []
for i in X:
    if i=='S':
        ans.append(i)
    elif i=='T' and (not ans or ans[-1] == 'T'):
        ans.append(i)
    else:
        ans.pop()
print(len(ans))
### BUGGY CODE ###

from heapq import heappush, heappop
from collections import deque
import re
import math
import functools
import itertools
import fractions

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29


def mk1d(n, val=INF):
    return [val for i in range(n)]

def mk2d(h, w, val=INF):
    return [[val for i in range(w)]for i in range(h)]

DIV = 998244353

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

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


def lcm(*numbers):
    return functools.reduce(lcm_base, numbers, 1)


def floyd_warshall(costs):
    N = len(costs)
    for k in range(N):
        for i in range(N):
            for j in range(N):
                costs[i][j] = min(costs[i][j], costs[i][k]+costs[k][j])
    return costs

def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)

def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b

def ncr(n, r, mod=DIV):
	r = min(r, n-r)
	ret = 1
	for i in range(1, r+1):
		ret = ret * (n-i+1) % mod
		ret = ret * mod_inv(i, mod) % mod
	return ret

def main():
    N,K = isRaw()
    As = isRaw()
    As.sort()
    dp = [0]*N
    dp[K-1] = As[K-1]-As[0]
    for n in range(K,N):
        dp[n] = dp[n-1]
        for idx in range(n-K+2):
            nCk = ncr(n-idx-1,K-2)
            dp[n] = (dp[n]+nCk*(As[n]-As[idx])+DIV)%DIV
    return dp[N-1]

if __name__ == "__main__":
    print(main())


### FIXED CODE ###


def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)

def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max,mod=DIV):
    fac,finv,inv = [0]*max, [0]*max, [0]*max
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod -inv[mod%i] * (mod//i)%mod
        finv[i] = finv[i-1]*inv[i]%mod
    class CONV:
        def __init__(self):
            pass
        def ncr(self,n,k):
            if(n<k):
                return 0
            if(n<0 or k<0 ):
                return 0
            return fac[n]*(finv[k]*finv[n-k]%mod)%mod
    return CONV()



def main():
    n,k = isRaw()
    As = list(isRaw())
    As.sort()
    ct = CONV_TBL(n)
    ans = 0

    for i in range(n):
        ans += As[i]*ct.ncr(i, k-1) - As[i]*ct.ncr(n-(i+1), k-1)
        ans = ans%DIV
    return ans

if __name__ == "__main__":
    print(main())
### BUGGY CODE ###

n = int(input())
a = [int(i) for i in input().split()]
b = []
for i in a:
    b.append(i)
    b.reverse()
print(*b)

### FIXED CODE ###

from collections import deque
n = int(input())
a = [int(i) for i in input().split()]
b = deque()
if n % 2 == 0:
    for i, j in enumerate(a):
        if (i + 1) % 2 == 0:
            b.appendleft(j)
        else:
            b.append(j)
else:
    for i, j in enumerate(a):
        if (i +1) % 2 == 0:
            b.append(j)
        else:
            b.appendleft(j)
print(*b)
### BUGGY CODE ###

import itertools
import collections
n = int(input())
a = [input() for i in range(n)]

p = itertools.combinations(a,2)
cnt = 0
for i,j in p:
	s = sorted(list(i))
	t = sorted(list(j))
	if s == t:
		cnt += 1
		#print (i,j)
print (cnt)

### FIXED CODE ###

n = int(input())
s = []
d = {}
for i in range(n):
	x = input()
	l = list(x)
	list.sort(l)
	ll = "".join(l)
	if ll in d:
		d[ll] += 1
	else:
		d[ll] = 1

ans = 0
for i in d:
	ss = d[i]
	if d[i] >= 2:
		ans += ss*(ss-1)/2
print (int(ans))
### BUGGY CODE ###

N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
list = A
list = sorted(list)
max = list[-1]
second_max = list[-2]
for i in range(N):
    if A[i] == max and A.count(max) == 1:
        print(second_max)
    else:
        print(max)

### FIXED CODE ###

N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
list = A
list = sorted(list)
max = list[-1]
second_max = list[-2]
cnt = A.count(max)
for i in range(N):
    if A[i] == max and  cnt == 1:
        print(second_max)
    else:
        print(max)
### BUGGY CODE ###

a, b , n= input().split() 
a = int(a)
b = int(b)
n = int(n)
if b > n :
    print(a*n//b)
else:
    max = 0
    for i in range(1,int(n)+1,1):
        r = (int(a)*i // int(b)) - (int(a)* (i//int(b)))
        if r > max:
            max = r

    print(max)


### FIXED CODE ###

a, b , n= input().split() 
a = int(a)
b = int(b)
n = int(n)
p = min(b,n)
if p % b ==0:
    print(int(a*(p-1)/b))
else:
    print(int(a*p/b))
### BUGGY CODE ###

N, M, Q = map(int, input().split())
ABCD = [tuple(map(int, input().split())) for _ in range(Q)]

stack = [i for i in range(1, M + 1)]

for i in range(N - 1):
    tmp = []
    while stack:
        now = stack.pop()
        start = now % 10
        for i in range(start, M + 1):
            tmp.append(now * 10 + i)
    stack = tmp

ans = 0
for tmp in stack:
    point = 0
    tmp1 = str(tmp)
    for a, b, c, d in ABCD:
        if int(tmp1[b - 1]) - int(tmp1[a - 1]) == c:
            point += d
    ans = max(ans, point)

print (ans)
# print (stack)

### FIXED CODE ###

import sys
input = sys.stdin.readline

from itertools import combinations_with_replacement

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

ABCD = [tuple(map(int, input().split())) for _ in range(Q)]

lst = [i for i in range(M)]

ans = 0
for tmp in combinations_with_replacement(lst, N):
    score = 0
    for a, b, c, d in ABCD:
        if tmp[b - 1] - tmp[a - 1] == c:
            score += d
    ans = max(ans, score)

print (ans)
### BUGGY CODE ###

from collections import defaultdict
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def root(par, x):
    if par[x] == x:
        return x
    else:
        return root(par, par[x])


def unite(rank, par, x, y):
    x = root(par, x)
    y = root(par, y)

    if x == y:
        return

    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1


def main():
    N, K, L = map(int, readline().split())
    m = map(int, read().split())
    pq = list(zip(m, m))
    pq, rs = pq[:K], pq[K:]

    d_c = defaultdict(list)
    d_t = defaultdict(list)

    par = list(range(N))
    rank = [0] * N
    for p, q in pq:
        p -= 1
        q -= 1
        unite(rank, par, p, q)

    par_t = list(range(N))
    rank_t = [0] * N
    for r, s in rs:
        r -= 1
        s -= 1
        unite(rank_t, par_t, r, s)

    for i in range(N):
        par[i] = root(par, i)
        par_t[i] = root(par_t, i)
        d_c[par[i]].append(i)
        d_t[par_t[i]].append(i)

    for i in range(N):
        d_c[i] = d_c[par[i]]
        d_t[i] = d_t[par_t[i]]

    cnt = [0] * N
    for i in range(N):
        cnt[i] = len(list(set(d_c[i]) & set(d_t[i])))

    print(*cnt)


main()


### FIXED CODE ###

from collections import defaultdict
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def root(par, x):
    if par[x] == x:
        return x
    else:
        return root(par, par[x])


def unite(rank, par, x, y):
    x = root(par, x)
    y = root(par, y)

    if x == y:
        return

    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1


def main():
    N, K, L = map(int, readline().split())
    m = map(int, read().split())
    pq = list(zip(m, m))
    pq, rs = pq[:K], pq[K:]

    par = list(range(N))
    rank = [0] * N
    for p, q in pq:
        p -= 1
        q -= 1
        unite(rank, par, p, q)

    par_t = list(range(N))
    rank_t = [0] * N
    for r, s in rs:
        r -= 1
        s -= 1
        unite(rank_t, par_t, r, s)

    pp = [(0, 0)]*N
    dd = defaultdict(list)
    for i in range(N):
        par[i] = root(par, i)
        par_t[i] = root(par_t, i)
        pp[i] = (par[i], par_t[i])
        dd[pp[i]].append(i)

    cnt = [0] * N
    for i in range(N):
        cnt[i] = len(dd[pp[i]])

    print(*cnt)


main()
### BUGGY CODE ###

num_of_candidate, start_point, num_of_questions = map(int, input().split())
winner_list = [int(input()) for i in range(num_of_questions)]

point_list = [start_point for i in range(num_of_candidate)]

for i in range(num_of_questions):
	winner_id = winner_list[i]
	for j in range(num_of_candidate):
		if j != winner_id - 1:
			point_list[j] -= 1

for i in range(num_of_candidate):
	if point_list[i] > 0:
		print("Yes")
	else:
		print("No")

### FIXED CODE ###

import numpy as np

num_of_candidate, start_point, num_of_questions = map(int, input().split())
# winner_list = [int(input()) for i in range(num_of_questions)]
if start_point > num_of_questions:
	for i in range(num_of_candidate):
		print("Yes")
	exit()


start_points = np.array([start_point for i in range(num_of_candidate)])

got_points = np.array([0 for i in range(num_of_candidate)])
for i in range(num_of_questions):
	winner_id = int(input())
	got_points[winner_id - 1] += 1

lost_points = np.array([num_of_questions for i in range(num_of_candidate)]) - got_points

result_points = start_points - lost_points

for i in range(num_of_candidate):
	if result_points[i] > 0:
		print("Yes")
	else:
		print("No")
### BUGGY CODE ###

k,s = map(int,input().split())
l = [a+b for a in range(k+1) for b in range(k+1)]
sum = 0
for i in range(k+1):
  sum += l.count(s-i)
print(sum)

### FIXED CODE ###

k,s = map(int,input().split())
sum =0
for i in range(k+1):
  for l in range(k+1):
    if 0<=s-i-l<=k:
      sum += 1
print(sum)
### BUGGY CODE ###

import math
import bisect

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

alist.sort()
#print(alist)

flist=[False]*N
answer=0
for i in reversed(range(N)):
  if flist[i]:
    continue
  
  p1=alist[i]
  p2=2**math.ceil(math.log(p1+1,2))-p1
  #print(p1,p2)
  
  index1 = bisect.bisect_left(alist,p2,0,i+1)  
  index2 = bisect.bisect_right(alist,p2,index1,i+1)  
  #print(index1,index2)
  for j in range(index1,index2):
    if j != i and not flist[j]:
      flist[i]=True
      flist[j]=True
      answer+=1
      break
  
#print(flist)    
print(answer)


### FIXED CODE ###

import bisect
N=int(input())
alist=list(map(int,input().split()))
alist.sort(reverse=True)

blist=[]
for a in alist:
  a2=a
  digit_a2=0
  while(a2>0):
    a2>>=1
    digit_a2+=1
  b=2**(digit_a2)-a
  blist.append(b)
#print(alist)
#print(blist)

dic_a={}
for a in alist:
  if a in dic_a:
    dic_a[a]+=1
  else:
    dic_a[a]=1

answer=0
for i in range(N):
  a=alist[i]
  b=blist[i]
  if a==b:
    if dic_a[a]>1:
      dic_a[a]-=2
      answer+=1
      #print(a,a)
  else:
    if dic_a[a]>0 and b in dic_a and dic_a[b]>0:
      dic_a[a]-=1
      dic_a[b]-=1
      answer+=1
      #print(a,b)
    
print(answer)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n = int(input())

dp = [[[-1]*(n+1) for _ in range(n+1)] for i in range(n+1)]
dp[0][0][0] = 0
for d in range(n+1):
  for c in range(n+1-d):
    for b in range(n+1-d-c):
      if b == c == d == 0:
        continue
      dp[b][c][d] = n
      if b != 0:
        dp[b][c][d] += b*dp[b-1][c][d]
      if c != 0:
        dp[b][c][d] += c*dp[b+1][c-1][d]
      if d != 0:
        dp[b][c][d] += d*dp[b][c+1][d-1]
      dp[b][c][d] /= (b+c+d)

L = [0]*3
for a in map(int, input().split()):
  L[a-1] += 1
ans = dp[L[0]][L[1]][L[2]]
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(input())
A = tuple(map(int, input().split()))
C = [0]*3
for a in A:
  C[a-1] += 1
dp = [[[-1]*(n+1) for i in range(n+1)] for j in range(n+1)]
dp[0][0][0] = 0
def f(i, j, k):
  if dp[i][j][k] != -1:
    return dp[i][j][k]
  res = 1
  if i:
    res += f(i-1, j, k)*(i/n)
  if j:
    res += f(i+1, j-1, k)*(j/n)
  if k:
    res += f(i, j+1, k-1)*(k/n)
  res /= (i+j+k)/n
  dp[i][j][k] = res
  return res
ans = f(C[0], C[1], C[2])
print(ans)
### BUGGY CODE ###

MOD = 10**9+7
n = int(input())
can = []
for i in range(n):
    row = list(map(int, input().split()))
    can.append(row)
dp = [0] * (1 << n)
dp[0] = 1
for mask in range((1 << n) - 1):
    a = bin(mask).count('1')
    for b in range(n):
        if can[a][b] and not (mask & (1 << b)):
            mask2 = mask ^ (1 << b)
            dp[mask2] = (dp[mask2] + dp[mask]) % MOD
print(dp[(1 << n) - 1])

### FIXED CODE ###

def bitcount(i): # i < 2^32
    i = i - ((i >> 1) & 0x55555555)
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
    return (((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) & 0xffffffff) >> 24

MOD = 10**9+7
n = int(input())
can = [[int(i) for i in input().split()] for j in range(n)]
dp = [0] * (1 << n)
dp[0] = 1
for mask in range((1 << n) - 1):
    #a = bin(mask).count('1')
    a = bitcount(mask)
    for b in range(n):
        if can[a][b] and not (mask & (1 << b)):
            mask2 = mask ^ (1 << b)
            dp[mask2] += dp[mask]
            if dp[mask2] >= MOD:
                dp[mask2] -= MOD
print(dp[(1 << n) - 1])
### BUGGY CODE ###

a,b = map(int,input().split())
x=0
for i in range(1000000000):
    x+=1
    if abs(a-i) == abs(b-i):
        print(i)
        exit()
print('IMPOSSIBLE')

### FIXED CODE ###

a,b = map(int,input().split())
if (b-a)%2 == 1:
    print('IMPOSSIBLE')

else:
    print(int((b-a)/2 + a))
### BUGGY CODE ###

def resolve():
    from collections import deque
    n, m = map(int, input().split())
    a = deque(map(int, input().split()))
 
    for i in range(m):
        a = deque(sorted(a))
        maxa = a.pop()
        maxa //= 2
        a.appendleft(maxa)
    print(sum(a))
resolve()

### FIXED CODE ###

def resolve():
    import heapq
    n, m = map(int, input().split())
    a = list(map(lambda x:int(x)*-1, input().split()))
    heapq.heapify(a)
    for i in range(m):
        maxa = heapq.heappop(a) * -1
        maxa //= 2
        heapq.heappush(a, -maxa)
    print(sum(a)*-1)
resolve()
### BUGGY CODE ###

N, A, B, C = map(int, input().split())

l = [int(input()) for i in range(N)]

stack = []
stack.append((0, (0, 0, 0), 0))
flg = []
mp = []

while stack:
    x = stack.pop(-1)
    if x[0] == N:
        a = x[1][0]
        b = x[1][1]
        c = x[1][2]
        if min(a, b, c) > 0:
            sum_mp = x[2] + abs(a-A)+abs(b-B)+abs(c-C)
            mp.append(sum_mp)
    else:
        depth = x[0]
        bamboo = x[1]
        MP = x[2]
        for i in range(4):
            bb = list(bamboo)
            if i < 3:
                if bb[i] != 0 and bb[i] < [A, B, C][i]:
                    mm = MP + 10
                    bb[i] += l[depth]
                    if (depth+1, bb, mm) not in flg:
                        stack.append((depth+1, bb, mm))
                        flg.append((depth+1, bb, mm))
                elif bb[i] == 0:
                    mm = MP
                    bb[i] += l[depth]
                    if (depth+1, bb, mm) not in flg:
                        stack.append((depth+1, bb, mm))
                        flg.append((depth+1, bb, mm))
            else:
                mm = MP
                if (depth+1, bb, mm) not in flg:
                    stack.append((depth+1, bb, mm))
                    flg.append((depth+1, bb, mm))

print(min(mp))


### FIXED CODE ###

N, A, B, C = map(int, input().split())

l = [int(input()) for i in range(N)]


def convert(n):
    list_q = []
    while True:
        a = n % 4
        n //= 4
        list_q.insert(0, a)
        if n == 0:
            break
    list_q = [str(i) for i in list_q]
    return list_q


MP = -1
for i in range(21, 4**N):
    mp_a = 0
    mp_b = 0
    mp_c = 0
    use = [int(j) for j in ''.join(convert(i)).zfill(N)]
    a_n = use.count(1)
    b_n = use.count(2)
    c_n = use.count(3)
    if a_n == 0 or b_n == 0 or c_n == 0:
        pass
    else:
        mp_a += 10 * (a_n - 1)
        mp_b += 10 * (b_n - 1)
        mp_c += 10 * (c_n - 1)
        b_a = 0
        b_b = 0
        b_c = 0
        idx = 0
        for i in use:
            if i == 1:
                b_a += l[idx]
            elif i == 2:
                b_b += l[idx]
            elif i == 3:
                b_c += l[idx]
            idx += 1
        mp_a += abs(A-b_a)
        mp_b += abs(B-b_b)
        mp_c += abs(C-b_c)
        mp = mp_a + mp_b + mp_c
        if MP == -1 or mp < MP:
            MP = mp
print(MP)
### BUGGY CODE ###

N, K, Q = map(int, input().split())
A = list(int(input()) for _ in range(Q))

def minus(n):
  return n - 1

score = [0] * N
for i in range(Q):
  score[A[i] - 1] += 1

ans = []
for j in range(N):
  if K - sum(score) + score[j] <= 0:
    ans.append("No")
  else:
    ans.append("Yes")

for a in ans:
  print(a)

### FIXED CODE ###

N, K, Q = map(int, input().split())
A = list(int(input()) for _ in range(Q))

score = [0] * N
for i in range(Q):
  score[A[i] - 1] += 1
 
ans = []
for j in range(N):
  if K - Q + score[j] <= 0:
    ans.append("No")
  else:
    ans.append("Yes")
 
for a in ans:
  print(a)
### BUGGY CODE ###

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

m=li[0]
for i in range(1,N):
  m=m*li[i]
if m>10**18:
  print(-1)
else:
  print(m)

### FIXED CODE ###

N=int(input())
li=list(map(int,input().split()))
 
m=li[0]
if 0 in li:
  m=0
else:
  for i in range(1,N):
    m=m*li[i]
    if m>10**18:
      m=-1
      break
print(m)
### BUGGY CODE ###

N,K = map(int,input().split())
A = [int(i) for i in input().split()]
temp = 1
arr = []
for k in range(K-1):
    temp *= A[k]
for i in range(N-K+1):
    temp *= A[i+K-1]
    arr.append(temp)
    temp = temp // A[i]
for i in range(N-K):
    if arr[i] < arr[i+1]:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

N,K = map(int,input().split())
A = [int(i) for i in input().split()]
for i in range(N-K):
    if A[i] < A[i+K]:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

n,q = map(int,input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]
for i in range(q):
    print(s[lr[i][0]-1:lr[i][1]].count("AC"))

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
t=[0]*(n+1)
for i in range(n-1):
    t[i+1]=t[i]+(1 if s[i:i+2]=="AC" else 0)
for i in range(q):
    l,r=map(int,input().split())
    print(t[r-1]-t[l-1])