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

n = int(input())
stock = []
for _ in range(n):
  stock.append(input())
  stock = list(set(stock))
print(len(stock))

### FIXED CODE ###

stock = {}
for _ in range(int(input())):
  s = input()
  try:
    stock[s] += 1
  except KeyError:
    stock[s] = 1
print(len(stock))
### BUGGY CODE ###

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

dxs = [0, 0, 1, -1]
dys = [1, -1, 0, 0]
cand = []
for j in range(H):
    for i in range(W):
        if S[j][i] == '#':
            continue
        q = queue.Queue()
        q.put((i, j, 0))
        field = [[-1] * W for _ in range(H)]
        while not q.empty():
            p = q.get()
            for dx, dy in zip(dxs, dys):
                field[p[1]][p[0]] = p[2]
                cand.append(p[2])
                x, y = p[0] + dx, p[1] + dy
                if not (0 <= x < W) or not (0 <= y < H) or S[y][x] == '#' or field[y][x] != -1:
                    continue
                q.put((x, y, p[2] + 1))
print(max(cand))

### FIXED CODE ###

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

dxs = [0, 0, 1, -1]
dys = [1, -1, 0, 0]
cand = []
for j in range(H):
    for i in range(W):
        if S[j][i] == '#':
            continue
        q = queue.Queue()
        q.put((i, j, 0))
        field = [[-1] * W for _ in range(H)]
        field[j][i] = 0
        while not q.empty():
            p = q.get()
            for dx, dy in zip(dxs, dys):
                x, y = p[0] + dx, p[1] + dy
                if not (0 <= x < W) or not (0 <= y < H) or S[y][x] == '#' or field[y][x] != -1:
                    continue
                field[y][x] = p[2] + 1
                q.put((x, y, p[2] + 1))
        cand.append(max(max(row) for row in field))
print(max(cand))
### BUGGY CODE ###

def main():
    import sys

    H, W = map(int, sys.stdin.readline().split())
    A = [list(map(int, sys.stdin.readline().split())) for i in range(H)]
    B = [list(map(int, sys.stdin.readline().split())) for i in range(H)]
    X = [[None] * W for i in range(H)]
    for h in range(H):
        for w in range(W):
            X[h][w] = abs(A[h][w] - B[h][w])

    dp = {}
    dp[0] = set()
    dp[0].add(X[0][0])
    dp[0].add(-X[0][0])

    for h in range(H):
        for w in range(W):
            if h == 0 and w == 0:
                continue
            x = X[h][w]
            s = set()

            if W * h + w > W - 1:
                for d in dp[W * (h - 1) + w]:
                    if d + x <= ((H - h) + (W - w)) * 79:
                        s.add(d + x)
                    if d - x >= -((H - h) + (W - w)) * 79:
                        s.add(d - x)

            if (W * h + w) % W != 0:
                for d in dp[W * h + w - 1]:
                    if d + x <= ((H - h) + (W - w)) * 79:
                        s.add(d + x)
                    if d - x >= -((H - h) + (W - w)) * 79:
                        s.add(d - x)

            dp[W * h + w] = s

    ans = min([abs(s) for s in dp[W * H - 1]])
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    import sys

    H, W = map(int, sys.stdin.readline().split())
    A = [list(map(int, sys.stdin.readline().split())) for i in range(H)]
    B = [list(map(int, sys.stdin.readline().split())) for i in range(H)]
    X = [[0] * W for i in range(H)]
    for h in range(H):
        for w in range(W):
            X[h][w] = abs(A[h][w] - B[h][w])

    dp = [[set() for j in range(W)] for i in range(H)]
    dp[0][0].add(X[0][0])
    dp[0][0].add(-X[0][0])

    for h in range(H):
        for w in range(W):
            if h == 0 and w == 0:
                continue
            x = X[h][w]
            s = set()

            if h > 0:
                for d in dp[h - 1][w]:
                    s.add(d + x)
                    s.add(abs(d - x))

            if w > 0:
                for d in dp[h][w - 1]:
                    s.add(d + x)
                    s.add(abs(d - x))

            dp[h][w] = s

    ans = min([abs(s) for s in dp[H - 1][W - 1]])
    print(ans)


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

