import math

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

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

for i in range(1, k + 1):
    tmp1 = combinations_count(k - 1, i - 1) % 1000000007
    tmp2 = combinations_count(n - k + 1, i) % 1000000007
    ans = (tmp1 * tmp2) % 1000000007
    print(ans)
    if ans == 1:
        exit()

import math

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

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

for i in range(1, k + 1):
    if n - k + 1 >= i:
        tmp1 = combinations_count(k - 1, i - 1) % 1000000007
        tmp2 = combinations_count(n - k + 1, i) % 1000000007
        ans = (tmp1 * tmp2) % 1000000007
        print(ans)
    else:
        print(0)


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

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

for i in range(1, K + 1):
    if N == K:
        print(0)
    else:
        print((cmb(N - K + 1, i) % (10**9 + 7)) * (cmb(K - 1, i - 1) % (10**9 + 7)))

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

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

for i in range(1, K + 1):
    if N - K + 1 < i:
        print(0)
    else:
        print((cmb(N - K + 1, i) * cmb(K - 1, i - 1)) % (10**9 + 7))


from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

row = []
col = []
for u, v in uv:
    for i in range(3):
        uu = u + i * n
        vv = v + ((i + 1) % 3) * n
        row.append(uu)
        col.append(vv)

cost = [1] * len(row)
N = 3 * (n + 1)

g = csr_matrix((cost, (row, col)), shape=(N, N))
dist = dijkstra(g, indices=s).astype(int)
ans = dist[t]
if ans < 0:
    ans = -1
else:
    ans //= 3
print(ans)

from collections import deque

n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

N = 3 * (n + 1)
adj = [[] for _ in range(N)]
for u, v in uv:
    for i in range(3):
        uu = u + i * n
        vv = v + ((i + 1) % 3) * n
        adj[uu].append(vv)

dq = deque([s])
d = [-1] * N
d[s] = 0
while dq:
    u = dq.popleft()
    for v in adj[u]:
        if d[v] == -1:
            d[v] = d[u] + 1
            dq.append(v)

ans = d[t] // 3
print(ans)


import sys
from collections import deque

data = sys.stdin.readlines()
N, M = map(int, data[0].split())
edge = [[] for _ in range(N)]
for i in range(1, M + 1):
    u, v = map(int, data[i].split())
    u -= 1
    v -= 1
    edge[u].append(v)
S, T = map(lambda x: int(x) - 1, data[M + 1].split())

def bfs1(s):
    q = deque()
    q.append((s, 0))

    while len(q) > 0:
        v, step = q.popleft()
        if step == 3:
            edge3[s].append(v)
        else:
            for nv in edge[v]:
                q.append((nv, step + 1))

def bfs2(n):
    global T
    q = deque()
    status[n] = 0
    q.append(n)

    while len(q) > 0:
        v = q.popleft()
        for nv in edge3[v]:
            if status[nv] == -1:
                status[nv] = status[v] + 1
                q.append(nv)

edge3 = [[] for _ in range(N)]
for i in range(N):
    bfs1(i)

status = [-1] * N
status[S] = 0
bfs2(S)
print(status[T])

import sys
from collections import deque

data = sys.stdin.readlines()
N, M = map(int, data[0].split())
edge = [[] for _ in range(N)]
for i in range(1, M + 1):
    u, v = map(int, data[i].split())
    u -= 1
    v -= 1
    edge[u].append(v)
S, T = map(lambda x: int(x) - 1, data[M + 1].split())

