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

n = int(input())
ans = [float("INF")]*(n+1)

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

xcal = [[0]*n for i in range(1<<n)]
ycal = [[0]*n for i in range(1<<n)]

for i in range(1<<n):
    for j in range(n):
        xcal[i][j] = abs(l[j][0])
        ycal[i][j] = abs(l[j][1])
        for k in range(n):
            if (i>>k) & 1:
                xcal[i][j] = min(xcal[i][j],abs(l[j][0]-l[k][0]))
                ycal[i][j] = min(ycal[i][j],abs(l[j][1]-l[k][1]))
        xcal[i][j] *= l[j][2]
        ycal[i][j] *= l[j][2]

for i in range(1<<n):
    count = 0
    for j in range(n):
        if i >> j & 1:
            count += 1
    for j in range(i,-1,-1):
        j &= i
        cost = 0
        for k in range(n):
            if not (i>>k & 1):
                cost += min(xcal[j][k],ycal[i-j][k])
        ans[count] = min(ans[count],cost)

for i in ans:
    print(i)

### FIXED CODE ###

import sys
input = sys.stdin.readline
def main():
    n = int(input())
    l = [list(map(int,input().split())) for i in range(n)]

    xcal = [[0]*n for i in range(1<<n)]
    ycal = [[0]*n for i in range(1<<n)]

    for i in range(1<<n):
        for j in range(n):
            xcal[i][j] = abs(l[j][0])
            ycal[i][j] = abs(l[j][1])
            for k in range(n):
                if (i>>k) & 1:
                    xcal[i][j] = min(xcal[i][j],abs(l[j][0]-l[k][0]))
                    ycal[i][j] = min(ycal[i][j],abs(l[j][1]-l[k][1]))
            xcal[i][j] *= l[j][2]
            ycal[i][j] *= l[j][2]
    ans = [float("INF")]*(n+1)

    for i in range(1<<n):
        count = 0
        for j in range(n):
            if i >> j & 1:
                count += 1
        j = i
        while j >= 0:
            j &= i
            cost = 0
            for k in range(n):
                if not (i>>k & 1):
                    cost += min(xcal[j][k],ycal[i-j][k])
                if cost > ans[count]:
                    break
            ans[count] = min(ans[count],cost)
            j -= 1

    for i in ans:
        print(i)
if __name__ == "__main__":
    main()
### BUGGY CODE ###

H, W = map(int, input().split())
AB = []
for i in range(H):
  AB.append(list(map(int, input().split())))

for i in range(H):
  AB[i] = [abs(AB[i][j] - int(b)) for j, b in enumerate(input().split())]

K = 80*(H + W)
dp = [[[False]*K for w in range(W)] for h in range(H)]
dp[0][0][abs(AB[0][0])] = True


for h in range(H):
  for w in range(W):
    if h == 0:
      if w == 0:
        continue
      else:
        for k in range(K):
          ab = AB[h][w]
          k1, k2 = abs(k - ab), k + ab
          if k1 < K and k2 < K:
            dp[h][w][k] = dp[h][w-1][k1] or dp[h][w-1][k2]
          elif k1 < K and k2 >= K:
            dp[h][w][k] = dp[h][w-1][k1]
          else:
            dp[h][w][k] = dp[h][w-1][k2]
    else:
      if w == 0:
        for k in range(K):
          ab = AB[h][w]
          k1, k2 = abs(k - ab), k + ab
          if k1 < K and k2 < K:
            dp[h][w][k] = dp[h-1][w][k1] or dp[h-1][w][k2]
          elif k1 < K and k2 >= K:
            dp[h][w][k] = dp[h-1][w][k1]
          else:
            dp[h][w][k] = dp[h-1][w][k2]
      else:
        for k in range(K):
          ab = AB[h][w]
          k1, k2 = abs(k - ab), k + ab
          if k1 < K and k2 < K:
            dp[h][w][k] = dp[h][w-1][k1] or dp[h][w-1][k2] or dp[h-1][w][k1] or dp[h-1][w][k2]
          elif k1 < K and k2 >= K:
            dp[h][w][k] = dp[h][w-1][k1] or dp[h-1][w][k1]
          else:
            dp[h][w][k] = dp[h][w-1][k2] or dp[h-1][w][k2]

