RKMINIMA - Guess The Number


Ushio and Tora are always good friends. Ushio always wanted to play with numbers. But Tora is afraid of big numbers. One day Ushio took two distinct integers x,y and calculated their product m. As Ushio doesn't want Tora to get afraid, he wants to choose x and y in such a way that their product remains same but their average p is minimum. Ushio can fight Demons but he is weak in math. help ushio calculating this minimum value of p.

Input

First Line of the input statement will contain an integer T. Each of the next T lines will contain an integer m ( as stated in the problem statement ).


1<=T<=100000

0<=m<=10^13


Output

Print the minimum possible value of p for each testcase. If there's no possible solution then print "Ushio is sad". If there's no lower bound on value of p then print "Tora is fearless".

Note: Average of a and b is the integer division of (a+b)/2.

Example

Input:
3 
0
1
2
output:
Tora is fearless
Ushio is sad
-1



hide comments
wisfaq: 2020-01-03 13:34:47

I have compassion with those who have to solve a problem like this to get to the educational institution they want to go to.
Primarily problem creators should be aware of situations where programming languages differ as far as implementation is concerned. Making a problem that doesn't pay attention to such a thing may unnecessarily exclude people from the education they deserve.

If you ask my opinion this is a ill thought through problem.
If then someone complains about that and gets their posts deleted I can very well imagine that they get irritated.

About deleting posts:
In the past I also suffered from unjustified deleting and I can assure you that that feels awful.

It might feel normal if your educational system (or other parts of your society) is autoritarian but to people living in societies where you can speak out free it feels like one of the worst insults.

I hope that problem setter has learned a few things from this.
(Btw I made a local copy of my post, just in case...)

Last edit: 2020-01-03 13:41:15
hodobox: 2020-01-03 03:25:20

So I'll give my opinions, seeing how hot this is getting...

1. I'd say a solution is 'x and y integers, such that x*y = m' (and you're then trying to find the minimum average across all solutions), not 'x and y integers such that x*y=m and (x+y)/2 is minimum'.

2. I agree that the integer division should be well defined, mathematically. Using either floor (round down) or ceiling (round up) should work well enough.

3. I don't think deleting comments that aren't aggressive/spoilers is appropriate behavior

4. I don't think devolving into literal insults at other users as a result of that is appropriate behavior. You're better than that, nad.

5. I think (if the wording is fixed so things are exact) that this belongs in classical. Sure it ends up being a few if/else's and basic arithmetic, but there's a place for such problems.

P.S. instead of 'minimum value of p can be infinitely long', say 'no lower bound on value of p' or 'p can be infinitely small'

Last edit: 2020-01-03 03:50:59
nadstratosfer: 2020-01-03 01:07:46

My comment was not "abusing" until you deleted it for the third time, showing both blatant disregard for solvers to whom I provided vital information, that you didn't bother when repeatedly asked for, and disrespect to me.

As wisfaq pointed out, while my requests for definition of division of negative integers kept being deleted, the result of the operation is implementation dependent:
https://stackoverflow.com/questions/19517868/integer-division-by-negative-number

Finally (Simes), if choosing *integers* x, y such that p is minimum is not possible, as it is with m=0, this falls under "no possible solution" category.

The problem was a poorly designed riddle and now that we've finally gathered the necessary info, isn't even that. My solution is exactly 1 line within the I/O handling loop. Please remove it from Classical category.

raka143: 2020-01-02 23:26:17

Thank you @simes for that explanation. I would be happy if you could suggest a word or phrase to replace "infinitely long".
++ I can't help but deleting such abusing comments. I think you should calm down i have already addressed your objection @nad and I think there's nothing wrong.

Simes: 2020-01-02 21:58:17

Sorry @nadstratosfer, but I have to disagree. The problem setter is only asserting that any integer multiplied by zero results in zero. So whichever integer you choose, you can always choose a bigger one and still get the same result. "Infinitely long" is a strange way to say that though.

I calculated average of (a, b) using "(a+b) div 2" in Pascal. No special treatment needed for the sign.

nadstratosfer: 2020-01-02 21:16:06

This is the third time you deleted my comment you little dipshit.

According to psetter, repeatedly deleting comments instead of addressing them is an acceptable behavior. Also in the world of psetter:

1) Infinity is an integer
2) Average of (a, b) = floor((a+b) / 2) * sign(a+b)

AC possible now, but this garbage belongs in Riddle or Tutorial anyway.

raka143: 2020-01-02 20:35:41

@wisfaq
appreciated

wisfaq: 2020-01-02 16:09:13

Just a remark:
The behaviour of (a+b)/2 when a+b is smaller than 0 is programming language dependent.
E.g. my version of Python2 returns -2 if a+b=-3.

And the tags: #math #number-theory are misleading...

Last edit: 2020-01-02 16:11:12
tarun_28: 2020-01-02 14:07:08

@raka143 Thank you for your prompt reply.

raka143: 2020-01-02 08:48:54

ok I will provide more testcases. But before accusing me please check the submissin status of this problem.


Added by:Raka
Date:2020-01-01
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:2019 GATE exam from IIT