Harryxun/stf_run huggingface dataset:
import math
import itertools
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

n, k = map(int, input().split())
d = [0]*k
d[0] = n-k+1
for i in range(1, k):
    a = cmb(k-1, i)/i
    div = math.ceil(a)
    d[i] = cmb(n-k+1, i+1)*div


    #     s = math.factorial(n-k+1)//math.factorial(i+1)
for i in d:
    print(i % (10 ** 9 + 7))


### FIXED CODE ###

import math


def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


n, k = map(int, input().split())
mod = 10**9+7
for i in range(1, k+1):
    if n-k+1 >= i:
        print(comb(n-k+1, i)*comb(k-1, i-1) % mod)
    else:
        print(0)
a,b=[int(input().split())]
	if a!=2 and b!=2:
		print("Yes")
	else:
		print("No")

### FIXED CODE ###

a,b=map(int,input().split())
if a!=2 and b!=2:
	print("Yes")
else:
	print("No")
num = list(map(int, input().split()))

history = []
count = 0

for i in range(0,num[0]):
    history.append(num[i+1])
    num_min = np.min(history)
    if(num[i+1] <= num_min):
        count = count + 1

print(count)

### FIXED CODE ###

num = [input() for i in range(2)]
num_0 = int(num[0])
num_1 = list(map(int, num[1].split()))

num_min = num_1[0]
count = 0

for i in range(0,num_0):
  if(num_min >= num_1[i]):
    count = count+1
    num_min = num_1[i]
    
print(count)
n,l=(int(x) for x in input().split())
sente1=input()
sente2=input()
sente3=input()
mylist=[sente1,sente2,sente3]
mylist.sort()
a=''.join(mylist)
print(a)

### FIXED CODE ###

# 入力
N,L=map(int,input().split())

l=[]
for i in range(N):
  l.append(input())

# ソート
l.sort()

# 出力
print(''.join(l))
X = list(map(int, input().split()))
A = []
B=[]
for _ in range(X[2]):
    A.append(int(input()))
for i in range(0,X[0]):
    count=0
    for j in range(0,X[2]):
        if j<X[2]-1 and A[j]!=i+1:
            count=count+1
        elif j==X[2]-1:
            if A[j]!=i+1:
                count=count+1
                if count < X[1]:
                    B.append("Yes")
                else:
                    B.append("No")
            else:
                if count < X[1]:
                    B.append("Yes")
                else:
                    B.append("No")
            
print(B)

### FIXED CODE ###

S=input()
if S=="Sunny":
    print("Cloudy")
elif S=="Cloudy":
    print("Rainy")
else:
    print("Sunny")
