Function to precompute the sum of perfect squares and store then in an array
def precomputation ( ) : NEW_LINE INDENT for i in range ( 1 , 10000 ) : NEW_LINE INDENT pref [ i ] = pref [ i - 1 ] + isPerfect ( i ) ; NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT L = 6 ; R = 28 ; NEW_LINE precomputation ( ) ; NEW_LINE print ( pref [ R ] - pref [ L - 1 ] ) ; NEW_LINE DEDENT