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

# 813~
# 解法 826
# 各数字について，２進数に直したときの各桁の値を計算する．(桁数＊(0,1))の形を持ったリストに対して,各桁数ごとの値で
# 足し合わせていく．各桁ごとに(0,1)の要素数をかけ合わせて，最後に足し合わせれば答えになる
# 計算量は　O(N*60)くらい
# 実装， 思ったよりもかんたんだったけど，やっぱり単純なケースで間違っていることがわかってやり直さないといけなかった
# 結果はあってるだろうけどTLEが出て困る

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

Large = 10**9 + 7
BA = [[0,0] for _ in range(60)] # <2^60なので
pow260 = pow(2,60)
for a in A:
    a = a + pow260
    a_bin = bin(a)
    for i,ab in enumerate(a_bin[::-1][:-3]): # 最初の'0x'みたいなのを取り除く，あと最初につけた'1'を除く
        ab = int(ab)
        BA[i][ab] += 1
ans = 0
for i,ba in enumerate(BA):
    ans += ba[0] * ba[1] * pow(2,i,Large)
    ans %= Large

print(ans)







### FIXED CODE ###

##かっこいい実装
import numpy as np
#mod = 10**9+7
#n = int(input())
#a = np.fromstring(input(), dtype = np.int64, sep = ' ')
#
#result = 0
#for i in range(60):
#    count_one = int((a&1).sum())
#    result += count_one*(n-count_one)*(2**i)
#    a >>= 1
#print(result%mod)

N = int(input())
A = np.fromstring(input(),dtype = np.int64, sep = ' ')
Large = 10**9 + 7
ans = 0
for i in range(60):
    sum1 = int((A&1).sum())
    ans += sum1*(N-sum1) * 2**i
    #ans %= Large
    A>>=1 # A = A>>1とする
print(ans%Large)
### BUGGY CODE ###

