```ts
export function parseAmount(text: string): number {
  if (typeof text !== 'string') throw new Error('Input must be a string');
  
  const match = text.match(/^\d+(\.\d{2})?$/);
  if (!match) throw new Error('Invalid amount format');

  const [_, integerPart, fractionalPart] = match;
  const cents = parseInt(integerPart || '0', 10) * 100 + (fractionalPart ? parseFloat(fractionalPart) * 100 : 0);
  
  if (isNaN(cents)) throw new Error('Invalid amount format');
  
  return cents;
}

export function formatAmount(cents: number): string {
  const integerPart = Math.floor(cents / 100);
  const fractionalPart = Math.round((cents % 100) * 100) / 100;
  return `${integerPart}.${fractionalPart.toFixed(2).padStart(3, '0')}`;
}

export function allocateCents(totalCents: number, weights: number[]): number[] {
  if (totalCents < 0 || !Number.isInteger(totalCents)) throw new Error('Total cents must be a non-negative integer');
  
  const totalWeights = weights.reduce((sum, weight) => sum + weight, 0);
  if (totalWeights === 0) throw new Error('Total weights cannot be zero');
  
  const shares = weights.map(weight => Math.floor(totalCents * (weight / totalWeights)));
  const remainder = totalCents - shares.reduce((sum, share) => sum + share, 0);

  let i = 0;
  while (remainder > 0 && i < shares.length) {
    if (shares[i] > 0) {
      shares[i]++;
      remainder--;
    }
    i++;
  }

  return shares;
}
```