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

# 初期入力
N= int(input())
S =input()

from collections import Counter
c = Counter(S)
count_all =c["R"] * c["G"] * c["B"]
count =0
#for i in range(N):
for i in range((N+1)//2):
    for j in range(1,i+1):
        if  0<=i-j and i+j <N: 
            if (S[i-j]=="R" and S[i] =="G" and S[i+j] =="B"):
                #print(i-j,i,i+j)
                count +=1
            elif S[i-j]=="R" and S[i] =="B" and S[i+j] =="G":
                #print(i-j,i,i+j)
                count +=1
            elif S[i-j]=="G" and S[i] =="R" and S[i+j] =="B":
                #print(i-j,i,i+j)
                count +=1
            elif S[i-j]=="G" and S[i] =="B" and S[i+j] =="R":
                #print(i-j,i,i+j)
                count +=1
            elif S[i-j]=="B" and S[i] =="G" and S[i+j] =="R":
                #print(i-j,i,i+j)
                count +=1
            elif S[i-j]=="B" and S[i] =="R" and S[i+j] =="G":
                count +=1
                #print(i-j,i,i+j)
N2=(N+1)//2           
for i in range(N2,N):
    for j in range(N-i,0,-1):
        if  0<=i-j and i+j <N: 
            if ((S[i-j]=="R" and S[i] =="G" and S[i+j] =="B")
                or( S[i-j]=="R" and S[i] =="B" and S[i+j] =="G")
                or( S[i-j]=="G" and S[i] =="R" and S[i+j] =="B")
                or( S[i-j]=="G" and S[i] =="B" and S[i+j] =="R")
                or( S[i-j]=="B" and S[i] =="G" and S[i+j] =="R")
                or( S[i-j]=="B" and S[i] =="R" and S[i+j] =="G")
            ):
                count +=1
                #print(i-j,i,i+j)

print(count_all - count) 

### FIXED CODE ###

# 初期入力
N= int(input())
S =input()


#
R_index=[]
G_index=[]
B_index=[]
for i,v in enumerate(S):
    if v =="R":
        R_index.append(i)
    if v =="G":
        G_index.append(i)
    if v =="B":
        B_index.append(i)

# 例　R_index各要素から等距離離れたところに左にG、右にBがあればOK
R_B =[]
B_G =[]
count_ij_jk_onaji =0
for r in R_index:
    for g in G_index:
        if 0<=g-(r-g) and g-(r-g)<N  :
            #if S[g-(r-g)]=="B" and r<g:
            if S[g-(r-g)]=="B" :
                count_ij_jk_onaji +=1
               # print(r,g,g-(r-g),"B")
for b in B_index:
    for r in R_index:
        if 0<=r-(b-r) and r-(b-r)<N :
            #if S[r-(b-r)] == "G" and b<r:
            if S[r-(b-r)] == "G" :
                count_ij_jk_onaji +=1
                #print(r,b,r-(b-r),"G")
for g in G_index:
    for b in B_index:
        if 0<=b-(g-b) and b-(g-b)<N :
            #if S[b-(g-b)] =="R" and g<b:
            if S[b-(g-b)] =="R":
                count_ij_jk_onaji +=1
                #print(b,g,b-(g-b),"R")

            
#3つとも異なる文字=all
kotae_all = len(R_index) * len(G_index) * len(B_index) 
print(kotae_all -count_ij_jk_onaji)
### BUGGY CODE ###

from fractions import gcd
from functools import reduce

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

#a = [746130, 1385670, 4849845, 881790, 3233230, 1939938, 570570, 510510]
#a = [7,6,8]
#n = len(a)
max_value = 0
for i in range(n):
    memo = a.pop(0)
    x = reduce(gcd, a)
    if x > max_value:
        max_value = x
    a.append(memo)
print(max_value)

### FIXED CODE ###

from fractions import gcd
n = int(input())
a = list(map(int,input().split()))
l = [0]
r = [0]
ans = 0
for i in range(n-1):
    l.append(gcd(l[i],a[i]))
for i in range(n-1):
    r.append(gcd(r[i],a[n-1-i]))
for i in range(n):
    ans = max(ans,gcd(l[i],r[-i-1]))
print(ans)
### BUGGY CODE ###

from string import ascii_lowercase
import sys


def input():
    return sys.stdin.readline().strip()


class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0] * (n + 1)
        self.k_init = 2 ** (self.n - 1).bit_length()

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            i += i & -i