def div(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

a,b = map(int,input().split())
c = list(set(div(a)) & set(div(b)))
ans = 0
for i in range(len(c)):
    for j in range(2,c[i]):
        if c[i] % j == 0:
            break
    else:
        ans += 1
print(ans)

### FIXED CODE ###

import math
def div(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
def is_primeplus(n):
    if n == 1:
        return 1
    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i == 0:
            return 0
    return 1
a,b = map(int,input().split())
c = list(set(div(a)) & set(div(b)))
ans = 0
for i in range(len(c)):
    if is_primeplus(c[i]):
        ans += 1
print(ans)
### BUGGY CODE ###

import collections
import math
 
def combinations_count(n, r):
    if n < 2:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
 
n = int(input())
a_list = list(map(int, input().split()))
a_col = collections.Counter(a_list)
c_dic = {}
sm = 0
for c in a_col:
    sm += combinations_count(a_col[c], 2)
 
for a in a_list:
    if a in c_dic:
        print(c_dic[a])
    else:
        ans = sm - combinations_count(a_col[a], 2) + combinations_count(a_col[a] - 1, 2)
        print(ans)
        c_dic[a] = ans

### FIXED CODE ###

import collections
import math

def combinations_count(n, r):
    if n < 2:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = int(input())
a_list = list(map(int, input().split()))
a_col = collections.Counter(a_list)
c_dic = {}
sm = sum([c * (c - 1) for c in a_col.values()]) // 2
for a in a_list:
    if a in c_dic:
        print(c_dic[a])
    else:
        ans = sm - combinations_count(a_col[a], 2) + combinations_count(a_col[a] - 1, 2)
        print(ans)
        c_dic[a] = ans
### BUGGY CODE ###

import sys

def main():
    N = int(input())

    Ss = []
    for x in range(N):
        Ss.append(sorted(input()))

    ans = 0
    for i in range(0, N-1):
        ans += Ss[i+1:N].count(Ss[i])

    print(ans)

main()

### FIXED CODE ###

import sys
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

def main():
    N = int(input())

    Ss = {}
    for x in range(N):
        tmp = ''.join(sorted(input()))

        if tmp in Ss:
            Ss[tmp] += 1

        else:
            Ss[tmp] = 1


    ans = 0
    for i in Ss.values():
        if i != 1:
            ans += combinations_count(i, 2)

    print(ans)

main()
### BUGGY CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
s, c = map(int, raw_input().split())
ans = 0
if c > s*2:
    ans += s
    c -= s*2
    ans += (c/4)
else:
    while(0 < s and 1 < c):
        s -= 1
        c -= 2
        ans += 1
    if 0 < c:
        ans += c/4
print ans

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
s, c = map(int, raw_input().split())
ans = 0
a = min(s,c/2)
s -= a
c -= a*2
ans = a + (c/4) 
print ans
### BUGGY CODE ###

N=int(input())

def Lu(n):
    if n==0:
        return 2
    elif n==1:
        return 1
    else:
        return Lu(n-1)+Lu(n-2)
print(Lu(N))


### FIXED CODE ###

N=int(input())

dp=[-1 for _ in range(N+1)]
def Lu(n):
    if n==0:
        rec=2
    elif n==1:
        rec=1
    elif dp[n]!=-1:
        return dp[n]
    else:
        rec=Lu(n-1)+Lu(n-2)
    dp[n]=rec
    return rec
print(Lu(N))
### BUGGY CODE ###

from fractions import gcd

mod = 10**9+7

n = int(input())
a = list(map(int,input().split()))
d = 1
for i in range(n):
  d = d * a[i] // gcd(a[i],d)
ans = 0
for i in range(n):
  ans += d//a[i]
  ans %= mod

print(ans)


### FIXED CODE ###

from sys import stdin
input = stdin.readline
from fractions import gcd
 
mod = 10**9+7
 
n = int(input())
a = list(map(int,input().split()))
d = 1
for i in range(n):
  d *= a[i] // gcd(a[i],d)
ans = 0
for i in range(n):
  ans += d//a[i]
 
print(ans%mod)
### BUGGY CODE ###

n = int(input())
lst = [int(i) for i in input().split()]

count = 0
for i in range(n):
  a = lst[i]
  if n - i - 1 <= a:
    continue
  for j in range(i + 1, n):
    if j - i > a:
      b = lst[j]
      if j - i == a + b:
        count += 1
print(count)

### FIXED CODE ###

n = int(input())
lst = [int(i) for i in input().split()]

dic = {}
count = 0
for i in range(n):
  num = lst[i]
  a = i + num
  if a not in dic:
    dic[a] = 1
  else:
    dic[a] += 1
  b = i - num
  if b in dic:
    count += dic[b]
print(count)
### BUGGY CODE ###

import math
n = int(input())
i = 11

if n == 8 or n ==9:
  print(11)
  i = 0
elif n == 2 or n== 3 or n == 5 or n == 7:
  print(n)
  i = 0
elif n <= 7 and n%2 == 0:
  print(n+1)
  i = 0

while i != 0:
  j = 3
  js = int(math.sqrt(i))
  while j <= js:
    if  i%j == 0:
      break
    elif j == js or j == js-1:
      print(i)
      break
      i = 0
    else:
      if j%2 == 0:
        j += 1
      else:
        j += 2
  if i%2 == 0:
    i += 1
  else:
    i += 2

### FIXED CODE ###

x = int(input())
if x <= 3:
  n = x
elif x == 4:
  n = 5
else:
  n = x
  j = 0
  while j == 0:
    a = int(n/2) + 1
    i = 2
    while i < a:
      if i == a-1:
        j = 1
        i = a
      elif n % i != 0:
        i += 1
      else:
        i = a
        n += 1
print(n)
### BUGGY CODE ###

N = int(input())
a = [int(a_i) for a_i in input().split()]
s = [0]  # s[i] = a[1]からa[i]までの総和
sum = 0
for i in range(N):
    sum += a[i]
    s.append(sum)
ans = 0
for i in range(N):
    for j in range(i, N):
        if s[j] - s[i-1] == 0:
            ans += 1
print(ans)


### FIXED CODE ###

from collections import defaultdict

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

sum = [0]
for i in range(N):
    sum.append(sum[i] + A[i])

sum.sort()
dict = defaultdict(int)
for i in range(N + 1):
    dict[sum[i]] += 1

ans = 0
for key, val in dict.items():
    ans += val * (val - 1) // 2

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

N,K=map(int,input().split())
n_b=N
if(N%K==0):
    print(0)
    exit(0)
while(1):

    n=abs(n_b-K)
    if(n>n_b):
        print(n_b)
        exit(0)
    n_b=n


### FIXED CODE ###

N,K=map(int,input().split())
n_b=N
a=N%K
if(K/2<a):
    print(abs(a-K))
else:
    print(a)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)

from collections import defaultdict
def dfs(node_i):
    is_visited[node_i] = 1
    for bi in tree[node_i]:
        if is_visited[bi]:
            continue
        tree_x[bi] += tree_x[node_i]
        dfs(bi)

N, Q = map(int, input().split())
# tree = [[] for i in range(N)]
tree = defaultdict(list)
tree_x = [0 for i in range(N)]
is_visited = [0]*N
for i in range(N-1):
    a, b = map(int, input().split())
    am1 = a-1
    bm1 = b-1
    tree[bm1].append(am1)
    tree[am1].append(bm1)

# print(tree)
for q in range(Q):
    p, x = map(int, input().split())
    tree_x[p-1] += x

dfs(0)

print(' '.join(map(str, tree_x)))


### FIXED CODE ###

N, Q = map(int, input().split())
tree = [[] for i in range(N+1)]
counter = [0] * (N+1)

for i in range(N-1):
    a, b = map(int, input().split())
    tree[b].append(a)

for i in range(Q):
    p, x = map(int, input().split())
    counter[p] += x
for i in range(1, N+1):
    for pn in tree[i]:
        counter[i] += counter[pn]

print(' '.join(map(str, counter[1:])))
### BUGGY CODE ###

# coding: utf-8
# Your code here!

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

s = input()

now = s[0]
tmp = 0

h = []
if s[0]=="0":
    h.append(0)

for i in s:
    if i != now:
        now = i
        h.append(tmp)
        tmp=0
        
    tmp+=1
h.append(tmp)
h.append(0)
h.append(0)

ans = 0

for i in range(0,max(len(h),len(h)-k),2):
    ans = max(ans,sum(h[i:i+k*2+1]))

for i in range(1,max(len(h),len(h)-k),2):
    ans = max(ans,sum(h[i:i+k*2]))

print(ans)

### FIXED CODE ###

# coding: utf-8
# Your code here!

import numpy as np

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

s = input()

now = s[0]
tmp = 0

h = []
if s[0]=="0":
    h.append(0)

for i in s:
    if i != now:
        now = i
        h.append(tmp)
        tmp=0
    tmp+=1
h.append(tmp)

h = np.array(h)

ans = 0

for i in range(0,max(len(h),len(h)-k),2):
    ans = max(ans,np.sum(h[i:i+k*2+1]))
    
print(ans)
### BUGGY CODE ###

import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = int(0)

N, M = LI()
S = LI()
T = LI()
cou = int(0)
dp = [[0]*(M+1) for _ in range(N+1)]
sumdp = [[0]*(M+1) for _ in range(N+1)]
for i in range(1,N+1):
    for j in range(1,M+1):
        if S[i-1]==T[j-1]:
            dp[i][j] = sumdp[i-1][j-1]+1
        sumdp[i][j] = sumdp[i-1][j] + sumdp[i][j-1] - sumdp[i-1][j-1] + dp[i][j]
        #累積和の更新
#print(dp)
for row in dp:
    ans+= sum(row)%mod
print((ans+1)%mod)

### FIXED CODE ###

import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
ans = int(0)

N, M = LI()
S = LI()
T = LI()
dp = [[0]*(M+1) for _ in range(N+1)]
sumdp = [[0]*(M+1) for _ in range(N+1)]
for i in range(1,N+1):
    for j in range(1,M+1):
        if S[i-1]==T[j-1]:
            dp[i][j] = sumdp[i-1][j-1]+1
            sumdp[i][j] = sumdp[i - 1][j] + sumdp[i][j - 1] +1
#            sumdp[i][j] = sumdp[i-1][j] + sumdp[i][j-1] - sumdp[i-1][j-1] + dp[i][j]
        #累積和の更新
        else:
            sumdp[i][j] = sumdp[i-1][j] + sumdp[i][j-1] - sumdp[i-1][j-1]
        sumdp[i][j] %=mod
#        ans += dp[i][j]
#print(dp)
#for row in dp:
#    ans+= sum(row)%mod
print((sumdp[N][M]+1)%mod)
### BUGGY CODE ###

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

### FIXED CODE ###

import collections

N = int(input())
A = list(map(int, input().split()))
# collections.Counter(A)で速くなる！！
cnt = collections.Counter(A)
for i in range(1, N+1):
    print(cnt[i])
### BUGGY CODE ###

import itertools
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
# 2次元配列
grid = []
for i in range(M):
    array = list(map(int, input().strip().split()))
    grid.append(array)
    
sum_fee = []
comb_pro = list(itertools.product(a, b))
for com in comb_pro:
    sum_fee.append(sum(com))

for l, m , n in grid:
    sum_fee.append(a[l-1] + b[m-1] - n)
    
print(min(sum_fee))

### FIXED CODE ###

import itertools
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

#2次元配列
grid = []
for i in range(M):
    array = list(map(int, input().strip().split()))
    grid.append(array)
    
sum_fee = []
a_min = min(a)
b_min = min(b)
sum_fee.append(a_min+b_min)

for l, m, n in grid:
    sum_fee.append(a[l-1] + b[m-1] - n)
    

print(min(sum_fee))
### BUGGY CODE ###

def ncr(n,r):
  if r==0 or n==r:
    return 1
  dp=[[0 for i in range(r+1)] for j in range(n+1)]
  for i in range(n+1):
    dp[i][0]=1
  dp[1][1]=1
 
  for i in range(2,n+1):
    for j in range(1,r+1):
      dp[i][j]=dp[i-1][j-1]+dp[i-1][j]
  return dp[n][r]

n,k=map(int,input().split())
for i in range(1,k+1):
  ans=ncr(n-k+1,i)*ncr(k-1,i-1)
  while ans>10**9+7:
    ans%=10**9+7
  print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
dp=[[0 for i in range(k+1)] for j in range(n+1)]
for i in range(n+1):
  dp[i][0]=1
dp[1][1]=1
for i in range(2,n+1):
  for j in range(1,k+1):
    dp[i][j]=dp[i-1][j-1]+dp[i-1][j]
for i in range(1,k+1):
  ans=dp[n-k+1][i]*dp[k-1][i-1]
  while ans>10**9+7:
    ans%=10**9+7
  print(ans)
### BUGGY CODE ###

def bellman_ford(s, n, G, st):
    d = [float('inf')]*n
    d[s] = 0
    for i in range(n):
        update = False
        for x, y, z in G:
            if not y in st:
                continue
            if d[y] > d[x] + z:
                d[y] = d[x] + z
                update = True
        if not update:
            break
        if i == n - 1:
            return None
    return d

def main():
    n, m, p = map(int, input().split())
    G = []
    U = [[] for _ in range(n)]
    dic = {}
    for _ in range(m):
        a, b, c = map(int, input().split())
        if (a-1, b-1) in dic:
            if dic[(a-1, b-1)] > -c+p:
                dic[(a-1, b-1)] = -c+p
        else:
            dic[(a-1, b-1)] = -c+p
    for v in dic.keys():
        G.append([v[0], v[1], dic[v]])
        U[v[1]].append(v[0])
    st = set()
    st.add(n-1)
    q = [n-1]
    while len(q) > 0:
        t = q.pop(-1)
        for v in U[t]:
            if not v in st:
                q.append(v)
                st.add(v)
    ans = bellman_ford(0, n, G, st)
    if ans is None:
        print(-1)
    else:
        print(max(0, -ans[n-1]))

if __name__ == "__main__":
    main()

### FIXED CODE ###

def bellman_ford(s, n, G):
    d = [float('inf')]*n
    d[s] = 0
    for i in range(n):
        update = False
        for x, y, z in G:
            if d[y] > d[x] + z:
                d[y] = d[x] + z
                update = True
        if not update:
            break
        if i == n - 1:
            return None
    return d

def main():
    n, m, p = map(int, input().split())
    G = []
    U = [[] for _ in range(n)]
    V = [[] for _ in range(n)]
    dic = {}
    for _ in range(m):
        a, b, c = map(int, input().split())
        if (a-1, b-1) in dic:
            if dic[(a-1, b-1)] > -c+p:
                dic[(a-1, b-1)] = -c+p
        else:
            dic[(a-1, b-1)] = -c+p
    for v in dic.keys():
        G.append([v[0], v[1], dic[v]])
        U[v[1]].append(v[0])
        V[v[0]].append(v[1])
    st1 = set()
    st1.add(n-1)
    q = [n-1]
    while len(q) > 0:
        t = q.pop(-1)
        for v in U[t]:
            if not v in st1:
                q.append(v)
                st1.add(v)
    st2 = set()
    st2.add(0)
    q = [0]
    while len(q) > 0:
        t = q.pop(-1)
        for v in V[t]:
            if not v in st2:
                q.append(v)
                st2.add(v)
    st = st1 & st2
    eg = []
    for v in G:
        if v[0] in st and v[1] in st:
            eg.append(v)
    ans = bellman_ford(0, n, eg)
    if ans is None:
        print(-1)
    else:
        print(max(0, -ans[n-1]))

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

def main():
    n = int(input())
    count = 0
    lists =[]
    count_dict = {}

    for i in range(n):
        input_data = ''.join(sorted(input()))
        if input_data in lists:
            count = count + count_dict[input_data]
            count_dict[input_data] = count_dict[input_data] + 1
        else:
            count_dict[input_data] = 1
            lists.append(input_data)

    print(count)


if __name__ == '__main__' :
    main()

### FIXED CODE ###

from collections import Counter

n = int(input())
count = 0
lists =[]
count_dict = Counter()

for i in range(n):
    input_data = ''.join(sorted(input()))
    if input_data in count_dict:
        count += count_dict[input_data]
        count_dict[input_data] += 1
    else:
        count_dict[input_data] = 1

print(count)
### BUGGY CODE ###

n=int(input())
lisa=[]
ans=1
add=[]
coua=0
for i in range(n):
    a=input()
    lisa.append(a)
    coua=lisa.count(a)
    if ans<coua:
        add=[]
        ans=coua
        add.append(a)
    elif ans==coua:
        add.append(a)
add=sorted(set(add))
for i in range(len(add)):
    print(add[i])

### FIXED CODE ###

n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
ANS=[]
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]#Sの？番目がSにいくつあるのか
        ANS.append(ans)
