Implement these TypeScript utility types:
1. ReturnType<F> — extract the return type of a function.
2. Flatten<T> — if T is an array, return its element type; otherwise T.
3. Awaited<T> — unwrap a Promise<T> to T (one level).
Then implement solve(input) which validates the types at runtime.
Sample tests