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

p = 10 ** 9 + 7 # mod
N = (10 ** 6) * 2 + 10  # N は必要分だけ用意する
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

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)

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

a = list(map(int,input().split()))
ans = cmb(a[2]+1,a[2]+a[3]+2,p) - cmb(a[1],a[2]+a[1]+1,p) - cmb(a[0],a[3]+a[0]+1,p) + cmb(a[0],a[0]+a[1],p)
print(ans)

### FIXED CODE ###

p = 10 ** 9 + 7 # mod
N = (10 ** 6) * 2 + 10  # N は必要分だけ用意する
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

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)

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

a = list(map(int,input().split()))
ans = cmb(a[2]+1,a[2]+a[3]+2,p) - cmb(a[1],a[2]+a[1]+1,p) - cmb(a[0],a[3]+a[0]+1,p) + cmb(a[0],a[0]+a[1],p)
print(ans%p)
### BUGGY CODE ###

n = int(input())
al = map(int, input().split())
bl = map(int, input().split())
cl = map(int, input().split())
al = sorted(al)
bl = sorted(bl)
cl = sorted(cl)

total = 0
for alnum in al:
    truebl = [blnum for blnum in bl if blnum > alnum]
    for blnum in truebl:
        total += sum(clnum>blnum for clnum in cl)
print(total)

### FIXED CODE ###

# C
import bisect
n = int(input())
al = map(int, input().split())
bl = map(int, input().split())
cl = map(int, input().split())
al = sorted(al)
bl = sorted(bl)
cl = sorted(cl)

total = 0
for blnum in bl:
    alcnt = bisect.bisect_left(al, blnum)
    clcnt = n - bisect.bisect_right(cl, blnum)
    total += alcnt*clcnt
print(total)
### BUGGY CODE ###

n,m=map(int,input().split())
dp=[0]*(m+2)

for i in range(n):  #商品を一つずつ見ていく。
  w,v=(map(int,input().split()))
  for j in range(m+1,w,-1): #w~(限界-w)までのdpの箱に入れていく。(例)w,m=3,8なら3~5
    dp[j]=max(dp[j-w]+v,dp[j])
    
print(dp[m+1])



### FIXED CODE ###

def DP():
    n,W = map(int, input().split(' '))
    WV = (map(int, input().split(' ')) for _ in range(n))
    dp = [0] * (W+1)

    for w, v in WV:
        for j in range(W, w-1, -1):
            DP = dp[j-w] + v
            if dp[j] < DP:
                dp[j] = DP
    return max(dp)
print(DP())
### BUGGY CODE ###

N = int(input())

P = [(x + 2) for x in range(N-1)] + [1]
M = [i % P[i-1] for i in range(N)]
print(sum(M))

### FIXED CODE ###

N = int(input())