inko=""
ans=max(ANS)
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])
        inko=S[i]
### BUGGY CODE ###

import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()


n=int(input())
a, b, c = [], [], []
for _ in range(n):
    x,y,z=get_ints()
    li=[[-1 for i in range(4)]for j in range(n)]
    a.append(x)
    b.append(y)
    c.append(z)
for i in range(n):
   for j in range(4):
        if i==0:
            if j==0:
                li[i][j]=a[i]
            if j==1:
                li[i][j]=b[i]
            if j==2:
                li[i][j]=c[i]
            if j==3:
                li[i][j] = 0
            continue
        if j==0:
            li[i][j] = max(a[i] + li[i-1][1] ,a[i] + li[i - 1][2])
        if j==1:
            li[i][j] = max(b[i] + li[i - 1][0], b[i] +li[i - 1][2])
        if j==2:
            li[i][j] = max(c[i] + li[i - 1][1], c[i] + li[i - 1][0])
        if j==3:
            li[i][3] = (max(li[i - 1][2],li[i - 1][1], li[i - 1][0]))
print(max(li[n-1]))



### FIXED CODE ###

import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()


n=int(input())
a, b, c = [], [], []
for _ in range(n):
    x,y,z=get_ints()
    
    a.append(x)
    b.append(y)
    c.append(z)
