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

#!/usr/bin/env python3

def main():
    na = list(map(int, input().split()))
    N = na[0]
    K = na[1]
    x = []
    y = []
    c = []
    for i in range(N):
        sa = input().split()
        x.append(int(sa[0]))
        y.append(int(sa[1]))
        c.append(True if sa[2] == 'W' else False)

    hopes = [[0 for j in range(K * 2)] for i in range(K * 3)]
    xsum = [0 for j in range(K * 2)]
    ysum = [[0 for j in range(K * 2)] for i in range(K * 3)]

    for i in range(N):
        if c[i]:
            x[i] += K
        xmod = x[i] % (K * 2)
        ymod = y[i] % (K * 2)
        if K <= xmod and K <= ymod:
            xmod -= K
            ymod -= K
        elif K <= ymod:
            xmod += K
            ymod -= K

        hopes[xmod][ymod] += 1
        if xmod < K:
            hopes[xmod + K][ymod + K] += 1
            hopes[xmod + K * 2][ymod] += 1
        else:
            hopes[xmod - K][ymod + K] += 1
            hopes[xmod + K][ymod + K] += 1

    for j in range(K * 2):
        for i in range(K):
            xsum[j] += hopes[i][j]
    for i in range(K):
        ysum[i][0] = ysum[i + K * 2][0] = s = sum(hopes[i][:K])
        for j in range(1, K):
            s += (hopes[i][j + K - 1] - hopes[i][j - 1])
            ysum[i][j] = ysum[i + K * 2][j] = s
    for i in range(K, K * 2):
        ysum[i][0] = s = sum(hopes[i][:K])
        for j in range(1, K):
            s += (hopes[i][j + K - 1] - hopes[i][j - 1])
            ysum[i][j] = s

    h0 = []
    hmax = h = sum(xsum[:K])
    h0.append(h)
    for j in range(1, K):
        h += (xsum[j + K - 1] - xsum[j - 1])
        hmax = max(hmax, h)
        h0.append(h)
    for j in range(K):
        h = h0[j]
        for i in range(1, K * 2):
            h += (ysum[i + K - 1][j] - ysum[i - 1][j])
            hmax = max(hmax, h)

    print(hmax)


if __name__ == '__main__':
    main()



### FIXED CODE ###

#!/usr/bin/env python3

def main():
    na = list(map(int, input().split()))
    N = na[0]
    K = na[1]
    x = []
    y = []
    c = []
    for i in range(N):
        sa = input().split()
        x.append(int(sa[0]))
        y.append(int(sa[1]))
        c.append(True if sa[2] == 'W' else False)

    hopes = [[0 for j in range(K)] for i in range(K)]
    ysum = [[0 for j in range(K * 2)] for i in range(K)]

    score = 0
    for i in range(N):
        xmod = x[i] % K
        ymod = y[i] % K
        f = (int(x[i] / K) + int(y[i] / K)) % 2 == 1
        c[i] ^= f
        if c[i]:
            score += 1
        h = -1 if c[i] else 1
        hopes[xmod][ymod] += h

    for i in range(K):
        s = 0
        for j in range(K):
            s += hopes[i][j]
            ysum[i][j] = s
        for j in range(K):
            s -= hopes[i][j]
            ysum[i][K + j] = s

    smax = 0
    for j in range(K):
        s = 0
        for i in range(K):
            s += ysum[i][K + j]
        for i in range(K):
            s += (ysum[i][j] - ysum[i][K + j])
            smax = max(smax, s)
        for i in range(K):
            s -= (ysum[i][j] - ysum[i][K + j])
            smax = max(smax, s)

    print(score + smax)


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

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from copy import copy 
def main():
    S = readline().decode().rstrip()    
    P = int(1e9)+7
    dp = [0 for _ in range(13)]
    dp[0] = 1
    mul = 1
    for s in reversed(S):
        nxDP = [0 for _ in range(13)]
        if s == '?':
            for i in range(10):
                for j in range(13):
                    nxr = (i*mul+j)%13
                    nxDP[nxr] += dp[j]
                    nxDP[nxr] %= P
        else:
            for j in range(13):
                nxr = ((ord(s)-ord('0'))*mul+j)%13
                nxDP[nxr] += dp[j]
                nxDP[nxr] %= P
        dp = copy(nxDP)
        mul *= 10
        mul %= 13

    print(dp[5])
