Harryxun/stf_run huggingface dataset:
from collections import deque

def main():
h, w = map(int,input().split())
A = [list(input()) for _ in range(h)]
    B = []

    for i,a in enumerate(A):
        for j,b in enumerate(a):
            if b == "#":
                B.append((i,j))

    dxy = [[1,0],[-1,0],[0,1],[0,-1]]

    stack = deque(B)
    darked = len(stack)
    targetd = h*w
    count = 0

    while darked < targetd:
        nextd = deque([])

        while stack:
            x, y = stack.popleft()
            for dx,dy in dxy:
                X = x + dx
                Y = y + dy
                if not(0 <= X < h) or not(0 <= Y < w):
                    continue
                if A[X][Y]==".":
                    A[X][Y]="#"
                    nextd.append((X,Y))
        count += 1
        stack = nextd
        darked += len(stack)
    print(count)
    
main()


### FIXED CODE ###

from collections import deque

def main():
    h, w = map(int,input().split())
    A = [list(input()) for _ in range(h)]
    B = []

    for i,a in enumerate(A):
        for j,b in enumerate(a):
            if b == "#":
                B.append((i,j))

    dxy = [[1,0],[-1,0],[0,1],[0,-1]]

    stack = deque(B)
    darked = len(stack)
    targetd = h*w
    count = 0

    while darked < targetd:
        nextd = deque([])

        while stack:
            x, y = stack.popleft()
            for dx,dy in dxy:
                X = x + dx
                Y = y + dy
                if not(0 <= X < h) or not(0 <= Y < w):
                    continue
                if A[X][Y]==".":
                    A[X][Y]="#"
                    nextd.append((X,Y))
        count += 1
        stack = nextd
        darked += len(stack)
    print(count)
    
main()
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

S = input()


def solve(S):
    tmp = 0
    tmpS = ''
    for i,s in enumerate(S):
        if s == '1':
            tmpS = S[i+1:]
            tmp =  L - 1 - i
            break
    else:
        return 1

    return (2*solve(tmpS) + solve_bin(tmp))%mod

def solve_bin(b):
    return pow(3,b,mod)

print(solve(S)%mod)


### FIXED CODE ###

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9 + 7

def solve(l):
    tmp = 0
    tmpS = ''
    for i in range(l,L):
        if S[i] == '1':
            return (2*solve(i+1) + pow(3,L-1-i,mod))%mod
    else:
        return 1

S = input()
L = len(S)
print(solve(0)%mod)
#TLE
from collections import deque
s = deque(input())
q = int(input())
num = 0
for _ in range(q):
    t = input()
    if t == '1':
        if num == 0:
            num = 1
        else:
            num = 0
    else:
        t, f, c = t.split()
        c = deque(c)
        if num == 0:
            if f == '1':
                s = c + s
            else:
                s = s + c
        else:
            if f == '2':
                s = c + s
            else:
                s = s + c
s = ''.join(s)
if num == 1:
    s = s[::-1]
print(s)

### FIXED CODE ###

#TLE
from collections import deque
s = deque(input())
q = int(input())
num = 0
for _ in range(q):
    t = input()
    if t == '1':
        if num == 0:
            num = 1
        else:
            num = 0
    else:
        t, f, c = t.split()
        if num == 0:
            if f == '1':
                s.appendleft(c)
            else:
                s.append(c)
        else:
            if f == '2':
                s.appendleft(c)
            else:
                s.append(c)
s = ''.join(s)
if num == 1:
    s = s[::-1]
print(s)
n,m=list(map(int, input().split()))
lll = []
a = n
b = m
if (n * m) % 3 == 0:
    print(0)
else:
    for i in range(1, a):
        p = b * i
        
        if b % 2 == 1:
            q = (a - i) * (int(b / 2) + 1)
        elif b % 2 == 0:
            q = (a - i) * (int(b / 2))
        r = (a - i) * (int(b / 2))
        
        if a - i % 2 == 1:
            q2 = b * (int((a - i) / 2) + 1)
        elif (a- i) % 2 == 0:
            q2 = b * (int(a - i) / 2)

        r2 = b * (int(a - i) / 2)
        
        lll.append(min(max(p, q, r) - min(p, q, r), max(p, q2, r2) - min(p, q2, r2)))

    temp = b
    b = a
    a = temp
    for i in range(1, a):
        p = b * i

        if b % 2 == 1:
            q = (a - i) * (int(b / 2) + 1)
        elif b % 2 == 0:
            q = (a - i) * (int(b / 2))
        r = (a - i) * (int(b / 2))

        if a - i % 2 == 1:
            q2 = b * (int((a - i) / 2) + 1)
        elif (a - i) % 2 == 0:
            q2 = b * (int(a - i) / 2)

        r2 = b * (int(a - i) / 2)

        lll.append(min(max(p, q, r) - min(p, q, r), max(p, q2, r2) - min(p, q2, r2)))


    print(min(lll))