#P = [(x + 2) for x in range(N-1)] + [1]
#M = [i % P[i-1] for i in range(N)]
print((N)*(N-1)//2)
### BUGGY CODE ###

N, M = map(int,input().split())
A = list(map(int,input().split()))
BC = [ list(map(int,input().split())) for i in range(M) ]
for i in range(M):
    for j in range(BC[i][0]):
        A.append(BC[i][1])
A = sorted(A, reverse=True)
print(sum(A[0:N]))


### FIXED CODE ###

from operator import itemgetter
N, M = map(int,input().split())
A = list(map(int,input().split()))
BC = [ list(map(int,input().split())) for i in range(M) ]
BC = sorted(BC, key=itemgetter(1), reverse=True)
sumval=0
idx=0
for i in range(len(BC)):
    sumval += BC[i][0]
    idx += 1
    if sumval >= N:
        break
BC = BC[0:idx]
for i in range(len(BC)):
    for j in range(BC[i][0]):
        A.append(BC[i][1])
A = sorted(A, reverse=True)
print(sum(A[0:N]))
### BUGGY CODE ###

#素因数分解（10**6まで）
def soinsu_bunkai(m):
    pf=set()
    mm =m
    for i in pri_num:
        while mm %i==0:
            pf.add(i)
            mm //=i
    if mm !=1:
        pf.add(mm)
    return pf

    # 初期入力
import math
import sys
from bisect import bisect_left
from functools import reduce
input = sys.stdin.readline  #文字列では使わない
N = int(input())
A = list(map(int, input().split()))
intersect =set()
pair_w =set()

# 10**6までの素因数分解するために、「10**6のルート」までの素数を列挙
pri =10**6 +10
sq_pri =int(math.sqrt(pri))
#pri_num =prime_numbers(sq_pri +10 )
pri_num =[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009]

#not coprimeの判定
gcd_a =reduce(math.gcd,A)
if gcd_a !=1:
    ans ="not coprime"

#pairwise coprimeの判定
else:
    A.sort()
    x =bisect_left(A,2)
    if N -x >= 78498 +1:
            print("setwise coprime")
            sys.exit() #10**6以下の素数は78498個、鳩ノ巣原理により必ず素因数が重複、または素数以外の数が出ている
    for a in A:
        aa =soinsu_bunkai(a)
        if intersect & aa:
            print("setwise coprime")
            sys.exit() #共通要素があったらpair_wではない→set_w
        intersect |=aa

    ans ="pairwise coprime"
print(ans)

### FIXED CODE ###

#高速素因数分解  osa_k法 
def osa_k(a):
    tmp = set()
    while a > 1:
        tmp.add(sieve[a])
        a //= sieve[a]
    return tmp

    # 初期入力
import math
import sys
from bisect import bisect_left
from functools import reduce
input = sys.stdin.readline  #文字列では使わない
N = int(input())
A = list(map(int, input().split()))
used =set()

#not coprimeの判定
gcd_a =reduce(math.gcd,A)
if gcd_a !=1:
    ans ="not coprime"

#pairwise coprimeの判定
else:
    MAXN =10**6 +10
    #osa_k法
    sieve = [i for i in range(MAXN+1)]
    p = 2
    while p*p <= MAXN:
        if sieve[p] == p:
            for q in range(2*p,MAXN+1,p):
                if sieve[q] == q:
                    sieve[q] = p
        p += 1
    
    ans ="pairwise coprime"
    for a in A:
        aa =osa_k(a)
        if used & aa:
            ans ="setwise coprime"
            break #共通要素があったらpair_wではない→set_w
        used |=aa
    
print(ans)
### BUGGY CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
INF = float('inf')
dp = [INF] * N
dp[0] = 0
for i in range(N):
    for j in range(i + 1, min(i + K + 1, N)):
        dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]))

print(dp[N - 1])

### FIXED CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
INF = float('inf')
dp = [INF] * N
dp[0] = 0
for i in range(N):
    for j in range(i + 1, min(i + K + 1, N)):
        dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]))

print(dp[N - 1])
### BUGGY CODE ###

N, K = map(int, input().split())
H = list(map(int, input().split()))
H = [H[0]] * K + H

# dp[i] := 足場iに来るのにかかる最小のコスト
INF = 10**18
dp = [INF] * (K + N)
dp[0] = 0
for i in range(1, N + K):
    for j in range(1, K + 1):
        v = dp[i - j] + abs(H[i] - H[i - j])
        dp[i] = min(dp[i], v)
# print('dp', dp)
ans = dp[-1]
print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
H = list(map(int, input().split()))
H = [H[0]] * K + H

# dp[i] := 足場iに来るのにかかる最小のコスト
INF = 10**18
dp = [INF] * (K + N)
dp[0] = 0
for i in range(K, N + K):
    h = H[i]
    dp[i] = min(x + abs(y - h) for x, y in zip(dp[i - K:i], H[i - K:i]))
#     for j in range(1, K + 1):
#         v = dp[i - j] + abs(H[i] - H[i - j])
#         dp[i] = min(dp[i], v)
# print('dp', dp)
ans = dp[-1]
print(ans)
### BUGGY CODE ###

K,N=map(int,input().split())
#print(K,N)
A=list(map(int,input().split()))
#print(A)
#print(A[1:N])
#print(A[0:(N-1)])

D0 = 0
for i in range(N-1):
    D = A[1:N][i] - A[0:(N-1)][i]
    if D > D0:
        D0 = D
