Harryxun/stf_run huggingface dataset:
def f(y,x,c0):
  global A
  c=A[y][x]
  if c==" " or c!=c0:
    return 0
  else:
    A[y][x]=" "
    for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
      f(y+i,x+j,c0)
    return 1

while 1:
  H,W=map(int,raw_input().split())
  if H==W==0: break
  A=[[[] for _ in range(W+2)] for _ in range(H+2)]
  for i in range(H+2):
    if i==0 or i==H+1:
      for j in range(W+2): A[i][j]=" "
    else:
      s=raw_input()
      for j in range(1,W+1): A[i][j]=s[j]
  for e in A: print e
  c=0
  for i in range(1,H+1):
    for j in range(1,W+1):
      c+=f(i,j,A[i][j])
  print c

### FIXED CODE ###

def f(y,x,a):
  M.append([y,x])
  while M:
    y,x=M.pop()
    if A[y][x]==a:
      A[y][x]=' '
      for i,j in [[0,-1],[-1,0],[0,1],[1,0]]: M.append([y+i,x+j])
  return 1

M=[]
while 1:
  H,W=map(int,raw_input().split())
  if H==W==0: break
  A=[list(' '*(W+2)) for _ in range(H+2)]
  for i in range(H): A[i+1][1:W+1]=list(raw_input())
  c=0
  for i in range(1,H+1):
    for j in range(1,W+1):
      a=A[i][j]
      if a!=' ': c+=f(i,j,a)
  print c
from math import factorial
def combi(n,r):
  res = factorial(n) / factorial(r) / factorial(n - r)
  return int(res)

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

data = {}

tmp = 0
for i in range(N):
  tmp += a[i]
  if tmp%M not in data:
    data[tmp%M] = 1
  else:
    data[tmp%M] += 1
else:
  if 0 in data:
      data[0] += 1

cnt = list(data.values())
ans = 0
for i in cnt:
  if i == 1:
    continue
  elif i == 2:
    ans += 1
  else:
    ans += combi(i,2)
print(ans)


### FIXED CODE ###

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

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

S = {0 : 1}
t = 0
for i in range(N):
  t = (t + D[i]) % M
  if t in S:
    S[t] += 1
  else:
    S[t] = 1

r = 0

for i in S.values():
  r += i * (i - 1) // 2
  
print(r)
#Make a Rectangle
N = int(input())
A = list(map(int, input().split()))
 
