Harryxun/stf_run huggingface dataset:
D,G = map(int,input().split())
ab = []
for _ in range(D):
    p, c = (int(x) for x in input().split())
    ab.append([p,c])

ans = 10000000

pick_num = []

for i in range(D):
    pick_num.append(i)

for i in range(0,D+1):
    for v in itertools.combinations(pick_num, i):      
        tmp_point = 0
        tmp_count = 0
        for j in v:
            tmp_point += ab[j][0]*(j+1)*100+ab[j][1]
            tmp_count += ab[j][0]
        if tmp_point < G:
            nokori = G-tmp_point
            for k in range(D-1, -1,-1):
                if k not in v:
                    if nokori%(100*(k+1)) == 0:
                        if nokori//(100*(k+1)) < ab[k][0]:
                            tmp_count += nokori//(100*(k+1))
                            tmp_point += nokori
                    else:
                        if nokori//(100*(k+1))+1 < ab[k][0]:
                            tmp_count += nokori//(100*(k+1))+1
                            tmp_point += nokori
                    break
        if G <= tmp_point:
            ans = min(ans, tmp_count)
print(ans)

### FIXED CODE ###

import itertools

D,G = map(int,input().split())
ab = []
for _ in range(D):
    p, c = (int(x) for x in input().split())
    ab.append([p,c])

ans = 10000000

pick_num = []

for i in range(D):
    pick_num.append(i)

for i in range(0,D+1):
    for v in itertools.combinations(pick_num, i):      
        tmp_point = 0
        tmp_count = 0
        for j in v:
            tmp_point += ab[j][0]*(j+1)*100+ab[j][1]
            tmp_count += ab[j][0]
        if tmp_point < G:
            nokori = G-tmp_point
            for k in range(D-1, -1,-1):
                if k not in v:
                    if nokori%(100*(k+1)) == 0:
                        if nokori//(100*(k+1)) < ab[k][0]:
                            tmp_count += nokori//(100*(k+1))
                            tmp_point += nokori
                    else:
                        if nokori//(100*(k+1))+1 < ab[k][0]:
                            tmp_count += nokori//(100*(k+1))+1
                            tmp_point += nokori
                    break
        if G <= tmp_point:
            ans = min(ans, tmp_count)
print(ans)
#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    while len(q) != 0 and len(q) <= (10 ** 5):
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min_cover[y][x]:
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
 
while True:
    data = raw_input()
    if data == "0":
        break
    m, n = map(int, data.split())
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()

### FIXED CODE ###

#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min_cover[y][x]:
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)

while True:
    data = raw_input()
    m, n = map(int, data.split())
    if m == 0:
        break
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()
S = int()
print(S[0]+ len(S) + S[-1])

### FIXED CODE ###

S = input()
T = len(S)-2
print(S[0]+ str(T) + S[-1])
from collections import Counter
from math import factorial
n = int(input())
lst = [input() for _ in range(n)]
for i in range(n):
    lst[i] = str(sorted(lst[i])).replace(', ','').replace("'",'').replace('[','').replace(']','')
numlst = Counter(lst)
ans = 0
for v in numlst.values():
    if v >= 2:
        ans += factorial(v) / factorial(2) / factorial(v-2)
print(int(ans))

### FIXED CODE ###

from collections import Counter

N = int(input())
S = [input() for i in range(N)]

sorted_S =  [''.join(sorted(s)) for s in S]
c = Counter(sorted_S)

