```typescript
/** Fixed-point money helpers: parse, format, and allocate integer cents. */

export function parseAmount(text: string): number {
  if (typeof text !== "string") {
    throw new Error("amount must be a string");
  }
  const match = /^(\d+)(?:\.(\d{2}))?$/.exec(text);
  if (match === null) {
    throw new Error(`malformed amount: ${text}`);
  }
  const whole = Number(match[1]);
  const cents = match[2] === undefined ? 0 : Number(match[2]);
  return whole * 100 + cents;
}

export function formatAmount(cents: number): string {
  if (!Number.isInteger(cents) || cents < 0) {
    throw new Error("cents must be a non-negative integer");
  }
  const whole = Math.floor(cents / 100);
  const rest = String(cents % 100).padStart(2, "0");
  return `${whole}.${rest}`;
}

export function allocateCents(totalCents: number, weights: number[]): number[] {
  if (!Number.isInteger(totalCents) || totalCents < 0) {
    throw new Error("total cents must be a non-negative integer");
  }
  if (weights.length === 0) {
    throw new Error("weight list cannot be empty");
  }
  weights.forEach((weight) => {
    if (!Number.isInteger(weight) || weight < 0) {
      throw new Error("all weights must be non-negative integers");
    }
  });
  const sum = weights.reduce((acc, weight) => acc + weight, 0);
  if (sum === 0) {
    throw new Error("weights must sum to a non-zero value");
  }

  let remainingCents = totalCents;
  const shares: number[] = weights.map(() => 0);

  for (let i = 0; i < weights.length && remainingCents > 0; i++) {
    const share = Math.floor(remainingCents / sum);
    shares[i] += share;
    remainingCents -= share * sum;

    // Distribute the leftover cents to the shares with largest remainders
    let maxRemainder = -1;
    let maxIndex = -1;
    for (let j = 0; j < weights.length && maxIndex === -1; j++) {
      if (shares[j] % sum !== 0) {
        const remainder = shares[j] % sum;
        if (remainder > maxRemainder) {
          maxRemainder = remainder;
          maxIndex = j;
        }
      }
    }

    if (maxIndex !== -1) {
      shares[maxIndex]++;
      remainingCents--;
    }
  }

  return shares;
}
```