Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Kingdom of Crisis Continues

By TarifEzaz · Limits 1s, 512 MB

The economic crisis continues in our beloved kingdom. The king has asked the data scientists to collect the data of each inhabitant of the kingdom. The king's goal is to initiate some transactions among the inhabitants so that the crisis is mitigated.

But collecting data is itself a costly piece of work. Thus, the data scientists have decided to generate some data and run simulations on them. Initially, they would like to consider a simple model in which N\textbf N inhabitants are labelled from 1\textbf 1 to N\textbf N and the ithi^{th} individual will have i\textbf i amount of money. Your task is to decide whether it would be possible to distribute the wealth equally across the kingdom if any person in the kingdom can make transactions with any other person in the kingdom. A person can make as many transactions as he wants to others.


The only line of input will have an integer N\textbf N (1N1018)(1\leq N \leq 10^{18}), the number of inhabitants in the kingdom.


For each of the cases, output Yes, if it is possible to distribute the money equally, or No otherwise.



Since the kingdom has only one person, we will get all the wealth he has.



83% Solution Ratio

dream_playerEarliest, 11M ago

hriday_kumarFastest, 0.0s

ashraful9194Lightest, 0 B

mdvirusShortest, 34B


Login to submit


It is not possible to save the summation of the first N positive integers if N is very close to 64-b...

Related Contests

Toph uses cookies. By continuing you agree to our Cookie Policy.