Update X with Operations

Update X with Operations

Easy Python Variables 15 views
Explanation Complexity

Problem Statement

Read two integers x and y. Do these updates in order: x=x+y, y=y+1, x=x-y. Output final x and y.

Input Format

One line: x y.

Output Format

One line: x y after updates.

Example

10 5
9 6

Constraints

-10^9

Input / Output Format

Input Format
One line: x y.
Output Format
One line: x y after updates.
Constraints
-10^9

Examples

Input:
10 5
Output:
9 6

Example Solution (Public)

Python
import sys
s=sys.stdin.read().strip().split()
if not s: sys.exit(0)
x=int(s[0]); y=int(s[1])
x=x+y
y=y+1
x=x-y
sys.stdout.write(f"{x} {y}")

Official Solution Code

import sys
s=sys.stdin.read().strip().split()
if not s: sys.exit(0)
x=int(s[0]); y=int(s[1])
x=x+y
y=y+1
x=x-y
sys.stdout.write(f"{x} {y}")
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.