n = int(input())

S = []
for i in range(n):
    s = input()
    s = sorted(list(s))
    s = str(s)
    S.append(s)

T = set(S)

ans = 0
cnt = [S.count(T.pop()) - 1 for i in range(len(T))]
for c in cnt:
    ans += c * (c+1) // 2

print(ans)

### FIXED CODE ###

n = int(input())

cnt = {}
for i in range(n):
    s = input()
    s = sorted(list(s))
    s = str(s)
    if s not in cnt:
        cnt[s] = 0
    else:
        cnt[s] += 1

ans = 0
for c in cnt.values():
    ans += c * (c+1) // 2

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

N = int(raw_input())
lis = []
for i in xrange(N):
	num = int(raw_input())
	for j in xrange(len(lis)):
		if lis[j] == num:
			lis.pop(j)
			break
		elif lis[j] > num:
			lis.insert(j,num)
			break
	else:
		lis.append(num)
print len(lis)

### FIXED CODE ###

from collections import Counter
N = int(raw_input())
lis = []
for i in xrange(N):
	lis.append(int(raw_input()))
lis.sort()
lister = dict(Counter(lis)).items()
count = 0
for item in lister:
	if item[1] % 2 == 1:
		count += 1
print count
### BUGGY CODE ###

s = input().split()

A = int(s[0])
B = int(s[1])
N = int(s[2])

result = 0

for x in range(N+1):
  y = (A*x)//B - A*(x//B)
  if y > result:
    result = y
    
print(result) 

### FIXED CODE ###

s = input().split()

A = int(s[0])
B = int(s[1])
N = int(s[2])

result = 0