visited = set()
q = deque()
q.append((0, S))
ans = 10**10
while len(q) > 0:
    c, v = q.popleft()
    key = (c % 3, v)
    if key in visited:
        continue
    visited.add(key)
    if v == T and c % 3 == 0:
        ans = min(ans, c // 3)
    else:
        for e in edge[v]:
            newKey = (c + 1, e)
            q.append(newKey)

if ans == 10**10:
    print(-1)
else:
    print(ans)


cord = list(input())
cord_len = len(cord)
for i in range(cord - 1):
    if cord[i] == cord[i + 1]:
        print("Bad")
        break
else:
    print("Good")

cord = list(input())
cord_len = len(cord)
for i in range(cord_len - 1):
    if cord[i] == cord[i + 1]:
        print("Bad")
        break
else:
    print("Good")

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02993/Python/s564571845.py", line 3, in <module>
    for i in range(cord - 1):
TypeError: unsupported operand type(s) for -: 'list' and 'int'


s = int(input())

ans = "Good"

s_temp = 99

for num in s:
    if int(num) == s_temp:
        ans = "Bad"
        break
    else:
        s_temp = int(num)

print(ans)

s = input()

ans = "Good"

s_temp = 99

for num in s:
    if int(num) == s_temp:
        ans = "Bad"
        break
    else:
        s_temp = int(num)

print(ans)

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02993/Python/s013728744.py", line 7, in <module>
    for num in s:
TypeError: 'int' object is not iterable


import sys

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = input()
    if n[1] == n[2] or n[2] == n[3] or n[3] == n[4]:
        print("Bad")

    else:
        print("Good")

if __name__ == "__main__":
    main()

import sys

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = input()
    if n[1] == n[2] or n[2] == n[3] or n[1] == n[0]:
        print("Bad")

    else:
        print("Good")

if __name__ == "__main__":
    main()


S = input()
if S[1] == S[2] or S[2] == S[3] or S[3] == S[4]:
    print("Bad")
else:
    print("Good")

S = input()
if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print("Bad")
else:
    print("Good")


def main():
    N, L = map(int, input().split())
    a = sum([L + n for n in range(N)])
    if L > 0:
        print(a - a[0])
    elif abs(L) >= N:
        print(a - a[-1])
    else:
        print(a)

main()

def main():
    N, L = map(int, input().split())
    a = [L + n for n in range(N)]
    if L > 0:
        print(sum(a) - a[0])
    elif abs(L) >= N:
        print(sum(a) - a[-1])
    else:
        print(sum(a))

main()

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02994/Python/s496114130.py", line 12, in <module>
    main()
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02994/Python/s496114130.py", line 5, in main
    print(a - a[0])
TypeError: 'int' object is not subscriptable


import math

a, b, c, d = [int(ch) for ch in input().strip().split()]

# upper 以下で div で割り切れるものの個数
def num_divisor(upper, div):
    return upper // div

# upper 以下で c でも d でも割り切れないものの個数
def num_divisor_c_d(upper, c, d):
    gcd_cd = c * d // math.gcd(c, d)

    n1 = num_divisor(upper, c)
    n2 = num_divisor(upper, d)
    n12 = num_divisor(upper, gcd_cd)

    return upper - (n1 + n2 - n12)

ans = num_divisor_c_d(b, c, d) - num_divisor_c_d(a - 1, c, d)

print(ans)

# import math
import fractions

a, b, c, d = [int(ch) for ch in input().strip().split()]

# upper 以下で div で割り切れるものの個数
def num_divisor(upper, div):
    return upper // div

# upper 以下で c でも d でも割り切れないものの個数
def num_divisor_c_d(upper, c, d):
    # gcd_cd = c * d // math.gcd(c, d)
    gcd_cd = c * d // fractions.gcd(c, d)

    n1 = num_divisor(upper, c)
    n2 = num_divisor(upper, d)
    n12 = num_divisor(upper, gcd_cd)

    return upper - (n1 + n2 - n12)

ans = num_divisor_c_d(b, c, d) - num_divisor_c_d(a - 1, c, d)

print(ans)


import math

A, B, C, D = map(int, input().split())

start = A // C
end = B // C
if A % C != 0:
    start = start + 1
C_num = end - start + 1

start = A // D
end = B // D
if A % D != 0:
    start = start + 1
D_num = end - start + 1

CD = C * D // math.gcd(C, D)
start = A // CD
end = B // CD
if A % CD != 0:
    start = start + 1
CD_num = end - start + 1

ans = (B - A + 1) - (C_num + D_num - CD_num)

print(ans)

def gcd(a, b):  # a < b
    while True:
        c = b % a
        if c == 0:
            break
        b = a
        a = c

    return a

A, B, C, D = map(int, input().split())

start = A // C
end = B // C
if A % C != 0:
    start = start + 1
C_num = end - start + 1

start = A // D
end = B // D
if A % D != 0:
    start = start + 1
D_num = end - start + 1

CD = C * D // gcd(C, D)
start = A // CD
end = B // CD
if A % CD != 0:
    start = start + 1
CD_num = end - start + 1

ans = (B - A + 1) - (C_num + D_num - CD_num)

print(ans)


import math

def solve():
    a, b, c, d = map(int, input().split())
    lcm = c * d // math.gcd(c, d)
    div_c = b // c - (a - 1) // c
    div_d = b // d - (a - 1) // d
    div_cd = b // lcm - (a - 1) // lcm
    return (b - a + 1) - div_c - div_d + div_cd

if __name__ == "__main__":
    print(solve())

import fractions

def solve():
    a, b, c, d = map(int, input().split())
    lcm = c * d // fractions.gcd(c, d)
    div_c = b // c - (a - 1) // c
    div_d = b // d - (a - 1) // d
    div_cd = b // lcm - (a - 1) // lcm
    return (b - a + 1) - div_c - div_d + div_cd

if __name__ == "__main__":
    print(solve())


from math import gcd

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

def cnt_div(a, b, x):
    q, r = divmod(a, x)

    if r == 0:
        m = q - 1
    else:
        m = q

    n = b // x

    return n - m

num_c = cnt_div(a, b, c)
num_d = cnt_div(a, b, d)
lcm = int((c * d) / gcd(c, d))
num_c_d_gcd = cnt_div(a, b, lcm)

print((b - a + 1) - (num_c + num_d - num_c_d_gcd))

from fractions import gcd

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

def cnt_div(a, b, x):
    q, r = divmod(a, x)

    if r == 0:
        m = q - 1
    else:
        m = q

    n = b // x

    return n - m

num_c = cnt_div(a, b, c)
num_d = cnt_div(a, b, d)
lcm = int((c * d) / gcd(c, d))
num_c_d_gcd = cnt_div(a, b, lcm)

print((b - a + 1) - (num_c + num_d - num_c_d_gcd))


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

x, y = max(c, d), min(c, d)
r = x - y
while r != 0:
    x, y = max(y, r), min(y, r)
    r = x - y
gcd = x
lcm = c * d // gcd

nc = b // c - (a - 1) // c
nd = b // d - (a - 1) // d
nlcm = b // lcm - (a - 1) // lcm

print((b - a + 1) - (nc + nd - nlcm))

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

x, y = c, d
r = x % y
while r != 0:
    x, y = y, r
    r = x % y
gcd = y
lcm = c * d // gcd

nc = b // c - (a - 1) // c
nd = b // d - (a - 1) // d
nlcm = b // lcm - (a - 1) // lcm

print((b - a + 1) - (nc + nd - nlcm))


from math import gcd

A, B, C, D = map(int, input().split())
G = gcd(C, D)
L = C * D // G
ca = (A - 1) // C
cb = B // C
da = (A - 1) // D
db = B // D
la = (A - 1) // L
lb = B // L
div = cb + db - (ca + da) - (lb - la)
print(B - (A - 1) - div)

from fractions import gcd

A, B, C, D = map(int, input().split())
G = gcd(C, D)
L = C * D // G
ca = (A - 1) // C
cb = B // C
da = (A - 1) // D
db = B // D
la = (A - 1) // L
lb = B // L
div = cb + db - (ca + da) - (lb - la)
print(B - (A - 1) - div)


import math

A, B, C, D = map(int, input().split(" "))
r = B - A + 1
n_C = round(r / C)
n_D = round(r / D)
n_CD = round(r / ((C * D) // math.gcd(C, D)))
print(r - (n_C + n_D - n_CD))

from fractions import gcd

def wari(x, c, d):
    nc = x // c
    nd = x // d
    ncd = x // ((c * d) // gcd(c, d))
    return x - nc - nd + ncd

A, B, C, D = map(int, input().split())

nb = wari(B, C, D)
na = wari(A - 1, C, D)
print(nb - na)


import math

S = input().split()

A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

CD = (C * D) // math.gcd(C, D)

count_B = B - (B // C) - (B // D) + (B // CD)
count_A = A - 1 - ((A - 1) // C) - ((A - 1) // D) + ((A - 1) // CD)

print(count_B - count_A)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

S = input().split()

A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

CD = (C * D) // gcd(C, D)

count_B = B - (B // C) - (B // D) + (B // CD)
count_A = A - 1 - ((A - 1) // C) - ((A - 1) // D) + ((A - 1) // CD)

print(count_B - count_A)


from math import gcd

A, B, C, D = [int(x) for x in input().split(" ")]

c = (B // C) - (A // C) + int(A % C == 0)
d = (B // D) - (A // D) + int(A % D == 0)
lcm_cd = (C * D) // gcd(C, D)
cd = (B // (lcm_cd)) - (A // (lcm_cd)) + int(A % (lcm_cd) == 0)

c_or_d = c + d - cd

print((B - A + 1) - c_or_d)

from fractions import gcd

A, B, C, D = [int(x) for x in input().split(" ")]

c = (B // C) - (A // C) + int(A % C == 0)
d = (B // D) - (A // D) + int(A % D == 0)
lcm_cd = (C * D) // gcd(C, D)
cd = (B // (lcm_cd)) - (A // (lcm_cd)) + int(A % (lcm_cd) == 0)

c_or_d = c + d - cd

print((B - A + 1) - c_or_d)


import math

a, b, c, d = list(map(int, input().split()))

c_n = (b // c) - ((a - 1) // c)
d_n = (b // d) - ((a - 1) // d)

lcm = (c * d) // math.gcd(c, d)
lcm_n = (b // lcm) - ((a - 1) // lcm)

ans = (b - a + 1) - (c_n + d_n - lcm_n)
print(ans)

import fractions

a, b, c, d = list(map(int, input().split()))

c_n = (b // c) - ((a - 1) // c)
d_n = (b // d) - ((a - 1) // d)

lcm = (c * d) // fractions.gcd(c, d)
lcm_n = (b // lcm) - ((a - 1) // lcm)

ans = (b - a + 1) - (c_n + d_n - lcm_n)
print(ans)


import math

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

def lcm(x, y):
    return x * y // math.gcd(x, y)

a1 = a - 1
div_a = (a1 // c) + (a1 // d) - (a1 // lcm(c, d))
div_b = (b // c) + (b // d) - (b // lcm(c, d))

print((b - a + 1) - (div_b - div_a))

# import math
import fractions

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

def lcm(x, y):
    # DeprecationWarning: fractions.gcd() is deprecated. Use math.gcd() instead.
    return x * y // fractions.gcd(x, y)

a1 = a - 1
div_a = (a1 // c) + (a1 // d) - (a1 // lcm(c, d))
div_b = (b // c) + (b // d) - (b // lcm(c, d))

print((b - a + 1) - (div_b - div_a))


import math

A, B, C, D = map(int, input().split())
lcm = C * D // math.gcd(C, D)

count = 0
div_C = B // C - math.ceil(A / C) + 1
div_D = B // D - math.ceil(A / D) + 1
div_C_D = B // lcm - math.ceil(A / lcm) + 1

print(B - A + 1 - div_C - div_D + div_C_D)

import math
import fractions

A, B, C, D = map(int, input().split())
lcm = C * D // fractions.gcd(C, D)

count = 0
if A % C == 0:
    div_C = B // C - A // C + 1
else:
    div_C = B // C - A // C

if A % D == 0:
    div_D = B // D - A // D + 1
else:
    div_D = B // D - A // D

if A % lcm == 0:
    div_C_D = B // lcm - A // lcm + 1
else:
    div_C_D = B // lcm - A // lcm

print(B - A + 1 - div_C - div_D + div_C_D)


import math

a, b, c, d = map(int, input().split())
ran = b - a + 1
if a % c == 0:
    count1 = math.ceil(ran / c)
else:
    count1 = math.ceil((ran - (c - a % c)) / c)
if a % d == 0:
    count2 = math.ceil(ran / d)
else:
    count2 = math.ceil((ran - (d - a % d)) / d)
e = c * d / math.gcd(c, d)
if a % e == 0:
    count3 = math.ceil(ran / e)
else:
    count3 = math.ceil((ran - (e - a % e)) / e)
print(ran - (count1 + count2 - count3))

import math

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

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

a, b, c, d = map(int, input().split())
ran = b - a + 1

def count(x):
    r = ran if a % x == 0 else ran - (x - a % x)
    return r // x if r % x == 0 else r // x + 1

count1 = count(c)
count2 = count(d)
e = lcm(c, d)
count3 = count(e)
print(ran - (count1 + count2 - count3))


from fractions import gcd
import math

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

def lcm(x, y):
    if math.gcd(x, y) == 0:
        return x * y
    return x * y // gcd(x, y)

def cantdiv(x):
    return x - x // c - x // d + x // lcm(c, d)

print(cantdiv(b) - cantdiv(a - 1))

from fractions import gcd

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

def lcm(x, y):
    if gcd(x, y) == 0:
        return x * y
    return x * y // gcd(x, y)

def cantdiv(x):
    return x - x // c - x // d + x // lcm(c, d)

print(cantdiv(b) - cantdiv(a - 1))

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02995/Python/s662817319.py", line 1, in <module>
    from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python3.10/fractions.py)


import math

def func(n, c, d):
    x = n // c
    y = n // d
    z = n // (c * d // math.gcd(c, d))

    return n - x - y + z

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

print(func(b, c, d) - func(a - 1, c, d))

import fractions

def func(n, c, d):
    x = n // c
    y = n // d
    z = n // (c * d // fractions.gcd(c, d))

    return n - x - y + z

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

print(func(b, c, d) - func(a - 1, c, d))


import math
import sys

input = sys.stdin.readline

def main():
    A, B, C, D = [int(i) for i in input().split()]
    # X : AとBの間の整数の数
    X = B - A + 1
    # Y : AとBの間でCの倍数の数
    Y = (B // C) - ((A - 1) // C)
    # Z : AとBの間でDの倍数の数
    Z = (B // D) - ((A - 1) // D)
    # V : CとDの最小公倍数
    V = (C * D) // math.gcd(C, D)
    # W : AとBの間でVの倍数の数
    W = (B // V) - ((A - 1) // V)
    print(X - Y - Z + W)

if __name__ == "__main__":
    main()

import sys

input = sys.stdin.readline

def gcd(*args):
    a = max(args)
    b = min(args)
    while b != 0:
        a, b = b, a % b
    return a

def main():
    A, B, C, D = [int(i) for i in input().split()]
    # X : AとBの間の整数の数
    X = B - A + 1
    # Y : AとBの間でCの倍数の数
    Y = (B // C) - ((A - 1) // C)
    # Z : AとBの間でDの倍数の数
    Z = (B // D) - ((A - 1) // D)
    # V : CとDの最小公倍数
    V = (C * D) // gcd(C, D)
    # W : AとBの間でVの倍数の数
    W = (B // V) - ((A - 1) // V)
    print(X - Y - Z + W)

if __name__ == "__main__":
    main()


import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B, C, D = map(int, input().split())

# B以下で割り切れる
UB_C = B // C
UB_D = B // D
UB_CD = B // lcm(C, D)

UB = B - (UB_C + UB_D - UB_CD)

# A以下で割り切れる
UA_C = A // C
UA_D = A // D
UA_CD = A // lcm(C, D)

UA = A - (UA_C + UA_D - UA_CD)

ans = UB - UA

if A % C != 0 and A % D != 0:
    ans += 1

print(ans)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

A, B, C, D = map(int, input().split())

# B以下で割り切れる
UB_C = B // C
UB_D = B // D
UB_CD = B // lcm(C, D)

UB = B - (UB_C + UB_D - UB_CD)

# A以下で割り切れる
UA_C = A // C
UA_D = A // D
UA_CD = A // lcm(C, D)

UA = A - (UA_C + UA_D - UA_CD)

ans = UB - UA

if A % C != 0 and A % D != 0:
    ans += 1

print(ans)


import math

a, b, c, d = map(int, input().split(" "))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def sj(base, i1, i2):
    cz = base // i1
    dz = base // i2
    cd = base // lcm(i1, i2)
    return base - (cz + dz - cd)

print(sj(b, c, d) - sj(a - 1, c, d))

from fractions import gcd

a, b, c, d = map(int, input().split(" "))

def lcm(x, y):
    return (x * y) // gcd(x, y)

def sj(base, i1, i2):
    cz = base // i1
    dz = base // i2
    cd = base // lcm(i1, i2)
    return base - (cz + dz - cd)

print(sj(b, c, d) - sj(a - 1, c, d))


import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a, b, c, d = map(int, input().split())
e = b - int(b / c) - int(b / d) + int(b / lcm(c, d))
f = (a - 1) - int((a - 1) / c) - int((a - 1) / d) + int((a - 1) / lcm(c, d))
print(e - f)

def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x

def lcm(x, y):
    return x * y // gcd(x, y)

a, b, c, d = map(int, input().split())
a = a - 1
e = b - b // c - b // d + b // lcm(c, d)
f = a - a // c - a // d + a // lcm(c, d)
print(e - f)


import math

a, b, c, d = map(int, input().split())
r = 0
bc = b // c
bd = b // d
bcd = b // ((c * d) // math.gcd(c, d))
ac = -(-a // c)
ad = -(-a // d)
acd = -(-a // ((c * d) // math.gcd(c, d)))
print(b - a + 1 - bc + ac - 1 - bd + ad - 1 + bcd - acd + 1)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

a, b, c, d = map(int, input().split())
r = 0
bc = b // c
bd = b // d
bcd = b // lcm(c, d)
ac = -(-a // c)
ad = -(-a // d)
acd = -(-a // lcm(c, d))
print(b - a + 1 - bc + ac - 1 - bd + ad - 1 + bcd - acd + 1)


from fractions import gcd

A, B, C, D = map(int, input().split())

if B < C and B < D:
    print(B - A + 1)
    exit()

CD_lcm = C * D // gcd(C, D)

n_cant_divs = []
for target in [C, D, CD_lcm]:
    if A <= target <= B:
        t_cant_div = target - A
        can_div = B // target
        t_cant_div2 = (B - target + 1) - can_div
        n_cant_divs.append(t_cant_div + t_cant_div2)
    elif target < A:
        can_div_w_over = B // target
        correction = (A - 1) // target
        actual_can_div = can_div_w_over - correction
        t_cant_div = (B - A + 1) - actual_can_div
        n_cant_divs.append(t_cant_div)

print(n_cant_divs[0] + n_cant_divs[1] - n_cant_divs[2])

from fractions import gcd

A, B, C, D = map(int, input().split())

CD_lcm = (C * D) // gcd(C, D)

def divided(a, b, target):
    return b // target - (a - 1) // target

all_num = B - A + 1

div_t1 = divided(A, B, C)
div_t2 = divided(A, B, D)
div_extra = divided(A, B, CD_lcm)

print(all_num - div_t1 - div_t2 + div_extra)

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02995/Python/s290829222.py", line 1, in <module>
    from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python3.10/fractions.py)


# -*- coding: utf-8 -*-
# モジュールのインポート
import math

# 標準入力の取得
A, B, C, D = list(map(int, input().split()))

def lcm(x: int, y: int) -> int:
    return (x * y) // math.gcd(x, y)

# 求解処理
div_C = (B // C) - ((A - 1) // C)
div_D = (B // D) - ((A - 1) // D)
lcm_CD = lcm(C, D)
div_lcm_CD = (B // lcm_CD) - ((A - 1) // lcm_CD)
result = (B - A + 1) - div_C - div_D + div_lcm_CD

# 結果出力
print(result)

# -*- coding: utf-8 -*-
# モジュールのインポート
from fractions import gcd

# 標準入力の取得
A, B, C, D = list(map(int, input().split()))

def lcm(x: int, y: int) -> int:
    return (x * y) // gcd(x, y)

# 求解処理
div_C = (B // C) - ((A - 1) // C)
div_D = (B // D) - ((A - 1) // D)
lcm_CD = lcm(C, D)
div_lcm_CD = (B // lcm_CD) - ((A - 1) // lcm_CD)
result = (B - A + 1) - div_C - div_D + div_lcm_CD

# 結果出力
print(result)


import math

a, b, c, d = map(int, input().split())
# print(b - a + 1)
e = c * d // math.gcd(c, d)
cMax = math.ceil(a / c)
cMin = math.floor(b / c)
# print(cMin - cMax + 1)
dMax = math.ceil(a / d)
dMin = math.floor(b / d)
# print(dMin - dMax + 1)
eMax = math.ceil(a / e)
eMin = math.floor(b / e)
# print(eMin - eMax + 1)

print(b - a + 1 + eMin - eMax + 1 - (cMin - cMax + 1) - (dMin - dMax + 1))

import math

a, b, c, d = map(int, input().split())
cd = (c * d) // math.gcd(c, d)
u = b // c + b // d - b // cd
l = (a - 1) // c + (a - 1) // d - (a - 1) // cd

print(b - a + 1 - u + l)


import math

def main():
    A, B, C, D = map(int, input().split())
    lcm = (C * D) // math.gcd(C, D)
    bc = B // C
    ac = A // C
    if A % C == 0:
        ac -= 1
    bd = B // D
    ad = A // D
    if A % D == 0:
        ad -= 1
    blcm = B // lcm
    alcm = A // lcm
    if A % lcm == 0:
        alcm -= 1
    print(B - A + 1 - ((bc - ac) + (bd - ad) - (blcm - alcm)))

main()

import fractions

def main():
    A, B, C, D = map(int, input().split())
    lcm = (C * D) // fractions.gcd(C, D)
    bc = B // C
    ac = A // C
    if A % C == 0:
        ac -= 1
    bd = B // D
    ad = A // D
    if A % D == 0:
        ad -= 1
    blcm = B // lcm
    alcm = A // lcm
    if A % lcm == 0:
        alcm -= 1
    print(B - A + 1 - ((bc - ac) + (bd - ad) - (blcm - alcm)))

main()


from math import gcd

A, B, C, D = map(int, input().split())
C_div = B // C - (A - 1) // C
D_div = B // D - (A - 1) // D
CD = C * D // gcd(C, D)
CD_div = B // CD - (A - 1) // CD
print(B - A + 1 - C_div - D_div + CD_div)

from fractions import gcd

A, B, C, D = map(int, input().split())
C_div = B // C - (A - 1) // C
D_div = B // D - (A - 1) // D
CD = C * D // gcd(C, D)
CD_div = B // CD - (A - 1) // CD
print(B - A + 1 - C_div - D_div + CD_div)


from sys import stdin
import math

A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

def div(n, x, y):
    lcs = int(x * y / math.gcd(x, y))
    return n - int(n // x) - int(n // y) + int(n // lcs)

print(div(B, C, D) - div(A - 1, C, D))

from sys import stdin
import fractions

A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

def div(n, x, y):
    lcs = int(x * y / fractions.gcd(x, y))
    return n - int(n // x) - int(n // y) + int(n // lcs)

print(div(B, C, D) - div(A - 1, C, D))


import math

A, B, C, D = map(int, input().split())

cntC = B // C - A // C + int(A % C == 0)
cntD = B // D - A // D + int(A % D == 0)

lcm = C * D // math.gcd(C, D)
cntCD = B // lcm - A // lcm + int(A % lcm == 0)

print((B - A + 1) - (cntC + cntD - cntCD))

import fractions

A, B, C, D = map(int, input().split())

cntC = B // C - A // C + int(A % C == 0)
cntD = B // D - A // D + int(A % D == 0)

lcm = C * D // fractions.gcd(C, D)
cntCD = B // lcm - A // lcm + int(A % lcm == 0)

print((B - A + 1) - (cntC + cntD - cntCD))


import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def main():
    A, B, C, D = map(int, input().split())
    first = B // C - A // C
    first += 1 if A % C == 0 else 0
    second = B // D - A // D
    second += 1 if A % D == 0 else 0
    tmp = lcm(C, D)
    both = B // tmp - A // tmp
    both += 1 if A % tmp == 0 else 0
    print(B - A + 1 - first - second + both)
    return

main()

# バージョン 3.4.X 以前
import fractions

# バージョン 3.5 以降
# mport math

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def main():
    A, B, C, D = map(int, input().split())
    first = B // C - A // C
    first += 1 if A % C == 0 else 0
    second = B // D - A // D
    second += 1 if A % D == 0 else 0
    tmp = lcm(C, D)
    both = B // tmp - A // tmp
    both += 1 if A % tmp == 0 else 0
    print(B - A + 1 - first - second + both)
    return

main()


from math import gcd

def main():
    A, B, C, D = map(int, input().split())
    Q_AC, R_AC = A // C, A % C
    Q_AD, R_AD = A // D, A % D
    Q_BC, R_BC = B // C, B % C
    Q_BD, R_BD = B // D, B % D
    Q_ACD, R_ACD = A // lcm(C, D), A % lcm(C, D)
    Q_BCD, R_BCD = B // lcm(C, D), B % lcm(C, D)
    N_C = num_baisu(Q_AC, Q_BC, R_AC, R_BC)
    N_D = num_baisu(Q_AD, Q_BD, R_AD, R_BD)
    N_CD = num_baisu(Q_ACD, Q_BCD, R_ACD, R_BCD)
    print(B - A + 1 - (N_C + N_D - N_CD))
    return

def lcm(x, y):
    return (x * y) // gcd(x, y)

def num_baisu(Q_A, Q_B, R_A, R_B):
    if R_A == 0 and R_B == 0:
        return Q_B - Q_A + 1
    elif R_A == 0 and R_B != 0:
        return Q_B - Q_A + 1
    elif R_A != 0 and R_B == 0:
        return Q_B - (Q_A + 1) + 1
    else:
        return Q_B - (Q_A + 1) + 1

if __name__ == "__main__":
    main()

from fractions import gcd

def main():
    A, B, C, D = map(int, input().split())
    Q_AC, R_AC = A // C, A % C
    Q_AD, R_AD = A // D, A % D
    Q_BC, R_BC = B // C, B % C
    Q_BD, R_BD = B // D, B % D
    Q_ACD, R_ACD = A // lcm(C, D), A % lcm(C, D)
    Q_BCD, R_BCD = B // lcm(C, D), B % lcm(C, D)
    N_C = num_baisu(Q_AC, Q_BC, R_AC, R_BC)
    N_D = num_baisu(Q_AD, Q_BD, R_AD, R_BD)
    N_CD = num_baisu(Q_ACD, Q_BCD, R_ACD, R_BCD)
    print(B - A + 1 - (N_C + N_D - N_CD))
    return

def lcm(x, y):
    return (x * y) // gcd(x, y)

def num_baisu(Q_A, Q_B, R_A, R_B):
    if R_A == 0 and R_B == 0:
        return Q_B - Q_A + 1
    elif R_A == 0 and R_B != 0:
        return Q_B - Q_A + 1
    elif R_A != 0 and R_B == 0:
        return Q_B - (Q_A + 1) + 1
    else:
        return Q_B - (Q_A + 1) + 1

if __name__ == "__main__":
    main()


import math

class AntiDivision:
    def __init__(self):
        self.A, self.B, self.C, self.D = map(int, input().split())

    def cal(self):
        a_b_count = self.B - self.A + 1
        lcm = (self.C * self.D) // math.gcd(self.C, self.D)
        c_count = self.B // self.C - (self.A - 1) // self.C
        d_count = self.B // self.D - (self.A - 1) // self.D
        lcm_count = self.B // lcm - (self.A - 1) // lcm

        print(a_b_count - c_count - d_count + lcm_count)

antiDivision = AntiDivision()
antiDivision.cal()

import fractions

class AntiDivision:
    def __init__(self):
        self.A, self.B, self.C, self.D = map(int, input().split())

    def cal(self):
        a_b_count = self.B - self.A + 1
        lcm = (self.C * self.D) // fractions.gcd(self.C, self.D)
        c_count = self.B // self.C - (self.A - 1) // self.C
        d_count = self.B // self.D - (self.A - 1) // self.D
        lcm_count = self.B // lcm - (self.A - 1) // lcm

        print(a_b_count - c_count - d_count + lcm_count)

antiDivision = AntiDivision()
antiDivision.cal()


def dec(X, d):
    X[1] -= d
    return X

N = int(input())
task = [list(map(int, input().split())) for _ in range(N)]

task.sort(key=lambda x: x[1])

while task:
    if task[0][1] - task[0][0] < 0:
        print("No")
        exit()
    task = list(map(lambda x: dec(x, task[0][0]), task[1:]))

print("Yes")

def dec(X, d):
    X[1] -= d
    return X

N = int(input())
task = [list(map(int, input().split())) for _ in range(N)]

task.sort(key=lambda x: x[1])
time = 0
for i in range(N):
    time += task[i][0]
    if time > task[i][1]:
        print("No")
        exit()

print("Yes")


from itertools import combinations

n, k = map(int, input().split())
star = []
max_k = (n - 1) * (n - 2) // 2
delta = max_k - k
cnt = 0
if k <= max_k:
    ans = []
    for i in range(2, n + 1):
        star.append((1, i))
        cnt += 1

    if delta > 0:
        kumiawase = list(combinations(range(2, n), 2))
        for j in range(delta):
            kumi = kumiawase[j]
            star.append(kumi)
            cnt += 1
    print(cnt)
    for pair in star:
        print(*pair, sep=" ")
else:
    print(-1)

from itertools import combinations

n, k = map(int, input().split())
star = []
max_k = (n - 1) * (n - 2) // 2
delta = max_k - k
cnt = 0
if k <= max_k:
    ans = []
    for i in range(2, n + 1):
        star.append((1, i))
        cnt += 1

    if delta > 0:
        kumiawase = list(combinations(range(2, n + 1), 2))
        for j in range(delta):
            kumi = kumiawase[j]
            star.append(kumi)
            cnt += 1
    print(cnt)
    for pair in star:
        print(*pair, sep=" ")
else:
    print(-1)


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

if k <= (n - 1) * (n - 2) // 2:
    raise Exception
else:
    print(-1)

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

if k <= (n - 1) * (n - 2) // 2:
    g = [0] * (n * n)
    for i in range(n * n):
        u = i // n
        v = i % n
        if u < v:
            g[i] = 1

    i = 0
    for _ in range(k):
        while g[i] == 0 or i % n == n - 1:
            i += 1
        g[i] = 0

    cnt = sum(g)
    print(cnt)
    for i, e in enumerate(g):
        if e:
            u = i // n + 1
            v = i % n + 1
            print(u, v)

else:
    print(-1)

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02997/Python/s244694894.py", line 4, in <module>
    raise Exception
Exception


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

if K > (N - 1)(N - 2) // 2:
    print(-1)
else:
    M = N * (N - 1) // 2 - K
    cnt = 0
    ans = []
    for i in range(N - 1):
        for j in range(i + 1, N):
            ans.append((i + 1, j + 1))
            cnt += 1
            if M == cnt:
                break
        else:
            continue
        break
    print(M)
    for edge in ans:
        print(*edge)

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

if K > (N - 1) * (N - 2) // 2:
    print(-1)
else:
    M = N * (N - 1) // 2 - K
    cnt = 0
    ans = []
    for i in range(N - 1):
        for j in range(i + 1, N):
            ans.append((i + 1, j + 1))
            cnt += 1
            if M == cnt:
                break
        else:
            continue
        break
    print(M)
    for edge in ans:
        print(*edge)

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02997/Python/s559992185.py", line 3, in <module>
    if K > (N - 1)(N - 2) // 2:
TypeError: 'int' object is not callable


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

max_num = (N - 1) * (N - 2) // 2

for i in range(2, N + 1):
    print(1, i)

add = max_num - K

edges = []
for i in range(2, N):
    for j in range(i + 1, N + 1):
        edges.append(i, j)

for i in range(add):
    print(edges[i])

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

max_num = (N - 1) * (N - 2) // 2

if K > max_num:
    print(-1)
else:
    edges = []
    for i in range(2, N + 1):
        edges.append(
            (
                1,
                i,
            )
        )

    add = max_num - K

    candidates = []
    for i in range(2, N):
        for j in range(i + 1, N + 1):
            candidates.append(
                (
                    i,
                    j,
                )
            )

    for i in range(add):
        edges.append(candidates[i])

    print(len(edges))
    for edge in edges:
        print(" ".join(map(str, edge)))

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02997/Python/s568785222.py", line 13, in <module>
    edges.append(i, j)
TypeError: list.append() takes exactly one argument (2 given)


from e import resolve
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5 3"""
        output = """5
4 3
1 2
3 1
4 5
2 3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5 8"""
        output = """-1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """5 1"""
        output = """-1"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """5 0"""
        output = """-1"""
        self.assertIO(input, output)

if __name__ == "__main__":
    unittest.main()

import bisect, collections, copy, heapq, itertools, math, string, sys

input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
INF = float("inf")

def I():
    return int(input())

def F():
    return float(input())

def SS():
    return input()

def LI():
    return [int(x) for x in input().split()]

def LI_():
    return [int(x) - 1 for x in input().split()]

def LF():
    return [float(x) for x in input().split()]

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

def resolve():
    N, K = LI()

    # Kの上界として、全ての頂点対の数がある。
    # グラフが連結なので頂点数-1個の頂点対は最短距離1になる。
    # よってKの最大値はNC2-(N-1)
    max_K = N * (N - 1) // 2 - (N - 1)
    if K <= max_K:
        # Kが最大値を取るのはスター型
        # そこから葉同士をくっつけて減らしていく
        print((N - 1) + max_K - K)
        for i in range(1, N):
            print(i, N)
        cnt = max_K
        for i, j in itertools.combinations(range(1, N), 2):
            if cnt == K:
                break
            print(i, j)
            cnt -= 1
    else:
        print(-1)

if __name__ == "__main__":
    resolve()

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02997/Python/s904121924.py", line 1, in <module>
    from e import resolve
ModuleNotFoundError: No module named 'e'


n, k = map(int, input().split())
ans = []
c = (n - 1) * (n - 2) // 2 - k
if c < k:
    print(-1)
    exit(1)
for i in range(1, n):
    ans.append((0, i))
cnt = 0
flg = 0
for i in range(1, n):
    if flg:
        break
    for j in range(1, n):
        if i == j:
            continue
        ans.append((i, j))
        cnt += 1
        if cnt >= c:
            flg = 1
            break
print(len(ans))
for a, b in ans:
    print(a, b)

n, k = map(int, input().split())
ans = []
c = (n - 1) * (n - 2) // 2 - k
if c < 0:
    print(-1)
    exit(0)
for i in range(1, n):
    ans.append((0, i))
cnt = 0
flg = 0
for i in range(1, n):
    if flg:
        break
    for j in range(i + 1, n):
        if cnt >= c:
            flg = 1
            break
        ans.append((i, j))
        cnt += 1
print(len(ans))
for a, b in ans:
    print(a + 1, b + 1)


n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
xtoy = {}
ytox = {}
for x, y in xy:
    if x not in xtoy:
        xtoy[x] = []
    xtoy[x].append(y)
    if y not in ytox:
        ytox[y] = []
    ytox[y].append(x)
ret = 0
while len(xtoy) > 0:
    q = [(next(iter(xtoy)), None)]
    xs = set()
    ys = set()
    while len(q) > 0:
        (x, y) = q.pop(0)
        if x is not None and x not in xs:
            xs.add(x)
            for y in xtoy.pop(x):
                q.append((None, y))
        if y is not None and y not in ys:
            ys.add(y)
            for x in ytox.pop(y):
                q.append((x, None))
    ret += len(xs) * len(ys)
print(ret - n)

n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
xtoy = {}
ytox = {}
for x, y in xy:
    if x not in xtoy:
        xtoy[x] = []
    xtoy[x].append(y)
    if y not in ytox:
        ytox[y] = []
    ytox[y].append(x)
ret = 0
while len(xtoy) > 0:
    x = next(iter(xtoy))
    xs = set()
    ys = set()
    xs.add(x)
    q = [(x, None)]
    while len(q) > 0:
        (xx, yy) = q.pop(0)
        if xx is not None:
            for y in xtoy.pop(xx):
                if y not in ys:
                    ys.add(y)
                    q.append((None, y))
        if yy is not None:
            for x in ytox.pop(yy):
                if x not in xs:
                    xs.add(x)
                    q.append((x, None))
    ret += len(xs) * len(ys)
print(ret - n)


x, a = map(int, input())
if x < a:
    print(0)
else:
    print(10)

x, a = map(int, input().split())
if x < a:
    print(0)
else:
    print(10)

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02999/Python/s478583937.py", line 1, in <module>
    x, a = map(int, input())
ValueError: invalid literal for int() with base 10: ' '


# A Rounding

x, a = map(int, input().split())
if x < a:
    print(0)
else:
    print(10)

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02999/Python/s947229710.py", line 1, in <module>
    x, a = map(int, input())
ValueError: invalid literal for int() with base 10: ' '


# -*- coding: utf-8 -*-

x, a = int(input()), int(input())

if x < a:
    print("0")
else:
    print("10")

# -*- coding: utf-8 -*-

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

if x < a:
    print("0")
else:
    print("10")

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02999/Python/s027313793.py", line 3, in <module>
    x, a = int(input()), int(input())
ValueError: invalid literal for int() with base 10: '3 5'


X, A = map(int, input())
if X < A:
    print(0)
else:
    print(10)

X, A = map(int, input().split())
if X < A:
    print(0)
else:
    print(10)

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02999/Python/s897076551.py", line 1, in <module>
    X, A = map(int, input())
ValueError: invalid literal for int() with base 10: ' '


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

ans = 1
D = 0
for i in range(N + 1):
    if D + positions[i] <= X:
        D += positions[i]
        ans += 1
    else:
        print(ans)
        exit()
print(ans)

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

ans = 1
D = 0
for i in range(N):
    if D + positions[i] <= X:
        D += positions[i]
        ans += 1
    else:
        print(ans)
        exit()
print(ans)


a, b = map(int, input().split())
c = list(map(int, input().split()))
d = 1
e = 0
for i in range(a):
    e += c[i]
    if e <= b:
        d += 1
print(d)
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = 1
e = 0
for i in range(a):
    e += c[i]
    if e <= b:
        d += 1
    else:
        break
print(d)

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03000/Python/s443147037.py", line 10, in <module>
    a, b = map(int, input().split())
EOFError: EOF when reading a line


N, X = map(int, input().split())
L = list(map(int, input().split()))
x = 0
i = 0
while x <= X:
    x += L[i]
    i += 1
print(i)

N, X = map(int, input().split())
L = list(map(int, input().split()))
x = 0
ans = 1
for i in range(N):
    x += L[i]
    if x > X:
        break
    else:
        ans += 1
print(ans)


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

if __name__ == "__main__":
    [n, x] = li()
    l_list = li()

    bound = 0
    bound_x = 0
    index = 0
    while bound_x <= x:
        bound = bound + 1
        bound_x = bound_x + l_list[index]
        index = index + 1
    print(bound)

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

if __name__ == "__main__":
    [n, x] = li()
    l_list = li()

    bound = 0
    bound_x = 0
    index = 0
    bound = bound + 1
    while bound_x + l_list[index] <= x:
        bound = bound + 1
        bound_x = bound_x + l_list[index]
        index = index + 1
        if index >= len(l_list):
            break

    print(bound)


n, x = map(int, input().split())
ls = list(map(int, input().split()))

d = 0
count = 0
while d <= x:
    d += ls[count]
    count += 1

print(count)

n, x = map(int, input().split())
ls = list(map(int, input().split()))

d = 0
count = 1
for a in ls:
    d += a
    if d <= x:
        count += 1

print(count)


# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
boundCnt = i[0]
limit = i[1]

# 入力の取得(2行目。数値)
landpoints = list(map(int, input().split()))

nowCnt = 0
nowLandpoints = 0
for i in range(boundCnt + 1):
    if nowLandpoints > limit:
        break
    nowCnt += 1
    nowLandpoints += landpoints[i]

print(nowCnt)

# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
boundCnt = i[0]
limit = i[1]

# 入力の取得(2行目。数値)
landpoints = list(map(int, input().split()))
# 1回目のバウンド情報を加算(0座標)
landpoints.insert(0, 0)
boundCnt += 1

nowCnt = 0
nowLandpoints = 0

for i in range(boundCnt):

    nowLandpoints += landpoints[i]
    if nowLandpoints > limit:
        break

    nowCnt += 1

print(nowCnt)


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

i = 0
D = 0

if L[0] > X:
    print(1)
    exit()
elif L[0] == X:
    print(2)
    exit()

while D <= X and i <= N:
    D += L[i]
    i += 1

print(i)

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

i = 0
D = 0
cnt = 1

for i in range(N):
    D += L[i]
    if D <= X:
        cnt += 1
print(cnt)


def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    cnt = 1
    D = 0

    while True:
        if D > X:
            cnt -= 1
            break
        if cnt > N + 1:
            cnt -= 1
            break
        D += L[cnt - 1]
        cnt += 1

    print(cnt)

if __name__ == "__main__":
    main()

def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    D = 0

    for cnt in range(2, N + 2):
        D += L[cnt - 2]
        if D > X:
            cnt -= 1
            break

    print(cnt)

if __name__ == "__main__":
    main()


import sys

input = sys.stdin.readline

w, h, x, y = map(int, input().split())

if w == h:
    print(f"{w * h / 2} 1")
else:
    print(f"{w * h / 2} 0")

import sys

input = sys.stdin.readline

w, h, x, y = map(int, input().split())

if w % 2 == 0 and h % 2 == 0 and w // 2 == x and h // 2 == y:
    print(str(w * h / 2) + " " + "1")
else:
    print(str(w * h / 2) + " " + "0")


# 真ん中を通れば必ず二分できてこれが最大値だが、自分自身が真ん中の座標の場合は自分自信を通るどんな直線も二分できる
w, h, x, y = map(int, input().split())
ans1 = (w * h) / 2.0
ans2 = 1 if w // x == h // y == 2 else 0
print(ans1, ans2)

# 真ん中を通れば必ず二分できてこれが最大値だが、自分自身が真ん中の座標の場合は自分自信を通るどんな直線も二分できる
w, h, x, y = map(int, input().split())
ans1 = (w * h) / 2.0
ans2 = 1 if w / 2 == x and h / 2 == y else 0
print(ans1, ans2)


W, H, x, y = map(int, input().split())
jufuku = 0
if x == 0 and y == 0:
    if y / x == H / W:
        naname = W * H / 2
        jufuku = 1
        kiri = naname
else:
    # 縦
    tate = min((W - x) * H, x * H)
    # 横
    yoko = min(W * (H - y), W * y)
    if tate == yoko:
        jufuku = 1
    kiri = max(tate, yoko)
print(kiri, jufuku)

W, H, x, y = map(int, input().split())
jufuku = 0
if W / 2 == x and H / 2 == y:
    jufuku = 1
print(W * H / 2, jufuku)


W, H, x, y = map(int, input().split())
print(W * H / 2, 1 if W / x == 2 and H / y == 2 else 0)

W, H, x, y = map(int, input().split())
print(W * H / 2, 1 if x != 0 and y != 0 and W / x == 2 and H / y == 2 else 0)


W, H, x, y = map(int, input().split())

s = W * H
if W % x == 0 and H % y == 0:
    print("{0} {1}".format(W * H // 2, 1))
else:
    a = W * y
    b = H * x
    p = 1 if a == b else 0
    print("{0} {1}".format(min(a, b), p))

W, H, x, y = map(int, input().split())
if W / 2 == x and H / 2 == y:
    p = 1
else:
    p = 0

print("{} {}".format(W * H / 2, p))


# dp[i][j] SとTの最後の文字を採用するような文字列の個数。これにより各DPテーブルの値が排反になる。元の文字列の最後を必ず採用するので
N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
MOD = 10**9 + 7
dp = [[0] * (M + 2) for _ in range(N + 2)]
sdp = [[0] * (M + 2) for _ in range(N + 2)]
dp[0][0] = 1
sdp[1][1] = 1
for i in range(N + 1):
    for j in range(M + 1):
        if i - 1 >= 0 and j - 1 >= 0 and S[i - 1] == T[j - 1]:
            dp[i][j] = sdp[i][j]
        sdp[i + 1][j + 1] = sdp[i + 1][j] + sdp[i][j + 1] - sdp[i][j] + dp[i][j]
        sdp[i + 1][j + 1] %= MOD
        sdp[i + 1][j + 1] %= MOD
print(sdp[N + 1][M + 1])


from itertools import permutations
from collections import Counter

n = int(input())
balls = []

for _ in range(n):
    x, y = map(int, input().split())
    balls.append((x, y))

counter = Counter()
for b1, b2 in permutations(balls, 2):
    p, q = b1[0] - b2[0], b1[1] - b2[1]
    counter[(p, q)] += 1

(p, q), val = counter.most_common(1)[0]
print(n - val)

from itertools import permutations
from collections import Counter

n = int(input())
balls = []

for _ in range(n):
    x, y = map(int, input().split())
    balls.append((x, y))

if n == 1:
    print(1)
else:
    counter = Counter()
    for b1, b2 in permutations(balls, 2):
        p, q = b1[0] - b2[0], b1[1] - b2[1]
        counter[(p, q)] += 1

    (p, q), val = counter.most_common(1)[0]
    print(n - val)


import sys
from collections import Counter

N = int(input())
points = []
for i, line in enumerate(sys.stdin):
    x, y = map(int, line.split())
    points.append([x, y])
    if i == N - 1:
        break

counts = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        p = points[j][0] - points[i][0]
        q = points[j][1] - points[i][1]
        counts.append((p, q))

pq = Counter(counts).most_common()[0][1]
cost = N - pq
print(cost)

import sys
from collections import Counter

N = int(input())
points = []
for i, line in enumerate(sys.stdin):
    x, y = map(int, line.split())
    points.append([x, y])
    if i == N - 1:
        break
if len(points) == 1:
    print(1)
    sys.exit(0)

counts = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        p = points[j][0] - points[i][0]
        q = points[j][1] - points[i][1]
        counts.append((p, q))

pq = Counter(counts).most_common()[0][1]
cost = N - pq
print(cost)


# https://atcoder.jp/contests/diverta2019-2/tasks/diverta2019_2_b
# 問題文はよく読もうね！

# 実際にボールを拾っていくシミュレーションをしていっても十分間に合う

from itertools import combinations
from collections import defaultdict
from operator import itemgetter

N = int(input())
points = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0

def is_online(x0, y0, xa, ya, p, q):
    # x0,y0を通る直線がp,qで与えられたときに、xa,yaがその線上にあるか判別
    dx = xa - x0
    dy = ya - y0
    if dx == 0 and dy == 0:
        return True
    elif dx == 0 or dy == 0:
        return False
    # print(x0, y0, xa, ya, p, q)
    return (dy / dx) == (q / p)  # 傾きが同じならば線上にある

def pickballs(balls):
    # cnt most frequent p,q
    global ans

    # 最適なpq探索
    cnts = defaultdict(lambda: 0)
    for pa, pb in combinations(balls, 2):
        dx = pa[0] - pb[0]
        dy = pa[1] - pb[1]
        if dx == 0 or dy == 0:
            continue
        if dx < 0:
            dx *= -1
            dy *= -1
        cnts[(dx, dy)] += 1
    p, q = max(cnts.items(), key=itemgetter(1))[0]

    # 最適な最初のpickball探索
    cnts = defaultdict(lambda: 0)
    for p0 in balls:
        for p1 in balls:
            if p0 == p1:
                continue
            if is_online(p0[0], p0[1], p1[0], p1[1], p, q):
                cnts[p0] += 1
    x, y = max(cnts.items(), key=itemgetter(1))[0]

    # 実際にpickball
    ans += 1
    ret = []
    for p1 in balls:
        if is_online(x, y, p1[0], p1[1], p, q):
            continue
        ret.append(p1)
    return ret

while points:
    points = pickballs(points)
print(ans)

# https://atcoder.jp/contests/diverta2019-2/tasks/diverta2019_2_b

from itertools import combinations
from collections import defaultdict

N = int(input())
points = [tuple(map(int, input().split())) for _ in range(N)]

if N == 1:
    print(1)
    exit()

# points.sort()  # 先にソートしておくと大小関係の処理が楽

cnts = defaultdict(lambda: 0)
for pa, pb in combinations(points, 2):
    dx = pa[0] - pb[0]
    dy = pa[1] - pb[1]
    if dx < 0:  # 事前にソートしておくとココらへんの処理がいらなくなるよ
        dx *= -1
        dy *= -1
    if dx == 0:
        dy = max(dy, -dy)
    if dy == 0:
        dx = max(dx, -dx)
    cnts[(dx, dy)] += 1

print(N - max(cnts.values()))


n = int(input())
a = [tuple(map(int, input().split())) for i in range(n)]
t = set(a)
minans = 1000000000000
for i in range(n):
    for j in range(i + 1, n):
        r = t.copy()
        p = a[i][0] - a[j][0]
        q = a[i][1] - a[j][1]
        curans = 0
        while r:
            curans += 1
            m = r.pop()
            z = m.copy()
            while (m[0] + p, m[1] + q) in r:
                m = (m[0] + p, m[1] + q)
                r.remove(m)
            m = z.copy()
            while (m[0] - p, m[1] - q) in r:
                m = (m[0] - p, m[1] - q)
                r.remove(m)
        minans = min(minans, curans)
print(minans)

n = int(input())
a = [tuple(map(int, input().split())) for i in range(n)]
t = set(a)
assert len(t) == len(a)
minans = 1000000000000
for i in range(n):
    for j in range(i + 1, n):
        r = t.copy()
        p = a[i][0] - a[j][0]
        q = a[i][1] - a[j][1]
        curans = 0
        while r:
            curans += 1
            m = r.pop()
            z = m
            while (m[0] + p, m[1] + q) in r:
                m = (m[0] + p, m[1] + q)
                r.remove(m)
            m = z
            while (m[0] - p, m[1] - q) in r:
                m = (m[0] - p, m[1] - q)
                r.remove(m)
        minans = min(minans, curans)
if minans == 1000000000000:
    print(1)
else:
    print(minans)

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03006/Python/s146476051.py", line 14, in <module>
    z = m.copy()
AttributeError: 'tuple' object has no attribute 'copy'


import collections

def calc(balla, ballb):
    xa, ya = balla
    xb, yb = ballb
    return xa - xb, ya - yb

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

a = []
for i in range(0, n - 1):
    for j in range(i + 1, n):
        tmp = calc(balls[i], balls[j])
        a += [tmp, tuple(-i for i in tmp)]
counts = collections.Counter(a)

print(n - max(counts.values()))

import collections

def calc(balla, ballb):
    xa, ya = balla
    xb, yb = ballb
    return xa - xb, ya - yb

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

if n == 1:
    print(1)
    exit()

a = []
for i in range(0, n - 1):
    for j in range(i + 1, n):
        tmp = calc(balls[i], balls[j])
        a += [tmp, tuple(-i for i in tmp)]
counts = collections.Counter(a)

print(n - max(counts.values()))


n = int(input())
xy = set(tuple(map(int, input().split())) for _ in range(n))

costs = []
for a in xy:
    besides_a = xy - {a}
    for b in besides_a:
        p = b[0] - a[0]
        q = b[1] - a[1]
        arrow_num = 0
        for c in xy:
            if (c[0] + p, c[1] + q) in xy:
                arrow_num += 1
        cost = n - arrow_num
        costs.append(cost)

print(min(costs))

n = int(input())
xy = set(tuple(map(int, input().split())) for _ in range(n))

costs = []
for a in xy:
    besides_a = xy - {a}
    for b in besides_a:
        p = b[0] - a[0]
        q = b[1] - a[1]
        arrow_num = 0
        for c in xy:
            if (c[0] + p, c[1] + q) in xy:
                arrow_num += 1
        cost = n - arrow_num
        costs.append(cost)

if n == 1:
    print(1)
else:
    print(min(costs))


from collections import Counter

N = int(input())
points = [tuple(map(int, input().split())) for _ in range(N)]
counter = Counter()

for i, a in enumerate(points):
    for j in range(N):
        if j == i:
            continue
        b = points[j]
        dx = b[0] - a[0]
        dy = b[1] - a[1]
        counter[(dx, dy)] += 1

vec, _ = counter.most_common()[0]
dx, dy = vec
visited = set()
cost = 0

for p in points:
    if p in visited:
        continue
    x, y = p
    visited.add(p)
    if (x + dx, y + dy) in visited or (x - dx, y - dy) in visited:
        continue
    cost += 1

print(cost)

from collections import Counter

def main():
    N = int(input())
    points = [tuple(map(int, input().split())) for _ in range(N)]
    counter = Counter()

    if N == 1:
        print(1)
        return

    for i in range(N):
        for j in range(N):
            if j == i:
                continue
            a = points[i]
            b = points[j]
            dx = b[0] - a[0]
            dy = b[1] - a[1]
            counter[(dx, dy)] += 1

    vec, _ = counter.most_common()[0]
    dx, dy = vec
    visited = set()
    pointset = set(points)
    cost = 0

    for p in points:
        if p in visited:
            continue
        visited.add(p)
        x, y = p
        cost += 1

        i = 1
        while True:
            n = (x + i * dx, y + i * dy)
            i += 1
            if n in pointset:
                visited.add(n)
            else:
                break
        i = 1
        while True:
            n = (x - i * dx, y - i * dy)
            i += 1
            if n in pointset:
                visited.add(n)
            else:
                break

    print(cost)

main()


N = int(input())
xy = []
for _ in range(N):
    x, y = map(int, input().split())
    xy.append((x, y))

d = {}
for i in range(N):
    tmp = set()
    for j in range(N):
        if i == j:
            continue
        dx = xy[i][0] - xy[j][0]
        dy = xy[i][1] - xy[j][1]

        if (dx, dy) in tmp:
            continue
        if (dx, dy) not in d:
            d[(dx, dy)] = 1
        else:
            d[(dx, dy)] += 1
        tmp.add((dx, dy))

d = sorted(d.items(), key=lambda x: x[1], reverse=True)
cnt = d[0][1]
print(N - cnt)

def main():
    N = int(input())
    if N == 1:
        print(1)
        return
    xy = []
    for _ in range(N):
        x, y = map(int, input().split())
        xy.append((x, y))

    d = {}
    for i in range(N):
        tmp = set()
        for j in range(N):
            if i == j:
                continue
            dx = xy[i][0] - xy[j][0]
            dy = xy[i][1] - xy[j][1]

            if (dx, dy) in tmp:
                continue
            if (dx, dy) not in d:
                d[(dx, dy)] = 1
            else:
                d[(dx, dy)] += 1
            tmp.add((dx, dy))

    d = sorted(d.items(), key=lambda x: x[1], reverse=True)
    cnt = d[0][1]
    print(N - cnt)

main()


from itertools import combinations

N = int(input())
P = []
for _ in range(N):
    x, y = map(int, input().split())
    P.append((x, y))

memo = dict()
for (a, b) in combinations(P, 2):
    p, q = a[0] - b[0], a[1] - b[1]
    if p < 0:
        p, q = -p, -q
    elif p == 0 and q < 0:
        q = -q
    if (p, q) in memo:
        memo[(p, q)] += 1
    else:
        memo[(p, q)] = 1

print(N - max(memo.values()))

from itertools import combinations

N = int(input())
P = []
for _ in range(N):
    x, y = map(int, input().split())
    P.append((x, y))

memo = dict()
for (a, b) in combinations(P, 2):
    p, q = a[0] - b[0], a[1] - b[1]
    if p < 0:
        p, q = -p, -q
    elif p == 0 and q < 0:
        q = -q
    if (p, q) in memo:
        memo[(p, q)] += 1
    else:
        memo[(p, q)] = 1

print(N - max(memo.values()) if N > 1 else 1)


from fractions import Fraction
from collections import Counter

class PickingUp:
    def __init__(self):
        self.N = int(input())
        self.points = []
        for n in range(self.N):
            self.points.append([int(n) for n in input().split()])

    def main(self):
        pattern_list = []
        slope_list = []
        for s in range(self.N):
            for e in range(s + 1, self.N):
                slope = self.__cal_slope(self.points[s], self.points[e])
                slope_list.append(slope)

        c = Counter(slope_list)
        most = c.most_common()[0][1]

        if self.N == 1:
            pattern_list.append(1)
        else:
            print(self.N - most)

    def __cal_slope(self, s, e):
        if s[0] != e[0]:
            return Fraction((s[1] - e[1]), (s[0] - e[0]))
        else:
            return None

    def __cal_section(self, slope, point):
        if slope is not None:
            return point[1] - slope * point[0]
        else:
            return point[0]

pickingUp = PickingUp()
pickingUp.main()

from collections import Counter

class PickingUp:
    def __init__(self):
        self.N = int(input())
        self.points = []
        for n in range(self.N):
            self.points.append([int(n) for n in input().split()])

    def main(self):
        dif_list = []

        if self.N == 1:
            print(1)
            return

        for s in range(self.N):
            for e in range(self.N):
                if s == e:
                    continue
                dif = self.__cal_dif(self.points[s], self.points[e])
                dif_list.append("{},{}".format(dif[0], dif[1]))

        c = Counter(dif_list)
        most = c.most_common()[0][1]

        print(self.N - most)

    def __cal_dif(self, s, e):
        dif_x = s[0] - e[0]
        dif_y = s[1] - e[1]
        return [dif_x, dif_y]

pickingUp = PickingUp()
pickingUp.main()


import itertools
from collections import defaultdict

N = int(input())
balls = sorted([tuple(map(int, input().split())) for _ in range(N)])

d = defaultdict(int)
for i, j in itertools.combinations(range(N), 2):
    d[(balls[j][0] - balls[i][0], balls[j][1] - balls[i][1])] += 1
print(N - max(d.values()))

import itertools
from collections import defaultdict
from sys import exit

N = int(input())
balls = sorted([tuple(map(int, input().split())) for _ in range(N)])

if N == 1:
    print(1)
    exit()

d = defaultdict(int)
for i, j in itertools.combinations(range(N), 2):
    d[(balls[j][0] - balls[i][0], balls[j][1] - balls[i][1])] += 1
print(N - max(d.values()))


from collections import Counter
from operator import itemgetter

N = int(input())
p = []
for _ in range(N):
    p.append(tuple(map(int, input().split())))
p.sort(key=itemgetter(0), reverse=True)

d = []
for i, pp1 in enumerate(p):
    for j in range(i + 1, N):
        pp2 = p[j]
        d.append((pp1[0] - pp2[0], pp1[1] - pp2[1]))

c = Counter(d)

print(N - c.most_common()[0][1])

from collections import defaultdict
from operator import itemgetter

N = int(input())
p = []
for _ in range(N):
    p.append(tuple(map(int, input().split())))
p.sort(key=itemgetter(0), reverse=True)

if N == 1:
    print(1)
else:
    d = defaultdict(int)
    for i, pp1 in enumerate(p):
        for j in range(i + 1, N):
            pp2 = p[j]
            d[(pp1[0] - pp2[0], pp1[1] - pp2[1])] += 1
        # print(d)

    cnt = 0
    keys = tuple(d.keys())
    for k in keys:
        x, y = k
        cnt = max(cnt, d[k] + d[(-x, -y)])

    print(N - cnt)


from collections import Counter

N = int(input())

p = []
for _ in range(N):
    p.append(tuple(map(int, input().split())))

d = []
for i, p1 in enumerate(p):
    for j, p2 in enumerate(p):
        if i == j:
            continue
        x = p1[0] - p2[0]
        y = p1[1] - p2[1]
        d.append((x, y))

c = Counter(d)
# print(c)
print(N - c.most_common()[0][1])

from collections import Counter

N = int(input())

p = []
for _ in range(N):
    p.append(tuple(map(int, input().split())))

if N == 1:
    print(1)
    exit()

d = []
for i, p1 in enumerate(p):
    for j, p2 in enumerate(p):
        if i == j:
            continue
        x = p1[0] - p2[0]
        y = p1[1] - p2[1]
        d.append((x, y))

c = Counter(d)
# print(c)
print(N - c.most_common()[0][1])


import collections

N = int(input())
x_y = []
for _ in range(N):
    x_y.append(list(map(int, input().split())))

x_y.sort(key=lambda x: (x[0], x[1]))
pq_cand = []
for i in range(N):
    for j in range(i + 1, N):
        pq_cand.append((x_y[j][0] - x_y[i][0], x_y[j][1] - x_y[i][1]))

pqc = collections.Counter(pq_cand)
_, x = max(pqc.items(), key=lambda x: x[1])
print(N - 1 - x + 1)

import collections

N = int(input())

if N == 1:
    print(1)
    exit()

x_y = []
for _ in range(N):
    x_y.append(list(map(int, input().split())))

x_y.sort(key=lambda x: (x[0], x[1]))
pq_cand = []
for i in range(N):
    for j in range(i + 1, N):
        pq_cand.append((x_y[j][0] - x_y[i][0], x_y[j][1] - x_y[i][1]))

pqc = collections.Counter(pq_cand)
_, x = max(pqc.items(), key=lambda x: x[1])
print(N - 1 - x + 1)


from collections import Counter

N = int(input())

xys = []
for _ in range(N):
    xys.append(tuple(map(int, input().split())))

sub = []
for x1, y1 in xys:
    for x2, y2 in xys:
        if x1 != x2 or y1 != y2:
            sub.append((x1 - x2, y1 - y2))

c = Counter(sub)
m = max(c.values())

print(N - m)

from collections import Counter

N = int(input())

xys = []
for _ in range(N):
    xys.append(tuple(map(int, input().split())))

sub = []
for x1, y1 in xys:
    for x2, y2 in xys:
        if x1 != x2 or y1 != y2:
            sub.append((x1 - x2, y1 - y2))

if not sub:
    print(1)
    exit(0)

c = Counter(sub)
m = max(c.values())

print(N - m)


import itertools

n = int(input())
xy_list = [list(map(int, input().split())) for _ in range(n)]
counts = dict()
for (x1, y1), (x2, y2) in itertools.combinations(xy_list, 2):
    for pq in ((x2 - x1, y2 - y1), (x1 - x2, y1 - y2)):
        counts.setdefault(pq, 0)
        counts[pq] += 1
max_count = max(counts.values())
print(n - max_count)

import sys
import itertools

n = int(input())
xy_list = [list(map(int, input().split())) for _ in range(n)]
if n == 1:
    print(1)
    sys.exit()

counts = dict()
for (x1, y1), (x2, y2) in itertools.combinations(xy_list, 2):
    for pq in ((x2 - x1, y2 - y1), (x1 - x2, y1 - y2)):
        counts.setdefault(pq, 0)
        counts[pq] += 1
max_count = max(counts.values())
print(n - max_count)


from collections import defaultdict

n = int(input())
z = [list(map(int, input().split())) for _ in range(n)]
d = defaultdict(int)
for i in range(n):
    xi, yi = z[i]
    for j in range(n):
        if i == j:
            continue
        xj, yj = z[j]
        d[(xi - xj, yi - yj)] += 1
print(n - max(d.values()))

from collections import defaultdict

n = int(input())
z = [list(map(int, input().split())) for _ in range(n)]
if n == 1:
    ans = 1
else:
    d = defaultdict(int)
    for i in range(n):
        xi, yi = z[i]
        for j in range(n):
            if i == j:
                continue
            xj, yj = z[j]
            d[(xi - xj, yi - yj)] += 1
    ans = n - max(d.values())
print(ans)


N = int(input())
inputs = [[int(i) for i in input().split()] for _ in range(N)]

ans = 1
rates = {}
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        vector = (inputs[i][0] - inputs[j][0], inputs[i][1] - inputs[j][1])
        rates[vector] = rates.get(vector, 0) + 1

print(N - max(rates.values()))

N = int(input())
inputs = [[int(i) for i in input().split()] for _ in range(N)]

ans = 1
rates = {0: 0}
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        vector = (inputs[i][0] - inputs[j][0], inputs[i][1] - inputs[j][1])
        rates[vector] = rates.get(vector, 0) + 1

print(N - max(rates.values()))


from collections import defaultdict

def main():
    N = int(input())
    XY = [list(map(int, input().split())) for _ in range(N)]

    dd = defaultdict(int)
    for i in range(N - 1):
        for j in range(i + 1, N):
            a = (XY[j][0] - XY[i][0], XY[j][1] - XY[i][1])
            dd[a] += 1

    pq = max(dd, key=dd.get)

    cnt = 0
    for x, y in XY:
        if [x + pq[0], y + pq[1]] in XY:
            cnt += 1

    print(N - cnt)

main()

import itertools
from collections import defaultdict

def main():
    N = int(input())
    if N == 1:
        print(1)

    else:
        XY = [list(map(int, input().split())) for _ in range(N)]

        dd = defaultdict(int)

        for xy1, xy2 in itertools.combinations(XY, 2):
            a = (xy2[0] - xy1[0], xy2[1] - xy1[1])
            b = (-a[0], -a[1])
            dd[a] += 1
            dd[b] += 1

        print(N - max(dd.values()))

main()


import sys
from collections import defaultdict
from itertools import combinations

input = sys.stdin.readline

def main():
    N = int(input())
    x = [0] * N
    y = [0] * N
    for i in range(N):
        x[i], y[i] = map(int, input().split())

    vector = defaultdict(int)
    for a, b in combinations(range(N), 2):
        dx = x[a] - x[b]
        dy = y[a] - y[b]
        if dx == 0:
            vector[(0, abs(dy))] += 1
        elif dx > 0:
            vector[(dx, dy)] += 1
        else:
            vector[(-dx, -dy)] += 1

    ans = N - max(vector.values())
    print(ans)

if __name__ == "__main__":
    main()

import sys
from collections import defaultdict
from itertools import combinations

input = sys.stdin.readline

def main():
    N = int(input())
    x = [0] * N
    y = [0] * N
    for i in range(N):
        x[i], y[i] = map(int, input().split())

    if N == 1:
        print(1)
        sys.exit()

    vector = defaultdict(int)
    for a, b in combinations(range(N), 2):
        dx = x[a] - x[b]
        dy = y[a] - y[b]
        if dx == 0:
            vector[(0, abs(dy))] += 1
        elif dx > 0:
            vector[(dx, dy)] += 1
        else:
            vector[(-dx, -dy)] += 1

    ans = N - max(vector.values())
    print(ans)

if __name__ == "__main__":
    main()


# クソザコナメクジ

# 負数を最後まで太らせて、最後に正の数の一番小さいやつに引く（符号がひっくりかえるので加えることになる）
N = int(input())
A = map(int, input().split())
plus, minus = [], []
for a in A:
    if a < 0:
        minus.append(a)
    else:
        plus.append(a)

plus = list(sorted(plus))
minus = list(reversed(sorted(minus)))

ans = 0
ans_list = []

if len(minus) == 0:
    # 太らせる要素がないので正の数から作る
    # 初回 最も小さい数 - 最も大きい数 して最大の負数をつくる
    # あとは残ってるやつから「引く」を加え続けて最後の一回で自らを「引く」
    a, b = plus[0], plus[-1]
    plus = plus[1:-1]
    if len(plus) > 0:
        ans_list.append([a, b])
        ans = a - b
        for p in plus[1:]:
            ans_list.append([ans, p])
            ans -= p
        ans_list.append([plus[0], ans])
        ans = plus[0] - ans
    else:
        ans_list.append([b, a])
        ans = b - a
else:
    # 残りの負数から最大の負数を作る。まず（正方向に）最大 - （正方向に）最小することで最大の正の数がデキるので、
    # あとは（正方向に）最小の一つ前まで 引くを加えていき、最後に逆に自分自身を加える
    if len(minus) == 1:
        ans = minus[0]
    elif len(minus) == 2:
        a, b = minus[0], minus[-1]
        ans_list.append([b, a])
        ans = b - a
    else:
        a, b = minus[0], minus[-1]
        ans = b
        ans_list.append([a, b])
        for m in minus[1:-2]:
            ans_list.append([ans, m])
            ans += m * (-1)
        ans_list.append([minus[-1], ans])
        ans = minus[-1] - ans

    # 正のやつを食う
    for p in plus[1:]:
        ans_list.append([ans, p])
        ans = ans - p
    # 仕上げ
    ans_list.append([plus[0], ans])
    ans = -1 * ans + plus[0]

    # もう1パターンあったわ
    ans_list2, ans2 = [], 0
    ans2 = plus[-1]
    for m in minus:
        ans_list2.append([ans2, m])
        ans2 = ans2 - m
    plus[-1] = ans2

    a, b = plus[0], plus[-1]
    tmp_ans = 0
    plus = plus[1:-1]
    if len(plus) > 0:
        ans_list2.append([a, b])
        tmp_ans = a - b
        for p in plus[1:]:
            ans_list2.append([tmp_ans, p])
            tmp_ans -= p
        ans_list2.append([plus[0], tmp_ans])
        tmp_ans = plus[0] - tmp_ans
    else:
        ans_list2.append([b, a])
        tmp_ans = b - a

    if ans < ans2:
        ans = ans2
        ans_list = ans_list2

print(ans)
for a in ans_list:
    print(a[0], a[1])

# 正整数だけ存在する場合はどうなるだろうか
# absじゃないのが味噌で、最後のyは負数だとお得
# なのでそれまでにできるだけ負の方向にデカいyを作ってみる
# 1 2 4 4 5 8 みたいなとき 1を出発点として残りは全部引いていけるので、最後ではy=1-(2+4+4+5)=-14にできる んで最後に最大値から引くことで 8-(-14)が達成可能
# 負数だけの場合
# 上記を踏まえると唯一の負数は正数で育てることができるが、複数ある場合はどうなるだろうか
# -6 -4 -3 -1 -1 みたいなとき
# 一度でも正数が作れればいいので-1-(-6-4-3-1)=13か？

# -1 1 2 のとき
# 最小値だけで正数を達成することはできない なので最後の手番までにできるだけデカい負を作って最後に引くをする
# -4 -2 -1 3 4 のとき 負数で正を作ると-1-(-2-4)=5, [3 4 5]になってしまいなんか小さくなりそう
# 負数を育てると-4-3-4=-11, -1-(-11)=10, 10-(-2)=12ができそうで、こっちのほうがいい
# 正の数が最後の1つになるまで負を太らせ、あとは負たちを正から引くことであますことなくいただける

n = int(input())
a = sorted(list(map(int, input().split())))
if n == 2:
    print(a[1] - a[0])
    print(a[1], a[0])
    exit()
ans = []
tmp = 0
if a[0] >= 0:
    tmp = a[0]
    for i in range(1, n - 1):
        ans.append(f"{tmp} {a[i]}")
        tmp -= a[i]
    ans.append(f"{a[-1]} {tmp}")
    tmp = a[-1] - tmp
elif a[-1] <= 0:
    tmp = a[-1]
    for i in range(n - 2, -1, -1):
        ans.append(f"{tmp} {a[i]}")
        tmp -= a[i]
else:
    ok, ng = 0, n
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if a[mid] < 0:
            ok = mid
        else:
            ng = mid
    plus = a[ok + 1 :]
    minus = a[: ok + 1]
    tmp = minus[0]
    idx = 0
    while idx < len(plus) - 1:
        ans.append(f"{tmp} {plus[idx]}")
        tmp -= plus[idx]
        idx += 1
    ans.append(f"{plus[idx]} {tmp}")
    tmp = plus[idx] - tmp
    for i in range(1, len(minus)):
        ans.append(f"{tmp} {minus[i]}")
        tmp -= minus[i]

print(tmp)
for av in ans:
    print(av)


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

def main():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    if A[0] > 0:
        printAllPlus(A)
        sys.exit()
    elif A[N - 1] < 0:
        printAllMinus(A)
        sys.exit()

    i = -1
    for k, n in enumerate(A):
        if n >= 0:
            i = k
            break
    plus = A[i:]
    minus = A[:i]
    print(sum(plus) - sum(minus))
    while len(plus) > 1:
        p = plus.pop()
        m = minus.pop()
        print(m, p)
        minus.append(m - p)
    p0 = plus.pop()
    for m in minus:
        print(p0, m)
        p0 -= m

def printAllPlus(nums):
    ans = sum(nums) - 2 * nums[0]
    print(ans)
    tmp = nums[0]
    for n in nums[1:-1]:
        print(tmp, n)
        tmp -= n
    print(nums[-1], tmp)

def printAllMinus(nums):
    nums.reverse()
    ans = -sum(nums) + 2 * nums[0]
    print(ans)
    tmp = nums[0]
    for n in nums[1:]:
        print(tmp, n)
        tmp -= n

if __name__ == "__main__":
    main()

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def main():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    if A[0] >= 0:
        printAllPlus(A)
    elif A[-1] <= 0:
        printAllMinus(A)
    else:
        printMixed(A)

def printMixed(nums):
    i = -1
    for k, n in enumerate(nums):
        if n >= 0:
            i = k
            break
    plus = nums[i:]
    minus = nums[:i]
    print(sum(plus) - sum(minus))
    while len(plus) > 1:
        p = plus.pop()
        m = minus.pop()
        print(m, p)
        minus.append(m - p)
    p0 = plus.pop()
    for m in minus:
        print(p0, m)
        p0 -= m

def printAllPlus(nums):
    ans = sum(nums) - 2 * nums[0]
    print(ans)
    tmp = nums[0]
    for n in nums[1:-1]:
        print(tmp, n)
        tmp -= n
    print(nums[-1], tmp)

def printAllMinus(nums):
    nums.reverse()
    ans = -sum(nums) + 2 * nums[0]
    print(ans)
    tmp = nums[0]
    for n in nums[1:]:
        print(tmp, n)
        tmp -= n

if __name__ == "__main__":
    main()


N = int(input())
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]

def count(n, a, b):
    a0, a1, a2 = a
    b0, b1, b2 = b
    dp = [0] * (n + 1)
    for i in range(n + 1):
        c0 = dp[i - a0] + b0 if i - a0 >= 0 else 0
        c1 = dp[i - a1] + b1 if i - a1 >= 0 else 0
        c2 = dp[i - a2] + b2 if i - a2 >= 0 else 0
        dp[i] = max([i, c0, c1, c2])
    return dp[n]

print(count(count(N, A, B), B, A))

N = int(input())
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]

def count(n, a, b):
    a0, a1, a2 = a
    b0, b1, b2 = b
    dp = [0] * (n + 1)
    for i in range(n + 1):
        c0 = dp[i - a0] + b0 if i - a0 >= 0 else 0
        c1 = dp[i - a1] + b1 if i - a1 >= 0 else 0
        c2 = dp[i - a2] + b2 if i - a2 >= 0 else 0
        dp[i] = max(i, c0, c1, c2)
    return dp[n]

print(count(count(N, A, B), B, A))


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

# 1 周目 : dp[巣から持ってきたドングリ数] = 取引所 B で持てる最大ドングリ数
dp = list(range(N + 1))
mas = tuple(zip(a, b))
for i in range(N + 1):
    for to_metal, to_acorn in mas:
        if i >= to_metal:
            dp[i] = max(dp[i], dp[i - to_metal] + to_acorn)
N = dp[N]

# 2 周目 : dp[取引所 B から持ってきたドングリ数] = 巣に持ち帰れる最大ドングリ数
dp = list(range(N + 1))
mas = tuple(zip(b, a))
for i in range(N + 1):
    for to_metal, to_acorn in mas:
        if i >= to_metal:
            dp[i] = max(dp[i], dp[i - to_metal] + to_acorn)
print(dp[N])

def main():
    N = int(input())
    ga, sa, ba = map(int, input().split())
    gb, sb, bb = map(int, input().split())

    # A : ドングリと金属に変える
    # B : 全部ドングリに変える
    # B : ドングリと金属に変える（無駄な操作でロスがないので、いったんドングリ化してよい）
    # A : ドングリに変える

    dp1 = list(range(N + 1))  # dp1[巣から持ってきたドングリ数] = 取引所 B で持てる最大ドングリ数
    dp1[0] = 0
    for i in range(N + 1):
        if i >= ga:
            dp1[i] = max(dp1[i], dp1[i - ga] + gb)
        if i >= sa:
            dp1[i] = max(dp1[i], dp1[i - sa] + sb)
        if i >= ba:
            dp1[i] = max(dp1[i], dp1[i - ba] + bb)

    N = dp1[N]
    dp2 = list(range(N + 1))  # dp2[取引所 B から持ってきたドングリ数] = 巣に持ち帰れる最大ドングリ数
    for i in range(N + 1):
        if i >= gb:
            dp2[i] = max(dp2[i], dp2[i - gb] + ga)
        if i >= sb:
            dp2[i] = max(dp2[i], dp2[i - sb] + sa)
        if i >= bb:
            dp2[i] = max(dp2[i], dp2[i - bb] + ba)
    print(dp2[N])

if __name__ == "__main__":
    main()


import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N = int(sys.stdin.readline())
GA, SA, BA = list(map(int, sys.stdin.readline().split()))
GB, SB, BB = list(map(int, sys.stdin.readline().split()))

values = []
weights = []
if GB / GA > 1:
    values.append(GB - GA)
    weights.append(GA)
if SB / SA > 1:
    values.append(SB - SA)
    weights.append(SA)
if BB / BA > 1:
    values.append(BB - BA)
    weights.append(BA)
# dp[i]: 重さ i 以下で選ぶのの価値の最大値
dp = [0] * (N + 1)
dp[0] = N
if values:
    for i in range(1, N + 1):
        x = dp[i - 1]
        for w, v in zip(weights, values):
            if i - w >= 0:
                x = max(x, dp[i - w] + v)
        dp[i] = x
    N = dp[N]

values = []
weights = []
if GA / GB > 1:
    values.append(GA - GB)
    weights.append(GB)
if SA / SB > 1:
    values.append(SA - SB)
    weights.append(SB)
if BA / BB > 1:
    values.append(BA - BB)
    weights.append(BB)
# dp[i]: 重さ i 以下で選ぶのの価値の最大値
dp = [0] * (N + 1)
dp[0] = N
if values:
    for i in range(1, N + 1):
        x = dp[i - 1]
        for w, v in zip(weights, values):
            if i - w >= 0:
                x = max(x, dp[i - w] + v)
        dp[i] = x
    N = dp[N]
print(int(N))

import math
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N = int(sys.stdin.readline())
GA, SA, BA = list(map(int, sys.stdin.readline().split()))
GB, SB, BB = list(map(int, sys.stdin.readline().split()))

values = []
weights = []
if GB / GA > 1:
    values.append(GB - GA)
    weights.append(GA)
if SB / SA > 1:
    values.append(SB - SA)
    weights.append(SA)
if BB / BA > 1:
    values.append(BB - BA)
    weights.append(BA)
# dp[i]: 重さ i 以下で選ぶのの価値の最大値
dp = [0] * (N + 1)
dp[0] = N
if values:
    for i in range(1, N + 1):
        x = dp[i - 1]
        for w, v in zip(weights, values):
            if i - w >= 0:
                x = max(x, dp[i - w] + v)
        dp[i] = x
    N = dp[N]

values = []
weights = []
if GA / GB > 1:
    values.append(GA - GB)
    weights.append(GB)
if SA / SB > 1:
    values.append(SA - SB)
    weights.append(SB)
if BA / BB > 1:
    values.append(BA - BB)
    weights.append(BB)
# dp[i]: 重さ i 以下で選ぶのの価値の最大値
dp = [0] * (N + 1)
dp[0] = N
if len(values) == 3:
    for i in range(1, N + 1):
        x = dp[i - 1]
        for w, v in zip(weights, values):
            if i - w >= 0:
                x = max(x, dp[i - w] + v)
        dp[i] = x
    N = dp[N]
if len(values) == 2:
    w1, w2 = weights
    v1, v2 = values
    if (v1 + w1) / w1 < (v2 + w2) / w2:
        v1, v2 = v2, v1
        w1, w2 = w2, w1
    c1 = N // w1
    c2 = (N - w1 * c1) // w2
    ret = N + v1 * c1 + v2 * c2
    while c1 >= 0:
        a = N - w1 * c1 - w2 * c2
        c1 -= max(1, math.ceil((w2 - a) / w1))
        c2 = (N - w1 * c1) // w2
        ret = max(ret, N + v1 * c1 + v2 * c2)
        if w1 * c1 + w2 * c2 == N:
            break
    N = ret
if len(values) == 1:
    N += N // weights[0] * values[0]
print(int(N))


p, q, r = map(int, input().split())
sorted_list = sorted(list[p, q, r])
ans = sorted_list[0] + sorted_list[1]
print(ans)

p, q, r = map(int, input().split())
sorted_list = sorted([p, q, r])
ans = sorted_list[0] + sorted_list[1]
print(ans)

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03011/Python/s382927375.py", line 2, in <module>
    sorted_list = sorted(list[p, q, r])
TypeError: 'types.GenericAlias' object is not iterable


p, q, r = map(int, input().split())

print(sum[p, q, r] - max[p, q, r])

p, q, r = map(int, input().split())
time = [p, q, r]

print(sum(time) - max(time))

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03011/Python/s963953736.py", line 3, in <module>
    print(sum[p, q, r] - max[p, q, r])
TypeError: 'builtin_function_or_method' object is not subscriptable


s = map(int, input().split())
s.sort()
print(s[0] + s[1])

s = list(map(int, input().split()))
s.sort()
print(s[0] + s[1])

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03011/Python/s230336688.py", line 2, in <module>
    s.sort()
AttributeError: 'map' object has no attribute 'sort'


A = [int(input()) for i in range(3)]

ans = sum(A) - max(A)
print(ans)

A = list(map(int, input().split()))
ans = sum(A) - max(A)
print(ans)

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03011/Python/s647136581.py", line 1, in <module>
    A = [int(input()) for i in range(3)]
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03011/Python/s647136581.py", line 1, in <listcomp>
    A = [int(input()) for i in range(3)]
ValueError: invalid literal for int() with base 10: '1 3 4'


p = list(map(int, input().split()))
print(p[0] + p[1] + [2] - max(p))

p = list(map(int, input().split()))
print(p[0] + p[1] + p[2] - max(p))

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03011/Python/s411748384.py", line 2, in <module>
    print(p[0] + p[1] + [2] - max(p))
TypeError: unsupported operand type(s) for +: 'int' and 'list'


# coding: utf-8

p, q, r = [int(x) for x in input().rstrip().split(" ")]

s = []
s[0] = p + q
s[1] = q + r
s[2] = r + p

print(min(s))

# coding: utf-8

p, q, r = [int(x) for x in input().rstrip().split(" ")]

s = [0, 0, 0]
s[0] = p + q
s[1] = q + r
s[2] = r + p

print(min(s))

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03011/Python/s517518252.py", line 6, in <module>
    s[0] = p + q
IndexError: list assignment index out of range


N = input()
W = list(map(int, input().split()))
print(min([abs(sum(W[:i]) - sum(W[i:])) for i in range(N)]))

N = int(input())
W = list(map(int, input().split()))
print(min([abs(sum(W[:i]) - sum(W[i:])) for i in range(N)]))

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03012/Python/s648426101.py", line 3, in <module>
    print(min([abs(sum(W[:i]) - sum(W[i:])) for i in range(N)]))
TypeError: 'str' object cannot be interpreted as an integer


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

A = []

for _ in range(M):
    A[int(input())] = True

step = [0] * (N + 1)

step[0] = 1

for s in range(1, N + 1):
    if A[s]:
        step[s] = 0
        continue
    if s == 1:
        step[s] = 1
        continue
    else:
        step[s] = step[s - 1] + step[s - 2]
        step[s] %= 1000000007

print(step[N])

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

A = [False] * (N + 1)

for _ in range(M):
    A[int(input())] = True

step = [0] * (N + 1)

step[0] = 1

for s in range(1, N + 1):
    if A[s]:
        step[s] = 0
        continue
    if s == 1:
        step[s] = 1
        continue
    else:
        step[s] = step[s - 1] + step[s - 2]
        step[s] %= 1000000007

print(step[N])

Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03013/Python/s337394668.py", line 6, in <module>
    A[int(input())] = True
IndexError: list assignment index out of range


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

a = [int(input()) for i in range(m)]

dp = [0] * (n + 1)
for i in range(n + 1):
    if i in a:
        dp[i] = 0
    else:
        if i == 0:
            dp[i] = 1
        elif i == 1:
            dp[i] = 1
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print(dp[n])

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

a = set()
for i in range(m):
    a_tmp = int(input())
    a.add(a_tmp)

# a = [int(input()) for i in range(m)]

dp = [0] * (n + 1)
for i in range(n + 1):
    if i in a:
        dp[i] = 0
    else:
        if i == 0:
            dp[i] = 1
        elif i == 1:
            dp[i] = 1
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print(dp[n])


import numpy as np

N, M = map(int, input().split())
A = np.array([int(input()) for _ in range(M)])
q = 1000000007

cost = np.zeros(N + 1, dtype=np.int64)
cost[0] = 1
cost[1] = 1
cost[A] = 0
cost[2] = cost[0] + cost[1]

for i in range(1, N + 1):
    cost[A] = 0
    cost[i] = (cost[i - 1] + cost[i - 2]) % q

print(cost[-1])

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
q = 1000000007

if N == 1:
    if M == 0:
        print(1)
    elif M == 1:
        print(0)
else:
    cost = [0 for _ in range(N + 1)]
    cost[0] = 1

    cnt = 0
    A.append([0])
    for i in range(1, N + 1):
        if i == A[cnt]:
            cost[i] = 0
            cnt += 1
        else:
            cost[i] = (cost[i - 1] + cost[i - 2]) % q

    print(cost[-1])


N, M = map(int, input().split())
broken_step = [0] * N
for _ in range(M):
    n = int(input())
    broken_step[n - 1] = 1

dp = [0] * N

dp[0] = 0 if broken_step[0] == 1 else 1
dp[1] = 0 if broken_step[1] == 1 else (1 + dp[0])

for i in range(2, N):
    if broken_step[i] == 1:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] + dp[i - 2]

print(dp[-1] % 1000000007)

N, M = map(int, input().split())
broken_step = [0] * (N + 1)
for _ in range(M):
    n = int(input())
    broken_step[n] = 1

dp = [1] * (N + 1)
dp[1] = 0 if broken_step[1] == 1 else dp[0]

for i in range(2, N + 1):
    if broken_step[i] == 1:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] + dp[i - 2]

print(dp[-1] % 1000000007)


INF = 1_000_000_007

def comb(n, k):
    k = min(n - k, k)
    if n == 0 or k == 0:
        return 1
    a = n
    for i in range(n - 1, n - k, -1):
        a *= i
    b = 1
    for i in range(2, k + 1):
        b *= i
    return a // b

N, M = list(map(int, input().split()))
A = [-1] + [int(input()) for _ in range(M)] + [N + 1]
res = 1
for i in range(M + 1):
    t = A[i + 1] - A[i] - 2
    if t < 0:
        res = 0
    else:
        _t = 0
        for i in range(t // 2 + 1):
            _t += comb(t - i, i)
        res *= _t
print(res % INF)

MOD = 10**9 + 7
N, M = list(map(int, input().split()))
B = [True] * (N + 1)
D = [1] + [0] * N
for _ in range(M):
    a = int(input())
    B[a] = False
for i in range(N):
    for j in range(i + 1, min(N, i + 2) + 1):
        if B[j]:
            D[j] = (D[j] + D[i]) % MOD
print(D[N])


MOD = 1000000007

n, m = map(int, input().split())
a = [int(input()) for i in range(m)]

f = [0] * (n + 1)
f[0] = 1

if 1 not in a:
    f[1] = 1

for i in range(2, n + 1):
    if i in a:
        continue
    f[i] = f[i - 1] + f[i - 2]
    if f[i] >= MOD:
        f[i] -= MOD

print(f[-1])

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M, *A = map(int, read().split())

MOD = 10**9 + 7

dp = [0] * (N + 10)
dp[0] = 1
is_broken = [False] * (N + 1)

for x in A:
    is_broken[x] = True

for n in range(1, N + 1):
    if is_broken[n]:
        continue
    x = dp[n - 1] + dp[n - 2]
    if x >= MOD:
        x -= MOD
    dp[n] = x

answer = dp[N]
print(answer)


div = 1000000007

n, m = map(int, input().split())
a = [int(input()) for i in range(m)]

f = [0] * (n + 1)
f[0] = 1

if 1 not in a:
    f[1] = 1

for i in range(2, n + 1):
    if i in a:
        continue
    f[i] = (f[i - 1] + f[i - 2]) % div

print(f[-1])

div = 1000000007

n, m, *b = map(int, open(0).read().split())
a = set(b)

f = [0] * (n + 1)
f[0] = 1

if 1 not in a:
    f[1] = 1

for i in range(2, n + 1):
    if i in a:
        continue
    f[i] = (f[i - 1] + f[i - 2]) % div

print(f[-1])


n, m = map(int, input().split())
a = [int(input()) for i in range(m)]

f = [0] * (n + 1)
f[0] = 1

for i in range(1, n + 1):
    if i in a:
        continue
    f[i] = (f[i - 1] + f[i - 2]) % 1000000007

print(f[n])

def main():
    N, M, *a = map(int, open(0).read().split())
    div = 1000000007
    broken = set(a)

    comb_list = [0] * (N + 1)
    comb_list[0] = 1
    if 1 not in broken:
        comb_list[1] = 1

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

    print(comb_list[-1])

if __name__ == "__main__":
    main()


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

stairs = []
is_continuous = False
for i in range(m):
    stairs.append(int(input()))
    if i > 0 and stairs[i] - 1 == stairs[i - 1]:
        is_continuous = True
        break

if is_continuous:
    print(0)
else:
    countup_num = [0] * (n + 1)
    countup_num[0] = 1
    countup_num[1] = 1
    for i in range(2, n + 1):
        countup_num[i] = (countup_num[i - 1] + countup_num[i - 2]) % 1000000007
    res = 1
    diff = 0
    now = 0
    for i in range(m):
        diff = stairs[i] - now - 1
        now = stairs[i] + 1
        res *= (countup_num[diff]) % 1000000007
        # print(res, now)
    diff = n - stairs[-1] - 1
    res *= (countup_num[diff]) % 1000000007

    res %= 1000000007
    # print(countup_num)
    print(res)

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

stairs = []
is_continuous = False
for i in range(m):
    stairs.append(int(input()))
    if i > 0 and stairs[i] - 1 == stairs[i - 1]:
        is_continuous = True
        break

if is_continuous:
    print(0)
else:
    countup_num = [0] * (n + 1)
    countup_num[0] = 1
    countup_num[1] = 1
    for i in range(2, n + 1):
        countup_num[i] = (countup_num[i - 1] + countup_num[i - 2]) % 1000000007
    res = 1
    diff = 0
    now = 0
    for i in range(m):
        diff = stairs[i] - now - 1
        now = stairs[i] + 1
        res *= (countup_num[diff]) % 1000000007
        # print(res, now)
    if m == 0:
        res = countup_num[n]
    else:
        diff = n - stairs[-1] - 1
        res *= (countup_num[diff]) % 1000000007

    res %= 1000000007
    # print(countup_num)
    print(res)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins

def solve(inputs):
    [N, M] = list(map(lambda x: int(x), inputs[0].split()))
    broke_steps = list(map(lambda x: int(x), inputs[1:]))

    SSSS = 1000000007

    patterns = [1]
    for step in range(1, N + 1):
        if step in broke_steps:
            ap = 0
        elif step == 1:
            ap = 1
        else:
            ap = (patterns[step - 1] + patterns[step - 2]) % SSSS
        patterns.append(ap)

    return patterns[-1]

if __name__ == "__main__":
    first = input()
    [N, M] = list(map(lambda x: int(x), first.split()))
    inputs_str = inputs(M)
    inputs_str.insert(0, first)
    ret = solve(inputs_str)
    print(ret)

def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins

def solve(inputs):
    [N, M] = list(map(lambda x: int(x), inputs[0].split()))
    broke_steps = {}
    for b in map(lambda x: int(x), inputs[1:]):
        broke_steps[b] = True

    SSSS = 1000000007

    patterns = [1]
    for step in range(1, N + 1):
        if step in broke_steps:
            ap = 0
        elif step == 1:
            ap = 1
        else:
            ap = (patterns[step - 1] + patterns[step - 2]) % SSSS
        patterns.append(ap)

    return patterns[-1]

if __name__ == "__main__":
    first = input()
    [N, M] = list(map(lambda x: int(x), first.split()))
    inputs_str = inputs(M)
    inputs_str.insert(0, first)
    ret = solve(inputs_str)
    print(ret)


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

s = [0] * (n + 1)
s[-1] = 1
for _ in range(m):
    a = int(input())
    s[a] = None

if s[0] is None and s[1] is None:
    print(0)
    exit()

for i in range(n - 1, -1, -1):
    if s[i] is None:
        continue
    if i + 1 < len(s) and s[i + 1] is not None:
        s[i] += s[i + 1]
    if i + 2 < len(s) and s[i + 2] is not None:
        s[i] += s[i + 2]

print(s[0] % 1_000_000_007)

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

s = [0] * (n + 1)
s[-1] = 1
for _ in range(m):
    a = int(input())
    s[a] = None

if s[0] is None and s[1] is None:
    print(0)
    exit()

for i in range(n - 1, -1, -1):
    if s[i] is None:
        continue
    if i + 1 < len(s) and s[i + 1] is not None:
        s[i] += s[i + 1]
    if i + 2 < len(s) and s[i + 2] is not None:
        s[i] += s[i + 2]

print(s[0] % 1000000007)


mod = 10**9 + 7

n, m = list(map(int, input().split()))
a = [int(input()) for _ in range(m)]

dp = {}
for i in range(n + 1):
    dp[i] = 1
dp[1] = 0 if 1 in a else 1
for i in range(2, n + 1):
    if i in a:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] % mod + dp[i - 2] % mod
        dp[i] %= mod

print(dp[n] % mod)

mod = 10**9 + 7

n, m = list(map(int, input().split()))
a = set([int(input()) for _ in range(m)])

dp = {}
for i in range(n + 1):
    dp[i] = 1
dp[1] = 0 if 1 in a else 1
for i in range(2, n + 1):
    if i in a:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] % mod + dp[i - 2] % mod
        dp[i] %= mod

print(dp[n] % mod)


n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
b = [0, 1]
c = []
ans = 1

for _ in range(n):
    b.append(b[-1] + b[-2])

c.append(a[0])
for i in range(m - 1):
    c.append(a[i + 1] - a[i] - 1)
c.append(n - a[m - 1])

for i in c:
    ans *= b[i]

print(ans % 1000000007)

n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
b = [0, 1]
c = []
ans = 1

for _ in range(n):
    b.append(b[-1] + b[-2])

if m == 0:
    ans = b[n + 1]
else:
    c.append(a[0])
    for i in range(m - 1):
        c.append(a[i + 1] - a[i] - 1)
    c.append(n - a[m - 1])

    for i in c:
        ans *= b[i]

print(ans % 1000000007)


#!/usr/bin/env python3
import sys

sys.setrecursionlimit(1000000)

def count(n):
    if n < 2:
        return 1
    return count(n - 1) + count(n - 2)

n, m, *a = map(int, open(0).read().split())
if sum(a[i + 1] == a[i] + 1 for i in range(m - 1)) > 0:
    print(0)
    exit()

a.append(n + 1)
c = -1
ans = 1
for i in a:
    ans = ans * count(i - c - 2) % (10**9 + 7)
    c = i
print(ans)

#!/usr/bin/env python3
import sys

sys.setrecursionlimit(1000000)

memo = [0] * (10**5 + 1)

def count(n):
    if n < 2:
        return 1
    if memo[n] != 0:
        return memo[n]
    memo[n] = count(n - 1) + count(n - 2)
    return memo[n]

n, m, *a = map(int, open(0).read().split())
if sum(a[i + 1] == a[i] + 1 for i in range(m - 1)) > 0:
    print(0)
    exit()

a.append(n + 1)
c = -1
ans = 1
for i in a:
    ans = ans * count(i - c - 2) % (10**9 + 7)
    c = i
print(ans)


from math import factorial

n, m = map(int, input().split())
A = [0] * m
for i in range(m):
    A[i] = int(input())
B = []
if m > 1:
    for i in range(m - 1):
        if A[i + 1] - A[i] == 1:
            print(0)
            exit()
if m:
    B.append(A[0])
    A.append(n + 1)
    for i in range(len(A) - 2, -1, -1):
        B.append(A[i + 1] - A[i] - 1)
else:
    B.append(n + 1)
div = 1000000007
ans = 1
for b in B:
    if b < 3:
        continue
    c = b - 1
    two_max = c // 2
    a = 0
    for two in range(two_max + 1):
        one = c - (2 * two)
        a += factorial(one + two) // (factorial(one) * factorial(two))
    ans *= a
    ans %= div
print(ans)

def generate_range_combinations(n):
    C = [1] * n
    for i in range(2, n):
        C[i] = (C[i - 1] + C[i - 2]) % DIV
    return C

def solve(n, m, A):
    from collections import defaultdict

    if m == 0:
        C = generate_range_combinations(n + 1)
        return C[-1]

    D = defaultdict(lambda: 0)
    for i in range(m - 1):
        d = A[i + 1] - A[i] - 1
        if d == 0:
            return 0
        D[d] += 1
    D[A[0]] += 1
    D[n - A[-1]] += 1

    ans = 1
    C = generate_range_combinations(max(D.keys()))
    for k, v in D.items():
        ans *= C[k - 1] ** v
        ans %= DIV
    return ans

DIV = 1000000007
n, m = map(int, input().split())
A = [int(input()) for _ in range(m)]
print(solve(n, m, A))


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

dp = [0, 1]

for i in range(1, N + 1):
    if i in a:
        dp.append(0)
        continue
    dp.append(dp[i - 1] + dp[i])

print(dp[N + 1] % 1000000007)

N, M = list(map(int, input().split()))
a = [int(input()) for i in range(M)]
a.append(0)
dp = [0, 1]
a_flag = 0

for i in range(1, N + 1):
    if i == a[a_flag]:
        dp.append(0)
        a_flag += 1
        continue
    dp.append(dp[i - 1] + dp[i])

print(dp[N + 1] % 1000000007)


#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def main():
    N, M = map(int, input().split())
    A = [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[1] = dp[0]
            continue

        dp[i] = dp[i - 1] + dp[i - 2]
        dp[i] %= mod

    print(dp[N])

if __name__ == "__main__":
    main()

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def main():
    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[1] = dp[0]
            continue

        dp[i] = dp[i - 1] + dp[i - 2]
        dp[i] %= mod

    print(dp[N])

if __name__ == "__main__":
    main()


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

B = [0] * (N + 1)
B[0] = 1
if 1 not in A:
    B[1] = 1
else:
    B[1] = 0
mod = 10**9 + 7

for i in range(2, N + 1):
    if i != 2 and i - 1 in A and i - 2 in A:
        print(0)
        exit()
    elif i - 2 in A:
        B[i] = B[i - 1]
    elif i - 1 in A:
        B[i] = B[i - 2]
    else:
        B[i] = B[i - 1] + B[i - 2]
    B[i] %= mod
print(B[N] % mod)

import sys

input = sys.stdin.readline

def binary_search(l, value):
    low = 0
    high = len(l) - 1
    while low <= high:
        mid = (low + high) // 2
        if l[mid] == value:
            return True
        elif l[mid] < value:
            low = mid + 1
        else:
            high = mid - 1
    return False

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

A.append(10**6)
A.append(10**6)
B = [0] * (N + 1)
B[0] = 1
if binary_search(A, 1) is True:
    B[1] = 0
else:
    B[1] = 1
mod = 10**9 + 7

for i in range(2, N + 1):
    if i != 2 and binary_search(A, i - 1) is True and binary_search(A, i - 2) is True:
        print(0)
        exit()
    elif binary_search(A, i - 2) is True:
        B[i] = B[i - 1]
    elif binary_search(A, i - 1) is True:
        B[i] = B[i - 2]
    else:
        B[i] = B[i - 1] + B[i - 2]
    B[i] %= mod
print(B[N] % mod)


#!/usr/bin/env python3
import sys

sys.setrecursionlimit(1000000)

n, m, *a = map(int, open(0).read().split())
dp = [0] * (n + 1)
ok = [True] * (n + 1)

for i in a:
    ok[i] = False

def count(n):
    if ok[n]:
        if n < 2:
            return 1
        if dp[n] != 0:
            return dp[n]
        dp[n] = (count(n - 1) + count(n - 2)) % (10**9 + 7)
        return dp[n]
    else:
        return 0

print(count(n))

#!/usr/bin/env python3
import sys

sys.setrecursionlimit(1000000)
n, m, *a = map(int, open(0).read().split())
dp = [1] + [-1] * n
dp[1] = 1
for i in a:
    dp[i] = 0

def count(n):
    if dp[n] != -1:
        return dp[n]
    dp[n] = (count(n - 1) + count(n - 2)) % (10**9 + 7)
    return dp[n]

print(count(n))


N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])

MOD = 1000000007

dp = [0] * (N + 1)
dp[0] = 1

if 1 not in a:
    dp[1] = 1
else:
    dp[1] = 0

for i in range(2, N + 1):
    print(f"i: {i}, dp: {dp}")

    if i in a:
        continue
    dp[i] = dp[i - 1] + dp[i - 2]
    dp[i] %= MOD
print(f"i: {i}, dp: {dp}")

print(dp[N])

N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])

MOD = 1000000007

dp = [0] * (N + 1)
dp[0] = 1

if 1 not in a:
    dp[1] = 1
else:
    dp[1] = 0

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

print(dp[N])


N, M = map(int, input().split())
steps = [True] * (N + 1)
for _ in range(M):
    steps[int(input())] = False
dp = [0] * (N + 1)
dp[0] = 1
for prev in range(N):
    for now in range(prev + 1, min(N, prev + 2) + 1):
        if steps[now]:
            dp[now] += dp[prev]
            dp[now] %= 1_000_000_007
print(dp[N])

N, M = map(int, input().split())
steps = [True] * (N + 1)
for _ in range(M):
    steps[int(input())] = False
dp = [0] * (N + 1)
dp[0] = 1
for prev in range(N):
    for now in range(prev + 1, min(N, prev + 2) + 1):
        if steps[now]:
            dp[now] += dp[prev]
            dp[now] %= 10**9 + 7
print(dp[N])