z = K - A[N-1] + A[0]
if z > D0:
    D0 = z
print(K - D0)


### FIXED CODE ###

K,N=map(int,input().split())
#print(K,N)
A=list(map(int,input().split()))
#print(A)
#print(A[1:N])
#print(A[0:(N-1)])

D = max([i-j for i,j in zip(A[1:N], A[0:(N-1)])])
#print(D)
z = K - A[N-1] + A[0]
if z > D:
    D = z
print(K - D)
### BUGGY CODE ###

import math
import itertools


# 与えられた数値の桁数と桁値の総和を計算する.
def calc_digit_sum(num):
    digits = sums = 0
    while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
    return digits, sums


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

MOD = 10 ** 9 + 7

answer = 0
for idx1 in range(len(arr) - 1):
    for idx2 in range(idx1 + 1, len(arr)):
        answer = (answer + (arr[idx1] * arr[idx2])) % MOD

print(answer)

### FIXED CODE ###

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

mod = 10 ** 9 + 7
sums = sum(arr)

answer = 0
for num in arr:
    sums -= num
    answer = (answer + (sums * num)) % mod

print(answer)
### BUGGY CODE ###

s=input()
q=int(input())
flg=1
for i in range(q):
  inp=input()
  if inp=='1':
    flg*=-1
  else:
    inp=inp.split()
    f,c=inp[1],inp[2]
    if f=='1'and flg==1:
      s=c+s
    elif f=='2' and flg==-1:
      s=c+s
    else:
      s+=c
if flg==-1:
  s = ''.join(list(reversed(s)))
print(s)

### FIXED CODE ###

s=input()
q=int(input())
flg=1
mae,ushiro='',''
for i in range(q):
  inp=input()
  if inp=='1':
    flg*=-1
  else:
    f,c=inp[2],inp[4]
    if f=='1'and flg==1:
      mae+=c
    elif f=='2' and flg==-1:
      mae+=c
    else:
      ushiro+=c

s=mae[::-1]+s+ushiro
if flg==-1:
  s=s[::-1]
print(s)
### BUGGY CODE ###

R, C, K = map(int,input().split())
V = [[]for i in range(R)]
for i in range(K):
    r,c,v = map(int,input().split())
    V[r-1].append([c,v])
cost = [0]*(C+1)
for r in range(R):
    V[r].sort()
    hoge = [0,0,0,0]
    for c,v in V[r]:
        for i in range(3,0,-1):
            hoge[i] = max(cost[c]+v,hoge[i-1]+v,hoge[i])
        hoge[0] = cost[c]
        cost[c] = max(hoge)
    for i in range(1,C+1):
        cost[i] = max(cost[i],cost[i-1])

print(cost[-1]) 


### FIXED CODE ###

R, C, K = map(int,input().split())
V = [[]for i in range(R)]
for i in range(K):
    r,c,v = map(int,input().split())
    V[r-1].append([c,v])
cost = [0]*(C+1)
for r in range(R):
    V[r].sort()
    hoge = [0,0,0,0]
    for c,v in V[r]:
        for i in range(3,0,-1):
            hoge[i] = max(cost[c]+v,hoge[i-1]+v,hoge[i])
        hoge[0] = cost[c]
        cost[c] = max(hoge)
    for i in range(1,C+1):
        cost[i] = max(cost[i],cost[i-1])

print(cost[-1])
### BUGGY CODE ###

n, q = map(int, input().split())
s = input()
for i in range(q):
    l, r = map(int, input().split())
    print(s[l-1:r].count('AC'))

### FIXED CODE ###

n, q = map(int, input().split())
s = input()
countS = [0]*n
for i in range(n-1):
    countS[i+1] = countS[i]
    if s[i]=='A' and s[i+1]=='C':
        countS[i+1] += 1

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

def examC():
    N = I()
    print(0)
    q = SI()
    if q!="Vacant":
        left = 0; right = N-1
        for _ in range(20):
            cur = (left+right)//2
            print(cur)
            next = SI()
            if next!="Vacant":
                if (cur%2==1 and next==q) or (cur%2==0 and next!=q):
                    right = cur
                else:
                    left = cur+1
            else:
                break

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