for k in range(K):
  if dp[H-1][W-1][k]:
    print(k)
    break

### FIXED CODE ###

H, W = map(int, input().split())
AB = []
max_ab = 0
for i in range(H):
  AB.append(list(map(int, input().split())))
  max_ab = max(max_ab, max(AB[-1]))

for i in range(H):
  AB[i] = [abs(AB[i][j] - int(b)) for j, b in enumerate(input().split())]

base = max_ab*(H + W)
dp = [[1 << base for w in range(W)] for h in range(H)]
dp[0][0] = (1 << base + AB[0][0]) | (1 << base - AB[0][0])
for h in range(1, H):
  dp[h][0] = (dp[h-1][0] << AB[h][0]) | (dp[h-1][0] >> AB[h][0])

for w in range(1, W):
  dp[0][w] = (dp[0][w-1] << AB[0][w]) | (dp[0][w-1] >> AB[0][w])

for h in range(1, H):
  for w in range(1, W):
    dp[h][w] = (
      (dp[h-1][w] << AB[h][w]) | (dp[h-1][w] >> AB[h][w]) 
      | (dp[h][w-1] << AB[h][w]) | (dp[h][w-1] >> AB[h][w]))

positive = bin(dp[H-1][W-1] >> base)
print(positive[::-1].find('1'))
### BUGGY CODE ###

e=enumerate
n,a=open(0)
d=[0]+[-1e18]*2000
for j,(a,i)in e(sorted((-int(a),i)for i,a in e(a.split()))):d=[max(t-a*(~i-j+k+int(n)),d[k-1]-a*abs(~i+k))for k,t in e(d)]
print(max(d))

### FIXED CODE ###

e=enumerate
n,*a=map(int,open(0).read().split())
dp=[0]
for j,(a,i)in e(sorted((a,i)for i,a in e(a))[::-1]):dp=[dp[0]+a*abs(n-j-i-1)]+[max(dp[k]+a*abs(n-j+k-i-1),dp[k-1]+a*abs(i-k+1))for k in range(1,j+1)]+[dp[j]+a*abs(i-j)]
print(max(dp))
### BUGGY CODE ###

import numpy as np
from collections import deque
import sys


sys.setrecursionlimit(10000)
h, w = map(int, input().split())
a = []
d = deque([])
memo = [[-1]*w for j in range(h)]
for i in range(h):
    a.append(list(input()))
    for j, s in enumerate(a[i]):
        if s == '#':
            d.append([i, j])
            memo[i][j] = 0


def d_list_update(d, hmax, wmax):
    move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
    dh, dw = d.popleft()
    for i, j in move:
        if (0 <= dh + i < hmax) and (0 <= dw + j < wmax):
            if memo[dh + i][dw + j] == -1:
                memo[dh + i][dw + j] = memo[dh][dw] + 1
                d.append([dh + i, dw + j])
    return d


while (d):
    d = d_list_update(d, h, w)
ans = np.amax(np.array(memo))
print(ans)

### FIXED CODE ###

from collections import deque
 
 
h, w = map(int, input().split())
hs, ws = set(range(h)), set(range(w))
d = deque()
memo = [[-1] * w for j in hs]
move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
a = tuple(input() for _ in hs)
b = [[i, j] for i in hs for j in ws if a[i][j] == '#']
for i, j in b:
    d.append((i, j))
    memo[i][j] = 0
while d:
    dh, dw = d.popleft()
    for i, j in move:
        dhn, dwn = dh + i, dw + j
        if (0 <= dhn < h) and (0 <= dwn < w) and (memo[dhn][dwn] < 0):
            d.append((dhn, dwn))
            memo[dhn][dwn] = memo[dh][dw] + 1
ans = max([max(e) for e in memo])
print(ans)
### BUGGY CODE ###

n=int(input())
lst=list(map(int,input().split()))
for i in range(1,n+1):
    print(lst.count(i))

### FIXED CODE ###

from collections import Counter

