A. The Brand New Function time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarpus has a sequence, consisting of n non-negative integers: a1, a2, ..., an. Let's define function f(l, r) (…