n = (N // B) * B - 1
if (n < 0):
  n = 0

a = (A*N)//B - A*(N//B)
b = (A*n)//B - A*(n//B)
"""
for x in range(N+1):
  y = (A*x)//B - A*(x//B)
  if y > result:
    result = y
"""
    
if (a > b):
  result = a
else:
  result = b
print(result)
### BUGGY CODE ###

import itertools

N,M,R=map(int,input().split())
r=list(map(int,input().split()))
for i in range(R): r[i] -= 1

g = [ [1001001001] * N for _ in range(N) ]
for i in range(N):
  g[i][i] = 0

for _ in range(M):
  A,B,C=map(int,input().split())
  A-=1
  B-=1
  g[A][B] = C
  g[B][A] = C

for k in range(N):
  for i in range(N):
    for j in range(N):
      g[i][j] = min(g[i][j], g[i][k] + g[k][j])

ans = 1001001001
for p in itertools.permutations(r):
  cur = 0
  for i in range(1, R):
    cur += g[p[i-1]][p[i]]
  ans = min(ans, cur)
print(ans)


### FIXED CODE ###

import itertools

N,M,R=map(int,input().split())
r=list(map(int,input().split()))
for i in range(R): r[i] -= 1

g = [ [1001001001] * N for _ in range(N) ]
for i in range(N):
  g[i][i] = 0

for _ in range(M):
  A,B,C=map(int,input().split())
  A-=1
  B-=1
  g[A][B] = C
  g[B][A] = C

def md(beg):
  d = [1001001001] * N
  done = [False] * N
  d[beg] = 0
  while True:
    cur = 1001001001
    pos = -1
    for i in range(N):
      if not done[i] and cur > d[i]:
        cur = d[i]
        pos = i
    if pos == -1:
      break
    done[pos] = True
    for i in range(N):
      d[i] = min(d[i], d[pos] + g[pos][i])
  return d

for i in range(R):
  g[r[i]] = md(r[i])

ans = 1001001001
for p in itertools.permutations(r):
  cur = 0
  for i in range(1, R):
    cur += g[p[i-1]][p[i]]
  ans = min(ans, cur)
print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
s=0
for i in range(len(a)):
    s+=a[i]*sum(a[i+1:])
print(s%(10**9+7))

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ss=sum(a)
s=0
for i in range(len(a)):
    ss=ss-a[i]
    s+=a[i]*ss
print(s%(10**9+7))
### BUGGY CODE ###

l = int(input())

lst = list(str(l))
lin = list(map(int,lst[:]))

#print(l)
#print(lst)
#print(lin)

le = len(lin)

dp1 = [0] * le#A+BがL以下だとわかっている
dp2 = [0] * le#A+BがL以下だとわかっていない

dp1[0] = 1
dp2[0] = 2

for i in range(1,le):
    if lin[i] == 0:
        dp1[i] = dp1[i-1] * 3
        dp2[i] = dp2[i-1]
    else:
        dp1[i] = dp1[i-1] * 3 + dp2[i-1]
        dp2[i] = dp2[i-1] * 2

print((dp1[-1]+dp2[-1])%(10**9+7))



### FIXED CODE ###

L = list(map(int,list(input())))
num = len(L)
mod = 10 ** 9 + 7

dp1 = [0] * num
#AおよびBの値の上からk桁目(k>=0)までを確定させ、その時点で
#既にA+BがL以下であることが分かっているような値組(A, B)の個数
dp2 = [0] * num
#AおよびBの値の上からk桁目(k>=0)までを確定させ、その時点では
#まだA+BがL以下になるかどうか分かっていないような値組 (A, B) の個数

dp1[0] = 1 #(A,B)=(0,0)
dp2[0] = 2 #(A,B)=(1,0),(0,1)

for i in range(1,num):
    if L[i] == 1:
        dp1[i] = dp1[i-1] * 3 + dp2[i-1]
        dp2[i] = dp2[i-1] * 2
    else:
        dp1[i] = dp1[i-1] * 3
        dp2[i] = dp2[i-1]
    dp1[i] %= mod
    dp2[i] %= mod

print((dp1[num-1] + dp2[num-1])%mod)
### BUGGY CODE ###

import numpy as np

def main():
    n, k = map(int, input().split())
    a = list(map(lambda x: int(x)-1, input().split()))
    count = 0
    foot = [0]
    is_loop = False

    for i in range(1,k):
        foot.append(a[foot[-1]])
        if foot.count(foot[-1]) == 2:
            st_i = foot.index(foot[-1])
            lo_size = len(foot)-1 - st_i

            k -= st_i
            k %= lo_size
            
            print(foot[st_i+k]+1)
            is_loop = True
            break
    
    if not is_loop:
        print(a[foot[-1]]+1)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import numpy as np

def main():
    n, k = map(int, input().split())
    a = list(map(lambda x: int(x)-1, input().split()))
    foot = [0]
    is_loop = False
    ed = np.zeros([n], dtype=int)
    ed[0] = 1

    for i in range(1,k):
        go = a[foot[-1]]
        foot.append(go)
        if ed[go] == 1:
            st_i = foot.index(foot[-1])
            lo_size = len(foot)-1 - st_i

            k -= st_i
            k %= lo_size
            
            print(foot[st_i+k]+1)
            is_loop = True
            break
        ed[go] = 1
    
    if not is_loop:
        print(a[foot[-1]]+1)


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

import sys
import copy

def solve():
    N,Q=map(int,input().split())
    s=list(input())
    s2={}
    for i in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
        s2[i]=[]
    for i,c in enumerate(s):
        s2[c].append(i+1)
    r2=copy.copy(s2)
    for k in r2.keys():
        r2[k]=list(reversed(r2[k]))

    m=[1 for i in range(N+2)]
    m[0]=0
    m[N+1]=0

    #print()
    #print(s2)
    #print(r2)
    #print(0,0,s)
    #print(0,0,m)
    for i in range(Q):
        t,d=sys.stdin.readline().rstrip().split()
        if d=='L':
            for i in s2[t]:
                m[i-1]+=m[i]
                m[i]=0
        else:
            for i in r2[t]:
                m[i+1]+=m[i]
                m[i]=0
        #print(t,d,m)
    return N-m[0]-m[N+1]

print(solve())


### FIXED CODE ###

import sys

N,Q=map(int,input().split())
s=[-1]
s+=list(map(lambda e:ord(e)-65,list(input())))
s+=[-1]
t=[]
d=[]
for i in range(Q):
    ti,di=sys.stdin.readline().rstrip().split()
    ti=ord(ti)-65
    di = -1 if di=='L' else +1
    t.append(ti)
    d.append(di)

def solve(n):
    for i in range(Q):
        if s[n]==t[i]:
            n+=d[i]
    return n

def find_match(x):
    f1 = 1
    f2 = N + 1
    while f1 != f2:
        f3 = (f1 + f2) // 2
        if solve(f3) == x:
            f1 = f3 + 1
        else:
            f2 = f3
    return f1

def find_notmatch(x):
    f1 = 1
    f2 = N + 1
    while f1 != f2:
        f3 = (f1 + f2) // 2
        #print(f1,f2,f3,solve(f3),x)
        if solve(f3) != x:
            f1 = f3 + 1
        else:
            f2 = f3
    return f1

#for i in range(1,N+1):
#    print(solve(i))

print(find_notmatch(N+1)-find_match(0))
### BUGGY CODE ###

m1 = 1046527
m2 = m1 - 1
_dict = [""] * m1


def insert(k):
    i = 0

    while True:
        ix = _h(k, i)
        if _dict[ix] == "":
            _dict[ix] = k
            return
        else:
            i += 1


def find(k):
    i = 0

    while True:
        ix = _h(k, i)
        if _dict[ix] == k:
            return True
        elif _dict[ix] == "":
            return False
        else:
            i += 1

    return False


def _h(k, i):
    return (_h1(k) + i * _h2(k)) % m1


def _h1(k):
    return k % m1


def _h2(k):
    return k % m2 + 1


def to_int(s):
    ret = 0
    i = 1
    for j in range(len(s)):
        e = s[len(s) - j - 1]

        if e == 'A':
            ret += 1 * i
        elif e == 'C':
            ret += 2 * i
        elif e == 'G':
            ret += 3 * i
        elif e == 'T':
            ret += 4 * i
        i *= 5

    return ret


if __name__ == '__main__':
    n = int(input())

    for _ in range(n):
        cmd, val = input().split()

        if cmd[0] == "i":
            insert(to_int(val))
        else:
            ans = "yes" if find(to_int(val)) else "no"
            print(ans)

### FIXED CODE ###

M = 1046527
L = 14
H = [""] * M
 
def getChar(ch):
    if ch == 'A':
        return 1
    elif ch == 'C':
        return 2
    elif ch == 'G':
        return 3
    elif ch == 'T':
        return 4
    else:
        return 0
 
def getKey(strings):
    Sum = 0
    p = 1
    for i in xrange(len(strings)):
        Sum += p * getChar(strings[i])
        p *= 5
 
    return Sum
 
def h1(key):
    return key % M
 
def h2(key):
    return 1 + (key % (M-1))
 
def find(strings):
    key = getKey(strings)
    i = 0
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == strings:
            return 1
        elif len(H[h]) == 0:
            return 0
        else:
            i += 1
    return 0
 
def insert(strings):
    key = getKey(strings)
    i = 0
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == strings:
            return 1
        elif len(H[h]) == 0:
            H[h] = strings
            return 0
        else:
            i += 1
    return 0
 
def main():
    n = input()
    for i in xrange(n):
        com = raw_input().split()
        if com[0][0] == 'i':
            insert(com[1])
        else:
            if find(com[1]):
                print 'yes'
            else:
                print 'no'
    return 0
 
main()
### BUGGY CODE ###

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

ans=1
for i in range(n):
    ans=ans*list[i]

if ans>10**18:
    ans=-1

print(ans)

### FIXED CODE ###

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

if 0 in list:
    ans=0
else:
    ans=1
    for i in range(n):
        ans=ans*list[i]
        if ans>10**18:
            ans=-1
            break

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

import time
import numpy as np
start = time.time()
n, q = map(int, input().split())
s = input()
dic = {}
g = np.ones(n).astype(int)
for i, c in enumerate(s):
    if c in dic.keys():
        dic[c].append(i)
    else:
        dic[c] = [i]

for i in range(q):
    t, d = input().split()
    sign = 0
    if t not in dic.keys():
        continue
    if d == 'L':
        sign = -1
    else:
        sign = 1
    for m in dic[t]:
        number = g[m]
        g[m] = 0
        if 0 <= m + sign < n:
            g[m + sign] += number

print(int(sum(g)))


### FIXED CODE ###

n, q = map(int, input().split())
s = input()
dic = {}
t_list = []
d_list = []

for i in range(q):
    t, d = input().split()
    t_list.append(t)
    if d == 'L':
        d_list.append(-1)
    else:
        d_list.append(1)


def find_pos(left, right):
    return left + (right - left - 1) // 2


def calc(sites, ts, ds):
    def check(idx):
        num = idx
        for j in range(q):
            site = sites[num]
            if ts[j] == site:
                num += ds[j]
            if num < 0:
                return -1
            if num > n - 1:
                return 1
        return 0

    def func(left, right):
        assert left > -1
        assert right < n + 1
        if right - left == 1:
            if check(left) > -1:
                return left
            else:
                return right
        pos = find_pos(left, right)
        if check(pos) > -1:
            return func(left, pos + 1)
        else:
            return func(pos + 1, right)
    return func


f1 = calc(s, t_list, d_list)
f2 = calc(s[::-1], t_list, [-i*1 for i in d_list])
print(n - f1(0, n) - f2(0, n))
### BUGGY CODE ###

from queue import Queue

N = int(input())
d = {}
for i in range(N-1):
    u, v, w = map(int, input().split())
    if u in d:
        d[u].append([v, w])
    else:
        d[u] = [[v, w]]
    if v in d:
        d[v].append([u, w])
    else:
        d[v] = [[u, w]]

isChecked = [False for i in range(N)]
ans = [0 for i in range(N)]
q = Queue()
# [current v, sum length]
q.put([1, 0])
while not q.empty():
    v, l = q.get()
    if isChecked[v-1]:
        continue
    ans[v-1] = 0 if l%2 == 0 else 1
    isChecked[v-1] = True
    for u, w in d[v]:
        q.put([u, l+w])

for i in range(N):
    print(ans[i])


### FIXED CODE ###

N = int(input())
d = {}
for i in range(N-1):
    u, v, w = map(int, input().split())
    if u in d:
        d[u].append([v, w])
    else:
        d[u] = [[v, w]]
    if v in d:
        d[v].append([u, w])
    else:
        d[v] = [[u, w]]

isChecked = [False for i in range(N)]
ans = [0 for i in range(N)]
for k in d:
    c = ans[k-1]
    q = [[0, k]]
    while q:
        l = q[-1][0]
        p = q[-1][1]
        q.pop()
        #print(l, p)
        if isChecked[p-1]:
            continue
        if l%2 == 0:
            ans[p-1] = c
        else:
            ans[p-1] = (c+1)%2
        isChecked[p-1] = True
        for e in d[p]:
            n = e[0]
            w = e[1]
            q.append([l+w, n])

for i in range(N):
    print(ans[i])
### BUGGY CODE ###

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

lr = [list(map(int, input().split())) for i 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):
    t[i] = t[i-1] + (1 if S[i:i+2] == "AC" else 0)
for i in range(Q):
    l,r = map(int, input().split())
    print(t[r-2] - t[l-2])
### BUGGY CODE ###

from collections import deque
n, x, y = map(int,input().split())
g = [[] for _ in range(n)] 
for i in range(n-1):

    g[i] += i+1,
    g[i+1] += i,
g[x-1] += y-1,
g[y-1] += x-1,
a = [0]*n
for start in range(n):
    d = [-1] * n
    d[start] = 0
    q = deque([start])
    add,pop = q.append,q.popleft
    while q:
        v = pop()
        for nv in g[v]:
            if d[nv] < 0:
                d[nv] = d[v]+1
                add(nv)
    for i in d:
        a[i] += 1
print(' '.join(str(i//2) for i in a[1:]))


### FIXED CODE ###

def main():
    from collections import deque
    n,x,y=map(int,input().split())
    e=[[]for _ in range(n)]
    for i in range(n-1):
        e[i]+=i+1,
        e[i+1]+=i,
    e[x-1]+=y-1,
    e[y-1]+=x-1,
    a=[0]*n
    for s in range(n):
        d=[-1]*n
        d[s]=0
        q=deque([s])
        add,pop=q.append,q.popleft
        while q:
            v=pop()
            for w in e[v]:
                if d[w]<0:
                    d[w]=d[v]+1
                    add(w)
        for i in d:a[i]+=1
    print(' '.join(str(i//2)for i in a[1:]))
main()
### BUGGY CODE ###

a = []
n = int(input())
for i in range(n):
    a.append(int(input()))
print(max(max(a[i:])-min(a[:i]) for i in range(1, n)))

### FIXED CODE ###

maxv = -2*10**9
minv = 2*10**9
n = int(input())
for i in range(n):
    x = int(input())
    maxv = max(x - minv, maxv)
    minv = min(x, minv)
print(maxv)
### BUGGY CODE ###

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

L = [0]*5
L[0] = N
count = 0
while sum(L) != 0:
    if L[4] != 0:
        tmp0 = min(L[4],E)
        L[4] -= tmp0
    if L[3] != 0:
        tmp0 = min(L[3],D)
        L[3] -= tmp0
        L[4] += tmp0
    if L[2] != 0:
        tmp0 = min(L[2],C)
        L[2] -= tmp0
        L[3] += tmp0
    if L[1] != 0:
        tmp0 = min(L[1],B)
        L[1] -= tmp0
        L[2] += tmp0
    if L[0] != 0:
        tmp0 = min(L[0],A)
        L[0] -= tmp0
        L[1] += tmp0
    count += 1
print(count)

### FIXED CODE ###

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
# N=5
# A=3
# B=2
# C=4
# D=3
# E=5
# L = [0]*5
# L[0] = N
# count = 0
# while sum(L) != 0:
#     if L[4] != 0:
#         tmp0 = min(L[4],E)
#         L[4] -= tmp0
#     if L[3] != 0:
#         tmp0 = min(L[3],D)
#         L[3] -= tmp0
#         L[4] += tmp0
#     if L[2] != 0:
#         tmp0 = min(L[2],C)
#         L[2] -= tmp0
#         L[3] += tmp0
#     if L[1] != 0:
#         tmp0 = min(L[1],B)
#         L[1] -= tmp0
#         L[2] += tmp0
#     if L[0] != 0:
#         tmp0 = min(L[0],A)
#         L[0] -= tmp0
#         L[1] += tmp0
#     count += 1
print((N-1) // min(A,B,C,D,E) + 5)
### BUGGY CODE ###

k = int(input())
l = 0
s = list()
for i in range(1,9000000):
    l = (l*10+7)%k
    if l == 0:
        print(i)
        exit()
    else:
        if s.count(l) == 0:
            s.append(l)
        else:
            print(-1)
            exit()
print(-1)
exit()

### FIXED CODE ###

k = int(input())
l = 0
s = set()
for i in range(1,9000000):
    l = (l*10+7)%k
    if l == 0:
        print(i)
        exit()
    else:
        s.add(l)
        if len(s) == i-1:
            print(-1)
            exit()
print(-1)
exit()
### BUGGY CODE ###

H, W, D = map(int,input().split())
dist = [[float("inf") for i in range(H*W+1)] for j in range(H*W+1)]
for i in range(H*W+1):
  dist[i][i] = 0
#dist[i][j]は隣接行列
pos = [[0,0] for i in range(H*W+1)]
for i in range(H):
  A = list(map(int,input().split()))
  for j in range(W):
    pos[A[j]] = [i+1, j+1]
for i in range(H*W+1-D):
  dist[i][i+D] = abs(pos[i][0]-pos[i+D][0])+abs(pos[i][1]-pos[i+D][1])
distances = [[] for i in range(D)]#あまりがiの距離
for i in range(1,H*W+1-D):
  d = dist[i][i+D]
  distances[i%D]+=[d]
distances2 = [[0] for i in range(D)]#累積和に直す
for i in range(D):
  for j in range(len(distances[i])):
    distances2[i]+=[distances2[i][-1]+distances[i][j]]
Q = int(input())
for i in range(Q):
  L, R = map(int, input().split())
  q = L%D
  l, r = (L-1)//D, (R-1)//D
  print(distances2[q][r]-distances2[q][l])

### FIXED CODE ###

H, W, D = map(int,input().split())
dist = [0]*(H*W+1)#dist[i]はiからi+Dまでの距離
pos = [[0,0] for i in range(H*W+1)]
for i in range(H):
  A = list(map(int,input().split()))
  for j in range(W):
    pos[A[j]] = [i+1, j+1]
for i in range(H*W+1-D):
  dist[i] = abs(pos[i][0]-pos[i+D][0])+abs(pos[i][1]-pos[i+D][1])
distances = [[] for i in range(D)]#あまりがiの距離
for i in range(1,H*W+1-D):
  d = dist[i]
  distances[i%D]+=[d]
distances2 = [[0] for i in range(D)]#累積和に直す
for i in range(D):
  for j in range(len(distances[i])):
    distances2[i]+=[distances2[i][-1]+distances[i][j]]
Q = int(input())
for i in range(Q):
  L, R = map(int, input().split())
  q = L%D
  l, r = (L-1)//D, (R-1)//D
  print(distances2[q][r]-distances2[q][l])
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = 1
for a in A:
  ans *= a
print(ans if ans<=10**18 else -1)


### FIXED CODE ###

import sys

N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
    print(0)
    sys.exit()

for a in A:
    ans *= a
    if ans > 1e18:
        print(-1)
        sys.exit()
print(ans)
### BUGGY CODE ###

import numpy as np
from numba import njit, i4, i8


@njit(i8(i8, i4), cache=True)
def div(n, d):
    cnt = 0
    while n % d == 0:
        n //= d
        cnt += 1
    return cnt


@njit(i8(i8[:, :], i8), cache=True)
def solve(arr, length):
    ans = 0
    for i in range(length):
        for j in range(i + 1, length):
            a, b, c, d = arr[0][i], arr[1][i], arr[0][j], arr[1][j]
            if a + c >= 18 and b + d >= 18:
                ans += 1
    return ans


n = int(input())
arr = np.array([input() for _ in range(n)], np.float64)
arr = np.rint(arr * 10**9).astype(np.int64)

f = np.vectorize(div)
arr = np.vstack([f(arr, 2), f(arr, 5)])

print(solve(arr, arr.shape[1]))

### FIXED CODE ###

def div(n, d):
    cnt = 0
    while n % d == 0 and cnt < 18:
        n //= d
        cnt += 1
    return cnt


n = int(input())
dp = [[0]*19 for _ in range(19)]

ans = 0
for _ in range(n):
    x = round(float(input()) * pow(10, 9))
    two = div(x, 2)
    five = div(x, 5)
    ans += dp[18 - two][18 - five]
    for i in range(two + 1):
        for j in range(five + 1):
            dp[i][j] += 1

print(ans)