• Cow and Exercise

    Farmer John is obsessed with making Bessie exercise more! Bessie is out grazing on the farm, which consists of $$$n$$$ fields connected by $$$m$$$ directed […]

  • Cow and Vacation

    Bessie is planning a vacation! In Cow-lifornia, there are $$$n$$$ cities, with $$$n-1$$$ bidirectional roads connecting them. It is guaranteed that one can reach any […]

  • Two Regular Polygons

    You are given two integers $$$n$$$ and $$$m$$$ ($$$m < n$$$). Consider a convex regular polygon of $$$n$$$ vertices. Recall that a regular polygon is a polygon […]

  • Bogosort

    You are given an array $$$a_1, a_2, \dots , a_n$$$. Array is good if for each pair of indexes $$$i < j$$$ the condition $$$j […]

  • Adding Powers

    Suppose you are performing the following algorithm. There is an array $$$v_1, v_2, \dots, v_n$$$ filled with zeroes at start. The following operation is applied […]

  • Count the Arrays

    Your task is to calculate the number of arrays such that: each array contains $$$n$$$ elements; each element is an integer from $$$1$$$ to $$$m$$$; […]