Company: Flipkart_26july
Difficulty: medium
Energy Transfer in Battle of the Band Problem Description Murat and Hayat are playing an online game called "Battle of the Band", each with their own army. Every soldier has an energy level. Midway through the game Hayat's army grows weak, and Murat uses a special power that transfers energy between the soldiers of his own army. Energy can only be transferred between soldiers standing S positions apart. Murat's soldiers are numbered 0, 1, 2, ..., N-1 in the order they are given in the input, so the soldiers at positions r, r+S, r+2S, ... all share energy with one another and form a single sharing group . Every position belongs to exactly one sharing group, so there are exactly S groups, one for each r = 0, 1, ..., S-1 . For a sharing group let K be the number of soldiers in it and let Se be the total energy of those soldiers. The group succeeds if Se can be written as a sum of exactly K prime numbers. The primes need not be different from one another. If every sharing group succeeds, t