### FIXED CODE ###

def examC():
    N = I()
    print(0)
    q = input()
    if q=="Vacant":
        exit()
    left = 0; right = N - 1
    for _ in range(20):
        cur = (left + right) // 2
        print(cur)
        next = input()
        if next=="Vacant":
            exit()

        if (cur % 2 == 1 and next == q) or (cur % 2 == 0 and next != q):
            right = cur
        else:
            left = cur + 1

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

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

# -*- coding: utf-8 -*-
import numpy as np
def fnSolv():
  iNum, iK = map(int, input().split())
  lHn  = list(map(int, input().split()))
  lDP  = [0]*iK
  for iI0 in range(1, iNum):
    lRange = range(max([0, iI0 - iK]), iI0)
    lLen = [0]*len(lRange)
    for iI2, iI1 in enumerate(lRange):
      lLen[iI2] = lDP[iI1%iK] + abs(lHn[iI0] - lHn[iI1])
    lDP[iI0%iK] = min(lLen)
    #print(iI0, lDP, lLen)
  print(lDP[(iNum-1)%iK])

if __name__ == '__main__':
  fnSolv()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
def fnSolv():
  iNum, iK = map(int, input().split())
  naHn  = np.array(list(map(int, input().split())))
  naDP  = np.zeros(iNum, dtype='int64')
  naLen = np.ones(iK) * 10**9
  for iI0 in range(1, iNum):
    iK0 = min([iK, iI0])
    naLen = naDP[iI0-iK0:iI0] + np.abs(- naHn[iI0-iK0:iI0] + naHn[iI0])
    naDP[iI0] = naLen.min()
  print(naDP[iNum-1])

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

string=list(input())
Q=int(input())
reverse=0
def func1(s):
    s.reverse()
    
def func2(s,F,C):
    if F=="1":
        s.insert(0,C)
        #return s
    if F=="2":
        s.append(C)
        #return s

            
for i in range(Q):
    Input=list(map(str,input().split()))
    if Input[0]=='1':
        func1(string)
        
    elif Input[0]=='2':
        func2(string,Input[1],Input[2])
for i in string:
    print(i,end="")

### FIXED CODE ###

S = str(input())
Q = int(input())
 
hanten = 0
front = ""
end = ""
 
for i in range(Q):
    query=list(map(str,input().split()))
    if query[0]=="1":
        hanten+=1
        hanten=hanten%2
    else:
        if query[1]=="1":
            if hanten==0:
                front=query[2]+front
            else:
                end=end+query[2]
        else:
            if hanten==0:
                end=end+query[2]
            else:
                front=query[2]+front
ans=front+S+end
if hanten==1:
    ans=ans[::-1]
print(ans)
### BUGGY CODE ###

h, n = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(n)]

INF = 10 ** 9
dp = [INF] * (h+1)
dp[h] = 0
for a, b in ab:
    for hi in range(h, 0, -1):
        if hi - a <= 0:
            dp[0] = min(dp[0], dp[hi]+b)
            #print('x', dp)
        else:
            dp[hi-a] = min(dp[hi-a], dp[hi]+b)
            #print(' ', dp)
print(dp[0])


### FIXED CODE ###

import sys
input = sys.stdin.readline

h, n = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(n)]

inf = 10 ** 9
max_h = 2 * 10**4 + 10
dp = [inf] * max_h
dp[0] = 0
for a, b in ab:
    for i in range(max_h - a + 1):
        dp[i] = min(dp[i], dp[i - a] + b)

print(min(dp[h:]))
### BUGGY CODE ###

