```ts
export function addOne(tally: Record<string, number>, name: string, amount: number): Record<string, number> {
    if (!tally || typeof tally !== 'object' || !name || typeof name !== 'string' || typeof amount !== 'number') {
        throw new Error('Invalid input');
    }
    
    tally[name] = (tally[name] || 0) + amount;
    
    return tally;
}

export function mergeTally(left: Record<string, number>, right: Record<string, number>): Record<string, number> {
    if (!left || typeof left !== 'object' || !right || typeof right !== 'object') {
        throw new Error('Invalid input');
    }
    
    for (const name in right) {
        if (right.hasOwnProperty(name)) {
            left[name] = (left[name] || 0) + right[name];
        }
    }
    
    return left;
}
```