peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N,K=map(int,input().split())
x=N%K
if x<=K/2:
    print(x)
else:
    print(K-x)
# Judge status: Accepted
s = input()
print('Bad' if any(s[i] == s[i+1] for i in range(3)) else 'Good')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

mae = []
usiro = []

#0の時に前 1の時に後ろ
Flag = 0

for i in reversed(range(0,N,1)):
    
    if Flag == 0: # 前の時
        mae.append(str(A[i]))
        Flag = 1
    else:
        usiro.insert(0,str(A[i]))
        Flag = 0

moziretu = (mae + usiro)
moziretu = ''.join(moziretu)
print(' '.join(moziretu))
# Judge status: Accepted
l=[2,1]
n=int(input())
i=0
while i!=n:
  l.append(l[i]+l[i+1])
  i+=1
print(l[n])
# Judge status: Accepted
n,m = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
a=0
for i in range(m):
    a+=l[i]    
print(a)
# Judge status: Accepted
n = input()
if '7' in n:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S = input()
print('Yes' if S[2] == S[3] and S[4] == S[5] else 'No')
# Judge status: Wrong Answer
n = int(input())
p = list(map(int,input().split()))
miss = 0
max = p[0]
for i in range(1,n):
    #s = p[0:i]
    #if not s:
    #    continue
    if p[i] > p[i-1]:
        miss += 1
        continue
    if max < p[i]:
        max = p[i]
    if p[i] > max:
        miss += 1
        continue

    #s = sorted(s,reverse=True)
    #for j in range(i):
    #    if p[i] > s[j]:
    #        miss += 1
    #        break

print(n-miss)
# Judge status: Accepted
from operator import itemgetter
N = int(input())
T = []
for _ in range(N):
    T.append(tuple(map(int, input().split())))
T.sort(key=itemgetter(1))
A = [i[0] for i in T]
B = [i[1] for i in T]
sum = 0
for i in range(N):
    sum += A[i]
    if sum > B[i]:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
n = int(input())
arr = list(map(int, input().split()))
num_4_multi = len(arr) // 2
cnt4 = len([i for i in arr if i % 4 == 0])
cnt2 = len([i for i in arr if i % 2 == 0])
cnt8 = len([i for i in arr if i % 8 == 0])
cnt = cnt2 - cnt4 + cnt8
if len(arr) % 2 == 0:
    cnt += arr.count(2) // 2
else:
    cnt += arr.count(2) / 3
if num_4_multi <= cnt: print("Yes")
else: print("No")
# Judge status: Accepted
s = input()
print('yes' if len(set(s)) == len(s) else 'no')
# Judge status: Accepted
from collections import Counter
n = int(input())
l = [{} for _ in range(n)]
for i in range(n):
    l[i] = Counter(input())
for i in range(26):
    w = chr(ord("a") + i)
    c = 51
    for j in range(n):
        c = min(c, l[j][w])
    print(w * c, end = "")
print()
# Judge status: Wrong Answer
import math

a, b, c = map(lambda x: math.sqrt(x), map(int, input().split()))

if a + b - c < 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

def solve():
    a, b = list(map(int, input().split()))
    print(lcm(a, b))

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))
l=[list(map(int,input().split())) for i in range(m)]

x=[]
x_l=0
for b,c in l:
 x+=[c]*b
 x_l+=b
 if x_l>n:
  break
x=sorted(x,reverse=True)

ans=0
for i in range(n):
 if i<x_l:
  ans+=max(a[i],x[i])
 else:
  ans+=a[i]
print(ans)
# Judge status: Accepted
from collections import defaultdict,deque
import math
def main():
    s = input()
    v = ["a","i","u","e","o"]
    if(s in v):
        print("vowel")
    else:
        print("consonant")
if __name__ == '__main__':
    main()
# Judge status: Accepted
from collections import defaultdict
n = int(input())