li=[[-1 for i in range(3)]for j in range(n)]
li[0][0],li[0][1],li[0][2]=a[0],b[0],c[0]
for i in range(1,n):


        li[i][0] = max(a[i] + li[i-1][1] ,a[i] + li[i - 1][2])

        li[i][1] = max(b[i] + li[i - 1][0], b[i] +li[i - 1][2])

        li[i][2] = max(c[i] + li[i - 1][1], c[i] + li[i - 1][0])
print(max(li[n-1]))
### BUGGY CODE ###

l, r = map(int, input().split())
if l - r >= 672:
    print(0)
else:
    print(min(i * j % 2019 for i in range(l, r + 1) for j in range(l, i)))


### FIXED CODE ###

l, r = map(int, input().split())
if r // 3 > (l - 1) // 3 and r // 673 > (l - 1) // 673:
    print(0)
else:
    print(min(i * j % 2019 for i in range(l, r + 1) for j in range(l, i)))
### BUGGY CODE ###

N = int(input())
S = list(input())

# print(N, S)
ans = N
for i, h in enumerate(range(N)):
    f = S[0: i]
    l = S[i]
    s = S[i+1:]
    # print(f, l,  s)
    nw = 0
    ne = 0
    for r in f:
        if r != 'E':
            nw += 1
            # print('not e')

    for w in s:
        if w != 'W':
            ne += 1
            # print('not w')

    ans = min(ans, nw+ne)

