```ts
export function parseAmount(text: string): number {
  if (typeof text !== 'string' || !text.match(/^\d+(\.\d{2})?$/)) {
    throw new Error('Invalid amount format');
  }
  const [integer, decimal = '00'] = text.split('.');
  return parseInt(integer + decimal, 10);
}

export function formatAmount(cents: number): string {
  if (cents < 0) {
    throw new Error('Negative cents are 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('Weight list cannot be empty');
  }
  const totalWeights = weights.reduce((sum, weight) => sum + weight, 0);
  if (totalWeights === 0 || typeof totalCents !== 'number' || !Number.isInteger(totalCents)) {
    throw new Error('Invalid total cents or weights');
  }

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

  for (let i = 0; i < weights.length; i++) {
    if (weights[i] === 0) {
      continue;
    }
    const shareSize = Math.floor(remainingCents / totalWeights);
    shares[i] += shareSize;
    remainingCents -= shareSize;
    totalWeights -= weights[i];
  }

  // Distribute leftover cents to shares with the largest remainder
  while (remainingCents > 0) {
    let maxRemainder = -1;
    let targetIndex = -1;
    for (let i = 0; i < shares.length; i++) {
      const remainder = remainingCents % weights[i];
      if (remainder > maxRemainder || (remainder === maxRemainder && targetIndex === -1)) {
        maxRemainder = remainder;
        targetIndex = i;
      }
    }
    if (targetIndex !== -1) {
      shares[targetIndex]++;
      remainingCents--;
    } else {
      throw new Error('Failed to allocate cents');
    }
  }

  return shares;
}
```