tests dict | problem stringlengths 29 13k |
|---|---|
{
"inputs": [
"2\n4 2\n",
"8\n1 2 4 8 16 32 64 576\n",
"2\n370881 659345\n",
"5\n804610 765625 2916 381050 93025\n",
"1\n-1000000\n",
"2\n-1 0\n",
"2\n99999 3\n",
"53\n280988 756430 -515570 -248578 170649 -21608 642677 216770 827291 589500 940901 216097 -118956 -919104 -319264 -761585 ... | Given an array a1, a2, ..., an of n integers, find the largest number in the array that is not a perfect square.
A number x is said to be a perfect square if there exists an integer y such that x = y2.
Input
The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of elements in the array.
The second ... |
{
"inputs": [
"5 4 10\n4 3 1\n6 4 3\n3 2 4\n2 2 1\n8 5 3\n1 2\n2 3\n3 4\n4 5\n3 3 1000\n1000 1 100\n1 7 100\n10 9 100\n1 2\n2 3\n3 2\n1 0 5\n25 25 2\n1 0 25\n25 25 2\n5 5 100\n1 1 20\n1 1 20\n10 1 1\n10 1 1\n10 1 1\n1 2\n2 1\n3 4\n4 5\n5 3\n3 3 100\n70 20 10\n50 15 20\n90 10 10\n1 2\n2 2\n2 3\n0 0 0",
"5 4 10... | Problem Statement
You want to compete in ICPC (Internet Contest of Point Collection). In this contest, we move around in $N$ websites, numbered $1$ through $N$, within a time limit and collect points as many as possible. We can start and end on any website.
There are $M$ links between the websites, and we can move be... |
{
"inputs": [
"2\n0 1\n1 0\n",
"5\n0 2 2 1 2\n2 0 4 1 3\n2 4 0 1 3\n1 1 1 0 1\n2 3 3 1 0\n",
"10\n0 1 5 2 5 3 4 5 5 5\n1 0 1 1 1 1 1 1 1 1\n5 1 0 2 6 3 4 6 6 6\n2 1 2 0 2 2 2 2 2 2\n5 1 6 2 0 3 4 8 8 7\n3 1 3 2 3 0 3 3 3 3\n4 1 4 2 4 3 0 4 4 4\n5 1 6 2 8 3 4 0 9 7\n5 1 6 2 8 3 4 9 0 7\n5 1 6 2 7 3 4 7 7 0... | Bob has a permutation of integers from 1 to n. Denote this permutation as p. The i-th element of p will be denoted as pi. For all pairs of distinct integers i, j between 1 and n, he wrote the number ai, j = min(pi, pj). He writes ai, i = 0 for all integer i from 1 to n.
Bob gave you all the values of ai, j that he wro... |
{
"inputs": [
"3\n8\n1 4 8 4 5 6 3 8\n16\n2 1 3 3 4 3 4 4 1 3 2 2 2 4 1 1\n9\n2 2 4 4 4 7 7 7 7\n",
"3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1\n",
"3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 ... | This problem is actually a subproblem of problem G from the same contest.
There are n candies in a candy box. The type of the i-th candy is a_i (1 ≤ a_i ≤ n).
You have to prepare a gift using some of these candies with the following restriction: the numbers of candies of each type presented in a gift should be all di... |
{
"inputs": [
"8 5\n1 2 2 3 3 2 3 3\n1 2\n1 5\n2 3\n2 4\n5 6\n5 7\n5 8\n1 2\n1 3\n1 4\n2 3\n5 3\n",
"4 1\n1 2 3 4\n1 2\n2 3\n3 4\n1 1\n",
"4 1\n1 4 3 4\n1 2\n2 3\n3 4\n1 1\n",
"4 1\n1 4 6 7\n1 2\n2 3\n3 4\n1 1\n",
"8 5\n1 2 2 3 3 2 3 3\n1 2\n1 5\n2 3\n2 4\n5 6\n5 7\n5 8\n1 3\n1 3\n1 4\n2 3\n5 3\n"... | You have a rooted tree consisting of n vertices. Each vertex of the tree has some color. We will assume that the tree vertices are numbered by integers from 1 to n. Then we represent the color of vertex v as cv. The tree root is a vertex with number 1.
In this problem you need to answer to m queries. Each query is des... |
{
"inputs": [
"10 2\n2 3 1\n3 5 1",
"1 0",
"10 3\n2 2 1\n4 2 1\n8 1 1",
"10 2\n2 3 1\n1 5 1",
"10 2\n2 3 1\n1 5 0",
"10 0\n2 3 1\n1 5 1",
"18 0\n2 3 1\n1 5 1",
"0 0\n2 -1 1\n0 1 1",
"1 0\n2 0 2\n1 2 1",
"2 1\n1 0 7\n4 -1 0",
"10 3\n2 0 1\n4 2 1\n8 1 1",
"34 0\n2 3 1\n1 ... | Problem
Aizu Magic School is a school where people who can use magic gather. Haruka, one of the students of that school, can use the magic of warp on the magic team.
From her house to the school, there is a straight road of length L. There are also magic circles on this road.
She uses this road every day to go to sch... |
{
"inputs": [
"3 5 1 2\n0\n4\n1\n8\n1 2 2\n1 1 -2\n2 3 5\n1 2 -1\n1 3 5",
"3 5 1 2\n0\n4\n1\n8\n1 2 2\n1 1 -2\n2 3 5\n1 2 -1\n1 2 5",
"3 5 1 2\n0\n4\n1\n8\n1 2 2\n1 1 -3\n2 3 5\n1 2 -1\n1 2 5",
"3 5 1 2\n0\n4\n1\n8\n2 2 2\n1 1 -3\n2 3 5\n1 2 -1\n1 2 5",
"3 5 1 2\n0\n4\n1\n8\n2 2 2\n1 1 -3\n2 1 5\n... | In the Kingdom of IOI, the wind always blows from sea to land. There are $N + 1$ spots numbered from $0$ to $N$. The wind from Spot $0$ to Spot $N$ in order. Mr. JOI has a house at Spot $N$. The altitude of Spot $0$ is $A_0 = 0$, and the altitude of Spot $i$ ($1 \leq i \leq N$) is $A_i$.
The wind blows on the surface ... |
{
"inputs": [
"3\n3\n1\n2",
"3\n0\n1\n2",
"3\n0\n0\n2",
"3\n0\n-1\n3",
"3\n0\n-2\n3",
"3\n0\n-2\n5",
"3\n0\n0\n5",
"3\n0\n-1\n0",
"3\n0\n-1\n1",
"3\n1\n0\n2",
"3\n1\n0\n4",
"3\n1\n0\n8",
"3\n2\n0\n8",
"3\n4\n-1\n8",
"3\n4\n-1\n15",
"3\n5\n-1\n15",
"3... | For Turbo C++ Users : Read the following document before attempting the question :
Problem Description
First question is easy to set you up with the online judge. You are given a number 'N'. You need to find the sum of first N terms of the series: 1 - 2 + 3 - 4 + 5 - 6 ...
Input
First line contains T, the number ... |
{
"inputs": [
"2\n3\n3 2 1\n6\n3 1 4 1 5 9\n",
"1\n5\n1 3 4 5 2\n",
"1\n3\n1 1 274005660\n",
"4\n7\n6 6 8 8 6 6 6\n1\n2\n5\n4 5 9 8 7\n7\n1 2 7 1 6 10 2\n",
"2\n3\n1 1 1\n2\n1 1\n",
"2\n2\n1 1\n1\n1\n",
"2\n5\n5 5 5 5 5\n3\n1 2 5\n",
"2\n5\n1 2 3 4 5\n4\n2 3 4 5\n",
"2\n4\n1 3 3 3\... | Ehab has an array a of length n. He has just enough free time to make a new array consisting of n copies of the old array, written back-to-back. What will be the length of the new array's longest increasing subsequence?
A sequence a is a subsequence of an array b if a can be obtained from b by deletion of several (pos... |
{
"inputs": [
"3\n32\n100\n9085\n\nSAMPLE",
"1000\n999001\n999002\n999003\n999004\n999005\n999006\n999007\n999008\n999009\n999010\n999011\n999012\n999013\n999014\n999015\n999016\n999017\n999018\n999019\n999020\n999021\n999022\n999023\n999024\n999025\n999026\n999027\n999028\n999029\n999030\n999031\n999032\n999... | Surya loves to play with primes. One day, he asked his friend don to print any number in the form of multiple of prime factors. Help don in solving the problem.
Input
The first line will contain an integer t (1 ≤ t ≤ 10^6) denoting number of test case.
For each test case, you will be given an integer n (2 ≤ n ≤ 10^6... |
{
"inputs": [
"4 6\n0 1 1\n0 2 -5\n1 2 2\n1 3 4\n2 3 1\n3 2 7",
"4 6\n0 1 1\n0 2 5\n1 2 2\n1 3 4\n2 3 1\n3 2 -7",
"4 6\n0 1 1\n0 2 5\n1 2 2\n1 3 4\n2 3 1\n3 2 7",
"4 6\n0 1 1\n0 2 5\n1 2 2\n1 3 8\n2 3 1\n3 2 -7",
"4 6\n0 1 1\n0 3 -5\n1 2 2\n1 3 4\n2 3 1\n3 2 7",
"4 6\n0 1 1\n0 2 5\n1 2 3\n1 3 ... | Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 9900
* -2 × 107 ≤ di ≤ 2 × 107
* There are no parallel edges
* There are no self-loops
Input
An edge-weighted graph G (V, E).
|V| |E|
s0 t0 d0
s1 t1 d1
:
s|E|-1 t|E|-1 d|E|-1
|V| is the number of vertices and |E| is the number of edges in G. The graph vertices are named wi... |
{
"inputs": [
"6\n5 11 44\n",
"6\n314 1592 6535\n",
"2\n9900\n",
"4\n35 15\n",
"82\n24 192 896 1568 2907 4840 7475 9775 11109 29939 22475 45951 46552 36859 66787 106329 85211 94423 65627 147436 143259 128699 139277 167743 178063 192167 150133 162719 177103 160732 139859 157301 176681 199291 152867... | Chouti is working on a strange math problem.
There was a sequence of n positive integers x_1, x_2, …, x_n, where n is even. The sequence was very special, namely for every integer t from 1 to n, x_1+x_2+...+x_t is a square of some integer number (that is, a [perfect square](https://en.wikipedia.org/wiki/Square_number)... |
{
"inputs": [
"3 2\n1 2\n1 1\n",
"3 3\n1 3\n2 3\n1 3\n",
"2 1\n2 1\n",
"7 3\n4 4\n5 4\n2 4\n",
"10 3\n7 10\n8 7\n5 5\n",
"2 2\n1 2\n2 2\n",
"2 1\n2 2\n",
"100 50\n11 28\n11 1\n98 58\n38 27\n24 27\n67 37\n90 48\n91 14\n43 29\n3 64\n24 6\n53 19\n97 65\n13 27\n75 53\n37 82\n69 75\n94 99\n... | The employees of the F company have lots of ways to entertain themselves. Today they invited a famous magician who shows a trick with plastic cups and a marble.
The point is to trick the spectator's attention. Initially, the spectator stands in front of a line of n plastic cups. Then the magician places a small marble... |
{
"inputs": [
"3 2",
"0 2",
"1 2",
"5 2",
"-1 2",
"1 3",
"5 3",
"1 5",
"2 3",
"1 1",
"4 2",
"-1 1",
"-2 1",
"2 6",
"7 2",
"-3 2",
"8 3",
"1 9",
"-1 3",
"2 5",
"-1 4",
"4 1",
"-2 4",
"3 6",
"11 2",
"13 3",
"-1 5... | Write a program which reads two integers a and b, and calculates the following values:
* a ÷ b: d (in integer)
* remainder of a ÷ b: r (in integer)
* a ÷ b: f (in real number)
Constraints
* 1 ≤ a, b ≤ 109
Input
Two integers a and b are given in a line.
Output
Print d, r and f separated by a space in a line. For ... |
{
"inputs": [
"2 1\nhackerearth 10\nhackerrank 9\nhacker\n\nSAMPLE",
"2 1\nhackerearth 10\nhackerrank 11\nhacker\n\nSAMPLE",
"2 1\nhackerearth 10\nhackerrank 20\nhacker\n\nSAMPLE",
"2 1\nhackerearth 10\nhackerrank 20\nhadker\n\nSAMPLE",
"1 2\nhackdrearth 10\nhackerranl 27\neadkhr\n\nSAMPLE",
"... | Let us see how search engines work. Consider the following simple auto complete feature. When you type some characters in the text bar, the engine automatically gives best matching options among it's database. Your job is simple. Given an incomplete search text, output the best search result.
Each entry in engine's da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.