Wrong ans in q14)

the code has two independent loops inside the pat() function, each of which runs for logn time. So time complexity should be O(logn + logn) => O(logn). Am I correct?

log time the function will execute
and time complexity of pow will be log time
hence log log N