Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyramid. The height of the pyramid is n. The top level consists of only 1 glass, that stands on 2 glasses on the second level (counting from the top), then 3 glasses on the third level and so on.The bottom level consists of n glasses.

Vlad has seen in the movies many times how the champagne beautifully flows from top levels to bottom ones, filling all the glasses simultaneously. So he took a bottle and started to pour it in the glass located at the top of the pyramid.

Each second, Vlad pours to the top glass the amount of champagne equal to the size of exactly one glass. If the glass is already full, but there is some champagne flowing in it, then it pours over the edge of the glass and is equally distributed over two glasses standing under. If the overflowed glass is at the bottom level, then the champagne pours on the table. For the purpose of this problem we consider that champagne is distributed among pyramid glasses immediately. Vlad is interested in the number of completely full glasses if he stops pouring champagne in t seconds.

Pictures below illustrate the pyramid consisting of three levels. [Image] [Image] 


-----Input-----

The only line of the input contains two integers n and t (1 ≤ n ≤ 10, 0 ≤ t ≤ 10 000) — the height of the pyramid and the number of seconds Vlad will be pouring champagne from the bottle.


-----Output-----

Print the single integer — the number of completely full glasses after t seconds.


-----Examples-----
Input
3 5

Output
4

Input
4 8

Output
6



-----Note-----

In the first sample, the glasses full after 5 seconds are: the top glass, both glasses on the second level and the middle glass at the bottom level. Left and right glasses of the bottom level will be half-empty.

Difficulty: MEDIUM
Tags: Mathematics

Implementation

Starter code:

Solutions:
def add(x, r, c):
	pyramid[r][c] += x
	amount = pyramid[r][c]
	if amount > 1 and r + 1 < n:
		amount -= 1
		pyramid[r + 1][c] += amount / 2
		pyramid[r + 1][c + 1] += amount / 2
		pyramid[r][c] = 1
(n, t) = map(int, input().split(' '))
pyramid = []
for i in range(n):
	pyramid.append([0 for y in range(i + 1)])
for r in range(t):
	add(1, 0, 0)
	for row in range(n):
		for col in range(row + 1):
			add(0, row, col)
total = 0
for row in range(n):
	for col in range(row + 1):
		if pyramid[row][col] >= 1:
			total += 1
print(total)


(n, t) = list(map(int, input().split()))
li = [[t - 1]]
cnt = 1 if t - 1 >= 0 else 0
for i in range(2, n + 1):
	tr = li[-1][0] / 2 - 1
	if tr >= 0:
		cnt += 2
	li.append([tr])
	for j in range(1, i - 1):
		a = li[-2][j - 1]
		b = li[-2][j]
		temp = -1
		if a > 0:
			temp += a / 2
		if b > 0:
			temp += b / 2
		if temp >= 0:
			cnt += 1
		li[-1].append(temp)
	li[-1].append(tr)
print(cnt)


from decimal import Decimal
RESULT = 0

class Glass:

	def __init__(self):
		self.left = None
		self.right = None
		self.amount = Decimal(0)
		self.is_calculated = False

	def add_wine(self, amount):
		extra_amount = self.amount + amount - Decimal(1)
		if extra_amount > 0:
			self.amount = Decimal(1)
			if self.left is not None:
				self.left.add_wine(extra_amount / Decimal(2))
			if self.right is not None:
				self.right.add_wine(extra_amount / Decimal(2))
		else:
			self.amount += amount

def calculate(glass: Glass):
	if glass.is_calculated:
		return
	global RESULT
	if glass.amount == Decimal(1):
		RESULT += 1
	glass.is_calculated = True
	if glass.left is not None:
		calculate(glass.left)
	if glass.right is not None:
		calculate(glass.right)
(n, t) = map(int, input().split())
a = []
for _ in range(n):
	a.append([])
for i in range(n, 0, -1):
	for _ in range(i):
		a[i - 1].append(Glass())
	if i != n:
		for (j, g) in enumerate(a[i - 1]):
			g.left = a[i][j]
			g.right = a[i][j + 1]
a[0][0].add_wine(t)
calculate(a[0][0])
print(RESULT)


from fractions import Fraction
inp = input().split()
(N, T) = (int(inp[0]), int(inp[1]))
if T is 0:
	print(0)
	exit()
dp = []
for r in range(N + 1):
	dp.append([Fraction(0) for _ in range(N + 1)])
dp[0][0] = Fraction(T)
for r in range(N):
	for c in range(r + 1):
		if dp[r][c] >= Fraction(1):
			dp[r + 1][c + 0] += (dp[r][c] - Fraction(1)) / Fraction(2)
			dp[r + 1][c + 1] += (dp[r][c] - Fraction(1)) / Fraction(2)
cnt = 0
for r in range(N):
	for c in range(r + 1):
		if dp[r][c] >= Fraction(1):
			cnt += 1
print(cnt)


(n, t) = [int(x) for x in input().split()]
curr = [t]
fill = 0
while sum(curr) > 0 and len(curr) <= n:
	nex = [0] * (len(curr) + 1)
	for i in range(len(curr)):
		if curr[i] >= 1:
			fill += 1
			flow = curr[i] - 1
			nex[i] += flow / 2
			nex[i + 1] += flow / 2
	curr = nex
print(fill)


(n, t) = map(int, input().split())
g = [[0.0] * i for i in range(1, n + 1)]
for _ in range(t):
	g[0][0] += 1.0
	for i in range(n):
		for j in range(i + 1):
			spill = max(0, g[i][j] - 1.0)
			g[i][j] -= spill
			if i < n - 1:
				g[i + 1][j] += spill / 2
				g[i + 1][j + 1] += spill / 2
	if g[n - 1][0] == 1.0:
		break
cnt = 0
for i in range(n):
	for j in range(i + 1):
		if g[i][j] == 1.0:
			cnt += 1
print(cnt)


(n, T) = list(map(int, input().split()))
a = [[0 for _ in range(n)] for __ in range(n)]
for t in range(T):
	(i, j) = (0, 0)
	a[i][j] += 1024
	for i in range(n - 1):
		for j in range(i + 1):
			if a[i][j] > 1024:
				diff = a[i][j] - 1024
				a[i][j] = 1024
				a[i + 1][j] += diff // 2
				a[i + 1][j + 1] += diff // 2
				if diff % 2 != 0:
					raise RuntimeError('whut')
ans = 0
for i in range(n):
	for j in range(i + 1):
		if a[i][j] >= 1024:
			ans += 1
print(ans)


from collections import deque
(n, t) = list(map(int, input().split()))
num_glasses = n * (n + 1) // 2
glasses = [[0] * n for _ in range(n)]

