Harryxun/stf_run huggingface dataset:
def main():
    n = int(input())

    ans = 0
    for a, b in (list(combinations(range(1, n+1), 2))):
        if (a%2==0 and b%2 != 0) or (b%2==0 and a%2!=0):
            ans += 1

    print(ans)


main()

### FIXED CODE ###

from itertools import combinations


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

    ans = 0
    for a, b in (list(combinations(range(1, n+1), 2))):
        if (a%2==0 and b%2 != 0) or (b%2==0 and a%2!=0):
            ans += 1

    print(ans)


main()
N, K = map(int, input().split())
candles = list(map(int, input().split()))

for i in range(K):
    minNum = candles[i]
    maxNum = candles[i+K-1]

### FIXED CODE ###

import sys

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

ans = sys.maxsize

for i in range(N-K+1):
    minNum = candles[i]
    maxNum = candles[i+K-1]
    l = abs(minNum) + abs(minNum - maxNum)
    r = abs(maxNum) + abs(maxNum - minNum)
    ans = min(ans, min(l, r))

print(ans)
a,b,c=input().split()
print(a,b,c,="")

### FIXED CODE ###

a,b,c=input().split(",")
print(a,b,c)
import sys
print = sys.stdout.printline
h,w,a,b = map(int,input().split())
for i in range(h):
    for j in range(w):
        if i<b :
            if j<a :print(0,end="")
            else :print(1,end="")
        else :
            if j<a :print(1,end="")
            else :print(0,end="")
    print("")

### FIXED CODE ###

a = list(map(int, input().split()))
for i in range(a[0]):
    for j in range(a[1]):
        if i<a[3] :
            if j<a[2] :print(0,end="")
            else :print(1,end="")
        else :
            if j<a[2] :print(1,end="")
            else :print(0,end="")
    print("")
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

def main():
    n, y = map(int, sys.stdin.readline().split())

    for i in range(y // 10000):
        for j in range((y - 10000 * i) // 5000):
            if 10000 * i + 5000 * j + 1000 * (n - i - j) == y:
                print(i, j, k)
                sys.exit()
    else:
        print('-1 -1 -1')

if __name__ == '__main__':
    main()


### FIXED CODE ###

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

import sys

def main():
    n, y = map(int, sys.stdin.readline().split())

    for i in range(y // 10000 + 1):
        for j in range((y - 10000 * i) // 5000 + 1):
            k = n - i - j
            if 10000 * i + 5000 * j + 1000 * k == y:
                print(i, j, k)
                sys.exit()
    else:
        print('-1 -1 -1')

if __name__ == '__main__':
    main()
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
M = 10**9 + 7
if N == K:
    result = 1
    for i in range(K):
        result = result * A[i] % M
    print(result)
    exit()
minus = [i for i in A if i <= 0]
l_minus = len(minus)
plus = [i for i in A if i > 0]
l_plus = len(plus)
plus.sort(reverse=1)
minus.sort()
if len(plus) == 0 and K % 2 == 1:
    result = 1
    for i in range(K):
        result = result * minus[-i-1] % M
    print(result)
    exit()

m_x = 0
p_x = 0
max_mm = -1
if (m_x+1) * 2 <= l_minus:
    max_mm = minus[m_x * 2] * minus[m_x * 2 + 1]
max_pp = -1
if (p_x+1) * 2 <= l_plus:
    max_pp = plus[p_x * 2] * plus[p_x * 2 + 1]
counter = 0
array = []
while counter * 2 + 1 <= K:
    if max_pp > max_mm:
        array.append(plus[p_x * 2])
        array.append(plus[p_x * 2 + 1])
        p_x += 1
        if (p_x+1) * 2 <= l_plus:
            max_pp = plus[p_x * 2] * plus[p_x * 2 + 1]
        else:
            max_pp = -1
    elif max_pp == -1 and max_mm == -1:
        break
    else:
        array.append(minus[m_x * 2])
        array.append(minus[m_x * 2 + 1])
        m_x += 1
        if (m_x+1) * 2 <= l_minus:
            max_mm = minus[m_x * 2] * minus[m_x * 2 + 1]
        else:
            max_mm = -1
    counter += 1
if K%2 == 1:
    array.append(plus[p_x * 2])
result = 1
for each in array:
    result = result * each % M
print(result)


### FIXED CODE ###

n, k = map(int, input().split())
a_list = list(map(int, input().split()))
mod = 10**9+7
a_list.sort()
ans = 1
if k % 2 == 1 and a_list[-1] < 0:
    for i in range(k):
        ans *= a_list[n - 1 - i]
        ans %= mod
else:
    l = 0
    r = -1
    mlt1 = a_list[0] * a_list[1]
    mlt2 = a_list[-2] * a_list[-1]
    count = 0
    while True:
        if count == k:
            break
        elif count == k - 1:
            ans *= a_list[r] % mod
            ans %= mod
            break
        if mlt1 >= mlt2:
            ans *= mlt1 % mod
            l += 2
            count += 2
            if l <= n - 2:
                mlt1 = a_list[l + 1] * a_list[l]
        else:
            ans *= a_list[r] % mod
            r -= 1
            count += 1
            if r >= - n + 1:
                mlt2 = a_list[r - 1] * a_list[r]
        ans %= mod
print(ans)
n=input()
p=list(map(int,input().split()))
m=0
for i in range(n):
    print(p[p[i]-1])
    if p[i]==i+1 :
        continue
    elif p[p[i]-1]==i+1 and m<2 :
        m+=1
        continue
    else :
        print ("NO")
        exit()
print("YES")


### FIXED CODE ###

n=input()
p=list(map(int,input().split()))
def func(i,j):
    if i == len(p) :
        return "YES"
    elif p[i]==i+1 :
        return func(i+1,j)
    elif p[p[i]-1]==i+1 and j<2 :
        j+=1
        return func(i+1,j)
    else :
        return "NO"
print(func(0,0))
H, W = map(int,input().split())
# C = [list(input()) for _ in range(H)]
C = []
pre = 0
for i in range(H):
    c = list(input())
    pre += c.count("#")
    C.append(c)

list = [(0, 0)]
count = 1
 
while C[H-1][W-1] == '.':
    count += 1
    next_list = []
    for y,x in list:
        for i,j in ((1,0),(0,1),):
            if x+j < W and y+i < H:
                if C[y+i][x+j] == '.':
                    C[y+i][x+j] = count
                    next_list.append((y+i,x+j))
    list = list(set(next_list))
print(H*W-pre-count)

### FIXED CODE ###

H, W = map(int, input().split())
C = [list(input()) for _ in range(H)]

# bfs 
C[0][0] = 0
pre_list = [(0,0)]
count = 0
 
while C[H-1][W-1] == '.' and len(pre_list) > 0:
    count += 1
    next_list = []
    for y,x in pre_list:
        for i,j in ((1,0),(0,-1),(0,1),(-1,0)):
            if y+i < 0 or x+j < 0 or y+i >= H or x+j >= W:
                continue
            if C[y+i][x+j] == '.':
                C[y+i][x+j] = count
                next_list.append((y+i,x+j))
    pre_list = next_list

if C[H-1][W-1] == '.':
    print(-1)
else:
    black = 0
    for h in C:
        for v in h:
            if v == "#":
                black += 1
    print(H*W-black-count-1)
a,b = map(int,input())
if a==b:
  print("Draw")
elif a==1:
  print("Alice")
elif b==1:
  print("Bob")
elif a>b:
  print("Alice")
else:
  print("Bob")

### FIXED CODE ###

a,b = map(int,input().split())
if a==b:
  print("Draw")
elif a==1:
  print("Alice")
elif b==1:
  print("Bob")
elif a>b:
  print("Alice")
else:
  print("Bob")
import sys
import math

def isprime(n):
    ans = 1
    for i in range(2, n):
        x = i
        y = n % i
        if math.gcd(x, y) != 1:
            ans = 0
            break
    return ans


n = int(input())
p = 0
for i in map(int, sys.stdin.readlines()):
    p += isprime(i)

print(p)

### FIXED CODE ###

import sys
import math

def isprime(n):
    if n == 2:
        return 1
    if n < 2 or n % 2 == 0:
        return 0

    i = 3
    while i <= math.sqrt(n):
        if n % i == 0:
            return 0
        i += 2
    return 1

n = int(input())
p = 0
for i in map(int, sys.stdin.readlines()):
    p += isprime(i)

print(p)
from collections import Counter
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

MOD = 10**9+7


def comb2(N):
    return int(N*(N-1)/2)


N = int(input())
prev = -1
Col = []
for _ in range(N):
    c = int(input())
    if c == prev:
        continue
    else:
        prev = c
        Col.append(c)


cntF = [0]*(N+1)
forward = [0]*len(Col)
for i, c in enumerate(Col):
    forward[i] = cntF[c]
    cntF[c] += 1

cntB = [0]*(N+1)
back = [0]*(len(Col))
for i in reversed(range(len(Col))):
    c = Col[i]
    back[i] = cntB[c]
    cntB[c] += 1

ans = 1+sum(forward)
for i in range(1, len(Col)-1):
    ans = ans + forward[i]*back[i+1]
    ans %= MOD
print(ans)


### FIXED CODE ###

N = int(input())
C = [-1]

for _ in range(N):
    c = int(input())
    if c == C[-1]:
        continue
    else:
        C.append(c)

MOD = 10**9+7
dp = 1
prev = [0]*(max(C)+1)

for c in C[1:]:
    dp = (dp+prev[c]) % MOD
    prev[c] = dp
print(dp)
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
%matplotlib inline

#{1, 2, ..., n} の順列 p = {p1,p2, ..., pn } があります。
#以下の条件を満たすような pi (1<i<n) がいくつあるかを出力してください。
#pi−1, pi, pi+1 の 3 つの数の中で、pi が 2 番目に小さい。

n = int(input())
p = list(map(int, input().split()))
ans=0
for i in range(n-1):
    if p[i-1]<p[i]<p[i+1] or p[i+1]<p[i]<p[i-1] :
        ans+=1
    else:
        ans==ans
print(ans)
        

### FIXED CODE ###

#{1, 2, ..., n} の順列 p = {p1,p2, ..., pn } があります。
#以下の条件を満たすような pi (1<i<n) がいくつあるかを出力してください。
#pi−1, pi, pi+1 の 3 つの数の中で、pi が 2 番目に小さい。

n = int(input())
p = list(map(int, input().split()))
ans=0
for i in range(1,n-1):
    if p[i-1]<=p[i]<p[i+1] or p[i+1]<=p[i]<p[i-1] :
        ans+=1

    else:
        ans==ans
print(ans)
import sys

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

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():
    N = in_n()
    X = in_s()
    nx = int(X, 2)

    ans = [0] * N

    oc = X.count('1')
    mx = nx % (oc - 1)
    px = nx % (oc + 1)

    tn = 1 << N - 1
    for i in range(N):

        if X[i] == '0':
            a = (px + tn % (oc + 1)) % (oc + 1)
        else:
            a = (mx - tn % (oc - 1)) % (oc - 1)

        count = 1
        while a:
            a = a % bin(a).count('1')
            count += 1

        ans[i] = count
        tn = tn >> 1

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

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


def main():
    N = int(readline())
    X = readline().rstrip().decode('utf-8')
    nx = int(X, 2)

    ans = [0] * N

    oc = X.count('1')

    if oc - 1 != 0:
        mx = nx % (oc - 1)
        f = True
    else:
        f = False

    px = nx % (oc + 1)

    for i in range(N):

        if X[i] == '0':
            a = (px + pow(2, N - i - 1, oc + 1)) % (oc + 1)
        elif f:
            a = (mx - pow(2, N - i - 1, oc - 1)) % (oc - 1)
        else:
            ans[i] = 0
            continue

        count = 1
        while a:
            a = a % bin(a).count('1')
            count += 1

        ans[i] = count

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()
S = input()
X=S[0]
i=1
while i<=4:
    if S[i]!=X:
        Y=S[i]
        break
    i+=1
if S.count(X)!=2 or S.count(Y)!=2:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

S = input()
X=S[0]
i=1
while i<=3:
    if S[i]!=X:
        Y=S[i]
        break
    i+=1
if S.count(X)!=2 or S.count(Y)!=2:
    print("No")
else:
    print("Yes")
# Coding: Utf-8

N=in(input())
a=list(map(int, input().split()))
count=0
zero=0
total=0

for i in range(N):
  if a[i]<0:
    count+=count
    total=toal+abs(a[1])
  if a[1]<0:
    zero+=zero
    
if count%2==0 or zero>0:
  print(total)
else:
  print(total-np.abs(a))
  


### FIXED CODE ###

#Conding: Utf-8

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

count=num=total=0
b=[]

for i in a:
    if i<0:
        count+=1
    elif i==0:
        num+=1

if count%2==0 or num>0:
    for j in a:
        total=total+abs(j)
    print(total)
else:
    for k in a:
        total=total+abs(k)
    for l in a:
        b.append(abs(l))

    print(total-2*min(b))
import math

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

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

_ac = (a-1) // c # a以下のcの倍数の数
_bc = b // c # b以下のcの倍数の数

_ad = (a-1) // d # a以下のdの倍数の数
_bd = b // d # b以下のdの倍数の数

_acd = (a-1) // lcm(c,d) # a以下のcdの倍数の数
_bcd = b // lcm(c,d) # b以下のcdの倍数の数

m = (b-a+1) - ((_bc-_ac) + (_bd-_ad) - (_bcd-_acd))
print(m)



### FIXED CODE ###

from fractions import gcd

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

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

_ac = (a-1) // c # a以下のcの倍数の数
_bc = b // c # b以下のcの倍数の数

_ad = (a-1) // d # a以下のdの倍数の数
_bd = b // d # b以下のdの倍数の数

_acd = (a-1) // lcm(c,d) # a以下のcdの倍数の数
_bcd = b // lcm(c,d) # b以下のcdの倍数の数

m = (b-a+1) - ((_bc-_ac) + (_bd-_ad) - (_bcd-_acd))
print(m)
btc = 380000
N = int(input())
ans = 0
for i in range(N):
    x, u = map(int, input().split())
    if u == "BTC":
        x *= btc
    ans += x
print(ans)

### FIXED CODE ###

btc = 380000
N = int(input())
ans = 0
for i in range(N):
    x, u = input().split()
    x = float(x)
    if u == "BTC":
        x *= btc
    ans += x
print(ans)
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
lst = []
for _ in range(n):
    a = input().split(".")
    if len(a) == 1:
        a[0] = a[0] + '0' * 9
        lst.append(int(a[0]))
    else:
        l = len(a[1])
        tmp = a[0] + a[1] + '0' * (9 - l)
        lst.append(int(tmp))


two = []
five = []
for i in lst:
    j = i
    cnt = 0
    while j % 2 == 0:
        j //= 2
        cnt += 1
    two.append(cnt)
    j = i
    cnt = 0
    while j % 5 == 0:
        j //= 5
        cnt += 1
    five.append(cnt)

a = [[0] * 25 for _ in range(25)]
for i, j in zip(two, five):
    a[i][j] += 1

S = [[0] * 25 for _ in range(25)]
for i in range(1, 25):
    for j in range(1, 25):
        S[i][j] = a[i-1][j-1] + S[i][j - 1] + S[i - 1][j] - S[i - 1][j - 1]

ans = 0
for i, j in zip(two, five):
    if 18 - i < 0:
        i = 18
    if 18 - j < 0:
        j = 18
    ans += S[-1][-1] - S[-1][18 - j] - S[18 - i][-1] + S[18 - i][18 - j]
    if i + i >= 18 and j + j >= 18:
        ans -= 1
print(ans // 2)

### FIXED CODE ###

#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
lst = []
for _ in range(n):
    a = input().split(".")
    if len(a) == 1:
        a[0] = a[0] + '0' * 9
        lst.append(int(a[0]))
    else:
        l = len(a[1])
        tmp = a[0] + a[1] + '0' * (9 - l)
        lst.append(int(tmp))


two = []
five = []
for i in lst:
    j = i
    cnt = 0
    while j % 2 == 0:
        j //= 2
        cnt += 1
    two.append(cnt)
    j = i
    cnt = 0
    while j % 5 == 0:
        j //= 5
        cnt += 1
    five.append(cnt)

a = [[0] * 100 for _ in range(100)]
for i, j in zip(two, five):
    a[i][j] += 1

S = [[0] * 100 for _ in range(100)]
for i in range(1, 100):
    for j in range(1, 100):
        S[i][j] = a[i-1][j-1] + S[i][j - 1] + S[i - 1][j] - S[i - 1][j - 1]

ans = 0
for i, j in zip(two, five):
    if 18 - i < 0:
        i = 18
    if 18 - j < 0:
        j = 18
    ans += S[-1][-1] - S[-1][18 - j] - S[18 - i][-1] + S[18 - i][18 - j]
    if i + i >= 18 and j + j >= 18:
        ans -= 1
print(ans // 2)
import math
a = int(input())
s = 1
for i in range(a):
    t= int(input())
    s = (t*s)//math.gcd(t,s)
print(s)
    

### FIXED CODE ###


def gcd(x,y):
    if x==0:return y
    else:return gcd(y%x,x)
a = int(input())
s = 1
for i in range(a):
    t= int(input())
    s = (t*s)//gcd(t,s)
print(s)
H, W = map(int, input().split())
M = []
for h in range(H):
    col = []
    s = input()
    for w in range(W):
        if s[w] == '.':
            col.append(0)
        else:
            col.append(np.inf)
    M.append(col)



for h in range(H):
    for w in range(W):
        flag_h0= True
        flag_hM = True
        flag_w0 = True
        flag_wM = True
        if M[h][w] == np.inf:
            
            if h==0:
                flag_h0= False
            if h == H - 1:
                flag_hM = False
            if w== 0:
                flag_w0 = False
            if w== W-1:
                flag_wM = False
            
            if flag_h0:
                M[h-1][w] += 1
                if  flag_w0:
                    M[h-1][w-1] += 1
                if flag_wM:
                    M[h-1][w+1] += 1
            
            if flag_w0:
                M[h][w-1] += 1
            if flag_wM:
                M[h][w+1] += 1
            
            if flag_hM:
                M[h+1][w] += 1

                if flag_w0:
                    M[h+1][w-1] += 1
                if flag_wM:
                    M[h+1][w+1] += 1

                    
for h in range(H):
    tmp_ = ''
    for w in range(W):
        if M[h][w] < np.inf:
            tmp_ += str(M[h][w])
        else:
            tmp_  += '#'
    print(tmp_)
                

### FIXED CODE ###



import numpy as np
H, W = map(int, input().split())
M = []
for h in range(H):
    col = []
    s = input()
    for w in range(W):
        if s[w] == '.':
            col.append(0)
        else:
            col.append(np.inf)
    M.append(col)



for h in range(H):
    for w in range(W):
        flag_h0= True
        flag_hM = True
        flag_w0 = True
        flag_wM = True
        if M[h][w] == np.inf:
            
            if h==0:
                flag_h0= False
            if h == H - 1:
                flag_hM = False
            if w== 0:
                flag_w0 = False
            if w== W-1:
                flag_wM = False
            
            if flag_h0:
                M[h-1][w] += 1
                if  flag_w0:
                    M[h-1][w-1] += 1
                if flag_wM:
                    M[h-1][w+1] += 1
            
            if flag_w0:
                M[h][w-1] += 1
            if flag_wM:
                M[h][w+1] += 1
            
            if flag_hM:
                M[h+1][w] += 1

                if flag_w0:
                    M[h+1][w-1] += 1
                if flag_wM:
                    M[h+1][w+1] += 1

                    
for h in range(H):
    tmp_ = ''
    for w in range(W):
        if M[h][w] < np.inf:
            tmp_ += str(M[h][w])
        else:
            tmp_  += '#'
    print(tmp_)
import sys

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


#xの木の根を求める
def root(x,li): 
    if li[x] == x:
        return x
    else:
        li[x] = root(li[x],li)
        return li[x]

#xとyが同じ集合に属するかの判定
def find(x,y,li):
    return root(x,li) == root(y,li)

#xとｙを併合
def union(x,y,li):
    x = root(x,li)
    y = root(y,li)
    if x==y:
        return
    else:
        li[x] = root(y,li)

li1 = [i for i in range(N)]
li2 = [i for i in range(N)]

for i in range(M):
    a = AB[i][0]
    b = AB[i][1]
    union(a-1,b-1,li1)
for i in range(K):
    c = CD[i][0]
    d = CD[i][1]
    union(c-1,d-1,li2)

mm = [0 for i in range(max(li1))]
for i in range(N):
    m = root(i,li1)
    mm[m-1] += 1

# print(li1)
# print(mm)
ans = [mm[li1[i]-1]-1 for i in range(N)]
# print(ans)

for i in range(M):
    a = AB[i][0]
    b = AB[i][1]
    ans[a-1] -= 1
    ans[b-1] -= 1


for i in range(K):
    c = CD[i][0]
    d = CD[i][1]
    if find(c-1,d-1,li1):
        ans[c-1] -= 1
        ans[d-1] -= 1
print(*ans)





### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

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


#xの木の根を求める
def root(x,li): 
    if li[x] == x:
        return x
    else:
        li[x] = root(li[x],li)
        return li[x]

#xとyが同じ集合に属するかの判定
def find(x,y,li):
    return root(x,li) == root(y,li)

#xとｙを併合
def union(x,y,li):
    x = root(x,li)
    y = root(y,li)
    if x==y:
        return
    else:
        li[x]=y

li1 = [i for i in range(N)]
li2 = [i for i in range(N)]

for i in range(M):
    a = AB[i][0]
    b = AB[i][1]
    # print(str(i)+" ",end="")
    union(min(a-1,b-1),max(a-1,b-1),li1)
# for i in range(K):
#     c = CD[i][0]
#     d = CD[i][1]
#     union(c-1,d-1,li2)

mm = [0 for i in range(max(li1)+1)]
for i in range(N):
    m = root(i,li1)
    mm[m] += 1

# print(li1)
# print(mm)
ans = [mm[li1[i]]-1 for i in range(N)]
# print(ans)

for i in range(M):
    a = AB[i][0]
    b = AB[i][1]
    ans[a-1] -= 1
    ans[b-1] -= 1


for i in range(K):
    c = CD[i][0]
    d = CD[i][1]
    if find(c-1,d-1,li1):
        ans[c-1] -= 1
        ans[d-1] -= 1
print(*ans)
from itertools import product

N = int(input())
num_list = ["3", "5", "7"]
count = 0

for i in range(2,10):
    for t in product(num_list, repeat=i):
        check = t.count("3")*t.count("5").t.count("7")
        
        if int("".join(t)): <= N and check:
            count += 1

print(count)

### FIXED CODE ###

from itertools import product

N = int(input())
num_list = ["3", "5", "7"]
count = 0

for i in range(3, 10):
    for t in (product(num_list, repeat=i)):
        check = t.count("3")*t.count("5")*t.count("7")
        if int("".join(t)) <= N and check:
            count += 1


print(count)
import bisect
N, K = map(int, input().split())
x = list(map(int, input().split()))
id = bisect.bisect_left(x, 0)
ans = max(x) - min(0, min(x))
if id >= K:
    ans = min(ans, x[id-K])
if id + K - 1 < N:
    ans = min(ans, x[id+K-1])

for i in range(max(0, id - K + 1), id):
    ans = min(ans, -x[i]*2 + x[i+K-1], -x[i]+x[i+K-1]*2)

print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
x = list(map(int, input().split()))
import bisect
id = bisect.bisect_left(x,0)
ans=10**10
if id == N:
  print(abs(x[N-K]))
  exit(0)
for i in range(max(0,(K+id)-N),min(id+1,K)):
  right = x[K+id-1-i]
  left=0
  if i>0:
    left =x[id-i]
  tmp=min(abs(left)*2+right,right*2+abs(left)) 
  ans=min(tmp,ans)
print(ans)
a,b,k=map(int,input().split())

c=min(a,b)
d=max(a,b)
ans=[]

if a==b:
    ans.append(1)
else:
    for i in range(c):
        if c%(i+1)==0 and d%(i+1)==0:
            ans.append(i+1)
            
print(ans[-k])

### FIXED CODE ###

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

c=min(a,b)
d=max(a,b)
ans=[]

for i in range(c):
    if c%(i+1)==0 and d%(i+1)==0:
        ans.append(i+1)
            
print(ans[-k])
r1,c1,r2,c2=map(int,input().split())
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
print(cmb(c2+r2+2,c2+1,mod)-cmb(c2+r1+1,c2+1,mod)-cmb(c1+r2+1,c1,mod)+cmb(c1+r1,c1,mod))

### FIXED CODE ###

r1,c1,r2,c2=map(int,input().split())
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**6+10
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
print((cmb(c2+r2+2,c2+1,mod)-cmb(c2+r1+1,c2+1,mod)-cmb(c1+r2+1,c1,mod)+cmb(c1+r1,c1,mod)+mod)%mod)