n = int(input())
s = input()
q = int(input())

bits = {c: BIT(n) for c in ascii_lowercase}
[bits[c].add(i, 1) for i, c in enumerate(s, 1)]
queries = (input().split() for _ in range(q))

ans = []
for q_type, *q in queries:
    if q_type == '1':
        iq = int(q[0])
        cq = q[1]
        for c in ascii_lowercase:
            if bits[c].sum(iq) - bits[c].sum(iq - 1) == 1:
                bits[c].add(iq, -1)
                break
        bits[cq].add(iq, 1)
    else:
        l, r = map(int, q)
        cnt = 0
        for c in ascii_lowercase:
            if bits[c].sum(r) - bits[c].sum(l - 1) > 0:
                cnt += 1
        ans.append(cnt)
[print(i) for i in ans]

### FIXED CODE ###

from string import ascii_lowercase
import sys


def input():
    return sys.stdin.readline().strip()


class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0] * (n + 1)
        self.k_init = 2 ** (self.n - 1).bit_length()

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            i += i & -i


n = int(input())
s = input()
q = int(input())

bits = {c: BIT(n) for c in ascii_lowercase}
[bits[c].add(i, 1) for i, c in enumerate(s, 1)]
queries = (input().split() for _ in range(q))

ans = []
for q_type, *q in queries:
    if q_type == '1':
        iq = int(q[0])
        cq = q[1]
        for c in ascii_lowercase:
            if bits[c].sum(iq) - bits[c].sum(iq - 1) == 1:
                bits[c].add(iq, -1)
                break
        bits[cq].add(iq, 1)
    else:
        l, r = map(int, q)
        cnt = 0
        for c in ascii_lowercase:
            if bits[c].sum(r) - bits[c].sum(l - 1) > 0:
                cnt += 1
        ans.append(cnt)
[print(i) for i in ans]
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
dic = {}
ans = {}
for item in a:
    if item in dic.keys():
        dic[item] += 1
    else:
        dic[item] = 1

