SQ2SQ2 - TSquare TO Square

no tags 

There are squares whose digits can be rearranged to make another squares. Lets call them S2S numbers.

For example: 144 → 441

Input

Single line containing two integers X Y (Xth, Yth term in the list of S2S numbers).

Output

Print all the numbers from Xth to Yth term of S2S numbers (both inclusive).

Example

Input:
1 3

Output:
144
169
196

(Xth, Yth term <= 10^12)
(Source Code Limit= 1000B)
Note: 1 → 100 → 1 or other similar numbers are NOT S2S numbers (e.g. 9 → 900 → 9)

Try the classic version -> http://www.spoj.com/problems/SQ2SQ/


hide comments
Saurabh Jain: 2014-06-15 20:31:55

Getting TLE, how to improve??

Jared Deckard: 2012-04-16 17:52:40

What previously got AC now gets WA... WHY!?

wrong answer : 2012-04-16 17:52:40

WTH?


Added by:Avinash
Date:2012-04-12
Time limit:0.709s-1.908s
Source limit:1000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem