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
tm1138: 2017-11-08 12:57:18

finally AC in cpp

Last edit: 2017-11-08 13:05:14
uday1053: 2017-10-14 12:40:48

Frekin Easy with Python3

aayushi2: 2017-10-06 20:14:30

what will be the answer if the test case is combiantion of even and odd ex. 13 and 2. it should come 7.5 and 5.5 which is not possible so two cases comes 7 and 5 or 8 and 5 which one will be correct and why?

uts91: 2017-10-06 00:47:55

BigInteger in java does the thing!

hitesh87: 2017-09-23 08:38:14

Use boost library in c++. Easy one got AC in one go.

gauravmohla: 2017-09-17 10:34:14

BigDecimal is needed here or else test case like 11 3 would fail. I am not sure if test cases are passing here using BigInteger. answer using BI would be 6 5 and not 7 4.

mib314: 2017-09-14 14:50:50

I see a lot of comments here about code working in Python 2 but not in Python 3. I believe the difference is due to how division works with different operators (/, //) in python 2 and python 3. Basically in python 2, if you use a/b and both the operators are int then it will return the python 3 equivalent of a//b i.e and int value. However, in python 3, a/b is float division. Float divisions are not accurate for really large test cases. Hence, In python 3 if you are first dividing using the a/b approach and then converting it to int by using int(a/b) then it will not be accurate. You need to form a logic where you don't need to consider float values and change them back to int,

malhappy: 2017-09-06 05:48:25

@kunalkumar0508 can you show me the testcases which you have used

initish: 2017-09-05 19:07:23

Has anyone solved this using string logic in C++

Last edit: 2017-09-05 19:07:49
malhappy: 2017-09-05 14:57:19

is any testcase like this is possible
10
3


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