n=int(input())
lst=Counter(list(map(int,input().split())))
for i in range(1,n+1):
    if i in lst : print(lst[i])
    else : print(0)
### BUGGY CODE ###

n = int(input())

l = list(map(int,input().split()))
#print(l)

ans = 0
sv = []
for i in l:
    sv.append(i)
    if i <= min(sv):
        ans += 1

print(ans)

### FIXED CODE ###

n = int(input())

l = list(map(int,input().split()))
#print(l)

ans = 0
min_ = 999999
for i in l:
    if i <= min_:
        min_ = i
        ans += 1

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

#(縦, 横)
#bfs 徒歩→ワープ→徒歩→ワープ→…

h,w = map(int,input().split())
sy, sx = map(int,input().split())
start = (sy-1, sx-1)
gy, gx = (map(int,input().split()))
goal = (gy-1, gx-1)

chizu = [input() for _ in range(h)]
yukaset = set()

for i in range(h):
	for j in range(w):
		if chizu[i][j] == ".":
			yukaset.add((i, j))

settansaku = set()
stock = set()
setmada = {start}
mode = 1
cost = 0

while len(setmada) > 0:
	while len(setmada) > 0:
		for i, j in list(setmada):
			settansaku.add((i, j))
			stock.add((i, j))
			setmada.remove((i, j))
			for k in [(i+1, j), (i-1, j), (i, j-1), (i, j+1)]:
				if k in yukaset:
					if not k in settansaku:
						setmada.add(k)
								
	if goal in settansaku:
		mode = 0
		break
	
	cost += 1
	for i, j in list(stock):
		for k in [(i-2, j-2), (i-1, j-2), (i, j-2), (i+1, j-2), (i+2, j-2), (i-2, j-1), (i-1, j-1), (i, j-1), (i+1, j-1), (i+2, j-1), (i-2, j), (i-1, j), (i+1, j), (i+2, j), (i-2, j+1), (i-1, j+1), (i, j+1), (i+1, j+1), (i+2, j+1), (i-2, j+2), (i-1, j+2), (i, j+2), (i+1, j+2), (i+2, j+2)]:
			if k in yukaset:
				if not k in settansaku:
					setmada.add(k)
	
	stock=set()
	
	if goal in settansaku:
		mode = 0
		break

if mode == 0:
	print(cost)
else:
	print(-1)

### FIXED CODE ###

h,w = map(int,input().split())
sy, sx = map(int,input().split())
start = (sy-1, sx-1)
gy, gx = (map(int,input().split()))
goal = (gy-1, gx-1)

yukaset = set()

for i in range(h):
	chizu = input()
	for j in range(w):
		if chizu[j] == ".":
			yukaset.add((i, j))

settansaku = {start}
stock = []
listmada = [start]
mode = 1
cost = 0

while len(listmada) > 0:
	for i, j in listmada:
		stock.append((i, j))
		for k in [(i+1, j), (i-1, j), (i, j-1), (i, j+1)]:
			if k in yukaset:
				if k not in settansaku:
					listmada.append(k)
					settansaku.add(k)

	if goal in settansaku:
		mode = 0
		break
	
	listmada = []
	cost += 1
	for i, j in stock:
		for k in [(i-2, j-2), (i-1, j-2), (i, j-2), (i+1, j-2), (i+2, j-2), (i-2, j-1), (i-1, j-1), (i, j-1), (i+1, j-1), (i+2, j-1), (i-2, j), (i-1, j), (i+1, j), (i+2, j), (i-2, j+1), (i-1, j+1), (i, j+1), (i+1, j+1), (i+2, j+1), (i-2, j+2), (i-1, j+2), (i, j+2), (i+1, j+2), (i+2, j+2)]:
			if k in yukaset:
				if k not in settansaku:
					listmada.append(k)
					settansaku.add(k)
	
	stock = []

if mode == 0:
	print(cost)
else:
	print(-1)
### BUGGY CODE ###

m = list(map(int,input().split()))
a=[int(input()) for i in range(m[2])]

n = [0] * m[0]

b=list(set(a))
for i in range(len(b)):
    n[b[i]-1] = a.count(b[i])

  