def main():
    import bisect

    N = int(input())
    upper = list(map(int, input().split()))
    middle = list(map(int, input().split()))
    lower = list(map(int, input().split()))

    upper.sort()
    middle.sort()
    lower.sort()

    cnt = 0

    for i in range(N):
        len_up = upper[i]
        
        index_mid = bisect.bisect_right(middle, len_up)

        while (index_mid < N):
            len_mid = middle[index_mid]
            index_low = bisect.bisect_right(lower, len_mid)

            if (index_low < N):
                cnt += N - index_low
                index_mid += 1
            
            else:
                break

    print(cnt)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    import bisect

    N = int(input())
    upper = list(map(int, input().split()))
    middle = list(map(int, input().split()))
    lower = list(map(int, input().split()))

    upper.sort()
    middle.sort()
    lower.sort()

    cnt = 0

    for i in range(N):
        mid = middle[i]
        index_up = bisect.bisect_left(upper, mid)
        index_low = bisect.bisect_right(lower, mid)
        
        cnt += index_up * (N - index_low)
    
    print(cnt)


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

import sys

# sys.stdin = open('e1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


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


def read_str():
    return input()


def solve():
    def collinear(x0, y0, x1, y1):
        return x0 * y1 == x1 * y0

    def aligned(i, j, k):
        return collinear(x[j] - x[i], y[j] - y[i], x[k] - x[i], y[k] - y[i])

    n = read_int()
    mod = 998244353
    res = pow(2, n, mod) - n - 1
    x, y = zip(*[read_int_list() for i in range(n)])
    done = set()
    for i in range(n):
        for j in range(i + 1, n):
            if (i, j) not in done:
                line = [i, j]
                for k in range(n):
                    if k not in [i, j]:
                        if aligned(i, j, k):
                            line.append(k)

                for u in line:
                    for v in line:
                        if u != v:

                            done.add((u, v))
                m = len(line)
                res -= pow(2, m, mod) - m - 1
    res %= mod
    return res


def main():
    res = solve()
    print(res)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import defaultdict

# sys.stdin = open('e1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


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


def read_str():
    return input()


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


def solve():
    def collinear(x0, y0, x1, y1):
        return x0 * y1 == x1 * y0

    def aligned(i, j, k):
        return collinear(x[j] - x[i], y[j] - y[i], x[k] - x[i], y[k] - y[i])

    n = read_int()
    mod = 998244353
    res = pow(2, n, mod) - n - 1
    x, y = zip(*[read_int_list() for i in range(n)])
    lines = defaultdict(set)
    for i in range(n):
        for j in range(i + 1, n):
            a = y[i] - y[j]
            b = x[j] - x[i]
            g = gcd(a, b)
            a //= g
            b //= g
            if a < 0 or (a == 0 and b < 0):
                a, b = -a, -b
            c = -(a * x[i] + b * y[i])
            lines[(a, b, c)].add(i)
            lines[(a, b, c)].add(j)
    for k, v in lines.items():
        m = len(v)
        res -= pow(2, m, mod) - m - 1
    res %= mod
    return res


def main():
    res = solve()
    print(res)


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

import copy
n = int(input())
x = [int(i) for i in input().split()]
y = copy.deepcopy(x)
for j in x:
	if x.count(j)<j:
		while y.count(j) != 0: y.remove(j)
	elif x.count(j)>j:
		while y.count(j) != j: y.remove(j)
print(len(x)-len(y))

### FIXED CODE ###

import collections
n = int(input())
a = [int(i) for i in input().split()]
c = collections.Counter(a)
answer = 0
for i in c.most_common():
	if i[0]>i[1]:
		answer += i[1]
	elif i[0]<i[1]:
		answer += i[1]-i[0]
print(answer)
### BUGGY CODE ###

import functools
import copy
def gcd_strategy():
    import math
    import fractions
    return math.gcd if hasattr(math, "gcd") else fractions.gcd
gcd = gcd_strategy()


n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  l=a.copy()
  del l[i]
  ans=max(ans,functools.reduce(gcd, l))
print(ans)


### FIXED CODE ###

import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))
### BUGGY CODE ###

N = int(input())
T = []
for _ in range(N):
    t = int(input())
    T.append(t)
sorted_T = sorted(T, key = lambda x: -x)
time = sorted_T[0]
for t in sorted_T:
    if time % t != 0:
        time *= t
while time >= sorted_T[0]:
    flag = True
    for t in T:
        if time % t != 0:
            flag = False
            break
    if flag:
        result = time
    time -= sorted_T[0]