a = sorted(list(set(A)), reverse=True)
b = []
for ai in a:
    c = A.count(ai)
    for i in range(c//2):
        b.append(ai)
    if (len(b)>=4):
        break
 
if (len(b)<2):
    print(0)
else:
    print(b[0]*b[1])

### FIXED CODE ###

# Meal Delivery
x,a,b, = list(map(int, input().split()))

if ( abs(a-x) < abs(b-x) ):
    print("A")
else:
    print("B")
S = input()
K = int(input())

p = 0
for i in range(len(S)) :
	if (S[i] != "1") :
		print(S[i])
		p = 1
		break
	
if (p == 0) :
	print("1")

### FIXED CODE ###

read_line = [int(i) for i in input().split()]
A = read_line[0]
B = read_line[1]

print(A*B-A-B+1)
a, b, c = map(int, input())

if a**0.5 + b**0.5 < c**0.5:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

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

if c - a - b >= 0 and (c - a - b)**2 > 4 * a * b:
    print('Yes')
else:
    print('No')
from heapq import *
import sys
input = sys.stdin.buffer.readline
n, m, s = map(int, input().split())
lim = 2510
di = [[float("inf")] * lim for _ in range(n)]
di[0][s] = 0
con = [[] for _ in range(n)]
for _ in range(m):
	u, v, a, b = map(int, input().split())
	con[u - 1].append((v - 1, a, b))
	con[v - 1].append((u - 1, a, b))
q = [(0, s, 0)]
cd = [list(map(int, input().split())) for _ in range(n)]
while q:
	time, have, cur = heappop(q)
	if di[cur][have] < time:
		continue
	c, d = cd[cur]
	if have + c < lim and di[cur][have + c] > time + d:
		di[cur][have + c] = time + d
		heappush(q, (time + d, have + c, cur))
	for nxt, dh, dt in con[cur]:
		if have >= dh and di[nxt][have - dh] > time + dt:
			di[nxt][have - dh] = time + dt
			heappush(q, (time + dt, have - dh, nxt))
for p in di[1:]:
	print(min(p))


### FIXED CODE ###

from heapq import *
import sys
input = sys.stdin.buffer.readline
n, m, s = map(int, input().split())
lim = 2510
di = [[float("inf")] * lim for _ in range(n)]
di[0][min(s,lim-1)] = 0
con = [[] for _ in range(n)]
for _ in range(m):
	u, v, a, b = map(int, input().split())
	con[u - 1].append((v - 1, a, b))
	con[v - 1].append((u - 1, a, b))
q = [(0, min(s,lim-1), 0)]
cd = [list(map(int, input().split())) for _ in range(n)]
while q:
	time, have, cur = heappop(q)
	if di[cur][have] < time:
		continue
	c, d = cd[cur]
	if have + c < lim and di[cur][have + c] > time + d:
		di[cur][have + c] = time + d
		heappush(q, (time + d, have + c, cur))
	for nxt, dh, dt in con[cur]:
		if have >= dh and di[nxt][have - dh] > time + dt:
			di[nxt][have - dh] = time + dt
			heappush(q, (time + dt, have - dh, nxt))
for p in di[1:]:
	print(min(p))
s = list(input())
a = s.count('B')
b = []
for i in range(len(s)):
    if s[i] == 'B':
        b.append(i)
b.sort(reverse=True)
for i in b:
    s.pop(i)
    s.pop(i-1)
print(''.join(s))


### FIXED CODE ###

s = input()
b = ''
for i in s:
    if i == 'B':
        b = b[:-1]
    else:
        b += i
print(b)
N = input()
B = False
kaisu = 0
array = list(map(int,input().split()))

def calc(n):
  return int(n) / 2
  
  
while not B:
  for i in range(N):
    if array[i]/2 == 1:
      B = True
  if not B:
    array = map(calc, array)
    kaisu += 1
  else:
    break
        
print(kaisu)

### FIXED CODE ###

N = int(input())
B = False
kaisu = 0
array = list(map(int,input().split()))

def calc(n):
  return int(n) / 2
  
  
while not B:
  for i in range(N):
    if array[i] % 2 == 1:
      B = True
  if not B:
    array = list(map(calc, array))
    kaisu += 1
  else:
    break
        
print(kaisu)
def Sieve_of_Eratosthenes(N):
    if N<2:
        prime = [False for i in range(N+1)]
        return prime
 
    prime = [True for i in range(N+1)]
    prime[0] = False
    prime[1] = False
 
    for i in range(2, int(N**0.5)+1):
        if prime[i]:
            for j in range(i*2, N+1, i):
                prime[j] = False
 
    return prime

prime=Sieve_of_Eratosthenes(10**5)
x=int(input())
while prime[x]==False:
    x+=1
print(x)

### FIXED CODE ###

import sys
def sieve(N):
    if N<2:
        prime = [False for i in range(N+1)]
        return prime
 
    prime = [True for i in range(N+1)]
    prime[0] = False
    prime[1] = False
 
    for i in range(2, int(N**0.5)+1):
        if prime[i]:
            for j in range(i*2, N+1, i):
                prime[j] = False
 
    return prime

l=sieve(100057)
x=int(input())
while True:
    if l[x]==True:
        print(x)
        sys.exit()
    x+=1
a=input()
b=len(a)
i=0
j=0
while i <= b//2 :
	if a[i] != a[(b-i-1)]
	j +=1
else
print(j)

### FIXED CODE ###

a=input()
b=len(a)
i=0
j=0
while i <= b//2-1 :
	if a[i] != a[b-i-1]: 
		j+=1
		i+=1
	else:
		i+=1
print(j)
def main();
  num = int(input())
  print("\n",num ** 3)
  return 0

### FIXED CODE ###

# -*- coding: utf-8 -*-
def main():
  num = int(input())
  print(num ** 3)
  return

if __name__ == '__main__':
  main()
order = list(input())
X, Y = map(int, input().split())

Xs = []
Ys = []
now_lis = Xs
cnt = 0
for s in order:
    if s=='T':
        now_lis.append(cnt)
        now_lis = Ys if now_lis==Xs else Xs
        cnt = 0
    else:
        cnt += 1
now_lis.append(cnt)
lx = len(Xs)
ly = len(Ys)

def dp(length, lis, goal):
    dp = [[0]*16000 for _ in range(length+1)]
    dp[0][8000] = 1
    for i, x in enumerate(lis, 1):
        for j in range(16000):
            if dp[i-1][j]==1:
                if not j+x>=16000 or not j+x<0:
                    dp[i][j+x] = 1
                if not j-x<0 or not j-x>=16000:
                    dp[i][j-x] = 1
    return dp[-1][goal+8000]

if dp(lx, Xs, X) and dp(ly, Ys, Y):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

order = list(input())
X, Y = map(int, input().split())
 
Xs = []
Ys = []
cnt = 0
now_lis = Xs
x_dir = 1
for s in order:
    if s=='T':
        if not cnt==0:
            now_lis.append(cnt)
        now_lis = Ys if x_dir else Xs
        x_dir = not x_dir
        cnt = 0
    else:
        cnt += 1
if not cnt==0:
    now_lis.append(cnt)

if order[0]=='T':
    x_start = 0
else:
    x_start = Xs[0]
    del Xs[0]

def dp(start, lis, goal):
    nodes = set([start])
    for x in lis:
        nx = set()
        L = list(nodes)
        for l in L:
            nx.add(l+x)
            nx.add(l-x)
        nodes = nx
    return goal in nodes
 
if dp(x_start, Xs, X) and dp(0, Ys, Y):
    print('Yes')
else:
    print('No')
N = input()
A = [int(i) for i in input().split()]

import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd_list(A))

### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

N = int(input())
A = [int(i) for i in input().split()]
K = gcd(A[0], A[1])

for i in range(2, N):
    K = gcd(K, A[i])

print(K)
# coding: utf-8
# Your code here!
import sys, collections, bisect, math, itertools
from fractions import gcd 
#input = sys.stdin.readline #文字列入力のときは注意

m = int(input())
#s = input()
#a = [int(i) for i in input().split()]
a = [int(input()) for j in range(m+1)] # 縦「n」行

beki = 0
while a[-1] == 0:
    a.pop()
    beki+=1
if m != len(a)-1:
    m = len(a)
    a.append(0)


def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
allprimes = get_sieve_of_eratosthenes(10010)

primes=[]
def get_sieve_of_eratosthenes2():
    prime = []
    data = [i + 1 for i in range(1, 35000)]
    c=abs(a[m])
    while True:
        p = data[0]
        if 35000 <= p*p:
            return prime + data
        if c%p==0: primes.append(p)
        prime.append(p)
        data = [e for e in data if e % p != 0]

primes2=[]
def get_sieve_of_eratosthenes3():
    prime = []
    data = [i + 1 for i in range(1, 35000)]
    c=abs(a[0])
    while True:
        p = data[0]
        if 35000 <= p*p:
            return prime + data
        if c%p==0: primes2.append(p)
        prime.append(p)
        data = [e for e in data if e % p != 0]


get_sieve_of_eratosthenes2()
#print(primes)
if len(primes) == 0 and abs(a[m]) != 1:
    primes.append(abs(a[m]))
if len(primes2) == 0 and abs(a[0]) != 1:
    primes2.append(abs(a[0]))
n=m
if a[m]==0:
    primes = allprimes


primes = primes + primes2
#print(a)
#print(primes)
for p in primes:
    if p > 10**4+5:
        if sum([i%p for i in a]) == 0:
            print(p)
        continue
    coeff = list(reversed(a))
    while len(coeff) > p:
#        print(coeff,p)
        t=coeff.pop()
        coeff[-p+1]+=t
            
