620A - Professor GukiZ's Robot
Easy to see that the answer is max(|x1 - x2|, |y1 - y2|).
Complexity: O(1).
620B - Grandfather Dovlet’s calculator
Let's simply iterate over all the values from a to b and add to the answer the number of segment of the current value x. To count the number of segments we should iterate over all the digits of the number x and add to the answer the number of segments of the current digit d. These values can be calculated by the image from the problem statement and stored in some array in code.
Complexity: O((b - a)logb).