d = defaultdict(int)
nums = []
for num in input().split():
    num = int(num)
    d[num] += 1
    # 同じ長さの棒が4本ある場合に対応するためこのような方法をとる
    if d[num] == 2:
        d.pop(num)
        nums.append(num)

nums = sorted(nums)
if len(nums) >= 2:
    print(nums[-1] * nums[-2])
else:
    print(0)
# Judge status: Accepted
A,B,C,D,E = map(int,input().split())

print(max(0,-60*A-B+(60*C+D))-E)
# Judge status: Accepted
S=input()
if S=='Sunny':
    print('Cloudy')
elif S=='Cloudy':
    print('Rainy')
else:
    print('Sunny')
# Judge status: Accepted
S = input()
N = len(S) - 1

for i in range(2**N):
    
    num = int(S[0])
    op = ["+","+","+",]
    
    for j in range(N):
        if i >> j & 1:
            op[-1-j] = "-"
            num -= int(S[-1-j])
        else:
            num += int(S[-1-j])
    
    if num == 7:
        print(S[0],op[0],S[1],op[1],S[2],op[2],S[3],"=7",sep="")
        break
# Judge status: Wrong Answer

c=str(input())

if c=='a' or 'e' or 'i' or 'o' or 'u':
    print('vowel')

else:print('consonant')
# Judge status: Wrong Answer
N = int(input())
A = [int(input()) for i in range(N)]


sorted_A = list(reversed(sorted(A)))

maxiuam = sorted_A[0]

is_there_tow_maximum = A.count(maxiuam) >= 2
if is_there_tow_maximum:
    answer = (str(maxiuam) + "\n") * N
    print(answer)

second = None
for Ai in sorted_A:
    if Ai < maxiuam:
        second = Ai
        break

answer = []
for Ai in A:
    if Ai == maxiuam:
        answer.append(second)
    else:
        answer.append(maxiuam)
answer = "\n".join(map(str, answer))

print(answer)
# Judge status: Accepted
N,M = map(int,input().split())
k = []
now = 0
ans = 0
for i in range(N):
    a,b = map(int,input().split())
    k.append([a,b])
k.sort()
for i in range(N):
    if (now+k[i][1])<M:
        ans += k[i][0]*k[i][1]
        now += k[i][1]
    else:
        ans += k[i][0]*(M-now)
        print(ans)
        break
# Judge status: Accepted
s = input()
k = int(input())

if k == 1:
    print(int(s[0]))
elif s[0] == "1":
    cnt = 0
    while  cnt < len(s) and s[cnt] == "1" :
        cnt += 1
    if cnt >= k:
        print(1)
    elif cnt == len(s):
        print("1")
    else:
        print(s[cnt])
else:
    print(int(s[0]))
# Judge status: Wrong Answer
S = str(input())
print(S[0:2])
# Judge status: Accepted
import numpy as np
W, H, N = map(int, input().split())
g = np.zeros((H, W))

for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        g[:, :x] = 1
    elif a == 2:
        g[:, x:] = 1
    elif a == 3:
        g[abs(H-y):, :] = 1
    else:
        g[:abs(H-y), :] = 1

print(np.count_nonzero(g == 0))
# Judge status: Accepted
n = input()
countArray = [0] * 2019
count = 0
countArray[0] += 1
nums=0
for i in range(len(n))[::-1]:
    nums = nums + int(n[len(n)-1-i])*pow(10,i,2019)
    countArray[nums%2019]+=1

for i in countArray:
    count += (i * (i - 1)) // 2
print(count)
# Judge status: Wrong Answer
N,L = map(int,input().split())
li = []

for i in range(N):
  li.append("".join(sorted(input())))

li.sort()
print("".join(li))
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    X, Y = [int(x) for x in input().split()]

    for i in range(101):
        for j in range(101):
            if i + j == X and (i * 2 + j * 4 == Y or i * 4 + j * 2 == Y):
                print("Yes")
                return

    print("No")


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
x, a, b = map(int, input().split())
if a <= b:
  print('delicious')
elif b - a >= x + 1:
  print('dangerous')