for i in range(m[0]):
    if n[i] - m[2] + m[1] > 0:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

m = list(map(int,input().split()))
n = [0] * m[0]

for i in range(m[2]):
    n[int(input())-1] += 1
  
for i in range(m[0]):
    if n[i] - m[2] + m[1] > 0:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

K = int(input())
i = 1
N = 0
if K%2==0:
    print(-1)
    exit()
while(i<1000000):
    N += 7*(10**(i-1))
    if N%K == 0:
        print(i)
        exit()
    i += 1
print(-1)

### FIXED CODE ###

K = int(input())
i = 1
N = 0
if K%2==0:
    print(-1)
    exit()
while(i<1000000):
    N = N*10+7
    N %= K
    if N == 0:
        print(i)
        exit()
    i += 1
print(-1)
### BUGGY CODE ###

L, R = map(int,input().split())
ans = 2019
for i in range(L, R):
    for j in range(i+1, R+1):
        if (ans > i*j % 2019):
            ans = i*j % 2019
print(ans)

### FIXED CODE ###

L, R = map(int,input().split())
if R - L >= 2019:
    print(0)
else:
    ans = 2019
    print(min([i*j%2019 for i in range(L, R) for j in range(i+1, R+1)]))
### BUGGY CODE ###

x = int(input())
ans = 8
max = 599
min = 400
while True:
  if min <= x < max:
    print(ans)
    break
  else:
    max += 200
    min += 200
    ans -= 1

### FIXED CODE ###

x = int(input())
ans = 8
max = 599
min = 400
while True:
  if min <= x <= max:
    print(ans)
    break
  else:
    max += 200
    min += 200
    ans -= 1
### BUGGY CODE ###

n, k = map(int,input().split())
a = list(map(int, input().split()))
dst = [1]
ans = 1
for _ in range(k):
    if a[ans - 1] not in set(dst):
        dst.append(a[ans - 1])
        ans = a[ans - 1]
    else:
        index = dst.index(a[ans - 1])
        ld = len(dst[:index])
        cyc = len(dst[index:])
        print(dst[(ld - 1) + (k + 1 - ld) % cyc] if (k + 1 - ld) % cyc != 0 else dst[-1])
        exit()
print(dst[-1])

### FIXED CODE ###

n, k = map(int,input().split())
a = list(map(int, input().split()))
flg = [True] * n
dst = [1]
twn = 0
for _ in range(k):
    if flg[twn]:
        dst.append(a[twn])
        flg[twn] = False
        twn = a[twn] - 1
    else:
        index = dst.index(a[twn])
        ld = len(dst[:index])
        cyc = len(dst[index:])
        print(dst[(ld - 1) + (k + 1 - ld) % cyc] if (k + 1 - ld) % cyc != 0 else dst[-1])
        exit()
print(dst[-1])
### BUGGY CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
for i in range(n-k+1):
    sum_p = sum([p[i+j] for j in range(k)])
    ans = max(ans, (sum_p+k)/2)

print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
P = list(map(int, input().split()))
kitai = [(p+1)/2 for p in P]
kitai_cum = [kitai[0]] * (n + 1)
for i in range(n):
    kitai_cum[i+1] = kitai_cum[i] + kitai[i]
ans = 0
for i in range(n-k+1):
    ans = max(ans, kitai_cum[i+k]-kitai_cum[i])
print(ans)
### BUGGY CODE ###

import itertools
import copy

N,K=map(int,input().split())
A=list(map(int,input().split()))
mod=10**9+7

NOW=[0]*(K+1)
NOW[0]=1#そこまでi個使ったときの場合の数


for a in A:
    NEXT=[0]*(K+1)
    NOWSUM=list(itertools.accumulate(NOW))
    NEXT=copy.copy(NOWSUM)
    #print(NEXT)

    for j in range(a+1,K+1):
        NEXT[j]=(NEXT[j]-NOWSUM[j-a-1])%mod


    NOW=NEXT
    #print(NOWSUM,NOW)

print(NOW[K]%mod)

### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
mod=10**9+7

NOW=[0]*(K+1)
NOW[0]=1#そこまでi個使ったときの場合の数


for i in range(N):
    NEXT=[0]*(K+1)
    NOWSUM=[0]
    for n in NOW:
        NOWSUM.append(NOWSUM[-1]+n)
        
    for j in range(K+1):
        NEXT[j]=(NEXT[j]+NOWSUM[j+1]-NOWSUM[max(0,j-A[i])])%mod

    NOW=NEXT
    #print(NOWSUM,NOW)

print(NOW[K])
### BUGGY CODE ###

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

base = int(1e9+7)
tot = 0

for i in range(N-1):
    for j in range(i+1, N):
        # print(i,j)
        tot += A[i]*A[j]
        tot %= base
print(tot)


### FIXED CODE ###

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

base = int(1e9+7)
tot = 0

s = 0
for a in A:
    tot += s*a
    s += a
    tot %= base

print(tot)
### BUGGY CODE ###

n,k=map(int,input().split())
mod=998244353
r=[]
l=[]
for _ in range(k):
  l_,r_=map(int,input().split())
  l.append(l_)
  r.append(r_)
dp=[0]*n
dp[0]=1
dpsum=[0]*n
dpsum[0]=1
for i in range(1,n):
  for j in range(k):
    li=i-r[j]
    ri=i-l[j]
    if ri>=0:
      li=max(li,0)
      dp[i]+=dpsum[ri]-dpsum[li-1]
  dpsum[i]=dpsum[i-1]+dp[i]
print(dp[n-1]%mod)

### FIXED CODE ###

n,k=map(int,input().split())
mod=998244353
l=[0]*n
r=[0]*n
for i in range(k):
  l[i],r[i]=map(int,input().split())
dp=[0]*(n+10)
dp[0]=1
sumdp=[0]*(n+10)
sumdp[1]=1
for i in range(1,n):
  for j in range(k):
    li=max(0,i-r[j])
    ri=max(0,i-l[j]+1)
    dp[i]+=sumdp[ri]-sumdp[li]
  sumdp[i+1]=(sumdp[i]+dp[i])%mod
print(dp[n-1]%mod)
### BUGGY CODE ###

n, y = map(int, input().split())
y /= 1000
flag = 0

a = 0
while 10*a <= y:
  b = 0
  while 5*b + 10*a <=y:
    r = y - 10*a - 5*b
    if n == a + b + r:
      print(a, b, int(r))
      flag = 1
      break
    b += 1
  if flag == 1:
    break
  a += 1
  
if flag == 0:
  print(-1, -1, -1)
  
    
  

### FIXED CODE ###

n,y = map(int,input().split())
y //= 1000
flag = False

for k in range(0,n+1):
  a = n-k
  b = y-10*k-a
  if b%4 == 0 and b <= 4*a and b>=0:
    flag = True
    break
    
if flag:
  print(k,b//4,a-b//4)
else:
  print(-1,-1,-1)
### BUGGY CODE ###

a, b = [int(i) for i in input().split()]
ans = 0
for i in range(b-a+1):
  ans = ans ^ (a + i)
print(ans)

### FIXED CODE ###

import math

def cnt1(a, i):
    return (a//(2**i)) * 2**(i-1) + max(0, a%(2**i) - 2**(i-1))

A, B = [int(i) for i in input().split()]
if B == 0:
    ans = '0'
else:
    top = int(math.log2(B))+1


    ans = ''
    for i in range(1, top+1):
        cntB = cnt1(B+1, i)
        cntA = cnt1(A, i)
        ans += str((cntB-cntA)%2)

    ans = ans[::-1]
print(int(ans, 2))
### BUGGY CODE ###

import sys

sys.stdin.readline()
a = list(map(int, sys.stdin.readline().split()))

a = [x for x in a if x % 2 == 0]

cnt = 0
while True:
    a.sort(reverse=True)
    flag = True
    for i, v in enumerate(a):
        if flag and v % 2 == 0:
            a[i] //= 2
            flag = False
        else:
            a[i] *= 3
    if flag:
        break
    cnt += 1
print(cnt)

### FIXED CODE ###

import math
import sys

sys.stdin.readline()
a = list(map(int, sys.stdin.readline().split()))

a = [x for x in a if x % 2 == 0]

cnt = 0
for x in a:
    while x % 2 == 0:
        x //= 2
        cnt += 1

print(cnt)
### BUGGY CODE ###

import re
N, Q = map(int, input().split())
S = input()
lr = []
for i in range(Q):
    k = map(int, input().split())
    lr.append(k)

index = []
result = re.finditer('AC', S)
for r in result:
    index.append(r.start())

for i in range(Q):
    count = 0
    l, r = lr[i]
    for ind in index:
        if ind in range(l-1, r-1):
            count += 1
    print(count)


### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
	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])