#    print(coeff)
    if sum([i%p for i in coeff]) == 0:
        print(p)
        
        
        
    












### FIXED CODE ###

# coding: utf-8
# Your code here!
import sys, collections, bisect, math, itertools
from fractions import gcd 
#input = sys.stdin.readline #文字列入力のときは注意

n = int(input())
s = input()
#a = [int(i) for i in input().split()]
#m = [[int(i) for i in input().split()] for j in range(n)] # 縦「n」行

b = [0]*(n+1)
for i in range(n):
    b[i+1] += b[i] + (1 if s[i]=="#" else 0)

w = [0]*(n+1)
for i in range(n):
    w[i+1] += w[i] + (1 if s[i]=="." else 0)
#print(b,w)
ans = n
for i in range(n):
    if i != 0:
        p = b[i-1]
    else: p=0
    q = w[n]-w[i]
#    print(p,q)
    ans = min(ans,p+q)

print(min(ans,b[n]))
s,t = map(int,input().split())
a,b = map(int,input().split())
u =map(int,input().split())

if s==u:
  print( str(a-1) +" "+ str(b) )
else:
  print( str(a) +" "+ str(b-1) ) 

### FIXED CODE ###

s,t = map(str,input().split())
a,b = map(int,input().split())
u =input()

if u==s:
  a -=1
else:
  b -=1
  
print(a,b)
def main():
    N, M = map(int, input().split())
    A = [int(x) for x in input().split()]

	for i in range(m):
    	changes.append([int(e) for e in input().split(" ")])
	changes.sort(key=lambda x:(x[1],x[0]),reverse = True)
	
    cnt = N
	for i in changes:
    	A.extend([i[1]] * min(i[0],cnt))
    	cnt -= min(i[0],cnt)
    A.sort()
    A.reverse()
    A = A[:N]
    print(sum(A))
if __name__ == "__main__":
    main()

### FIXED CODE ###

import numpy

n,m = map(int,input().split(" "))

a = numpy.array([int(e) for e in input().split(" ")],dtype=numpy.int64)
changes=[]
for i in range(m):
    changes.append([int(e) for e in input().split(" ")])


a.sort()
#昇順ソート

changes.sort(key=lambda x:(x[1],x[0]),reverse = True)

change_num = 0
for change in changes:
    for i in range(change_num, min(change[0] + change_num,n)):
        if a[i] < change[1]:
            change_num += 1
            a[i] = change[1]
        else:
            break

print(a.sum())
n = int(raw_input())
data = raw_input().split(" ")

sorted_data = sorted(data)

minimum = sorted_data[0]
maximum = sorted_data[-1]

goukei = 0
for i in data:
	goukei += i

print("{:} {:} {:}".format(minimum, maximum, goukei))

### FIXED CODE ###

n = int(raw_input())
data = map(int, raw_input().split(" "))

#data = [10, 1, 5, 4, 17]

minimum = data[0]
maximum = data[0]
goukei = 0

for i in data:
	if i < minimum:
		minimum = i

	if i > maximum:
		maximum = i

	goukei += i

print("{:} {:} {:}".format(minimum, maximum, goukei))
a = input().split()
x = []
y = []
z = []
a[0] = int(a[0])
a[1] = int(a[1])
a[2] = int(a[2])
for i in range(a[0]):
    b = input().split()
    for j in range(a[1]):
        b[j] = int(b[j])
    x.append(b)
    z.append([])
for i in range(a[1]):
    b  = input().split()
    for j in range(a[2]):
        b[j] = int(b[j])
    y.append(b)
for i in range(a[0]):
    for j in range(a[2]):
        z[i].append(0)    
for i in range(a[0]):
    for j in range(a[2]):
        for k in range(a[1]):
            z[i][j] += x[i][k]*y[k][j]
for i in range(len(z)):
    for j in range(a[0]):
        z[i][j] = str(z[i][j])
for i in z:
    gam = " ".join(i)
    print(gam)


### FIXED CODE ###

a = input().split()
x = []
y = []
z = []
a[0] = int(a[0])
a[1] = int(a[1])
a[2] = int(a[2])
for i in range(a[0]):
    b = input().split()
    x.append(b)
    z.append([])
for i in range(a[1]):
    b  = input().split()
    y.append(b)
for i in range(a[0]):
    for j in range(a[2]):
        z[i].append(0)    
for i in range(a[0]):
    for j in range(a[2]):
        for k in range(a[1]):
            z[i][j] += int(x[i][k])*int(y[k][j])
for i in range(len(z)):
    for j in range(a[2]):
        z[i][j] = str(z[i][j])
for i in z:
    gam = " ".join(i)
    print(gam)
import heapq
n,m=map(int,input().split())
q=[]
a=[-int(i) for i in input().split()]
for i in a:
    heapq.heappush(q,(i,i,0))
ans=chk=0
while 1:
    f=1
    for i in range(m):
        x=heapq.heappop(q)
        j=-x[1]
        k=-q[0][1]
        if (i==m-1) or (j//(2**(i+1+x[2]))<k):
            f=0
            heapq.heappush(q,(-(j//(2**(i+1+x[2]))),x[1],x[2]+i+1))
            m-=(i+1)
            break
    if f:
        break
for i in q:
    ans+=-i[0]
print(ans)

### FIXED CODE ###

import heapq
n,m=map(int,input().split())
q=[]
a=[-int(i) for i in input().split()]
for i in a:
    heapq.heappush(q,i)
ans=chk=0
for i in range(m):
    x=heapq.heappop(q)
    heapq.heappush(q,-(-x//2))
print(-sum(q))
exit()
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
su = sum(A)
print(counter)
lis = {}
for i in range(Q):
  B, C = map(int, input().split())
  su -= B * counter[B]
  su += C * counter[B]
  counter[C] += counter[B]
  counter[B] = 0
  print(su)

### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
su = sum(A)
counter = Counter(A)
lis = {}
for i in range(Q):
  B, C = map(int, input().split())
  su -= B * counter[B]
  su += C * counter[B]
  counter[C] += counter[B]
  counter[B] = 0
  print(su)
lines = [x.strip() for x in sys.stdin.readlines()]
def solve(lines):
    N = int(lines.pop(0))
    print(math.ceil(N/2))
solve(lines)

### FIXED CODE ###

import sys,math
N = int(input())
print(math.ceil(N/2))
import numpy as np
import sys
sys.setrecursionlimit(10000000)

N, M, P = map(int, input().split())
ABC_d = {}
for m in range(M):
    A, B, C = map(int, input().split())
    if A in ABC_d:
        ABC_d[A].append([B, C - P])
    else:
        ABC_d[A] = [[B, C - P]]


cost = np.empty(N, dtype = int) - np.inf
cost[0] = 0

def solve(pos, already):
    global cost

    if not(pos in ABC_d): return
    # print (already)

    for B, C in ABC_d[pos]:
        if already[B - 1] == True:
            if cost[pos - 1] == inf: continue
            if cost[B - 1] == np.inf:
                pass
            elif cost[B - 1] < cost[pos - 1] + C:
                cost[B - 1] = np.inf
                solve(B, already)
        else:
            if cost[B - 1] < cost[pos - 1] + C:
                cost[B - 1] = cost[pos - 1] + C
                already2 = already.copy()
                already2[B - 1] = True
                solve(B, already2)


already = np.zeros(N, dtype = bool)
already[0] = True
solve(1, already)

if (cost[-1] == np.inf):
    print (-1)
else:
    print (max(0, int(cost[-1])))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)

f_inf = sys.maxsize

N, M, P = map(int, input().split())
ABC_d = {}
for m in range(M):
    A, B, C = map(int, input().split())
    if A in ABC_d:
        ABC_d[A].append([B, C - P])
    else:
        ABC_d[A] = [[B, C - P]]

cost = [-f_inf] * N
cost[0] = 0

def solve(pos, cnt):
    global cost

    if not(pos in ABC_d): return
    if cnt > N: cost[pos-1] = f_inf;

    for B, C in ABC_d[pos]:
        if cost[B - 1] == f_inf or cost[B - 1] >= cost[pos - 1] + C:
            pass
        elif cost[pos-1] == f_inf:
            cost[B-1] = f_inf
            solve(B, cnt + 1)
        elif cost[B - 1] < cost[pos - 1] + C:
            cost[B - 1] = cost[pos - 1] + C
            solve(B, cnt + 1)

solve(1, 1)

if (cost[-1] == sys.maxsize):
    print (-1)
else:
    print (max(0, int(cost[-1])))
s=input()
a=len(s)
t=input()
b=len(t)
maxcnt=0
for i in range(a-b+1):
	count=0
	for j in range(b):
		s1=s[i+j]
		s2=t[j]
		if(s1==s2):
			count+=1
	if(maxcnt<count):
		maxcnt=count	
print(b-maxcnt)

### FIXED CODE ###

d,t,s=map(int,input().split())
if(d/s>t):
	print("No")
else:
	print("Yes")
v = []
for i in range(5):
  V.append(int(input()
               
k = int(input())
               
d = []
for i in range(1,5):
  d.append(V[i]-v[i-1])

if max(v) > k:
  print(":(")
else:
  print(("Yay!")

### FIXED CODE ###

V = []
for i in range(5):
  V.append(int(input()))
               
k = int(input())
               
d = max(V) - min(V)

if d > k:
  print(":(")
else:
  print("Yay!")
a,b = map(int,split())

if a > b:
 print('a > b')
elif a < b:
 print('a < b')
else:
 print('a == b')

### FIXED CODE ###

a, b = map(int, input().split())
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
else:
    print('a == b')
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

def search3(w,v,n):
    res = 0
    for n1 in range(n//w[0]+1):
        for n2 in range((n-w[0]*n1)//w[1]+1):
            n3 = (n-w[0]*n1-w[1]*n2)//w[2]
            res = max(res,n+(v[0]-w[0])*n1+(v[1]-w[1])*n2+(v[2]-w[2])*n3)
    return res

def search2(w,v,W):
    res = 0
    for n1 in range(n//w[0]+1):
        n2 = (n-w[0]*n1)//w[1]
        res = max(res,n+(v[0]-w[0])*n1+(v[1]-w[1]*n2))
    return res

AB = [[A[0]-B[0],A[0]],[A[1]-B[1],A[1]],[A[2]-B[2],A[2]]]
AB.sort()

if AB[0][0]>0:
    ans = search3(B,A,N)
elif AB[1][0]>0:
    n = N+(B[0]-A[0])*(N//A[0])
    ans = search2(B[1:],A[1:],n)
elif AB[2][0]>0:
    n = search2(A[:2],B[:2],N)
    n = n+(A[2]-B[2])*(n//B[2])
else:
    ans = search3(A,B,N)

print(ans)

### FIXED CODE ###

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

def search3(w,v,n):
    res = 0
    for n1 in range(n//w[0]+1):
        for n2 in range((n-w[0]*n1)//w[1]+1):
            n3 = (n-w[0]*n1-w[1]*n2)//w[2]
            res = max(res,n+(v[0]-w[0])*n1+(v[1]-w[1])*n2+(v[2]-w[2])*n3)
    return res

def search2(w,v,n):
    res = 0
    for n1 in range(n//w[0]+1):
        n2 = (n-w[0]*n1)//w[1]
        res = max(res,n+(v[0]-w[0])*n1+(v[1]-w[1])*n2)
    return res

AB = [[A[0]-B[0],A[0],B[0]],[A[1]-B[1],A[1],B[1]],[A[2]-B[2],A[2],B[2]]]
AB.sort()
A = [AB[i][1] for i in range(3)]
B = [AB[i][2] for i in range(3)]

if AB[0][0]>0:
    ans = search3(B,A,N)
elif AB[1][0]>0:
    n = N+(B[0]-A[0])*(N//A[0])
    ans = search2(B[1:],A[1:],n)
elif AB[2][0]>0:
    n = search2(A[:2],B[:2],N)
    ans = n+(A[2]-B[2])*(n//B[2])
else:
    ans = search3(A,B,N)

print(ans)
N = int(input())

x = [list(map(int, input().split())) for _ in range(N)]

y = []
for i,j in x:
    y.append([j, i])

x.sort()
y.sort(reverse = True)

mini = 10 ** 10
maxi = 0
if N % 2 == 1:
    idx = (N+1) // 2 - 1
    for i,j in x[idx:]:
        mini = min(mini,j)
    for i,j in y[idx:]:
        maxi = max(maxi, j)
    if maxi <= mini:
        ans = y[idx][0] - x[idx][0] + 1 
    else:
        ams = y[idx][0] - maxi +mini - x[idx][0] + 2 
        
else:
    idx = N // 2
    for i,j in x[idx:]:
        mini = min(mini,j)
    for i,j in y[idx:]:
        maxi = max(maxi, j)
    if maxi + y[idx-1][1] <= mini + x[idx-1][1]:
        ans = y[idx][0]+y[idx-1][0] - x[idx][0]-x[idx-1][0] + 1
    else:
        ans = y[idx][0]+y[idx-1][0] - maxi - y[idx-1][1] +mini + x[idx-1][1] - x[idx][0]-x[idx-1][0]

print(ans)

### FIXED CODE ###

N = int(input())
ab = [list(map(int, input().split())) for _ in range(N)]

ba = []
for i, j in ab:
    ba.append([j, i])

ab.sort()
ba.sort(reverse = True)

if N % 2 == 1:
    n = (N+1) // 2 - 1
    ans = ba[n][0] - ab[n][0] + 1
    
else:
    n = N // 2 - 1
    ans = (ba[n][0] + ba[n+1][0]) - (ab[n][0] + ab[n+1][0]) + 1

print(ans)
count=0
while 1:
    count+=1
    a=input()
    if a==0:
        break
    else:
        print("Case "+str(count)+": "+str(a))



### FIXED CODE ###

count=1
while True:
    a=input()
    a=int(a)
    if a==0:
        break
    print("Case {}: {}".format(count,a))
    count+=1
import math
n = math.factorial(int(input()))
#print(n)
def div(n):
  di = []
  for i in range(1,int(n**0.5)+1):
    if n % i == 0:
      di.append(i)
      if i != n//i:
        di.append(n//i)
  return di
print(len(div(n)))

### FIXED CODE ###

n = int(input())
t = [0]*n
f = 1
mod = 10**9+7
for i in range(2,n+1):
  fa = 1
  while i > 1:
    fa += 1
    while i % fa == 0:
      i = i//fa
      t[fa-2] += 1

for j in range(n):
  f = f*(t[j]+1)%mod
print(f)
import math


def seekGcd(A, n):
    ans = A[0]
    for i in range(1, n):
        ans = math.gcd(ans, A[i])
    ans_list.append(ans)


n = int(input())
A = list(map(int, input().split()))
ans_list = []

seekGcd(A, n)

for i in range(n):
    p = A.pop(0)
    seekGcd(A, n-1)
    A.append(p)

print(max(ans_list))


### FIXED CODE ###

import fractions

n = int(input())
A = list(map(int, input().split()))
n = len(A)

L = [0]
R = [0]
ans_list = []

for i in range(n-1):
    L.append(fractions.gcd(L[i], A[i]))
    R.append(fractions.gcd(R[i], A[n-1-i]))

for j in range(n):
    ans_list.append(fractions.gcd(L[j], R[-j-1]))

print(max(ans_list))
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
l = [0 for i in range(n+1)]

for i in range(1, m+1):
    for j in range(n):
        if a[j]<=i and l[i-a[j]] == 0:
            l[i] = 1
            
if l[k] ==1:
    print("First")
else:
    print("Second")

### FIXED CODE ###

import sys
input = sys.stdin.readline
 
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
 
dp = [0 for i in range(K+1)]
for i in range(K+1):
    if not dp[i]:
        for j in range(N):
            if i + A[j] < K + 1:
                dp[i+A[j]] = 1
 
if dp[K]: print("First")
else: print("Second")