BACD Pattern (bacd)

48 teams scored 1680 points on this task, for a maximum score of 60, an average score of 35 and a median score of 30.

Highlights

  1. Scuola Internazionale H-Farm Venice, Roncade is the institute with the most points (90).
  2. Lombardia is the region with the most points (450).

Statement

Given a permutation P = [P_0, P_1, …, P_N-1] of length N, count the number of tuples 0 ≤ a < b < c < d < N, where P_b < P_a < P_c < P_d. Since the answer can be large, print its remainder modulo 10^9 + 7.