### BUGGY CODE ###

K, S = list(map(int, input().rstrip().split()))

n = 0
for x in range(K + 1):
    for y in range(K + 1):
        if x + y > S:
            break

        for z in range(K + 1):
            if x + y + z > S:
                break

            if (x + y + z) == S:
                n += 1

print(n)


### FIXED CODE ###

K, S = list(map(int, input().rstrip().split()))

n = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z and z <= K:
            n += 1

print(n)
### BUGGY CODE ###

def solve(string):
    s, k = string.split()
    g = []
    for i in range(len(s)):
        for j in range(i + 1, len(s) + 1):
            g.append(s[i:j])
    g = sorted(set(g))
    return g[int(k)-1]


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


### FIXED CODE ###

from collections import Counter


def solve(string):
    s, k = string.split()
    """
    g = []
    for i in range(len(s)):
        for j in range(i + 1, len(s) + 1):
            g.append(s[i:j])
    g = sorted(set(g))
    return g[int(k)-1]
    """
    k = int(k)
    count = Counter(s)
    chars = sorted(set(s))
    for t in range(min(3, len(chars))):
        tmp = []
        i = s.index(chars[t])
        tmp.append(s[i:i + 5])
        if count[chars[t]] > 1:
            for _ in range(count[chars[t]] - 1):
                i = s.index(chars[t], i + 1)
                tmp.append(s[i:i + 5])
        g = []
        for p in tmp:
            for j in range(1, len(p) + 1):
                g.append(p[:j])
        g = sorted(set(g))
        if len(g) < k:
            k -= len(g)
            continue
        return g[k - 1]


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))
### BUGGY CODE ###

N = int(input())
S = input()
R = 0
G = 0
B = 0
notToAllow = 0


for i in range(0,N):
    if S[i] == "R":
        R = R + 1
    elif S[i] == "G":
        G = G + 1
    else:
        B = B + 1

total = R*G*B

