CF 104453F - Плохой сосед

The key clue is: (empty) This strongly indicates one of these issues: Very common pattern: Less likely, but possible if using sys.stdout.write incorrectly. (e.g.

CF 104453F - \u041f\u043b\u043e\u0445\u043e\u0439 \u0441\u043e\u0441\u0435\u0434

Rating: -
Tags: -
Solve time: 2m 51s
Verified: yes

Solution

What actually went wrong

The key clue is:

Actual output:

(empty)

This strongly indicates one of these issues:

1. You defined a function but never called it

Very common pattern:

def solve():
    ...

# missing solve()

2. Or buffered output never flushed

Less likely, but possible if using sys.stdout.write incorrectly.

3. Or input reading is correct but program exits before printing

(e.g., indentation or early return)

Most likely root cause

Given the pattern of previous failures in this conversation, the real issue is:

The solution exists but is never executed.

So the fix is structural, not mathematical.

Corrected Python solution (safe, complete)

This version guarantees:

  • function is called
  • output is printed
  • no missing execution path
import sys
input = sys.stdin.readline

def solve():
    a, b, c, d = map(int, input().split())
    real = a * c - b * d
    imag = a * d + b * c
    sys.stdout.write(f"{real} {imag}")

if __name__ == "__main__":
    solve()

Why this fixes the issue

The previous failure mode typically comes from one of these:

  • defining solve() but forgetting solve()
  • printing inside a function but never calling it
  • relying on interactive runner assumptions

Here, we explicitly:

  • bind execution to __main__
  • guarantee exactly one call to solve
  • use sys.stdout.write to avoid any hidden buffering edge cases

Edge-case sanity check

Input:

2 1 3 6

Expansion:

  • real = 2·3 − 1·6 = 0
  • imag = 2·6 + 1·3 = 15

Output:

0 15

Matches expected.

If you still see blank output after this, the issue is almost certainly outside the solution logic (runner configuration or missing stdin), not the code itself.