if __name__ == '__main__':
    main()

### FIXED CODE ###

from copy import copy
MOD = int(1e9)+7

def main():
    s = input()
    n = len(s)
    dp = [0 for _ in range(13)]
    dp[0] = 1 
    mul = 1
    for i in reversed(range(n)):
        nextDP = [0 for _ in range(13)]
        if s[i] == '?':
            for j in range(13):
                for k in range(10):
                    nextDP[(k*mul + j)%13] += dp[j]
                    nextDP[(k*mul + j)%13] %= MOD
        else:
            x = ord(s[i]) - ord('0')
            for j in range(13):
                nextDP[(x*mul + j)%13] += dp[j]
                nextDP[(x*mul + j)%13] %= MOD
        dp = copy(nextDP)
        mul *= 10
        mul %= 13
    print(dp[5])
main()
### BUGGY CODE ###

N = int(input())
# N, K = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(N - 1)]

ans = [-1] * N
W = [[0 for __ in range(N)] for _ in range(N)]
P = [set() for _ in range(N)]
for l in L:
    u, v, w = l
    W[u - 1][v - 1] = w
    P[u - 1].add(v - 1)
    P[v - 1].add(u - 1)

ans[0] = 0
F = [0] * (N + 1)
it = 0
po = 1
already = set()
for _ in range(N + 1):
    if it > po:
        break
    u = F[it]
    it += 1
    for v in (P[u] - already):
        w = W[u][v] if u < v else W[v][u]
        ans[v] = ans[u] if w % 2 == 0 else 1 - ans[u]
        F[po] = v
        already.add(v)
        po += 1

for a in ans:
    print(a)



### FIXED CODE ###

import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def f(N):
    res = 0
    while N != 0:
        b = format(N, "b").count("1")
        N %= b
        res += 1
    return res


def main():
    N = int(input())
    F = [[] for _ in range(N)]

    for _ in range(N - 1):
        u, v, w = read_values()
        u -= 1
        v -= 1
        F[u].append((v, w % 2))
        F[v].append((u, w % 2))

    D = [0] * N
    stack = [(0, 0, -1)]

    while stack:
        a, d, p = stack.pop()
        D[a] = d % 2

        for b, w in F[a]:
            if b == p:
                continue
            stack.append((b, (d + w) % 2, a))
    
    for d in D:
        print(d)


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

N = int(input())
a = input().split()
numbers = [int(n) for n in a]
product = 1
for i in range(N):
    product *= numbers[i]
if product > 10 ** 18:
    print('-1')
else:
    print(product)

### FIXED CODE ###

N = int(input())
a =[int(n) for n in input().split()]

product = 1
if 0 in a:
    print(0)
else:
    for i in range(N):
        product *= a[i]
        if product > 10 ** 18:
            print('-1')
            break
    if product <= 10 ** 18:
        print(product)
### BUGGY CODE ###

def main():
    from heapq import heappush, heappop

    WHITE = 0
    BLACK = 1

    CHAR = '.', '#'

    H, W = map(int, input().split())
    s = [input() for _ in range(H)]

    h = []
    x = CHAR.index(s[0][0])
    heappush(h, (x, 0, 0, x))

    while h:
        cnt, r, c, mode = heappop(h)
        if r == H - 1 and c == W - 1:
            print(cnt)
            return

        if r < H - 1:
            if s[r + 1][c] == CHAR[mode]:
                heappush(h, (cnt, r + 1, c, mode))
            else:
                heappush(h, (cnt + int(mode == WHITE), r + 1, c, 1 - mode))

        if c < W - 1:
            if s[r][c + 1] == CHAR[mode]:
                heappush(h, (cnt, r, c + 1, mode))
            else:
                heappush(h, (cnt + int(mode == WHITE), r, c + 1, 1 - mode))


if __name__ == '__main__':
    main()

# import sys
#
# input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 7)
# rstrip()
# int(input())
# map(int, input().split())


### FIXED CODE ###

