JULKA - Julka


Julka surprised her teacher at preschool by solving the following riddle:

Klaudia and Natalia have 10 apples together, but Klaudia has two apples more than Natalia. How many apples does each of he girls have?

Julka said without thinking: Klaudia has 6 apples and Natalia 4 apples. The teacher tried to check if Julka's answer wasn't accidental and repeated the riddle every time increasing the numbers. Every time Julka answered correctly. The surprised teacher wanted to continue questioning Julka, but with big numbers she could't solve the riddle fast enough herself. Help the teacher and write a program which will give her the right answers.

Task

Write a program which

  • reads from standard input the number of apples the girls have together and how many more apples Klaudia has,
  • counts the number of apples belonging to Klaudia and the number of apples belonging to Natalia,
  • writes the outcome to standard output

Input

Ten test cases (given one under another, you have to process all!). Every test case consists of two lines. The first line says how many apples both girls have together. The second line says how many more apples Klaudia has. Both numbers are positive integers. It is known that both girls have no more than 10100 (1 and 100 zeros) apples together. As you can see apples can be very small.

Output

For every test case your program should output two lines. The first line should contain the number of apples belonging to Klaudia. The second line should contain the number of apples belonging to Natalia.

Example

Input:
10
2
[and 9 test cases more]

Output:
6
4
[and 9 test cases more]


hide comments
Siddharth Singh: 2015-11-13 06:35:14

Python <3
4 lines of code

ranjanakash166: 2015-10-28 17:59:38

why people post link to solution of the problems ridiculous!!!!!!!!!!!

faishal28: 2015-10-28 07:11:25

Nice one AC in first go.

Mohit Rathore: 2015-10-18 15:37:12

Oh Python love ;D

garmel: 2015-10-18 02:03:04

hhh...finally, I made it after 3hours and "3 or 2" WA...I already have read comments describing how easy is this problem...
In fact, the idea is obvious: an array of size bigger that 100 and basic mathematics: those of addition and soustraction...Don't be terrified and scared of , maybe, the 80 or 100 lines of code you are going to write...just take your time and increase your concentration...

Last edit: 2015-10-18 02:05:39
as00000001: 2015-10-13 20:59:57

having the same output but still showing wrong answer @bunnycoder

$aLienT: 2015-10-13 03:03:16

AC in Py 2.7. Same logic in Py 3.4 -> Timed Out.
Tried several other logics, ways of inputs.. But no results. Cost me several TLEs.

Last edit: 2015-10-13 03:07:26
dinesh13506: 2015-10-06 08:25:16

how many times we have find???

skrishna99: 2015-10-04 11:27:32

Pretty simple .AC @ first go. My first of AC @ first go.

satish9040: 2015-10-03 21:42:41

thank you @bunnycoder


Added by:Adam Dzedzej
Date:2004-06-08
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS PERL6 VB.NET
Resource:Internet Contest Pogromcy Algorytmow (Algorithm Tamers)
Round II, 2003