N = int(input())
A = [int(input()) for i in range(N)]
A.sort()
if N & 1:
    ans1 = 2*sum(A[N//2:])-A[N//2]-A[N//2+1]-2*sum(A[:N//2])
    ans2 = 2*sum(A[N//2+1:])-2*sum(A[:N//2+1])+A[N//2]+A[N//2-1]
else:
    if N == 2:
        ans1 = ans2 = abs(A[0]-A[1])
    else:
        ans1 = 2*sum(A[N//2:])-A[N//2]-2*sum(A[:N//2])+A[N//2-1]
        ans2 = 2*sum(A[N//2+1:])-A[N//2+1]-2*sum(A[:N//2+1])+A[N//2]
print(max(ans1, ans2))

### FIXED CODE ###

S = input()
if len(S) == 2:
    print(S)
else:
    print(S[::-1])
while True:
    x = input()
    if x == "0":
        break
    num = [int(i) for i in x.split("")]
    print(sum(num))

### FIXED CODE ###

while True:
    x = input()
    if x == "0":
        break
    num = [int(i) for i in x]
    print(sum(num))
s=input()
if s="A":
  print("T")
if s="T":
  print("A")

if s="G":
  print("C")
if s="C":
  print("G")

### FIXED CODE ###

s=input()
if s=="A":
  print("T")
if s=="T":
  print("A")

if s=="G":
  print("C")
if s=="C":
  print("G")
x,a,b=map(int,raw_input().split())
print (x-a)%b

### FIXED CODE ###

x=input()
a=input()
b=input()
print (x-a)%b
n, m = map(int, input().split())
rank = list(map(int, input().split()))
rank.sort(reverse=True)
cnt = 0

for r in rank:
  if r >= (sum(rank)//(4*m)):
    cnt += 1
    if cnt = m:
      break

if cnt >= m :
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n, m = map(int, input().split())
rank = list(map(int, input().split()))
rank.sort(reverse=True)
cnt = 0

for r in rank:
  if r >= (sum(rank)/(4*m)):
    cnt += 1
    if cnt >= m:
      break

if cnt >= m :
  print('Yes')
else:
  print('No')
input_num = map(int, input().split())
seki = input_num[0] * input_num[1]
if seki % 2 == 0:
    print("Even")
else:
    print("0dd")

### FIXED CODE ###

num1, num2 = map(int, input().split())
seki = num1 * num2
if seki % 2 == 0:
    print("Even")
else:
    print("Odd")
#include<iostream>
using namespace std;

int main(){
    int k;
    int n=7;
    int count=1;

    cin>>k;

    while(n%k != 0){
        if(k%2==0){
            count=-1;
            break;
        }
        else if(k%5==0){
            count=-1;
            break;
        }
        n=10*n+7;
        count++;
    }
    cout<<count<<"\n";

}
                                                              
                                                              

### FIXED CODE ###

k=int(input())
a=[]
judge=0
a.append("")
a.append(7%k)
for i in range(2,k+1):
    a.append((a[i-1]*10+7)%k)
for i in range(1,k+1):
    if a[i]==0:
        print(i)
        judge=1
        break
if judge==0:
    print(-1)
N,L = map(int,input().split())
a_list = []
for i in range(N):
    diff = abs(((L-1)*(N-1)-i))
    a_list.append(diff)
    
print(sum(list(N+1))-((L-1)*(N-1) - min(a_list)))

### FIXED CODE ###

N,L = map(int,input().split())
l = list(map(lambda x : L+x-1 , range(1,N+1)))
print(sum(l)-min(l,key=abs))
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n, k = LI()
    ps = LI()
    sum_ = [0]
    for i in range(1, 1000+1):
        sum_.append(sum_[i-1] + i)
    kitai = [k / (i + 1) for i, k in enumerate(sum_[1:])]
    kitai2 = [kitai[i-1] for i in ps]
    ans = []
    for i in range(n-k):
        ans.append(sum(kitai2[i:i+k]))
    print(max(ans))



if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n, k = LI()
    ps = LI()
    sum_ = [0]
    for i in range(1, 1000+2):
        sum_.append(sum_[i-1] + i)
    kitai = [ke / (i + 1) for i, ke in enumerate(sum_[1:])]
    kitai2 = [kitai[i-1] for i in ps]
    ans = []
    for i in range(n-k+1):
        if i == 0:
            ans.append(sum(kitai2[0:k]))
        else:
            ans.append(ans[i-1] - kitai2[i-1] + kitai2[i+k-1])
    print(max(ans))




if __name__ == '__main__':
    main()
a,b = map(int,input().split())

if(a <= 5):
    print(0)
elif(a < 12):
    print(b//2):
else:
    print(b)

### FIXED CODE ###

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

if(a <= 5):
    print(0)
elif(a <= 12):
    print(b//2)
else:
    print(b)
a=10**9+7
import math 
def combinations_count(n, r):
    return (math.factorial(n)) // (math.factorial(n - r) * math.factorial(r))

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


for _ in range(1,k+1):
  print(combinations_count((n-k+1)%a,_%a)%a*combinations_count((k-1)%a,(_-1)%a))

  


### FIXED CODE ###

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

from scipy.misc import comb

for i in range(1,k+1):
  print(comb(n-k+1,i,exact=True)*comb(k-1,i-1,exact=True)%mod)
sankaNum, scoreMax, ansCnt = input().split()

score = []

for i in int(sankaNum):
    score.append(scoreMax)



for n in ansCnt.int():
    ansSanka = input()

    isOk = False
    
    for k in sankaNum.int():
        if ansSanka - 1 != k:
            score[k] -= score[k] -1
            if score[k] < 0:
                isOk = True
    
    

if isOk:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

sankaNum, scoreMax, ansCnt = map(int, input().split())

score = [scoreMax-ansCnt]*sankaNum

for _ in range(ansCnt):
    score[int(input()) - 1] +=  1

for m in range(sankaNum):

    if  score[m] > 0:
        print('Yes')
    else:
        print('No')
n = int(input())
a = 1
for i in range(0,n):
    a*=int(input())
    if(a>10**18):
        a=-1
if(a<0):
    a=-1
print(a)

### FIXED CODE ###

n = int(input())
a = 1
s = list(map(int, input().split()))
if 0 in s:
    print(0)
    exit()
for i in s:
    a*=i
    if a>10**18:
        print(-1)
        exit()
else:
    print(a)
N = int(input())
A = list(map(int, input().split()))

DP = [0] * (10 ** 6 + 1)

A.sort()
Sum = 0

for i in range(N):

    if DP[A[i]] == 0:
        for j in range(1, 10 ** 6):
            if A[i] * j <= 10 ** 6:
                DP[A[i] * j] = 1
            else:
                break

        if i == 0:
            if A[i] != A[i + 1]:
                Sum += 1
        elif i == N - 1:
            if A[i] != A[i - 1]:
                Sum += 1


print(Sum)


### FIXED CODE ###

from collections import defaultdict

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

DP = [0] * (10 ** 6 + 1)

A.sort()
Sum = 0

d = defaultdict(int)
for key in A:
    d[key] += 1

for i in range(N):

    if DP[A[i]] == 0:
        for j in range(1, 10 ** 6):
            if A[i] * j <= 10 ** 6:
                DP[A[i] * j] = 1
            else:
                break

        if d[A[i]] == 1:
            Sum += 1
print(Sum)
n, m = map(int, input().split())
l = list(map(int, input().split()))
l.sorted()
if min(l[m-1]) < 1/(4*m):
  print('No')
else:
  print('Yes')

### FIXED CODE ###

n, m = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
l.reverse()
a = sum(l)
for i in range(m):
  if l[i]/a < 1/(4*m):
    print('No')
    exit()
print('Yes')
m=int(input())
pf={m:1}
a=[0]
for i in range(2,int(m**0.5)+1):
    pf[i]=pf.get(i,0)+1
    if i!=m//i:
        pf[m//i]=pf.get(m//i,0)+1
for i in pf:
    if m//(i-1)==m%(i-1):
        a.append(a[-1]+i-1)
print(a[-1])


### FIXED CODE ###

m=int(input())
pf={m:1}
a=[0]
for i in range(2,int(m**0.5)+1):
    if m ==1:
        break
    pf[i]=pf.get(i,0)+1
    if i!=m//i:
        pf[m//i]=pf.get(m//i,0)+1
for i in pf:
    if m!=1and m//(i-1)==m%(i-1):
        a.append(a[-1]+i-1)
print(a[-1])
from itertools import groupby

H, W = map(int,input().split())
S = []

max_row_range = [[None, None], [None, None]]
max_row_num = -float('inf')
for j in range(H):
  row = [0 if s=='.' else 1 for s in input()]
  S.append(row)
  
  i = 0
  for key, value in groupby(row):
    value_len = len(list(value))
    if key == 0 and max_row_num < value_len:
      max_row_range = [[i,j],[i+value_len,j]]
      max_row_num = value_len
    i += value_len

max_col_range = [[None, None], [None, None]]
max_col_num = -float('inf')
for i, col in enumerate(zip(*S)):
  if i < max_row_range[0][0] or i < max_row_range[0][1]: continue 
    
  j = 0
  for key, value in groupby(col):
    value_len = len(list(value))
    if key == 0 and max_col_num < value_len:
      max_col_range = [[i,j],[i+value_len,j]]
      max_col_num = value_len
    j += value_len
    
print(max_row_range[1][0]-max_row_range[0][0]+max_col_range[1][0]-max_col_range[0][0]-1)

### FIXED CODE ###

import sys

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

col_cnt = [[0 for _ in range(W)]for _ in range(H)]
for i in range(W):
  tmp_cnt = 0
  prvjj = 0
  for j in range(H):
    if grids[j][i] == '.':
      tmp_cnt += 1
    else:
      col_cnt[j][i] = 0
      for jj in range(prvjj,j):
        col_cnt[jj][i] = tmp_cnt
      prvjj = j+1
      tmp_cnt = 0
  for jj in range(prvjj,H):
    col_cnt[jj][i] = tmp_cnt

ans = -float('inf')
for j in range(H):
  tmp_cnt = 0
  prvii = 0
  for i in range(W):
    if grids[j][i] == '.':
      tmp_cnt += 1
    else:
      for ii in range(prvii,i):
        ans = max(ans,col_cnt[j][ii]+tmp_cnt-1)
      prvii = i+1
      tmp_cnt = 0

  for ii in range(prvii,W):
    ans = max(ans,col_cnt[j][ii]+tmp_cnt-1)

print(ans)
n = int(input())
s = input()

if s[:n/2] == s[n/2:]:
	print("Yes")
else:
    print("No")


### FIXED CODE ###

n = int(input())
s = input()
     
if s[:n//2] == s[n//2:]:
	print("Yes")
else:
	print("No")
a, b = map(int, input().split())

if a > b :
	print("a > b")
elif a = b:
	print("a == b")
else : 
	print("a < b")


### FIXED CODE ###

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

if a > b :
	print("a > b")
elif a == b:
	print("a == b")
else : 
	print("a < b")
n = int(input())
a = list(map(int, input().split()))

flg = True
for i in range(n):
  if a[i]%2 == 0:
    cnt += 1
    if a[i]%3 == 0 or a[i]%5 == 0:
      pass
    else:
      flg = False
if flg: print("APPROVED")
else: print("DENIED")

### FIXED CODE ###

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

flg = True
for i in range(n):
  if a[i]%2 == 0:
    if a[i]%3 == 0 or a[i]%5 == 0:
      pass
    else:
      flg = False
if flg: print("APPROVED")
else: print("DENIED")
n=int(input())
blue=[input() for i in range(n)]
m=int(input())
red=[input() for i in range(m)]
print(max([blue.count(blue(i))-red.count(blue(i)) for i in range(n)]),0)

### FIXED CODE ###

n=int(input())
blue=[input() for i in range(n)]
m=int(input())
red=[input() for i in range(m)]
print(max(max([blue.count(blue[i])-red.count(blue[i]) for i in range(n)]),0))
n,m = map(int,input().split())
l = dict()
tl = []
for i in range(n+1):
  l[i] = []
for _ in range(m):
  a,b,c = map(int,input().split())
  l[a].append((b,c))
  l[b].append((a,-c))
  tl.append((a,b,c))
pos = [None]*(n+1)

def dfs(v,p,pos):
  pos[v] = p
  for i,d in l[v]:
    if pos[i] == None:
      dfs(i,p+d,pos)
  return

for i in range(1,n+1):
  if pos[i] == None:
    dfs(i,0,pos)
for a,b,c in tl:
  if pos[b] - pos[a] != c:
    print("No")
    break
else:
  print("Yes")

### FIXED CODE ###

n,m = map(int,input().split())
l = dict()
tl = []
for i in range(n+1):
  l[i] = []
for _ in range(m):
  a,b,c = map(int,input().split())
  l[a].append((b,c))
  l[b].append((a,-c))
  tl.append((a,b,c))
pos = [None]*(n+1)

def dfs(v,p,pos):
  q = [(v,p)]
  while q:
    cv,cp = q.pop()
    if pos[cv] != None:
      continue
    pos[cv] = cp
    for i,d in l[cv]:
      if pos[i] == None:
        q.append((i,cp+d))
  return

for i in range(1,n+1):
  if pos[i] == None:
    dfs(i,0,pos)
for a,b,c in tl:
  if pos[b] - pos[a] != c:
    print("No")
    break
else:
  print("Yes")
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
B = [0 for i in range(N)]
for i in range(N-1):
  B[i] = A[i + 1] - A[i]
B[N - 1] = N - A[N - 1] + a[0]
ans = N - max(B)
print(ans)


### FIXED CODE ###

K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
B = [0 for i in range(N)]
for i in range(N-1):
  B[i] = A[i + 1] - A[i]
B[N - 1] = K - A[N - 1] + A[0]
ans = K - max(B)
print(ans)
# import numpy as np
n=int(input())
l=list(map(float,input().split()))
t=(n+1)//2
dp=[[-1 for i in range(n+1)]for i in range(n+1)]
def recur(i,k,ans):
    if i==n:
        # global ans
        if k>=t:
            return 1
            
        return 0
    # a=dp[i][k]
    # dp[i][k]=recur(i+1,k+1,p*l[i],ans)+recur(i+1,k,p*(1-l[i]),ans)
    # b=dp[i][k]
    # if a!=0 and a!=b:
    #     print(a,b)
    # return dp[i][k]
    if dp[i][k]!=-1:
        return dp[i][k]
    
    dp[i][k]=l[i]*recur(i+1,k+1,ans)+recur(i+1,k,ans)*(1-l[i])
    # print(dp[i][k])
    # if dp[i+1][k+1] == 0:
    #     dp[i+1][k+1]=recur(i+1,k+1,p*l[i])
    # if dp[i+1][k]==0:
    #     dp[i+1][k]=recur(i+1,k,p*(1-l[i]))
    return dp[i][k]
# ans=0
# print(dp)
print("%0.10f"%recur(0,0,0))
# print(dp)
# print(ans)
            

### FIXED CODE ###

# import numpy as np
n=int(input())
l=[0]+list(map(float,input().split()))
n+=1
dp=[[0 for i in range(n)]for i in range(n)]
dp[0][0]=1
for i in range(1,n):
    for j in range(i+1):
        if j==0:
            dp[i][j] = (1-l[i])*dp[i-1][j]
        else:
            dp[i][j]=(1-l[i])*(dp[i-1][j])+l[i]*dp[i-1][j-1]
ans=0
# print(np.array(dp))
for i in range((n)//2,n):
    ans+=dp[-1][i]
print(ans)
H=int(input())
A=int(input())
count=0
while H>0:
    H=H-A
    count+=1
else:
    print(count)

### FIXED CODE ###

H,A=map(int, input().split())
count=0
while H>0:
    H=H-A
    count+=1
else:
    print(count)
import math
from bisect import bisect
x1,y1,x2,y2 = map(int,input().split())
N = int(input())
src = [tuple(map(int,input().split())) for i in range(N)]
src.sort()
if x1 > x2:
    x1,x2 = x2,x1
    y1,y2 = y2,y1

arc = 5 * math.pi

if x1 == x2:
    if y1 > y2:
        y1,y2 = y2,y1
    ans = 100 * (y2-y1)
    for x,y in src:
        if x == x1 and y1 < y < y2:
            ans += arc*2 - 20
            break
    print(ans)
    exit()

if y1 == y2:
    if x1 > x2:
        x1,x2 = x2,x1
    ans = 100 * (x2-x1)
    for x,y in src:
        if y == y1 and x1 < x < x2:
            ans += arc*2 - 20
            break
    print(ans)
    exit()

assert x1 < x2

if y1 < y2:
    lis = []
    for x,y in src:
        if x < x1: continue
        if x > x2: break
        if not y1 <= y <= y2: continue
        i = bisect(lis, y)
        if i == len(lis):
            lis.append(y)
        else:
            lis[i] = y
    ans = 100 * (x2-x1 + y2-y1)
    ans += len(lis) * (arc - 20)
    print(ans)
else:
    print(src)
    lds = []
    for x,y in src:
        if x < x1: continue
        if x > x2: break
        if not y2 <= y <= y1: continue
        print(x,y,i)
        if i == 0:
            lds.append(y)
        else:
            lds[-i] = y
    ans = 100 * (x2-x1 + y1-y2)
    ans += len(lds) * (arc - 20)
    print(ans)

### FIXED CODE ###

import math
from bisect import bisect
x1,y1,x2,y2 = map(int,input().split())
N = int(input())
src = [tuple(map(int,input().split())) for i in range(N)]
src.sort()
if x1 > x2:
    x1,x2 = x2,x1
    y1,y2 = y2,y1

arc = 5 * math.pi

if x1 == x2:
    if y1 > y2:
        y1,y2 = y2,y1
    ans = 100 * (y2-y1)
    for x,y in src:
        if x == x1 and y1 < y < y2:
            ans += arc*2 - 20
            break
    print(ans)
    exit()

if y1 == y2:
    if x1 > x2:
        x1,x2 = x2,x1
    ans = 100 * (x2-x1)
    for x,y in src:
        if y == y1 and x1 < x < x2:
            ans += arc*2 - 20
            break
    print(ans)
    exit()

if y1 < y2:
    lis = []
    for x,y in src:
        if x < x1: continue
        if x > x2: break
        if not y1 <= y <= y2: continue
        i = bisect(lis, y)
        if i == len(lis):
            lis.append(y)
        else:
            lis[i] = y
    ans = 100 * (x2-x1 + y2-y1)
    if len(lis) in (x2-x1+1, y2-y1+1):
        ans += (len(lis)-1) * (arc - 20)
        ans += arc*2 - 20
    else:
        ans += len(lis) * (arc - 20)
    print(ans)
else:
    lds = []
    for x,y in src:
        if x < x1: continue
        if x > x2: break
        if not y2 <= y <= y1: continue
        i = bisect(lds, -y)
        if i == len(lds):
            lds.append(-y)
        else:
            lds[i] = -y
    ans = 100 * (x2-x1 + y1-y2)
    if len(lds) in (x2-x1+1, y1-y2+1):
        ans += (len(lds)-1) * (arc - 20)
        ans += arc*2 - 20
    else:
        ans += len(lds) * (arc - 20)
    print(ans)
import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

for i in range(N):
    tmp = A[i]
    A[i] = 0
    print(np.max(A))
    A[i] = tmp

### FIXED CODE ###

import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

tmp = copy.deepcopy(A)
tmp = list(sorted(A, reverse=True))

Amax = tmp[0]
Asecond = tmp[1]

for i in range(N):
    if A[i] != Amax:
        print(Amax)
    else:
        print(Asecond)
import fractions
import math

n,X= map(int,input().split())
x = list(map(int, input().split()))
x.append(x)
x = sorted(X)

#print(x)

difflis = [0] * (n)

for i in range(n):
    difflis[i] = math.fabs(x[i+1] - x[i])

ans = difflis[0]
for i in range(i,len(difflis)):
    ans = fractions.gcd(ans,difflis[i])
print(int(ans))

### FIXED CODE ###

import fractions


n,X= map(int,input().split())
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)

#print(x)

difflis = [0] * (n)

for i in range(n):
    difflis[i] = x[i+1] - x[i]

ans = difflis[0]
for i in range(1,len(difflis)):
    ans = fractions.gcd(ans,difflis[i])
print(ans)
#! /usr/bin/env python3

from fractions import gcd
# from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

import copy

N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for i in range(M)]

road = [ [] for i in range(N) ]

for ab in AB:
    road[ab[0]-1] += [ab[1]-1]
    road[ab[1]-1] += [ab[0]-1]

rets_ct = [N for i in range(N)]
rets = [0 for i in range(N)]

def dfs(second, num, ct, done):
    global road, rets_ct, rets
    
    if num == 0:
        if rets_ct[start] > ct:
            rets[start] = second
            rets_ct[start] = ct

    if done[num]:
        return
    done[num] = 1
    
    ct += 1
    next = road[num]
    for i in next:
        if second == 0:
            dfs(i, i, ct, copy.copy(done))
        else:
            dfs(second, i, ct, copy.copy(done))


for start in range(1, N):
    ct = 0
    done = [0 for i in range(N)]
    dfs(0, start, ct, done)

print("Yes")
for i in rets[1:]:
    print(i+1)


### FIXED CODE ###

#! /usr/bin/env python3

# from math import gcd
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
import copy

N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for i in range(M)]

graph = [[] for i in range(N)]

for A, B in AB:
    graph[A-1] += [B]
    graph[B-1] += [A]

D = deque([0])
visited = [0] * N
visited[0] = 1

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

while D:
    v = D.popleft()
    for i in graph[v]:
        i -= 1
        if visited[i]: continue
        visited[i] = 1
        ret[i] = v + 1
        D.append(i)

if any(ret[1:]):
    print("Yes")
    for i in ret[1:]:
        print(i)
else:
    print("No")
# An efficient Python3 program to compute
# sum of bitwise OR of all pair

# Returns sum of bitwise OR
# of all pairs
def sumXOR( arr,  n):
    sum = 0
    for i in range(0, 60):
        #  Count of zeros and ones
        zc = 0
        oc = 0
        # Individual sum at each bit position
        idsum = 0
        for j in range(0, n):
            if (arr[j] % 2 == 0):
                zc = zc + 1
            else:
                oc = oc + 1
            arr[j] = int(arr[j] / 2)
        # calculating individual bit sum
        idsum = oc * zc * (1 << i)
        # final sum
        sum = (sum + idsum)%(1e9+7);
    return sum



# driver function
sum = 0
n = int(input())
arr = []
for _ in range(n):
    arr.append(int(input())
sum = sumXOR(arr, n);
print(sum)


### FIXED CODE ###

import numpy as np

MAX_DIGIT = 60
MOD = 10**9 + 7

N = int(input())
A = np.array([int(a) for a in input().split()])

answer = 0
for d in range(MAX_DIGIT + 1):
    A, r = (A>>1), A % 2
    s = int(r.sum())
    base = (1<<d) % MOD #this may be key
    answer += (base * s * (N - s)) % MOD

answer %= MOD
print(answer)