def simulate(i, j, time):
	if i >= n or j >= n:
		return
	if time > 1 - glasses[i][j]:
		time -= 1 - glasses[i][j]
		glasses[i][j] = 1
		simulate(i + 1, j, time / 2)
		simulate(i + 1, j + 1, time / 2)
	else:
		glasses[i][j] += time
simulate(0, 0, t)
ans = 0
for g in glasses:
	ans += sum([x >= 1 for x in g])
print(ans)


from sys import *

def input():
	return stdin.readline()
(n, t) = map(int, input().split())
a = [[0 for i in range(1, j + 1)] for j in range(1, n + 2)]
a[0][0] = t
ans = 0
for i in range(n):
	for j in range(i + 1):
		now = a[i][j]
		if now >= 1:
			a[i + 1][j] += (now - 1) / 2
			a[i + 1][j + 1] += (now - 1) / 2
			ans += 1
print(ans)


(n, t) = map(int, input().split())
matrix = [[0 for x in range(10)] for y in range(10)]
fullcups = 0
for x in range(10):
	for y in range(10):
		matrix[x][y] = 0
matrix[0][0] = t
for x in range(10):
	for y in range(10):
		if matrix[x][y] == 0:
			continue
		if matrix[x][y] > 1:
			flood = matrix[x][y] - 1
			matrix[x][y] = 1
			if x == 9:
				continue
			if y != 9:
				matrix[x + 1][y + 1] = matrix[x + 1][y + 1] + flood / 2
			matrix[x + 1][y] = matrix[x + 1][y] + flood / 2
for x in range(n):
	for y in range(n):
		if matrix[x][y] >= 1:
			fullcups = fullcups + 1
print(str(fullcups))


(n, t) = map(int, input().split())
matrix = [[0] * i for i in range(1, n + 1)]
norma = 2 ** n
for time in range(t):
	matrix[0][0] += norma
	for i in range(n):
		for j in range(i + 1):
			if matrix[i][j] > norma:
				many = matrix[i][j] - norma
				if i + 1 != n:
					matrix[i + 1][j] += many // 2
					matrix[i + 1][j + 1] += many // 2
				matrix[i][j] = norma
counter = 0
for i in range(n):
	for j in range(i + 1):
		if matrix[i][j] == norma:
			counter += 1
print(counter)


inin = input().split(' ')
n = int(inin[0])
t = int(inin[1])
mat = []
for i in range(n + 2):
	mat.append([0.0] * (n + 2))
for time in range(t):
	mat[1][1] += 1.0
	for i in range(1, n + 1):
		for j in range(1, i + 1):
			if mat[i][j] > 1.0:
				over = mat[i][j] - 1.0
				mat[i + 1][j] += over / 2
				mat[i + 1][j + 1] += over / 2
				mat[i][j] = 1.0
result = 0
for i in range(1, n + 1):
	for j in range(1, i + 1):
		if mat[i][j] >= 1.0:
			result += 1
print(result)


(m, t) = map(int, input().split())
re = 0
tmp = [t]
for k in range(m):
	tmp2 = [0] * (len(tmp) + 1)
	for (i, j) in enumerate(tmp):
		if j < 1.0:
			continue
		re += 1
		tmp2[i] += (j - 1) / 2
		tmp2[i + 1] += (j - 1) / 2
	tmp = tmp2
print(re)


from collections import *
import os, sys
from io import BytesIO, IOBase

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
BUFSIZE = 8192
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
rstr = lambda : input().strip()
rstrs = lambda : [str(x) for x in input().split()]
rstr_2d = lambda n: [rstr() for _ in range(n)]
rint = lambda : int(input())
rints = lambda : [int(x) for x in input().split()]
rint_2d = lambda n: [rint() for _ in range(n)]
rints_2d = lambda n: [rints() for _ in range(n)]
ceil1 = lambda a, b: (a + b - 1) // b
(n, m) = rints()
a = [[0] * (_ + 1) for _ in range(n + 1)]
for _ in range(m):
	a[0][0] += 1024
	for i in range(n):
		for j in range(len(a[i])):
			diff = max(0, a[i][j] - 1024)
			a[i][j] -= diff
			a[i + 1][j] += diff >> 1
			a[i + 1][j + 1] += diff >> 1
print(sum([x.count(1024) for x in a[:-1]]))


(n, t) = map(int, input().split())
ot = 0
a = []
b = []
c = []
for i in range(n + 1):
	a.append([])
	b.append([])
	c.append([])
	for j in range(n + 1):
		a[i].append(0)
		b[i].append(0)
		c[i].append(0)
for ii in range(1, t + 1):
	a[0][0] += 1
	if ot >= (n * n + n) // 2:
		break
	for i in range(n):
		for j in range(i + 1):
			if a[i][j] >= 1:
				if not c[i][j]:
					ot += 1
				c[i][j] = 1
				b[i][j] = a[i][j] - 1
				a[i][j] = 1
				a[i + 1][j] += b[i][j] / 2
				b[i][j] = b[i][j] / 2 * 2
				a[i + 1][j + 1] += b[i][j] / 2
				b[i][j] = 0
print(ot)


(n, m) = map(int, input().split())
ans = []
for i in range(1, 12):
	ans.append([0] * i)
total = 1024 * m
i = 0
ans[0][0] = total
while i < n:
	for j in range(i + 1):
		if ans[i][j] > 1024:
			extra = ans[i][j] - 1024
			ans[i][j] = 1024
			ans[i + 1][j + 1] += extra // 2
			ans[i + 1][j] += extra // 2
	i += 1
a = 0
for i in range(n):
	a += ans[i].count(1024)
print(a)


arr = list(map(int, input().split(' ')))
n = arr[0]
t = arr[1]
glasses = 0
a = [[0] * (i + 1) for i in range(n + 1)]
a[0][0] = t
for j in range(n):
	for k in range(j + 1):
		if a[j][k] >= 1:
			glasses += 1
			extra = a[j][k] - 1
			a[j][k] = 1
			a[j + 1][k] += extra / 2.0
			a[j + 1][k + 1] += extra / 2.0
print(min(glasses, n * (n + 1) / 2))


a = 1 << 56
bocal = [[0] * (i + 1) for i in range(10)]
ans = [[0] * (i + 1) for i in range(10)]
x = input().split()
n = int(x[0])
t = int(x[1])
bocal[0][0] = a
ans[0][0] = 1
for z in range(2, 2000):
	bocal[0][0] += a
	for i in range(10):
		for j in range(i + 1):
			if ans[i][j] == 0 and bocal[i][j] >= a:
				ans[i][j] = z
			if bocal[i][j] > a:
				x = bocal[i][j] - a
				if i < 9:
					bocal[i + 1][j] += x // 2
					bocal[i + 1][j + 1] += x // 2
				bocal[i][j] = a
a = 0
for i in range(n):
	for j in range(i + 1):
		if ans[i][j] <= t:
			a += 1
print(a)