def main():
    from collections import deque

    WHITE = 0
    BLACK = 1

    CHAR = '.', '#'

    H, W = map(int, input().split())
    s = [input() for _ in range(H)]

    h = deque()
    x = CHAR.index(s[0][0])
    h.append((x, 0, 0, x))

    cost = [[H * W] * W for _ in range(H)]
    cost[0][0] = x

    while h:
        cnt, r, c, mode = h.popleft()
        if cnt > cost[r][c]:
            continue
        if r == H - 1 and c == W - 1:
            print(cnt)
            return

        delta = int(mode == WHITE)
        ncnt = cnt + delta

        if r < H - 1:
            if s[r + 1][c] == CHAR[mode]:
                if cnt < cost[r + 1][c]:
                    cost[r + 1][c] = cnt
                    h.appendleft((cnt, r + 1, c, mode))
            else:
                if delta:
                    if ncnt < cost[r + 1][c]:
                        cost[r + 1][c] = ncnt
                        h.append((ncnt, r + 1, c, 1 - mode))
                else:
                    if ncnt < cost[r + 1][c]:
                        cost[r + 1][c] = ncnt
                        h.appendleft((ncnt, r + 1, c, 1 - mode))

        if c < W - 1:
            if s[r][c + 1] == CHAR[mode]:
                if cnt < cost[r][c + 1]:
                    cost[r][c + 1] = cnt
                    h.appendleft((cnt, r, c + 1, mode))
            else:
                if delta:
                    if ncnt < cost[r][c + 1]:
                        cost[r][c + 1] = ncnt
                        h.append((ncnt, r, c + 1, 1 - mode))
                else:
                    if ncnt < cost[r][c + 1]:
                        cost[r][c + 1] = ncnt
                        h.appendleft((ncnt, r, c + 1, 1 - mode))


if __name__ == '__main__':
    main()

# import sys
#
# input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 7)
# rstrip()
# int(input())
# map(int, input().split())
### BUGGY CODE ###

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

cost=10**10

Plus=[i for i in X if i>=0]
Minus=[-i for i in X if i<=0]

if len(Plus)>=K:
    cost=Plus[K-1]
if len(Minus)>=K:
    cost=min(cost,Minus[-K])

i=0
while X[i]<0 and i+K-1<N:
    L=[j-X[i] for j in X]
    cost=min(cost,L[i+K-1]+abs(X[i]))
    i+=1

print(cost)

### FIXED CODE ###

N,K=map(int,input().split())
X=list(map(int,input().split()))
X.sort()
ans=10**10

for i in range(N-K+1):
    R=X[i+K-1]
    L=X[i]
    A=[ans, abs(L)+abs(R-L), abs(R)+abs(R-L)]
    ans=min(A)

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

from collections import deque
import sys
input = sys.stdin.readline
N,M,L = map(int,input().split())
load = [[]for i in range(N)]
for _ in range(M):
    a,b,c = map(int,input().split())
    if c <= L:
        load[a-1].append([b-1,c])
        load[b-1].append([a-1,c])
cost =[[float('inf')]*N for i in range(N)]
for i in range(N):
    queue = deque([i])
    cost[i][i] = 0
    while(queue):
        q = queue.popleft()
        gas = cost[i][q]
        for t,c in load[q]:
            if gas//L < (gas+c-1)//L :
                newc = (gas//L+1)*L+c
            else:
                newc = gas+c
            if newc < cost[i][t]:
                cost[i][t] = newc
                queue.append(t)
Q = int(input())
for _ in range(Q):
    s,t = map(int,input().split())
    ans = cost[s-1][t-1]
    if ans == float('inf'):
        print(-1)
    else:
        print((ans-1)//L)
     


### FIXED CODE ###

import sys
imput = sys.stdin.readline
def func(d):
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])
    return d
N,M,L = map(int,input().split())
road = [[10**10]*N for i in range(N)]
for i in range(N):
    road[i][i] = 0
for i in range(M):
    a,b,c = map(int,input().split())
    road[a-1][b-1] = c
    road[b-1][a-1] = c
road = func(road)
ans = [[10**5]*N for i in range(N)]
for i in range(N):
    for j in range(N):
        if road[i][j] <= L:
            ans[i][j] = 1
ans = func(ans)
for i in range(int(input())):
    a,b = map(int,input().split())
    o = ans[a-1][b-1]
    if o == 10**5:
        print(-1)
    else:
        print(o-1)
### BUGGY CODE ###