else:
  print('safe')
# Judge status: Accepted
S=int(input())
T=input()
S=int(S)
print('Yes' if T[:S//2]==T[S//2:] else 'No')
# Judge status: Accepted
h, w = map(int, input().split())
if h == 1 or w == 1:
    print(1)
elif h*w % 2 == 0:
    print(int(h*w/2))
else:
    print(int(h*w//2) + 1)
# Judge status: Accepted
import math

r = int(input())

pi = int(math.pi)

a = (pi * (r)**2)
ans = a / pi

print(int(ans))
# Judge status: Accepted
N,A,B = map(int, input().split())
print(sum(i for i in range(1,N+1) if A<=sum(map(int, str(i)))<=B))
# Judge status: Wrong Answer
data = ['dream','dreamer','erase','eraser']
word = input()
for i in data:
  while i in word:
    word = word.replace(i,"")
if word == "":
  print("YES")
else :
  print("NO")
# Judge status: Wrong Answer
S = input()
l = ['L', 'R', 'U', 'D']

ans='Yes' 
for i, s in enumerate(S):
  if i+1 % 2 == 0:
    if s not in ['L', 'U', 'D']:
      ans='No'
      break
  elif i+1 % 2 != 0:
    if s not in ['R', 'U', 'D']:
      ans='No'
      break

print(ans)
# Judge status: Accepted
cubic = list(map(int, input().split()))
sort_cubic = sorted(cubic, reverse=True)
a = sort_cubic[0]
b = sort_cubic[1]
c = sort_cubic[2]
red = (a // 2 ) * b * c
blue = (a - a//2) * b * c
print(abs(red - blue))
# Judge status: Accepted
N,K=map(int,input().split())
P=[1]
for k in range(17):
    P.append(P[-1]/2)

Q=0
for i in range(1,N+1):
    u=0
    x=i
    while x<K:
        u+=1
        x*=2
    Q+=P[u]

print(Q/N)
# Judge status: Accepted
import math

A,B,C,D=map(int,input().split())
g=(C*D)//math.gcd(C,D)
print((B-A+1)-(B//C--(-A//C)+1)-(B//D--(-A//D)+1)+(B//g--(-A//g)+1))
# Judge status: Wrong Answer
N=int(input())
import itertools
A = list(map(int, input().split())) 

count=0
if len(A)<=2:
    print(0)
else:
    for ｔ in itertools.combinations(A, 3):
        if t[2]<t[0]+t[1] and t[1]<t[0]+t[2] and t[0]<t[1]+t[2] and t[0]!=t[1]!=t[2]!=t[0]:
            print(t)
            count+=1

    print(count)
# Judge status: Accepted
def main():
    N, P = (int(i) for i in input().split())
    A = [int(i) % 2 for i in input().split()]
    from collections import Counter
    c = Counter(A)
    ans = 0
    if P == 0:
        ans = 2**c[0]
        if c[1]:
            ans *= 2**(c[1]-1)
    else:
        if c[1]:
            ans = 2**(c[1]-1)
        ans *= 2**c[0]
    # print(c)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
S = int(input())
T = input()

if 2800 <= S > 3200:
  print("red")
else:
  print(T)
# Judge status: Wrong Answer
N = int(input())
if N % 2 == 0:
  print((N/2-1)/(N/2))
else:
  print(0.5)
# Judge status: Wrong Answer
s = input()
 
for i in range(3):
    if s[i] == s[i+1]:
        print('Bad')
        break
print('Good')
# Judge status: Wrong Answer
s=input()
op=['+', '-']
for op1 in op:
    for op2 in op:
        for op3 in op:
            tmp=s[0]+op1+s[1]+op2+s[2]+op3+s[3]
            if eval(tmp)==7:
                print(tmp)
                break
# Judge status: Accepted
s = input()
k = int(input()) - 1


for i in range(len(s)):
    if s[i] != "1" or i == k:
        break

print(s[i])
# Judge status: Accepted
# Problem B - Five Dishes

import itertools
import math

# input process
cost_list = []
for i in range(5):
    cost_list.append(int(input()))

# initialization
min_ans = 1000

# count process
perm_list = list(itertools.permutations(cost_list))
for p in perm_list:
    p = list(p)
    # cost calc
    tmp = 0
    for i in range(len(p)):
        if i==4:
            tmp += p[i]
            break
        tmp += p[i]
        tmp = math.ceil((tmp/10))*10

    min_ans = min(min_ans, tmp)

# output process
print(min_ans)
# Judge status: Accepted
n = int(input())
print((n//2)**2) if n%2 == 0 else print((n//2) * (n//2+1))
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
# print(N,a)

a_sort = sorted(a, reverse=True)

a_sum = a_sort[0]

if N-2 % 2 == 0:
    for i in range((N-2)/2):
        a_sum += 2*a_sort[i+1]
else:
    for i in range((N-2)//2):
        a_sum += 2*a_sort[i+1]
print(a_sum)
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
d=[]
for i in range(1,100):
    if a%i==0 and b%i==0:
        d.append(i)

print(d[-1*k])
# Judge status: Wrong Answer
a,b,c = map(int,input().split())

if a*c < b:
  print(int(c))
if a*c > b:
  print(int(b/a))
else:
  print(0)
# Judge status: Accepted
n,x,y=map(int,input().split())
ans=[0]*(n-1)
for i in range(1,n):
    for j in range(i+1,1+n):
        d=min(j-i,abs(x-i)+abs(y-j)+1)
        ans[d-1]+=1

for i in ans:
    print(i)
# Judge status: Wrong Answer
a = int(input())
b = int(input())

print(a, b)

ans = [c for c in range(1, 4) if c not in [a, b]]

for i in ans:
    print(i)
# Judge status: Wrong Answer
import collections

s = list(input())
s_count = collections.Counter(s)
max_s = max(s_count[">"], s_count["<"])
ans = sum(range(1, max_s + 1))
print(ans)
# Judge status: Accepted
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
print('YES' if abs(a-b)<=t*(v-w) else 'NO')
# Judge status: Accepted
n = int(input())
AS  = list(map(int,input().split()))
cost = float('inf')

for i in range(min(AS),max(AS)+1):
  c = 0
  for a in AS:
    c += (i-a)**2
  if c < cost:
    cost = c
print(cost)
# Judge status: Wrong Answer
x, y = map(int, input().split())
x_, y_ = x, y
ans = 0

def sign(n):
    if n == 0:
        return 0
    else:
        return int(n / abs(n))

if abs(x) > abs(y):
    if x > 0:
        x_ = -x_
        ans += 1
else:
    if x < 0:
        x_ = -x_
        ans += 1
ans += abs(abs(x) - abs(y))

if sign(x_) != sign(y):
    ans += 1
print(ans)
# Judge status: Wrong Answer
S = input().split(" ")

A = int(S[0])
B = int(S[1])
C = int(S[2])
X = int(S[3])
Y = int(S[4])



def calculate(a,b,c,x,y):
    s1 = a * x + b * y

    base = min([x,y])

    values = [s1]
    for i in range(base):
        index = (i + 1)
        tmp = s1 - (A + B) * index + 2 * C * index
        values.append(tmp)
    print(min(values))

calculate(A,B,C,X,Y)
# Judge status: Wrong Answer
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]

begin = a[0::2]
end = a[1::2]

if n%2 == 0:
    end = end[:-1]
    ans = end+begin
else:
    begin = begin[::-1]
    ans = begin+end
    
Ans = ''
for i in range(len(ans)):

    if i == len(ans)-1:
        Ans = Ans + str(ans[i])
    else:
        Ans = Ans + str(ans[i]) +' '

print(Ans)
# Judge status: Accepted
N, H = map(int, input().split())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i], B[i] = map(int, input().split())

A.sort()
B.sort()
max_a = A[-1]
ans = 0
b_i = len(B) - 1
while H > 0:
    b = B[b_i]
    if b <= max_a:
        break
    H -= b
    ans += 1
    b_i -= 1
    if b_i < 0:
        break

if H <= 0:
    print(ans)
    exit()

ans += (H + max_a - 1) // max_a
print(ans)
# Judge status: Accepted
#abc173d
n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
res=0
for i in range(1,n):
 res+=l[i//2]
print(res)
# Judge status: Accepted
def lcm(a):
    import math
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // math.gcd(x, a[i])
    return x


def resolve():
    N = int(input())
    T = [int(input()) for _ in range(N)]
    print(lcm(T))


resolve()
# Judge status: Accepted
s = int(input())
v = 1000000000
x = (v-s%v)%v
y = (s+x)//v
print(0, 0, 1000000000, 1, x, y)
# Judge status: Accepted
h, w, n = map(int, [input() for _ in range(3)])
print((n-1)//max(h, w)+1)
# Judge status: Wrong Answer
N, *A = map(int, open(0).read().split())

A = [0] + A
B = [0] * (N + 1)
sum_B = 0
for i in range(N, 0, -1):
    if sum(B[j] for j in range(i, N + 1, i)) != A[i]:
        B[i] = 1
        sum_B += 1
print(sum_B)
print(*[i for i, b in enumerate(B) if b])
# Judge status: Accepted
from fractions import gcd

def lcm(m, n):
    return (m * n) // gcd(m, n)

def lcm_list(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x


N = int(input())
T = [int(input()) for _ in range(N)]
print(lcm_list(T))
# Judge status: Accepted
x = int(input())
if x>= 30:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N, M = map(int, input().split())
pAc = [list(map(int, input().split())) for _ in range(N)]
pAc.sort()
count = 0
price = 0
for p,c in pAc:
    if count + c >= M:
        print(price+(M-count)*p)
        exit()
    count += c
    price += p*c
# Judge status: Wrong Answer
N = int(input())
X = list(map(int, input().split()))
A = sorted(X)
mid = A[N//2]

for x in X:
    if x == mid:
        print(A[N//2-1])
    else:
        print(mid)
# Judge status: Accepted
X,Y=map(int,input().split())
mod=10**9+7
MAX=X+Y+1

fac=[1,1]
inv_t=[0,1]
finv=[1,1]
for i in range(2,MAX):
    fac.append(fac[-1]*i%mod)
    inv_t += [inv_t[mod % i] * (mod - mod // i) % mod]
    finv.append(finv[i-1]*inv_t[i]%mod)

x=2*X-Y
y=2*Y-X

if x%3!=0 or y%3!=0 or x*y<0:
    print(0)
else:
    x=x//3
    y=y//3
    n=x+y
    r=min(x,y)
    print((fac[n]*finv[r]*finv[n-r])%mod)
# Judge status: Wrong Answer
if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    b = 1

    if a[0]<= 0 and a[1]>=0:
        b=0
    elif b<0:
        c = abs(a-b)
        if c %2 ==1:
            b=-1


    if b >0:
        print("Positive")
    elif b ==0:
        print("Zero")
    else:
        print("Negative")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
if n == len(set(a)):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
S,T=input().split()
A,B=map(int,input().split())
U=input()
if U == S:
    print(A-1,B)
elif U == T:
    print(A,B-1)
# Judge status: Accepted
def resolve():
    a, b = map(int,input().split())
    x = (a+b) / 2
    if x % 1 == 0:
        print(int(x))
    else:
        print(int(x)+1)
resolve()
# Judge status: Accepted
a,b = map(int,input().split())
if a > 0:
    print('Positive')
else:
    if b >= 0:
        print('Zero')
    else:
        if (b-a) % 2 == 0:
            print('Negative')
        else:
            print('Positive')
# Judge status: Wrong Answer
n,m,s=map(int,input().split())
a=[]
q=[[0]]
while q:
  x=q.pop()
  if len(x)<=n:
    for j in range(x[-1],m+1):
      c=x+[j]
      q.append(c)
  else:
    a.append(x)
li=[tuple(map(int,input().split())) for _ in  range(s)]

ans=0
for A in a:
  s=0
  for i,j,k,l in li:
    if A[j]-A[i]==k:
      s+=l
  ans=max(ans,s)
print(ans)
# Judge status: Accepted
nCr = {}
def cmb(n, r):
    if n == 0: return 0
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
s = input().split()
print(cmb(int(s[0]),2) + cmb(int(s[1]),2))
# Judge status: Wrong Answer
S,W = input ().split()

if S>W:
    print("safe")
else:
    print("unsafe")
# Judge status: Accepted
x, y = map(int, input().split())
ans = 0
while (x <= y):
    x *= 2
    ans += 1
print(ans)
# Judge status: Wrong Answer
S = input()
T = input()

len_T = len(T)
len_S = len(S)
output = len_T

for i in range(len_S-len_T):
    diff = 0
    for j in range(len_T):
        if T[j] != S[i+j]:
            diff += 1
    output = min(output, diff)

print('output',output)
# Judge status: Accepted
N,x=map(int,input().split())
a=list(map(int,input().split()))
cnt=0
for i in range(N-1):
    l=a[i]+a[i+1]
    if(l>x):
        cnt+=l-x
        if(a[i+1]>=l-x):
            a[i+1]-=l-x
        else:
            a[i+1]=0
            
print(cnt)
# Judge status: Wrong Answer
N, M = map(int, input().split())
ans = (N - 2) * (M - 2)
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(n)]

p.sort(key=lambda x: x[0])
ans=0
for i in p:
    if i[1] >= m:
        ans += i[0] * m
    else:
        ans += i[0] * i[1]
    m -= i[1]

    if m <= 0:
        break
print(ans)
# Judge status: Accepted
X,Y,Z=map(int,input().split())
print(Z,X,Y)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
N, P = map(int, input().split())
a = list(map(int, input().split()))
odd = 0
even = 0
for i in range(N):
  if a[i] % 2: odd += 1
  else: even += 1
if P:
  print(int((pow(2, odd - 1) * pow(2, even) * (odd > 0))))
else:
  print(pow(2, odd - 1) * pow(2, even))
# Judge status: Accepted
N, K = map(int, input().split())
ans = 0
for i in range(N):
    now = i + 1
    loop = 0
    while now < K:
        now *= 2
        loop += 1
    ans += (1/2)**loop
print(ans/N)
# Judge status: Wrong Answer
N = int(input())
W = []
flag = True
for i in range(N):
    Wi = input()
    W.append(Wi)
    if 1<= i <=N-2:
        if W[i-1][-1] == Wi[0]:
            pass
        else:
            flag = False
if len(set(W))==len(W):
    pass
else:
    flag = False
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S = str(input())
v_list = list()

#print(S)

SS = S.replace("?", "D")
print(SS)
# Judge status: Wrong Answer
N = int(input())

ans = []

for i in range(1, N):
    n = N - i
    if n > 0 and n <= i:
        continue
    N = n
    ans.append(i)
    if n == 0:
        break

if N == 1:
    print(1)
else:
    print(*ans, sep='\n')
# Judge status: Accepted
n = int(input())
nums = list(map(int, input().split()))
ans = [-1] * n
for i in range(1, n + 1)[::-1]:
  C = i * 2
  BALL = nums[i-1]
  while C <= n:
    BALL = BALL ^ ans[C-1]
    C += i
  ans[i-1] = BALL 

print(ans.count(1))
ball = []
for i in range(n):
  if ans[i] == 1:
    ball.append(i+1)
print(*ball)
# Judge status: Accepted
n,m = map(int, input().split(" "))
xList = [int(i) for i in input().split(" ")]
xList = sorted(xList)
dList = [0]
for i in range(len(xList) -1) :
    dList.append(xList[i+1] - xList[i])
dList = sorted(dList, reverse=True)    

for i in range(n-1) :
    dList[i] = 0
    if(i == len(dList) -1) :
        break
print(sum(dList))
# Judge status: Wrong Answer

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


ans = 1
if n > 1:
    count = 0
    for i in range(1,n):
        count += 1 if pn[i-1] > pn[i] else 0

    ans += count

print(ans)
# Judge status: Accepted
D=int(input())
c=list(map(int,input().split()))
s=[]
for _ in range(D):
    ss=list(map(int,input().split()))
    s.append(ss)

for i in range(D):
    sss=s[i]
    a=sss.index(max(sss))
    print(a+1)
    i+=1
# Judge status: Wrong Answer
n = int(input())
s = input()
ans = -1*float('inf')
for i in range(1, n-1):
  ans = max(ans, len(set(s[:i])&set(s[i:])))
print(ans)
# Judge status: Wrong Answer
LOWER, UPPER = range(2)
n = 0
bounds = [0] * 32
for digit in range(32):
    n = (n << 1) | (digit & 1)
    bounds[digit] = [-(n >> (digit & 1)), n >> (not (digit & 1))]

N = int(input())

answer = 0
n = -(1 << digit)

while digit:
    answer <<= 1
    n = (-1) * n >> 1
    if bounds[digit][LOWER] <= N < bounds[digit - 1][LOWER] or \
        bounds[digit - 1][UPPER] < N <= bounds[digit][UPPER]:
        answer |= 1
        N -= n
    digit -= 1

print(format(answer, "b"))
# Judge status: Accepted
D, S, T = map(int, input().split())
if S*T >= D:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer

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

base = 10 ** 100
modu = (10 ** 9) + 7

nums = [(base + i) % modu for i in range(N+1)]

saw = []

for i in range(2**(N+1)):
    _sum = 0
    count = 0
    for j in range(N+1):
        if (i >> j) & 1:
            count += 1
            _sum += nums[j]

    if (_sum % modu not in saw) and count >= 2:
        saw.append(_sum % modu)

print(len(saw))
# Judge status: Wrong Answer
# EDPC C Vacation
N = int(input())
act = [list(map(int,input().split())) for i in range(N)]

DP = [[-float("inf"), 0] for i in range(N)]
DP[0][0] = max(act[0])
DP[0][1] = act[0].index(max(act[0]))

for i in range(1,N):
    for j in range(3):
        if DP[i-1][1] == j:
            pass
        else:
            DP[i][0] = max(DP[i][0], DP[i-1][0] + act[i][j])

print(DP[N-1][0])
# Judge status: Wrong Answer
h,n=map(int,input().split())
L=[]
for i in range(n):
    a,b=map(int,input().split())
    L.append((b/a,a,b))

dp=[100000000 for i in range(h+1)]
dp[0]=0
for i in range(h):
    for q in range(n):
        power=L[q][1]
        magic=L[q][2]
        if i+power>h:
        	break
        nex=min(h,i+power)
        dp[nex]=min(dp[nex],dp[i]+magic)

print(dp[h])
# Judge status: Accepted
import random

for i in range(365):
  print(random.randint(1, 26))
# Judge status: Wrong Answer
import bisect

n = int(input())
seq = []
for i in range(n):
    seq.append(int(input()))
seq.reverse()
LIS = [seq[0]]
for i in range(1,len(seq)):
    if seq[i] >= LIS[-1]:
        LIS.append(seq[i])
    else:
        LIS[bisect.bisect_left(LIS, seq[i])] = seq[i]

print(len(LIS))
# Judge status: Wrong Answer
n=int(input())

for i in range(50):
    if n<2**i:
        break
print(i)

out=0
for k in range(i):
    out+=2**k

print(out)
# Judge status: Wrong Answer
N  =int(input())
a = list(map(int,input().split()))
ans = (10**9)
for av in range(min(a),max(a)):
    Sum = 0
    for i in range(N):
        Sum += (a[i]-av)**2
    if Sum < ans:
        ans = Sum
print(ans)