name stringlengths 2 82 | description stringlengths 42 10.5k | private_tests dict | public_tests dict | generated_tests dict |
|---|---|---|---|---|
saarc07 | Problem description.
Tic-tac-toe is the third most popular activity to kill a lazy afternoon in Ardenia.Arthum and Breece are not fans of this game, but their mother told them to play, so they sit at a 5 x 5 board. Both have a large pile of marbles: marbles of Arthum have an A written on them and that of Breece have a ... | {
"input": [],
"output": []
} | {
"input": [
"2\nAABBA\nBAAAB\nAAABA\nABAAB\nBAAAB\nAAAAA\nAAAAA\nBAAAA\nABAAA\nAABAA"
],
"output": [
"A wins\ndraw"
]
} | {
"input": [],
"output": []
} |
manish-playning-with-bits | Manish like to play with bits, so he was recently gifted with a puzzle book on bits arithmetic by one of his friend on his birthday.
Manish couldn't solve any of the puzzles from the book and needs your help to solve one.
Given two integers m & n .Find the number of combinations of bit-size 'n' in which there are no '... | {
"input": [
"6\n2 3\n2 2\n2 4\n3 3\n3 5\n3 8"
],
"output": [
"5\n3\n8\n7\n24\n149"
]
} | {
"input": [
"1\n2 3\n\nSAMPLE"
],
"output": [
"5"
]
} | {
"input": [],
"output": []
} |
p00733 Dr. Podboq or: How We Became Asymmetric | After long studying how embryos of organisms become asymmetric during their development, Dr. Podboq, a famous biologist, has reached his new hypothesis. Dr. Podboq is now preparing a poster for the coming academic conference, which shows a tree representing the development process of an embryo through repeated cell div... | {
"input": [],
"output": []
} | {
"input": [
"(((x x) x) ((x x) (x (x x))))\n(((x x) (x x)) ((x x) ((x x) (x x))))\n(((x x) ((x x) x)) (((x (x x)) x) (x x)))\n(((x x) x) ((x x) (((((x x) x) x) x) x)))\n(((x x) x) ((x (x x)) (x (x x))))\n((((x (x x)) x) (x ((x x) x))) ((x (x x)) (x x)))\n((((x x) x) ((x x) (x (x x)))) (((x x) (x x)) ((x x) ((x x... | {
"input": [],
"output": []
} |
amr15c | The Kalakeyas were a powerful, ferocious and cruel clan of Danavas. They were known to be really strong and they did not have any war strategy. They would just attack the enemy randomly and overpower them with sheer number of soldiers. However, we all know that Baahubali and Bhallaladeva defeated the Kalakeyas by follo... | {
"input": [],
"output": []
} | {
"input": [
"3\n2 2\n3 0\n3 1"
],
"output": [
"-1\n1 2 3\n2 3 1"
]
} | {
"input": [],
"output": []
} |
1346_D. Constructing the Dungeon | Polycarp is developing an RPG game where the main character fights monsters and searches for treasure in dungeons. Now Polycarp is making one of the dungeons the character can explore.
The dungeon consists of n rooms connected by m two-way tunnels, and it is possible to reach every room from every other room using tun... | {
"input": [],
"output": []
} | {
"input": [
"3\n3 2\n1 2 1\n2 3 1\n5 7\n3 2 7\n3 4 9\n1 5 5\n1 2 5\n4 1 5\n4 2 7\n3 1 5\n4 4\n1 2 5\n3 2 2\n4 1 3\n3 4 4\n"
],
"output": [
"\nYES\n1 1 1\nYES\n5 7 9 9 5\nNO\n"
]
} | {
"input": [],
"output": []
} |
1505_A. Is it rated - 2 |
Interaction
This is an interactive problem. You need to read participants' queries from standard input and print your responses to standard output. You don't know the number of queries upfront, so you'll need to process them as you get them; you'll know you're done once you reach the end of the file.
In each query,... | {
"input": [
"Is it rated?\nIs it rated?\nIs it rated?\n"
],
"output": [
"Correct!"
]
} | {
"input": [
"Is it rated?\nIs it rated?\nIs it rated?\n"
],
"output": [
"\nNO\nNO\nNO"
]
} | {
"input": [],
"output": []
} |
345_G. Suffix Subgroup | You are given a group of n strings: s1, s2, ..., sn.
You should find a subgroup si1, si2, ..., sik (1 ≤ i1 < i2 < ... < ik ≤ n) of the group. The following two conditions must hold:
* there exists a string t such, that each string from found subgroup is its suffix;
* the number of strings in the found subgroup i... | {
"input": [],
"output": []
} | {
"input": [
"6\nbb\nbb\nb\naaa\naa\nz\n"
],
"output": [
"3\n"
]
} | {
"input": [],
"output": []
} |
crazy-kangaroo | Little Jhool is a world renowned kangaroo trainer. He's now living in Australia, and is training kangaroos for his research project on mobile soccer. (We don't know the connection, too.) Anyway, for the project to be completed he observes kangaroos for a lot of time - because he wants to figure out the hop count for v... | {
"input": [
"1000\n99617 152603 778\n99085 150178 336\n99614 152906 650\n99579 150491 28\n99310 149769 764\n99074 152164 427\n99828 153414 212\n99632 153249 430\n99218 151498 863\n99877 153644 136\n99071 151423 23\n99942 151611 168\n99607 153863 12\n99958 150687 374\n99579 150048 785\n99463 150911 325\n99685 150... | {
"input": [
"3\n1 10 2\n5 10 3\n7 9 5SAMPLE"
],
"output": [
"5\n2\n0"
]
} | {
"input": [],
"output": []
} |
micro-and-minmax | Micro is a big fan of the famous competitive programmer Gennady Korotkevich, known by his handle tourist. He wants to be like him. He has been practising hard but is not reaching anywhere. So he has left his fate to one game he has, called MinMax. The game consists of an array A of N integers. If the difference between... | {
"input": [],
"output": []
} | {
"input": [
"1\n5\n1 2 3 4 5\n\nSAMPLE"
],
"output": [
"No"
]
} | {
"input": [],
"output": []
} |
p03394 AtCoder Grand Contest 022 - GCD Sequence | Nagase is a top student in high school. One day, she's analyzing some properties of special sets of positive integers.
She thinks that a set S = \\{a_{1}, a_{2}, ..., a_{N}\\} of distinct positive integers is called special if for all 1 \leq i \leq N, the gcd (greatest common divisor) of a_{i} and the sum of the remai... | {
"input": [],
"output": []
} | {
"input": [
"3",
"4"
],
"output": [
"2 5 63",
"2 5 20 63"
]
} | {
"input": [],
"output": []
} |
cn01 | So, you are bored and you think about playing a game. The game is like, if you win your money will be
doubled and eleven dollars extra will be added to it. If you lose, your money will be halved (if the
amount is odd, it will be halved to the upper integer). The inital amount of money you have is 'X'. A
sequence of ... | {
"input": [],
"output": []
} | {
"input": [
"23\nLWLW",
"51\nL"
],
"output": [
"47",
"26"
]
} | {
"input": [],
"output": []
} |
1147_F. Zigzag Game | You are given a complete bipartite graph with 2n nodes, with n nodes on each side of the bipartition. Nodes 1 through n are on one side of the bipartition, and nodes n+1 to 2n are on the other side. You are also given an n × n matrix a describing the edge weights. a_{ij} denotes the weight of the edge between nodes i a... | {
"input": [
"1\n2\n1 2\n3 4\n"
],
"output": [
"player won game 1!\n"
]
} | {
"input": [
"2\n3\n3 1 9\n2 5 7\n6 4 8\n6\n-1\n1\n1\nI 1\n-1"
],
"output": [
"B\nB\n2\n"
]
} | {
"input": [],
"output": []
} |
1249_B2. Books Exchange (hard version) | The only difference between easy and hard versions is constraints.
There are n kids, each of them is reading a unique book. At the end of any day, the i-th kid will give his book to the p_i-th kid (in case of i = p_i the kid will give his book to himself). It is guaranteed that all values of p_i are distinct integers ... | {
"input": [
"20\n6\n3 6 4 2 5 1\n6\n2 4 1 3 5 6\n7\n5 2 1 4 6 7 3\n6\n3 6 4 2 5 1\n9\n5 8 2 6 4 7 9 1 3\n9\n3 2 6 8 5 7 9 1 4\n8\n8 4 6 5 2 1 7 3\n5\n3 1 2 5 4\n10\n2 4 3 5 6 10 7 9 1 8\n2\n2 1\n1\n1\n5\n3 2 5 4 1\n3\n1 3 2\n8\n2 6 5 3 7 1 4 8\n5\n3 5 4 1 2\n4\n1 4 3 2\n5\n5 1 4 3 2\n4\n4 1 3 2\n1\n1\n7\n3 1 5 2... | {
"input": [
"6\n5\n1 2 3 4 5\n3\n2 3 1\n6\n4 6 2 1 5 3\n1\n1\n4\n3 4 1 2\n5\n5 1 2 4 3\n"
],
"output": [
"1 1 1 1 1 \n3 3 3 \n2 3 3 2 1 3 \n1 \n2 2 2 2 \n4 4 4 1 4 \n"
]
} | {
"input": [],
"output": []
} |
130_I. Array sorting | Sorting arrays is traditionally associated with high-level languages. How hard can it be in Befunge? Sort the given array in non-descending order.
Input
The first line of input contains an integer n (1 ≤ n ≤ 100) — the size of the array. The following n lines contain the elements of the array, one per line. Each elem... | {
"input": [],
"output": []
} | {
"input": [
"5\n7\n1\n9\n7\n3\n",
"10\n60\n1\n60\n1\n60\n1\n60\n1\n60\n1\n"
],
"output": [
"1 3 7 7 9 \n",
"1 1 1 1 1 60 60 60 60 60 \n"
]
} | {
"input": [],
"output": []
} |
1372_E. Omkar and Last Floor | Omkar is building a house. He wants to decide how to make the floor plan for the last floor.
Omkar's floor starts out as n rows of m zeros (1 ≤ n,m ≤ 100). Every row is divided into intervals such that every 0 in the row is in exactly 1 interval. For every interval for every row, Omkar can change exactly one of the 0s... | {
"input": [
"7 8\n1\n1 8\n2\n1 5\n6 8\n4\n1 1\n2 2\n3 4\n5 8\n4\n1 3\n4 4\n5 5\n6 8\n2\n1 7\n8 8\n2\n1 6\n7 8\n3\n1 1\n2 2\n3 8\n",
"3 3\n3\n1 1\n2 2\n3 3\n3\n1 1\n2 2\n3 3\n3\n1 1\n2 2\n3 3\n",
"1 100\n10\n1 3\n4 10\n11 17\n18 48\n49 54\n55 56\n57 59\n60 61\n62 81\n82 100\n",
"21 16\n6\n1 7\n8 8\n9 ... | {
"input": [
"4 5\n2\n1 2\n3 5\n2\n1 3\n4 5\n3\n1 1\n2 4\n5 5\n3\n1 1\n2 2\n3 5\n"
],
"output": [
"36\n"
]
} | {
"input": [],
"output": []
} |
661_A. Lazy Caterer Sequence | Lazy caterer sequence is defined as the maximum number of pieces formed when slicing a convex pancake with n cuts (each cut is a straight line). The formula is Cn = n·(n + 1) / 2 + 1. You are given n; calculate n-th element of the sequence.
Input
The only line of the input contains an integer n (0 ≤ n ≤ 100).
Output... | {
"input": [],
"output": []
} | {
"input": [
"2\n",
"5\n"
],
"output": [
"4\n",
"16\n"
]
} | {
"input": [],
"output": []
} |
72_F. Oil | After the nationalization of the oil industry, Dr. Mosaddegh wants to dig some oil wells to extract all the oil in Persian Gulf. But Persian Gulf is huge and has an infinite amount of oil. So Dr. Mosaddegh works only on a rectangular plane of size n × m of the Persian Gulf. Each of the cells in this rectangle either co... | {
"input": [],
"output": []
} | {
"input": [
"2 3\n1 2\n1 2\n",
"4 4\n2 2 3\n3 2 3 1\n",
"2 3\n1 1\n0\n"
],
"output": [
"2\n",
"2\n",
"1\n"
]
} | {
"input": [],
"output": []
} |
aran05 | Now that we have recovered all our data, we can return to hacking in to the hacker's system. Our sources tell us that this hacker's lust for power is so great that it is reflected in everything he does, everything he creates. Perhaps this knowledge can become his weakness in our hands, his thirst for power laying a tra... | {
"input": [],
"output": []
} | {
"input": [
"3\naranya\nreverse\ngear"
],
"output": [
"124\n252\n159"
]
} | {
"input": [],
"output": []
} |
cipher | Pakistan Team is obsessed with match fixing. Their bookie Asif is writing a letter to them and wants nobody else to be able to read it. They use a simple substitution cipher to encode his message. Each letter in the message is replaced with its corresponding letter in a substitution alphabet. A substitution alphabet is... | {
"input": [],
"output": []
} | {
"input": [
"2\nhello\nsachin"
],
"output": [
"abccd\nabcdef"
]
} | {
"input": [],
"output": []
} |
162_D. Remove digits | You are given a string. Remove all digits from it. When a character is removed from a string, all characters to the right of it are shifted one position to the left.
Input
The only line of input contains a string between 1 and 100 characters long. Each character of the string has ASCII-code between 33 (exclamation ma... | {
"input": [],
"output": []
} | {
"input": [
"VK-Cup-2012!\n",
"Go,Codeforces!\n"
],
"output": [
"VK-Cup-!\n",
"Go,Codeforces!\n"
]
} | {
"input": [],
"output": []
} |
254_A. Cards with Numbers | Petya has got 2n cards, each card contains some integer. The numbers on the cards can be the same. Let's index all cards by consecutive integers from 1 to 2n. We'll denote the number that is written on a card with number i, as ai. In order to play one entertaining game with his friends, Petya needs to split the cards i... | {
"input": [
"5\n3 3 1 1 1 3 2 3 1 2\n",
"100\n6 3 6 8 8 4 3 7 10 3 1 3 9 5 10 10 6 7 6 6 2 3 8 8 7 6 4 9 6 7 4 4 10 4 7 3 2 7 10 8 6 7 9 1 3 5 3 7 9 1 1 7 1 1 7 7 8 3 2 7 4 8 7 8 10 3 1 7 2 7 9 8 8 8 5 2 8 1 2 7 8 7 8 8 5 10 10 4 9 10 8 7 8 8 7 7 3 6 4 3 4 8 10 8 6 3 7 1 8 6 3 3 7 10 3 9 3 5 10 9 9 2 8 7 2 3... | {
"input": [
"3\n20 30 10 30 20 10\n",
"1\n1 2\n"
],
"output": [
"4 2\n1 5\n6 3\n",
"-1"
]
} | {
"input": [],
"output": []
} |
k-arrays | Milly is feeling bored during her winter vaccations, so she has decided to do some random fun on some arrays. She will take K number of arrays of same same size N. She will make all possible non-empty subsets of these arrays. She will make a Set S made up of the same-sized subsets of these arrays while considering the ... | {
"input": [],
"output": []
} | {
"input": [
"1\n2 2\n1 2\n3 4\n\nSAMPLE"
],
"output": [
"8 3"
]
} | {
"input": [],
"output": []
} |
rk-string | Today RK wants to play a game based on his awesome name.In this game RK gives you a string consists only of characters "R" and "K".Your task is to find the number of substrings of the given string, containing exactly M characters "R" and number of substrings containing exactly N characters "K".
Note : String a1 is a s... | {
"input": [
"9\n1 2\nKK\n1 3\nKR\n1 123\nRK\n1 0\nRR\n2 22\nKK\n2 120\nKR\n2 1\nRK\n2 0\nRR\n94 9\nRRRRRRRRRRRRKRKRRRRKKRRRRRRRRRRRRKRRKRRRRRRRRKRRRRRRRRRRRKRRRRRRRRRRRRRRRKRRRRRKRRRRRRKRRRKRRRRRRRRRRKKRRRRRRRRKKRRRRRKRRRR"
],
"output": [
"0 1\n2 0\n2 0\n2 3\n0 0\n0 0\n0 2\n1 3\n17 324"
]
} | {
"input": [
"2\n1 1\nRKRK\n2 1\nKRKRK\n\nSAMPLE"
],
"output": [
"6 6\n4 8"
]
} | {
"input": [],
"output": []
} |
troublesome-children | Description
IIT Gandhinagar has a day-care centre for the children of its faculty and staff. As it is IIT Gandhinagar’s culture to do things differently, the morning roll-call here is
conducted in a unique manner.
The kids stand in a circle and the teacher proceeds around the circle clockwise,
spelling each name on th... | {
"input": [
"3\n3\n4\n5"
],
"output": [
"3\n2\n1"
]
} | {
"input": [],
"output": []
} | {
"input": [],
"output": []
} |
equatio | x*y = a + b*lcm(x,y) + c*gcd(x,y)
It's easy: you are to write a program which for given a, b and c finds the number of pairs of positive integers (x, y) satisfying this equation.
Here * stands for multiplication, gcd(x,y) stands for the greatest common divisor of x and y, while lcm(x,y) stands for the least common mul... | {
"input": [],
"output": []
} | {
"input": [
"3\n2 1 1\n160 0 90\n300 7 5"
],
"output": [
"2\n8\n4"
]
} | {
"input": [],
"output": []
} |
kokt03 | Daenerys Targaryen has been suggested by her counselors to leave the Meereen and start conquering other parts of the world. But she knows giving up on the people of Meereen means victory of slavery. Her plan is to start conquering rest of the world while she remains in Meereen. She can only trust her bravest and most b... | {
"input": [],
"output": []
} | {
"input": [
"3\n5 3\n1 2 3 4 5\n6 2\n4 4 4 4 4 4\n7 4 \n10 10 10 10 50 60 70"
],
"output": [
"VICTORY\nVICTORY\nDEFEAT"
]
} | {
"input": [],
"output": []
} |
sss | Mr. Vallya,the rich playboy billionaire , has recently bought an IPL team Surathkal SuperStars (SSS) . Now he has the challenging task of buying the best possible team in the IPL auction . For this , he is aiming to make a priority order list in which he wants to buy each player .
The total number of players available... | {
"input": [],
"output": []
} | {
"input": [
"3\n2 5\n5 11\n21 71"
],
"output": [
"2\n10\n6"
]
} | {
"input": [],
"output": []
} |
1431_E. Chess Match | The final of Berland Chess Team Championship is going to be held soon. Two teams consisting of n chess players each will compete for first place in the tournament. The skill of the i-th player in the first team is a_i, and the skill of the i-th player in the second team is b_i. The match will be held as follows: each p... | {
"input": [],
"output": []
} | {
"input": [
"4\n4\n1 2 3 4\n1 2 3 4\n2\n1 100\n100 101\n2\n1 100\n50 51\n5\n1 1 1 1 1\n3 3 3 3 3\n"
],
"output": [
"\n3 4 1 2\n1 2\n2 1\n5 4 2 3 1\n"
]
} | {
"input": [],
"output": []
} |
sort-the-array-5 | You have been given an array A of size N and an integer K. This array consists of N integers ranging from 1 to 10^7. Each element in this array is said to have a Special Weight. The special weight of an element a[i] is a[i]\%K.
You now need to sort this array in Non-Increasing order of the weight of each element, i.e ... | {
"input": [],
"output": []
} | {
"input": [
"5 2\n1 2 3 4 5\n\nSAMPLE"
],
"output": [
"1 3 5 2 4"
]
} | {
"input": [],
"output": []
} |
p01042 Sum of Numbers | Problem
There are c cards each with an integer between a and b. When d cards are selected from these c (b-a + 1) cards, the remainder when the sum of the integers written on those cards is e is divided by 1,000,000,007 is calculated. please.
Constraints
The input satisfies the following constraints.
* 1 ≤ a ≤ 1000
... | {
"input": [],
"output": []
} | {
"input": [
"2 5 3 3 11",
"1 2 3 4 100"
],
"output": [
"3",
"0"
]
} | {
"input": [],
"output": []
} |
fbfrw1 | Problem Description
An online quiz is going to be held at NIT Hamirpur. Each student will be given a system which is connected to internet. Although all the systems are connected to same network, there is still varying data transfer speed among them. This can cause pages to load slower on one system than the other. The... | {
"input": [],
"output": []
} | {
"input": [
"5 3\n250 125 330 3000 1000",
"6 6\n2000 2100 3000 1500 1250 3000"
],
"output": [
"330",
"1250"
]
} | {
"input": [],
"output": []
} |
162_E. HQ9+ | HQ9+ is a joke programming language which has only four one-character instructions:
* "H" prints "Hello, World!",
* "Q" prints the whole source code of the program itself (at each call),
* "9" prints the lyrics of "99 Bottles of Beer" song,
* "+" increments the value stored in the internal accumulator.
Ins... | {
"input": [],
"output": []
} | {
"input": [
"Hello!\n",
"VK_Cup_2012!\n"
],
"output": [
"YES\n",
"NO\n"
]
} | {
"input": [],
"output": []
} |
k-distribution | You are given N positive integers A1, A2, ... AN. Find the number of ways to distribute them in 2 groups in such a way that sum of numbers in each group is greater or equal K. The answer can be large so output it modulo 10^9 + 7.
Input
The first line contains two space-separated integers N and K.
The second line conta... | {
"input": [
"100 91019\n6 5 10 9 4 5 4 2 8 10 10 8 6 2 4 2 2 2 9 6 6 9 2 7 7 1 4 7 87301 1 9 7 3 5 3 9 4 10 8 1 5 5 10 8 8 8 9 8 6 9 9 9 2 7 1 9 4 5 5 3 9 9 1 5 1 3 9 2 8 2 3 1 10 6 6 8 2 6 10 3 3 8 5 6 8 10 5 3 3 9 8 5 6 88954 8 3 1 9 1 10",
"100 89\n12 25 27 51 13 56 59 16 14 17 6 4 11 26 23 29 16 19 3 21 ... | {
"input": [
"2 5\n6 6\n\n\nSAMPLE"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} |
road-demolishing | King Tle4Ever just appointed Moron as the new Engineer for his country Time Limit Exceeded. In the country of Time Limit Exceeded there are n cities and there is a direct road between each pair of cities. Now cleaning up these roads costs Tle4Ever a lot of money so he wants to demolish some of the roads but not all for... | {
"input": [],
"output": []
} | {
"input": [
"2\n4 3\n5 3\n\nSAMPLE"
],
"output": [
"2\n4"
]
} | {
"input": [],
"output": []
} |
troubling-triple | A Puzzle is a game, problem, or toy that tests a person's ingenuity. In a puzzle, one is required to put pieces together, in a logical way, in order to arrive at the correct solution of the puzzle. There are different types of puzzles for different ages.Puzzles are often devised as a form of entertainment but they can ... | {
"input": [],
"output": []
} | {
"input": [
"4 42\n3 2 5 7\n\nSAMPLE"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} |
prime | Print sum of prime numbers upto n
Input
n - the number till which sum has to be done.
Output
print sum of primes ≤n.
Example
Input:
5
Output:
10 | {
"input": [],
"output": []
} | {
"input": [
"5"
],
"output": [
"10"
]
} | {
"input": [],
"output": []
} |
661_C. Array Sum | You are given an array of integers. Calculate the sum of its elements.
Input
The i-th line of the input contains an integer ai (0 ≤ a ≤ 1000) — the i-th element of the array. The size of the array is between 1 and 10, inclusive. Note that the size of the array is not given explicitly!
Output
Output a single integer... | {
"input": [
"2 10 4 8 6 12\n",
"3 3\n"
],
"output": [
"8\n",
"0\n"
]
} | {
"input": [
"2\n15\n110\n3\n",
"90\n0\n21\n331\n45\n"
],
"output": [
"130\n",
"487\n"
]
} | {
"input": [],
"output": []
} |
72_H. Reverse It! | The 14th of March was the international day of mathematics, because of number π = 3.1415926...
In the occasion of this day Goofy Nephews Unity Organization (GNU) wants to publish the fastest program in math at 1:59:26 AM.
Now the time is 1:11:11 AM and the project team haven't checked their program yet. Because of s... | {
"input": [],
"output": []
} | {
"input": [
"23\n",
"-032\n",
"01234560\n"
],
"output": [
"32\n",
"-23\n",
"654321\n"
]
} | {
"input": [],
"output": []
} |
p01345 DON'T PANIC! | Arthur is an innocent man who used to live on the Earth. He had lived a really commonplace life, until the day when the Earth was destroyed by aliens, who were not evil invaders but just contractors ordered to build a hyperspace bypass. In the moment when the demolition beams were shot at the Earth by them, Arthur was ... | {
"input": [],
"output": []
} | {
"input": [
"4\n89 0\n0 0\n0 -90\n0 180\n0 90",
"4\n0 0\n10 10\n10 -10\n-10 -10\n-10 10",
"4\n89 0\n0 0\n0 90\n0 180\n0 -90"
],
"output": [
"No",
"Yes",
"Yes"
]
} | {
"input": [],
"output": []
} |
p01515 Equation | Equation
Identity
English text is not available in this practice contest.
In logical operations, only two types of values, T and F, are handled.
Let "-" be a unary operator (a symbol whose input represents one operation) and "*", "+", "->" be a binary operator (a symbol whose input represents two operations). "-" I... | {
"input": [],
"output": []
} | {
"input": [
""
],
"output": [
""
]
} | {
"input": [],
"output": []
} |
gerald08 | Chef has a rooted tree G, consisting of N vertices. Each edge of the tree has a color black or white.
Once Chef's friend Ksen offered Chef to play a game on the tree G. The game has very simple rule:
The players make moves in the game alternately.
On his move Chef deletes a single undeleted black edge. On her move Kse... | {
"input": [],
"output": []
} | {
"input": [
"5\n1\n2\n1 2 0\n2\n1 2 1\n3\n1 2 0\n1 3 1\n3\n1 2 0\n2 3 1"
],
"output": [
"Ksen Chef\nChef Chef\nKsen Ksen\nKsen Chef\nChef Chef"
]
} | {
"input": [],
"output": []
} |
qcj2 | There is a war going on between two countries and the enemy of your country depends heavily on the transportation of Weapons between two strategic points A and B. Point A and point B along with other points (C,D, etc... ) are connected by a network of roads. Disrupting all traffic between points A and B will give your ... | {
"input": [],
"output": []
} | {
"input": [
"AC\nAD\nAE\nCE\nCF\nED\nGF\nBG\nHB\nGH\nEND"
],
"output": [
"CF\nGF"
]
} | {
"input": [],
"output": []
} |
112_E. Petya and Spiders | Little Petya loves training spiders. Petya has a board n × m in size. Each cell of the board initially has a spider sitting on it. After one second Petya chooses a certain action for each spider, and all of them humbly perform its commands. There are 5 possible commands: to stay idle or to move from current cell to som... | {
"input": [
"7 3\n",
"7 1\n",
"4 10\n",
"1 16\n",
"14 1\n",
"9 4\n",
"1 18\n",
"6 3\n",
"1 8\n",
"2 15\n",
"13 1\n",
"27 1\n",
"1 14\n",
"40 1\n",
"10 3\n",
"1 30\n",
"25 1\n",
"10 4\n",
"12 1\n",
"3 11\n",
"32 1\n",
"4 1\n",
... | {
"input": [
"2 3\n",
"1 1\n"
],
"output": [
"4\n",
"0\n"
]
} | {
"input": [],
"output": []
} |
1250_H. Happy Birthday | You have a set of birthday cake candles. Each of such candles represents a digit between 0 and 9, inclusive.
<image> Example of birthday cake candles.
Let's denote the candle representing the digit d as d-candle.
Your set contains c_0 instances of 0-candles, c_1 instances of 1-candles and so on. So, the total number... | {
"input": [],
"output": []
} | {
"input": [
"4\n1 1 1 1 1 1 1 1 1 1\n0 0 1 1 2 2 3 3 4 4\n1 2 1 2 1 3 1 0 0 0\n0 1 2 1 4 3 1 1 2 1\n"
],
"output": [
"\n11\n1\n7\n10\n"
]
} | {
"input": [],
"output": []
} |
cdsw153 | Virat is a guy who likes solving problems very much. Today Virat’s friend Jadega gave him a problem to solve. Jadeja gives Virat three numbers: N, L and R and Virat has to find out the count of numbers between L and R (both inclusive) which are divisible by at least 1 prime number belonging to range 1 to N (inclusive).... | {
"input": [],
"output": []
} | {
"input": [
"2\n6 1 15\n10 17 29"
],
"output": [
"11\n9"
]
} | {
"input": [],
"output": []
} |
cysm | Since the finance department of MAKAUT has lots of bills to pass and funds to allocate for puja and freshers so there is a mess in Finance Officer's office. Although he has numbered all type of files from 0-9, all his files got jumbled up. Aaroti Di however arranged all of them to form a big integer n and presented it ... | {
"input": [],
"output": []
} | {
"input": [
"1\n12\n1"
],
"output": [
"1"
]
} | {
"input": [],
"output": []
} |
rmath | Little Ron of Byteland was poor at mathematics. He always used to get zero marks in mathematics test. One evening when he showed his result to his father, his father scolded him badly. So, he thought if zeroes were not there in this world how good the world would have been. The next day he was given an assignment by hi... | {
"input": [],
"output": []
} | {
"input": [
"1\n205 402"
],
"output": [
"YES"
]
} | {
"input": [],
"output": []
} |
1211_F. kotlinkotlinkotlinkotlin... | Polycarp really likes writing the word "kotlin". He wrote this word several times in a row without spaces. For example, he could write the string like "kotlinkotlinkotlinkotlin".
Polycarp sliced (cut) the written string into n pieces and mixed them. As a result, he has n strings s_1, s_2, ..., s_n and he can arrange t... | {
"input": [],
"output": []
} | {
"input": [
"2\nlin\nkot\n",
"4\nlinkotlinkotlinkotl\nkotlin\nin\nkot\n",
"8\ni\nn\ntlin\no\nko\nt\nk\nl\n"
],
"output": [
"\n2 1 ",
"\n2 4 1 3 ",
"\n7 4 3 5 6 8 1 2 "
]
} | {
"input": [],
"output": []
} |
1297_B. Cartoons | Tanya likes cartoons. She knows that n new cartoons will be released in his favorite cinema: the i-th of them will be airing from the day a_i to the day b_i (1 ≤ a_i ≤ b_i ≤ 10^9).
The cinema has a special offer: there is a huge discount every day when only one cartoon is airing.
Tanya doesn't care which cartoon she ... | {
"input": [],
"output": []
} | {
"input": [
"5\n1\n1 1\n3\n2 1000000000\n2 500000000\n500000002 1000000000\n3\n1 2\n3 4\n1 4\n2\n4 11\n4 9\n3\n1 5\n10 10\n1 5\n"
],
"output": [
"\n1\n500000001\n-1\n10\n10\n"
]
} | {
"input": [],
"output": []
} |
241_G. Challenging Balloons | Martha — as a professional problemsetter — proposed a problem for a world-class contest. This is the problem statement:
Tomorrow is Nadia's birthday, and Bardia (her brother) is assigned to make the balloons ready!
There are n balloons (initially empty) that are tied to a straight line on certain positions x1, x2, ..... | {
"input": [
""
],
"output": [
"302\n0 500000\n24495 300\n25094 299\n25691 298\n26286 297\n26879 296\n27470 295\n28059 294\n28646 293\n29231 292\n29814 291\n30395 290\n30974 289\n31551 288\n32126 287\n32699 286\n33270 285\n33839 284\n34406 283\n34971 282\n35534 281\n36095 280\n36654 279..."
]
} | {
"input": [],
"output": []
} | {
"input": [],
"output": []
} |
290_A. Mysterious strings |
Input
The input contains a single integer a (1 ≤ a ≤ 40).
Output
Output a single string.
Examples
Input
2
Output
Adams
Input
8
Output
Van Buren
Input
29
Output
Harding | {
"input": [
"12\n",
"40\n",
"43\n",
"10\n",
"11\n",
"60\n",
"50\n",
"61\n",
"17\n",
"9\n",
"59\n",
"14\n",
"64\n",
"48\n",
"28\n",
"58\n",
"51\n",
"30\n",
"32\n",
"34\n",
"33\n",
"3\n",
"37\n",
"22\n",
"7\n",
"41\... | {
"input": [
"8\n",
"2\n",
"29\n"
],
"output": [
"Van Buren\n",
"Adams\n",
"Harding\n"
]
} | {
"input": [],
"output": []
} |
bandu-the-saviour | The Bandu of the Hackers' community had a very urgent job to do. He needs to diffuse all the bombs placed by Poker. Poker is extremely clever and cruel. He selected a region of 1000 X 1000 points, chose N center points of the form (X,Y) and placed bombs on every integral point that was on or inside the circular region ... | {
"input": [
"1\n172 686 234"
],
"output": [
"0"
]
} | {
"input": [],
"output": []
} | {
"input": [],
"output": []
} |
p03983 Kyoto University Programming Contest 2016 - Handing out leaflets | Eli- 1 started a part-time job handing out leaflets for N seconds. Eli- 1 wants to hand out as many leaflets as possible with her special ability, Cloning. Eli- gen can perform two kinds of actions below.
* Clone herself and generate Eli- (gen + 1) . (one Eli- gen (cloning) and one Eli- (gen + 1) (cloned) exist as a r... | {
"input": [],
"output": []
} | {
"input": [
"1\n20 3",
"1\n200 1",
"2\n20 8\n20 12"
],
"output": [
"67",
"148322100",
"24\n20"
]
} | {
"input": [],
"output": []
} |
p00988 Fun Region | Fun Region
Dr. Ciel lives in a planar island with a polygonal coastline. She loves strolling on the island along spiral paths. Here, a path is called spiral if both of the following are satisfied.
* The path is a simple planar polyline with no self-intersections.
* At all of its vertices, the line segment directions ... | {
"input": [],
"output": []
} | {
"input": [
"4\n10 0\n20 10\n10 30\n0 10"
],
"output": [
"300.00"
]
} | {
"input": [],
"output": []
} |
p01573 Complex Integer Solutions | Let f(x) = a0 + a1x + a2x2 + ... + adxd be the function where each ai (0 ≤ i ≤ d) is a constant integer (and ad is non-zero) and x is a variable. Your task is to write a program that finds all complex integer solutions of the equation f(x) = 0 for a given f(x). Here, by complex integers, we mean complex numbers whose r... | {
"input": [],
"output": []
} | {
"input": [
"4\n-2 0 0 0 2",
"8\n0 0 25 15 17 -10 1 -1 1"
],
"output": [
"4\n-1 -i i 1",
"5\n-1-2i -1+2i 0 2-i 2+i"
]
} | {
"input": [],
"output": []
} |
p01875 Complex Oracle | D: Complex Oracle --Complex Oracle-
problem
* This problem is a reactive problem. In other words, it is necessary to create a program that derives the correct answer by interactively responding to the program prepared on the server side. Also, since the program on the server side also shares computer resources, the s... | {
"input": [],
"output": []
} | {
"input": [
""
],
"output": [
""
]
} | {
"input": [],
"output": []
} |
p02011 Enlarge Circles | You are given $N$ distinct points on the 2-D plane. For each point, you are going to make a single circle whose center is located at the point. Your task is to maximize the sum of perimeters of these $N$ circles so that circles do not overlap each other. Here, "overlap" means that two circles have a common point which ... | {
"input": [],
"output": []
} | {
"input": [
"9\n91 -18\n13 93\n73 -34\n15 2\n-46 0\n69 -42\n-23 -13\n-87 41\n38 68",
"3\n0 0\n5 0\n0 5",
"3\n0 0\n3 0\n5 0"
],
"output": [
"1049.191683488",
"53.630341225",
"31.415926535"
]
} | {
"input": [],
"output": []
} |
goc203 | Prof. R.K.Vats of NIT Hamirpur has given a problem to the whole class and has imposed a condition that he won't give attendance to those who don't solve it within time. He gave the equation ,
ax+by=c
where a, b, c are three positive integers. The problem is to determine if there exists at least one solution for some in... | {
"input": [],
"output": []
} | {
"input": [
"2\n2 4 8\n3 6 7"
],
"output": [
"Case 1: Yes\nCase 2: No"
]
} | {
"input": [],
"output": []
} |
torr | Problem description.
One day Toretto wanted to make some extra money. We all know his obsession with cars so all he could manage to get hold of, was some information regarding the buying and selling prices of cars for the next N days.
The buying and selling prices for one car on day i are same and equal to Pi where (... | {
"input": [],
"output": []
} | {
"input": [
"3\n2 5\n4 8\n4 100\n10 7 6 4\n4 100\n10 6 7 4"
],
"output": [
"9\n100\n116"
]
} | {
"input": [],
"output": []
} |
1250_L. Divide The Students | A group of students has recently been admitted to the Faculty of Computer Sciences at the Berland State University. Now the programming teacher wants to divide them into three subgroups for practice sessions.
The teacher knows that a lot of programmers argue which language is the best. The teacher doesn't want to hear... | {
"input": [],
"output": []
} | {
"input": [
"5\n3 5 7\n4 8 4\n13 10 13\n1000 1000 1000\n13 22 7\n",
"5\n1 3 4\n1000 1000 1\n4 1 2\n325 226 999\n939 861 505\n"
],
"output": [
"\n5\n6\n13\n1000\n14\n",
"\n3\n667\n3\n517\n769\n"
]
} | {
"input": [],
"output": []
} |
artsy-lulu-1 | Problem Description
Lulu says
"I love triangles. I love the alphabet, too. Today, I am feeling artsy and I want to mix up these two. Write me a program that draws left-aligned triangles using consecutive letters of the alphabet."
Input Format
Each line of input consists of an alphabetic character ch, either in upp... | {
"input": [
"f 1\nA 3\nn 5\nw 7\nv 5"
],
"output": [
"INVALID\n\nA \nB B \nC C C \n\nn \no o \np p p \nq q q q \nr r r r r \n\nINVALID\n\nv \nw w \nx x x \ny y y y \nz z z z z"
]
} | {
"input": [
"f 1\nA 3\nn 5\nw 7\nv 5\n\nSAMPLE"
],
"output": [
"INVALID\n\nA \nB B \nC C C \n\nn \no o \np p p \nq q q q \nr r r r r \n\nINVALID\n\nv \nw w \nx x x \ny y y y \nz z z z z"
]
} | {
"input": [],
"output": []
} |
cn03 | So, as you all know free WiFis are being
installed in our institute.
These are a special
type of WiFi and they start to interfere when
there is a signal coming from two different
WiFis at a single location. The WiFi
installation task is given to you.
There are N suitable locations for the
installation of WiFi. ... | {
"input": [],
"output": []
} | {
"input": [
"5 3\n1\n2\n8\n4\n9"
],
"output": [
"3"
]
} | {
"input": [],
"output": []
} |
pree02 | Problem Statement
You have a number N and you want to calculate how many divisors of N are special.
A number is said to be special if it is possible to remove some digits from it to get a number having 3, 5 or 6 only.For exemple number 38597 is special since it is posible to remove digits 8, 9, 7 to get 35. You can... | {
"input": [],
"output": []
} | {
"input": [
"2\n15\n75"
],
"output": [
"3\n5"
]
} | {
"input": [],
"output": []
} |
130_J. Date calculation | In Gregorian calendar a typical year consists of 365 days and 12 months. The numbers of days in the months are: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. If year index is divisible by 400, or divisible by 4 but not by 100, the year becomes leap year, with one extra day in the second month (the one which typically... | {
"input": [],
"output": []
} | {
"input": [
"2011\n324\n",
"2012\n274\n"
],
"output": [
"20 11\n",
"30 9\n"
]
} | {
"input": [],
"output": []
} |
352_C. Jeff and Rounding | Jeff got 2n real numbers a1, a2, ..., a2n as a birthday present. The boy hates non-integer numbers, so he decided to slightly "adjust" the numbers he's got. Namely, Jeff consecutively executes n operations, each of them goes as follows:
* choose indexes i and j (i ≠ j) that haven't been chosen yet;
* round elemen... | {
"input": [
"10\n8003.867 4368.000 2243.298 3340.000 5384.489 1036.000 3506.115 4463.317 1477.000 2420.314 9391.186 1696.000 5857.833 244.314 8220.000 5879.647 5424.482 2631.000 7111.130 9157.536\n",
"1\n1.100 1.200\n",
"2\n950.000 8019.170 3179.479 9482.963\n",
"3\n673.674 9263.142 6780.000 9801.000... | {
"input": [
"3\n0.000 0.500 0.750 1.000 2.000 3.000\n",
"3\n4469.000 6526.000 4864.000 9356.383 7490.000 995.896\n"
],
"output": [
"0.250\n",
"0.279\n"
]
} | {
"input": [],
"output": []
} |
661_B. Seasons | You are given a name of a month. Output the season of the year to which it belongs (based on Northern hemisphere).
Input
The input consists of a single string containing the name of one of the twelve months (January, February, March, April, May, June, July, August, September, October, November or December). The strin... | {
"input": [],
"output": []
} | {
"input": [
"April\n",
"November\n"
],
"output": [
"spring\n",
"autumn\n"
]
} | {
"input": [],
"output": []
} |
72_G. Fibonacci army | King Cambyses loves Fibonacci numbers. He has several armies. Today he wants to make a new army for himself and he wants the number of men in this army to be the n-th Fibonacci number.
Given n you should find n-th Fibonacci number. The set of Fibonacci numbers start with f0 = f1 = 1 and for each i ≥ 2, fi = fi - 1 + f... | {
"input": [],
"output": []
} | {
"input": [
"2\n",
"1\n"
],
"output": [
"2\n",
"1\n"
]
} | {
"input": [],
"output": []
} |
gcd-game-11 | Life and death, win or lose - both have two sides to each other. And that's what Arjit and Chandu Don are fighting about. They are tired of gang-wars between each other, and thus decide to settle like men in a field, of Mathematics.
But even while going to play the game of Mathematics, they have not given up on their ... | {
"input": [
"1000\n1 1\n42 468\n335 1\n170 225\n479 359\n463 465\n206 146\n282 328\n462 492\n496 443\n328 437\n392 105\n403 154\n293 383\n422 217\n219 396\n448 227\n272 39\n370 413\n168 300\n36 395\n204 312\n323 334\n174 165\n142 212\n254 369\n48 145\n163 258\n38 360\n224 242\n30 279\n317 36\n191 343\n289 107\n4... | {
"input": [],
"output": []
} | {
"input": [],
"output": []
} |
strings-awesomeness | Vivek likes strings a lot but moreover he likes Awesome strings. Vivek calls a string str Awesome if zero or more letters of the string str can be rearranged to form the string "HackerEarth" (case insensitive). For eg : strings HackerEarth , Earthhacker , haeackerrth are all Awesome strings whereas strings HE, Mycareer... | {
"input": [],
"output": []
} | {
"input": [
"HackerEarthhACKEReARTH\n5\n1 11\n2 15\n5 15\n7 20\n7 22\n\nSAMPLE"
],
"output": [
"1\n4\n1\n4\n6"
]
} | {
"input": [],
"output": []
} |
goc202 | Aniket Verma aka Math Bond flaunts his mathematics skill whenever he gets the opportunity. But this time he gets into trouble when he meets Sakshi, another mathematician. Sakshi gave him a problem and asked him to solve. Help Aniket to solve the problem.
Given a number N, find the sum of all products x*y such that N/x... | {
"input": [],
"output": []
} | {
"input": [
"3\n2\n3\n5"
],
"output": [
"4\n8\n21"
]
} | {
"input": [],
"output": []
} |
quest | Smaug, the dragon, rules under The Mountain, Erabor which was originally the ruling place of Dwarf King. King Thorin, who is the rightful heir to the throne is on his way to take back his kingdom from Smaug. With the help of a map, King Thorin is able to find a secret entry into the mountain. But now when he has reache... | {
"input": [],
"output": []
} | {
"input": [
"cdcdcdcdeeeef"
],
"output": [
"YES"
]
} | {
"input": [],
"output": []
} |
1172_D. Nauuo and Portals | Nauuo is a girl who loves playing games related to portals.
One day she was playing a game as follows.
In an n× n grid, the rows are numbered from 1 to n from top to bottom, the columns are numbered from 1 to n from left to right. We denote a cell on the intersection of the r-th row and c-th column as (r,c).
A porta... | {
"input": [
"3\n2 3 1\n1 3 2\n",
"5\n3 1 5 4 2\n4 2 1 3 5\n",
"3\n2 3 1\n3 1 2\n",
"10\n6 5 1 8 2 3 4 10 9 7\n10 9 4 8 5 6 1 3 2 7\n",
"5\n1 3 2 5 4\n3 1 4 5 2\n",
"3\n3 1 2\n3 1 2\n",
"2\n1 2\n2 1\n",
"3\n3 2 1\n3 2 1\n",
"20\n4 7 14 2 6 3 1 11 18 10 5 19 16 13 15 12 9 8 20 17\n6... | {
"input": [
"3\n1 3 2\n3 1 2\n",
"5\n3 1 5 4 2\n4 2 1 3 5\n"
],
"output": [
"2\n1 1 1 2\n3 2 2 3\n",
"3\n2 1 1 3\n5 2 2 2\n5 3 3 4\n"
]
} | {
"input": [],
"output": []
} |
1250_K. Projectors | There are n lectures and m seminars to be conducted today at the Faculty of Approximate Sciences. The i-th lecture starts at a_i and ends at b_i (formally, time of the lecture spans an interval [a_i, b_i), the right bound is exclusive). The j-th seminar starts at p_j and ends at q_j (similarly, time of the seminar span... | {
"input": [],
"output": []
} | {
"input": [
"2\n2 2 2 2\n1 5\n2 5\n1 5\n1 4\n2 0 2 10\n1 3\n1 3\n",
"3\n1 2 1 1\n3 4\n2 4\n1 3\n3 4 2 3\n5 7\n1 3\n1 7\n4 8\n2 5\n1 6\n2 8\n0 1 1 0\n1 1000000\n"
],
"output": [
"\nYES\n2 1 4 3 \nYES\n2 1 \n",
"\nYES\n1 2 1 \nNO\nYES\n1 \n"
]
} | {
"input": [],
"output": []
} |
grab-the-laddu | On the eve of New Year in Dholakpur, Chota Bheem and Chutki are playing a game, described as follows.
There are two plates full of Laddus. Both can eat 'L' (L ≥ 1) laddus from any one plate or 'L' laddus from both the plates in each step. They play the game alternatively and the last one to eat the laddu will be the ... | {
"input": [
"36\n27 13\n53 35\n96 96\n57 0\n25 88\n28 26\n77 80\n83 69\n63 0\n46 5\n34 87\n97 74\n42 46\n64 84\n18 38\n73 53\n62 85\n96 81\n87 45\n21 0\n89 31\n40 0\n6 0\n83 67\n8 72\n80 17\n92 55\n96 2\n54 82\n68 23\n69 88\n49 74\n26 32\n44 78\n83 66\n64 17",
"1296\n1234 9647\n1824 2942\n6608 3086\n2458 577... | {
"input": [
"3\n1 2\n1 3\n2 0\n\nSAMPLE"
],
"output": [
"Bheem\nChutki\nChutki"
]
} | {
"input": [],
"output": []
} |
p01365 Camera Control | "ACM48" is one of the most popular dance vocal units in Japan. In this winter, ACM48 is planning a world concert tour. You joined the tour as a camera engineer.
Your role is to develop software which controls the camera on a stage. For simplicity you can regard the stage as 2-dimensional space. You can rotate the came... | {
"input": [],
"output": []
} | {
"input": [
"2\n0 0\n2\n-5 5 0\n5 5 10\n1\n0 6\n2\n5 5 0\n-5 5 10\n1\n6 10\n1\n7 -65\n2\n-65 10 0\n65 1 3\n2\n0 1\n23 24\n2\n0 0\n2\n100 10 0\n-10 10 10\n5\n0 1\n2 3\n4 5\n6 7\n8 9\n2\n10 0 0\n0 10 10\n5\n1 2\n3 4\n5 6\n7 8\n9 10\n0"
],
"output": [
"9.00000000\n2.00000000\n5.98862017"
]
} | {
"input": [],
"output": []
} |
kjcc02 | Sum and Color
Chef is a mathematics student. His professor has given him a difficult task. Professor initially provides Chef with a list of numbers. For every number in the list, Chef has to calculate the sum 'S' of digits such that 0<=S<=9. Even if the sum of digits is coming as a 'n' digit number, Chef has to bring i... | {
"input": [],
"output": []
} | {
"input": [
"5\n5\n128 25 87 50 1558\n4\n11 22 33 44\n3\n36 14 1000\n5\n11112 95 96 256 2669\n3\n10 991 83"
],
"output": [
"yellow\ngreen\nbrown\ncyan\npink"
]
} | {
"input": [],
"output": []
} |
1346_F. Dune II: Battle For Arrakis | You're at the last mission in one very old and very popular strategy game Dune II: Battle For Arrakis. The map of the mission can be represented as a rectangular matrix of size n × m. Initially, there are a_{i, j} units of your army in the cell (i, j).
You want to prepare for the final battle, so you want to move all ... | {
"input": [],
"output": []
} | {
"input": [
"3 3 1\n1 2 3\n2 1 2\n1 1 2\n2 3 100\n",
"4 4 3\n2 5 6 3\n4 8 10 5\n2 6 7 1\n8 4 2 1\n1 1 8\n2 3 4\n4 4 5\n"
],
"output": [
"\n21 22 \n",
"\n123 135 129 145 \n"
]
} | {
"input": [],
"output": []
} |
958_A3. Death Stars (hard) | The stardate is 2015, and Death Stars are bigger than ever! This time, two rebel spies have yet again given Heidi two maps with the possible locations of the Death Stars.
Heidi has now received two maps with possible locations of N Death Stars. She knows that each of the maps is possibly corrupted, and may contain som... | {
"input": [],
"output": []
} | {
"input": [],
"output": []
} | {
"input": [],
"output": []
} |
crazy-numbers-1 | Golu is crazy about numbers. He loves those numbers such that the difference between the adjacent digits of that number is exactly one. He calls these numbers crazy numbers and wants to find out how many such numbers exist for N number of digits. This task is very difficult for him so he wants your help.
Now your task... | {
"input": [],
"output": []
} | {
"input": [
"2\n1\n2\n\nSAMPLE"
],
"output": [
"10\n17"
]
} | {
"input": [],
"output": []
} |
bytesg | Do you like Treasure Hunts? I like treasure hunts. Love ‘em. And TROIKA 2013 has the best one ever in ‘MIST’ (apps.facebook.com/mist_troika).
Just like a normal treasure hunt, you are given several clues and you have to get the right answer to progress to the next level and so on, until you reach the ultimate prize! B... | {
"input": [],
"output": []
} | {
"input": [
"Sachin Ramesh Tendulkar\nSach\nRam\nsAcH Tendul\nsach Tendulkar\nSachin Ram Tendulkar\nSAChin TENduLkaR",
"Sachin Ramesh Tendulkar\nSach\nRam\nsAcH Tendul\nsach Tendulkar\nSachin Ram Tendulkar\nRamesh TENduLkaR"
],
"output": [
"No\nNo\nNo\nNo\nNo\nYes",
"No\nNo\nNo\nNo\nNo\nYes"
]
... | {
"input": [],
"output": []
} |
qucobic | STATEMENT
You are sitting in your class getting bored and wondering how long will it be before you can get back to your room and contine solving the
current long challenge @ codechef. You look at the clock and it shows the time as HH:MM (24-hour format). Just to pass the time you
consider the problem of what maximal... | {
"input": [],
"output": []
} | {
"input": [
"3\n1234\n123\n1234\n120\n0000\n0"
],
"output": [
"1237\n1236\n0000"
]
} | {
"input": [],
"output": []
} |
1250_J. The Parade | The Berland Army is preparing for a large military parade. It is already decided that the soldiers participating in it will be divided into k rows, and all rows will contain the same number of soldiers.
Of course, not every arrangement of soldiers into k rows is suitable. Heights of all soldiers in the same row should... | {
"input": [],
"output": []
} | {
"input": [
"5\n3 4\n7 1 13\n1 1\n100\n1 3\n100\n2 1\n1000000000000 1000000000000\n4 1\n10 2 11 1\n"
],
"output": [
"\n16\n100\n99\n2000000000000\n13\n"
]
} | {
"input": [],
"output": []
} |
doghouses | Russian version of the problem can be read here.
As you probably know, cats usually fight with dogs.
There are N doghouses in a backyard. For simplicity, we consider the backyard as a plane, and the doghouses as points on the plane. All doghouses are numbered from 1 to N. The i-th doghouse is located at point (i, Y[i... | {
"input": [
"1000\n3 6 10 2 7 0 12 2 10 10 3 6 7 8 9 6 8 12 11 4 8 6 12 5 10 7 9 1 2 1 10 4 12 12 11 13 12 12 10 0 13 12 4 10 3 0 13 1 11 3 0 9 7 8 12 5 7 7 0 3 12 4 5 11 7 6 3 13 5 8 12 5 8 12 3 4 5 5 1 13 2 9 11 2 2 0 13 0 2 6 12 10 0 9 2 1 6 12 9 4 10 4 5 12 7 8 8 12 11 5 13 12 13 2 5 0 9 0 3 12 7 6 10 6 4 2 ... | {
"input": [
"5\n2 3 4 1 1\n\nSAMPLE"
],
"output": [
"4"
]
} | {
"input": [],
"output": []
} |
samu-and-permutations | Samu had got N fruits. Sweetness of i^th fruit is given by A[i]. Now she wants to eat all the fruits , in such a way that total taste is maximised.
Total Taste is calculated as follow (Assume fruits sweetness array uses 1-based indexing) :
int taste=0;
for(int i=2;i ≤ N;i++){
if (A[i]-A[i-1] ≥ 0){
taste =... | {
"input": [
"10\n12\n77 45 4 92 12 57 14 41 87 96 68 48\n8\n41 38 50 92 26 43 20 55\n7\n48 61 70 58 84 93 18\n4\n81 41 64 89\n4\n16 43 90 83\n12\n72 8 10 11 34 100 50 73 4 83 3 1\n15\n89 77 73 53 75 77 91 68 49 86 44 44 85 28 35\n14\n31 26 1 89 91 1 53 50 56 68 27 34 99 98\n5\n54 72 36 42 42\n1\n69"
],
"outp... | {
"input": [
"1\n3\n2 5 4\n\nSAMPLE"
],
"output": [
"13"
]
} | {
"input": [],
"output": []
} |
btreat | Its Chef's Birthday and his friends are demanding him for treat. So he went to the shop to buy N gift packets (one for each friend). Each gift packet bought from shop contains some number of chocolates in it.
Chef believes in equality i.e. all gift packets should contain equal number of chocolates in it. So Chef thou... | {
"input": [],
"output": []
} | {
"input": [
"2\n4\n5 2 4 5\n6\n5 2 4 1 7 5"
],
"output": [
"2\n5"
]
} | {
"input": [],
"output": []
} |
m3 | The new season of the Bytelandian Premier League (BPL) has started!
In the BPL, any two soccer teams play with each other exactly once. In each match, the winner earns 3 points and the loser earns no point. There is no draw (if the match is level after the two halves, two teams will take part in a penalty shootout to d... | {
"input": [],
"output": []
} | {
"input": [
"3\n3\n0 0 0 \n1 0 1 \n1 0 0 \n4\n0 1 1 0 \n0 0 2 0 \n0 2 0 0 \n1 1 1 0 \n5\n0 2 2 1 0 \n2 0 1 1 0 \n2 0 0 1 0 \n0 0 0 0 1 \n1 1 1 0 0"
],
"output": [
"010\n0001\n11001"
]
} | {
"input": [],
"output": []
} |
1170_G. Graph Decomposition | You are given an undirected graph consisting of n vertices and m edges.
Recall that a cycle is a path that starts and ends in the same vertex. A cycle in a graph is called simple if it contains each vertex (except the starting and ending one) no more than once (the starting and the ending one is contained always twice... | {
"input": [],
"output": []
} | {
"input": [
"6 9\n1 2\n2 3\n1 3\n2 4\n2 5\n4 5\n3 5\n3 6\n5 6\n",
"4 7\n1 1\n1 2\n2 3\n3 4\n4 1\n1 3\n1 3\n",
"4 8\n1 1\n1 2\n2 3\n3 4\n4 1\n2 4\n1 3\n1 3\n"
],
"output": [
"\nYES\n3\n4 2 5 4 2 \n4 3 6 5 3 \n4 1 3 2 1 \n",
"\nYES\n3\n2 1 1 \n5 1 4 3 2 1 \n3 1 3 1 \n",
"\nNO\n"
]
} | {
"input": [],
"output": []
} |
1250_D. Conference Problem | A large-scale conference on unnatural sciences is going to be held soon in Berland! In total, n scientists from all around the world have applied. All of them have indicated a time segment when they will attend the conference: two integers l_i, r_i — day of arrival and day of departure.
Also, some of the scientists ha... | {
"input": [],
"output": []
} | {
"input": [
"2\n4\n1 10 30\n5 6 30\n6 12 0\n1 1 0\n4\n1 2 1\n2 3 0\n3 4 0\n4 5 2\n"
],
"output": [
"\n4\n2\n"
]
} | {
"input": [],
"output": []
} |
470_H. Array Sorting | Sorting arrays is traditionally associated with high-level languages. How hard can it be in FALSE? Sort the given array in non-descending order.
Input
The input consists of a single line of space-separated integers. The first number is n (1 ≤ n ≤ 10) — the size of the array. The following n numbers are the elements o... | {
"input": [],
"output": []
} | {
"input": [
"3 3 1 2\n",
"7 12 2 3 44 5 60 2\n"
],
"output": [
"1 2 3 \n",
"2 2 3 5 12 44 60 \n"
]
} | {
"input": [],
"output": []
} |
847_A. Union of Doubly Linked Lists | Doubly linked list is one of the fundamental data structures. A doubly linked list is a sequence of elements, each containing information about the previous and the next elements of the list. In this problem all lists have linear structure. I.e. each element except the first has exactly one previous element, each eleme... | {
"input": [
"100\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n... | {
"input": [
"7\n4 7\n5 0\n0 0\n6 1\n0 2\n0 4\n1 0\n"
],
"output": [
"4 7\n5 6\n0 5\n6 1\n3 2\n2 4\n1 0\n"
]
} | {
"input": [],
"output": []
} |
power-matrix | You are given a square matrix M and a positive integer N. You will have to compute M raised to the power N. (that is, M multiplied with itself N times.)
Input
First line of input is T ( number of test-cases) .
First line of each test-case contains two integer M , N where M is size of square array that you have to ex... | {
"input": [],
"output": []
} | {
"input": [
"2\n2 3\n1 0 \n1 1 \n3 3\n1 0 4 \n1 2 2 \n0 4 4\n\nSAMPLE"
],
"output": [
"1 0 \n3 1 \n17 112 116 \n15 88 100 \n28 144 160"
]
} | {
"input": [],
"output": []
} |
arithm | Chef's encounters with sweets continue with this problem! This time, he wants to distribute chocolates to his N students sitting on a long bench. The students are ordered according to the scores they got from the last exam.
Chef wants to give more chocolates to the higher-scoring students. He also has a few more restr... | {
"input": [],
"output": []
} | {
"input": [
"2\n4 24\n2 2"
],
"output": [
"Yes\nNo"
]
} | {
"input": [],
"output": []
} |
clco03 | Arush was not always poor at Mathematics but his recent performances had not been that good and he had lost his confidence. Now his elder brother was determined to bring back his confidence back in Mathematics.
So he made a tricky question and made sure that Arush would be able to do solve it. The factorial of a non-ne... | {
"input": [],
"output": []
} | {
"input": [
"2\n1\n6\n3\n006"
],
"output": [
"53\n53"
]
} | {
"input": [],
"output": []
} |
162_I. Truncatable primes | A truncatable prime is a prime number which contains no zeros in decimal notation and all its suffixes are primes. 1 is considered to be not a prime.
You are given a positive integer n. Figure out whether it is a truncatable prime.
Input
The only line of input contains an integer n (2 ≤ n ≤ 107).
Output
Output "YE... | {
"input": [],
"output": []
} | {
"input": [
"19\n",
"9137\n"
],
"output": [
"NO\n",
"YES\n"
]
} | {
"input": [],
"output": []
} |
610_C. Harmony Analysis | The semester is already ending, so Danil made an effort and decided to visit a lesson on harmony analysis to know how does the professor look like, at least. Danil was very bored on this lesson until the teacher gave the group a simple task: find 4 vectors in 4-dimensional space, such that every coordinate of every vec... | {
"input": [
"2\n",
"4\n",
"1\n",
"5\n",
"7\n",
"8\n",
"6\n",
"0\n",
"3\n"
],
"output": [
"++++\n+*+*\n++**\n+**+\n",
"++++++++++++++++\n+*+*+*+*+*+*+*+*\n++**++**++**++**\n+**++**++**++**+\n++++****++++****\n+*+**+*++*+**+*+\n++****++++****++\n+**+*++*+**+*++*\n+++++++... | {
"input": [
"2\n"
],
"output": [
"++++\n+*+*\n++**\n+**+\n"
]
} | {
"input": [],
"output": []
} |
dawood-the-mathematician | Dr.Dawood is another mathematician who is more geekier than Osama (that's why, ++). Dawood deals with more complex problems than Osama usually deals with. He also recruits people to be his sub-ordinates. He usually gives them "trivial" problems as test for them to solve and earn their position to be his sub-ordinate.
... | {
"input": [],
"output": []
} | {
"input": [
"4\n3\n1\n2\n5\n\nSAMPLE"
],
"output": [
"2\n2\n4\n2"
]
} | {
"input": [],
"output": []
} |
uncles-will-1 | Ramu’s uncle has left him a stable in his Will. But the stable is not in a good condition. The roofs leak and need to be repaired.
There are a number of stalls in the stable. A stall may or may not contain a horse. Ramu has to buy new cement sheets to cover these stalls. He has to cover atleast all those stalls that h... | {
"input": [],
"output": []
} | {
"input": [
"1\n2 10 3\n2\n4\n10\n\nSAMPLE"
],
"output": [
"4"
]
} | {
"input": [],
"output": []
} |
p01664 Sigma | I-σ
A permutation of magnitude N is a sequence of elements in a sequence (1, 2, 3,…, N). For example, (5, 2, 1, 4, 3) is a permutation of size 5, while (1, 5, 1, 2, 3) is not.
This problem is a reactive task. You play a response program and a "permutation guessing game". First of all, the response program internally ... | {
"input": [],
"output": []
} | {
"input": [
""
],
"output": [
""
]
} | {
"input": [],
"output": []
} |
p02226 Test | test
UnionFind(バイナリ入力)
Example
Input
Output | {
"input": [],
"output": []
} | {
"input": [
""
],
"output": [
""
]
} | {
"input": [],
"output": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.