# SRSD CONDENSED CROSS CODE  ·  ≤4000 chars
# Nonnegative-integer SRSD specialization used by the finite Q/S machine.
# Core: Eₛ / Dₛ bijection + portability contract

## Language-neutral core (≤ 600 chars)
E_s(y)=(d,ρ): d=⌊y/s⌋, ρ=y−s·d, 0≤ρ<s on ℕ₀.
D_s(d,ρ)=s·d+ρ.
Thm: D_s∘E_s = id on ℕ₀; E_s∘D_s = id on {(d,ρ): d∈ℕ₀, 0≤ρ<s}.
Proof: unique Euclidean division. Integer only. Keep (d,ρ)⇒zero loss; drop ρ⇒projection.
This is not the full real SRSD family {(R_s,E_s,D_s)}.
Omega: s=10^15, y=Q·n, Q=339949771344778, n=0..32767.
RESOLVE (d,ρ)=E_s(Q·n). VERIFY D_s(d,ρ)=Q·n.

## Python (≤ 700 chars)
def E(y,s):
    d=y//s; return d,y-s*d
def D(d,r,s):
    return s*d+r
S=10**15; Q=339949771344778
for n in range(1<<15):
    y=Q*n; d,r=E(y,S)
    assert D(d,r,S)==y and 0<=r<S
print("VERIFY=PASS")

## Java (≤ 900 chars)
import java.math.BigInteger;
class Srsd {
  static BigInteger[] E(BigInteger y, BigInteger s){
    BigInteger d=y.divide(s);
    return new BigInteger[]{d, y.subtract(s.multiply(d))};
  }
  static BigInteger D(BigInteger d, BigInteger r, BigInteger s){
    return s.multiply(d).add(r);
  }
  public static void main(String[] a){
    BigInteger S=BigInteger.TEN.pow(15), Q=new BigInteger("339949771344778");
    for(int n=0;n<1<<15;n++){
      BigInteger y=Q.multiply(BigInteger.valueOf(n));
      BigInteger[] e=E(y,S);
      BigInteger r=e[1];
      if(!D(e[0],r,S).equals(y) || r.signum()<0 || r.compareTo(S)>=0)
        throw new IllegalStateException("FAIL");
    }
    System.out.println("VERIFY=PASS");
  }
}

## Rust (≤ 800 chars)
fn e(y:u128,s:u128)->(u128,u128){let d=y/s;(d,y-s*d)}
fn lift(d:u128,r:u128,s:u128)->u128{s*d+r}
fn main(){
  let s=10u128.pow(15); let q=339949771344778u128;
  for n in 0..(1u128<<15) {
    let y=q*n; let (d,r)=e(y,s);
    assert!(lift(d,r,s)==y && r<s);
  }
  println!("VERIFY=PASS");
}

## Julia (≤ 700 chars)
E(y,s)=(d=div(y,s); (d,y-s*d))
D(d,ρ,s)=s*d+ρ
S=BigInt(10)^15; Q=BigInt(339949771344778)
for n in 0:(1<<15)-1
    y=Q*n; d,ρ=E(y,S)
    @assert D(d,ρ,S)==y && 0≤ρ<S
end
println("VERIFY=PASS")

## Final check
Total characters of this artifact: 2191
Status: SRSD-exact · exact integer round trip · reversible · under 4000