print(ans)


### FIXED CODE ###

N = int(input())
S = list(input())

# print(N, S)
ans = N

f = S[0]
s = S[1:]

nw = 0
ne = 0

for w in s:
    if w != 'W':
        ne += 1

ans = nw+ne
for i in range(1, N):
    # skipflg = False
    # f = S[0: i]
    # l = S[i]
    # s = S[i+1:]
    # # print(i, f, l, s)
    # nw = f.count('W')
    # ne = s.count('E')
    # print(nw, ne)

    if S[i-1] != 'E':
        nw += 1

    if S[i] != 'W':
        ne -= 1
    # print(nw, ne)
    ans = min(ans, nw+ne)

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

# import numpy as np
# import scipy as sp

n = int(input())
info = []
for i in range(n):
    a = int(input())
    for _ in range(a):
        x, y = map(int, input().split())
        info.append([i, x-1, y])

ans = 0
for i in range(2 ** n):
    bit = [0] * n
    for j in range(n):
        if ((i >> j) & 1):
            bit[j] = 1

    flag = True
    # print(bit)
    for idx, j in enumerate(bit):
        if j == 1:
            for k in [x for x in info if x[0] == idx]:
                # print(' ', k)
                if bit[k[1]] != k[2]:
                    flag = False
    if flag:
        ans = max(ans, sum(bit))
    # print(ans)