import numpy as np
inputs = open(0).readlines()

h, w, k = map(int, inputs[0].split())
cake = np.zeros((h, w), dtype=np.int)
count = 0
coords = {}
for i, s in enumerate(inputs[1:]):
    for j, c in enumerate(s):
        if c == '#':
            count += 1
            cake[i, j] = count
            coords[count] = (j, i)
            
for i in range(1, count+1):
    x, y = coords[i]
    min_x = max_x = x
    min_y = max_y = y
    while 0 <= min_x-1 and cake[y, min_x-1] == 0:
        cake[y, min_x-1] = i
        min_x -= 1
    while max_x+1 < w and cake[y, max_x+1] == 0:
        cake[y, max_x+1] = i
        max_x += 1
    while 0 <= min_y-1 and np.all(cake[min_y-1, min_x:max_x+1] == 0):
        cake[min_y-1, min_x:max_x+1] = i
        min_y -= 1
    while max_y+1 < h and np.all(cake[max_y+1, min_x:max_x+1] == 0):
        cake[max_y+1, min_x:max_x+1] = i
        max_y += 1

for rows in cake:
    print(*rows)

### FIXED CODE ###

import numpy as np
inputs = open(0).readlines()

def main(inputs):
    h, w, k = map(int, inputs[0].split())
    cake, count, coords = np.zeros((h, w), dtype=np.uint), 0, {}
    for i, s in enumerate(inputs[1:]):
        for j, c in enumerate(s):
            if c == '#':
                count += 1
                cake[i, j] = count
                coords[count] = (j, i)
    empty_rows = {i for i, rows in enumerate(cake) if not np.any(rows)}

    for i in range(1, count+1):
        x, y = coords[i]
        x0, y0 = x-1, y-1
        x1, y1 = x+1, y+1
        while 0 <= x0 and cake[y, x0] == 0:
            cake[y, x0] = i
            x0 -= 1
        x0 += 1
        while x1 < w and cake[y, x1] == 0:
            cake[y, x1] = i
            x1 += 1
        while 0 <= y0 and y0 in empty_rows:
            cake[y0, x0:x1] = i
            y0 -= 1
        while y1 < h and y1 in empty_rows:
            cake[y1, x0:x1] = i
            y1 += 1

    for rows in cake:
        print(*rows)

main(inputs)
### BUGGY CODE ###

def prime_factorize(n):
    """Calculate prime factorization and return unique numbers and 1.
    """
    ans = set()
    ans_add = ans.add
    ans_add(1)
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    x = int(input())
    # 素因数分解してユニークな因数を取る。
    insu = prime_factorize(x)
    # a^5 - b^5 も a - b も，ある因数の倍数となる。

    # a は足す一方なので，
    b_min = -int(x ** (1 / 5))
    for n in insu:
        b = b_min
        while 1:
            a = b
            while 1:
                a += n
                cand = a ** 5 - b ** 5
                if cand == x:
                    return f'{a} {b}'
                elif cand > x:
                    break
            b += 1


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


### FIXED CODE ###

def prime_factorize(n):
    """Calculate prime factorization and return unique numbers and 1.
    """
    ans = set()
    ans_add = ans.add
    ans_add(1)
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    x = int(input())
    # 素因数分解してユニークな因数を取る。
    insu = prime_factorize(x)
    # a^5 - b^5 も a - b も，ある因数の倍数となる。
    # ここは a >= b と仮定すると，a は正でなくては，xが負になっちゃう。

    b_min = -int(x ** (1 / 5))
    for n in insu:
        b = b_min
        while 1:
            a = b
            while 1:
                a += n
                if a < 0:
                    continue
                cand = a ** 5 - b ** 5
                if cand == x:
                    return f'{a} {b}'
                elif cand > x:
                    break
            b += 1
            if (b + n) ** 5 - b ** 5 > x:
                break


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

import collections

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

path = [[False for i in range(N)] for j in range(N)]
detect_start = [[False for i in range(N)] for j in range(N)]
for i in range(M) :
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    path[a][b] = True
    detect_start[b][a] = True

start = []
for i in range(N) :
    for j in range(N) :
        if detect_start[i][j] :
            break
    else :
        start.append(i)

ans = 0

for i in range(len(start)) :
    q = collections.deque()
    q.append(start[i])
    dist = [0 for i in range(N)]
    
    while q :
        now = q.pop()
        for j in range(N) :
            if path[now][j] :
                q.append(j)
                dist[j] = max(dist[j], dist[now]+1)
    
    ans = max(ans, max(dist))

print(ans)



### FIXED CODE ###

N,M = map(int,input().split())
L = [list(map(int,input().split())) for i in range(M)]

L_minus = [[] for i in range(N)]
L_plus = [0 for i in range(N)]

dp = [0 for i in range(N)]

for i in range(M) :
    x,y = L[i]
    x -= 1
    y -= 1
    L_plus[y] += 1
    L_minus[x].append(y)

A = []

for i in range(N) :
    if L_plus[i] == 0 :
        A.append(i)

while A :
    x = A.pop()
    
    for y in L_minus[x] :
        L_plus[y] -= 1
        if L_plus[y] == 0 :
            A.append(y)
        dp[y] = max(dp[y], dp[x]+1)

ans = max(dp)

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

S = [int(i) for i in input()]
S.reverse()
lst = []
_sum = 0

for i in range(len(S)):
    _sum = (_sum + S[i] * 10**i % 2019) % 2019
    lst.append(_sum)
    
ans = lst.count(0)
for i in set(lst):
    c = lst.count(i)
    ans += c*(c-1)//2
   
print(ans)    



### FIXED CODE ###

from collections import Counter

S = [int(i) for i in input()]
S.reverse()
lst = []
_sum = 0

for i in range(len(S)):
    _sum = (_sum + S[i] * pow(10,i,2019)) % 2019
    lst.append(_sum)
    
C = Counter(lst)    
ans = C[0]

for i in C:
    ans += C[i]*(C[i]-1)//2
print(ans)
### BUGGY CODE ###

import itertools

def main():
    N, M, R = map(int, input().split())
    RR = tuple(map(int, input().split()))
    ABC = {tuple(map(int, input().split())) for _ in range(M)}

    dist = [[float('inf') for i in range(N + 1)] for j in range(N + 1)]
    for a, b, c in ABC:
        dist[a][b] = dist[b][a] = c
    for k, i, j in itertools.product(range(N + 1), repeat=3):
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

    ans = float('inf')
    for r in itertools.permutations(RR):
        move = 0
        for i in range(R - 1):
            a = r[i]
            b = r[i+1]
            move += dist[a][b]
        ans = min(ans, move)

    print(ans)

main()


### FIXED CODE ###

import itertools

def main():
    N, M, R = map(int, input().split())
    RR = tuple(map(int, input().split()))
    ABC = {tuple(map(int, input().split())) for _ in range(M)}

    dist = [[float('inf')] * (N + 1) for j in range(N + 1)]
    for a, b, c in ABC:
        dist[a][b] = dist[b][a] = c
        dist[a][a] = dist[b][b] = 0
    for k in range(1, N + 1):
        for i in range(1, N + 1):
            for j in range(1, N + 1):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

    ans = float('inf')
    for r in itertools.permutations(RR):
        move = 0
        for i in range(R - 1):
            a = r[i]
            b = r[i+1]
            move += dist[a][b]
        ans = min(ans, move)

    print(ans)

main()
### BUGGY CODE ###

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

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

X = A[0]
for i in range(1, N):
    X = X // gcd(X, A[i]) * A[i]

output = 0
for i in range(N):
    output += X*pow(A[i],10**9+5,10**9+7)%(10**9+7)
    output = output % (10**9+7)
print(output)

### FIXED CODE ###

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))
### BUGGY CODE ###

import itertools

n, k = map(int, input().split())
alist = sorted(list(map(int, input().split())))
alist_rev = alist[::-1]
divide = 10**9 + 7

def comb(s, n):
    return len(list(itertools.combinations(s, n)))

amax = 0
i = 0
while i <= n-k:
    amax += alist_rev[i] * comb(alist_rev[i+1:], k-1)
    i += 1

amin = 0
i = 0
while i <= n-k:
    amin += alist[i] * comb(alist[i+1:], k-1)
    i += 1

print((amax - amin) % divide)


### FIXED CODE ###

n, k = map(int, input().split())
alist = sorted(map(int, input().split()))
mod = 10**9 + 7

def comb(n, r, p=mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
p = mod
N = n
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

amax = 0
amin = 0
i = 0
while i <= n-k:
    cnt = comb(n-i-1, k-1)
    amax += (alist[n-i-1] * cnt)%mod
    amin += (alist[i] * cnt)%mod
    i += 1

print((amax - amin) % mod)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
ans = 0
m0 = 10**9+7
for i in range(0,N-1):
    sumtemp = 0
    for j in range(i+1,N):
        sumtemp = (sumtemp+A[j]) % m0
    ans = (ans + A[i] * sumtemp) % m0
print(ans)

### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = 0
    m0 = 10**9+7
    Ar = [0]*N
    sum0 = 0
    for i in reversed(range(N)):
        sum0 = (sum0 + A[i]) % m0
        Ar[i] = sum0

    for i in range(N-1):
        ans = (ans + A[i] * Ar[i+1]) % m0
    print(ans)

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

Q = int(input().strip())

def is_prime(tar):
    #mid = int(pow(tar,0.5))
    if tar < 2:
        return False
    for div in range(2,tar):
        if tar % div == 0:
            return False
    return True


count = 0

for i in range(0,Q):
    l,r = map(int,input().strip().split())
    for i in range(l, r + 1):
        if i % 2 == 0:
            continue
        if is_prime(i) and is_prime((i + 1) // 2):
            count += 1
    print(count)
    count = 0



### FIXED CODE ###

Q = int(input().strip())

NUMS = 100000
fs = [True] * (NUMS + 1)
cs = [0] * (NUMS + 1)

for i in range(2,NUMS):
    if fs[i]:
        for j in range(i + i, NUMS,i):
            fs[j] = False
for i in range(3,NUMS,2):
    if fs[i] and fs[int((i + 1) / 2)]:
        cs[i] += 1
for i in range(3,NUMS):
    cs[i] = cs[i] + cs[i - 1]

for i in range(0,Q):
    l,r = map(int,input().strip().split())
    print(cs[r] - cs[l - 1])
### BUGGY CODE ###

def main():
  N,X,Y = map(int,input().split())
  d = [[float('inf') for _ in range(N)] for _ in range(N)]
  for i in range(N-1):
    d[i][i+1] = 1
    d[i+1][i] = 1
  d[X-1][Y-1] = 1
  d[Y-1][X-1] = 1
  for i in range(N):
    d[i][i] = 0
  
  for k in range(N):
    for i in range(N):
      for j in range(N):
        d[i][j] = min(d[i][k]+d[k][j],d[i][j])
  #print(d)
  ans = [0 for _ in range(N-1)]
  for i in range(N-1):
    for j in range(i,N):
      if 0 < d[i][j] < N:
        ans[d[i][j]-1] += 1
  for i in range(N-1):
    print(ans[i])

main()

### FIXED CODE ###

def main():
  N,X,Y = map(int,input().split())
  V = [[] for _ in range(N)]
  
  for i in range(N-1):
    V[i].append(i+1)
    V[i+1].append(i)
  X -= 1
  Y -= 1
  V[X].append(Y)
  V[Y].append(X)
  #print(V)
  
  ans = [0 for _ in range(N)]
  INF = float('INF')
  for s in range(N):
    D = [INF for _ in range(N)]
    q = [s]
    d = 0
    while(q):
      q2 = []
      for v in q:
        D[v] = min(D[v],d)
        for u in V[v]:
          if D[u] == INF:
            q2.append(u)
      q = q2[:]
      d += 1
      #print(q,d,D)
    for i in range(N):
      ans[D[i]] += 1
  for i in range(1,N):
    print(ans[i]//2)

main()
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
keta=[0]*61
for i in range(n):
  for j in range(61):
    if (a[i]>>j)&1==1:
      keta[j]+=1
ans=0
for i in range(61):
  ans+=((2**i)*(n-keta[i])*keta[i])%(10**9+7)
print(ans%(10**9+7))  

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
keta=[0]*61
for i in range(n):
  for j in range(61):
    if (a[i]>>j)&1==1:
      keta[j]+=1
ans=0
for i in range(61):
  ans+=((2**i)*(n-keta[i])*keta[i])%(10**9+7)
print(ans%(10**9+7))