print(result)

### FIXED CODE ###

def min_mult(a, b):
    result = max(a, b)
    while result % min(a, b) != 0:
        result += max(a, b)
    return result
N = int(input())
multiple = 1
for _ in range(N):
    multiple = min_mult(multiple, int(input()))
print(multiple)
### BUGGY CODE ###

from collections import defaultdict

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

dp = defaultdict(int)
dp[0] = 0
idx2check = [0]
for _ in range(N):
    w, v = map(int, input().split())
    new_idx2check = []
    for k in idx2check:
        dp[k + w] = max(dp[k + w], dp[k] + v)
        new_idx2check.append(k+w)

    idx2check += new_idx2check

ans = 0
for k, v in dp.items():
    if k <= W:
        ans = max(ans, v)

print(ans)


### FIXED CODE ###

from collections import defaultdict

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

dp = defaultdict(lambda: 1e9)
dp[0] = 0
ans = 0
for _ in range(N):
    w, v = map(int, input().split())
    keys = sorted(dp.keys(), reverse=True)
    for k in keys:
        dp[k + v] = min(dp[k + v], dp[k] + w)
        if dp[k + v] <= W:
            ans = max(ans, k + v)


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

N, M = tuple(map(int, input().split()))
mod = 10**9+7
broken = []
dp = [0]* (N+1)

for i in range(M):
    broken.append(int(input()))

dp[0] = 1

for i in range(1, N+1):
    if (i in broken):
        continue
    if (i == 1):
        dp[i] = 1
        continue
    dp[i] = (dp[i-1] + dp[i-2]) % mod

print(dp[N])

### FIXED CODE ###

N, M = map(int, input().split())
A = set(int(input()) for _ in range(M))
mod = 10 ** 9 + 7

dp = [0] * (N+1)
dp[0] = 1
for i in range(1, N+1):
    if i in A:
        continue
    if i == 1:
        dp[i] = 1
        continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= mod

print(dp[N] % mod)
### BUGGY CODE ###

n,m = map(int,input().split())
lists = []
for i in range(m):
    l,r = map(int,input().split())
    if m == 1:
        print(r-l+1)
        exit()
    tmp = list(range(l,r+1))
    lists.append(tmp)
ans = set(lists[0]) & set(lists[1])
for i in range(m):
    ans = ans & set(lists[i])
print(len(ans))

### FIXED CODE ###

N,M = map(int,input().split())
L = []
R = []
for i in range(M):
    l,r = map(int,input().split())
    L.append(l)
    R.append(r)
ans = list(range(max(L),min(R)+1))
print(len(ans))
### BUGGY CODE ###

N,X,Y=map(int,input().split())
A=[]
for i in range(N-1):
    A.append([-1]*(N-1-i))

for i in range(N-1):
    for j in range(i+1,N):
        A[i][j-i-1]=min(j-i,abs(X-i-1)+1+abs(Y-j-1),abs(X-j-1)+1+abs(Y-i-1))

for k in range(1,N):
    L=0
    for i in range(N-1):
        for j in range(N-1-i):
            if A[i][j]==k:
                L+=1
    print(L)

### FIXED CODE ###

N,X,Y=map(int,input().split())
A=[]
for i in range(N-1):
    A.append([-1]*(N-1-i))

Ndmin=[0]*(N-1)
for i in range(N-1):
    for j in range(i+1,N):
        Ndmin[min(j-i,abs(X-i-1)+1+abs(Y-j-1),abs(X-j-1)+1+abs(Y-i-1))-1]+=1

for k in range(N-1):
    print(Ndmin[k])
### BUGGY CODE ###

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

res =[]
for i in range(len(alphas)):
	
	r = None
	for j in range(len(alphas)):
		if j != i:
			if r is None:
				r = alphas[j]
			else:
				r ^= alphas[j]
	res.append(r)
print(*res)

### FIXED CODE ###

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

res =[]

r = None

for i in range(len(alphas)):
	if r is None:
		r = alphas[i]
	else:
		r ^= alphas[i]

for i in range(len(alphas)):
	res.append(r^alphas[i])
print(*res)