for i in range(0,N):
    for j in range(0,(N//2)+1):
        if(j+j+i < N):
            if ((S[i] != S[i+j]) and (S[i] != S[i+j+j]) and (S[i+j] != S[i+j+j])):
                notToAllow = notToAllow + 1

print(R*G*B - notToAllow)


### FIXED CODE ###

N = int(input())
S = input()
R = 0
G = 0
B = 0
notToAllow = 0


for i in range(0,N):
    if S[i] == "R":
        R = R + 1
    elif S[i] == "G":
        G = G + 1
    else:
        B = B + 1

total = R*G*B

for i in range(0,N):
    for j in range(0,(N//2)+1):
        if(j+j+i < N):
            if ((S[i] != S[i+j])):
                if(S[i] != S[i+j+j]):
                    if(S[i+j] != S[i+j+j]):
                        notToAllow = notToAllow + 1

print(R*G*B - notToAllow)
### BUGGY CODE ###

#!/usr/bin/env python3
#ABC68 C

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

s = []
g = []
for _ in range(m):
    a,b = map(int,input().split())
    if a == 1:
        s.append(b)
    if b == n:
        g.append(a)
f = 0
s = list(set(s))
g = list(set(g))
for i in range(len(s)):
    if s[i] in g:
        f = 1
if f:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


### FIXED CODE ###

#!/usr/bin/env python3
#ABC68 C

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

s = [0]*(200000+1)
g = [0]*(200000+1)
for _ in range(m):
    a,b = map(int,input().split())
    if a == 1:
        s[b] += 1
    if b == n:
        g[a] += 1
f = 0
for i in range(200000+1):
    if s[i] & g[i]:
        f = 1
        break
if f:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
### BUGGY CODE ###

N,K = map(int,input().split())
List = list(map(int,input().split()))

def sm(lst, j, k):
  res = 0
  for i in range(j, j+k):
    res += lst[i]
  return res

def max(lst, k):
  res = 0
  for i in range(N-k+1):
    if res < sm(lst, i, k):
      res = sm(lst, i, k)
  res = (res+k)/2
  return res

print(max(List, K))
    

### FIXED CODE ###

N,K = map(int,input().split())
List = list(map(int,input().split()))

def sm(lst, j, k):
  return lst[j+k]-lst[j]

def max(lst, k):
  sumlst = [0]
  for i in range(len(lst)):
    sumlst.append(sumlst[i]+lst[i])
  res = 0
  for i in range(N-k+1):
    if res < sm(sumlst, i, k):
      res = sm(sumlst, i, k)
  res = (res+k)/2
  return res

print(max(List, K))
### BUGGY CODE ###

N=int(input())
L=list(map(int,input().split()))
counter=0
L.sort()
for i in range(len(L)):
    for j in range(i+1,len(L)-1):
        l=j
        r=len(L)-1
        c=(r+l)//2
        while abs(r-l)>1:    
            if L[i]>abs(L[c]-L[j]):
                b=c
                c=(r+c)//2
                l=b
            else:
                b=c
                c=(c+l)//2
                r=b
        if L[i]-abs(L[l]-L[j])>0 and L[i]-abs(L[r]-L[j])>0:
            c=r
        elif L[i]-abs(L[l]-L[j])>0 and L[i]-abs(L[r]-L[j])<0:
            c=l
        if L[i]>abs(L[c]-L[j]):
            counter+=c-j
print(counter)
    



### FIXED CODE ###


N=int(input())
L=list(map(int,input().split()))
counter=0
L.sort()
for i in range(N-2):
    k=i+2
    for j in range(i+1,N-1):    
        while k < N and L[k] < L[i] + L[j]:
            k += 1
        counter += k - j -1
print(counter)
### BUGGY CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def calcSum(n, A):
    return n

def main():
    N, K = map(int, readline().split())
    A = list(map(int, readline().split()))

    l = [0] * (N + 1)
    for i in range(K, N + 1):
        pi = 1
        for j in range(i - K + 1, i + 1):
           pi *= A[j - 1]
        l[i] = pi
        if (i != K):
            if (l[i - 1] < l[i]):
                print("Yes")
            else:
                print("No")
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def calcSum(n, A):
    return n

def main():
    N, K = map(int, readline().split())
    A = list(map(int, readline().split()))

    for i in range(K + 1, N + 1): # K + 1 から N までのループ
        if (A[i - K - 1] < A[i - 1]):
            print("Yes")
        else:
            print("No")
    return

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

import math
n,m=map(int,input().split())
ans=math.factorial(m)*math.factorial(n)
if n==m:
  ans*=2
elif abs(n-m)>1:
  ans=0
print(ans)


### FIXED CODE ###

import math
n,m=map(int,input().split())
ans=math.factorial(m)*math.factorial(n)%(10**9+7)
if n==m:
  ans*=2
  ans%=(10**9+7)
elif abs(n-m)>1:
  ans=0
print(ans)
### BUGGY CODE ###

from bisect import bisect_right
n = int(input())
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))
c = sorted(map(int, input().split()))
cnt = 0
for i in range(n):
    x1 = bisect_right(b, a[i])
    for j in range(x1, n):
        cnt += (n-bisect_right(c, b[j]))
print(cnt)

### FIXED CODE ###

from bisect import bisect_right
from bisect import bisect_left

n = int(input())
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))
c = sorted(map(int, input().split()))
cnt = 0
bn = []
for i in range(n):
    x1 = bisect_left(a, b[i])
    x2 = bisect_right(c, b[i])
    cnt += x1*(n-x2)
print(cnt)