all_ans = sum([item * (item - 1) // 2 for item in dic.values()])

for i in range(n):
    print(all_ans - dic[a[i]] + 1)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
dic = {}
ans = {}
for item in a:
    if item in dic.keys():
        dic[item] += 1
    else:
        dic[item] = 1

all_ans = sum([item * (item - 1) // 2 for item in dic.values()])

for i in range(n):
    print(all_ans - dic[a[i]] + 1)
### BUGGY CODE ###

n, k = list(map(int, input().split()))
li = list(map(int, input().split())) + [0] * k

dp = [0] + [float("inf")] * (n + k)

for i in range(n-1):
    for k in range(1,k+1):
        dp[i+k] = min(dp[i+k], dp[i] + abs(li[i+k] - li[i]))

print(dp[n-1])

### FIXED CODE ###

import numpy as np

n,k = list(map(int, input().split()))
h = np.array(list(map(int, input().split())))

dp = np.array([0] * n)

for i in range(1,n):
    s = max(i-k,0)
    dp[i] = min(dp[s : i] + abs(h[i] - h[s:i]))

print(dp[n-1])
### BUGGY CODE ###

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

cnt = 0
for i in range(N):
    for j in range(i+1, N+1):
        if sum(A[i:j])%K==j-i:
            cnt += 1
print(cnt)

### FIXED CODE ###

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

B = [0]*(N+1)

b = 0
for i, a in enumerate(A):
    b += a - 1
    b %= K
    B[i+1] = b

Q = {}
X = 0

for i, b in enumerate(B):
    if i>=K:
        Q[B[i-K]] -= 1
 
    if b in Q:
        X += Q[b]
        Q[b] += 1
    else:
        Q[b] = 1

print(X)
### BUGGY CODE ###

def main():
  import sys
  from heapq import heappush, heappop, heapify
  _int = int
  n = _int(input())
  a = [_int(e) for e in input().split()]
  b = [_int(e) for e in input().split()]
  result = 0
  finished = 0
  hq = [(-b[i], i) for i in range(n)]
  heapify(hq)
  while True:
    _, i = heappop(hq)
    if a[i] == b[i]:
      finished += 1
      continue
    if i == 0:
      j = b[n - 1] + b[1]
    elif i == n - 1:
      j = b[n - 2] + b[0]
    else:
      j = b[i - 1] + b[i + 1]
    if len(hq) != 0:
      k = min((b[i] + hq[0][0]) // j, (b[i] - a[i]) // j)
    else:
      k = (b[i] - a[i]) // j
    if k <= 0:
      k = 1
    b[i] -= j * k
    if a[i] > b[i]:
      print(-1)
      sys.exit()
    result += k
    if a[i] == b[i]:
      finished += 1
      if finished == n:
        print(result)
        sys.exit()
    else:
      heappush(hq, (-b[i], i))
main()

### FIXED CODE ###

def main():
  import sys
  _int = int
  n = _int(input())
  a = [_int(e) for e in input().split()]
  b = [_int(e) for e in input().split()]
  result = 0
  q = [i for i in range(n) if b[i] != a[i]]
  while len(q) != 0:
    nq = []
    c = 0
    for i in q:
      if i == 0 or i == n - 1:
        j = b[(n + i - 1) % n] + b[(n + i + 1) % n]
      else:
        j = b[i - 1] + b[i + 1]
      if j > b[i] - a[i]:
        nq.append(i)
        continue
      c += 1
      k = (b[i] - a[i]) // j
      result += k
      b[i] -= j * k
      if a[i] != b[i]:
        nq.append(i)
    if c == 0 and len(nq) != 0:
      print(-1)
      sys.exit()
    q = nq
  print(result)
main()
### BUGGY CODE ###

# TLE

import numpy as np
import sys
sys.setrecursionlimit(2000)



def solve(M, num1):

    Mr = np.copy(M)
    Mc = np.copy(M)


    H = M.shape[0]
    W = M.shape[1]

    ret = 0

    # if M.sum() == 0:
    if num1 == 0:
        return ret
    elif H == W == 1:
        return M[0][0]


    del_row = 100000
    del_col = 100000
    num1r = num1
    num1c = num1
    retr = 0
    retc = 0
    if H > 1:
        if Mr[0][0] == 1:
            h = 1
            w = 1
            # while h < H and M[:h + 1, :w].sum() == (h + 1) * w:
            while h < H and Mr[h][0] == 1:
                h += 1
            # while w < W and Mr[:h, :w + 1].sum() == h * (w + 1):
            while w < W and Mr[:h, w:w + 1].sum() == h:
                w += 1

            for i in range(h):
                for j in range(w):
                    Mr[i][j] = 0
                    num1r -= 1
            retr += 1

        del_row = solve(Mr[1:, :], num1r)


    if W > 1:

        if Mc[0][0] == 1:

            h = 1
            w = 1

            # while w < W and Mc[:h, :w + 1].sum() == h * (w + 1):
            while w < W and Mc[0][w] == 1:
                w += 1
            # while h < H and Mc[:h + 1, :w].sum() == (h + 1) * w:
            while h < H and Mc[h:h + 1, :w].sum() == w:
                h += 1


            for i in range(h):
                for j in range(w):
                    Mc[i][j] = 0
                    num1c -= 1
            retc += 1

        del_col = solve(Mc[:, 1:], num1c)

    return min(retr + del_row, retc + del_col)


H, W = [int(x) for x in input().split()]
s = [list(input()) for i in range(H)]
M = np.array([[ (0 if s[i][j] == '.' else 1) for j in range(W) ] for i in range(H)])

print(solve(M, M.sum()) )


### FIXED CODE ###

import numpy as np

H, W = [int(x) for x in input().split()]
s = [list(input()) for i in range(H)]

M = np.array([[ (0 if s[i][j] == '.' else 1) for j in range(W) ] for i in range(H)])
INF = 10 ** 9
dp = np.array([[INF for j in range(W)] for i in range(H)])

for i in range(H - 1, -1, -1):
    for j in range(W - 1, -1, -1):
        ans_r = INF
        ans_d = INF
        if i == H - 1 and j == W - 1:
            dp[i][j] = M[i][j]
            continue
        if j < W - 1:  # 右に動ける
            if M[i][j] == 1 and M[i][j + 1] == 0:
                ans_r = dp[i][j + 1] + 1
            else:
                ans_r = dp[i][j + 1]
        if i < H - 1:  # 下に動ける
            if M[i][j] == 1 and M[i + 1][j] == 0:
                ans_d = dp[i + 1][j] + 1
            else:
                ans_d = dp[i + 1][j]
        dp[i][j] = min(ans_r, ans_d)

print(dp[0][0])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

import numpy as np

N,B = map(int,input().split())
X = np.array(input().split(), dtype=np.int64)

Xcum = X.cumsum()

coef = np.full(N,2,dtype=np.int64)
coef[0] = 5
coef[1] = 0

answer = 10**18
for n in range(1,N+1):
    # 往復回数
    cost = (Xcum[::-n]*coef[:1+(N-1)//n]).sum() + B*(N+n)
    answer = min(answer, cost)

print(answer)


### FIXED CODE ###

import sys
input = sys.stdin.readline
import itertools

N,B = map(int,input().split())
X = [int(x) for x in input().split()]

Xcum = tuple(itertools.accumulate(X))

coef = [2] * N
coef[0] = 5
coef[1] = 0

answer = min(sum(x*y for x,y in zip(Xcum[::-n], coef[:1+(N-1)//n])) + B*(N+n) for n in range(1,N+1))
print(answer)
### BUGGY CODE ###

N = int(input())
def kaijo(N) :
    ans = 1
    for i in range(1,N+1) :
        ans *=i
    return ans
mod = 1000000007
A = kaijo(N)
print(A%mod)

### FIXED CODE ###

import math
print(math.factorial(int(input()))%int(1e9+7))
### BUGGY CODE ###

n=int(input())
num=[]
for i in range(n):
    a=int(input())
    str=a in num
    if str==True:
        num.remove(a)
    else:
        num.append(a)
print(len(num))


### FIXED CODE ###

n=int(input())
num=[]
def ap(num1):
    num.append(num1)
for i in range(n):
    a=int(input())
    ap(a)
num.sort()
num1=num[0]
num2=1
ans=0
for i in range(n-1):
    if num[i+1]==num1:
        num2+=1
    else:
        num1=num[i+1]
        if num2%2==1:
            ans+=1
        num2=1
if num2%2==1:
    ans+=1
print(ans)
### BUGGY CODE ###

n,m=map(int,input().split())
A=[int(input()) for _ in range(m)]
dp=[1]+[0]*(n+1)
for i in range(n):
    if i in A:
        continue
    dp[i+1] += dp[i]
    dp[i+2] += dp[i]
print(dp[n]%(10**9 + 7))

### FIXED CODE ###

n,m=map(int,input().split())
A={int(input()) for _ in range(m)}
dp=[1]+[0]*(n+1)
for i in range(n):
    if i in A:
        continue
    dp[i+1] += dp[i]
    dp[i+2] += dp[i]
print(dp[n]%(10**9 + 7))
### BUGGY CODE ###

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

result = 0
for X in range(K+1):
    for Y in range(K+1):
        for Z in range(K+1):
            if S == X+Y+Z:
                result += 1
print(result)

### FIXED CODE ###

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

result = 0
for X in range(K+1):
    for Y in range(K+1):
        Z = S-X-Y
        if Z<0:
            continue
        elif K<Z:
            continue
        elif S == X+Y+Z:
            result += 1
print(result)
### BUGGY CODE ###

import math
k = int(input())
ans = 0
for i in range(1, k+1):
    for j in range(1, k+1):
        for k in range(1, k+1):
            temp = math.gcd(i, j)
            ans += math.gcd(temp, k)

print(ans)


### FIXED CODE ###

import math
k = int(input())
ans = 0
for i in range(1, k+1):
    for j in range(1, k+1):
        for k in range(1, k+1):
            temp = math.gcd(i, j)
            ans += math.gcd(temp, k)

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

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

def found_cut(X):
    p1 = sum(X)/2
    count1 = 0
    for i in range(len(X)):
        count1 += X[i]
        if p1 <= count1:
            if abs(count1-p1) < abs(count1-X[i]-p1):
                index = i
                break
            else:
                index = i-1
                break
    return index

def found_ans(X,Y,Z,W):
    ans_list = []
    ans_list.append(sum(X))
    ans_list.append(sum(Y))
    ans_list.append(sum(Z))
    ans_list.append(sum(W))
    return max(ans_list)-min(ans_list)

ANS = []
for x in range(N-1):
    A_first = A[:x+1]
    A_second = A[x+1:]

    if len(A_first) >= 3:
        yp1 = found_cut(A_first)
        pattern1_1 = A_first[:yp1+1]
        pattern1_2 = A_first[yp1+1:]
        if len(pattern1_2) != 1:
            yp2 = found_cut(pattern1_2)
            pattern1_2_1 = pattern1_2[:yp2+1]
            pattern1_2_2 = pattern1_2[yp2+1:]
            ANS.append(found_ans(pattern1_1,pattern1_2_1,pattern1_2_2,A_second))
        if len(pattern1_1) != 1:
            yp2 = found_cut(pattern1_1)
            pattern1_1_1 = pattern1_1[:yp2+1]
            pattern1_1_2 = pattern1_1[yp2+1:]
            ANS.append(found_ans(pattern1_1_1,pattern1_1_2,pattern1_2,A_second))
    if len(A_second) >= 3:
        zp1 = found_cut(A_second)
        pattern2_1 = A_second[:zp1+1]
        pattern2_2 = A_second[zp1+1:]
        if len(pattern2_2) != 1:
            zp2 = found_cut(pattern2_2)
            pattern2_2_1 = pattern2_2[:zp2+1]
            pattern2_2_2 = pattern2_2[zp2+1:]
            ANS.append(found_ans(pattern2_1,pattern2_2_1,pattern2_2_2,A_first))
        if len(pattern2_1) != 1:
            zp2 = found_cut(pattern2_1)
            pattern2_1_1 = pattern2_1[:zp2+1]
            pattern2_1_2 = pattern2_1[zp2+1:]
            ANS.append(found_ans(pattern2_1_1,pattern2_1_2,pattern2_2,A_first))
    if len(A_first) >= 2 and len(A_second) >= 2:
        wp1 = found_cut(A_first)
        wp2 = found_cut(A_second)
        pattern3_1 = A_first[:wp1+1]
        pattern3_2 = A_first[wp1+1:]
        pattern3_3 = A_second[:wp2+1]
        pattern3_4 = A_second[wp2+1:]
        ANS.append(found_ans(pattern3_1,pattern3_2,pattern3_3,pattern3_4))
print(min(ANS))

### FIXED CODE ###

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

S = [0]*N
S[0] = A[0]
for i in range(1, N):
    S[i] = A[i]+S[i-1]
    
ans = 2*10**14
l = 0
temp = 2*10**14
r = 2
#for i in range(2, N):
#    if abs(S[-1]-2*S[i]+S[1]) < temp:
#        temp = abs(S[-1]-2*S[r]+S[1])
#        r = i
        
for i in range(2, N-1):
    r = max(r, i)
    while l+1 < i-1 and abs(S[i-1]-2*S[l]) > abs(S[i-1]-2*S[l+1]):
        l += 1
    while r+1 < N-1 and abs(S[N-1]-2*S[r]+S[i-1])  > abs(S[N-1]-2*S[r+1]+S[i-1]):
        r += 1
    t = max(S[N-1]-S[r], S[r]-S[i-1], S[i-1]-S[l], S[l]) - min(S[N-1]-S[r], S[r]-S[i-1], S[i-1]-S[l], S[l])
    ans = min(ans, t)
    
print(ans)
### BUGGY CODE ###

# encoding: utf-8
S = input()

A = 0
C = S.count("C") # N
q = 0

q_max = S.count("?") # N

ABC = 0
div = 10 ** 9 + 7
for si in S: # N
    if si == "A": A += 1
    elif si == "C": C -= 1
    elif si == "B":
        ABC = (ABC + (A * C) * (3 ** q_max)) % div
        ABC = (ABC + (q * C) * (3 ** (q_max - 1))) % div
        ABC = (ABC + (A * (q_max - q)) * (3 ** (q_max - 1))) % div
        ABC = (ABC + (q * (q_max - q)) * (3 ** (q_max - 2))) % div
    else: # "?"
        ABC = (ABC + (A * C) * (3 ** (q_max - 1))) % div
        ABC = (ABC + (q * C) * (3 ** (q_max - 2))) % div
        ABC = (ABC + (A * (q_max - q - 1)) * (3 ** (q_max - 2))) % div
        ABC = (ABC + (q * (q_max - q - 1)) * (3 ** (q_max - 3))) % div        
        q += 1
    # print(si, ABC)
    
print(int(ABC))

### FIXED CODE ###

# encoding: utf-8
S = input()

A = 0
C = S.count("C") # N
q = 0

q_max = S.count("?") # N

ABC = 0
div = 10 ** 9 + 7
B_base = 3 ** (q_max - 2) % div
q_base = 3 ** (q_max - 3) % div
for si in S: # N
    if si == "A": A += 1
    elif si == "C": C -= 1
    elif si == "B":
        # ABC = (ABC + (A * C) * (3 ** q_max)) % div
        # ABC = (ABC + (q * C) * (3 ** (q_max - 1))) % div
        # ABC = (ABC + (A * (q_max - q)) * (3 ** (q_max - 1))) % div
        # ABC = (ABC + (q * (q_max - q)) * (3 ** (q_max - 2))) % div
        ABC = (ABC + (3 * A + q) * (3 * C + q_max - q) * B_base) % div
    else: # "?"
        # ABC = (ABC + (A * C) * (3 ** (q_max - 1))) % div
        # ABC = (ABC + (q * C) * (3 ** (q_max - 2))) % div
        # ABC = (ABC + (A * (q_max - q - 1)) * (3 ** (q_max - 2))) % div
        # ABC = (ABC + (q * (q_max - q - 1)) * (3 ** (q_max - 3))) % div        
        ABC = (ABC + (3 * A + q) * (3 * C + q_max - q - 1) * q_base) % div
        q += 1
    # print(si, ABC)
    
print(int(ABC))
### BUGGY CODE ###

import sys
N,K=map(int,input().split())
A=sorted([int(i) for i in input().split()])
sa=sum(A)
def f(x):
    if A[x]>=K:
        return True
    L=set()
    L.add(0)
    for i in range(N):
        T=set()
        s=A[i]
        if i==x:
            s=0
        for k in L:
            T.add(k)
            if k+s<K:
                T.add(k+s)
        L=T
    for k in L:
        if k+A[x]>=K:
            return True
    return False
ma=N-1
mi=0
if not f(N-1):
    print(N)
    sys.exit()
if f(0):
    print(0)
    sys.exit()
while ma-mi>1:
    #print(ma,mi)
    a=(ma+mi)//2
    if f(a):
        ma=a
    else:
        mi=a
print(ma)

### FIXED CODE ###

import sys
N,K=map(int,input().split())
A=sorted([int(i) for i in input().split()])
sa=sum(A)
def f(x):
    y=A[x]
    if y>=K:
        return True
    L=set()
    L.add(0)
    dp=[False]*(K-y)
    dp[0]=True
    t=0
    for i in range(N):
        if i==x:
            continue
        s=A[i]
        for k in range(t,-1,-1):
            if not dp[k]:
                continue
            if k+s>=K:
                continue
            if k+s+y>=K:
                return True
            dp[k+s]=True
        t=min(t+s,K-y-1)
    return False
ma=N-1
mi=0
if not f(N-1):
    print(N)
    sys.exit()
if f(0):
    print(0)
    sys.exit()
while ma-mi>1:
    #print(ma,mi)
    a=(ma+mi)//2
    if f(a):
        ma=a
    else:
        mi=a
print(ma)
### BUGGY CODE ###

n,k=map(int,input().split())
a=[]
for i in range(0,n+1):
    a.append(10**20+i)
b=set()
for i in range(2**(n+1)):
    c=0
    d=0
    for j in range(n+1):
        if ((i>>j) & 1):
            c+=a[j]
            d+=1
    if d>=k:
        b.add(c)
print(len(b)%(10**9+7))

### FIXED CODE ###

n,k=map(int,input().split())
d=0
for i in range(k,n+2):
    b=i*(i-1)/2
    c=i*(2*n-i+1)/2
    d+=(c-b+1)
print(int(d)%(10**9+7))
### BUGGY CODE ###

import collections

n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
data = sorted(list(set(a)))
prime_bool = [True]*(max(a)+1)
prime_bool[0] = False
count = 0
for i in range(len(data)):
  p = data[i]
  if prime_bool[p]:
    if c[p] == 1:
      count += 1
    #print(p)
    for j in range(2*p, max(a)+1, p):
      prime_bool[j] = False



print(count)



### FIXED CODE ###

import collections

n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
c = collections.Counter(a)
data = sorted(list(set(a)))
max_ = max(a)+1
prime_bool = [True]*max_
prime_bool[0] = False

for i in range(len(data)):
  p = data[i]
  if prime_bool[p]:
    #print(p)
    k = 2
    while k*p < max_:
      prime_bool[k*p] = False
      k += 1

count = 0
for i in range(len(prime_bool)):
  if prime_bool[i]:
    if c[i] == 1:
      count += 1
print(count)
#print(prime_bool)
### BUGGY CODE ###

import math
n, a, b = map(int, input().split())
X = 2**n-1
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

Y = combinations_count(n, a)
Z = combinations_count(n, b)

print(X-Y-Z)

### FIXED CODE ###

n, a, b = map(int, input().split())
mod = 10**9 + 7
def nck(k):
    y, z = 1, 1
    for i in range(1, k+1):
        y = (y * (n+1-i)) % mod
        z = (z * pow(i, mod-2, mod)) % mod
    return (y*z) % mod
 
ans = (pow(2, n, mod) - 1 - nck(a) - nck(b)) % mod
print(ans)
### BUGGY CODE ###

import bisect

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

A = []
B = []
for _ in range(N):
    a,b = map(int,input().split(" "))
    A.append(a)
    B.append(b)


# 日数でソート
ind_sorted = sorted(range(N), key = lambda x:A[x])

tmp_a = 0
tmp_b_ls = [0]
money = 0
for i in range(N):
    if A[ind_sorted[i]] > M:
        break
    if tmp_a != A[ind_sorted[i]]:
        d = A[ind_sorted[i]]-tmp_a
        tmp_money = sum(tmp_b_ls[-d:])
        money += tmp_money
        tmp_b_ls = tmp_b_ls[:-d]
        tmp_a = A[ind_sorted[i]]
    bisect.insort(tmp_b_ls,B[ind_sorted[i]])

d = M+1-tmp_a
tmp_money = sum(tmp_b_ls[-d:])
money += tmp_money

print(money)

### FIXED CODE ###

import bisect
import time
import heapq


# N: バイトの種類
# M: 日数の最大
N,M = map(int,input().split(" "))

# A 日数
# b バイト代
A = []
B = []
for _ in range(N):
    a,b = map(int,input().split(" "))
    A.append(a)
    B.append(-b)

# 日数でソート
ind_sorted = sorted(range(N), key = lambda x:A[x])
tmp_a = 0
tmp_b_ls = [0]
money = 0
tmp_ind = 0
for i in range(N):
    if A[ind_sorted[i]] > M:
        break
    if tmp_a != A[ind_sorted[i]]:
        # 空いている日数
        # print(d)
        # print(tmp_b_ls)
        d = A[ind_sorted[i]]-tmp_a
        for _ in range(d):
            if tmp_b_ls == []:
                break
            money -= heapq.heappop(tmp_b_ls)
        tmp_a = A[ind_sorted[i]]
    heapq.heappush(tmp_b_ls,B[ind_sorted[i]])

d = M+1-tmp_a
# print(d)
# print(tmp_b_ls)

for _ in range(d):
    if tmp_b_ls == []:
        break
    money -= heapq.heappop(tmp_b_ls)
print(money)
### BUGGY CODE ###


N=int(input())
A = 1
for i in range(N):
  A *= (i+1)

A %=(10**9+7)
print(A)


### FIXED CODE ###

import math
 
N=int(input())
 
A = math.factorial(N)
A %=(10**9+7)

print(A)