```ts
export function parseAmount(text: string): number {
  const regex = /^\d+(\.\d{2})?$/;
  if (!regex.test(text)) {
    throw new Error("Invalid amount format");
  }
  return parseFloat(text) * 100;
}

export function formatAmount(cents: number): string {
  if (cents < 0) {
    throw new Error("Negative cents not allowed");
  }
  const dollars = Math.floor(cents / 100);
  const centsPart = cents % 100;
  return `${dollars}.${centsPart.toString().padStart(2, "0")}`;
}

export function allocateCents(totalCents: number, weights: number[]): number[] {
  if (weights.length === 0) {
    throw new Error("Empty weight list");
  }
  const sum = weights.reduce((acc, w) => acc + w, 0);
  if (sum === 0) {
    throw new Error("Weights sum to zero");
  }
  if (!Number.isInteger(totalCents)) {
    throw new Error("Total cents must be a non-negative integer");
  }

  const shares = weights.map((weight, index) => Math.floor(weight * totalCents / sum));
  let leftoverCents = totalCents - shares.reduce((acc, share) => acc + share, 0);

  for (let i = 0; i < shares.length && leftoverCents > 0; i++) {
    if (weights[i] === 0) continue;
    shares[i]++;
    leftoverCents--;
  }

  return shares;
}
```