{"approach":"Built the supplied base plus the spread-1 fivefold front tick-2 ask and queue retention, spread-2 flow-scaled one-cent stock, spread-3 $20 low-ask queue threshold, and spread-4 censored-flow ask/stock sizing. Each trading change is isolated by the first-step public competitor spread. Preserved source arithmetic order and the spread-2 optimized handler. Replaced only spread 2 with the complete Demand-with-floors source policy; retained the swap because its paired spread-2 mean gain exceeded the original flow-stock change. The floor candidate delegates spread 2 to its source policy, including its probability grid and probe handling; all other spreads delegate to the stack. The two policies share identical original P constants. Removed only the floor table rows discarded by its existing quadrature subset; retained literals, row order and all floating-point operations. No tuning, seed access, simulator introspection by the strategy, external dependencies, or Paradigm submission. Simulator commit b244530ee2a6247b5f930830eeca9dd950da0e7e; Python standard library, default 2000-step configurations, unsandboxed. Scorer calibration is the parent on seeds 1000-1599; all subsequent base comparisons use artifact 41fa8829432f502a00c5302c0e2200b475c5c2e100a2a16b086aaab0ce62a395. Exactness compares every SimulationResult field, including regime, inventory, fills, settlement and failure data, on the first seeds of each sampled spread from 60000. Final exact.spread2 compares against the original Demand-with-floors artifact; spreads 1, 3 and 4 compare against their named source artifacts. All paired statistics are run-by-run candidate minus base, with sample standard deviation divided by sqrt(n) for standard error; arb is signed edge. Batch means preserve ascending seed order and the simulator sum/length convention. Timing uses the first holdout seeds for both files in one process, one warmup each on seed 69999, alternating order; engine construction and run are timed, configuration sampling and module loading excluded.","blocked":null,"python_version":"3.12.3","base_mean_edge":108.63974289615767,"exact":{"spread1":{"runs":300,"identical":true},"spread2":{"runs":300,"identical":true},"spread3":{"runs":300,"identical":true},"spread4":{"runs":300,"identical":true}},"spread2_gain":{"runs":1987,"mean":0.6365839910112733,"standard_error":0.15359022930502778,"retail":0.25626440974328124,"arb":0.3803195812700554},"base_unseen":{"mean_edge":92.95847243878374,"retail_edge":117.45997392621285,"arb_edge":-24.50150148744755},"holdout":{"mean_edge":93.9731934166282,"retail_edge":118.00860484256181,"arb_edge":-24.0354114259515,"simulations":2000,"seed_start":70000,"failures":0},"diff":{"mean":1.0147209778444495,"standard_error":0.41549948352459654,"retail":0.5486309163489501,"arb":0.46609006149605},"seconds":{"base":143.52286202501273,"yours":141.41617071192013},"code":"\"\"\"Crossing-cover base with isolated, untuned spread overrides.\"\"\"\nimport math\nfrom orderbook_pm_challenge.strategy import BaseStrategy\nfrom orderbook_pm_challenge.types import CancelOrder, PlaceOrder, Side\n\nP = dict(lam_r=0.25, m=5.0, sig_n=1.2, lam_j=0.0019, sig_j=0.35, sig=0.02,\n         qmax=3000.0, rmin=2, kA=0.7, kL=0.15, pL=0.05,\n         ammo=1.0, ydem=0.4, W=200.0, fy=0.6, ammo_q=60.0, ammo_pmax=0.05, ammo_maxpay=0.02,\n         fb=0.9, fu=0.7, xu=0.1, sticky=1.0, min_ahead=2.0, keep_hi=1.5, keep_lo=0.7, Hu=300.0, bins=8.0, filt=1.0, uni=0.01, jumpinfo=1.0, dmin=0.0, kLb=0.08, kLf=0.08, pinf=1.0, pre=0.0, H1=100.0,\n         ydf=0.6, Wf=2000.0, g_hi=0.15, g_lo=0.15, qf=400.0, pmaxf=0.05, pre_gap=1.0,\n         ydf1=0.6, g1=5.0, f1=0.6, a1=100.0, nb1=0.0, gs=1.0, p1t=1.0, m1=1.0, zd=1.0, pfl=0.0005)\nSQ2 = math.sqrt(2.0)\nSQ2PI = math.sqrt(2.0 * math.pi)\ndef cdf(x): return 0.5 * (1.0 + math.erf(x / SQ2))\ndef pdf(x): return math.exp(-0.5 * x * x) / SQ2PI\ndef inv(p):\n    p = min(max(p, 1e-9), 1 - 1e-9)\n    t = math.sqrt(-2.0 * math.log(min(p, 1 - p)))\n    x = t - (2.515517 + 0.802853 * t + 0.010328 * t * t) / (1 + 1.432788 * t + 0.189269 * t * t + 0.001308 * t ** 3)\n    x = -x if p < 0.5 else x\n    for _ in range(2):\n        d = pdf(x)\n        if d < 1e-12:\n            break\n        x -= (cdf(x) - p) / d\n    return x\ndef lpm(k):\n    return pdf(k) + k * cdf(k)\ndef fl(q):\n    return math.floor(q * 100 + 1e-9) / 100\n\nNODES = [(-2.2, .06), (-1.3, .17), (-0.6, .27), (0.6, .27), (1.3, .17), (2.2, .06)]\nPROBE = 0.01\n\n\nclass _StackStrategy(BaseStrategy):\n    def __init__(self):\n        self.n = 0\n        self.ahead = set()     # main orders placed strictly ahead of any competitor order at their tick\n        self.res = {}          # order id -> uncovered quantity at placement\n        self.bc = None         # belief: sub-tick grid centres (ticks)\n        self.bw = None         # belief: weights\n        self.st = 0.5          # last one-step sd in ticks\n        self.pcb = self.pca = None\n        self.pb = set()\n        self.pa = set()\n        self.tb = 0\n        self.s = None          # competitor spread parameter\n        self.flow_notional = 0.0\n        self.flow_exposure = 0\n        self.last_ask_tick = None\n        self.last_quote_exposed = False\n        self.last_flow_ca = None\n        self.last_flow_cap = 0.0\n        self.last_flow_correction = 1.0\n        self.params = P.copy()\n\n    def _oid(self, tag):\n        self.n += 1\n        return tag + str(self.n)\n\n    def on_step(self, state):\n        H = max(1, state.steps_remaining)\n        cb = state.competitor_best_bid_ticks or 0\n        ca = state.competitor_best_ask_ticks or 100\n        if self.s is None:\n            self.s = max(1, (ca - cb + 1) // 2)\n            if self.s == 4:\n                # Censored compound-Poisson flow likelihood, using only our fills.\n                self.f4_exposure = [0, 0]\n                self.f4_events = [0, 0]\n                self.f4_weights = [[0.0] * 9, [0.0] * 9]\n                self.f4_means = [2.64 + i * (6.336 - 2.64) / 8 for i in range(9)]\n                # Positive aggregate flow is approximately lognormal; +0.065\n                # accounts for the occasional second arrival in a timestep.\n                self.f4_mu = [math.log(m) - 0.72 + 0.065 for m in self.f4_means]\n                self.f4_last = [None, None]\n                self.f4_rate = 0.1265\n                self.f4_mean = 4.488\n                self.f4_flow = self.f4_rate * self.f4_mean\n                self.f4_extreme = inv(1 - 1e-6)\n            if self.s == 1:\n                self.params.update({'dmin': 0.3, 'pfl': 1e-06})\n            if self.s == 3:\n                self.params.update({'flow_prior': 200, 'flow_level': 0.6, 'flow_strength': 1.0, 'flow_safety': 2.0, 'flow_exposure_min': 5.0})\n        P = self.params\n        if self.s == 4:\n            for side, filled, bound in ((0, state.sell_filled_quantity, ca), (1, state.buy_filled_quantity, cb)):\n                last = self.f4_last[side]\n                if last is None:\n                    continue\n                tick, conv, cap, old_bound, ids = last\n                if (side == 0 and bound > old_bound + 1) or (side == 1 and bound < old_bound - 1):\n                    continue\n                # Track only the main quote, excluding probes and stock orders.\n                remaining = sum(o.remaining_quantity for o in state.own_orders if o.order_id in ids)\n                value = max(0.0, cap - remaining * conv)\n                self.f4_exposure[side] += 1\n                if value > 0.01:\n                    self.f4_events[side] += 1\n                    censored = remaining < 0.011\n                    logv = math.log(max(value, 0.01))\n                    weights = self.f4_weights[side]\n                    for i, mu4 in enumerate(self.f4_mu):\n                        z4 = (logv - mu4) / 1.2\n                        weights[i] += math.log(max(1e-12, 1.0 - cdf(z4))) if censored else -0.5 * z4 * z4\n            if state.step % 25 == 0:\n                exposure = sum(self.f4_exposure)\n                events = sum(self.f4_events)\n                event_probability = (events + 80.0 * (1.0 - math.exp(-0.1265))) / (exposure + 80.0)\n                self.f4_rate = max(0.077, min(0.176, -math.log(max(1e-6, 1.0 - event_probability))))\n                weights = [a + b for a, b in zip(*self.f4_weights)]\n                peak = max(weights)\n                weights = [math.exp(w - peak) for w in weights]\n                self.f4_mean = sum(m * w for m, w in zip(self.f4_means, weights)) / sum(weights)\n                self.f4_flow = self.f4_rate * self.f4_mean\n        if self.s == 3 and self.last_quote_exposed and ca <= self.last_flow_ca + 1:\n            self.flow_exposure += 1\n            self.flow_notional += min(self.last_flow_cap, state.sell_filled_quantity * self.last_ask_tick / 100.0) * self.last_flow_correction\n        lo, hi = cb, ca\n        for o in state.own_orders:\n            if o.side is Side.BUY:\n                lo = max(lo, o.price_ticks)\n            else:\n                hi = min(hi, o.price_ticks)\n        if P['pinf'] > 0:\n            sb = {o.price_ticks for o in state.own_orders if o.side is Side.BUY and o.remaining_quantity <= PROBE + 1e-9}\n            sa = {o.price_ticks for o in state.own_orders if o.side is Side.SELL and o.remaining_quantity <= PROBE + 1e-9}\n            ea = self.pa - sa\n            eb = self.pb - sb\n            if sa and ea:\n                lo = max(lo, min(max(ea), hi))\n            if eb and (sb or min(eb) <= P['p1t']):\n                hi = min(hi, max(min(eb), lo))\n        if P['jumpinfo'] > 0 and self.pcb is not None:\n            if ca > self.pca + 1:\n                lo = max(lo, ca - 1)\n            if cb < self.pcb - 1:\n                hi = min(hi, cb + 1)\n        self.pcb, self.pca = cb, ca\n        if lo > hi:\n            lo, hi = hi, lo\n        # sub-tick belief over p_(t-1): predict with one-step noise, truncate to [lo, hi]\n        wid = max(hi - lo, 1e-6)\n        nb = max(2, min(48, int(round(wid * P['bins']))))\n        cs = [lo + (i + 0.5) * wid / nb for i in range(nb)]\n        if self.bc is None or P['filt'] <= 0:\n            ws = [1.0 / nb] * nb\n        else:\n            sg = max(self.st, 0.6 * wid / nb)\n            k = -0.5 / (sg * sg)\n            ws = []\n            uni = P['uni'] * sg\n            if self.s == 4:\n                exp = math.exp\n                if self.bc == cs and 1.0 <= wid <= 6.0 and nb == 8 * wid:\n                    # On this stationary grid, spacing is exactly 1/8 tick.\n                    # Equal index distances therefore have bit-identical d*d*k.\n                    # Reuse exp values while retaining the original sum order.\n                    kernel = []\n                    c0 = cs[0]\n                    for ci in self.bc:\n                        d = c0 - ci\n                        d2 = d * d * k\n                        kernel.append(exp(d2) if d2 > -12.5 else 0.0)\n                    kernel = kernel[:0:-1] + kernel\n                    for i in range(nb):\n                        t = uni\n                        start = nb - 1 - i\n                        for wi, e in zip(self.bw, kernel[start:start + nb]):\n                            if e:\n                                t += wi * e\n                        ws.append(t)\n                else:\n                    previous = tuple(zip(self.bc, self.bw))\n                    for c in cs:\n                        t = uni\n                        for ci, wi in previous:\n                            d = c - ci\n                            d2 = d * d * k\n                            if d2 > -12.5:\n                                t += wi * exp(d2)\n                        ws.append(t)\n            else:\n                previous = tuple(zip(self.bc, self.bw))\n                exp = math.exp\n                for c in cs:\n                    t = uni\n                    for ci, wi in previous:\n                        d = c - ci\n                        d2 = d * d * k\n                        if d2 > -12.5:\n                            t += wi * exp(d2)\n                    ws.append(t)\n            tot = sum(ws)\n            ws = [w / tot for w in ws]\n        self.bc, self.bw = cs, ws\n        mean_t = sum(c * w for c, w in zip(cs, ws))\n        var_t = max(sum(c * c * w for c, w in zip(cs, ws)) - mean_t * mean_t, 0.0)\n        phat = min(max(mean_t / 100.0, 0.002), 0.998)\n        var = P['sig'] ** 2 + P['lam_j'] * P['sig_j'] ** 2\n        sd = math.sqrt(H * var)\n        self.tb = self.tb + 1 if hi <= 1 else 0\n        if self.tb > 0 and P['zd'] > 0:\n            # below the last tick there is no probe: the score keeps walking away from it\n            phat = min(phat, max(P['pfl'], cdf(inv(0.01) - P['zd'] * 0.02 * math.sqrt(self.tb) / sd)))\n        z = inv(phat)\n        Z = z * sd\n        sp = pdf(z) / sd * P['sig']\n        self.st = sp * 100.0\n        s = math.sqrt(sp * sp + var_t / 1e4 + 1e-8)\n        sd1 = math.sqrt(max(1.0, H - 1.0) * var)\n        jp = [(cdf((Z + n * P['sig_j']) / sd1), w) for n, w in NODES]\n        lj = P['lam_j']\n\n        def AB(x):\n            k = (x - phat) / s\n            a = s * lpm(k)\n            b = a - (x - phat)\n            if self.s == 4:\n                ja = jb = 0.0\n                for p, w in jp:\n                    if x > p:\n                        ja += w * (x - p)\n                    else:\n                        jb += w * (p - x)\n            else:\n                ja = sum(w * max(0.0, x - p) for p, w in jp)\n                jb = sum(w * max(0.0, p - x) for p, w in jp)\n            return (1 - lj) * a + lj * ja, (1 - lj) * b + lj * jb\n\n        if H == 1:\n            def AB(x):\n                return (1 - phat) * x, phat * (1 - x)\n        rho = P['lam_r'] * 0.5\n        mu = math.log(P['m']) - 0.5 * P['sig_n'] ** 2\n        kA = P['kL'] if phat < P['pL'] else P['kA']\n\n        def qsize(loss, gain, px):\n            loss *= kA\n            if gain <= 0:\n                return 0.0\n            tail = loss / (rho * gain)\n            if tail >= 1.0:\n                return 0.0\n            if self.s == 4 and tail <= 1e-6:\n                return min(P['qmax'], math.exp(mu + P['sig_n'] * self.f4_extreme) / px)\n            return min(P['qmax'], math.exp(mu + P['sig_n'] * inv(1 - max(tail, 1e-6))) / px)\n\n        ptk = phat * 100\n        def qbid(t):\n            if not 1 <= t <= 99:\n                return 0.0\n            if self.s == 4 and phat * 100 - t < P['dmin']:\n                return 0.0\n            a, b = AB(t / 100.0)\n            if phat * 100 - t < P['dmin']:\n                return 0.0\n            if P['nb1'] > 0 and self.s == 1 and t == 1 and ptk < 1.0:\n                return 0.0\n            if phat < P['pL']:\n                ytg = P['ydem'] * min(H, P['W']) / max(ca - 1, ptk + 1) * 100.0\n                a *= (P['kLb'] if state.yes_inventory < ytg else P['kLf']) / P['kL']\n            return qsize(a, b, max(phat, 0.05))\n\n        def qask(t):\n            if not 1 <= t <= 99:\n                return 0.0\n            if self.s == 4 and t - phat * 100 < P['dmin']:\n                return 0.0\n            a, b = AB(t / 100.0)\n            if t - phat * 100 < P['dmin']:\n                return 0.0\n            if self.s == 4:\n                tail = b * kA / max(self.f4_rate * a, 1e-30)\n                if a <= 0 or tail >= 1.0:\n                    return 0.0\n                return min(P['qmax'], math.exp(math.log(self.f4_mean) - 0.72 + 1.2 * (self.f4_extreme if tail <= 1e-6 else inv(1 - tail))) / (t / 100.0))\n            return qsize(b, a, t / 100.0)\n\n        bids = [o for o in state.own_orders if o.side is Side.BUY and o.remaining_quantity > PROBE + 1e-9]\n        asks = [o for o in state.own_orders if o.side is Side.SELL and o.remaining_quantity > PROBE + 1e-9]\n        sticky = P['sticky'] > 0\n        def top(orders, comp, step):\n            threshold = max(P['min_ahead'], 20 * 100.0 / comp) if self.s == 3 and step == -1 and 1 <= comp <= 5 else P['min_ahead']\n            if sticky and sum(o.remaining_quantity for o in orders if o.price_ticks == comp and o.order_id in self.ahead) >= threshold:\n                return comp\n            return comp + step\n        bid_t = top(bids, cb, 1)\n        ask_t = top(asks, ca, -1)\n        qb = qbid(bid_t)\n        qa = qask(ask_t)\n        if self.s == 1 and ask_t == 2 and ask_t < ca and phat < 0.01:\n            qa *= 5\n\n        Y = state.yes_inventory\n        if ask_t == 1 and H > P['H1'] and P['pre'] > 0:\n            qa = qa if Y >= P['a1'] > 0 else 0.0          # let the competitor's 2-tick ask erode instead of fronting it for nothing\n        # ammunition: hold YES so that low asks are covered\n        ptick = phat * 100\n        amt = 0\n        qam = 0.0\n        if P['ammo'] > 0 and ask_t >= 2 and phat < max(P['ammo_pmax'], P['pmaxf']):\n            wealth = state.cash + Y * phat\n            x = max(ask_t, ptick + 1) / 100.0\n            capw = P['fy'] * wealth / max(phat, 0.005)\n            flow_scale = self.f4_flow / 0.6 if self.s == 4 else 1.0\n            target = min(flow_scale * P['ydem'] * min(H, P['W']) / x, capw)\n            full = min(flow_scale * P['ydf'] * min(H, P['Wf']) / x, capw) if phat < P['pmaxf'] else 0.0\n            t = max(1, min(99, int(math.ceil(ptick + 1e-9))))\n            g = t - ptick\n            if Y < full and g <= P['g_hi'] and bid_t <= t < ask_t:\n                amt, qam = t, min(P['qf'], full - Y)     # a tick p has just crossed: nearly free\n            elif Y < target and phat < P['ammo_pmax'] and bid_t <= t < ask_t and t / 100.0 - phat < P['ammo_maxpay']:\n                amt, qam = t, min(P['ammo_q'], target - Y)\n            elif Y < full and t >= 2 and 1.0 - g <= P['g_lo']:\n                amt, qam = t - 1, min(P['qf'], full - Y)  # rest just under p: filled only on the crossing, or by retail\n\n        if P['pre'] > 0 and ca == 2 and phat < 0.01 and H > P['H1'] and Y < P['pre'] and not qam and 1.0 - ptick < P['pre_gap']:\n            amt, qam = 1, min(P['ammo_q'], P['pre'] - Y)\n        q1 = 0.0\n        if P['ydf1'] > 0 and P['m1'] < ptick < P['g1'] + 1.0 and amt != 1:\n            stock_rate = P['ydf1']\n            if self.s == 4:\n                stock_rate *= self.f4_flow / 0.6\n            if self.s == 3:\n                flow = (self.flow_notional + P['flow_prior'] * P['flow_level']) / (P['flow_prior'] + self.flow_exposure)\n                scale = max(0.5, min(2.0, flow / P['flow_level']))\n                stock_rate *= 1.0 + P['flow_strength'] * (scale - 1.0)\n            q1 = max(0.0, stock_rate * min(H, P['Wf']) / (self.s / 100.0) - Y)\n\n        # Bridge expected retail demand until another tick crossing is available.\n        if 0.02 < phat < 0.1:\n            ct = max(2, min(99, int(math.floor(ptick))))\n            wealth = state.cash + Y * phat\n            goal = min(1 * qa, 0.3 * max(wealth, 0.0) / phat)\n            if Y < goal and ct < ask_t:\n                amt, qam = ct, min(3000.0, goal - Y)\n        # order management\n        actions = []\n        free = state.free_cash - 2.0\n        keep_ask = 0.0\n        new_b = []\n        new_a = []\n        def cancel(o):\n            nonlocal free\n            actions.append(CancelOrder(o.order_id))\n            x = o.price_ticks / 100.0\n            if o.side is Side.BUY:\n                free += x * o.remaining_quantity\n            else:\n                free += (1 - x) * min(self.res.get(o.order_id, 0.0), o.remaining_quantity)\n            self.ahead.discard(o.order_id)\n            self.res.pop(o.order_id, None)\n        for o in state.own_orders:\n            if o.remaining_quantity <= PROBE + 1e-9:\n                cancel(o)\n        kept_ids = set()\n        def manage(orders, t, q, comp):\n            kept = 0.0\n            for o in orders:\n                if o.price_ticks == t and q > 0 and (kept + o.remaining_quantity <= max(q * P['keep_hi'], 1.0) or (self.s == 1 and (o.side is Side.SELL) and o.price_ticks <= 2 and o.order_id in self.ahead)):\n                    kept += o.remaining_quantity\n                    kept_ids.add(o.order_id)\n                else:\n                    cancel(o)\n            return kept\n        kb = manage(bids, bid_t, qb, cb)\n        ka = manage(asks, ask_t, qa, ca)\n        add_b = (qb - kb) if (kb < qb * P['keep_lo'] and bid_t != cb) else 0.0\n        add_a = (qa - ka) if (ka < qa * P['keep_lo'] and ask_t != ca) else 0.0\n\n        budget = P['fb'] * max(free, 0.0)\n        cost = add_b * bid_t / 100.0 + qam * amt / 100.0\n        if cost > budget:\n            f = budget / cost\n            add_b *= f\n            qam *= f\n            cost = budget\n        out = []\n        q1 = min(q1, P['f1'] * max(budget - cost, 0.0) * 100.0)\n        if q1 >= 0.01:\n            out.append(PlaceOrder(side=Side.BUY, price_ticks=1, quantity=fl(q1)))\n            free -= fl(q1) / 100.0 + 1e-6\n        if amt and qam >= 0.01:\n            q = fl(qam)\n            out.append(PlaceOrder(side=Side.BUY, price_ticks=amt, quantity=q))\n            free -= q * amt / 100.0 + 1e-6\n        if bid_t >= 1 and add_b >= 0.01:\n            q = fl(add_b)\n            oid = self._oid('b')\n            out.append(PlaceOrder(side=Side.BUY, price_ticks=bid_t, quantity=q, client_order_id=oid))\n            free -= q * bid_t / 100.0 + 1e-6\n            if bid_t > cb:\n                self.ahead.add(oid)\n        if ask_t <= 99 and add_a >= 0.01:\n            x = ask_t / 100.0\n            covk = sum(o.remaining_quantity - min(self.res.get(o.order_id, 0.0), o.remaining_quantity)\n                       for o in asks if o.order_id in kept_ids)\n            cov = max(0.0, Y - covk - 0.1)\n            unc = max(0.0, add_a - cov)\n            if unc > 0:\n                ub = max(0.0, free - (1 - P['fu']) * max(state.cash, 0.0)) if x >= P['xu'] else 0.0\n                if H < P['Hu'] and phat < 0.05:\n                    ub = max(0.0, free * (1 - H / P['Hu']))\n                unc = min(unc, ub / (1 - x))\n            q = fl(min(add_a, cov + unc))\n            if q >= 0.01:\n                oid = self._oid('a')\n                out.append(PlaceOrder(side=Side.SELL, price_ticks=ask_t, quantity=q, client_order_id=oid))\n                r = max(0.0, q - cov)\n                self.res[oid] = r\n                free -= r * (1 - x) + 1e-6\n                if ask_t < ca:\n                    self.ahead.add(oid)\n\n        # probes: tiny orders that the arbitrageur removes when p crosses them\n        f = int(math.floor(ptick + 1e-9))\n        r = max(int(P['rmin']), int(math.ceil(2.0 * s * 100)))\n        self.pb = set()\n        self.pa = set()\n        if free > 1.0:\n            for t in range(f, f + r + 1):\n                if cb < t < ca and 1 <= t <= 99:\n                    out.append(PlaceOrder(side=Side.BUY, price_ticks=t, quantity=PROBE))\n                    self.pb.add(t)\n            for t in range(f + 1 - r, f + 2):\n                if cb < t < ca and 1 <= t <= 99:\n                    out.append(PlaceOrder(side=Side.SELL, price_ticks=t, quantity=PROBE))\n                    self.pa.add(t)\n        if self.s == 3:\n            self.last_ask_tick = ask_t\n            self.last_flow_ca = ca\n            exposed_qty = ka + sum(o.quantity for o in out if o.side is Side.SELL and o.price_ticks == ask_t and o.quantity > PROBE)\n            self.last_flow_cap = exposed_qty * ask_t / 100.0\n            self.last_quote_exposed = ask_t / 100.0 > phat + max(0.005, P['flow_safety'] * self.st / 100.0) and self.last_flow_cap >= P['flow_exposure_min']\n            if self.last_quote_exposed:\n                logcap = math.log(self.last_flow_cap)\n                mu_flow = math.log(P['m']) - 0.5 * P['sig_n'] ** 2\n                clipped = P['m'] * cdf((logcap - mu_flow - P['sig_n'] ** 2) / P['sig_n']) + self.last_flow_cap * (1.0 - cdf((logcap - mu_flow) / P['sig_n']))\n                self.last_flow_correction = min(3.0, P['m'] / max(clipped, 0.01))\n        if self.s == 4:\n            self.f4_last = [None, None]\n            # Eligibility is decided before observing fills, so depleted quotes\n            # remain in the sample as right-censored observations.\n            for side, tick, bound, conv, distance in (\n                (0, ask_t, ca, ask_t / 100.0, ask_t / 100.0 - phat),\n                (1, bid_t, cb, max(phat, 0.05), phat - bid_t / 100.0)):\n                if distance < max(0.01, 3.0 * self.st / 100.0):\n                    continue\n                if side == 0:\n                    if not (ask_t < ca or any(o.price_ticks == ask_t and o.order_id in self.ahead for o in asks)):\n                        continue\n                    orders = asks\n                    order_side = Side.SELL\n                else:\n                    if not (bid_t > cb or any(o.price_ticks == bid_t and o.order_id in self.ahead for o in bids)):\n                        continue\n                    if (qam > 0 and amt >= bid_t) or (q1 > 0 and bid_t <= 1):\n                        continue\n                    orders = bids\n                    order_side = Side.BUY\n                tracked = {o.order_id: o.remaining_quantity for o in orders if o.order_id in kept_ids and o.price_ticks == tick}\n                tracked.update({o.client_order_id: o.quantity for o in out if o.side is order_side and o.price_ticks == tick and o.client_order_id is not None})\n                cap = sum(tracked.values()) * conv\n                if cap >= 0.5:\n                    self.f4_last[side] = (tick, conv, cap, bound, tracked)\n        return actions + out\n\nfrom operator import mul, add\nDEMAND_RATE = [0.0825, 0.0935, 0.1045, 0.11549999999999999, 0.1265, 0.1375, 0.1485, 0.15949999999999998, 0.17049999999999998]\nDEMAND_MEAN = [2.8453333333333335, 3.2560000000000002, 3.666666666666667, 4.077333333333334, 4.488, 4.898666666666667, 5.309333333333333, 5.720000000000001, 6.1306666666666665]\nDEMAND_BINS = [0.05, 0.1, 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, 12.8, 25.6, 51.2, 102.4, 204.8]\nDEMAND_CDF = [[0.92105888795, 0.92196113275, 0.924969202738, 0.932357807565, 0.945624667991, 0.963044967501, 0.979774193119, 0.991444400227, 0.997284251979, 0.999362623017, 0.999889869489, 0.999986021068, 0.999998701659], [0.920945012846, 0.921485151702, 0.92348952474, 0.929003887314, 0.940110233753, 0.956459487114, 0.974070049074, 0.987897259483, 0.99572208432, 0.998877738246, 0.999783052142, 0.999969162137, 0.99999678734], [0.920892286499, 0.921241004804, 0.922650360076, 0.926888826178, 0.936242509662, 0.951327643403, 0.969126878904, 0.984465721977, 0.99402899512, 0.998289236206, 0.999638392601, 0.999943764683, 0.999993582937], [0.920863935648, 0.92110328027, 0.92213405742, 0.925471903383, 0.933417637455, 0.947244128395, 0.964840878478, 0.981214974808, 0.992270479813, 0.997618465854, 0.999457877851, 0.999909164149, 0.999988822676], [0.920847052834, 0.921018315954, 0.921797428174, 0.924478933961, 0.931288674603, 0.943935630405, 0.961108570736, 0.978166924312, 0.990489488325, 0.996883539619, 0.999244217885, 0.999865030849, 0.999982288256], [0.901081414622, 0.902199415354, 0.905927255918, 0.915088709511, 0.931567794602, 0.953296025539, 0.974308790694, 0.989088636586, 0.996531994403, 0.999187169072, 0.999859883387, 0.999982249395, 0.999998353287], [0.900940310933, 0.901609606607, 0.904093419216, 0.910928987821, 0.924712608966, 0.945067029715, 0.967124082228, 0.984583618901, 0.994537732949, 0.998567789553, 0.999723743198, 0.999960817458, 0.999995923888], [0.900874977369, 0.901307078282, 0.903053492688, 0.908306707177, 0.91990946569, 0.938667676578, 0.960915389766, 0.980236353468, 0.992378854321, 0.997815862377, 0.999539213179, 0.999928506641, 0.99999185547], [0.900839847669, 0.901136421686, 0.902413697149, 0.90655033071, 0.916403602673, 0.933582786883, 0.955543835134, 0.976127304679, 0.990139528354, 0.996958894844, 0.999308798077, 0.999884457729, 0.999985809043], [0.900818928088, 0.901031141439, 0.901996560421, 0.905319617381, 0.913762493352, 0.929467130002, 0.950874222813, 0.972281989775, 0.987874680808, 0.996020255134, 0.999035951481, 0.999828238979, 0.999977505591], [0.881537242096, 0.882861192393, 0.887276272726, 0.898132479461, 0.917694267994, 0.943594082249, 0.968815802614, 0.986702194611, 0.995767830544, 0.999009365295, 0.999829633201, 0.999978459043, 0.999998004007], [0.881370148485, 0.882162727389, 0.885104241895, 0.893202019128, 0.909550098159, 0.933767460298, 0.960168098636, 0.981234934238, 0.993335029571, 0.99825327492, 0.99966381097, 0.999952421149, 0.99999505758], [0.881292781279, 0.881804471972, 0.883872640944, 0.890094976505, 0.903849686343, 0.926141368064, 0.952716032491, 0.975972321873, 0.990704529173, 0.99733516677, 0.999438855515, 0.999913136864, 0.99999012111], [0.881251181151, 0.881602381081, 0.883114953749, 0.888014317635, 0.899691515761, 0.92009025422, 0.946282688752, 0.971009119894, 0.987979660618, 0.996288912423, 0.999157784814, 0.999859544788, 0.99998278139], [0.88122640847, 0.881477709026, 0.882620965169, 0.886556544958, 0.896560277004, 0.915197473935, 0.940699549414, 0.966373481837, 0.985227516633, 0.995143321396, 0.998824806026, 0.999791105011, 0.999972697614], [0.8624169724, 0.863937390277, 0.869008249778, 0.881483618668, 0.904002372588, 0.93394034102, 0.963296586465, 0.984285390699, 0.994991714626, 0.998829190931, 0.999799116882, 0.999974649922, 0.999997653816], [0.862225086521, 0.863135269465, 0.866513465537, 0.875816372004, 0.8946195484, 0.922561196377, 0.953203688763, 0.977851867426, 0.992113976556, 0.997934158218, 0.999603250104, 0.999943972908, 0.999994188406], [0.862136240257, 0.86272385346, 0.865098978201, 0.872246301028, 0.888058890995, 0.913748248102, 0.944530367456, 0.971674618492, 0.989006122225, 0.996847102076, 0.99933730908, 0.999897654595, 0.999988379831], [0.86208846791, 0.862491776464, 0.86422881567, 0.869856037386, 0.883276218061, 0.906765194853, 0.937058785332, 0.965861679699, 0.985791118956, 0.995608469492, 0.999004820794, 0.999834423777, 0.999979739653], [0.862060019713, 0.862348606131, 0.863661510057, 0.868181540363, 0.879676178266, 0.901124529261, 0.930585565403, 0.960442850252, 0.982548402175, 0.99425270008, 0.998610756596, 0.999753626198, 0.999967864194], [0.843711411394, 0.845419129782, 0.851115346983, 0.86513672082, 0.89049038859, 0.924335953846, 0.957752479339, 0.981838545053, 0.99420360231, 0.99864662518, 0.999768332365, 0.999970821942, 0.999997302711], [0.843495891092, 0.844518187601, 0.848312741368, 0.858765560661, 0.879917837048, 0.911448610603, 0.946232406922, 0.974435080048, 0.990874579238, 0.997610403433, 0.999542055216, 0.999935472427, 0.999993316357], [0.843396101918, 0.844056092249, 0.846723864987, 0.854753491639, 0.8725328585, 0.901487816668, 0.936359908659, 0.967344226952, 0.987283740064, 0.996351621478, 0.99923456329, 0.999882059072, 0.999986631604], [0.843342445645, 0.843795429212, 0.845746463916, 0.852067821394, 0.867152634025, 0.893606260585, 0.927873419944, 0.960686226948, 0.983574149863, 0.994917518053, 0.998849888695, 0.99980909314, 0.999976683767], [0.843310493614, 0.843634624433, 0.845109258803, 0.85018659556, 0.863104451923, 0.887246168453, 0.920533234786, 0.954491519679, 0.979837746907, 0.993348354707, 0.998393778244, 0.999715799769, 0.999963005203]]\n_DIDX = (0, 2, 4, 6, 8)\n_DW = (13.0 / 96.0, 7.0 / 24.0, 7.0 / 48.0, 7.0 / 24.0, 13.0 / 96.0)\nDEMAND_RATE = [DEMAND_RATE[i] for i in _DIDX]\nDEMAND_MEAN = [DEMAND_MEAN[i] for i in _DIDX]\nDEMAND_PRIOR = [r * m for r in _DW for m in _DW]\nDEMAND_PRIOR_LOG = [math.log(w) for w in DEMAND_PRIOR]\nDEMAND_LOG = []\nfor row in DEMAND_CDF:\n    masses = [row[0]] + [max(1e-14, row[i] - row[i - 1]) for i in range(1, len(row))]\n    DEMAND_LOG.append([[math.log(max(1e-14, mass) / max(row[k], 1e-14)) for mass in masses[:k + 1]] for k in range(len(row))])\nDEMAND_FLOW = [r * m for r in DEMAND_RATE for m in DEMAND_MEAN]\nDEMAND_LIKELIHOOD = [[tuple((table[k][b] for table in DEMAND_LOG)) for b in range(k + 1)] for k in range(len(DEMAND_BINS))]\nD = {'mult': 1.0, 'horizon': 2000.0, 'mode': 1, 'shrink': 1.0, 'extra': 0.0, 'floor': 0.45}\n\nclass _FloorStrategy(BaseStrategy):\n\n    def __init__(self):\n        self.dpost = DEMAND_PRIOR_LOG[:]\n        self.dcounts = {}\n        self.dprev = None\n        self.dbprev = None\n        self.dpending = None\n        self.dcount = 0\n        self.dflow = sum(DEMAND_FLOW) / len(DEMAND_FLOW)\n        self.probe_ids = set()\n        self.n = 0\n        self.ahead = set()\n        self.res = {}\n        self.bc = None\n        self.bw = None\n        self.st = 0.5\n        self.pcb = self.pca = None\n        self.pb = set()\n        self.pa = set()\n        self.tb = 0\n        self.s = None\n\n    def _oid(self, tag):\n        self.n += 1\n        return tag + str(self.n)\n\n    def _demand_update(self, state, now):\n        if self.dprev is None:\n            return\n        tick, prev, cutoff = self.dprev\n        if not any((oid in now for oid in prev)):\n            return\n        spent = sum((q - now.get(oid, 0.0) for oid, q in prev.items())) * tick / 100.0\n        k = 0\n        while k < len(DEMAND_BINS) and spent >= DEMAND_BINS[k]:\n            k += 1\n        if k > cutoff:\n            return\n        key = (cutoff, k)\n        self.dcounts[key] = self.dcounts.get(key, 0) + 1\n        self.dcount += 1\n        if self.dcount % 16 == 0:\n            for (cutoff, k), count in self.dcounts.items():\n                terms = DEMAND_LIKELIHOOD[cutoff][k]\n                self.dpost = [v + count * l for v, l in zip(self.dpost, terms)]\n            self.dcounts.clear()\n            self.dpending = self.dpost[:]\n\n    def _refresh_demand(self):\n        if self.dpending is not None:\n            mx = max(self.dpending)\n            weights = [math.exp(v - mx) for v in self.dpending]\n            z = sum(weights)\n            self.dflow = sum((w * f for w, f in zip(weights, DEMAND_FLOW))) / z\n            self.dpending = None\n\n    def _demand_snapshot(self, buy, sell, unknown_tick, q1, amt, qam):\n        self.dprev = None\n        if sell:\n            tick = min((v[0] for v in sell.values()))\n            front = {oid: q for oid, (t, q) in sell.items() if t == tick}\n            cap = sum(front.values()) * tick / 100.0\n            k = -1\n            for i, b in enumerate(DEMAND_BINS):\n                if b < cap - 0.01 * tick / 100.0:\n                    k = i\n            if k >= 0:\n                self.dprev = (tick, front, k)\n        self.dbprev = None\n        if buy:\n            tick = max((v[0] for v in buy.values()))\n            unknown = unknown_tick >= tick or (tick == 1 and (q1 >= 0.01 or (amt == 1 and qam >= 0.01)))\n            if not unknown:\n                front = {oid: q for oid, (t, q) in buy.items() if t == tick}\n                cap = sum(front.values()) * 0.05\n                k = -1\n                for i, b in enumerate(DEMAND_BINS):\n                    if b < cap - 0.0005:\n                        k = i\n                if k >= 0:\n                    self.dbprev = (5.0, front, k)\n\n    def on_step(self, state):\n        H = max(1, state.steps_remaining)\n        cb = state.competitor_best_bid_ticks or 0\n        ca = state.competitor_best_ask_ticks or 100\n        if self.s is None:\n            self.s = max(1, (ca - cb + 1) // 2)\n        lo, hi = (cb, ca)\n        sb, sa = (set(), set())\n        bids, asks, probes = ([], [], [])\n        now = {}\n        has_bid = low_ask = False\n        for o in state.own_orders:\n            now[o.order_id] = o.remaining_quantity\n            is_probe = o.remaining_quantity <= PROBE + 1e-09\n            if is_probe:\n                probes.append(o)\n            if o.side is Side.BUY:\n                has_bid = True\n                lo = max(lo, o.price_ticks)\n                if is_probe:\n                    sb.add(o.price_ticks)\n                else:\n                    bids.append(o)\n            else:\n                hi = min(hi, o.price_ticks)\n                if o.price_ticks <= 5:\n                    low_ask = True\n                if is_probe:\n                    sa.add(o.price_ticks)\n                else:\n                    asks.append(o)\n        self._demand_update(state, now)\n        ask_prev = self.dprev\n        if low_ask:\n            self.dprev = self.dbprev\n            self._demand_update(state, now)\n        self.dprev = ask_prev\n        if P['pinf'] > 0:\n            ea = self.pa - sa\n            eb = self.pb - sb\n            if sa and ea:\n                lo = max(lo, min(max(ea), hi))\n            if eb and (sb or min(eb) <= P['p1t']):\n                hi = min(hi, max(min(eb), lo))\n        if P['jumpinfo'] > 0 and self.pcb is not None:\n            if ca > self.pca + 1:\n                lo = max(lo, ca - 1)\n            if cb < self.pcb - 1:\n                hi = min(hi, cb + 1)\n        self.pcb, self.pca = (cb, ca)\n        if lo > hi:\n            lo, hi = (hi, lo)\n        wid = max(hi - lo, 1e-06)\n        grid_bins = 8.0 if hi <= 10 else 4.0\n        nb = max(2, min(48, int(round(wid * grid_bins))))\n        cs = [lo + (i + 0.5) * wid / nb for i in range(nb)]\n        if self.bc is None or P['filt'] <= 0:\n            ws = [1.0 / nb] * nb\n        else:\n            sg = max(self.st, 0.6 * wid / nb)\n            k = -0.5 / (sg * sg)\n            ws = []\n            uni = P['uni'] * sg\n            oldn = len(self.bc)\n            spacing = wid / nb\n            if nb >= 8 and oldn >= 8 and (abs(self.bc[1] - self.bc[0] - spacing) < 1e-12):\n                offset = oldn - 1\n                d0 = cs[0] - self.bc[0]\n                kernel = []\n                for j in range(-offset, nb):\n                    d = d0 + j * spacing\n                    d2 = d * d * k\n                    kernel.append(math.exp(d2) if d2 > -12.5 else 0.0)\n                for i in range(nb):\n                    ix = i + offset\n                    ws.append(sum(map(mul, self.bw, kernel[ix::-1]), uni))\n            else:\n                for c in cs:\n                    t = uni\n                    for ci, wi in zip(self.bc, self.bw):\n                        d = c - ci\n                        d2 = d * d * k\n                        if d2 > -12.5:\n                            t += wi * math.exp(d2)\n                    ws.append(t)\n            tot = sum(ws)\n            ws = [w / tot for w in ws]\n        self.bc, self.bw = (cs, ws)\n        mean_t = sum(map(mul, cs, ws))\n        var_t = max(sum(map(mul, map(mul, cs, cs), ws)) - mean_t * mean_t, 0.0)\n        phat = min(max(mean_t / 100.0, 0.002), 0.998)\n        var = P['sig'] ** 2 + P['lam_j'] * P['sig_j'] ** 2\n        sd = math.sqrt(H * var)\n        self.tb = self.tb + 1 if hi <= 1 else 0\n        if self.tb > 0 and P['zd'] > 0:\n            phat = min(phat, max(P['pfl'], cdf(inv(0.01) - P['zd'] * 0.02 * math.sqrt(self.tb) / sd)))\n        if phat < 0.1:\n            self._refresh_demand()\n        z = inv(phat)\n        Z = z * sd\n        sp = pdf(z) / sd * P['sig']\n        self.st = sp * 100.0\n        s = math.sqrt(sp * sp + var_t / 10000.0 + 1e-08)\n        sd1 = math.sqrt(max(1.0, H - 1.0) * var)\n        jp = [(cdf((Z + n * P['sig_j']) / sd1), w) for n, w in NODES]\n        lj = P['lam_j']\n\n        def AB(x):\n            k = (x - phat) / s\n            a = s * lpm(k)\n            b = a - (x - phat)\n            ja = jb = 0.0\n            for p, w in jp:\n                d = x - p\n                if d > 0.0:\n                    ja += w * d\n                else:\n                    jb -= w * d\n            return ((1 - lj) * a + lj * ja, (1 - lj) * b + lj * jb)\n        if H == 1:\n\n            def AB(x):\n                return ((1 - phat) * x, phat * (1 - x))\n        rho = P['lam_r'] * 0.5\n        mu = math.log(P['m']) - 0.5 * P['sig_n'] ** 2\n        kA = P['kL'] if phat < P['pL'] else P['kA']\n\n        def qsize(loss, gain, px):\n            loss *= kA\n            if gain <= 0:\n                return 0.0\n            tail = loss / (rho * gain)\n            if tail >= 1.0:\n                return 0.0\n            return min(P['qmax'], math.exp(mu + P['sig_n'] * inv(1 - max(tail, 1e-06))) / px)\n        ptk = phat * 100\n\n        def qbid(t):\n            if not 1 <= t <= 99:\n                return 0.0\n            a, b = AB(t / 100.0)\n            if phat * 100 - t < P['dmin']:\n                return 0.0\n            if P['nb1'] > 0 and self.s == 1 and (t == 1) and (ptk < 1.0):\n                return 0.0\n            if phat < P['pL']:\n                ytg = P['ydem'] * min(H, P['W']) / max(ca - 1, ptk + 1) * 100.0\n                a *= (P['kLb'] if state.yes_inventory < ytg else P['kLf']) / P['kL']\n            return qsize(a, b, max(phat, 0.05))\n\n        def qask(t):\n            if not 1 <= t <= 99:\n                return 0.0\n            a, b = AB(t / 100.0)\n            if t - phat * 100 < P['dmin']:\n                return 0.0\n            return qsize(b, a, t / 100.0)\n        sticky = P['sticky'] > 0\n\n        def top(orders, comp, step):\n            if sticky and sum((o.remaining_quantity for o in orders if o.price_ticks == comp and o.order_id in self.ahead)) >= P['min_ahead']:\n                return comp\n            return comp + step\n        bid_t = top(bids, cb, 1)\n        ask_t = top(asks, ca, -1)\n        qb = qbid(bid_t)\n        qa = qask(ask_t)\n        Y = state.yes_inventory\n        if ask_t == 1 and H > P['H1'] and (P['pre'] > 0):\n            qa = qa if Y >= P['a1'] > 0 else 0.0\n        ptick = phat * 100\n        amt = 0\n        qam = 0.0\n        if P['ammo'] > 0 and ask_t >= 2 and (phat < max(P['ammo_pmax'], P['pmaxf'])):\n            wealth = state.cash + Y * phat\n            x = max(ask_t, ptick + 1) / 100.0\n            capw = P['fy'] * wealth / max(phat, 0.005)\n            target = min(P['ydem'] * min(H, P['W']) / x, capw)\n            full = min(max(0.5, 0.3 + 0.5 * self.dflow) * min(H, P['Wf']) / x, capw) if phat < P['pmaxf'] else 0.0\n            t = max(1, min(99, int(math.ceil(ptick + 1e-09))))\n            g = t - ptick\n            if Y < full and g <= P['g_hi'] and (bid_t <= t < ask_t):\n                amt, qam = (t, min(P['qf'], full - Y))\n            elif Y < target and phat < P['ammo_pmax'] and (bid_t <= t < ask_t) and (t / 100.0 - phat < P['ammo_maxpay']):\n                amt, qam = (t, min(P['ammo_q'], target - Y))\n            elif Y < full and t >= 2 and (1.0 - g <= P['g_lo']):\n                amt, qam = (t - 1, min(P['qf'], full - Y))\n        if P['pre'] > 0 and ca == 2 and (phat < 0.01) and (H > P['H1']) and (Y < P['pre']) and (not qam) and (1.0 - ptick < P['pre_gap']):\n            amt, qam = (1, min(P['ammo_q'], P['pre'] - Y))\n        demand_flow = max(D['floor'], self.dflow * D['mult'])\n        q1 = 0.0\n        if P['ydf1'] > 0 and P['m1'] < ptick < P['g1'] + 1.0 and (amt != 1):\n            q1 = max(0.0, demand_flow * min(H, D['horizon']) / (self.s / 100.0) - Y)\n        if 0.02 < phat < 0.1:\n            ct = max(2, min(99, int(math.floor(ptick))))\n            wealth = state.cash + Y * phat\n            goal = min(1 * qa, 0.3 * max(wealth, 0.0) / phat)\n            if Y < goal and ct < ask_t:\n                amt, qam = (ct, min(3000.0, goal - Y))\n        actions = []\n        free = state.free_cash - 2.0\n        keep_ask = 0.0\n        new_b = []\n        new_a = []\n\n        def cancel(o):\n            nonlocal free\n            actions.append(CancelOrder(o.order_id))\n            x = o.price_ticks / 100.0\n            if o.side is Side.BUY:\n                free += x * o.remaining_quantity\n            else:\n                free += (1 - x) * min(self.res.get(o.order_id, 0.0), o.remaining_quantity)\n            self.ahead.discard(o.order_id)\n            self.res.pop(o.order_id, None)\n        live_probes = {}\n        for o in probes:\n            if o.order_id in self.probe_ids:\n                if o.side is Side.BUY:\n                    free += o.price_ticks / 100.0 * o.remaining_quantity\n                live_probes[o.side, o.price_ticks] = o\n            else:\n                cancel(o)\n        kept_ids = set()\n        d_buy, d_sell = ({}, {})\n\n        def manage(orders, t, q, comp):\n            kept = 0.0\n            for o in orders:\n                if o.price_ticks == t and q > 0 and (kept + o.remaining_quantity <= max(q * P['keep_hi'], 1.0)):\n                    kept += o.remaining_quantity\n                    kept_ids.add(o.order_id)\n                    if o.order_id in self.ahead:\n                        target = d_buy if o.side is Side.BUY else d_sell\n                        target[o.order_id] = (o.price_ticks, o.remaining_quantity)\n                else:\n                    cancel(o)\n            return kept\n        kb = manage(bids, bid_t, qb, cb)\n        ka = manage(asks, ask_t, qa, ca)\n        add_b = qb - kb if kb < qb * P['keep_lo'] and bid_t != cb else 0.0\n        add_a = qa - ka if ka < qa * P['keep_lo'] and ask_t != ca else 0.0\n        budget = P['fb'] * max(free, 0.0)\n        cost = add_b * bid_t / 100.0 + qam * amt / 100.0\n        if cost > budget:\n            f = budget / cost\n            add_b *= f\n            qam *= f\n            cost = budget\n        out = []\n        q1 = min(q1, P['f1'] * max(budget - cost, 0.0) * 100.0)\n        if q1 >= 0.01:\n            out.append(PlaceOrder(side=Side.BUY, price_ticks=1, quantity=fl(q1)))\n            free -= fl(q1) / 100.0 + 1e-06\n        if amt and qam >= 0.01:\n            q = fl(qam)\n            out.append(PlaceOrder(side=Side.BUY, price_ticks=amt, quantity=q))\n            free -= q * amt / 100.0 + 1e-06\n        if bid_t >= 1 and add_b >= 0.01:\n            q = fl(add_b)\n            oid = self._oid('b')\n            out.append(PlaceOrder(side=Side.BUY, price_ticks=bid_t, quantity=q, client_order_id=oid))\n            free -= q * bid_t / 100.0 + 1e-06\n            if bid_t > cb:\n                self.ahead.add(oid)\n                d_buy[oid] = (bid_t, q)\n        if ask_t <= 99 and add_a >= 0.01:\n            x = ask_t / 100.0\n            covk = sum((o.remaining_quantity - min(self.res.get(o.order_id, 0.0), o.remaining_quantity) for o in asks if o.order_id in kept_ids))\n            cov = max(0.0, Y - covk - 0.1)\n            unc = max(0.0, add_a - cov)\n            if unc > 0:\n                ub = max(0.0, free - (1 - P['fu']) * max(state.cash, 0.0)) if x >= P['xu'] else 0.0\n                if H < P['Hu'] and phat < 0.05:\n                    ub = max(0.0, free * (1 - H / P['Hu']))\n                unc = min(unc, ub / (1 - x))\n            q = fl(min(add_a, cov + unc))\n            if q >= 0.01:\n                oid = self._oid('a')\n                out.append(PlaceOrder(side=Side.SELL, price_ticks=ask_t, quantity=q, client_order_id=oid))\n                r = max(0.0, q - cov)\n                self.res[oid] = r\n                free -= r * (1 - x) + 1e-06\n                if ask_t < ca:\n                    self.ahead.add(oid)\n                    d_sell[oid] = (ask_t, q)\n        f = int(math.floor(ptick + 1e-09))\n        r = max(int(P['rmin']), int(math.ceil(2.0 * s * 100)))\n        self.pb = set()\n        self.pa = set()\n        self.probe_ids = set()\n\n        def probe(side, t):\n            old = live_probes.pop((side, t), None)\n            collision = side is Side.BUY and (t == bid_t or (qam >= 0.01 and t == amt) or (q1 >= 0.01 and t == 1)) or (side is Side.SELL and t == ask_t)\n            if old is not None and (not collision):\n                self.probe_ids.add(old.order_id)\n            else:\n                if old is not None:\n                    actions.append(CancelOrder(old.order_id))\n                oid = self._oid('p')\n                out.append(PlaceOrder(side=side, price_ticks=t, quantity=PROBE, client_order_id=oid))\n                self.probe_ids.add(oid)\n        if free > 1.0:\n            for t in range(f, f + r + 1):\n                if cb < t < ca and 1 <= t <= 99:\n                    probe(Side.BUY, t)\n                    self.pb.add(t)\n            for t in range(f + 1 - r, f + 2):\n                if cb < t < ca and 1 <= t <= 99:\n                    probe(Side.SELL, t)\n                    self.pa.add(t)\n        for old in live_probes.values():\n            actions.append(CancelOrder(old.order_id))\n        unknown_tick = max((o.price_ticks for o in bids if o.order_id not in self.ahead), default=0)\n        self._demand_snapshot(d_buy, d_sell, unknown_tick, q1, amt, qam)\n        return actions + out\n\nclass Strategy(BaseStrategy):\n    \"\"\"Select a fixed policy from the first public competitor spread.\"\"\"\n    def __init__(self):\n        self.s = None\n        self._impl = None\n\n    def on_step(self, state):\n        if self.s is None:\n            cb = state.competitor_best_bid_ticks or 0\n            ca = state.competitor_best_ask_ticks or 100\n            self.s = max(1, (ca - cb + 1) // 2)\n            self._impl = _FloorStrategy() if self.s == 2 else _StackStrategy()\n        return self._impl.on_step(state)\n","code_sha256":"4cda6894bb98e7e4bcd2cdece8ae65e89413211d93a36c9fca64e5d8ad5862e9","tried":["Parent CLI: python3 -m orderbook_pm_challenge run ../parent.py --simulations 600 --seed-start 1000 --workers 4 --json; mean_edge=108.63974289615767, failures=0, seconds=114.33208467101213; exactly matches requested 108.63974289615767.","Calibration took less than five minutes; no run counts were halved.","Exact stack frozen SHA256=f1d0df618d948015745604d8fba2c677247b0dea96b02551d1cd44ec5d866e12; initial source replay: 300 runs per spread, all result fields identical, zero failures.","Spread-2 paired comparison on sampled spread-2 seeds in [60000,68000): original={\"runs\":1987,\"mean\":0.6075141093718673,\"standard_error\":0.18318063780805277,\"retail\":0.28992974992219434,\"arb\":0.31758435944836433}; floors={\"runs\":1987,\"mean\":0.6365839910112733,\"standard_error\":0.15359022930502778,\"retail\":0.25626440974328124,\"arb\":0.3803195812700554}; keep_floors=True.","Final full source replay: 300 runs per spread from seed 60000, every result field identical, zero failures; source for spread 2 is Demand with floors.","Independent all-spread holdout: seeds [70000,72000), simulations=2000, base={\"mean_edge\":92.95847243878374,\"retail_edge\":117.45997392621285,\"arb_edge\":-24.50150148744755}, yours={\"mean_edge\":93.9731934166282,\"retail_edge\":118.00860484256181,\"arb_edge\":-24.0354114259515}, diff={\"runs\":2000,\"mean\":1.0147209778444495,\"standard_error\":0.41549948352459654,\"retail\":0.5486309163489501,\"arb\":0.46609006149605}, failures=0.","Single-process alternating timing, 200 simulations per file: base=143.52286202501273 seconds, yours=141.41617071192013 seconds.","All seven artifact code hashes verified; source quotes fetched and checked literally; final code parsed with ast; strategy imports only standard library and the public challenge API."],"next":"Independently reproduce the paired spread-2 comparison and final-source exactness before the operator considers a manual Paradigm entry; local holdout gains are not leaderboard scores."}
