AtCoder ABC077 Note

A. Rotation … If second input is same as the reverse of the first input, it is true.

B. Around Square … Get the square root of the input, print out the square number based on the floor of the obtained number.

C. Snuke Festival … First I used product module to list out all the combination, but it takes O(n^3) and caused TimeOut.

Solution is – Sort the top parts list and bottom parts list. For each mid parts, count the number of top parts which is smaller than the mid parts, and count the number of the bottom parts which is bigger than the mid parts. I used bisect module to get the respective index.