37. Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Each of the digits 1-9 must occur exactly once in each row. Each of the digits 1-9 must occur exactly once in each column. Each of the digits 1-9 must occur exactly once in each of the 9 3x3 sub-boxes of the grid. The '.' character indicates empty cells.
/**
 * @param {character[][]} board
 * @return {void} Do not return anything, modify board in-place instead.
 */
var solveSudoku = function(board) {
    const SIZE = 9;

    // Track used digits in rows, columns, and 3x3 boxes
    const row = Array.from({ length: SIZE }, () => Array(SIZE).fill(false));
    const col = Array.from({ length: SIZE }, () => Array(SIZE).fill(false));
    const box = Array.from({ length: SIZE }, () => Array(SIZE).fill(false));

    // Initialize tracking arrays based o

Transition-behavior: allow-discrete

/* works in one direction, if both direction is needed, we need to use 
@starting-style for second direction, @see: https://www.youtube.com/shorts/xVt8Foa2u7I (Kevin Powell)


/* toggle - two 2 , starting-style needed */
/* https://jsbin.com/sokazavera/edit?html,css,output */
.txt {
	background-color: #eee;
	padding: 20px;
	margin-top: 15px;
	border-radius: 4px;
	border: 1px solid #ccc;
	display: none;
	opacity: 0;

	transition-property: all;
	transition-duration: 1s;
	transition-behavior: allow

36. Valid Sudoku

Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: Each row must contain the digits 1-9 without repetition. Each column must contain the digits 1-9 without repetition. Each of the nine 3 x 3 sub-boxes of the grid must contain the digits 1-9 without repetition. Note: A Sudoku board (partially filled) could be valid but is not necessarily solvable. Only the filled cells need to be validated according to the mentioned rules.
/**
 * Validates a partially filled 9x9 Sudoku board.
 * Only filled cells are checked for rule violations.
 *
 * @param {character[][]} board - 2D array representing the Sudoku board
 * @return {boolean} - true if the board is valid, false otherwise
 */
var isValidSudoku = function(board) {
    // Set to track seen digits in rows, columns, and sub-boxes
    const seen = new Set();

    // Iterate over each cell in the 9x9 grid
    for (let row = 0; row < 9; row++) {
        for (let col = 0; co

SurgiFusionAI

**Goal:** A clean, reproducible skeleton for experimentation with **MIDE** (Multiscale Inflammatory Dynamics Encoder) and the **FORTA** (Feedback-Optimized Resolution Trajectory Architecture) controller for post-surgical ocular inflammation modeling. This repository provides: - `model.py`: a PyTorch implementation of a lightweight, modular encoder–controller stack. - A simple, single-file setup so you can plug in your own datasets and training loop. > The architecture and terminology follow the SurgiFusionAI paper (MIDE + FORTA; multi-source fusion; risk-driven control; procedure-aware temporal modulation). :contentReference[oaicite:0]{index=0} --- ## Background **MIDE** encodes multi-scale/ multi-modal inputs (e.g., slit-lamp/OCT/thermography + optional metadata) with: - Per-modality backbones - Cross-modal attention fusion - Spatial decoder to predict **inflammation intensity map** `I(x,y)` and auxiliary fields (e.g., ECM proxy) **FORTA** consumes the predicted states and: - Tracks a target burden curve `B*(t)` (user-defined) - Produces a **spatial dosing map** (control) and **risk map** - Applies optional **procedure-aware temporal gating** for PRK vs LASIK For a conceptual overview (operator coupling, risk-driven allocation, temporal gating), see figures and equations in the paper (e.g., MIDE schematic on *page 6*, Cross-Scale State Integration on *page 8*, FORTA on *page 10*). :contentReference[oaicite:1]{index=1} --- ## Quick Start ### 1) Environment ```bash pip install torch torchvision

```python
# model.py
# Minimal, self-contained PyTorch implementation of a MIDE+FORTA-style model.
# Focus: clean structure and reasonable defaults, easy to extend for research.

from typing import Dict, Optional, Tuple
import math
import torch
import torch.nn as nn
import torch.nn.functional as F


# ----------------------------
# Small building blocks
# ----------------------------

class ConvBNAct(nn.Module):
    """Conv -> BatchNorm -> GELU"""
    def __init__(self, in_ch

HACSI

# HACSI: Dual-Attention + Temporal Encoder for Multimodal Mental-State Analysis This repository provides a clean **PyTorch** reference implementation of a multimodal model architecture that fuses **visual**, **textual**, and **physiological** features via **dual attention**, followed by a **temporal encoder** for sequence modeling. It is designed as a practical starting point for research or production prototypes where time-evolving mental states (or any sequential target) are inferred from heterogeneous signals. > Core ideas: (1) modality-specific encoders, (2) **dual attention** (channel recalibration + cross-modal self-attention), (3) **temporal encoding** with a Transformer encoder, and (4) flexible **heads** for classification or regression. --- ## Features - **Plug-and-play inputs**: Pre-extracted features per modality (`vision`, `text`, `physio`) with shape `[B, T, D]`. - **Dual attention fusion**: - *Channel attention* (Squeeze-Excitation style) per modality. - *Cross-modal attention* to learn data-driven fusion weights. - **Temporal modeling**: Transformer encoder with positional embeddings. - **Heads**: - Classification (`num_classes > 0`) - Regression (set `num_classes=0` and use `output_dim` > 0) - **Masking** for variable-length sequences. --- ## Quick Start ### 1) Install ```bash pip install torch einops

```python
from dataclasses import dataclass
from typing import Optional, Literal

import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange


# -----------------------------
# Configuration
# -----------------------------
@dataclass
class HACSIConfig:
    # Input feature dims [B, T, D]
    d_vision: int
    d_text: int
    d_physio: int

    # Shared model dim after projection
    d_model: int = 512

    # Fusion strategy: 'cross_att

Temporal Self-Attention with Channel Fusion for Mental State Identification in Oncology Nursing

This repository contains the code and methodology for a model designed to enhance mental state identification in oncology nursing. The model leverages temporal self-attention and channel fusion techniques to interpret complex physiological data and provide robust, real-time emotional trajectory modeling for cancer patients. ## Key Features - **Temporal Self-Attention Mechanisms**: Captures dynamic, time-dependent patterns in emotional and cognitive states of oncology patients. - **Channel Fusion**: Integrates data from multiple modalities, including physiological signals, nurse annotations, and patient self-reports, to improve model robustness and accuracy. - **Domain-Specific Adaptation**: Incorporates contextual information such as nursing metadata to personalize and refine inferences in real-time clinical settings. - **Probabilistic Model**: Uses a latent-variable framework with variational inference to handle uncertainty and incomplete data, which is common in real-world clinical environments. - **High-Performance**: Outperforms traditional methods like RNNs and transformers in early warning sensitivity and alignment with expert assessments. ## Installation 1. Clone the repository: pip install -r requirements.txt

```python
import torch
import torch.nn as nn
import torch.optim as optim

class OncoMindNetwork(nn.Module):
    def __init__(self, input_dim, latent_dim, num_modalities):
        super(OncoMindNetwork, self).__init__()
        # Define the components for your OncoMind Network
        self.transformer_branch = nn.TransformerEncoderLayer(d_model=latent_dim, nhead=8)
        self.conv_branch = nn.Conv2d(input_dim, latent_dim, kernel_size=3, stride=1)
        self.fc1 = nn.Linear(latent

ATIN: Affective Tensor Interaction Network

# ATIN: Affective Tensor Interaction Network This repository provides a **clean, minimal PyTorch implementation** of the core ideas behind the **Affective Tensor Interaction Network (ATIN)** for recognizing and tracking patient psychological states over time. The model combines: - **Contextual Encoding** of time-varying environment inputs (e.g., signals, observations) with a GRU. - **Affective Tensor Embedding** (low-rank) to jointly represent affective–cognitive–volitional components. - **Patient-Profile Attention** over a static psychosocial tensor. - **Psychological State Projection** into interpretable latent vectors *(α: affective, κ: cognitive, ν: volitional)* with smooth temporal dynamics. > Architecture sketches: see the **ATIN schematic on page 6 (Figure 1)** and the **Psychological State Projection on page 8 (Figure 2)** of the referenced paper. These diagrams illustrate the multi-encoder setup, tensor interaction, and projection pipeline, which this minimal code mirrors in a lightweight form. --- ## Why this repo? - **Minimal & readable**: focuses on the modeling core so you can plug into your data pipeline. - **Interpretable heads**: exposes α/κ/ν slices for downstream analysis and visualization. - **Temporal smoothness**: provides an optional continuity regularizer for stable trajectories. --- ## Repository structure

```python
from __future__ import annotations
from typing import Optional, Dict, Any, Tuple

import torch
import torch.nn as nn
import torch.nn.functional as F


class GRUContextEncoder(nn.Module):
    """
    Contextual Encoding + Temporal Propagation
    - Encodes E_t (environmental inputs) with a GRU to produce hidden states h_t.
    Mirrors Eqs. (6)–(10) in a compact, standard GRU form.
    """
    def __init__(self, env_dim: int, hidden_dim: int, num_layers: int = 1, bidir: 

RiskSqueezeNet

A lightweight, practical PyTorch implementation inspired by *RiskSqueezeNet: Squeeze-Excitation with Aggregated Attention for Tumor Care Risk Forecasting*. It combines: - **Temporal encoders** (stacked GRU, bidirectional), - **Squeeze-and-Excitation (SE)** for channel recalibration, - **Multi-Head Self-Attention** for global temporal context, and - **Horizon-aware decoding** for multi-step risk forecasts, with optional **contrastive projection** (for representation learning) and **temporal smoothness** utilities. > This repo is a concise, engineering-friendly reference and not a line-for-line reproduction of the paper’s full pipeline (e.g., CARE-GLIDE variants or multi-modal fusion). See the paper for conceptual details and figures. :contentReference[oaicite:0]{index=0} --- ## Why this repo? - **Simple to drop into EHR time-series projects**: expects padded/packed temporal batches or plain tensors. - **Interpretable building blocks**: SE, attention, horizon heads are explicit and modular. - **Trainer-agnostic**: plug into your favorite training loop or Lightning. --- ## Quick start ```bash pip install torch

```python
"""
RiskSqueezeNet (minimal PyTorch reference)
------------------------------------------

A compact model for clinical risk forecasting on temporal EHR features.

Core blocks:
- Bidirectional GRU stack (hierarchical temporal encoding)
- Squeeze-and-Excitation (SE) channel gating
- Multi-Head Self-Attention for global temporal context
- Horizon-aware decoding: per-horizon classification heads (1..H)
- Optional contrastive projection head (for representation learning)

I

ONCOPRED

# ONCOPRED: Channel-Attention Transformer with Temporal Embedding A lightweight PyTorch implementation of an oncology risk prediction model with: - **Temporal gating** over time gaps - **Observation embedding** that fuses values, missingness, and time-since-last - **Treatment-aware fusion** - **Transformer encoder** with multi-head self-attention - **Horizon-wise risk decoder** (multi-interval) - **Auxiliary heads** for next-treatment prediction and missingness reconstruction - **MC Dropout** for uncertainty This implementation is inspired by the architecture described in the paper *“Channel Attention-driven Transformer with Temporal Embedding for Oncology Care Risk Prediction.”* Key elements we mirror include temporal gating, treatment-aware attention/encoding, interval-specific decoding, and uncertainty via MC dropout (see the **Method** section and Eqs. (6)–(23) for encoding/attention/decoding and (19) for MC dropout). :contentReference[oaicite:0]{index=0} According to the diagram on **page 7**, the pipeline performs temporal gating/embedding → treatment-aware attention → interval-specific decoding. The **page 8** text further details multi-task auxiliary heads and uncertainty estimation. --- ## Quick Start ### 1) Install ```bash pip install torch numpy

---

# model.py

```python
import math
from typing import Optional, Dict
import torch
import torch.nn as nn
import torch.nn.functional as F


class TemporalGating(nn.Module):
    """
    Exponential decay gating: gamma_t = exp(-rho * delta_t)
    Multiplies feature embeddings elementwise (Eq. 7–8).
    """
    def __init__(self, d_model: int):
        super().__init__()
        # One learnable decay per channel (broadcasted across time)
        self.rho = nn.Parameter(torch

VivoDNA

A clean, production-friendly PyTorch model scaffold you can drop into new projects. It provides a tiny yet flexible `Model` class with: - Config-driven initialization (`from_config`) - Multiple heads (classification / regression) - Pluggable backbones (MLP / ConvNet) - Sensible weight init and export helpers > Perfect for quick baselines, hackathons, or bootstrapping more serious work. --- ## Features - **Simple API**: `model = Model.from_config(cfg)` then `model(x)` - **Two heads**: `task="classification"` or `task="regression"` - **Two backbones**: `backbone="mlp"` (tabular) or `backbone="conv"` (image) - **Utilities**: `save_weights`, `load_weights`, `parameter_count` --- ## Install ```bash python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate pip install torch torchvision # choose the CUDA/CPU build you need
"""
model.py — A small, configurable PyTorch model scaffold.

Usage:
    from model import Model
    cfg = {"task": "classification", "backbone": "conv", "in_channels": 3, "num_classes": 10}
    model = Model.from_config(cfg)
    y = model(x)

Design goals:
- Minimal deps (just PyTorch)
- Config-driven
- Two backbones (MLP/Conv) + two heads (classification/regression)
- Small but production-friendly utilities
"""

from typing import Dict, Any, Optional, Tuple
import math
import

OperonNurse: A Lightweight Sequence Model for Workflow Standardization

A clean PyTorch implementation of a **sequence model** for learning and standardizing multi-phase workflows (e.g., pre-op / intra-op / post-op nursing steps). It combines token embeddings, positional encoding, an LSTM backbone, and an optional Transformer encoder layer for long-range context, then predicts the **next action** or a **distribution over standardized steps**. > Inspired by a modular, constraint-aware sequential-learning framework with phase transitions and compliance monitoring (see schematic diagrams analogous to Fig. 1–2 in the reference). This repo provides a compact, production-friendly baseline you can extend to your own datasets. :contentReference[oaicite:1]{index=1} --- ## Highlights - **Simple but strong baseline**: Embedding → LSTM → (optional) Transformer → Classifier - **Mask-aware** variable-length batching - **Next-step prediction** or **per-step classification** - **Pluggable constraints** (hook points for eligibility/feasibility checks) - **TorchScript-friendly** components --- ## Install ```bash pip install torch>=2.0.0

---

# model.py

```python
import math
from typing import Optional, Tuple

import torch
import torch.nn as nn
import torch.nn.functional as F


class PositionalEncoding(nn.Module):
    """
    Standard sinusoidal positional encoding.
    """
    def __init__(self, d_model: int, max_len: int = 10000):
        super().__init__()
        pe = torch.zeros(max_len, d_model)
        position = torch.arange(0, max_len, dtype=torch.float32).unsqueeze(1)
        div_term = torch.ex

RoLIE: Risk-Oriented Latent Interaction Encoder

A lightweight PyTorch implementation of a **risk-factor recognition** model inspired by the RoLIE architecture for operating-room (OR) nursing safety. It combines: - **Visual feature encoder** (CNN backbone) - **Temporal modeling** (GRU) - **Graph-based latent interaction** (attention over latent factors) - **Multi-label risk prediction** (sigmoid head) > This repository is a practical, minimal re-implementation intended for experimentation and education. It is not a drop-in reproduction of any specific paper or benchmark. --- ## Features - **Plug-and-play CNN backbone** (ResNet-18 by default via `torchvision`) - **Temporal GRU** for streaming frames or short clips - **Graph Attention** over latent factors to model inter-risk dependencies - **Multi-label head** with `BCEWithLogitsLoss` - **Clear, typed API** with docstrings and examples --- ## Quick Start ### 1) Install ```bash pip install torch torchvision

---

# model.py

```python
from typing import Tuple, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models


class GraphAttentionLayer(nn.Module):
    """
    A simple single-head graph attention layer over a set of latent nodes.

    Given node features Z in R^{B x N x D}, it computes attention weights
    alpha_{ij} = softmax_i( (Z_i W_q) · (Z_j W_k) / sqrt(Da) ) and produces
    H_i = sigma( sum_j alpha_{ij} (Z_j W_v) ).

スクロールトリガー(IntersectionObserver)

function scrollEffect() {
    var $target = $('.js-target');
    if(!$target.length) return;

    var opt = {
        root: null,
        rootMargin: '0px 0px -20% 0px',
        threshold: 0,
    };

    var observer = new IntersectionObserver(function(entries) {
        $.each(entries, function(__, entry) {
            if(entry.isIntersecting) {
                $(entry.target).addClass('act');
                observer.unobserve(entry.target);
            }
            // else {
            //  

3021. Alice and Bob Playing Flower Game

Alice and Bob are playing a turn-based game on a field, with two lanes of flowers between them. There are x flowers in the first lane between Alice and Bob, and y flowers in the second lane between them. The game proceeds as follows: Alice takes the first turn. In each turn, a player must choose either one of the lane and pick one flower from that side. At the end of the turn, if there are no flowers left at all, the current player captures their opponent and wins the game. Given two integers, n and m, the task is to compute the number of possible pairs (x, y) that satisfy the conditions: Alice must win the game according to the described rules. The number of flowers x in the first lane must be in the range [1,n]. The number of flowers y in the second lane must be in the range [1,m]. Return the number of possible pairs (x, y) that satisfy the conditions mentioned in the statement.
/**
 * @param {number} n
 * @param {number} m
 * @return {number}
 */
var flowerGame = function(n, m) {
    // Count how many odd numbers are in [1, n]
    const oddX = Math.floor(n / 2) + (n % 2);   // e.g., 1, 3, 5...
    const evenX = Math.floor(n / 2);            // e.g., 2, 4, 6...

    // count how many odd numbers are in [1, m]
    const oddY = Math.floor(m / 2) + (m % 2);
    const evenY = Math.floor(m / 2);

    // Valid pairs are:
    // - odd x with even y
    // - even x with odd y
 

Ajax processs Apex

async function populaValoresDashBoardAdmin() {
    const inputDashValoresPagos = document.getElementById('dashValoresPagos');
    const waitPopup = apex.widget.waitPopup();

    try {
        const data = await new Promise((resolve, reject) => {
            apex.server.process(
                "SET_TOTAIS_DASHBOARD",
                {
                    x01: $v('P1_DASH_INICIAL'),
                    x02: $v('P1_DASH_FINAL'),
                    x03: $v('P1_DASH_TIPO_SERVICO'),
    

【テンプレート・2025/08】お問い合わせフォーム

<form method="post" action="inquiry.php" id="js_validation_form">
  <input type=hidden name="action" value="">
  <table class="base_table">
    <tr>
      <th>会社名・お名前<span class="must">必須</span></th>
      <td><input name="name" type="text"></td>
    </tr>
    <tr>
      <th>メールアドレス<span class="must">必須</span></th>
      <td><input name="mailad" type="email"></td>
    </tr>
    <tr>
      <th>電話番号<span class="must">必須</span></th>
      <td><input name="tel" type="tel"></td>
    </t