Help me in solving TSUM01 problem

My issue

need answer

My code

# cook your dish here

Learning course: Design and Analysis of Algorithms
Problem Link: Summary of Time Complexity in Design and Analysis of Algorithms