print(ans)


### FIXED CODE ###

# import numpy as np
# import scipy as sp

n = int(input())
info = []
for i in range(n):
    a = int(input())
    for _ in range(a):
        x, y = map(int, input().split())
        info.append([i, x-1, y])

ans = 0
for i in range(2 ** n):
    bit = [0] * n
    for j in range(n):
        if ((i >> j) & 1):
            bit[j] = 1

    flag = True
    # print(bit)
    for idx, j in enumerate(bit):
        if j == 1:
            for k in [x for x in info if x[0] == idx]:
                # print(' ', k)
                if bit[k[1]] != k[2]:
                    flag = False
    if flag:
        ans = max(ans, sum(bit))
    # print(ans)
print(ans)
### BUGGY CODE ###

a=int(input())
ai=[int(i) for i in input().split()]

from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

for i in range(len(ai)):
    b=sorted(ai[:i]+ai[i+1:])
    c=[b.count(x) for x in set(b) if b.count(x) > 1]
    ans=[cmb(x,2) for x in c]
    print(sum(ans))

### FIXED CODE ###

import collections
a=int(input())
ai = list(map(int, input().split()))
c = collections.Counter(ai)
val=0
for i in c.values():
    val+=i*(i-1)//2
for i in range(len(ai)):
    b=c[ai[i]]
    print(val-b+1)
### BUGGY CODE ###


K = int(input())
A = 7 % K 

for i in range(1, K + 1):
    if A % K == 0:
        print(i)
        exit()
    A = 10 * A + 7
print(-1)

### FIXED CODE ###

K = int(input())
ans = -1
N = 7
for i in range(K):
    if N % K == 0:
        ans = i+1
        break
    N = (N*10+7) % K
print(ans)
### BUGGY CODE ###

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

    # print(A)
    for j in range(N):
        ans = [x for i, x in enumerate(A) if i != j]
        print(np.max(ans))


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n = int(input())
    As = [int(input()) for _ in range(n)]

    As_sort = sorted(As)
    second, first = As_sort[-2:]
    for i in range(n):
        if As[i] == first:
            print(second)
        else:
            print(first)


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

n , k =map(int, input().split())
a = list(map(int, input().split()))
a_mul = [0] * n
mul = 1
for i in range(n):
    if i < k:
        mul *= a[i]
    else:
        mul = mul * a[i] // a[i - k]
    a_mul[i] = mul

for i in range(n - k):
    if a_mul[k + i - 1] < a_mul[k + i]:
        print("Yes")
    else:
        print("No") 

### FIXED CODE ###

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

for i in range(k, n):
    if a[i - k] < a[i]:
        print("Yes")
    else:
        print("No")