### FIXED CODE ###

n,m=list(map(int, input().split()))
lll = []
a = n
b = m
if (n * m) % 3 == 0:
    print(0)
else:
    for i in range(1, a):
        p = b * i

        if b % 2 == 1:
            q = (a - i) * (int(b / 2) + 1)
        elif b % 2 == 0:
            q = (a - i) * (int(b / 2))
        r = (a - i) * (int(b / 2))

        if (a - i) % 2 == 1:
            q2 = b * (int((a - i) / 2) + 1)
        elif (a - i) % 2 == 0:
            q2 = b * (int((a - i) / 2))

        r2 = b * (int((a - i) / 2))

        lll.append(min(max(p, q, r) - min(p, q, r), max(p, q2, r2) - min(p, q2, r2)))

    temp = b
    b = a
    a = temp
    for i in range(1, a):
        p = b * i

        if b % 2 == 1:
            q = (a - i) * (int(b / 2) + 1)
        elif b % 2 == 0:
            q = (a - i) * (int(b / 2))
        r = (a - i) * (int(b / 2))

        if (a - i) % 2 == 1:
            q2 = b * (int((a - i) / 2) + 1)
        elif (a - i) % 2 == 0:
            q2 = b * (int((a - i) / 2))

        r2 = b * (int((a - i) / 2))

        lll.append(min(max(p, q, r) - min(p, q, r), max(p, q2, r2) - min(p, q2, r2)))


    print(min(lll))
# -*- coding: utf-8 -*-

D = int(input())
c = list(map(int, input().split()))
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
s3 = list(map(int, input().split()))
s4 = list(map(int, input().split()))
s5 = list(map(int, input().split()))
t1 = int(input())
t2 = int(input())
t3 = int(input())
t4 = int(input())
t5 = int(input())

t = [0] * 26

ans = 0

# 1日目
# 満足度加算
ans = ans + s1[t1 - 1]
# 満足度減算
for i in range(26):
    if (t1 - 1) != i:
        t[i] = t[i] + 1
        ans = ans - (c[i] * t[i])
    elif (t1 - 1) == i:
        t[i] = 0
print(ans)

# 2日目
# 満足度加算
ans = ans + s2[t2 - 1]
# 満足度減算
for i in range(26):
    if (t2 - 1) != i:
        t[i] = t[i] + 1
        ans = ans - (c[i] * t[i])
    elif (t2 - 1) == i:
        t[i] = 0
print(ans)

# 3日目
# 満足度加算
ans = ans + s3[t3 - 1]
# 満足度減算
for i in range(26):
    if (t3 - 1) != i:
        t[i] = t[i] + 1
        ans = ans - (c[i] * t[i])
    elif (t3 - 1) == i:
        t[i] = 0
print(ans)

# 4日目
# 満足度加算
ans = ans + s4[t4 - 1]
# 満足度減算
for i in range(26):
    if (t4 - 1) != i:
        t[i] = t[i] + 1
        ans = ans - (c[i] * t[i])
    elif (t4 - 1) == i:
        t[i] = 0
print(ans)

# 5日目
# 満足度加算
ans = ans + s5[t5 - 1]
# 満足度減算
for i in range(26):
    if (t5 - 1) != i:
        t[i] = t[i] + 1
        ans = ans - (c[i] * t[i])
    elif (t5 - 1) == i:
        t[i] = 0
print(ans)

### FIXED CODE ###

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

D = int(input())
c = list(map(int, input().split()))
s = []
t = []

for i in range(D):
    s.append(list(map(int, input().split())))

for i in range(D):
    t.append(int(input()) - 1)

last = [0] * 26

ans = 0

for i in range(D):
    ans = ans + s[i][t[i]]
    for j in range(26):
        if t[i] != j:
            last[j] += 1
            ans = ans - (c[j] * last[j])
        elif t[i] == j:
            last[j] = 0
    print(ans)
