ROOTCIPH  Decipher
Radar scanned the approaching enemy aircraft on the border. However due to some error part of the tranmitted data can't be deciphered. It was possible only to obtain the coefficients of the cubic polynomial, whose roots are the coordinates of the aircraft relative to the radar. Now you need to calculate the distance to the aircraft. Write the program to solve this task.
Input
The first line contains T (1 <= T <= 1000)  number tests. The next T lines contain three integers a, b and c  coefficients of the polynomial x^{3} + ax^{2} + bx + c, whose roots are the coordinates (the absolute value of the coordinates do not exceed 10^{8}).
Output
For each test print the square of the distance to the enemy aircraft.
Example
Input: 1 6 11 6 Output: 14
hide comments
davidgalehouse:
20190112 07:53:28
There are numbers in the input larger than the limit of a 64bit signed integer. Scanf and cin react to overflowing input in different ways (look this up or experiment), which is why scanf solutions are succeeding and cin solutions are failing. I don't want to give too much away, but only the c coefficient overflowsthis fact may help you create a 'workaround' once you figure out the solution (which isn't so easy IMO). Last edit: 20190112 08:32:55 

dynamo214:
20180816 19:03:14
Dont use any cin cout instead use printf scanf dont know why it is happening. 

badal:
20180125 09:28:14
Why using cin gives WA but scanf gives AC? 

nikroc896:
20170807 15:09:42
AC in one go :)


kr_abhinav:
20170622 08:18:21
To all the guys wondering why they are getting WAs with cin/cout, it's because coordinates can be as large as 100000000, and so the constant term in polynomial can be as large as 10**24 . use string for c and get AC :D 

sagnik_66:
20170608 13:47:38
using cin to take inputs of a,b,c gives WA, but using scanf for those values works! 

vineetpratik:
20170330 20:54:35
haha AC using scanf/printf WA in cin/cout 

starbot:
20170313 15:46:41
too easy...basic maths...WA with cin/cout,AC with scanf/printf


nilabja16180:
20170310 09:43:32
WA using cin,cout, AC using scanf, printf! :/ curious! 

cake_is_a_lie:
20170221 14:28:23
This is amazingly weird, but as somebody before stated, I got WA using cin/cout and AC using scanf/printf. The solution is amazingly simple and only uses integer arithmetic, so no idea why. 
Added by:  Spooky 
Date:  20100309 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS OBJC PERL6 SQLITE VB.NET 
Resource:  Advancement Spring 2010, http://sevolymp.uuuq.com/, author: Alexey Shchepin 