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

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

if N%2 == 0: # 偶数の時
	for i in range(N//2):
		if A.count(N-1-2*i) != 2:
			# print(N-1-2*i)
			print(0)
			break
	else:
		print(2**(N//2)%MOD)
else: # 奇数の時
	if A.count(0) != 1:
		print(0)
	else:
		for i in range((N-1)//2):
			if A.count(N-1-2*i) != 2:
				# print(N-1-2*i)
				print(0)
				break
		else:
			print(2**((N-1)//2)%MOD)

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

dic = {}
def power(x, y):
   if y == 0:
       return 1
   elif y == 1:
       return x % mod
   elif y % 2 == 0:
       return power(x, y/2) ** 2 % mod
   else:
       return power(x, (y-1)/2) ** 2 * x % mod

for i in range(N):
	if not A[i] in dic:
		dic[A[i]] = 1
	else:
		dic[A[i]] += 1

if N%2 == 0: # 偶数の時
	for i in range(N//2):
		if N-1-2*i not in dic:
			print(0)
			break
		elif dic[N-1-2*i] != 2:
			print(0)
			break
		else:
			pass
	else:
		print(power(2,(N//2)))
else: # 奇数の時
	if A.count(0) != 1:
		print(0)
	else:
		for i in range(N//2-1):
			if N-1-2*i not in dic:
				print(0)
				break
			elif dic[N-1-2*i] != 2:
				print(0)
				break
			else:
				pass
		else:
			print(power(2,(N//2)))
### BUGGY CODE ###

n = int(input())
A = list(map(int, input().split()))
ans = []
for i in range(1, n + 1):
    ans.append(str(A.index(i) + 1))
print(' '.join(ans))

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
ans = [0] * n
for i, a in enumerate(A):
    ans[a - 1] = str(i + 1)
print(' '.join(ans))
### BUGGY CODE ###

# coding: utf-8

import sys
import math

import array
import bisect
import collections
from collections import Counter, defaultdict
import fractions
import heapq
import re

sys.setrecursionlimit(1000000)


def array2d(dim1, dim2, init=None):
    return [[init for _ in range(dim2)] for _ in range(dim1)]

def argsort(l, reverse=False):
    return sorted(range(len(l)), key=lambda i: l[i], reverse=reverse)

def argmin(l):
    return l.index(min(l))

def YESNO(ans, yes="YES", no="NO"):
    print([no, yes][ans])

II = lambda: int(input())
MI = lambda: map(int, input().split())
MIL = lambda: list(MI())
MIS = lambda: input().split()


def main():
    M, K = MI()

    if M == 1 and K == 1:
        return -1
    if K >= 2**M:
        return -1
    if K == 0:
        return " ".join(map(str, sum([[i, i] for i in range(2**M)], [])))

    ans = []
    ans.append(K)
    for i in range(0, 2**M):
        if i != K:
            ans.append(i)
    ans.append(K)
    for i in range(2**M - 1, -1, -1):
        if i != K:
            ans.append(i)
    return " ".join(map(str, ans))


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


### FIXED CODE ###

# coding: utf-8

import sys
import math

import array
import bisect
import collections
from collections import Counter, defaultdict
import fractions
import heapq
import re

sys.setrecursionlimit(1000000)


def array2d(dim1, dim2, init=None):
    return [[init for _ in range(dim2)] for _ in range(dim1)]

def argsort(l, reverse=False):
    return sorted(range(len(l)), key=lambda i: l[i], reverse=reverse)

def argmin(l):
    return l.index(min(l))

def YESNO(ans, yes="YES", no="NO"):
    print([no, yes][ans])

II = lambda: int(input())
MI = lambda: map(int, input().split())
MIL = lambda: list(MI())
MIS = lambda: input().split()


def main():
    M, K = MI()

    if M == 1 and K == 1:
        return -1
    if K >= 2**M:
        return -1
    if K == 0:
        ans = []
        for i in range(0, 2**M):
            ans.append(i)
            ans.append(i)
        return " ".join(map(str, ans))

    ans = []
    ans.append(K)
    for i in range(0, 2**M):
        if i != K:
            ans.append(i)
    ans.append(K)
    for i in range(2**M - 1, -1, -1):
        if i != K:
            ans.append(i)
    return " ".join(map(str, ans))


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

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

# 数値Aの頻度
ndic = {}
for i in A:
    if i in ndic:
        ndic[i] += 1
    else:
        ndic[i] = 1

# 2つの同じ数値Aの選び方
cdic = {}
mem = {}
for j in ndic:
    if ndic[j] == 1:
        continue
    
    if ndic[j] in mem:
        cdic[j] = mem[ndic[j]]
    else:
        cdic[j] = int((ndic[j] * (ndic[j] -1)) / 2)
        mem[ndic[j]] = cdic[j]

for i in A:
    cmb = 0
    for j in cdic:
        if i == j and cdic[j] > 0:
            cmb += cdic[j] - (ndic[j] - 1)
        else:
            cmb += cdic[j]
    print(cmb)

### FIXED CODE ###

import collections

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

# 数値Aの頻度
ndic = collections.Counter(A)

mem = {}
tcmb = 0
for j in ndic:
    if ndic[j] == 1:
        continue
    
    if ndic[j] in mem:
        tcmb += mem[ndic[j]]
    else:
        mem[ndic[j]] = int((ndic[j] * (ndic[j] -1)) / 2)
        tcmb += mem[ndic[j]]
        
for i in A:
    cmb  = tcmb - (ndic[i] - 1)
    print(cmb)
### BUGGY CODE ###

n=int(input())
res=0
ans=1
while res<n:
  res+=1
  ans*=res
  
print(ans%(10**9+7))

### FIXED CODE ###

n = int(input())

pw = 1
num = 1
for i in range(n):
  pw = pw*num % (10**9+7)
  num += 1
  
print(pw)
### BUGGY CODE ###

#!/usr/bin/env python3
#A
import re

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

c = [list(map(str,input().split()))for i in range(a)]
d = [[0 for j in range(b)]  for i in range(a)]

for i in range(a):#初期のリスト設定
    for j in range(b):
        if c[i][0][j] == '#':
            d[i][j] = 1

def change(save,d):
    for i in save:
        d[i[0]][i[1]] = 1

count = 0
for k in range(a*b):
    count += 1
    save = []
    save2 = []
    for i in range(a):
        for j in range(b):
            if d[i][j] == 1:
                if i != 0:#上があるなら
                    save.append((i-1,j))
                if j != 0:#左があるなら
                    save.append((i,j-1))
                if i != a-1:#下があるなら
                    save.append((i+1,j))
                if j != b-1:#右があるなら
                    save.append((i,j+1))
            else:
                save2.append(1)
    change(save,d)
    if len(save2) == 0:
        break;
print(count-1)

### FIXED CODE ###

#!/usr/bin/env python3
#AGC33 A

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h,w = LI()
maze = [list(input()) for _ in range(h)]
check = [[True]*w for _ in range(h)]
dx,dy = [0,1,0,-1],[1,0,-1,0]
que = deque()
for i in range(h):
    for j in range(w):
        if maze[i][j] == '#':
            check[i][j] = False
            que.append((j,i))
res = 0
while que:
    que2 = deque(que)
    que = deque()
    flg = False
    while que2:
        x,y = que2.popleft()
        for i in range(4):
            nx,ny = x + dx[i], y + dy[i]
            if 0 <= nx < w and 0 <= ny < h:
                if check[ny][nx]:
                    check[ny][nx] = False
                    que.append((nx,ny))
                    flg = True
    if flg:
        res += 1
print(res)
### BUGGY CODE ###

def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    count = [0 for _ in range(10**5)]
    for i in range(n):
        count[a[i] - 1] += a[i]

    q = int(input())
    for _ in range(q):
        b, c = list(map(int, input().split()))
        count[c - 1] += count[b - 1] * (c / b)
        count[b - 1] = 0
        print(int(sum(count)))


if 'unittest' not in globals():
    resolve()

### FIXED CODE ###

def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    total = 0
    count = [0 for _ in range(10**5)]
    for i in range(n):
        count[a[i] - 1] += 1
        total += a[i]

    q = int(input())
    for _ in range(q):
        b, c = list(map(int, input().split()))
        count_b = count[b - 1]
        count[b - 1] = 0
        count[c - 1] += count_b

        total -= count_b * (b - c)
        print(total)


if 'unittest' not in globals():
    resolve()
### BUGGY CODE ###

import sys

n, k = map(int, input().split())
s = list(map(int, list(input().strip())))

sys.setrecursionlimit(len(s) + 100)


def count_zero(s, i):
    count = 0
    for j in range(i, len(s)):
        if s[j] == 0:
            count += 1
        else:
            break
    return count


def dfs(s, i, k, count):
    if i == len(s):
        return count
    elif s[i] == 1:
        count += 1
        return dfs(s, i + 1, k, count)
    else:
        if k > 0:
            c = count_zero(s, i)
            count += c
            return dfs(s, i + c, k - 1, count)
        else:
            return count


nums = []
for i in range(n):
    count = 0
    nums.append(dfs(s, i, k, count))
print(max(nums))

### FIXED CODE ###

n, k = map(int, input().split())
s = list(input().strip())

streaks = []
c = s[0]
i = 1
count = 1
while True:
    if i == n:
        streaks.append(count)
        break
    if s[i] == c:
        i += 1
        count += 1
    else:
        streaks.append(count)
        c = s[i]
        i += 1
        count = 1

accs = [0]
for num in streaks:
    accs.append(accs[-1] + num)
if accs[-1] != n:
    accs.append(n)

flag = s[0] == '0'
res = []
for i in range(len(accs)):
    if flag:
        index = i + 2 * k
    else:
        index = i + 2 * k + 1
    index = min(index, len(accs) - 1)
    res.append(accs[index] - accs[i])
    flag = not flag

print(max(res))
### BUGGY CODE ###

s = input()
Q = int(input())

def add_head(s, c):
    return c + s

def add_tail(s, c):
    return s + c

f = 0

for _ in range(Q):
    q = input()
    if int(q[0]) == 1:
        f = abs(f-1)
        continue
    
    _, F, c = q.split()
    if (f == 0 and int(F) == 1) or (f == 1 and int(F) == 2):
        s = c + s
    elif (f == 1 and int(F) == 1) or (f == 0 and int(F) == 2):
        s = s + c
        
if f:
    print(s[::-1])
else:
    print(s)

### FIXED CODE ###

from queue import deque
s = deque([i for i in input()])
Q = int(input())
 
f = 0
 
for _ in range(Q):
    q = input()
    if int(q[0]) == 1:
        f = abs(f-1)
        continue
    
    _, F, c = q.split()
    if f+int(F) % 2 == 1:
        s.appendleft(c)
    else:
        s.append(c)
        
if f:
    print(''.join(reversed(s)))
else:
    print(''.join(s))
### BUGGY CODE ###

import sys
from collections import deque
import numpy as np

sys.setrecursionlimit(10**9)

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

# 最短距離で行って通ったところ以外を黒マスにする
# . : 0, # : 1
S = np.zeros((H + 2, W + 2), dtype='int')
S[0, :] = 1
S[-1, :] = 1
S[:, 0] = 1
S[:, -1] = 1

cost = np.zeros((H + 2, W + 2), dtype='int')
cost[:, :] = -1

subset = S[1:-1, 1:-1]
for h in range(H):
    s = list(input())
    subset[h:] = np.array([0 if i == '.' else 1 for i in s], dtype='i')

q = deque()
qq = deque()
q.append((1, 1))

i = 0
while len(q) > 0:
    while len(q) > 0:
        x, y = q.popleft()
        cost[x, y] = i
        for dx, dy in ((-1, 0), (1, 0), (0, -1), (0, 1)):
            nx = x + dx
            ny = y + dy
            if S[nx, ny] == 0 and cost[nx, ny] == -1:
                qq.append((nx, ny))
    q = qq
    qq = deque()
    i += 1

if cost[H, W] == -1:
    print(-1)
    exit()

ans = (H + 2) * (W + 2) - (S == 1).sum() - cost[H, W] - 1
print(ans)


### FIXED CODE ###

import sys
from collections import deque
import numpy as np

sys.setrecursionlimit(10**9)

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

# 最短距離で行って通ったところ以外を黒マスにする
# . : 0, # : 1
S = np.zeros((H + 2, W + 2), dtype='int')
S[0, :] = 1
S[-1, :] = 1
S[:, 0] = 1
S[:, -1] = 1

cost = np.zeros((H + 2, W + 2), dtype='int')
cost[:, :] = -1

subset = S[1:-1, 1:-1]
for h in range(H):
    s = list(input())
    subset[h:] = np.array([0 if i == '.' else 1 for i in s], dtype='i')

dd = ((-1, 0), (1, 0), (0, -1), (0, 1))
q = deque([(1, 1)])
cost[1, 1] = 0

while q:
    x, y = q.popleft()
    for dx, dy in dd:
        nx = x + dx
        ny = y + dy
        if S[nx, ny] == 0 and cost[nx, ny] == -1:
            cost[nx, ny] = cost[x, y] + 1
            q.append((nx, ny))

if cost[H, W] == -1:
    print(-1)
    exit()

ans = (H + 2) * (W + 2) - (S == 1).sum() - cost[H, W] - 1
print(ans)
### BUGGY CODE ###

"""
マスターオブ整数
公約数の問題
公約数とは最大公約数の約数であるという性質がある
"""
import fractions
A, B = map(int, input().split())

# まず公約数を列挙したくなる
# 最大公約数を求めてその約数を列挙する
# 最大公約数はユークリッドの互除法で求めることができる

ans = 1
gcd_value = fractions.gcd(A, B)
for i in range(2, gcd_value + 1):
    if gcd_value == 1:
        break
    if gcd_value % i == 0:
        ans += 1
        while gcd_value % i == 0:
            gcd_value //= i

# divisorリストの中からどの二つ互いに素となるようにいくつか選ぶ
# 素因数の数+1を答えれば良い

print(ans)

### FIXED CODE ###

"""
マスターオブ整数
公約数の問題
公約数とは最大公約数の約数であるという性質がある
"""
import fractions
A, B = map(int, input().split())

# まず公約数を列挙したくなる
# 最大公約数を求めてその約数を列挙する
# 最大公約数はユークリッドの互除法で求めることができる

ans = 1
gcd_value = fractions.gcd(A, B)
for i in range(2, int(gcd_value**0.5) + 1):
    if gcd_value % i == 0:
        ans += 1
        while gcd_value % i == 0:
            gcd_value //= i

# divisorリストの中からどの二つ互いに素となるようにいくつか選ぶ
# 素因数の数+1を答えれば良い
if gcd_value != 1:
    ans += 1

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

from collections import deque

h,w = [int(x) for x in input().split()]
m = []
for _ in range(h):
    m.append(list(input()))

q = deque()
d = [[-1]*w for x in range(h)]

for i in range(h):
    for j in range(w):
        if m[i][j] == "#":
            q.append([i,j])
            d[i][j] = 0

aa = 0
while q:
    v = q.popleft()
    count = 0
    for i in m:
        jj = set(i)
        if len(jj) == 2:
            break
    else:
        break
    for i in [[1,0],[-1,0],[0,1],[0,-1]]:
        ny = v[0] + i[0]
        nx = v[1] + i[1]
        if (0<=ny<h and 0<=nx<w and m[ny][nx] == "."):
            m[ny][nx] = "#"
            q.append([ny,nx])
            d[ny][nx] = d[v[0]][v[1]] + 1
            aa = max(aa,d[ny][nx])

######
print(aa)

### FIXED CODE ###

from collections import deque

h,w = [int(x) for x in input().split()]
m = []
for _ in range(h):
    m.append(list(input()))

q = deque()
d = [[-1]*w for x in range(h)]

for i in range(h):
    for j in range(w):
        if m[i][j] == "#":
            q.append([i,j])
            d[i][j] = 0

aa = 0
while q:
    v = q.popleft()
    for i in [[1,0],[-1,0],[0,1],[0,-1]]:
        ny = v[0] + i[0]
        nx = v[1] + i[1]
        if (0<=ny<h and 0<=nx<w and m[ny][nx] == "."):
            m[ny][nx] = "#"
            q.append([ny,nx])
            d[ny][nx] = d[v[0]][v[1]] + 1
            aa = max(aa,d[ny][nx])

######
print(aa)
### BUGGY CODE ###

n, m, k =map(int, input().split())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
ta=0
tb=0
ans=0
for i in range(n+1):
    ta=sum(a[:i])
    if ta>k:
        break
    for j in range(m):
        tb=sum(b[:j+1])
        ans=max(ans,i+j)
        if tb + ta >k:
            break
        ans=max(ans,i+j+1)
print(ans)


### FIXED CODE ###

n, m, k =map(int, input().split())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
ta=sum(a)
a.append(0)
tb=0
ans=0
j=0
for i in range(n+1):
    ta -= a[n-i]
    if ta>k:
        continue
    while tb + ta<=k:

        if j ==m:
            ans=max(ans,n-i+j)
            break
        ans=max(ans,n-i+j)
        tb += b[j]
        j +=1

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

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

A=[list(map(int,input().split())) for _ in range(H)]
B=[list(map(int,input().split())) for _ in range(H)]

#dp[i][j]=マス(i,j)における可能なポイントのリスト
dp=[[set() for _ in range(W)] for _ in range(H)]
dp[0][0].add(0)

for i in range(W+H-1):
  I,J=0,0
  if i < H:
    I=i
    J=0
  else:
    I=H-1
    J=i-H+1
  while I>=0 and J<W:
    sa = A[I][J] - B[I][J]
    for point in dp[I][J]:
      if I!=H-1:
        dp[I+1][J].add(point+sa)
        dp[I+1][J].add(point-sa)
      if J!=W-1:
        dp[I][J+1].add(point+sa)
        dp[I][J+1].add(point-sa)
    I-=1
    J+=1

ans=dp[H-1][W-1]
sa = A[H-1][W-1] - B[H-1][W-1]
res=float("inf")
for p in ans:
  res=min(res,abs(p+sa),abs(p-sa))
print(res)

### FIXED CODE ###

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

A=[list(map(int,input().split())) for _ in range(H)]
B=[list(map(int,input().split())) for _ in range(H)]

#dp[i][j]=マス(i,j)における可能なポイントのリスト
dp=[[set() for _ in range(W)] for _ in range(H)]
dp[0][0].add(0)

for i in range(W+H-1):
  I,J=0,0
  if i < H:
    I=i
    J=0
  else:
    I=H-1
    J=i-H+1
  while I>=0 and J<W:
    sa = abs(A[I][J] - B[I][J])
    for point in dp[I][J]:
      if I!=H-1:
        dp[I+1][J].add(point+sa)
        dp[I+1][J].add(abs(point-sa))
      if J!=W-1:
        dp[I][J+1].add(point+sa)
        dp[I][J+1].add(abs(point-sa))
    I-=1
    J+=1

ans=dp[H-1][W-1]
sa = abs(A[H-1][W-1] - B[H-1][W-1])
res=float("inf")
for p in ans:
  res=min(res,abs(p+sa),abs(p-sa))
print(res)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N,M = map(int,input().split())
S = [[]for i in range(N)]
for i in range(M):
    u,v = map(int,input().split())
    S[u-1].append(v-1)
St,T = map(int,input().split())

D = [[float('inf')]*3 for i in range(N)]
D[St-1][0] = 0
queue = [St-1]
hoge = [0]*N
for i in range(1,N*3+3):
    l = 0
    for q in queue:
        for s in S[q]:
            if D[s][i%3] > i:
                D[s][i%3] = i
                if not s in hoge[:l]:
                    hoge[l] = s
                    l += 1
    queue = hoge[:l]
if D[T-1][0] == float('inf'):
    print(-1)
else:
    print(D[T-1][0]//3)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N,M = map(int,input().split())
S = [[]for i in range(N)]
for i in range(M):
    u,v = map(int,input().split())
    S[u-1].append(v-1)
St,T = map(int,input().split())

D = [[float('inf')]*3 for i in range(N)]
D[St-1][0] = 0
queue = [St-1]
i = 0
while queue != []:
    i += 1
    hoge = []
    for q in queue:
        for s in S[q]:
            if D[s][i%3] > i:
                D[s][i%3] = i
                if not s in hoge:
                    hoge.append(s)
    queue = hoge[:]
    if D[T-1][0] != float('inf'):
        break
if D[T-1][0] == float('inf'):
    print(-1)
else:
    print(D[T-1][0]//3)
### BUGGY CODE ###

def e_val(p_i):
  return (p_i+1)/2

n, k, *p = map(int, open(0).read().split())

max_e = 0
for i in range(n-k+1):
  e = 0
  
  for j in range(i, i+k):
    e += e_val(p[j])
  
  if e > max_e:
    max_e = e

print(max_e)

### FIXED CODE ###

n, k, *p = map(int, open(0).read().split())

q = []
for p_i in p:
  q.append((p_i+1)/2)
  
s = [0]
pre_s = 0
for q_i in q:
  pre_s += q_i
  s.append(pre_s)

ans = 0
for i in range(n-k+1):
  if ans < (s[i+k] - s[i]):
    ans = s[i+k] - s[i]
    
print(ans)
### BUGGY CODE ###

import sys

N=int(input())
st=0
en=N-1
print(st)
sys.stdout.flush()
s=input().split()
if s=="Vacant":
  sys.exit()
print(en)
sys.stdout.flush()
e=input().split()
if e=="Vacant":
  sys.exit()

def solve(a,b,c,d):
  x=(a+b)/2
  print(x)
  sys.stdout.flush()
  f=input().split()

  if f=="Vacant":
    return
  elif c!=f:
    solve(a,x,c,f)
  else:
    solve(x,b,f,d)

if solve(st,en,s,t):
  sys.exit()

### FIXED CODE ###

import sys

N=int(input())
st=0
en=N
print(st)
sys.stdout.flush()
s=input().split()
if s=="Vacant":
  sys.exit()
a=st
b=en
c=s
d=s

for i in range(19):
  x=(a+b)//2
  print(x)
  sys.stdout.flush()
  f=input().split()

  if f=="Vacant":
    sys.exit()
  elif (x-a)%2==0 and c!=f:
    b=x
    d=f
  elif (x-a)%2==0 and c==f:
    a=x
    c=f
  elif (x-a)%2==1 and c!=f:
    a=x
    c=f
  elif (x-a)%2==1 and c==f:
    b=x
    d=f
### BUGGY CODE ###

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

li = [i for i in range(a,b+1)]

count =0 
for j in range(len(li)):
    if(li[j]%x==0):
        count+=1
print(count)


### FIXED CODE ###

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

print(b//x-((a-1)//x))
### BUGGY CODE ###

import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
res  = 1
for i in range(n):
    res *= a[i]
if res > 10**18:
    print(-1)
    sys.exit()
print(res)

### FIXED CODE ###

import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
res  = 1
if 0 in a:
    print(0)
    sys.exit()

for i in range(n):
    res *= a[i]
    if res > 10**18:
        print(-1)
        sys.exit()
print(res)
### BUGGY CODE ###

N,K = map(int,input().split())
XYC = [list(map(int,input().split())) for _ in [0]*N]
def f(x,y,t):
    ret = 0
    for X,Y,C in XYC:
        if (C**2)*(((x-X)**2+(y-Y)**2))<=(t**2)+1e-7: ret += 1
    return ret

def get_cross_section(x1,y1,r1,x2,y2,r2):
    d = ((x1-x2)**2+(y1-y2)**2)**0.5
    if d > (r1+r2):return []
    X = (d*d+r1*r1-r2*r2)/(2*d)
    Y = max(0,(r1*r1-X*X))**0.5
    dx = (x2-x1)/d
    dy = (y2-y1)/d
    ret = [(x1+X*dx+Y*dy,y1+X*dy-Y*dx),(x1+X*dx-Y*dy,y1+X*dy+Y*dx)]
    return ret
def check(t):
    check = []
    for i in range(N):
        x1,y1,c1 = XYC[i]
        for j in range(N):
            if i==j:
                check.append((x1,y1))
                continue
            x2,y2,c2 = XYC[j]
            tmp = get_cross_section(x1,y1,t/c1,x2,y2,t/c2)
            for tmp2 in tmp:
                check.append(tmp2)

    for tmp in check:
        if f(tmp[0],tmp[1],t) >= K:return True
    return False

l=0
r=1000000
while abs(r-l)>1e-7 and abs(r-l)/r > 1e-7:
    i = (l+r)/2
    if check(i):
        r = i
    else:
        l = i
print(r)

### FIXED CODE ###

N,K = map(int,input().split())
XYC = [list(map(int,input().split())) for _ in [0]*N]
eps = 1e-7
def f(x,y,t):
    ret = 0
    for X,Y,C in XYC:
        if ((x-X)**2+(y-Y)**2)<=(t/C)**2+eps: ret += 1
    return ret

def get_cross_section(x1,y1,r1,x2,y2,r2):
    d = ((x1-x2)**2+(y1-y2)**2)**0.5
    X = (d*d+r1*r1-r2*r2)/(2*d)
    Y = max(0,(r1*r1-X*X))**0.5
    dx = (x2-x1)/d
    dy = (y2-y1)/d
    ret = [(x1+X*dx+Y*dy,y1+X*dy-Y*dx)]
    if Y>0 : ret.append((x1+X*dx-Y*dy,y1+X*dy+Y*dx))
    return ret
def check(t):
    kouho = []
    for i in range(N):
        x1,y1,c1 = XYC[i]
        kouho.append((x1,y1))
        for j in range(i+1,N):
            x2,y2,c2 = XYC[j]
            tmp = get_cross_section(x1,y1,t/c1,x2,y2,t/c2)
            for tmp2 in tmp:
                kouho.append(tmp2)
    for tmp in kouho:
        if f(tmp[0],tmp[1],t) >= K:return True
    return False

l=0
r=1000000
for _ in range(100):
    i = (l+r)/2
    if check(i):
        r = i
    else:
        l = i
print(r)