print(sum([n * (n-1)//2 for n in  list(c.values())]))
K=int(input())
if K%2==0:
  print((L//2)**2)
else:
  print(L//2*(L//2+1))

### FIXED CODE ###

K=int(input())
if K%2==0:
  print((K//2)**2)
else:
  print(K//2*(K//2+1))
import sys
sys.setrecursionlimit(1000000)

def main():
    h, w = map(int, input().split())
    mp = ["X" * (w + 2)] + ["X" + input() + "X" for _ in range(h)] + ["X" * (w + 2)]
    checked = [[False] * (w + 2) for _ in range(h + 2)]
    vec = ((1, 0), (0, -1), (-1, 0), (0, 1))


    def search(x, y):
        checked[y][x] = True
        if mp[y][x] == "#":
            b_cnt = 1
            w_cnt = 0
            another = "."
        else:
            b_cnt = 0
            w_cnt = 1
            another = "#"
        for dx, dy in vec:
            nx, ny = x + dx, y + dy
            if not checked[ny[nx] and mp[ny][nx] == another:
                w_add, b_add = search(nx, ny)
                w_cnt += w_add
                b_cnt += b_add
        return w_cnt, b_cnt

    ans = 0
    for y in range(1, h + 1):
        for x in range(1, w + 1):
            if not checked[y][x]:
                w_cnt, b_cnt = search(x, y)
                ans += w_cnt * b_cnt

    print(ans)

main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

def main():
    h, w = map(int, input().split())
    mp = ["X" * (w + 2)] + ["X" + input() + "X" for _ in range(h)] + ["X" * (w + 2)]
    checked = [[False] * (w + 2) for _ in range(h + 2)]
    vec = ((1, 0), (0, -1), (-1, 0), (0, 1))


    def search(stack):
        x, y = stack.pop()
        if mp[y][x] == "#":
            b_cnt = 1
            w_cnt = 0
            another = "."
        else:
            b_cnt = 0
            w_cnt = 1
            another = "#"
        for dx, dy in vec:
            nx, ny = x + dx, y + dy
            if not checked[ny][nx] and mp[ny][nx] == another:
                checked[ny][nx] = True
                stack.append((nx, ny))
        return w_cnt, b_cnt

    ans = 0
    for y in range(1, h + 1):
        for x in range(1, w + 1):
            if not checked[y][x]:
                checked[y][x] = True
                stack = []
                stack.append((x, y))
                w_cnt = b_cnt = 0
                while stack:
                    w_add, b_add = search(stack)
                    w_cnt += w_add
                    b_cnt += b_add
                ans += w_cnt * b_cnt

    print(ans)

main()
N,K = map(int,input().split())
Alist = list(map(int, input().strip().split()))
p = 1
for i in range(len(Alist)-1):
    if Alist[i]*Alist[i+1] <= 0:
        q = i
        p = p*(-1)
length = 10**10
ans2 = 10**10
if p == 1:
    if Alist[0] > 0:
        ans = Alist[K-1]
    if Alist[0] < 0:
        ans = -Alist[0]
if p == -1:
    for i in range(len(Alist)):
        if i + K - 1 < len(Alist):
            if i + K - 1 == q:
                length = min(abs(Alist[i]),length)
            elif i == q + 1:
                length = min((Alist[i+K-1]),length)
            else:
                length = min(min(abs(Alist[i+K-1]-Alist[i])+abs(Alist[i]),abs(Alist[i+K-1]-Alist[i]),abs(Alist[i+K-1])),length)
    ans = length
for i in range(len(Alist)):
    ans2 = min(ans2,abs(Alist[i]))
if K == 1:
    print(ans2)
else:
    if len(Alist) > 1:
        print(ans)
    if len(Alist) ==1:
        print(Alist[0])

### FIXED CODE ###

N = int(input())
p = []
if N > 0:
    for i in range(500):
        if (2**(2*i)-1)/3 < N <= (2**(2*(i+1))-1)/3:
            q = 2*i + 1
if N < 0:
    for i in range(1,500):
        if -(2**(2*i+1)-2)/3 <= N < -(2**(2*i-1)-2)/3:
            q = 2*i
if N == 0:
    q = 1
def cal(n,i):
    if i % 2 != 0:
        if (2**(i-1)-1)/3 < n <= (2**(i+1)-1)/3:
            p.append(1)
            n = n - (-2)**(i-1)
            i = i-1
            if i > 0:
                cal(n,i)
        else:
            p.append(0)
            i = i-1
            if i > 0:
                cal(n,i)
    elif n == 0:
        p.append(0)
        i = i-1
        if i > 0:
            cal(n,i)
    else:
        if -(2**(i+1)-2)/3 <= n < -(2**(i-1)-2)/3:
            p.append(1)
            n = n - (-2)**(i-1)
            i = i-1
            if i > 0:
                cal(n,i)
        else:
            p.append(0)
            i = i-1
            if i > 0:
                cal(n,i)
            
    return p
ans = cal(N,q)
for i in range(len(ans)):
    ans[i] = str(ans[i])
print(int(''.join(ans)))
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def inp():
    return int(input())
def inps():
    return input().rstrip()
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)

# import decimal
# from decimal import Decimal
# decimal.getcontext().prec = 10

# from heapq import heappush, heappop, heapify
# import math
# from math import gcd
# import itertools as it
# import collections
# from collections import deque 

# ---------------------------------------

N = inp()
S = inps()

r = []
g = []
b = []

for i in range(N):
    if S[i] == "R":
        r.append(i)
    if S[i] == "G":
        g.append(i)
    if S[i] == "B":
        b.append(i)

ans = 0
for i in r:
    for j in g:
        for k in b:
            if abs(i - j) != abs (j - k) 
                    and abs(i - j) != abs (i - k) 
                    and abs(i - k) != abs (j - k):
                ans += 1
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def inp():
    return int(input())
def inps():
    return input().rstrip()
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)

# import decimal
# from decimal import Decimal
# decimal.getcontext().prec = 10

# from heapq import heappush, heappop, heapify
# import math
# from math import gcd
# import itertools as it
# import collections
# from collections import deque 

# ---------------------------------------

N = inp()
S = inps()

r = []
g = []
b = []

for i in range(N):
    if S[i] == "R":
        r.append(i)
    if S[i] == "G":
        g.append(i)
    if S[i] == "B":
        b.append(i)

ans = 0
for i in r:
    for j in g:
        m = i
        n = j
        if m > n:
            m, n = n, m
        sa = abs(m - n)
        ans += len(b)
        if m - sa >= 0 and S[m - sa] == "B":
            ans -= 1
        if n + sa < N and S[n + sa] == "B":
            ans -= 1
        if sa % 2 == 0 and S[m + sa//2] == "B":
            ans -= 1
print(ans)
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))

ok, ng = n, 0
while ok-ng > 1:
	x = (ok+ng)//2
	d = defaultdict(int)
	last = 0
	valid = True
	if x == 1:
		for i in range(n-1):
			if a[i] >= a[i+1]:
				valid = False
				break
		if valid:
			ok = x
		else:
			ng = x
		continue

	for i in range(n-1):
		if a[i] > a[i+1]:
			if a[i+1] > last:
				d[a[i+1]] = 1
			else:
				j = a[i+1]
				while d[j] == x-1 and j > 0:
					d[j] = 0
					j -= 1
				d[j] += 1
			last = a[i+1]
			for k in d.keys():
				if k > last:
					d.pop(k)
		elif a[i] == a[i+1]:
			j = a[i+1]
			while d[j] == x-1 and j > 0:
				d[j] = 0
				j -= 1
			d[j] += 1
			last = a[i+1]

		if d[0] > 0:
			valid = False
			break

	if valid:
		ok = x
	else:
		ng = x
print(ok)

### FIXED CODE ###

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

ok, ng = n, 0
while ok-ng > 1:
	x = (ok+ng)//2
	#d = defaultdict(int)
	d = dict()
	last = 0
	valid = True
	if x == 1:
		for i in range(n-1):
			if a[i] >= a[i+1]:
				valid = False
				break
		if valid:
			ok = x
		else:
			ng = x
		continue

	for i in range(n-1):
		dels = []
		if a[i] < a[i+1]:
			last = a[i+1]
			continue

		j = a[i+1]
		for k in d.keys():
			if j < k:
				dels.append(k)

		while j > 0:
			if j in d and d[j] == x-1:
				#d[j] = 0
				dels.append(j)
				j -= 1
			else:
				break

		if j in d:
			d[j] += 1
		else:
			d[j] = 1

		for k in dels:
			del d[k]

		if 0 in d:
			valid = False
			break
		last = j

	if valid:
		ok = x
	else:
		ng = x
print(ok)
def cal1(n):
    num=(n**0.5)//1+1
    for i in range(num,n+1):
        if n//i==0:
            num=i
            break
    return num

import math

N=int(input())
num=cal1(N)
print(int((math.log(num,10)+1)//1))

### FIXED CODE ###

def cal(N):
    num=(N**0.5)//1
    num=int(num)
    for i in range(num,0,-1):
       if N%i==0:
           k=int(N/i)
           x=len(str(k))
           break
    return x

print(cal(int(input())))
import itertools

N,M = map(int,input().split())
Data = []
for _ in range(M+1):
    Data.append([0]*(M+1))
for _ in range(M):
    a,b = map(int,input().split())
    Data[a][b] = 1
    Data[b][a] = 1

ans = 0
for r in itertools.permutations(range(2,N+1)):
    Rlist = list(r)
    a = 1
    b = Rlist[0]
    if Data[a][b] == 0:
        continue
    else:
        flag = True 
        for i in range(len(Rlist)-1):
            a = Rlist[i]
            b = Rlist[i+1]
            if Data[a][b] == 0:
                flag = False
                break
        if flag:
            ans += 1

print(ans)


### FIXED CODE ###

import itertools

N,M = map(int,input().split())
Data = []
for _ in range(N+1):
    Data.append([0]*(N+1))
for _ in range(M):
    a,b = map(int,input().split())
    Data[a][b] = 1
    Data[b][a] = 1

ans = 0
for r in itertools.permutations(range(2,N+1)):
    Rlist = list(r)
    a = 1
    b = Rlist[0]
    if Data[a][b] == 0:
        continue
    else:
        flag = True 
        for i in range(len(Rlist)-1):
            a = Rlist[i]
            b = Rlist[i+1]
            if Data[a][b] == 0:
                flag = False
                break
        if flag:
            ans += 1

print(ans)
n = int(raw_input())
for i in range(1, n+1)
  if (i % 3 == 0 or i % 10 == 3):
    print " %d" % i

### FIXED CODE ###

n = int(raw_input())
print "",
for i in range(1, n+1):
  if i % 3 == 0:
    print "%d" % i,
  else:
    z = i
    while 1:
      if z % 10 == 3:
        print "%d" % i,
        break
      z /= 10
      if z == 0:
        break
X = int(input())
if X >= 30:
    print('Yes'):
else:
    print('No'):



### FIXED CODE ###

X = int(input())
if X >= 30:
    print('Yes')
else:
    print('No')
def f(y):

    if 1 <= y <=999:
        print(1000-y)
    elif 1000<= y <= 10000 :
        b = int(y / 100)
        c = int(str(b)[1])
        g = 9-c
        h = int(y/10)
        i = int(str(h)[2])

        if y %1000==0:
            print("0")
        elif y % 500==0 and x % 1000!=0:
            print("500")
        elif y % 100==0 and x % 500!=0:
            f = 10-c
            print(f*100)
        elif y % 10 ==0 and x % 100!=0:
            j =10-i
            print(g*100+j*10)
        elif y % 10!=0:
            k = int(str(y)[3])
            l = 9 - i
            m = 10-k
            print(g*100+l*10+m)


y = input()
x = f(int(y))






### FIXED CODE ###


def f(y):

    if 1 <= y <=999:
        print(1000-y)
    elif 1000<= y <= 10000 :
        b = int(y / 100)
        c = int(str(b)[1])
        g = 9-c
        h = int(y/10)
        i = int(str(h)[2])

        if y %1000==0:
            print("0")
        elif y % 500==0 and y % 1000!=0:
            print("500")
        elif y % 100==0 and y % 500!=0:
            f = 10-c
            print(f*100)
        elif y % 10 ==0 and y % 100!=0:
            j =10-i
            print(g*100+j*10)
        elif y % 10!=0:
            k = int(str(y)[3])
            l = 9 - i
            m = 10-k
            print(g*100+l*10+m)


y = input()
x = f(int(y))
n=int(input())
b=list(map(int,input().split()))
a=b[:]
condition=''
cnt=0
wa=0
for i in range(n):
  wa+=a[i]
  if i == 0:
    if a[i]>0:
      condition='minus'
    else:
      condition='plus'
  elif condition == 'plus':
    condition='minus'
    if wa<=0:
      cnt+=abs(wa)+1
      a[i]+=abs(wa)+1
      wa+=abs(wa)+1
  elif condition == 'minus':
    condition='plus'
    if wa>=0:
      cnt+=abs(wa)+1
      a[i]-=abs(wa)+1
      wa-=abs(wa)+1

cnt1=cnt
a=b[:]
condition=''
cnt=0
wa=0
for i in range(n):
  a[i]=a[i]/abs(a[i])*(-1)
  cnt+=abs(a[i])+1
  wa+=a[i]
  if i == 0:
    if a[i]>0:
      condition='minus'
    else:
      condition='plus'
  elif condition == 'plus':
    condition='minus'
    if wa<=0:
      cnt+=abs(wa)+1
      a[i]+=abs(wa)+1
      wa+=abs(wa)+1
  elif condition == 'minus':
    condition='plus'
    if wa>=0:
      cnt+=abs(wa)+1
      a[i]-=abs(wa)+1
      wa-=abs(wa)+1

cnt2=cnt
print(min(cnt1,cnt2))

### FIXED CODE ###

n=int(input())
b=list(map(int,input().split()))
a=b[:]

cnt=0
wa=0
condition='plus'
for i in range(n):
  wa+=a[i]
  if condition == 'plus':
    condition='minus'
    if wa<=0:
      cnt+=abs(wa)+1
      a[i]+=abs(wa)+1
      wa+=abs(wa)+1
  elif condition == 'minus':
    condition='plus'
    if wa>=0:
      cnt+=abs(wa)+1
      a[i]-=abs(wa)+1
      wa-=abs(wa)+1

cnt1=cnt
a=b[:]
cnt=0
wa=0
condition='minus'
for i in range(n):
  wa+=a[i]
  if condition == 'plus':
    condition='minus'
    if wa<=0:
      cnt+=abs(wa)+1
      a[i]+=abs(wa)+1
      wa+=abs(wa)+1
  elif condition == 'minus':
    condition='plus'
    if wa>=0:
      cnt+=abs(wa)+1
      a[i]-=abs(wa)+1
      wa-=abs(wa)+1

cnt2=cnt
print(min(cnt1,cnt2))
import collections
import sys

S1 = collections.deque()
S2 = collections.deque()

f = open('in47', 'r')

for i, j in enumerate(f.readline()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1][0] > left_edge):
                new_puddle += S2[-1][1]
                S2.pop()
            S2.append((left_edge, new_puddle))
        else:
            pass


print(sum(j for i, j in S2))

print(len(S2), *(j for i, j in S2))

### FIXED CODE ###

import collections
import sys

S1 = collections.deque()
S2 = collections.deque()

for i, j in enumerate(sys.stdin.readline()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1][0] > left_edge):
                new_puddle += S2[-1][1]
                S2.pop()
            S2.append((left_edge, new_puddle))
        else:
            pass


print(sum(j for i, j in S2))

print(len(S2), *(j for i, j in S2))
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],*A[N%2::2])

### FIXED CODE ###

n=int(input())
a= list(map(int,input().split()))
if n%2 ==1:
    ans = a[::-2]+a[1::2]
else:
    ans = a[::-2]+a[0::2]
print(*ans)
def main():
    N = int(input())

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

    # print(np.array(tree))

    Q = [(x, [0, x], 0) for x in tree[0]]
    reached = [1] + [0]*(N-2) + [0]
    while len(Q) > 0:
        new_pos, root, cost = Q.pop()
        reached[new_pos] = 1

        if new_pos == N-1:
            break

        #add to Q
        for p in tree[new_pos]:
            new_root = root[:]
            if reached[p] == 0:
                new_root.append(p)
                Q.append((p, new_root, cost+1))

    l = math.ceil(len(root)/2) - 1
    r = l + 1

    # print(root, l, r)
    tree[root[l]].remove(root[r])
    tree[root[r]].remove(root[l])
    # print(tree, tree)

    F = tree[0]
    S = tree[N-1]

    reached = [1] + [0]*(N-2) + [1]
    while True:
        if len(F) == 0:
            print("Snuke")
            break
        else:
            pos = F.pop()
            reached[pos] = 1
            for p in tree[pos]:
                if reached[p] == 0:
                    F.append(p)

        if len(S) == 0:
            print("Fennec")
            break
        else:
            pos = S.pop()
            reached[pos] = 1
            for p in tree[pos]:
                if reached[p] == 0:
                    S.append(p)



if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()


### FIXED CODE ###

def main():
    A, B = map(int, input().split())

    if (A%3 == 0) or (B%3 == 0) or ((A+B)%3 == 0):
        print("Possible")
    else:
        print("Impossible")

if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
if n%2 == 1:
  if a[0]!=0:
    print(0)
    exit()
  for i,j,k in zip(a[1::2],a[2::2],range(,n,2)):
    if not i==j==k:
      print(0)
      exit()
  print(2**(n//2))
  exit()
for i,j,k in zip(a[::2],a[1::2],range(,n,2)):
  if not i==j==k:
    print(0)
    exit()
print(2**(n//2))

### FIXED CODE ###

i=input
n=int(i())
print([0,pow(2,n//2,10**9+7)][sorted(i().split(),key=int)==[str((j+n%2)//2*2+1-n%2)for j in range(n)]])
import math

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

def check():
    a = []
    b = []
    count = 0
    bDict = {}
    bDict2 = {}
    removeList = []
    N, K = [int(i) for i in input().split(' ')]
    for i in range(1,N+1):
        if (2*i)%K == 0:
            a.append(i)
    count += len(a)
    
    while a != []:
        temp = a[0]
        for i in a:
            #print(i)
            if (temp+i)%K == 0:
                removeList.append(i)
                if str(temp) not in bDict2:
                    bDict2[str(temp)] = 1
                else:
                    bDict2[str(temp)] += 1  
                    
        for i in removeList:
            a.remove(i)
        removeList.clear()
       
    for i in bDict2:
        count += 3*permutations_count(bDict2[i], 2)
        if bDict2[i] > 2:
            count += permutations_count(bDict2[i], 3)

    print(count)
check()

### FIXED CODE ###

N, K = map(int, input().split())
cnt1,cnt2 = 0,0

for i in range(1,N+1):
    if i%K == 0:
        cnt1 += 1
    elif i%K == K/2:
        cnt2 += 1
print(cnt1**3+cnt2**3)
from itertools import accumulate as acc
N, x, *A = map(int, open(0).read().split())
dp = []
for i in range(N):
  dp.append(list(acc((A[(i-j)%N] for j in range(N)),min)))

ans = 10**10
for i,a in enumerate(zip(*dp)):
  ans = min(ans,i*x+sum(a))
print(ans)

### FIXED CODE ###

from itertools import accumulate as acc
N, x, *A = map(int, open(0).read().split())
dp = []
for i in range(N):
  dp.append(list(acc((A[(i-j)%N] for j in range(N)),min)))

ans = 10**60
for i,a in enumerate(zip(*dp)):
  ans = min(ans,i*x+sum(a))
print(ans)
s = input()
res = [i for i in s if i == 'C' or i == 'F']
print('Yes' if res[0] + res[1] == 'CF' or res[1] + res[2] == 'CF' else'No')


### FIXED CODE ###

s = list(input())
ans = ''
for i in s:
    if i in 'C':
        ans += i
    elif i in 'F':
        ans += i
print('Yes' if 'CF' in ans else 'No')