Official algorithmic problem description and constraints.
Eren, Mikasa, and Armin are playing a game with an array A of length N to get FREEDOM.
Eren can select any indices i and j such that 1β€i<jβ€N.
Let a,b, and c denote the points of Eren, Mikasa, and Armin respectively, where:
Eren, Mikasa and Armin will get FREEDOM if the values of a,b, and c form an arithmetic progression.
The task is to count the number of ways Eren can select pairs (i,j) such that they get FREEDOM.
Detailed video explanations, mathematical intuition, and clean C++ implementation code.