@@ -0,0 +1,798 @@
+# Enter your code here. Read input from STDIN. Print output to STDOUT%0An = int(raw_input())%0Ap = int(raw_input())%0A%0Adef squareRoot(n, p):%0A    a = 5 * n%0A    b = 5%0A    limit = 10 ** (p + 1)%0A    while b %3C limit:%0A        if (a %3E= b):%0A            a -= b%0A            b += 10%0A        else:%0A            a *= 100%0A            b = (b - 5) * 10 + 5%0A    return b / 100%0A%0Adef sumDigits(n):%0A   r = 0%0A   while n:%0A       r, n = r + n %25 10, n / 10%0A   return r%0A%0Adef sqrtFloat(n, p):%0A    from decimal import *%0A    getcontext().prec = p%0A    return Decimal(n).sqrt()%0A%0Adef perfectRoot(x):%0A    import math%0A    sqrt = int(math.sqrt(x))%0A    return sqrt * sqrt == x%0A%0Airrational = %5B x for x in range(1, n + 1) if not perfectRoot(x) %5D%0Adigits = %5B sum(sqrtFloat(m, p + 10).as_tuple()%5B1%5D%5B:p%5D) for m in irrational %5D%0Aprint(sum(digits))%0A

Add a python solution. Python's the decimal lib is much faster than Java's. And there is sqrt built-in support. This code passes all the test cases on hackerrank. This is a repo primarily target scala but I may post solution of other langs.