def cuenta_uno(va):
	resp = 0
	for f in range(n):
		resp += va[f].count(1)
	return resp
(n, t) = input().split(' ')
(n, t) = [int(n), int(t)]
va = [[0 for i in range(n + 1)] for i in range(n)]
ch = [0 for i in range(n + 1)]
max = 0
for i in range(n + 1):
	max += i
c1 = 1
while c1 <= t and cuenta_uno(va) < max:
	ch = [0 for i in range(n + 1)]
	ch[0] = 1
	i_va = 0
	while sum(ch) > 0 and i_va < n and (cuenta_uno(va) <= 55):
		for ct in range(n):
			va[i_va][ct] += ch[ct]
		ch = [0 for i in range(n + 1)]
		for ct in range(n):
			if va[i_va][ct] > 1:
				ch[ct] += (va[i_va][ct] - 1) / 2
				ch[ct + 1] += (va[i_va][ct] - 1) / 2
				va[i_va][ct] = 1
		i_va += 1
	c1 += 1
print(cuenta_uno(va))


(n, t) = [int(i) for i in input().split(' ')]
pyramid = []
for i in range(n + 1):
	temp_arr = []
	for j in range(i):
		temp_arr.append(0)
	pyramid.append(temp_arr)

def get_num_filed(num, time, level, glass, input_per_second=1):
	if time == 0:
		return
	if num == 0:
		return
	time_remaining = time
	while pyramid[level][glass] < 1 and time_remaining > 0:
		time_remaining -= 1
		pyramid[level][glass] += input_per_second
	if pyramid[level][glass] >= 1:
		get_num_filed(num - 1, time_remaining, level + 1, glass, input_per_second / 2)
		get_num_filed(num - 1, time_remaining, level + 1, glass + 1, input_per_second / 2)
	return
get_num_filed(n, t, 1, 0, 1)
total = 0
for i in pyramid:
	for j in i:
		if j >= 1:
			total += 1
print(total)


(n, t) = map(int, input().split())
A = [[0 for i in range(11)] for i in range(12)]
A[0][0] = t
index = 1
result = 0
while 1:
	temp = 0
	for i in range(index):
		if A[index - 1][i] >= 1:
			result += 1
			temp = A[index - 1][i]
			temp -= 1
			A[index][i] += temp / 2
			A[index][i + 1] += temp / 2
	if index == n:
		break
	index += 1
print(result)


s = input().split()
(n, t) = (int(s[0]), int(s[1]))
a = [0 for i in range(110)]

def balance(x, d):
	if a[x] <= 1.0 or d == n:
		return
	else:
		p = (a[x] - 1.0) / 2
		a[x] = 1
		a[x + n] += p
		a[x + 1] += p
		balance(x + n, d + 1)
		balance(x + 1, d + 1)
a[0] += t
balance(0, 1)
ans = 0
for i in range(100):
	if a[i] >= 1:
		ans += 1
print(ans)


(n, t) = map(int, input().split(' '))
glasses = [[0 for i in range(j + 1)] for j in range(n)]
for _ in range(t):
	glasses[0][0] += 1
	for i in range(n - 1):
		for j in range(i + 1):
			if glasses[i][j] > 1:
				diff = glasses[i][j] - 1
				glasses[i][j] = 1
				glasses[i + 1][j + 1] += diff / 2
				glasses[i + 1][j] += diff / 2
cnt = 0
for i in range(n):
	for j in range(i + 1):
		if glasses[i][j] >= 1:
			cnt += 1
print(cnt)


from sys import *
inp = lambda : stdin.readline()

def main():
	(n, t) = map(int, inp().split())
	a = [[0 for i in range(n + 2)] for j in range(n + 2)]
	a[0][0] = t
	ans = 0
	for i in range(n):
		for j in range(n):
			ex = a[i][j] - 1
			if ex > 0:
				a[i + 1][j] += ex / 2
				a[i + 1][j + 1] += ex / 2
				a[i][j] = 1
			if a[i][j] >= 1:
				ans += 1
	print(ans)
main()


(n, t) = map(int, input().split())
t = min(2000, t)
L = [[0.0] * n for i in range(n)]
for _ in range(t):
	L[0][0] += 1.0
	for i in range(n - 1):
		for j in range(i + 1):
			if L[i][j] > 1.0:
				x = (L[i][j] - 1.0) / 2
				L[i + 1][j] += x
				L[i + 1][j + 1] += x
				L[i][j] = 1.0
ans = 0
for i in range(n):
	for j in range(i + 1):
		if L[i][j] > 0.9999999999:
			ans += 1
print(ans)


(n, t) = map(int, input().split())
m = (n + 1) * n // 2
a = [0] * ((n + 1) * n // 2)
next = [-1] * ((n + 1) * n // 2)
now = 1
layer = 1
for i in range(m - n):
	next[i] = (now, now + 1)
	if layer * (layer + 1) // 2 == i + 1:
		layer += 1
		now = layer * (layer + 1) // 2 - 1
	now += 1
for i in range(t):
	a[0] += 1024
	for j in range(0, m):
		if a[j] > 1024:
			if next[j] == -1:
				a[j] = 1024
			else:
				a[next[j][0]] += (a[j] - 1024) // 2
				a[next[j][1]] += (a[j] - 1024) // 2
				a[j] = 1024
res = 0
for i in range(m):
	if a[i] >= 1024:
		res += 1
print(res)


(n, t) = list(map(int, input().split()))
R = [[0], [2, 2], [6, 4, 6], [14, 8, 8, 14], [30, 13, 10, 13, 30], [62, 21, 15, 15, 21, 62], [126, 36, 21, 18, 21, 36, 126], [254, 62, 30, 23, 23, 30, 62, 254], [510, 104, 45, 31, 27, 31, 45, 104, 510], [1022, 181, 68, 40, 33, 33, 40, 68, 181, 1022]]
C = [0 for _ in range(10001)]
for i in range(n):
	for j in range(i + 1):
		C[R[i][j]] += 1
for i in range(1, 10001):
	C[i] += C[i - 1]
if t:
	print(C[t - 1])
else:
	print(0)


d = {}
i = j = 1
for k in range(1, 56):
	if j == 0:
		i = j = i + 1
	d[k] = i
	j -= 1
(n, t) = map(int, input().split())
a = [0] * (n * (n + 1) // 2 + 1)
for i in range(t):
	a[1] += 1
	for j in range(1, n * (n - 1) // 2 + 1):
		k = max(0, a[j] - 1)
		a[j] = min(a[j], 1)
		a[j + d[j]] += k / 2
		a[j + d[j] + 1] += k / 2
print(len([i for i in a if i >= 1]))


(n, t) = list(map(int, input().split()))
glasses = [[0] * i for i in range(1, n + 1)]

def pour_glass(glasses, n, i, j, quantity):
	if i >= n:
		return
	if j < 0 or j > i:
		return
	cur_quantity = glasses[i][j]
	to_pour = 1 - cur_quantity
	if quantity > to_pour:
		glasses[i][j] += to_pour
		restant = quantity - to_pour
		r1 = 1.0 * restant / 2
		r2 = r1
		pour_glass(glasses, n, i + 1, j, r1)
		pour_glass(glasses, n, i + 1, j + 1, r2)
	else:
		glasses[i][j] += quantity
pour_glass(glasses, n, 0, 0, t)
res = 0
for glasses_level in glasses:
	for glass in glasses_level:
		if glass >= 1.0:
			res += 1
print(res)


read = lambda : map(int, input().split())
(n, t) = read()
a = [[0] * 20 for i in range(20)]
b = [[0] * 20 for i in range(20)]
for k in range(t):
	for i in range(n):
		for j in range(n):
			b[i][j] = 0
	b[0][0] = 1
	for s in range(n):
		for i in range(s + 1):
			j = s - i
			a[i][j] += b[i][j]
			if a[i][j] > 1:
				r = a[i][j] - 1
				a[i][j] = 1
				b[i + 1][j] += r / 2
				b[i][j + 1] += r / 2
cnt = 0
for i in range(n):
	for j in range(n):
		cnt += int(a[i][j] == 1)
print(cnt)


(n, k) = map(int, input().split())
a = [[0] * i for i in range(1, 12)]
a[0][0] = k
ans = 0
for i in range(n):
	for j in range(len(a[i])):
		if a[i][j] >= 1:
			ans += 1
			rem = a[i][j] - 1
			a[i][j] = 1
			a[i + 1][j] += rem / 2
			a[i + 1][j + 1] += rem / 2
print(ans)


def add(w, v, l, i):
	if l >= len(w):
		return
	w[l][i] += v
	if w[l][i] > 1:
		v = w[l][i] - 1
		w[l][i] = 1
	else:
		v = 0
	if v > 0:
		add(w, v / 2, l + 1, i)
		add(w, v / 2, l + 1, i + 1)
(n, t) = map(int, input().split())
w = []
for i in range(n):
	w += [[0 for j in range(i + 1)]]
add(w, t, 0, 0)
k = 0
for i in range(len(w)):
	for j in range(len(w[i])):
		if w[i][j] == 1:
			k += 1
print(k)


(N, T) = map(int, input().split())
C = []
for i in range(N + 1):
	C.append([0.0] * (i + 1))
C[0][0] = T
filled = 0
for i in range(N):
	for j in range(i + 1):
		if C[i][j] >= 1:
			filled += 1
			C[i][j] -= 1
			C[i + 1][j] += C[i][j] / 2
			C[i + 1][j + 1] += C[i][j] / 2
print(filled)


l = []
v = []
f = []
str = input()
n = int(str.split()[0])
s = int(str.split()[1])

def fill(i, j, vol):
	if i < n and v[i][j] + vol > 1:
		fill(i + 1, j, (vol - (1 - v[i][j])) / 2)
		fill(i + 1, j + 1, (vol - (1 - v[i][j])) / 2)
		v[i][j] = 1.0
	elif i < n:
		v[i][j] += vol
for i in range(n):
	l.append([])
	v.append([])
	f.append(0)
	for j in range(1 + i):
		if j == 0 or i == 0 or i == 1 or (j == i):
			l[i].append(1)
		else:
			l[i].append(l[i - 1][j - 1] + l[i - 1][j])
		v[i].append(0)
for i in range(s):
	t = -1
	for j in range(len(f)):
		if f[j] == 0:
			t = j
			break
	if t == -1:
		continue
	filled = 0
	for j in range(t + 1):
		fill(t, j, float(l[t][j]) / 2 ** t)
		if v[t][j] == 1:
			filled += 1
	if filled == t + 1:
		f[t] = 1
count = 0
for i in v:
	for j in i:
		if j == 1.0:
			count += 1
print(count)


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

def recur(i, j):
	if i >= n or j >= n:
		return
	if dp[i][j] > 1:
		if i + 1 != n:
			dp[i + 1][j] += (dp[i][j] - 1) / 2
			recur(i + 1, j)
		if i + 1 != n and j + 1 != n:
			dp[i + 1][j + 1] += (dp[i][j] - 1) / 2
			recur(i + 1, j + 1)
		dp[i][j] = 1
recur(0, 0)
ans = 0
for i in range(n):
	for j in range(n):
		if dp[i][j] == 1:
			ans += 1
print(ans)


def push(graph, pos, level):
	if graph[pos] > 1:
		over = graph[pos] - 1
		graph[pos] = 1
		if level + pos < numberofglasses:
			graph[level + pos] += over / 2
		if level + pos + 1 < numberofglasses:
			graph[level + pos + 1] += over / 2
		if level + pos < numberofglasses:
			push(graph, level + pos, level + 1)
		if level + pos + 1 < numberofglasses:
			push(graph, level + pos + 1, level + 1)
(n, t) = map(int, input().split())
table = dict()
current = 0
for i in range(1, 11):
	current += i
	table[i] = current
graph = [0] * table[n]
numberofglasses = table[n]
graph[0] = t
push(graph, 0, 1)
counter = 0
for elem in graph:
	if elem == 1:
		counter += 1
print(counter)


a = [[0] * 11 for x in range(11)]
(n, a[0][0]) = map(int, input().split())
s = 0
a[0][0] *= 2048
for lv in range(n):
	for c in range(lv + 1):
		v = a[lv][c] - 2048
		if v >= 0:
			s += 1
			a[lv + 1][c] += v / 2
			a[lv + 1][c + 1] += v / 2
print(s)


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
(n, t) = int_array()
champ = [[0 for _ in range(22)] for _ in range(n)]
m = 10
floor = 0
for _ in range(t):
	champ[0][m] += 1
	for i in range(n):
		f = 1
		for j in range(22):
			if champ[i][j] > 1:
				extra = champ[i][j] - 1
				champ[i][j] -= extra
				if i + 1 >= n:
					floor += extra
				else:
					champ[i + 1][j - 1] += extra / 2
					champ[i + 1][j + 1] += extra / 2
				f = 0
		if f:
			break
ans = 0
for i in champ:
	for j in i:
		if j >= 1:
			ans += 1
print(ans)


(n, t) = map(int, input().split())
fill = 0
k = [[0] * (i + 1) for i in range(n + 1)]
k[0][0] = t
for i in range(n):
	for j in range(i + 1):
		if k[i][j] >= 1:
			fill += 1
			k[i + 1][j] += (k[i][j] - 1) / 2
			k[i + 1][j + 1] += (k[i][j] - 1) / 2
print(fill)


(n, t) = list(map(int, input().split()))
ans = 0
z = [[0 for i in range(n + 1)] for i in range(n + 1)]
e = [[0 for i in range(n + 1)] for i in range(n + 1)]
b = [[0 for i in range(n + 1)] for i in range(n + 1)]
for it in range(t):
	z[0][0] += 1
	if ans >= n * (n + 1) // 2:
		break
	for i in range(n):
		for j in range(i + 1):
			if z[i][j] >= 1:
				if b[i][j] == 0:
					ans += 1
				b[i][j] = 1
				e[i][j] = z[i][j] - 1
				z[i][j] = 1
				z[i + 1][j] += e[i][j] / 2
				z[i + 1][j + 1] += e[i][j] / 2
				e[i][j] = 0
print(ans)


(n, t) = [int(x) for x in input().split()]
m = [[0] * (i + 1) for i in range(n + 1)]
for _ in range(t):
	m[0][0] += 1
	for i in range(n):
		for j in range(i + 1):
			if m[i][j] > 1:
				m[i + 1][j] += (m[i][j] - 1) / 2
				m[i + 1][j + 1] += (m[i][j] - 1) / 2
				m[i][j] = 1
print(sum((m[i].count(1) for i in range(n))))


(n, t) = map(int, input().split())
g = []
for i in range(n):
	g.append([0] * (i + 1))
g[0][0] = t * 2048
c = 0
for i in range(0, n - 1):
	for j in range(i + 1):
		if g[i][j] > 2048:
			g[i + 1][j] += (g[i][j] - 2048) // 2
			g[i + 1][j + 1] += (g[i][j] - 2048) // 2
			g[i][j] = 2048
		c += 1
ans = 0
for i in range(n):
	ans += sum((1 for _ in g[i] if _ >= 2048))
print(ans)


(n, t) = (int(e) for e in input().split())
a = []
for i in range(n):
	b = []
	for j in range(i + 1):
		b.append(0)
	a.append(b)
current_row = 0
for x in range(t):
	for i in range(n):
		for j in range(i + 1):
			if i == 0:
				a[i][j] += 1
			if a[i][j] > 1 and i + 1 < n and (j < 10):
				a[i + 1][j] += (a[i][j] - 1) / 2
				a[i + 1][j + 1] += (a[i][j] - 1) / 2
				a[i][j] = 1
			if a[i][j] > 1 and i == n - 1:
				a[i][j] = 1
count = 0
for i in range(n):
	for j in range(i + 1):
		if a[i][j] == 1:
			count += 1
print(count)


from sys import stdin
(N, T) = (10, 10000)
fountain = [[0 for y in range(x + 1)] for x in range(100)]

def solve():
	global N, T, fountain
	for x in range(T):
		fountain[0][0] += 1
		all_full = True
		for i in range(N - 1):
			for j in range(0, i + 1):
				glass = fountain[i][j]
				this_full = glass >= 0.9999
				all_full &= this_full
				if this_full:
					delta = (glass - 1) / 2
					fountain[i][j] = 1
					fountain[i + 1][j] += delta
					fountain[i + 1][j + 1] += delta
		for j in range(N):
			all_full &= fountain[N - 1][j] >= 0.9999
		if all_full:
			break
	cnt = 0
	for i in range(100):
		for j in range(0, i + 1):
			cnt = cnt + 1 if fountain[i][j] >= 0.9999 else cnt
	print(cnt)

def parse():
	global N, T, fountain
	line = stdin.readline().split()
	(N, T) = map(int, line)
	solve()
parse()


from collections import defaultdict, Counter
import os
import sys
from io import BytesIO, IOBase
ii = lambda : int(input())
lmii = lambda : list(map(int, input().split()))
slmii = lambda : sorted(map(int, input().split()))
li = lambda : list(input())
mii = lambda : map(int, input().split())
msi = lambda : map(str, input().split())

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

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

def main():
	(n, t) = map(int, input().split())
	l = [[0] * (i + 1) for i in range(n + 1)]
	l[0][0] = t
	ans = 0
	for i in range(n):
		for j in range(i + 1):
			if l[i][j] >= 1:
				ans += 1
				l[i + 1][j] += (l[i][j] - 1) / 2
				l[i + 1][j + 1] += (l[i][j] - 1) / 2
	print(ans)
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


full = 0
(n, t) = (int(v) for v in input().strip().split())
g = [t]
for i in range(n):
	g2 = [0] * (len(g) + 1)
	for (j, l) in enumerate(g):
		if l < 1:
			continue
		full += 1
		g2[j] += (l - 1) / 2
		g2[j + 1] += (l - 1) / 2
	g = g2
print(full)


(n, t) = map(int, input().split())
(curr, res) = ([t], 0)
while sum(curr) > 0 and len(curr) <= n:
	nxt = [0] * (len(curr) + 1)
	for i in range(len(curr)):
		if curr[i] >= 1:
			res += 1
			nxt[i] += (curr[i] - 1) / 2
			nxt[i + 1] += (curr[i] - 1) / 2
	curr = nxt
print(res)


def main():
	(n, t) = map(int, input().split())
	for r in ((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1023), (1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 511), (1, 2, 3, 4, 5, 6, 7, 8, 7, 8, 255), (1, 2, 3, 4, 5, 6, 7, 6, 7, 8, 182), (1, 2, 3, 4, 5, 6, 7, 6, 7, 6, 127), (1, 2, 3, 4, 5, 6, 5, 6, 7, 6, 105), (1, 2, 3, 4, 5, 6, 5, 6, 5, 6, 69), (1, 2, 3, 4, 5, 6, 5, 6, 5, 4, 63), (1, 2, 3, 4, 5, 4, 5, 4, 5, 4, 46), (1, 2, 3, 4, 5, 4, 5, 4, 3, 4, 41), (1, 2, 3, 4, 5, 4, 5, 4, 3, 2, 37), (1, 2, 3, 4, 5, 4, 3, 4, 3, 2, 34), (1, 2, 3, 4, 5, 4, 3, 4, 3, 0, 32), (1, 2, 3, 4, 5, 4, 3, 4, 1, 0, 31), (1, 2, 3, 4, 3, 4, 3, 2, 1, 0, 28), (1, 2, 3, 4, 3, 4, 3, 2, 0, 0, 24), (1, 2, 3, 4, 3, 4, 3, 0, 0, 0, 22), (1, 2, 3, 4, 3, 2, 1, 0, 0, 0, 19), (1, 2, 3, 4, 3, 2, 0, 0, 0, 0, 16), (1, 2, 3, 4, 3, 0, 0, 0, 0, 0, 15), (1, 2, 3, 2, 3, 0, 0, 0, 0, 0, 14), (1, 2, 3, 2, 1, 0, 0, 0, 0, 0, 11), (1, 2, 3, 2, 0, 0, 0, 0, 0, 0, 9), (1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 7), (1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 5), (1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 3), (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)):
		if r[-1] <= t:
			print(sum(r[:n]))
			break
main()


import random, math
from copy import deepcopy as dc
glass = [[0 for i in range(10)] for j in range(10)]

def solution(n, t, i, j):
	if t == 0 or i >= n or j >= n:
		return
	glass[i][j] += min(t, 1)
	t -= min(t, 1)
	if glass[i][j] > 1:
		t += glass[i][j] - 1
		glass[i][j] = 1
	if t > 0:
		solution(n, t / 2, i + 1, j)
		solution(n, t / 2, i + 1, j + 1)

def input_test():
	(n, t) = map(int, input().strip().split(' '))
	solution(n, t, 0, 0)
	c = 0
	for i in range(n):
		for j in range(i + 1):
			if glass[i][j] >= 1:
				c += 1
	print(c)
input_test()


(n, t) = map(int, input().split())
(ans, b) = (0, 1 << n)
a = [[0] * 11 for i in range(11)]
a[0][0] = t * (1 << n)
for i in range(n):
	for j in range(i + 1):
		if a[i][j] >= b:
			a[i + 1][j] += (a[i][j] - b) // 2
			a[i + 1][j + 1] += (a[i][j] - b) // 2
			ans += 1
print(ans)


(n, t) = map(int, input().split())
bo = [[0.0] * (n + 1) for i in range(n + 1)]
while t > 0:
	bo[0][0] += 1
	for i in range(n):
		for j in range(0, i + 1):
			if bo[i][j] > 1.0:
				temp = (bo[i][j] - 1) / 2
				bo[i][j] = 1.0
				bo[i + 1][j] += temp
				bo[i + 1][j + 1] += temp
	t -= 1
num = 0
for i in range(n):
	for j in range(0, i + 1):
		if bo[i][j] >= 1.0:
			num += 1
print(num)


from sys import stdin
import math
(level, second) = map(int, stdin.readline().split())
counter = 0
curr = [second]
for i in range(0, level):
	wine = [0] * (len(curr) + 1)
	for j in range(len(curr)):
		if curr[j] >= 1:
			counter += 1
			flow = curr[j] - 1
			wine[j] += flow / 2
			wine[j + 1] += flow / 2
			second -= 1
		j += 1
	curr = wine
print(counter)


(n, t) = map(int, input().split())
g = [0] * n
for i in range(n):
	g[i] = [0] * (i + 1)
for i in range(t):
	g[0][0] += 1
	for j in range(n):
		for k in range(j + 1):
			if g[j][k] > 1 and j < n - 1:
				u = g[j][k] - 1
				g[j][k] = 1
				g[j + 1][k] += u / 2
				g[j + 1][k + 1] += u / 2
			if j == n - 1 and g[j][k] > 1:
				g[j][k] = 1
ans = 0
for i in range(n):
	for j in range(i + 1):
		if g[i][j] == 1:
			ans += 1
print(ans)


(n, t) = list(map(int, input().split()))
a = []
for i in range(10):
	row = []
	for j in range(10):
		row.append(0)
	a.append(row)

def pour(level, loc, amount, a, n):
	if loc >= n or level >= n:
		return
	if a[level][loc] >= 1:
		a[0][9] -= 1
	a[level][loc] += amount
	if a[level][loc] >= 1:
		a[0][9] += 1
	if a[level][loc] > 1:
		amount = a[level][loc] - 1
		a[level][loc] = 1
		amount = amount / 2
		pour(level + 1, loc, amount, a, n)
		pour(level + 1, loc + 1, amount, a, n)
pour(0, 0, t, a, n)
print(a[0][9])


(n, t) = map(int, input().split())
a = [[0] * (n + 1) for _ in range(n + 1)]
a[0][0] = t
for i in range(n):
	for j in range(i + 1):
		q = (a[i][j] - 1) / 2
		if q > 0:
			a[i + 1][j] += q
			a[i + 1][j + 1] += q
count = sum([sum([p >= 1 for p in e]) for e in a[:n]])
print(count)


import os
import sys
from io import BytesIO, IOBase
mod = 10 ** 9 + 7

def main():
	dp = [[0 for _ in range(25)] for _ in range(15)]
	(n, t) = map(int, input().split())
	dp[0][13] = t
	ans = 0
	for i in range(n):
		for j in range(25):
			if dp[i][j] >= 1:
				dp[i][j] -= 1
				ans += 1
				dp[i + 1][j - 1] += dp[i][j] / 2
				dp[i + 1][j + 1] += dp[i][j] / 2
	print(ans)

def nouse0():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse1():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse2():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def nouse3():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse4():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse5():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
main()


(n, t) = map(int, input().split())
l = [[0] * (i + 1) for i in range(n + 1)]
l[0][0] = t
ans = 0
for i in range(n):
	for j in range(i + 1):
		if l[i][j] >= 1:
			ans += 1
			l[i + 1][j] += (l[i][j] - 1) / 2
			l[i + 1][j + 1] += (l[i][j] - 1) / 2
print(ans)


def a(level, col, lt):
	if cnt[0] == s or level >= n:
		return
	if filled[level][col] < 1.0:
		if lt + filled[level][col] >= 1.0:
			lt -= 1.0 - filled[level][col]
			filled[level][col] = 1.0
			cnt[0] += 1
		else:
			filled[level][col] += lt
			lt = 0.0
	if filled[level][col] == 1.0:
		a(level + 1, col, lt / 2)
		a(level + 1, col + 1, lt / 2)
(n, t) = [int(x) for x in input().split()]
s = 0
cnt = [0]
filled = []
for r in range(n):
	filled.append([0.0 for c in range(r + 1)])
	s += r + 1
a(0, 0, float(t))
print(cnt[0])


(n, t) = map(int, input().split())
a = [0] * (n * (n + 1) // 2)
a[0] = t
for l in range(1, n):
	for j in range(1, l + 1):
		num = l * (l - 1) // 2 + j
		if a[num - 1] >= 1:
			a[num + l - 1] += (a[num - 1] - 1) / 2
			a[num + l] += (a[num - 1] - 1) / 2
			a[num - 1] = 1
k = 0
for i in a:
	if i >= 1:
		k += 1
print(k)


(n, t) = map(int, input().split(' '))
dp = [[0 for col in range(12)] for row in range(12)]
sum = 0
dp[1][1] = t
for i in range(2, n + 1):
	for j in range(1, i + 1):
		if dp[i - 1][j] > 1:
			dp[i][j] += (dp[i - 1][j] - 1) / 2
		if dp[i - 1][j - 1] > 1:
			dp[i][j] += (dp[i - 1][j - 1] - 1) / 2
		if dp[i][j] >= 1:
			sum = sum + 1
if t > 0:
	sum += 1
print(sum)


from fractions import Fraction
(n, t) = map(int, input().split())
(a, v) = ([[0] * (i + 1) for i in range(n + 1)], 0)
a[0][0] = t
for (i, ai) in enumerate(a):
	if i == n:
		print(v)
		break
	for (j, aij) in enumerate(ai):
		if aij >= 1:
			v += 1
			a[i + 1][j] += Fraction(aij - 1, 2)
			a[i + 1][j + 1] += Fraction(aij - 1, 2)


class CodeforcesTask676BSolution:

	def __init__(self):
		self.result = ''
		self.n_t = []

	def read_input(self):
		self.n_t = [int(x) for x in input().split(' ')]

	def process_task(self):
		glasses = [[0.0] * (x + 1) for x in range(self.n_t[0])]
		for s in range(self.n_t[1]):
			glasses[0][0] += 1.0
			for x in range(self.n_t[0] - 1):
				for y in range(x + 1):
					if glasses[x][y] > 1.0:
						to_pour = glasses[x][y] - 1.0
						glasses[x + 1][y] += to_pour / 2
						glasses[x + 1][y + 1] += to_pour / 2
						glasses[x][y] = 1.0
		full = 0
		for g in glasses:
			for glass in g:
				if glass >= 1.0:
					full += 1
		self.result = str(full)

	def get_result(self):
		return self.result
Solution = CodeforcesTask676BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(n, t) = [int(x) for x in input().split()]
py = [[0] * (n + 5) for x in range(n + 5)]
cnt = 0
py[1][1] = t
for i in range(1, n + 1):
	for j in range(1, i + 1):
		if py[i][j] >= 1:
			x = py[i][j] - 1
			py[i][j] = 1
			py[i + 1][j] += x / 2
			py[i + 1][j + 1] += x / 2
			cnt += 1
print(cnt)


def __starting_point():
	(n, t) = map(int, input().split())
	A = [[0] * 11 for _ in range(11)]
	ans = 0
	A[0][0] = t
	for i in range(n):
		for j in range(i + 1):
			if A[i][j] >= 1:
				A[i + 1][j] += (A[i][j] - 1) / 2
				A[i + 1][j + 1] += (A[i][j] - 1) / 2
				A[i][j] = 1
				ans += 1
	print(ans)
__starting_point()


from fractions import Fraction
(n, t) = map(int, input().split())
tri = []
for row in range(n):
	arr = [0] * (row + 1)
	tri.append(arr)
tri[0][0] = 2048 * t
ans = 0
for (i, row) in enumerate(tri):
	for (j, cell) in enumerate(row):
		if cell >= 2048:
			ans += 1
			excess = cell - 2048
			if i + 1 < n:
				tri[i + 1][j] += excess // 2
				tri[i + 1][j + 1] += excess // 2
			row[j] = 2048
print(ans)


class Node:

	def __init__(self):
		self.coordinates = []
		self.capacity = 0
		self.left = None
		self.right = None

	def insert_left(self):
		self.left = Node()

	def insert_right(self):
		self.right = Node()
(N, K) = map(int, input().split())
arr = [[Node() for i in range(j)] for j in range(1, N + 1)]
val = [[0 for i in range(j)] for j in range(1, N + 1)]
for i in range(N - 1):
	for j in range(0, i + 1):
		arr[i][j].coordinates = [i, j]
		arr[i][j].left = arr[i + 1][j]
		arr[i][j].right = arr[i + 1][j + 1]
for i in range(N - 1, N):
	for j in range(0, i + 1):
		arr[i][j].coordinates = [i, j]

def fill(arr, x, y, time, amount=1):
	global val
	if arr[x][y].capacity < 1:
		arr[x][y].capacity += amount
		val[x][y] += amount
		time -= amount
		if time == 0:
			return
	else:
		if time == 0:
			return
		if arr[x][y].left != None:
			(x1, y1) = arr[x][y].left.coordinates
			fill(arr, x1, y1, time, amount / 2)
		if arr[x][y].right != None:
			(x1, y1) = arr[x][y].right.coordinates
			fill(arr, x1, y1, time, amount / 2)
		return
for i in range(K):
	fill(arr, 0, 0, 1)
cnt = 0
for i in val:
	for j in i:
		if j == 1:
			cnt += 1
print(cnt)


(n, m) = map(int, input().split())
L = [[0] * 11 for i in range(11)]
L[0][0] = m
for i in range(n):
	for j in range(i + 1):
		L[i + 1][j] += max(0, (L[i][j] - 1) / 2)
		L[i + 1][j + 1] += max(0, (L[i][j] - 1) / 2)
k = 0
for i in range(n):
	for x in L[i]:
		if x >= 1:
			k += 1
print(k)


(n, t) = map(int, input().split())
total = sum(range(1, n + 1))
l = [[0] * i for i in range(1, n + 1)]
max_d = sum(range(1, n + 1))
d = 0

def f(l, lvl, i, inc):
	if lvl >= len(l) or i >= len(l[lvl]):
		return
	if l[lvl][i] < 1:
		tmp = l[lvl][i] + inc
		if tmp > 1:
			inc = tmp - 1
			l[lvl][i] = 1
		else:
			l[lvl][i] += inc
			inc = 0
	if inc == 0:
		return
	inc /= 2
	lvl += 1
	f(l, lvl, i, inc)
	f(l, lvl, i + 1, inc)

def count(l):
	ans = 0
	for i in range(len(l)):
		for j in range(len(l[i])):
			if l[i][j] >= 1:
				ans += 1
	return ans
f(l, 0, 0, t)
print(count(l))


a = input().split(' ')
n = int(a[0])
t = int(a[1])
if t >= 2 ** n - 1:
	print(n * (n + 1) // 2)
else:
	a = [[0 for i in range(j + 1)] for j in range(n)]
	for i in range(t):
		a[0][0] += 1
		for row in range(n):
			for j in range(len(a[row])):
				if a[row][j] > 1:
					if row < n - 1:
						a[row + 1][j] += (a[row][j] - 1) / 2
						a[row + 1][j + 1] += (a[row][j] - 1) / 2
					a[row][j] = 1
	c = 0
	for i in range(n):
		for j in range(len(a[i])):
			if a[i][j] >= 1:
				c += 1
	print(int(c))


(n, t) = map(int, input().split())
m = [[0 for _ in range(11)] for _ in range(11)]
m[1][1] = t
for i in range(1, n):
	for j in range(1, n + 1):
		if m[i][j] > 1:
			m[i + 1][j] += (m[i][j] - 1) / 2
			m[i + 1][j + 1] += (m[i][j] - 1) / 2
print(sum([sum(map(lambda x: x >= 1, m[i])) for i in range(11)]))


(n, t) = map(int, input().split())
an = [[0 for i in range(j + 1)] for j in range(n)]

def dfs(i, j, v):
	if an[i][j] + v > 1:
		vv = v - (1 - an[i][j])
		an[i][j] = 1
		if i == n - 1:
			return
		dfs(i + 1, j, vv / 2)
		dfs(i + 1, j + 1, vv / 2)
		return
	d = 1 if j == 0 or j == i else 2
	an[i][j] += v
for i in range(t):
	dfs(0, 0, 1)
ans = 0
for i in range(n):
	for j in range(i + 1):
		ans += an[i][j] >= 1
print(ans)


(n, t) = list(map(int, input().split()))
a = []
for i in range(n):
	a.append([0] * (n + 1))
a[0][1] = t
ans = 0
for i in range(1, n):
	for j in range(1, n + 1):
		a[i][j] = max(0, (a[i - 1][j] - 1) / 2) + max(0, (a[i - 1][j - 1] - 1) / 2)
		if a[i][j] >= 1:
			ans += 1
if t < 1:
	print(0)
else:
	print(ans + 1)


import sys, math
res = [0]
(n, m) = map(int, input().split())
z = []
need = 0
for i in range(1, n + 1):
	need += i
for i in range(1, n + 1):
	z.append([0] * i)
for i in range(1, m + 1):
	z[0][0] += 2
	for i in range(n - 1):
		for j in range(i + 1):
			if z[i][j] >= 2:
				h = z[i][j] - 2
				z[i + 1][j] += h / 2
				z[i + 1][j + 1] += h / 2
				z[i][j] = 2
	for j in range(n):
		if z[-1][j] >= 2:
			z[-1][j] = 2
s = 0
for i in range(n):
	s += z[i].count(2)
print(s)


(n, t) = map(int, input().split())
a = [[None]] + [[0] * i for i in range(1, n + 1)]
c = 2 ** (n + 1)
for _ in range(t):
	a[1][0] += c
	for i in range(1, n + 1):
		for j in range(i):
			if a[i][j] > c:
				diff = a[i][j] - c
				a[i][j] = c
				if i < n:
					a[i + 1][j] += diff // 2
					a[i + 1][j + 1] += diff // 2
full = 0
for i in range(1, n + 1):
	for j in range(i):
		full += a[i][j] == c
print(full)


import sys
import math
import collections
from pprint import pprint
mod = 1000000007

def vector(size, val=0):
	vec = [val for i in range(size)]
	return vec

def matrix(rowNum, colNum, val=0):
	mat = []
	for i in range(rowNum):
		collumn = [val for j in range(colNum)]
		mat.append(collumn)
	return mat
(n, t) = map(int, input().split())
dp = matrix(11, 11)
dp[0][0] = t
cnt = 0
for i in range(n):
	for j in range(i + 1):
		if dp[i][j] >= 1.0:
			dp[i + 1][j] += (dp[i][j] - 1) / 2
			dp[i + 1][j + 1] += (dp[i][j] - 1) / 2
			cnt += 1
print(cnt)


(n, t) = input().split()
n = int(n)
t = int(t)
lis = []
for i in range(n):
	l = [0] * (i + 1)
	lis.append(l)
lis[0][0] = t
c = 0
for i in range(n):
	for j in range(i + 1):
		if lis[i][j] >= 1:
			r = lis[i][j] - 1
			lis[i][j] = 1
			c += 1
			if i != n - 1:
				lis[i + 1][j] += r / 2
				lis[i + 1][j + 1] += r / 2
print(c)


(n, t) = list(map(int, input().split()))
m = [[0] * 11 for i in range(11)]
eps = 1e-06
for l in range(t):
	m[0][0] += 1.0
	for i in range(n):
		for j in range(i + 1):
			if m[i][j] - eps > 1.0:
				should_end = False
				delta = m[i][j] - 1.0
				m[i][j] = 1.0
				m[i + 1][j] += delta / 2.0
				m[i + 1][j + 1] += delta / 2.0
answ = 0
for i in range(n):
	for j in range(n):
		if abs(m[i][j] - 1.0) <= eps:
			answ += 1
print(answ)


from copy import deepcopy

def main():
	(n, k) = list(map(int, input().split()))
	arr = [[1], [0.5, 0.5], [0.25, 0.5, 0.25], [0.125, 0.375, 0.375, 0.125], [0.0625, 0.25, 0.375, 0.25, 0.0625], [0.03125, 0.15625, 0.3125, 0.3125, 0.15625, 0.03125], [0.015625, 0.09375, 0.234375, 0.3125, 0.234375, 0.09375, 0.015625], [0.0078125, 0.0546875, 0.1640625, 0.2734375, 0.2734375, 0.1640625, 0.0546875, 0.0078125], [0.00390625, 0.03125, 0.109375, 0.21875, 0.2734375, 0.21875, 0.109375, 0.03125, 0.00390625], [0.001953125, 0.017578125, 0.0703125, 0.1640625, 0.24609375, 0.24609375, 0.1640625, 0.0703125, 0.017578125, 0.001953125]]
	opyramid = [[1], [0, 0], [0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
	finish_times = [[1], [0, 0], [0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
	opyramid[0][0] = 1
	countarr = [0, 1]
	for x in range(2, 10001):
		opyramid[0][0] += 1
		for y in range(1, len(opyramid)):
			opyramid[y][0] += max(opyramid[y - 1][0] - 1, 0) * 0.5
			opyramid[y - 1][0] -= max(opyramid[y - 1][0] - 1, 0) * 0.5
			for z in range(1, y):
				opyramid[y][z] += max(opyramid[y - 1][z - 1] - 1, 0) + max(opyramid[y - 1][z] - 1, 0) * 0.5
				opyramid[y - 1][z - 1] -= max(opyramid[y - 1][z - 1] - 1, 0)
				opyramid[y - 1][z] -= max(opyramid[y - 1][z] - 1, 0) * 0.5
			opyramid[y][y] += max(opyramid[y - 1][y - 1] - 1, 0)
			opyramid[y - 1][y - 1] -= max(opyramid[y - 1][y - 1] - 1, 0)
		count = 0
		for x in range(n):
			for y in opyramid[x]:
				if y >= 1:
					count += 1
		countarr.append(count)
	print(countarr[k])
main()


from collections import defaultdict
import heapq
(n, t) = map(int, input().split())
l = []
for i in range(1, 11):
	nl = [0 for _ in range(i)]
	l.append(nl)
for i in range(t):
	l[0][0] += 1
	for j in range(9):
		for k in range(j + 1):
			if l[j][k] > 1:
				rem = l[j][k] - 1
				l[j][k] = 1
				l[j + 1][k] += rem / 2
				l[j + 1][k + 1] += rem / 2
ans = 0
for i in range(n):
	cur = l[i]
	for v in cur:
		if v >= 1:
			ans += 1
print(ans)