a,b = map(int,input().split
 
if a <= 5 :
  print(0)
elif a <= 12 :
  print(int(b//2))
else :
  print(b)

### FIXED CODE ###

a,b = map(int,input().split())
 
if a <= 5 :
  print(0)
elif a <= 12 :
  print(int(b//2))
else :
  print(b)
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return int(input())
from collections import defaultdict
import bisect

sys.setrecursionlimit(1000000000)

n = SI()
a_list = LI()

a_list =  sorted(a_list)
minus = bisect.bisect_left(a_list, 0)
minus_list = a_list[:minus]
plus_list = a_list[minus:]
ans = 0
p_i = 0
m_i = 0
if minus == 0:
    print(sum(plus_list) - 2*plus_list[0])
    minus_list = plus_list[0:1]
    plus_list = plus_list[1:]


elif minus == n:
    print(-sum(minus_list) + 2*minus_list[-1])
    plus_list = minus_list[-2:-1]
    minus_list = minus_list[:-1]

else:
    print(sum(plus_list) - sum(minus_list))

ans = minus_list[m_i]
m_i += 1
minus = len(minus_list)
plus = len(plus_list)

while p_i != (plus-1):
    print(ans, plus_list[p_i])
    ans = ans - plus_list[minus]
    p_i += 1

print(plus_list[p_i], ans)
ans = plus_list[p_i] - ans

while m_i != minus:
    print(ans, minus_list[m_i])
    ans = ans - minus_list[m_i]
    m_i += 1
    
        

### FIXED CODE ###

import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return int(input())
from collections import defaultdict
import bisect

sys.setrecursionlimit(1000000000)

n = SI()
a_list = LI()

a_list =  sorted(a_list)
minus = bisect.bisect_left(a_list, 0)
minus_list = a_list[:minus]

plus_list = a_list[minus:]

ans = 0
p_i = 0
m_i = 0
if minus == 0:
    print(sum(plus_list) - 2*plus_list[0])
    minus_list = plus_list[0:1]
    plus_list = plus_list[1:]


elif minus == n:
    print(-sum(minus_list) + 2*minus_list[-1])
    plus_list = minus_list[-1:]
    minus_list = minus_list[:-1]

else:
    print(sum(plus_list) - sum(minus_list))

ans = minus_list[m_i]
m_i += 1
minus = len(minus_list)
plus = len(plus_list)


while p_i != (plus-1):
    print(ans, plus_list[p_i])
    ans = ans - plus_list[p_i]
    p_i += 1

print(plus_list[p_i], ans)
ans = plus_list[p_i] - ans

while m_i != minus:
    print(ans, minus_list[m_i])
    ans = ans - minus_list[m_i]
    m_i += 1
import math
L=int(input())-1
L2=int(math.log2(L+1))
LLL=2**(L2-1)
lll=LLL*2-1

amount_of_branch=0

branch_list=[]
for x in range(1,L2+1):
  branch_list.append([x,x+1,0])
  branch_list.append([x,x+1,LLL])
  LLL//=2

print(L2)

lll+=1
while True:
  ls=L-lll
  print (lll)
  if ls==0:
    branch_list.append([1,L2+1,lll])
    break
  else:
    ls2=int(math.log2(ls))
    branch_list.append([1,L2+1-ls2,lll])
    lll+=2**ls2

print (L2+1,len(branch_list))
for x,y,z in branch_list:
  print (x,y,z)


### FIXED CODE ###

import math
L=int(input())-1
  
if L==0:
  print(2,2)
  print(1,2,0)
  exit()
elif L==1:
  print(2,2)
  print(1,2,0)
  print(1,2,1)
  exit()

L2=int(math.log2(L))
LLL=2**(L2-1)
lll=LLL*2-1

branch_list=[]
for x in range(1,L2+1):
  branch_list.append([x,x+1,0])
  branch_list.append([x,x+1,LLL])
  LLL//=2


lll+=1
while True:
  ls=L-lll
  if ls<=0:
    branch_list.append([1,L2+1,lll])
    break
  else:
    ls2=int(math.log2(ls))
    branch_list.append([1,L2+1-ls2,lll])
    lll+=2**ls2

print (L2+1,len(branch_list))
for x,y,z in branch_list:
  print (x,y,z)
N, K = map(int, input().split())
A = list(map(int, input().split()))

A_neg = []
A_pos = []

for i in range(N):
  if A[i] <= 0:
    A_neg.append(-A[i])
  else:
    A_pos.append(A[i])

A_neg.sort(reverse=True)
A_pos.sort(reverse=True)

ans = 1

if K%2==1 and len(A_pos)==0:
  for i in range(1, K+1):
    ans *= ((-A_neg[-i])%1000000007)
    ans %= 1000000007
  print(ans)

else:
  if K%2==1:
    ans *= A_pos.pop(0)
    K -= 1
  buf = []
  for i in range(len(A_pos)//2):
    buf.append(A_pos[2*i]*A_pos[2*i+1])
  for i in range(len(A_neg)//2):
    buf.append(A_neg[2*i]*A_neg[2*i+1])
  buf.sort(reverse=True)
  for i in range(K//2):
    ans *= (buf[i]%1000000007)
    ans %= 1000000007
  print(ans)
  



### FIXED CODE ###

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

A_neg = []
A_pos = []

for i in range(N):
  if A[i] <= 0:
    A_neg.append(-A[i])
  else:
    A_pos.append(A[i])

A_neg.sort(reverse=True)
A_pos.sort(reverse=True)

ans = 1

if K == N:
  for i in range(N):
    ans *= (A[i]%1000000007)
    ans %= 1000000007
  print(ans)

elif K%2==1 and len(A_pos)==0:
  for i in range(1, K+1):
    ans *= ((-A_neg[-i])%1000000007)
    ans %= 1000000007
  print(ans)

else:
  if K%2==1:
    ans *= A_pos.pop(0)
    K -= 1
  buf = []
  for i in range(len(A_pos)//2):
    buf.append(A_pos[2*i]*A_pos[2*i+1])
  for i in range(len(A_neg)//2):
    buf.append(A_neg[2*i]*A_neg[2*i+1])
  buf.sort(reverse=True)
  for i in range(K//2):
    ans *= (buf[i]%1000000007)
    ans %= 1000000007
  print(ans)
small = ['a', 'b', 'c']
capital = ['A', 'B', 'C']

tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])
str = input()

str[K] = small[capital.index(str[K])]

print(str)

### FIXED CODE ###

small = ['a', 'b', 'c']
capital = ['A', 'B', 'C']
 
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])
str = list(input())
 
str[K - 1] = small[capital.index(str[K - 1])]
 
print("".join(str))
import math
def cmb(n, r):
  n_ = math.factorial(n)
  n_r_ = math.factorial(n-r) 
  r_ = math.factorial(r)
  return n_//(r_*n_r_)

i = list(map(int, input().split(" ")))
k = i[1]
n = i[0]
a = 1000000007

for i in range(1, k+1):
  if n-k+1 > 0:
  	ni =  cmb(n-k+1,i)*cmb(k-1,i-1)
  	print(int(ni%a))
  else:
    print(0)

### FIXED CODE ###

import math
def cmb(n, r):
  n_ = math.factorial(n)
  n_r_ = math.factorial(n-r) 
  r_ = math.factorial(r)
  return n_//(r_*n_r_)

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

for i in range(1, k+1):
  if n-k+1 >= i:
    ans =  cmb(n-k+1,i)*cmb(k-1,i-1)%(10**9+7)
  else:
    ans = 0
  print(ans)
print(int(input()/3))

### FIXED CODE ###

print(int(int(input())/3))
N,M=map(int,input().split())
A = list(map(int,input().split()))
import numpy as np
import math
A = np.array(A)
A = np.unique(A)
x=0
while np.all(A%2==0):
  A //= 2
  x+=1
  
if np.any(A%2==0):
  print(0)
  exit()
m = max(A)
l = np.array([0]*(m+1))
l[1]=1
for a in A:
  for i in range(3,a+1,2):
    n=0
    while a%i==0:
      a//=i
      n+=1
      
    l[i]=max(l[i],n*i)
  

k = np.cumprod(l[l>=1])[-1]*pow(2,x)
if 1 in A:
  k/=2
  
ans = math.ceil(M/k/2)
print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
A = list(map(int,input().split()))
import numpy as np
import math
import fractions
import functools
A = np.array(A)
A = np.unique(A)
B = A.copy()
x=0
while np.all(B%2==0):
  B//=2
  x+=1
if np.any(B%2==0):
  print(0)
  exit()
  
A /= 2
n = A[0]
for a in A[1::]:
  n = n*a//fractions.gcd(n,a)
ans = math.ceil(M//n/2)
print(ans)
l = sum(map(int, input().split()))
n = sum(l)%3
if n == 0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

l = list(map(int, input().split()))

if l[0] == l[1] + l[2] or l[1] == l[0] + l[2] or l[2] == l[0] + l[1]:
    print("Yes")
else:
    print("No")
import copy
H, W = list(map(int , input().split(' ')))

arr =  []
h_ar = []
for _ in range(W):
    h_ar.append(0)
dp =[]
for _ in range(H):
    dp.append(copy.deepcopy(h_ar))


for _ in range(H):
    w  =  list(map(str , input().split(' ')))
    arr.append(w)


flag= False
for h in range(H-1,-1,-1):
    if arr[h][W-1]=='#':

        dp[h][W-1]=-1
        flag =  True
    if flag:
        dp[h][W-1]=-1
    else:
        dp[h][W-1]=1
    
flag = False
for w in range(W-1,-1,-1):
    if arr[H-1][w]=='#':
        dp[H-1][w]=-1
        flag =  True
    if flag:
        dp[H-1][w]=-1
    else:
        dp[H-1][w]=1



for row in range(H-1,0,-1):
    for col in range(W-1,0,-1):
        if arr[row-1][col-1]=='#':
            dp[row-1][col-1]=-1
        elif dp[row][col-1] ==-1 or dp[row-1][col]==-1:
            dp[row-1][col-1] = max(dp[row][col-1],  dp[row-1][col])
        elif dp[row][col-1] > -1 and dp[row-1][col]>-1:
             dp[row-1][col-1] = dp[row][col-1] +  dp[row-1][col]

print(dp[0][0]%(10**9+7))



            
    


### FIXED CODE ###



H, W = map(int, input().split())
arr = ['']*H
for i in range(H):
    arr[i] = input()
 
#print(arr)
dp = [[0]*W for _ in range(H)]

# arr =[
# ['.','.'],
# ['#','.'],
# ['.','.'],
# ['.','#'],
# ['.','.']
# ]








flag= False
#print(arr)
for h in range(H-1,-1,-1):
    #print(h,W-1)

    if arr[h][W-1]=='#':
        dp[h][W-1]=0
        flag =  True
    if flag:
        dp[h][W-1]=0
    else:
        dp[h][W-1]=1
#print(dp)
    
flag = False
for w in range(W-1,-1,-1):
    #print(h,W-1)
    if arr[H-1][w]=='#':
        dp[H-1][w]=0
        flag =  True
    if flag:
        dp[H-1][w]=0
    else:
        dp[H-1][w]=1


#print(dp)

MOD = 10**9+7

dp[H-1][W-1]=0

for row in range(H-1,0,-1):
    for col in range(W-1,0,-1):
        if arr[row-1][col-1]=='#':
            dp[row-1][col-1]=0
        elif dp[row][col-1] ==0 or dp[row-1][col]==0:
            dp[row-1][col-1] = max(dp[row][col-1],  dp[row-1][col])
            dp[row-1][col-1]%=MOD

        elif dp[row][col-1] > 0 and dp[row-1][col]>0:
            dp[row-1][col-1] = dp[row][col-1] +  dp[row-1][col]
            dp[row-1][col-1]%=MOD
        elif  dp[row][col-1] == 0 and dp[row-1][col] == 0:
            dp[row-1][col-1]==0


print(dp[0][0])
import numpy as np
import math

N, X = (int(i) for i in input().split())
x = np.array([int(i) for i in input().split()])

diff = abs(x-X)
intermediate_gcd = diff[0]

for i in range(len(x)-1):
    intermediate_gcd = math.gcd(intermediate_gcd, diff[i+1])

print(intermediate_gcd)

### FIXED CODE ###

import numpy as np
from fractions import gcd

N, X = (int(i) for i in input().split())
x = np.array([int(i) for i in input().split()])

diff = abs(x-X)
intermediate_gcd = diff[0]

for i in range(len(x)-1):
    intermediate_gcd = gcd(intermediate_gcd, diff[i+1])

print(intermediate_gcd)
s = str(input())
n = len(s)
ans = 0
b = [0 for i in range(n)]
for i in range(n-1):
    if s[i] != s[i+1]:
        if b[i] == 0 and b[i+1] == 0:
            b[i] = 1
            b[i+1] = 1 
            ans += 2
            flag = True
            nowl = i
            nowr = i+1
            while flag:
                if nowl < 0 and nowr > n-1:
                    flag = False
                if b[nowl] == 1 and b[nowr] == 1:
                    nowl -= 1
                    nowr += 1
                elif b[nowl] == 1 and b[nowr] == 0:
                    nowl -= 1
                elif b[nowl] == 0 and b[nowr] == 1:
                    nowr += 1
                else:
                    if s[nowl] != s[nowr]:
                        ans += 2
                        b[nowl] += 1
                        b[nowr] += 1
                        nowl -= 1
                        nowr += 1
                    else:
                        flag = False
for i in range(1,n-1):
    if s[i] != s[i+1]:
        if b[i] == 0 and b[i+1] == 0:
            b[i] = 1
            b[i+1] = 1 
            ans += 2
            flag = True
            nowl = i-1
            nowr = i
            while flag:
                if nowl < 0 and nowr > n-1:
                    flag = False
                if b[nowl] == 1 and b[nowr] == 1:
                    nowl -= 1
                    nowr += 1
                elif b[nowl] == 1 and b[nowr] == 0:
                    nowl -= 1
                elif b[nowl] == 0 and b[nowr] == 1:
                    nowr += 1
                else:
                    if s[nowl] != s[nowr]:
                        ans += 2
                        b[nowl] += 1
                        b[nowr] += 1
                        nowl -= 1
                        nowr += 1
                    else:
                        flag = False
print(ans)
            

### FIXED CODE ###

s = str(input())
if s.count("0") > 0 and s.count("1") > 0:
    print(2*min(s.count("0"),s.count("1")))
else:
    print(0)
N,A = map(int,input().split())
print(N * N - A)

### FIXED CODE ###

N = int(input())
A = int(input())
print(N * N - A)
N, M = map(int,input().split())
list_and = list(range(1,N+1,1))
for i in range(M):
    L, R = list(map(int, input().split()))
    list_temp = list(range(L,R+1,1))
    list_and = list(set(list_and) & set(list_temp))
print(len(list_and))

### FIXED CODE ###

a,b = map(int,input().split())
if a >= 13:
    print(b)
elif a>=6 and a<=12:
    print(round(b/2))
else:
    print(0)
import itertools
import heapq
import sys
import functools
import operator
import numpy as np
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
b = np.abs(a)
b.sort(reverse = True)
b_k = b[2*k]
a_new = [a[i] for i in range(len(a)) if np.abs(a)[i] > b_k]
 
comb = itertools.combinations(a_new,k)  
l = [list(_) for _ in comb]  
A = (functools.reduce(operator.mul,l[_]) for _ in range(len(l)))
l_max = max(A)
waru = 10**9 + 7
print(l_max % waru)

### FIXED CODE ###

import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)
i = 0
x = input()
while x != 0':
  print('Case ' i ': ' x)
  i+=1
  x = input()


### FIXED CODE ###

i,x = 1,input()
while x != "0":
  print('Case '+str(i)+': '+x)
  i,x = i+1,input()
N = int(input())
a = list(map(int,input().split()))
c = [0]*(max(a)+1)
max_num = 0
for i in a:
  c[i] += 1
for x in range(max(a)+1):
  if max_num < (c[x-1]) + (c[x]) + (c[x+1]):
      max_num = (c[x-1]) + (c[x]) + (c[x+1])
print(max_num)


### FIXED CODE ###

from collections import Counter

N = int(input())
a = list(map(int,input().split()))
c = Counter(a)
max_num = 0

for x in range(max(a)+1):
      max_num = max(max_num,(c[x] + c[x+1] + c[x+2]))
print(max_num)
def code_for_B(test=None):

    n = int(input)
    list_p = list(map(int, input().split()))
    
    pre = list_p[0]
    count = 0

    for i in range(1,n-1):
        cur = list_p[i]
        nxt = list_p[i+1]
        
        if pre >= cur > nxt:
            count += 1
        elif pre < cur < nxt:
            count += 1
        
        pre, cur = cur, nxt

    print(count)

code_for_B()

### FIXED CODE ###

def code_for_B(test=None):

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

    pre = list_p[0]
    count = 0

    for i in range(1,n-1):
        cur = list_p[i]
        nxt = list_p[i+1]

        if pre >= cur > nxt:
            count += 1
        elif pre < cur < nxt:
            count += 1

        pre, cur = cur, nxt

    print(count)

code_for_B()
import math
n = int(input())
ans = 1
for _ in range(n):
    x = int(input())
    ans *=  x//math.gcd(ans,x)
print(ans)

### FIXED CODE ###

n = int(input())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a
  
ans = 1
for _ in range(n):
    x = int(input())
    ans *=  x//gcd(ans,x)
print(ans)