name
stringlengths
2
82
description
stringlengths
42
10.5k
private_tests
dict
public_tests
dict
generated_tests
dict
1297_A. Likes Display
Polycarp is working on the implementation of displaying likes on the Codehorses social network. The number of likes should be displayed in a format that will be easy to read by users. It was decided that for large numbers of likes the format should be like 123K (one hundred twenty-three thousand) or like 56M (fifty-six...
{ "input": [], "output": [] }
{ "input": [ "9\n999\n123\n0\n1782\n31415926\n1500\n999999\n35499710\n2000000000\n" ], "output": [ "\n999\n123\n0\n2K\n31M\n2K\n1M\n35M\n2000M\n" ] }
{ "input": [], "output": [] }
1381_B. Unmerge
Let a and b be two arrays of lengths n and m, respectively, with no elements in common. We can define a new array merge(a,b) of length n+m recursively as follows: * If one of the arrays is empty, the result is the other array. That is, merge(∅,b)=b and merge(a,∅)=a. In particular, merge(∅,∅)=∅. * If both arrays a...
{ "input": [ "1\n16\n27 1 28 2 29 3 4 5 6 7 30 8 9 10 11 12 13 31 14 15 16 17 18 19 32 20 21 22 23 24 25 26\n", "1\n9\n2 1 4 3 7 6 5 10 9 8 13 12 11 18 17 16 15 14\n" ], "output": [ "YES\n", "YES\n" ] }
{ "input": [ "6\n2\n2 3 1 4\n2\n3 1 2 4\n4\n3 2 6 1 5 7 8 4\n3\n1 2 3 4 5 6\n4\n6 1 3 7 4 5 8 2\n6\n4 3 2 5 1 11 9 12 8 6 10 7\n" ], "output": [ "YES\nNO\nYES\nYES\nNO\nNO\n" ] }
{ "input": [], "output": [] }
city-and-campers
"Money money MONEY, I want money" thought Alex. "Now how do I get money? Well... I'll open up a camp!" Well, unfortunately things didn't go so well for Alex's campers, and now there are N campers wandering around the city aimlessly. You have to handle Q queries; which consist of two groups finding each other and becom...
{ "input": [], "output": [] }
{ "input": [ "2 1\n1 2\n\nSAMPLE" ], "output": [ "0" ] }
{ "input": [], "output": [] }
navi-and-his-friend
Navi is a famous shopkeeper in his locality. He gives discounts to his regular customers. Some new rules have been made due to which he is in trouble. According to the new rules, any shopkeeper can sale his items to only one customer in a day. But every customer has some issues like the total money they have or the tot...
{ "input": [], "output": [] }
{ "input": [ "1\n3\n10 20\n20 30\n30 40\n50 2\n\nSAMPLE" ], "output": [ "For Day #1:\n30" ] }
{ "input": [], "output": [] }
shekhar-loves-to-travel
Richard is a travel freak. He is now out to travel to a distant place with his friends, so he took his car and went out with a certain amount of fuel. Thus he must stop at a fuel station before his fuel gets over. There are several fuel station with 1 km gap providing fixed amount of fuel. At each fuel station his tan...
{ "input": [ "100\n79\n1 1 14 17 11 1 12 1 17 1 17 11 13 16 10 1 13 3 5 12 8 16 19 16 13 6 7 4 3 5 17 1 7 3 17 6 9 5 1 1 16 15 17 17 1 1 5 17 3 13 10 15 10 12 1 5 1 19 1 14 10 11 5 8 13 1 13 13 6 3 1 13 15 12 13 3 1 9 19 \n16\n13 15 17 3 3 13 9 1 5 16 1 7 16 10 1 11 \n25\n1 17 18 5 3 13 17 9 1 12 9 1 7 13 1 17 1 ...
{ "input": [ "2\n5\n2 15 5 6 2\n11\n1 3 5 8 9 2 6 7 6 8 9\n\nSAMPLE" ], "output": [ "1\n2" ] }
{ "input": [], "output": [] }
axr1p2
Given this sequence….. 1^(1!)+2^(2!)+3^(3!)+4^(4!)+……………………..N^(N!). Your job is to write a program such that given N any time, you have to find out the unit place digit of the sum of the above sequence. Input Enter the number N to calculate the unit place digit of the sum of the above sequence 1 < N < 1000. ...
{ "input": [], "output": [] }
{ "input": [ "71\n#" ], "output": [ "8\n" ] }
{ "input": [], "output": [] }
ppxor
Polo, the Penguin, likes the XOR operation. Please read NOTE if you are not familiar with XOR operation. XOR-sum of a list of numbers is the result of XOR-ing all of them. XOR-sum of (A[1] XOR A[2] XOR ... XOR A[N]) is defined as A[1] XOR (A[2] XOR (A[3] XOR ( ... XOR A[N]))). He has an array A consisting of N integer...
{ "input": [], "output": [] }
{ "input": [ "1\n2\n1 2" ], "output": [ "6" ] }
{ "input": [], "output": [] }
100_J. Interval Coloring
Aryo has got a lot of intervals for his 2418th birthday. He is really excited and decided to color all these intervals with some colors. He has a simple rule for himself. He calls a coloring nice if there exists no three intervals a, b and c such that the following conditions are satisfied simultaneously: * a, b an...
{ "input": [], "output": [] }
{ "input": [ "2\n[1,2)\n(3,4]\n", "3\n[1,3]\n[2,6]\n(5,7)\n" ], "output": [ "1\n", "2\n" ] }
{ "input": [], "output": [] }
130_E. Tribonacci numbers
Tribonacci numbers are a sequence of numbers, defined as follows: * t0 = t1 = 0, * t2 = 1, * ti = ti - 1 + ti - 2 + ti - 3. You are given n; calculate n-th tribonacci number modulo 26. Input The only line of input contains an integer n (1 ≤ n ≤ 1000). Output Output n-th tribonacci number modulo 26. Examp...
{ "input": [], "output": [] }
{ "input": [ "4\n", "9\n" ], "output": [ "2\n", "18\n" ] }
{ "input": [], "output": [] }
1331_H. It's showtime
You are given a mysterious language (codenamed "UnknownX") available in "Custom Test" tab. Find out what this language is, and use it to solve the following problem. You are given an integer input = 1000 * n + mod (1 ≤ n, mod ≤ 999). Calculate [double factorial](https://en.wikipedia.org/wiki/Double_factorial) of n mod...
{ "input": [], "output": [] }
{ "input": [ "6100\n", "9900\n", "100002\n", "123456\n" ], "output": [ "\n48\n", "\n45\n", "\n0\n", "\n171\n" ] }
{ "input": [], "output": [] }
683_G. The Fraction
Periodic decimal fraction is usually written as: [entire_part.non-periodic_part (period)]. Any simple fraction can be represented as a periodic decimal fraction and vice versa. For example, the decimal fraction 0.2(45) corresponds to a fraction 27 / 110. Your task is to convert the periodic fraction to a simple periodi...
{ "input": [], "output": [] }
{ "input": [ "0.2(45)\n", "0.75(0)\n" ], "output": [ "27/110\n", "3/4\n" ] }
{ "input": [], "output": [] }
72_B. INI-file
The INI file format is a de facto standard for configuration files. INI files are simple text files with a basic structure. They are commonly associated with Microsoft Windows, but are also used on other platforms. Each line in INI-file stands for key-value mapping or defines new section. A key-value line has a format...
{ "input": [], "output": [] }
{ "input": [ "11\na= 1\nb=a\na = 2\n ; comment\n[z]\n1=2\n[y]\n2=3\n[z]\n2=1\n[w]\n" ], "output": [ "a=2\nb=a\n[w]\n[y]\n2=3\n[z]\n1=2\n2=1\n" ] }
{ "input": [], "output": [] }
monk-and-iq
Monk and his P-1 friends recently joined a college. He finds that N students have already applied for different courses before him. Courses are assigned numbers from 1 to C. He and his friends will follow the following conditions when choosing courses:- They will choose the course i (1 ≤ i ≤ C), for which the value o...
{ "input": [ "10 10 10\n2 8 5 1 10 5 9 9 3 5\n2 5 1 8 6 5 1 10 1 6", "100 100 90\n2 8 5 1 10 5 9 9 3 5 6 6 2 8 2 2 6 3 8 7 2 5 3 4 3 3 2 7 9 6 8 7 2 9 10 3 8 10 6 5 4 2 3 4 4 5 2 2 4 9 8 5 3 8 8 10 4 2 10 9 7 6 1 3 9 7 1 3 5 9 7 6 1 10 1 1 7 2 4 9 10 4 5 5 7 1 7 7 2 9\n1 6 2 4 4 9 7 2 2 9 10 8 5 1 7 3 4 10 5 ...
{ "input": [ "5 4 4\n2 8 5 1\n9 10 5 1\n\nSAMPLE" ], "output": [ "5 4 1 3" ] }
{ "input": [], "output": [] }
crz02
In the University College of JNTUK Vizianagaram external lab examinations were being conducted. Management has decided to strictly prohibit the mal practices for that the management has decided to arrange cardboards of size nx2 to place in between two successive systems. The construction of cardboard can be done only b...
{ "input": [], "output": [] }
{ "input": [ "3\n1\n2\n3" ], "output": [ "1\n2\n3" ] }
{ "input": [], "output": [] }
harry
Problem description Nineteen years after the conclusion of events of Harry Potter and the Deathly Hallows, Harry Potter is now a Ministry of Magic employee. His youngest son Albus Severus Potter struggle with the weight of a family legacy he never wanted. As past and present fuse ominously, both father and son learn th...
{ "input": [], "output": [] }
{ "input": [ "3\nabccde\n2\nacd\nbc\nabccde\n2\nad\nbce\nmnopq\n3\namn\nopsp\nqrwas" ], "output": [ "NO\nNO\nYES" ] }
{ "input": [], "output": [] }
1173_F. 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": [ "6\n2 5 3 4 1 6\n2 6 3 4 5 1\n", "4\n1 4 2 3\n4 1 2 3\n", "35\n30 28 16 14 21 15 22 26 4 3 12 13 6 19 7 8 18 9 31 24 35 17 34 10 29 2 5 32 33 11 25 27 23 20 1\n2 12 17 13 19 35 27 9 6 4 25 20 14 26 28 34 33 29 32 24 22 18 11 15 3 21 8 5 23 31 7 10 16 30 1\n", "5\n4 1 3 5 2\n3 4 2 5 1\n", ...
{ "input": [ "5\n3 1 5 4 2\n4 2 1 3 5\n", "3\n1 3 2\n3 1 2\n" ], "output": [ "3\n2 1 1 3\n5 2 2 2\n5 3 3 4\n", "2\n1 1 1 2\n3 2 2 3\n" ] }
{ "input": [], "output": [] }
171_D. Broken checker
"This problem is rubbish! There is not statement, and there are only 5 test cases. The problemsetter took liberties with this problem!" — people complained in the comments to one round on Codeforces. And even more... No, wait, the checker for the problem was alright, that's a mercy. Input The only line of the input c...
{ "input": [ "5\n", "4\n", "2\n", "3\n", "1\n" ], "output": [ "1", "2", "3", "1", "2" ] }
{ "input": [], "output": [] }
{ "input": [], "output": [] }
tape-december-easy-easy-medium
You are a product engineer and would like to improve the quality of duct tapes that your company manufactures. An entire tape can be represented as a single row of N cells. Each cell has its Stickiness factor, which stands for its ability to stick to an object. We say that a tape is a good quality product, if and only ...
{ "input": [ "7751 1 22232\n8 5 5 1 8 2 4 6 2 5 6 3 3 4 8 9 2 4 8 1 9 3 2 9 3 7 5 9 3 4 9 7 8 10 7 10 5 2 5 8 1 10 10 4 2 4 4 4 9 8 5 3 5 7 10 3 3 3 3 9 10 5 4 8 1 4 4 8 6 8 9 9 1 4 9 10 1 5 4 9 6 2 9 4 9 7 5 2 1 10 9 9 6 10 1 6 10 3 5 7 6 3 6 4 8 4 9 9 7 5 4 10 5 10 6 8 1 10 6 7 1 8 7 3 8 8 4 6 6 3 7 6 7 5 7 7 1...
{ "input": [ "3 2 4\n1 1 1 \n\nSAMPLE" ], "output": [ "1" ] }
{ "input": [], "output": [] }
cntsols
Little Chief loves math. Most of all, he loves equations. He can solve any equation in the whole world. Recently he found one interesting and easy equation x1^d+x2^d+x3^d ≡ m (mod N) Where x1, x2 and x3 are non negative integer numbers. But, as always, this was easy enough for him and he solved it in just a few seconds...
{ "input": [], "output": [] }
{ "input": [ "2\n2 2 3 5\n1 2013 3 31" ], "output": [ "4\n1" ] }
{ "input": [], "output": [] }
661_F. Primes in Interval
You are given two integers a and b (a ≤ b). How many prime numbers are there on the interval from a to b, inclusive? Input The input contains two integers a and b (2 ≤ a ≤ b ≤ 1 000 000), separated by a single space. Output Output a single integer — the number of primes between a and b, inclusive. Examples Input ...
{ "input": [], "output": [] }
{ "input": [ "10 20\n", "23 23\n", "271 566\n" ], "output": [ "4\n", "1\n", "46\n" ] }
{ "input": [], "output": [] }
least-common-multiple
Gennady and Artem are discussing solutions of different problems. Gennady told Artem about a number theory problem he solved the day before. One of steps to solve the problem was to calculate the least common multiple (LCM) of all integers from 1 to n, inclusive. That problem inspired Gennady to come up with another pr...
{ "input": [ "20", "999999999999999", "8", "6589321754597", "16", "11", "3", "999997426287578", "999997426287579", "999997426287580" ], "output": [ "11", "500000000000057", "5", "3294660877307", "9", "7", "2", "499998713143801", "49999871...
{ "input": [ "5\n\nSAMPLE" ], "output": [ "3" ] }
{ "input": [], "output": [] }
roy-and-ring-13
Roy bought a Ring for Alfi, his girlfriend :p. But Alfi will only accept the Ring if Roy played a game with her and answered her queries correctly during the game. Alfi places a ring at origin of a Cartesian Plane. Both Alfi and Roy move the ring alternatively. Alfi takes odd steps and Roy takes even steps. Directio...
{ "input": [ "20\n1\n10\n100\n1000\n10000\n100000\n1000000\n10000000\n100000000\n1000000000\n9\n99\n999\n9999\n99999\n999999\n9999999\n99999999\n999999999\n2" ], "output": [ "1\n25\n775282605\n539493658\n555390103\n204760192\n230142013\n758178153\n996448456\n399999993\n25\n775282605\n539493658\n555390103\...
{ "input": [ "4\n1\n2\n3\n4\n\nSAMPLE" ], "output": [ "1\n1\n1\n1" ] }
{ "input": [], "output": [] }
vanya-and-gcd-array
Vanya has been studying all day long about sequences and other Complex Mathematical Terms. She thinks she has now become really good at it. So, her friend Vasya decides to test her knowledge and keeps the following challenge it front of her: Vanya has been given an integer array A of size N. Now, she needs to find th...
{ "input": [ "100\n93 75 77 78 91 54 55 6 44 8 92 71 45 26 46 22 31 66 73 54 93 40 96 56 51 35 92 29 100 94 83 72 85 55 68 43 62 75 40 52 16 37 57 64 45 72 19 100 88 16 33 14 73 97 5 7 28 43 98 53 17 11 84 97 39 34 94 77 81 93 74 45 19 13 89 47 88 69 10 17 66 66 89 98 38 41 77 88 50 62 29 72 54 42 92 75 89 48 82 ...
{ "input": [ "3\n1 2 3\n\nSAMPLE" ], "output": [ "5" ] }
{ "input": [], "output": [] }
p01965 Farm Village
There is a village along a road. This village has $N$ houses numbered $1$ to $N$ in order along the road. Each house has a field that can make up to two units of the crop and needs just one unit of the crop. The total cost to distribute one unit of the crop to each house is the summation of carrying costs and growing c...
{ "input": [], "output": [] }
{ "input": [ "2\n3\n1 5", "3\n100 100\n1 2 3", "4\n1 2 3\n1 1 100 100" ], "output": [ "5", "6", "12" ] }
{ "input": [], "output": [] }
isd
Ilya lives in the beautiful city of Bytes lying in a hilly terrain. She loves to ride her bicycle on the hills whenever she gets a chance to do so. There are check-posts located on the hill at a unit distance from each other. The height of the check posts is given in an array A. Ilya has to visit her aunt who lives N ...
{ "input": [], "output": [] }
{ "input": [ "2\n3\n1 3 2\n5\n1 2 3 4 5" ], "output": [ "1 \n0" ] }
{ "input": [], "output": [] }
seatstr2
Sereja has a string A consisting of n lower case English letters. Sereja calls two strings X and Y each of length n similar if they can be made equal by applying the following operation at most once in each of them. Chose any two position i, j in the string (i can be equal to j too). Swap the characters at position ...
{ "input": [], "output": [] }
{ "input": [ "2\nz\nabcd" ], "output": [ "0\n144" ] }
{ "input": [], "output": [] }
530_A. Quadratic equation
You are given a quadratic equation with integer coefficients A * X2 + B * X + C = 0. It is guaranteed that A ≠ 0 and that the equation has at least one real root. Output the roots of the equation. Input The only line of input contains integers A, B and C ( - 1000 ≤ A, B, C ≤ 1000, A ≠ 0), separated by spaces. Output...
{ "input": [], "output": [] }
{ "input": [ "1 -2 1\n", "1 0 -1\n", "2 -3 1\n" ], "output": [ "1\n", "-1 1\n", "0.5 1\n" ] }
{ "input": [], "output": [] }
64_I. Sort the Table
You are given a rectangular table containing words. Each of its columns has its own name. You are also given the list of rules of sorting in form "FIELD_NAME SORT_ORDER", where SORT_ORDER is either ASC (nondescending order) or DESC (nonascending order). Rules in the list are separated by a single comma with a single sp...
{ "input": [], "output": [] }
{ "input": [ "NAME GROUP AGE\nGROUP ASC, AGE DESC\nAlex 412 19\nPeter 422 19\nSergey 412 18\nAndrey 311 18\n" ], "output": [ "Andrey 311 18\nAlex 412 19\nSergey 412 18\nPeter 422 19\n" ] }
{ "input": [], "output": [] }
containers-of-choclates-1
In Ninja World, World War is going on.. The Raikage Army and Zetsu Army are fighting each other. The war has become so fierce that, no one knows who will win. The ninjas of Leaf Village want to know who will survive finally. But leaf village ninjas are afraid of going to the battlefield. So, they made a plan. They col...
{ "input": [], "output": [] }
{ "input": [ "4\n4\n1 2\n2 3\n2 4\n2 5\n6\n2 6\n1 5\n3 4\n7 9\n5 8\n4 10\n1\n100 200\n4\n1 2\n2 3\n3 4\n4 5\n\nSAMPLE" ], "output": [ "Case 1: 4\nCase 2: 6\nCase 3: 1\nCase 4: 3" ] }
{ "input": [], "output": [] }
oliver-and-the-game-3
Oliver and Bob are best friends. They have spent their entire childhood in the beautiful city of Byteland. The people of Byteland live happily along with the King. The city has a unique architecture with total N houses. The King's Mansion is a very big and beautiful bungalow having address = 1. Rest of the houses in By...
{ "input": [ "200\n34 138\n160 40\n109 52\n133 196\n49 141\n167 199\n156 128\n100 184\n192 66\n118 177\n30 185\n137 188\n169 182\n11 131\n131 112\n154 106\n65 42\n163 68\n88 39\n28 133\n7 180\n42 78\n39 152\n140 108\n125 190\n90 81\n173 62\n199 46\n48 28\n105 70\n119 156\n21 30\n186 122\n171 93\n38 193\n27 20\n10...
{ "input": [], "output": [] }
{ "input": [], "output": [] }
the-story-of-a-girl
Once upon a time there was a girl who loved to garden. This girl liked to work in the garden to plant peas, weed watermelon, and grown all sorts of tasty and interesting fruits and vegetables. In fact, not only did this girl have a green thumb, her whole hand was green! On the first day of fall, the girl went into her ...
{ "input": [ "1000\n37715446\n11794169\n32896615\n4674101\n7087908\n44167775\n92044044\n20008248\n28959725\n98164375\n81134590\n56440197\n14058894\n48606821\n13167433\n47174635\n29713953\n75163802\n52366358\n16659675\n80621918\n1320081\n62853874\n50716036\n77501555\n21681214\n94552665\n3242040\n78204345\n60861827...
{ "input": [ "2\n5\n13\n\nSAMPLE" ], "output": [ "5\n233" ] }
{ "input": [], "output": [] }
cd1it5
Somewhere out there, there are N islands numbered from 1 to N with no network connectivity. Communication is such a pain for the islands' dwellers. So the Kings of the islands go to nearby islands and decide to connect the islands with underwater cables for bidirectional communication. Initially no islands are connecte...
{ "input": [], "output": [] }
{ "input": [ "5 7\n0 1 2\n1 2 1\n0 3 4\n1 1 4\n0 3 2\n1 2 3\n1 1 4" ], "output": [ "Yes\nNo\nYes\nYes" ] }
{ "input": [], "output": [] }
icecream
Pankaj likes to eat Ice cream when he is working late into the night. Today has been yet another long day for Pankaj. So, he wants to eat ice cream now. He opens the fridge and sees that he has 2 types of containers holding the ice cream. The first container is a cone with radius r1 and height h1. There is also a hemis...
{ "input": [], "output": [] }
{ "input": [ "2\n1.00 1.00 1.00 1.00\n3.02 7.23 5.20 6.00" ], "output": [ "3.141592654 3.141592654\n126.739919445 509.691992118" ] }
{ "input": [], "output": [] }
mprob
You are given three integers A,B and C. We choose two real numbers x and y such that 0 ≤ x ≤ A and 0 ≤ y ≤ B. What is the probability that x+y≤C ? Input The first line of input contains T denoting the number of test cases. Each of the following T lines contains three space separated Integers A,B and C Output For e...
{ "input": [], "output": [] }
{ "input": [ "2\n4 10 3\n4 10 11" ], "output": [ "0.1125\n0.8875" ] }
{ "input": [], "output": [] }
1211_B. Traveling Around the Golden Ring of Berland
The Golden Ring is the special tourist route in Berland. This route consists of n cities and the cyclic railway route. Cities are numbered from 1 to n so that: * the next city for 1 is the city 2, * the next city for 2 is the city 3, * ... * the next city for n is the city 1. Thus, the route is a cycle,...
{ "input": [], "output": [] }
{ "input": [ "3\n1 0 0\n", "3\n2 0 2\n", "5\n0 3 1 3 2\n", "5\n1000000000 1000000000 1000000000 1000000000 0\n" ], "output": [ "\n1\n", "\n6\n", "\n14\n", "\n4999999999\n" ] }
{ "input": [], "output": [] }
1252_K. Addition Robot
Adding two numbers several times is a time-consuming task, so you want to build a robot. The robot should have a string S = S_1 S_2 ... S_N of N characters on its memory that represents addition instructions. Each character of the string, S_i, is either 'A' or 'B'. You want to be able to give Q commands to the robot, ...
{ "input": [], "output": [] }
{ "input": [ "5 3\nABAAA\n2 1 5 1 1\n1 3 5\n2 2 5 0 1000000000\n" ], "output": [ "\n11 3\n0 1000000000\n" ] }
{ "input": [], "output": [] }
690_E2. Photographs (II)
Zombies seem to have become much more intelligent lately – a few have somehow wandered into the base through the automatic gate. Heidi has had to beef up security, and a new gate has been installed. Unfortunately, now the questions being asked are more complicated, and even humans have trouble answering them. Can you s...
{ "input": [], "output": [] }
{ "input": [], "output": [] }
{ "input": [], "output": [] }
the-battle-of-panipat-4
This is 1526 A.D. Third Battle of Panipat between Babur and Ibrahim Lodi, the current ruler of India is going on. Realising that Lodi has much larger army, Babur planned to attack the cities of India to bring the moral of the soldiers of Lodi down. Now, Lodi had been ordered by his ancestors that, if he is to rule I...
{ "input": [], "output": [] }
{ "input": [ "3\n0 1\n1 2\n\nSAMPLE" ], "output": [ "7" ] }
{ "input": [], "output": [] }
p02909 AtCoder Beginner Contest 141 - Weather Prediction
The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ... Given is a string S representing the weather in the town today. Predict the weather tomorrow. Constraints * S is `Sunny`, `Cloudy`, or `Rainy`. Input Input is given from Standard Input in the...
{ "input": [], "output": [] }
{ "input": [ "Rainy", "Sunny" ], "output": [ "Sunny", "Cloudy" ] }
{ "input": [], "output": [] }
p03978 Kyoto University Programming Contest 2016 - Long Blackboard
There is a long blackboard with 2 rows and N columns in a classroom of Kyoto University. This blackboard is so long that it is impossible to tell which cells are already used and which unused. Recently, a blackboard retrieval device was installed at the classroom. To use this device, you type a search query that forms...
{ "input": [], "output": [] }
{ "input": [ "" ], "output": [ "" ] }
{ "input": [], "output": [] }
p00853 Enjoyable Commutation
Isaac is tired of his daily trip to his ofice, using the same shortest route everyday. Although this saves his time, he must see the same scenery again and again. He cannot stand such a boring commutation any more. One day, he decided to improve the situation. He would change his route everyday at least slightly. His ...
{ "input": [], "output": [] }
{ "input": [ "5 20 10 1 5\n1 2 1\n1 3 2\n1 4 1\n1 5 3\n2 1 1\n2 3 1\n2 4 2\n2 5 2\n3 1 1\n3 2 2\n3 4 1\n3 5 1\n4 1 1\n4 2 1\n4 3 1\n4 5 2\n5 1 1\n5 2 1\n5 3 1\n5 4 1\n4 6 1 1 4\n2 4 2\n1 3 2\n1 2 1\n1 4 3\n2 3 1\n3 4 1\n3 3 5 1 3\n1 2 1\n2 3 1\n1 3 1\n0 0 0 0 0" ], "output": [ "1-2-4-3-5\n1-2-3-4\nNone" ...
{ "input": [], "output": [] }
chode
Once upon a time chef decided to learn encodings. And, obviously, he started with the easiest one (well, actually the easiest after Caesar cypher) – substitution cypher. But very soon Chef got bored with encoding/decoding, so he started thinking how to hack this cypher. He already knows some algorithm, which is not alw...
{ "input": [], "output": [] }
{ "input": [ "3\nqwrtyuipasdfgjkzxcvbnmheol\ndummy!\nbfgjklmopqrstuwxzhvnicdyea\nabcd b efgd hbi!\nqwrtyuipasdfgjkzxcvbnmheol\nDummy!" ], "output": [ "hello!\nhave a nice day!\nHello!" ] }
{ "input": [], "output": [] }
kjcc08
Clash of clans is a very popular game. Each player in the game is allocated a base with certain hit points the player can train a limited number of troops on the base. There are three types of troops: Barbarian, Archers and Giants. The Cost of training a Barbarian is 100, an Archer is 500, and a Giant is 1500. When att...
{ "input": [], "output": [] }
{ "input": [ "3\n1\n60", "5\n3\n2475", "9\n2\n1530" ], "output": [ "300", "7500", "3300" ] }
{ "input": [], "output": [] }
1346_I. Pac-Man 2.0
Polycarp is developing a new version of an old video game "Pac-Man". Though he really enjoyed playing the original game, he didn't like some aspects of it, so he decided to alter the rules a bit. In Polycarp's version, you play as Pac-Man and you have to collect pellets scattered over the game world while avoiding dan...
{ "input": [], "output": [] }
{ "input": [ "3 4 2 1\n3 1 2\n1 2\n2 1\n1 3\n3 1\n5 8\n", "5 7 4 2\n1 3 2 2 1\n2 3\n4 2\n3 4\n3 1\n1 4\n5 4\n4 5\n7 14 23 27\n", "4 4 3 3\n2 3 1 4\n3 4\n4 1\n1 2\n2 3\n13 42 1337\n" ], "output": [ "\n1\n3\n", "\n2\n6\n10\n13\n", "\n3\n13\n401\n" ] }
{ "input": [], "output": [] }
1368_G. Shifting Dominoes
Bill likes to play with dominoes. He took an n × m board divided into equal square cells, and covered it with dominoes. Each domino covers two adjacent cells of the board either horizontally or vertically, and each cell is covered exactly once with a half of one domino (that is, there are no uncovered cells, and no two...
{ "input": [ "6 6\nULRULR\nDLRDLR\nUULRUU\nDDLRDD\nLRUUUU\nLRDDDD\n", "100 2\nLR\nLR\nUU\nDD\nUU\nDD\nUU\nDD\nLR\nLR\nUU\nDD\nUU\nDD\nLR\nUU\nDD\nLR\nLR\nUU\nDD\nLR\nLR\nLR\nUU\nDD\nLR\nLR\nLR\nLR\nUU\nDD\nUU\nDD\nUU\nDD\nLR\nLR\nUU\nDD\nUU\nDD\nLR\nLR\nUU\nDD\nLR\nLR\nLR\nLR\nLR\nLR\nLR\nUU\nDD\nLR\nLR\nUU\n...
{ "input": [ "6 6\nULRUUU\nDUUDDD\nUDDLRU\nDLRLRD\nULRULR\nDLRDLR\n", "2 4\nUUUU\nDDDD\n", "2 3\nULR\nDLR\n" ], "output": [ "133\n", "4\n", "6\n" ] }
{ "input": [], "output": [] }
1431_C. Black Friday
There is a local shop in your area getting prepared for the great holiday of Black Friday. There are n items with prices p_1, p_2, ..., p_n on the display. They are ordered by price, so p_1 ≤ p_2 ≤ ... ≤ p_n. The shop has a prechosen discount value k. The Black Friday discount is applied in the following way: for a si...
{ "input": [], "output": [] }
{ "input": [ "5\n5 2\n1 3 4 6 7\n6 3\n1 2 3 4 5 6\n6 3\n3 3 4 4 5 5\n1 1\n7\n4 4\n1 3 3 7\n" ], "output": [ "\n7\n4\n6\n7\n1\n" ] }
{ "input": [], "output": [] }
cricket-field
Assume the cricket ground to be an infinite grid and there can be more than 11 players in a team. It is known that the batsmen stand at the point (0,0). The field placement follows the following pattern 1st fielder is to be placed at 1 step to the east of batsman. 2nd fielder is to be placed at 2 steps to the north of...
{ "input": [ "100\n10007 10008\n10009 10010\n10037 10038\n10039 10040\n10061 10062\n10067 10068\n10069 10070\n10079 10080\n10091 10092\n10093 10094\n10099 10100\n10103 10104\n10111 10112\n10133 10134\n10139 10140\n10141 10142\n10151 10152\n10159 10160\n10163 10164\n10169 10170\n10177 10178\n10181 10182\n10193 101...
{ "input": [ "4\n3 3\n3 4\n5 5\n6 6\n\nSAMPLE" ], "output": [ "NO\nYES\nNO\nNO" ] }
{ "input": [], "output": [] }
john-maria
In the city of Madrid, there are two types of roads - Boulevard and Woonerf. As the people of Madrid are fond of eating, there is exactly one pizzeria on the intersection of each Boulevard and Woonerf. John decides to take Maria to a pizzeria for a lunch. Maria comes from a rich family while John has a modest backgro...
{ "input": [ "1 1\n1000000000" ], "output": [ "1000000000" ] }
{ "input": [ "3 4\n4 1 3 5\n2 2 2 2\n5 4 5 1", "3 3\n1 2 3\n2 3 1\n3 1 2\n\nSAMPLE" ], "output": [ "2", "1" ] }
{ "input": [], "output": [] }
p01638 Pie Chart is as easy as pie.
ICPC World Finals Day 3 On that day, Mr. Tee was investigating the percentage of language used within the team. Unusually, our team does not unify the languages ​​used. Research has shown that two are using C ++ and one is using Java. Now, let's make this a pie chart (pie chart). pie1.png Oh, it looks like Java isn'...
{ "input": [], "output": [] }
{ "input": [ "r x y n\np" ], "output": [ "71 156" ] }
{ "input": [], "output": [] }
jntuv1
Problem description.   JNTU College is conducting an Warmup contest for students to bring out their approaches of solving a problem. A Challenged B that he could not solve the problem.So help B in solving the problem. Given a series of numbers with only 3 and 4.Your task is very simple i.e.. find the nth...
{ "input": [], "output": [] }
{ "input": [ "5" ], "output": [ "43" ] }
{ "input": [], "output": [] }
530_G. Levenshtein distance
Levenshtein distance between two strings of letters is calculated as the minimal total cost of a sequence of edit actions that converts one of the strings into the other one. The allowed edit actions are: * substitution: the cost of substituting one letter with another is equal to the difference of index numbers of ...
{ "input": [], "output": [] }
{ "input": [ "arc\nbug\n", "dome\ndrone\n" ], "output": [ "8\n", "19\n" ] }
{ "input": [], "output": [] }
22-base-conflict
Announcement ************Second Round will be ONLINE instead of ONSITE************* Problem Statement Schimdt is teaching Jenko a new technique to excel at bases. He writes n numbers in base k on a piece of paper and also their decimal sum. He doesn’t mention k on the paper. Jenko has to find out the value of k using ...
{ "input": [ "1\n100000000000000000000000000000000000000000000000000000000000\n576460752303423488" ], "output": [ "2" ] }
{ "input": [ "2\n10 21\n10\n\nSAMPLE" ], "output": [ "3" ] }
{ "input": [], "output": [] }
inter-city-travel-3
A state consists of N cities. Some of these cities are connected to each other by one - way roads. The time taken to travel from a particular city to any other city directly connected to it is 1 hour. The entire map of the state will be given. You will be given Q queries, each query asking you the number of ways to tra...
{ "input": [ "50\n1000\n44 23\n43 20\n2 20\n18 5\n18 23\n20 26\n36 5\n28 37\n30 1\n40 16\n50 27\n26 23\n31 6\n35 17\n36 21\n28 49\n13 1\n30 45\n40 4\n24 37\n37 39\n15 42\n8 15\n32 38\n32 42\n30 20\n50 25\n30 34\n2 38\n36 26\n18 46\n27 10\n16 26\n27 37\n33 12\n21 48\n24 23\n23 35\n20 10\n19 18\n18 41\n5 38\n39 23\...
{ "input": [ "6\n7\n1 2\n1 5\n2 5\n2 3\n5 4\n3 4\n4 6\n6\n1 2 1\n2 1 2\n1 4 3\n1 6 3\n1 6 4\n6 1 8\n\nSAMPLE" ], "output": [ "1\n0\n2\n1\n2\n0" ] }
{ "input": [], "output": [] }
dcgame
Devu and Churu love to play games a lot. Today, they have an array A consisting of N positive integers. First they listed all N × (N+1) / 2 non-empty continuous subarrays of the array A on a piece of paper and then replaced all the subarrays on the paper with the maximum element present in the respective subarray. Devu...
{ "input": [], "output": [] }
{ "input": [ "3 5\n1 2 3\n> 1 D\n< 2 C\n= 3 D\n> 4 C\n< 5 D" ], "output": [ "DCDDC" ] }
{ "input": [], "output": [] }
iiti13
John Watson always knew that one of the favourite hobbies of Sherlock Holmes was to tinker with ciphers. Though Watson was not that good with ciphers, he learnt a few things being with him. Right now, Watson is in trouble! He has been locked in a room and the only way to get out of the room is through deciphering a kn...
{ "input": [], "output": [] }
{ "input": [ "3\n5\nabcde\n1 2 3 4 5\n6\nfluxus\n6 5 4 3 2 1\n8\nhrcksleo\n5 5 7 5 6 8 7 8" ], "output": [ "abcde\nfluxus\nsherlock" ] }
{ "input": [], "output": [] }
1278_D. Segment Tree
As the name of the task implies, you are asked to do some work with segments and trees. Recall that a tree is a connected undirected graph such that there is exactly one simple path between every pair of its vertices. You are given n segments [l_1, r_1], [l_2, r_2], ..., [l_n, r_n], l_i < r_i for every i. It is guara...
{ "input": [ "4\n1 2\n3 6\n4 7\n5 8\n", "8\n2 16\n7 13\n12 14\n4 15\n8 9\n1 11\n3 6\n5 10\n", "5\n4 6\n2 5\n3 9\n8 10\n1 7\n", "5\n1 4\n2 5\n3 10\n6 8\n7 9\n", "6\n9 12\n2 3\n6 10\n4 7\n1 5\n8 11\n", "6\n1 3\n2 10\n8 11\n4 12\n5 7\n6 9\n", "6\n4 11\n1 5\n7 9\n2 12\n6 8\n3 10\n", "4\n1 ...
{ "input": [ "5\n5 8\n3 6\n2 9\n7 10\n1 4\n", "5\n1 3\n2 4\n5 9\n6 8\n7 10\n", "6\n9 12\n2 11\n1 3\n6 10\n5 7\n4 8\n" ], "output": [ "NO\n", "NO\n", "YES\n" ] }
{ "input": [], "output": [] }
1403_C. Chess Rush
The mythic world of Chess Land is a rectangular grid of squares with R rows and C columns, R being greater than or equal to C. Its rows and columns are numbered from 1 to R and 1 to C, respectively. The inhabitants of Chess Land are usually mentioned as pieces in everyday language, and there are 5 specific types of t...
{ "input": [], "output": [] }
{ "input": [ "8 8 5\nP 1 2\nR 4 8\nQ 2 3\nB 3 6\nK 5 5\n" ], "output": [ "\n0 0\n2 2\n2 5\n2 2\n7 393\n" ] }
{ "input": [], "output": [] }
magical-number-a-3
Programmer Deepak has created a program which calculates magical number as 2^n * 3^n * 5^n where "n" is an integer. Now he wants to find the magical number which is just greater than the input. Help him in finding it. NOTE : a^b denotes a raised to power b. Input : 456 NOTE : You do not need to create a program f...
{ "input": [ "456" ], "output": [ "900\n" ] }
{ "input": [], "output": [] }
{ "input": [], "output": [] }
protect-the-bad-when-weak-4
Reverse_flash lost his power while moving through a number of timezones and landed in the timezone of Flash. Now we know that Flash would kill him as soon as he finds him. Your job is to protect the bad. The timezone of Flash is (1,1). There is a safe timezone (n,n), the last one ,where Flash couldn't enter. Timezone ...
{ "input": [ "25\n0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0\n1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 1 1 0\n0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0\n0 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0\n1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 0 1 1 1 1...
{ "input": [ "7\n0 0 0 0 0 0 0\n0 1 0 1 0 1 0\n0 0 0 0 0 0 0\n0 1 0 1 0 1 0\n0 0 0 0 0 0 0\n0 1 0 1 0 1 0\n0 0 0 0 0 0 0\n\nSAMPLE" ], "output": [ "184" ] }
{ "input": [], "output": [] }
p01584 Divide the Water
A scientist Arthur C. McDonell is conducting a very complex chemical experiment. This experiment requires a large number of very simple operations to pour water into every column of the vessel at the predetermined ratio. Tired of boring manual work, he was trying to automate the operation. One day, he came upon the id...
{ "input": [], "output": [] }
{ "input": [ "" ], "output": [ "" ] }
{ "input": [], "output": [] }
1184_B2. The Doctor Meets Vader (Medium)
Thanks to the Doctor's help, the rebels managed to steal enough gold to launch a full-scale attack on the Empire! However, Darth Vader is looking for revenge and wants to take back his gold. The rebels have hidden the gold in various bases throughout the galaxy. Darth Vader and the Empire are looking to send out their...
{ "input": [ "1 1\n1 1\n2 1 657705832 300429230\n1 435788130 187757098\n1 464180683 238039721\n1 101041215\n", "1 1\n1 1\n1 2 498328473 730315543\n1 267535146 337021959\n1 340728578\n1 82073826\n", "1 0\n1 1 154608701 257538154\n1 148757376 932599775\n1 953264671\n", "1 1\n1 1\n2 2 551454259 292052813...
{ "input": [ "6 7\n1 2\n2 3\n3 4\n4 6\n6 5\n4 4\n3 6\n4 2 7 3\n1 10 2\n3 8 2\n5 1 0\n6 5 4\n3 7\n5 2\n" ], "output": [ "12\n" ] }
{ "input": [], "output": [] }
1431_H. Rogue-like Game
Marina plays a new rogue-like game. In this game, there are n different character species and m different classes. The game is played in runs; for each run, Marina has to select a species and a class for her character. If she selects the i-th species and the j-th class, she will get c_{i, j} points for this run. Initi...
{ "input": [], "output": [] }
{ "input": [ "3 4 2\n0 5 7\n0 2 6 10\n2 5 5 2\n5 3 4 4\n3 4 2 4\n", "4 2 1\n0 3 9 9\n0 2\n3 3\n5 1\n1 3\n2 3\n", "3 3 5\n0 8 11\n0 0 3\n3 1 3\n1 2 1\n1 1 3\n" ], "output": [ "\n3\n", "\n2\n", "\n2\n" ] }
{ "input": [], "output": [] }
67_D. Optical Experiment
Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows. There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each...
{ "input": [ "3\n1 2 3\n1 3 2\n", "5\n1 2 4 5 3\n1 5 4 2 3\n", "5\n1 2 4 5 3\n1 2 5 4 3\n", "5\n1 5 2 4 3\n4 3 2 5 1\n", "3\n1 2 3\n2 3 1\n", "10\n4 7 8 1 2 3 5 9 6 10\n6 3 8 7 10 2 1 4 5 9\n", "5\n5 3 2 4 1\n2 4 5 1 3\n", "5\n1 3 5 4 2\n1 4 5 3 2\n", "2\n1 2\n2 1\n", "4\n2 4 1...
{ "input": [ "3\n3 1 2\n2 3 1\n", "5\n1 4 5 2 3\n3 4 2 1 5\n" ], "output": [ "2\n", "3\n" ] }
{ "input": [], "output": [] }
909_C. Python Indentation
In Python, code blocks don't have explicit begin/end or curly braces to mark beginning and end of the block. Instead, code blocks are defined by indentation. We will consider an extremely simplified subset of Python with only two types of statements. Simple statements are written in a single line, one per line. An ex...
{ "input": [ "156\nf\ns\nf\ns\nf\ns\ns\ns\ns\nf\ns\ns\nf\nf\ns\nf\nf\nf\nf\ns\ns\ns\nf\ns\ns\nf\nf\nf\nf\nf\nf\ns\ns\ns\ns\nf\ns\nf\ns\nf\ns\nf\nf\nf\nf\ns\ns\nf\nf\ns\ns\ns\ns\nf\ns\nf\ns\nf\ns\nf\ns\ns\ns\nf\ns\ns\nf\ns\nf\nf\ns\ns\ns\nf\nf\nf\nf\ns\ns\nf\nf\nf\nf\nf\nf\nf\ns\nf\ns\ns\ns\nf\nf\ns\ns\ns\ns\ns\nf...
{ "input": [ "4\ns\nf\nf\ns\n", "4\nf\ns\nf\ns\n" ], "output": [ "1", "2" ] }
{ "input": [], "output": [] }
bob-and-lines
Problem Statement: Line segment intersection is one of the important part of mathematics. Bob will be given a set of n number of line segments, followed by set of q number of query lines. He is supposed to find how many line segments from set of n intersect given query line. As bob likes only parallel lines he will...
{ "input": [ "2\n2 83\n996 874 4 193\n611 166 630 317\n683 0\n0 415\n0 819\n0 771\n346 0\n100 0\n0 32\n0 281\n411 0\n0 837\n807 0\n0 795\n2 0\n0 751\n77 0\n0 37\n512 0\n0 377\n0 168\n0 903\n0 673\n428 0\n0 463\n631 0\n259 0\n642 0\n326 0\n0 706\n278 0\n0 920\n951 0\n0 842\n116 0\n0 666\n0 228\n739 0\n0 976\n135 0...
{ "input": [], "output": [] }
{ "input": [], "output": [] }
millys-rank-2
Milly is very much concern about her rank in her class. So to make her feel better , her friend Pranjul will give three numbers to her denoting N, X and Y. N represents the total number of students in the class. Now he has already described about the rank predictor algorithm that he has made for her. According to this ...
{ "input": [], "output": [] }
{ "input": [ "1\n4 1 2\n\nSAMPLE" ], "output": [ "3" ] }
{ "input": [], "output": [] }
special-knight
In the game of chess, there is a piece called the knight. A knight is special -- instead of moving in a straight line like other pieces, it jumps in an "L" shape. Specifically, a knight can jump from square (r1, c1) to (r2, c2) if and only if (r1 - r2)2 + (c1 - c2)2 = 5. In this problem, one of our knights is going to...
{ "input": [], "output": [] }
{ "input": [ "2\n1 1 0\n4 4 1\n2 1\n\nSAMPLE" ], "output": [ "Case #1: 1\nCase #2: 2" ] }
{ "input": [], "output": [] }
p01644 Collector
* This story is fiction and has nothing to do with real people or groups. Social games have become very popular these days, and many companies are developing social games. You are infiltrating one of the competing social game developers as a spy. problem The company you work for develops social games. The game we a...
{ "input": [], "output": [] }
{ "input": [ "N (Sレアカードの種類)\nP_1 (カード1が好きな人の割合)\nP_2 (カード2が好きな人の割合)\n...\nP_N (カードNが好きな人の割合)" ], "output": [ "10000" ] }
{ "input": [], "output": [] }
p02068 Non-trivial Common Divisor
Problem Statement You are given a positive integer sequence $A$ of length $N$. You can remove any numbers from the sequence to make the sequence “friendly". A sequence is called friendly if there exists an integer $k$ (>1) such that every number in the sequence is a multiple of $k$. Since the empty sequence is friendl...
{ "input": [], "output": [] }
{ "input": [ "" ], "output": [ "" ] }
{ "input": [], "output": [] }
cb01
This is a very simple problem. Given the value of N and K, you need to tell us the value of the binomial coefficient C(N,K). You may rest assured that K ≤ N and the maximum value of N is 1,000,000,000,000,000. Since the value may be very large, you need to compute the result modulo 1009. Input The first line of the in...
{ "input": [], "output": [] }
{ "input": [ "3\n3 1\n5 2\n10 3" ], "output": [ "3\n10\n120" ] }
{ "input": [], "output": [] }
gshuff
Presti Digitator, the world-famous magician, is highly dissatisfied with his way of shuffling cards. Just yesterday, a perky guy in the audience demanded that he shuffle the cards once again, and he was aghast to see that the bottom card had not changed. Even though Mr. Digitator pacified the crowd with a few excellent...
{ "input": [], "output": [] }
{ "input": [ "2\n2\n4" ], "output": [ "1\n9" ] }
{ "input": [], "output": [] }
mdosa
Harish has decided to go to Arya's hotel this morning. We all know he is crazy for masala dosas. And as usual he is always hungry. He decided to order all the masala dosas at once. But then he realised that he did not have enough money to buy all of them. So he decided to share the amount with his friend Ozil. But both...
{ "input": [], "output": [] }
{ "input": [ "2 \n16 \n27" ], "output": [ "YES\nNO" ] }
{ "input": [], "output": [] }
reciibks
Shrija's brother Vaibhav is a very mischievous boy . He has messed a lot of books of Shrija on floor . Now Shrija is very angry . Seeing her sister angry he promises to arrange them on N empty stacks numbered from 1 to N . Shrija also felt that she should help her brother in arranging the books. So she gives Vaibhav a ...
{ "input": [], "output": [] }
{ "input": [ "5 3\n2 4\n1 3\n3 5" ], "output": [ "2" ] }
{ "input": [], "output": [] }
tr004
Problem Statement Chef Diablo has set up a stall for selling his famous Modaks in the Trinity fest. He wants to earn as much profit as he can. So he has bought a chemical that increases the taste level of the Modaks. The tastier the Modaks the higher he can price them. This chemical is very costly hence he applies on...
{ "input": [], "output": [] }
{ "input": [ "3\n1 1\n2 2\n123123123123 2" ], "output": [ "1\n4\n293883007" ] }
{ "input": [], "output": [] }
120_B. Quiz League
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
{ "input": [ "200 31\n1 0 0 1 1 1 0 0 0 0 0 1 1 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1 1 0 0 0 1 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 0 0 1 1 1 0 0 0 1 0 0 0 1 1 0 0 0 0 1 1 0 1 1 1 1 1 0 0 1 1 1 0 0 0 0 1 0 1 1 1 0 1 1 0 0 1 1 1 1 1 0 1 0 1 1 0 1 0 1 1 0 0 1 1 0 0 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 1 ...
{ "input": [ "5 5\n0 1 0 1 0\n", "2 1\n1 1\n" ], "output": [ "2\n", "1\n" ] }
{ "input": [], "output": [] }
exam
An exam consists of N questions. The marks of the N questions are m1, m2, m3, .. mN respectively. Jam is giving the exam and he wants to maximise his number of marks. However he takes some time to solve each question. The time taken by him to solve the questions are t1, t2, t3, .. tN respectively. The exams lasts for a...
{ "input": [], "output": [] }
{ "input": [ "3\n10\n1 2 3\n4 3 4" ], "output": [ "8" ] }
{ "input": [], "output": [] }
1184_C3. Heidi and the Turing Test (Hard)
The Cybermen have again outwitted the Daleks! Unfortunately, this time the Daleks decided to abandon these tasks altogether, which means the Doctor has to deal with them. The Doctor can handle the Daleks on his own, but Heidi now has to make sure that the Cybermen are kept busy with this next task. There are k rings ...
{ "input": [], "output": [] }
{ "input": [], "output": [] }
{ "input": [], "output": [] }
136_A. Presents
Little Petya very much likes gifts. Recently he has received a new laptop as a New Year gift from his mother. He immediately decided to give it to somebody else as what can be more pleasant than giving somebody gifts. And on this occasion he organized a New Year party at his place and invited n his friends there. If t...
{ "input": [ "71\n35 50 55 58 25 32 26 40 63 34 44 53 24 18 37 7 64 27 56 65 1 19 2 43 42 14 57 47 22 13 59 61 39 67 30 45 54 38 33 48 6 5 3 69 36 21 41 4 16 46 20 17 15 12 10 70 68 23 60 31 52 29 66 28 51 49 62 11 8 9 71\n", "100\n42 23 48 88 36 6 18 70 96 1 34 40 46 22 39 55 85 93 45 67 71 75 59 9 21 3 86 6...
{ "input": [ "3\n1 3 2\n", "4\n2 3 4 1\n", "2\n1 2\n" ], "output": [ "1 3 2 \n", "4 1 2 3 \n", "1 2 \n" ] }
{ "input": [], "output": [] }
1534_C. Little Alawn's Puzzle
When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row is a permutation of the numbers 1,2,3,…,n. The goal of Little Alawn's puzzle is to make sure no numbers on the same column or ...
{ "input": [], "output": [] }
{ "input": [ "2\n4\n1 4 2 3\n3 2 1 4\n8\n2 6 5 1 4 3 7 8\n3 8 7 5 1 2 4 6\n" ], "output": [ "\n2\n8\n" ] }
{ "input": [], "output": [] }
cut-the-stick
We have a S cm long stick.It can be broken only at certain positions.Sarah wants to calculate the number of GOOD Pairs. It satisfies the following conditions A good pair consists of 2 distinct positions where the stick can be broken. When the stick is broken at these two positions there should be at least one st...
{ "input": [ "7\n100 3 25\n25 50 75\n100 3 50\n25 50 75\n100 3 24\n25 50 75\n100 9 50\n99 88 77 66 55 44 33 22 11\n100 11 71\n67 21 90 77 19 38 85 91 23 29 42\n100 2 50\n50 51\n100 2 49\n50 51" ], "output": [ "3\n0\n3\n26\n10\n0\n1" ] }
{ "input": [ "2\n10 2 6\n1 3\n10 3 5\n1 3 9\n\nSAMPLE" ], "output": [ "1\n3" ] }
{ "input": [], "output": [] }
palindrome-check-2-1
A String is called Palindrome if it reads the same backwards as well as forwards. For example, the String aba can be read the same backwards as well as forwards. Now, a Permutation of a String S is some String K where S and K contain the same set of characters, however, these characters need not necessarily have the ...
{ "input": [ "sqezvgkgdlclzguaoejdjjebzmtmxucvpnjtlpbhoagkmdtvppskugaocuybxshemnxxgqubfdxqatygtiaojsuuplnjmgdoqweqlznfbcraajovzqzjsckfqqotujivjhrowacmlzteoypdiazckwpyksvwdjpsldvgiqajbqrcyfzlwhmxugeenaxdtgqfwdxvcogerxlsolguxbculygcdjyxibrgvyughpnsmwfugzlyjrbiwqbfrwhcukuoasgtkkwccjebjekyfaccntvhwlgicetuxyxbbnzjicau...
{ "input": [ "abab\n\nSAMPLE" ], "output": [ "YES" ] }
{ "input": [], "output": [] }
rhezo-and-cinema-hall-1
Rhezo is the new manager of Specialist Cinema Hall. A new movie is being released this Friday and Rhezo wants people in the hall to be seated according to some rules. His rules are weird and he likes that no 2 people in a row sit together/adjacent. He also wants that there are at least 2 people in each row. The hall ...
{ "input": [ "304 8\n475", "500 10\n500", "500 10\n393", "500 10\n437", "500 10\n495", "500 10\n475", "500 10\n422" ], "output": [ "660379328", "616800443", "616800443", "616800443", "616800443", "616800443", "616800443" ] }
{ "input": [], "output": [] }
{ "input": [], "output": [] }
p02072 All your base are belong to us
Problem Statement In A.D. 2101, war was beginning. The enemy has taken over all of our bases. To recapture the bases, we decided to set up a headquarters. We need to define the location of the headquarters so that all bases are not so far away from the headquarters. Therefore, we decided to choose the location to mini...
{ "input": [], "output": [] }
{ "input": [ "" ], "output": [ "" ] }
{ "input": [], "output": [] }
buycar
Walter white wants to buy a car, he does not care much about the type of car (sedan/hatchback/SUV) nor the power that the car has, all he cares about is how much the car will cost him, since he has loads of money , he wants to buy the most expensive car available in the market, but there is a catch! The tax percentages...
{ "input": [], "output": [] }
{ "input": [ "2\n3\nFerrari $100000 20%\nPorsche $200000 10%\nLamborghini $300000 10%\n2\nBMW $20000 50%\nBenz $15000 100%" ], "output": [ "Lamborghini\nBMW" ] }
{ "input": [], "output": [] }
psudo4
In the fest of Paradigm, every organiser is given a special kind of pager. The pager consists of a screen and a single big red button. To type a message in it, one has to push the red button that many time at which the alphabet occurs in the alphabetical order. For example for typing D, one needs to push button 4 times...
{ "input": [], "output": [] }
{ "input": [ "2\nA\nAB" ], "output": [ "1\n3" ] }
{ "input": [], "output": [] }
1170_I. Good Subsets
You are given n segments on the Ox axis. The i-th segment is given as a pair l_i, r_i, where l_i is the position of the left end of the i-th segment and r_i is the position of the right end of the i-th segment. Segments may intersect, overlap, or even coincide. A segment is a set of numbers (including floating-point nu...
{ "input": [], "output": [] }
{ "input": [ "3\n1 1\n2 6\n1 6\n", "2\n3 4\n2 5\n", "4\n1 2\n5 5\n2 3\n1 3\n" ], "output": [ "\n4\n", "\n2\n", "\n5\n" ] }
{ "input": [], "output": [] }
1250_F. Data Center
You are developing a project to build a new data center. The data center will be a rectangle with an area of exactly n square meters. Each side of the data center must be an integer. Your goal is to minimize the impact of the external environment on the data center. For this reason, you want to minimize the length of ...
{ "input": [], "output": [] }
{ "input": [ "36\n", "13\n", "1\n" ], "output": [ "\n24\n", "\n28\n", "\n4\n" ] }
{ "input": [], "output": [] }
143_E. Help Caretaker
Autumn came late to the kingdom of Far Far Away. The harvest was exuberant and it is now time to get ready for the winter. As most people celebrate the Harvest festival, Simon the Caretaker tries to solve a very non-trivial task of how to find place for the agricultural equipment in the warehouse. He's got problems wi...
{ "input": [ "1 8\n", "4 9\n", "4 8\n", "9 5\n", "2 6\n", "2 3\n", "5 9\n", "6 4\n", "8 8\n", "7 4\n", "3 8\n", "6 2\n", "1 9\n", "3 2\n", "5 3\n", "6 8\n", "8 5\n", "9 1\n", "1 4\n", "8 1\n", "8 7\n", "3 9\n", "9 2\n", "9...
{ "input": [ "5 6\n", "3 3\n", "2 2\n" ], "output": [ "4\nAAABBB\n.A..B.\nCA.DB.\nCCCDDD\nC..D..\n", "1\nAAA\n.A.\n.A.\n\n", "0\n..\n..\n\n" ] }
{ "input": [], "output": [] }
332_D. Theft of Blueprints
Insurgents accidentally got hold of the plan of a top secret research polygon created on a distant planet for the needs of the Galaxy Empire. The insurgents suppose that this polygon is developing new deadly weapon. The polygon consists of n missile silos connected by bidirectional underground passages. The passages ar...
{ "input": [ "4 3\n15 1 3\n5 8\n9\n", "2 1\n0\n", "10 9\n999999996 999999991 999999997 999999994 999999991 999999992 999999992 1000000000 999999995\n999999999 999999992 1000000000 999999993 999999996 999999996 999999996 999999991\n999999990 999999996 999999998 999999996 999999993 999999995 999999991\n9999...
{ "input": [ "3 2\n10 0\n11\n", "6 1\n-1 -1 -1 8 -1\n-1 5 -1 -1\n-1 -1 3\n-1 -1\n-1\n" ], "output": [ "14\n", "5\n" ] }
{ "input": [], "output": [] }
821_C. Okabe and Boxes
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack. Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and thr...
{ "input": [ "2\nadd 2\nadd 1\nremove\nremove\n", "4\nadd 1\nadd 2\nremove\nremove\nadd 4\nadd 3\nremove\nremove\n", "16\nadd 1\nadd 2\nadd 3\nadd 4\nadd 5\nadd 6\nadd 7\nadd 8\nadd 9\nadd 10\nadd 11\nadd 12\nadd 13\nadd 14\nadd 15\nadd 16\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nr...
{ "input": [ "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove\n", "3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove\n" ], "output": [ "2", "1" ] }
{ "input": [], "output": [] }
847_C. Sum of Nestings
Recall that the bracket sequence is considered regular if it is possible to insert symbols '+' and '1' into it so that the result is a correct arithmetic expression. For example, a sequence "(()())" is regular, because we can get correct arithmetic expression insering symbols '+' and '1': "((1+1)+(1+1))". Also the foll...
{ "input": [ "500 12169\n", "10 46\n", "4 5\n", "5 9\n", "50 282\n", "10 42\n", "301 43259\n", "5 8\n", "5001 12502500\n", "100 4298\n", "5 10\n", "4 1\n", "9999 41526212\n", "5 2\n", "4 2\n", "5 5\n", "3 2\n", "5 1\n", "5 0\n", "3 3\n", ...
{ "input": [ "3 1\n", "2 5\n", "4 6\n" ], "output": [ "(())()", "Impossible\n", "(((())))" ] }
{ "input": [], "output": [] }
aquarium-visit-b-1
Kritika visits a aquarium and is astonished to find that the sections of aquarium are numbered in a different way. First Section : -1 Second Section : 1 Third Section : 16 Fourth Section : 60 She realized that there is a pattern in the numbering. Help her in guessing the number of "nth" section. ** Input :**...
{ "input": [ "67438" ], "output": [ "5170862977916541521" ] }
{ "input": [], "output": [] }
{ "input": [], "output": [] }
good-words
Description In a particular language words are written using only two symbols: ones(1) and zeroes(0). A given word N is called “good” if it can be written in the form of concatenation of several(two or more than two) copies of some shorter word, and is called bad otherwise. For example the words 100, 1100, 0010 are “...
{ "input": [ "5\n0" ], "output": [ "1" ] }
{ "input": [], "output": [] }
{ "input": [], "output": [] }
moody-numbers
Some people are just moody, you just cannot reason with them. Same goes with Natural Numbers. Some of them ultimely want to become 1 or 4 and will evolve infinite times if they have to, to become what they want to. To evolve, they use a function F such that N = F(N). Function F(N) is defined as : F(N) = sum_of_digits(...
{ "input": [], "output": [] }
{ "input": [ "4\n1\n2\n3\n8\n\nSAMPLE" ], "output": [ "YES\nYES\nNO\nYES" ] }
{ "input": [], "output": [] }
100_E. Lamps in a Line
There are n lamps in a line. The lamps are numbered 1 to n from left to right. There are also n keys. When key number i is pressed, all lamps number x such that i|x change their state. For two integer numbers a and b, we say a|b if and only if there exists an integer c such that a × c = b. Amirali likes to play with ...
{ "input": [], "output": [] }
{ "input": [ "2\noff off\n2\n1 2\n", "3\noff off on\n6\n1 1 1 1 2 2\n" ], "output": [ "on off \n", "off off on \n" ] }
{ "input": [], "output": [] }
683_B. The Teacher of Physical Education
n pupils came to Physical Education lesson. We know the name and the height of each pupil. Your task is to help the teacher of Physical Education to line up all pupils in non-decreasing order of their heights. Input The first line contains the positive integer n (1 ≤ n ≤ 5000) — the number of pupils. The next n li...
{ "input": [], "output": [] }
{ "input": [ "4\nIvan 150\nIgor 215\nDasha 158\nKatya 150\n", "2\nSASHA 180\nSASHA 170\n" ], "output": [ "Ivan\nKatya\nDasha\nIgor\n", "SASHA\nSASHA\n" ] }
{ "input": [], "output": [] }
987_E. Petr and Permutations
Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random permutation this way: he takes identity permutation of numbers from 1 to n and then 3n times takes a random pair of different elements and swaps them. Alex envies Petr and tr...
{ "input": [], "output": [] }
{ "input": [ "5\n2 4 5 1 3\n" ], "output": [ "Petr\n" ] }
{ "input": [], "output": [] }
debts-of-the-lannisters
Tyrion, son of Tywin was released from the dungeons of vale after his champion Bronn defeated Ser Vardis in the trial by combat. As a Lannister always pays his debts, he invited Bronn to play a game of mastermind with him. The game is played as follows: Tyrion has rocks of 7 colours. (As he is rich, he has infinitel...
{ "input": [ "IBBRVOOOGY\n100\nYBBBYBOOYI\nROOIIYRVIB\nOROYGROBVO\nBRVGVVIYRY\nRBOGYIOIIO\nOIIVBGYRGG\nOYROBIGOYG\nRBROYYVROI\nOVBROOIRVR\nIIYRVVGIIO\nBVVIGGGRVR\nGGBBRBGYBB\nYIBYBOOVOR\nIOORBIIYII\nVOOYOGBIGB\nGGIGVRGIYO\nYBORVIOBOR\nIIYRRYIGBB\nBVVVBRBOII\nYVVRVVOYIB\nORYOBVBRGO\nGROGBIYRYO\nVBYGIBRGGG\nYOVYBRG...
{ "input": [ "ROYGBIVVOG\n3\nVIBGYORROY\nRRRRRVVVVV\nROYGBIVVGO\n\nSAMPLE" ], "output": [ "2 6\n3 0\n8 2" ] }
{ "input": [], "output": [] }
game-of-riddle
"Bless us and splash us , precious . Thats a meaty mouthful . " said Gollum on seeing Bilbo Baggins . Poor Bilbo Baggins is lost in the Misty Mountains and worst of all now he is stuck with Gollum who wants to finish him off. As Mr. Bilbo Baggins is clever , he convinced Gollum to play a game of riddles where if Bil...
{ "input": [], "output": [] }
{ "input": [ "3\n5\n9 4 2 2 6 3 2 2 1\n2\n5 11 2 2 5 8 9 10 19\n5\n9 9 9 9 9 9 9 9 9\n\nSAMPLE" ], "output": [ "99999\n4\n-1" ] }
{ "input": [], "output": [] }
killing-white-walkers
"N" White Walkers are positioned in a circle from "1" to "N". First (No. 1) White Walker has a dragonglass . He kills the next White Walker (i.e. No. 2) and passes the dragonglass to the next (i.e. No. 3) who kills the 4th and passes the weapon to 5th White Walker. This way alternate killing of White Walkers goes on...
{ "input": [ "15\n8\n7\n3\n667\n5554\n234\n8866\n345\n765\n998\n4466\n76\n555\n3346\n6675" ], "output": [ "1\n7\n3\n311\n2917\n213\n1349\n179\n507\n973\n741\n25\n87\n2597\n5159" ] }
{ "input": [ "3\n100\n10\n4\n\nSAMPLE" ], "output": [ "73\n5\n1" ] }
{ "input": [], "output": [] }