messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 1
value |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHeidi the Cow is aghast: cracks in the northern Wall? Zombies gathering outside, forming groups, preparing their assault? This must not happen! Quickly, she fetches her HC2 (Handbook of Crazy Constructions) and looks for ... | [{"type": "stdin_stdout", "input": "350000 180000\n", "output": "708073\n"}, {"type": "stdin_stdout", "input": "400000 140000\n", "output": "956370\n"}, {"type": "stdin_stdout", "input": "350000 140000\n", "output": "453366\n"}, {"type": "stdin_stdout", "input": "450000 160000\n", "output": "926957\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain obstacles. Then, he ... | [{"type": "stdin_stdout", "input": "100 33\nG..................................................................................................T\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 20\n.....G.#.#..................#.........##....#...................#.#..........#...#.#.T..#.......#...\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCan you imagine our life if we removed all zeros from it? For sure we will have many problems.\n\nIn this problem we will have a simple example if we removed all zeros from our life, it's the addition operation. Let's ass... | [{"type": "stdin_stdout", "input": "1000000000\n1000000000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1000000000\n1000010000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000000000\n1001010000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "999999999\n999999999\n", "output": "YES\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHave you ever tasted Martian food? Well, you should.\n\nTheir signature dish is served on a completely black plate with the radius of R, flat as a pancake.\n\nFirst, they put a perfectly circular portion of the Golden Hon... | [{"type": "stdin_stdout", "input": "2\n4 3 1\n4 2 2\n", "output": "0.9230769231\n0.6666666667\n"}, {"type": "stdin_stdout", "input": "2\n4 3 1\n5 2 2\n", "output": "0.9230769231\n0.6521739130\n"}, {"type": "stdin_stdout", "input": "2\n8 3 1\n4 2 2\n", "output": "2.4489795918\n0.6666666667\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this:\n\nThere are space-separated non-empty words of lowercase and uppercase Latin letters.\n\nThere are ... | [{"type": "stdin_stdout", "input": "2\nWjrWBWqKIeSndDHeiVmfChQNsoUiRQHVplnIWkwBtxAJhOdTigAAzKtbNEqcgvbWHOopfCNgWHfwXyzSCfNqGMLnmlIdKQonLsmGSJlPBcYfHNJJDGlKNnOGtrWUhaTWuilHWMUlFEzbJYbeAWvgnSOOOPLxX-eJEKRsKqSnMjrPbFDprCqgbTfwAnPjFapVKiTjCcWEzhahwPRHScfcLnUixnxckQJzuHzshyBFKPwVGzHeJWniiRKynDFQdaazmTZtDGnFVTmTUZCRCpUHFmUHA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has a checkered sheet of paper of size n Γ m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's \"Black Square\", Polycarp wants to paint minimum possible number of whit... | [{"type": "stdin_stdout", "input": "20 10\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWBWBBWW\nWWBWWBWWWW\nWWWWBWWWWW\nWWWWBWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\n", "output": "29\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPerhaps many have heard that the World Biathlon Championship has finished. Although our hero Valera was not present at this spectacular event himself and only watched it on TV, it excited him so much that he decided to en... | [{"type": "stdin_stdout", "input": "15\n17 5\n-19 5\n-8 3\n27 2\n45 3\n36 2\n-32 2\n49 1\n-3 2\n-41 2\n-35 1\n-46 1\n-29 1\n33 1\n0 1\n50\n24 -4\n41 3\n37 3\n9 2\n38 -4\n-30 2\n-41 -5\n-9 -5\n-33 3\n0 2\n-20 -3\n-49 -4\n34 1\n-38 -2\n17 -1\n-33 3\n-17 4\n16 3\n-49 2\n-3 -4\n-9 2\n35 3\n37 -5\n0 0\n-46 -5\n48 1\n-22 -4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnn and Borya have n piles with candies and n is even number. There are ai candies in pile with number i.\n\nAnn likes numbers which are square of some integer and Borya doesn't like numbers which are square of any intege... | [{"type": "stdin_stdout", "input": "100\n444272562 25 25 0 49 73291074 64 100 638092144 756033694 0 700405846 16 25 25 100 36 25 269573395 288578186 366853675 36 81 49 4 0 25 49 9 64 0 4 36 36 49 0 64 64 532899768 1 64 9 549673690 25 64 4 817183855 25 146555318 36 495564252 100 49 9 36 100 49 100 4 100 9 64 9 432227412... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYes, that's another problem with definition of \"beautiful\" numbers.\n\nLet's call a positive integer x beautiful if its decimal representation without leading zeroes contains even number of digits, and there exists a pe... | [{"type": "stdin_stdout", "input": "60\n799032\n1880\n489633\n167604\n641858\n521214\n951107\n121088\n952294\n514428\n890184\n883033\n317778\n456130\n373364\n404297\n757369\n815335\n317046\n148887\n834163\n990592\n721319\n402371\n458279\n570263\n887791\n365893\n433095\n463049\n457336\n669570\n803506\n178817\n214599\n21... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvar the Boneless is a great leader. He is trying to capture Kattegat from Lagertha. The war has begun and wave after wave Ivar's warriors are falling in battle.\n\nIvar has n warriors, he places them on a straight line i... | [{"type": "stdin_stdout", "input": "100 55\n1 2 4 4 3 5 5 2 3 1 2 2 1 2 4 5 0 5 4 2 5 4 5 3 3 5 4 4 4 5 5 2 3 3 4 4 3 4 5 5 5 5 3 5 1 2 4 3 4 5 3 3 2 0 4 5 3 4 4 1 9 1 5 2 0 1 4 0 3 3 1 4 2 5 4 5 3 2 5 5 2 3 2 3 2 2 3 4 4 4 1 4 2 4 5 3 1 3 3 1\n5 2 1 4 3 4 3 1 4 4 1 2 0 2 1 5 5 4 5 4 2 5 2 1 5 1 4 0 1 5 4 5 1 4 4 2 5 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe king of ghosts is really disappointed when he sees that all the human beings on Planet Earth have stopped fearing the ghost race. He knows the reason for this. The existing ghost race has become really lazy and has st... | [{"type": "stdin_stdout", "input": "7 3\n1 -1 0 2 4 -1 4\n\nELPLAS", "output": "1 1\n1 1\n1 1\n2 1\n4 1\n-1 2\n4 2\n"}, {"type": "stdin_stdout", "input": "7 1\n2 -1 1 0 4 -1 2\n\nELPMAS", "output": "2 1\n2 1\n2 1\n2 1\n4 1\n-1 2\n2 2\n"}, {"type": "stdin_stdout", "input": "7 5\n-1 3 1 3 0 2 3\n\nS@MPLE", "output": "-1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs the Formula One Grand Prix was approaching, the officials decided to make the races a little more interesting with a new set of rules.\nAccording to the new set of rules, each driver will be given a vehicle with differ... | [{"type": "stdin_stdout", "input": "50\n83\n2 1 2 3 7 0 5 3 4 1 3 3 5 0 5 0 4 6 1 7 3 6 5 0 9 7 2 2 7 9 2 4 4 3 3 4 5 8 5 4 7 4 8 0 3 1 3 7 6 4 0 9 9 1 1 3 7 7 4 3 1 5 5 2 8 1 3 8 1 3 9 5 2 7 3 1 8 0 4 8 2 5 2 \n10\n9 8 8 9 8 5 6 3 6 1 \n37\n6 8 9 2 3 2 3 7 4 5 9 8 8 0 5 6 4 2 4 8 5 8 7 0 2 0 2 6 5 4 7 9 8 6 1 6 9 \n3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print `Yes`; ot... | [{"type": "stdin_stdout", "input": "1 -2 -2", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 -2 -2", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "18 3 3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 1 17", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "18 4 -1", "output": "No\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke's mother gave Snuke an undirected graph consisting of N vertices numbered 0 to N-1 and M edges. This graph was connected and contained no parallel edges or self-loops.\n\nOne day, Snuke broke this graph. Fortunately... | [{"type": "stdin_stdout", "input": "10 9 16\n7 6 0\n4 7 1\n9 7 0\n2 9 0\n2 3 0\n4 1 0\n10 0 0\n9 1 -1\n3 0 0", "output": "No\n"}, {"type": "stdin_stdout", "input": "10 9 16\n7 6 0\n4 7 1\n9 7 0\n2 9 0\n2 3 0\n4 1 0\n10 0 0\n6 1 -1\n3 0 0", "output": "No\n"}, {"type": "stdin_stdout", "input": "10 9 16\n7 6 0\n4 7 1\n9 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S of length N consisting of `A`, `B` and `C`, and an integer K which is between 1 and N (inclusive). Print the string S after lowercasing the K-th character in it.\n\nConstraints\n\n* 1 β€ N β€ 50\n* ... | [{"type": "stdin_stdout", "input": "10 1\nC?BB", "output": "c?BB\n"}, {"type": "stdin_stdout", "input": "10 1\nC?BA", "output": "c?BA\n"}, {"type": "stdin_stdout", "input": "-1 1\nBC@E", "output": "bC@E\n"}, {"type": "stdin_stdout", "input": "-1 2\nBB@E", "output": "Bb@E\n"}, {"type": "stdin_stdout", "input": "4 1\nCAB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a grid with N rows and N columns of squares. Let (i,j) be the square at the i-th row from the top and the j-th column from the left.\n\nThese squares have to be painted in one of the C colors from Color 1 to Colo... | [{"type": "stdin_stdout", "input": "4 3\n-1 0 71\n81 0 102\n14 92 0\n1 2 2 1\n2 1 2 3\n2 2 1 3\n1 1 2 2", "output": "551\n"}, {"type": "stdin_stdout", "input": "4 3\n-1 0 71\n81 0 102\n14 92 0\n1 2 2 1\n2 1 2 3\n2 2 1 3\n1 1 3 2", "output": "449\n"}, {"type": "stdin_stdout", "input": "4 3\n0 0 71\n81 0 102\n14 92 0\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N integers written on a blackboard. The i-th integer is A_i.\n\nTakahashi will repeatedly perform the following operation on these numbers:\n\n* Select a pair of integers, A_i and A_j, that have the same parity ... | [{"type": "stdin_stdout", "input": "5\n1 18 1 14 0", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5\n2 18 0 14 0", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5\n4 3 -1 16 4", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5\n2 3 -1 16 4", "output": "YES\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSummer vacation ended at last and the second semester has begun. You, a Kyoto University student, came to university and heard a rumor that somebody will barricade the entrance of your classroom. The barricade will be bui... | [{"type": "stdin_stdout", "input": "5 5 5\n3\n2\n11\n16\n18", "output": "5\n"}, {"type": "stdin_stdout", "input": "5 5 5\n3\n2\n11\n29\n18", "output": "5\n"}, {"type": "stdin_stdout", "input": "5 4 5\n3\n2\n11\n29\n18", "output": "5\n"}, {"type": "stdin_stdout", "input": "5 4 5\n3\n2\n11\n29\n30", "output": "5\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe new PIN is hard to remember. I was told that I shouldn't take notes, but I don't think I can remember them. Therefore, I decided to embed a numerical value in the text and make a note of the PIN. Here, the sum of all ... | [{"type": "stdin_stdout", "input": "Thereare100yenonthetable.Iam17yearsold.\n.mp6taemohogdluohsI", "output": "123\n"}, {"type": "stdin_stdout", "input": "Thergarn100yeeontgesable-Iam17ye`rsolc.\nIshptkogdhomemt5q`.", "output": "122\n"}, {"type": "stdin_stdout", "input": "Thereare100yenonthetable.Iam17ye`rsold.\n.mp6tae... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJapan achieved the second straight victory in the national baseball competition WBC !! A baseball tournament was held at Aizu Gakuen High School as baseball became more popular. In this tournament, a round-robin league ma... | [{"type": "stdin_stdout", "input": "6\nA 1 0 0 2 -1\nB 0 0 1 2 -1\nC 2 1 1 1 1\nD 2 0 -1 0 2\nE 2 0 0 0 0\nF 1 1 1 2 2\n4\nh 1 1 1\ng 0 2 2\nx -1 0 0\n` 0 2 2\n0", "output": "E\nD\nA\nB\nF\nC\nx\ng\n`\nh\n"}, {"type": "stdin_stdout", "input": "6\nA 1 0 0 2 -1\nB 0 0 1 1 0\nC 1 1 1 1 1\nD 1 1 0 0 2\nE 2 0 -1 0 0\nF 1 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThe island where JOI lives has been invaded by zombies. JOI decided to escape to the shelter, which is set as the safest shelter on the island.\n\nThe island where JOI lives consists of N towns from town 1 to t... | [{"type": "stdin_stdout", "input": "13 21 1 1\n1001 6000\n11\n4 2\n3 7\n2 4\n8 8\n8 4\n2 10\n3 4\n6 7\n7 10\n10 11\n5 9\n11 10\n3 6\n4 5\n1 6\n13 12\n6 7\n8 11\n6 13\n7 8\n2 12", "output": "1001\n"}, {"type": "stdin_stdout", "input": "13 21 1 1\n1010 10247\n7\n1 2\n3 7\n2 4\n5 8\n8 9\n2 5\n3 4\n4 7\n9 10\n10 11\n9 9\n7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are a number of ways to shuffle a deck of cards. Hanafuda shuffling for Japanese card game 'Hanafuda' is one such example. The following is how to perform Hanafuda shuffling.\n\nThere is a deck of n cards. Starting ... | [{"type": "stdin_stdout", "input": "1 -2\n3 1\n3 1\n10 1\n1 10\n10 0\n8 -1\n0 0", "output": "1\n1\n10\n10\n8\n"}, {"type": "stdin_stdout", "input": "1 -2\n3 1\n3 1\n10 1\n4 10\n10 0\n8 -1\n0 0", "output": "1\n1\n7\n10\n8\n"}, {"type": "stdin_stdout", "input": "5 -1\n3 1\n1 1\n10 2\n1 10\n14 1\n11 0\n0 0", "output": "5\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFloating-Point Numbers\n\nIn this problem, we consider floating-point number formats, data representation formats to approximate real numbers on computers.\n\nScientific notation is a method to express a number, frequentl... | [{"type": "stdin_stdout", "input": "1\n0000000000100000000000000000000000000000000000000000\n2\n0000000000000000000000000000000000000000000000000000\n2\n0000000000000000001000000000000000000000000000000000\n11\n0000000000000000000000000000000000000000000000000000\n7\n1101000000000000000000000000000000000000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTraining is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.\n\nToday's training is to perform a very large number of calculations to improve the calc... | [{"type": "stdin_stdout", "input": "3\n0\n0\n1000000010", "output": "1000000010\n0\n0\n"}, {"type": "stdin_stdout", "input": "3\n0\n0\n1000000000", "output": "1000000000\n0\n0"}, {"type": "stdin_stdout", "input": "4\n11\n5\n10\n10", "output": "5\n10\n10\n11\n"}, {"type": "stdin_stdout", "input": "4\n11\n5\n19\n10", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nThere is an unsigned $ 2 $ decimal integer $ X $ with $ N $ in digits including Leading-zeros. Output the largest non-negative integer that can be expressed in $ 2 $ base in $ N $ digits where the Ham... | [{"type": "stdin_stdout", "input": "5\n00001\n4", "output": "11111\n"}, {"type": "stdin_stdout", "input": "5\n00000\n3", "output": "11100\n"}, {"type": "stdin_stdout", "input": "5\n00001\n1", "output": "10001\n"}, {"type": "stdin_stdout", "input": "5\n10001\n1", "output": "11001\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nGiven the squares of $ R * C $. Each square is either an empty square or a square with a hole. The given square meets the following conditions.\n\n* The cells with holes are connected. (You can move a square wi... | [{"type": "stdin_stdout", "input": "3 5\n.....\n.#.#.\n.###.\n.#.#.\n.....", "output": "3\n"}, {"type": "stdin_stdout", "input": "3 1\n.....\n.#.#.\n.###.\n.#.#.\n.....", "output": "0\n"}, {"type": "stdin_stdout", "input": "2 5\n.....\n.#.#.\n.###.\n.#.#.\n.....", "output": "2\n"}, {"type": "stdin_stdout", "input": "4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA binary heap which satisfies max-heap property is called max-heap. In a max-heap, for every node $i$ other than the root, $A[i] \\leq A[parent(i)]$, that is, the value of a node is at most the value of its parent. The la... | [{"type": "stdin_stdout", "input": "10\n-1 2 2 0 140 11 1 1 12 5", "output": " 140 12 11 1 5 2 1 -1 0 2\n"}, {"type": "stdin_stdout", "input": "10\n0 2 2 0 140 11 1 -1 12 5", "output": " 140 12 11 0 5 2 1 -1 0 2\n"}, {"type": "stdin_stdout", "input": "10\n1 -1 0 0 15 18 1 -1 -1 2", "output": " 18 15 1 0 2 0 1 -1 -1 -1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStack is a container of elements that are inserted and deleted according to LIFO (Last In First Out).\n\nFor $n$ stack $S_i$ ($i = 0, 1, ..., n-1$), perform a sequence of the following operations.\n\n* push($t$, $x$): Ins... | [{"type": "stdin_stdout", "input": "6 12\n1 0 0\n0 -1 1\n0 1 0\n0 0 4\n0 2 1\n1 1\n1 2\n1 0\n1 0", "output": "-1\n-1\n1\n4\n4\n4\n4\n"}, {"type": "stdin_stdout", "input": "6 12\n1 0 0\n0 0 1\n0 1 0\n0 0 4\n0 2 1\n1 1\n1 2\n1 0\n1 0", "output": "0\n0\n1\n4\n4\n4\n4\n"}, {"type": "stdin_stdout", "input": "6 12\n1 0 0\n0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe king's birthday dinner was attended by k guests. The dinner was quite a success: every person has eaten several dishes (though the number of dishes was the same for every person) and every dish was served alongside wi... | [{"type": "stdin_stdout", "input": "100 100\n97 64 64 35 35 97 39 83 26 97 92 97 83 11 83 97 97 64 23 97 97 11 39 11 11 39 64 14 23 39 64 26 26 97 39 39 39 64 83 26 83 97 64 11 64 64 64 83 64 92 64 26 83 26 27 64 11 83 92 92 23 11 11 97 92 64 97 64 97 83 64 27 83 23 11 26 11 92 83 64 83 11 11 11 97 83 97 26 26 97 23 23... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFrom \"ftying rats\" to urban saniwation workers - can synthetic biology tronsform how we think of pigeons? \n\nThe upiquitous pigeon has long been viewed as vermin - spleading disease, scavenging through trush, and defec... | [{"type": "stdin_stdout", "input": "10\n9 16 19 23 7 14 21 15 14 6\n", "output": "23\n"}, {"type": "stdin_stdout", "input": "10\n5 20 18 1 12 17 22 20 26 4\n", "output": "21\n"}, {"type": "stdin_stdout", "input": "10\n9 16 19 23 7 14 21 15 1 6\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "10\n5 20 18 1 12 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe legend of the foundation of Vectorland talks of two integers x and y. Centuries ago, the array king placed two markers at points |x| and |y| on the number line and conquered all the land in between (including the endp... | [{"type": "stdin_stdout", "input": "100\n404 523 -303 876 982 -275 498 287 255 491 -723 289 203 -796 -469 -299 -435 -869 58 577 55 600 153 -948 -11 726 129 797 -323 99 -934 -419 101 -307 -525 502 353 44 -905 371 -946 925 -538 614 -171 -867 -929 702 -429 720 94 -390 997 -803 451 379 57 -377 -545 -890 442 525 -975 -484 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp decided to relax on his weekend and visited to the performance of famous ropewalkers: Agafon, Boniface and Konrad.\n\nThe rope is straight and infinite in both directions. At the beginning of the performance, Aga... | [{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000 1000000000\n", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000 1000010000\n", "output": "2000020000\n"}, {"type": "stdin_stdout", "input": "500000000 250000000 750000000 1000000000\n", "output": "15000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n boxers, the weight of the i-th boxer is a_i. Each of them can change the weight by no more than 1 before the competition (the weight cannot become equal to zero, that is, it must remain positive). Weight is al... | [{"type": "stdin_stdout", "input": "125\n8 85 125 177 140 158 2 152 67 102 9 61 29 188 102 193 112 194 15 7 133 134 145 7 89 193 130 149 134 51 13 194 191 149 73 106 151 85 42 53 163 134 127 7 51 61 178 105 117 197 35 21 122 164 133 165 135 12 192 60 54 187 173 75 74 195 85 62 166 195 131 109 191 196 61 44 61 20 95 147... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string s and a number k (0 β€ k < |s|).\n\nAt the beginning of... | [{"type": "stdin_stdout", "input": "wfyjbwcuxjrvmunfbrhethdmepeampvjcypavwoolteucetnqntytdfstvunnfyvngydjcohnwgtfddcnvuewxcafwureiupfeljqydwtickfbokoytlxtuwmvmvflemfvcksszlwgcwtamzovectkzxuzdtvbujyfpvcruvzvgglozwktwawcbkkwkookmuhjlcyjvfrnzmgpglvnbrujtbvtwrsqbulusfwzulxnadaqbijfrsvteqqoirfaolhfbgorxdwigwxcydbfxhvhqzjqir... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHyakugoku has just retired from being the resident deity of the South Black Snail Temple in order to pursue her dream of becoming a cartoonist. She spent six months in that temple just playing \"Cat's Cradle\" so now she ... | [{"type": "stdin_stdout", "input": "0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 6 6 6 6 6 6 0 0 0\n1 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n", "output": "15.90475929388076714588\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSo the Beautiful Regional Contest (BeRC) has come to an end! n students took part in the contest. The final standings are already known: the participant in the i-th place solved p_i problems. Since the participants are pr... | [{"type": "stdin_stdout", "input": "5\n12\n5 4 4 3 2 2 1 1 1 1 1 1\n4\n4 3 2 0\n1\n1000000\n20\n20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 10 3 2 1\n32\n64 64 63 58 58 58 58 58 37 37 37 37 34 34 28 28 28 28 28 28 24 24 19 17 17 17 17 16 17 16 16 11\n", "output": "1 2 3\n0 0 0\n0 0 0\n1 2 7\n2 6 6\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's assume that we have a pair of numbers (a, b). We can get a new pair (a + b, b) or (a, a + b) from the given pair in a single step.\n\nLet the initial pair of numbers be (1,1). Your task is to find number k, that is,... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "999998\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "123455\n", "output": "26\n"}, {"type": "stdin_stdout", "input": "998756\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "999879\n", "output": "3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integers numbered from 1 to n.\n\nLet's define the k-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length k (recall th... | [{"type": "stdin_stdout", "input": "3\n5\n1 2 3 4 5\n5\n4 4 4 4 2\n6\n1 3 1 5 3 1\n", "output": "-1 -1 3 2 1 \n-1 4 4 4 2 \n-1 -1 1 1 1 1 \n"}, {"type": "stdin_stdout", "input": "3\n5\n4 4 4 4 2\n5\n1 2 3 4 5\n6\n1 3 1 5 3 1\n", "output": "-1 4 4 4 2 \n-1 -1 3 2 1 \n-1 -1 1 1 1 1 \n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th s... | [{"type": "stdin_stdout", "input": "58260522 77914575 2436426 24979445 61648772 23690081\n10\n582107247 906728404 411434947 673536177 411497300 488012525 561127307 800305059 992325267 112738006\n", "output": "804109112\n"}, {"type": "stdin_stdout", "input": "58260522 77914575 2436426 24979445 61648772 23690081\n10\n582... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n cards numbered 1, β¦, n. The card i has a red digit r_i and a blue digit b_i written on it.\n\nWe arrange all n cards in random order from left to right, with all permutations of 1, β¦, n having the same probabi... | [{"type": "stdin_stdout", "input": "3\n3\n150\n111\n3\n529\n159\n5\n18444\n11156\n", "output": "EQUAL\nEQUAL\nEQUAL\n"}, {"type": "stdin_stdout", "input": "3\n3\n777\n111\n3\n314\n159\n5\n09281\n09281\n", "output": "\nRED\nBLUE\nEQUAL\n"}, {"type": "stdin_stdout", "input": "3\n3\n777\n111\n3\n229\n159\n5\n16093\n11156\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have two positive integers a and b.\n\nYou can perform two kinds of operations:\n\n * a = β a/b β (replace a with the integer part of the division between a and b) \n * b=b+1 (increase b by 1) \n\n\n\nFind the minim... | [{"type": "stdin_stdout", "input": "19\n45713448 35\n788943748 304424261\n237960356 1\n487449924 402839525\n467441822 2\n716573439 455654889\n385540845 22\n184 114\n793833426 27\n765976595 822587672\n154 56\n329515648 1\n825827348 3\n169809490 255930640\n146 87\n41033 104433410\n50 122\n52634639 1\n11839593 1\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe student council has a shared document file. Every day, some members of the student council write the sequence TMT (short for Towa Maji Tenshi) in it.\n\nHowever, one day, the members somehow entered the sequence into ... | [{"type": "stdin_stdout", "input": "5\n3\nTMT\n3\nMTT\n6\nTMTMTT\n6\nTMTTTT\n6\nTTMMTT\n", "output": "\nYES\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "5\n3\nTMT\n3\nTMT\n6\nTMTMTT\n6\nTMTTTT\n6\nTTMMTT\n", "output": "YES\nYES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "5\n3\nTMT\n3\nMTT\n6\nTMT... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of the characters 0, 1, and ?.\n\nLet's call a string unstable if it consists of the characters 0 and 1 and any two adjacent characters are different (i. e. it has the form 010101... or... | [{"type": "stdin_stdout", "input": "3\n0?10\n???\n?10??1100\n", "output": "\n8\n6\n25\n"}, {"type": "stdin_stdout", "input": "3\n1?10\n???\n?10??1100\n", "output": "10\n6\n25\n"}, {"type": "stdin_stdout", "input": "3\n?010\n???\n?100?11?0\n", "output": "10\n6\n16\n"}, {"type": "stdin_stdout", "input": "3\n001?\n???\n?1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya lives in a strange world. The year has n months and the i-th month has ai days. Vasya got a New Year present β the clock that shows not only the time, but also the date.\n\nThe clock's face can display any number fr... | [{"type": "stdin_stdout", "input": "103\n100\n68 38 41 54 37 11 35 26 43 97 70 3 13 11 64 83 3 95 17 16 4 13 22 27 64 20 95 38 40 87 6 17 95 67 31 24 85 33 98 24 89 101 66 38 42 5 95 18 95 13 103 85 72 73 68 93 22 59 48 59 72 46 5 41 54 32 48 69 3 76 2 26 102 44 39 58 55 85 40 16 81 78 92 63 25 97 83 2 54 16 20 63 19 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves to play with color cards.\n\nHe has n cards, each has exactly two colors (the color of the front side and the color of the back side). Initially, all the cards lay on the table with the front sid... | [{"type": "stdin_stdout", "input": "100\n1 2\n2 1\n2 1\n1 2\n1 1\n1 2\n2 1\n1 1\n2 2\n2 1\n2 1\n1 1\n1 1\n2 1\n2 1\n2 1\n2 1\n2 1\n1 1\n2 1\n1 1\n1 1\n2 2\n1 2\n1 2\n1 2\n2 2\n1 2\n1 2\n2 1\n1 2\n2 1\n1 2\n2 2\n1 1\n2 1\n1 2\n2 1\n2 1\n1 2\n2 1\n2 1\n1 2\n2 1\n1 1\n1 2\n1 1\n1 1\n2 2\n2 2\n2 1\n2 1\n1 2\n2 2\n1 1\n2 1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other serv... | [{"type": "stdin_stdout", "input": "100 4283 65\n", "output": "65 1\n65 2\n65 3\n65 4\n65 5\n65 6\n65 7\n65 8\n65 9\n65 10\n65 11\n65 12\n65 13\n65 14\n65 15\n65 16\n65 17\n65 18\n65 19\n65 20\n65 21\n65 22\n65 23\n65 24\n65 25\n65 26\n65 27\n65 28\n65 29\n65 30\n65 31\n65 32\n65 33\n65 34\n65 35\n65 36\n65 37\n65 38\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters \"x\" and \"y\", and uses two following operations at runtime:... | [{"type": "stdin_stdout", "input": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\n", "output": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"}, {"type": "stdin_stdout", "input": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n", "output": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, {"type": "stdin_stdout", "input": "xxxxxx... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to ne... | [{"type": "stdin_stdout", "input": "100 100\n75 92 18 7 81 67 7 92 100 65 57 32 50 131 85 31 80 91 84 63 39 52 92 81 1 98 24 12 84 48 17 86 51 72 48 95 81 50 12 66 19 79 49 89 34 1 193 75 20 33 96 27 42 23 133 71 93 1 85 19 66 14 13 13 20 39 36 33 42 61 56 64 23 91 37 99 40 74 13 18 98 85 74 39 62 84 46 74 50 23 38 11 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYaroslav has an array, consisting of (2Β·n - 1) integers. In a single operation Yaroslav can change the sign of exactly n elements in the array. In other words, in one operation Yaroslav can select exactly n array elements... | [{"type": "stdin_stdout", "input": "56\n-157 136 457 598 -138 -586 -338 752 -566 -718 -333 -965 309 -125 -938 -188 -390 17 -75 -902 -320 163 820 -970 -525 -329 81 488 -412 978 138 344 305 -358 -273 -967 253 -665 -245 187 602 252 -825 -511 828 764 -402 278 995 541 542 549 612 -536 527 -884 225 800 160 -409 -926 -795 -32... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter too much playing on paper, Iahub has switched to computer games. The game he plays is called \"Block Towers\". It is played in a rectangular grid with n rows and m columns (it contains n Γ m cells). The goal of the ... | [{"type": "stdin_stdout", "input": "1 500\n........................................................................................................................................................................................................................................................................................ | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCucumber boy is fan of Kyubeat, a famous music game.\n\nKyubeat has 16 panels for playing arranged in 4 Γ 4 table. When a panel lights up, he has to press that panel.\n\nEach panel has a timing to press (the preffered tim... | [{"type": "stdin_stdout", "input": "4\n15168\n..7.\n.7..\n7...\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5\n..1.\n1111\n..1.\n..1.\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1\n.135\n1247\n3468\n5789\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4\n7777\n..7.\n.7..\n7...\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the break, we decided to relax and play dominoes. Our box with Domino was empty, so we decided to borrow the teacher's dominoes.\n\nThe teacher responded instantly at our request. He put nm dominoes on the table as... | [{"type": "stdin_stdout", "input": "9 9\n10 10 10 01 10 11 11 01 10\n11 00 10 10 11 10 01 00 00\n10 00 11 01 00 01 01 11 10\n10 11 10 00 01 11 11 10 11\n01 11 11 01 11 00 10 00 01\n01 00 00 10 01 01 10 00 01\n11 10 11 10 01 00 00 11 00\n10 11 10 10 01 10 10 10 01\n10 10 10 10 11 11 01 00 11\n", "output": "11 11 11 11 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got array a[1], a[2], ..., a[n], consisting of n integers. Count the number of ways to split all the elements of the array into three contiguous parts so that the sum of elements in each part is the same. \n\nMore ... | [{"type": "stdin_stdout", "input": "100\n1 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "120\n"}, {"type": "stdin_stdout", "input": "100\n1 0 0 0 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUncle Fyodor, Matroskin the Cat and Sharic the Dog live their simple but happy lives in Prostokvashino. Sometimes they receive parcels from Uncle Fyodorβs parents and sometimes from anonymous benefactors, in which case it... | [{"type": "stdin_stdout", "input": "scissors\nscissors\nscissors\n", "output": "?\n"}, {"type": "stdin_stdout", "input": "scissors\nscissors\npaper\n", "output": "?\n"}, {"type": "stdin_stdout", "input": "paper\nscissors\nscissors\n", "output": "?\n"}, {"type": "stdin_stdout", "input": "scissors\npaper\nscissors\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAll cities of Lineland are located on the Ox coordinate axis. Thus, each city is associated with its position xi β a coordinate on the Ox axis. No two cities are located at a single point.\n\nLineland residents love to se... | [{"type": "stdin_stdout", "input": "50\n-50000 -49459 -48875 -48456 -48411 -48096 -47901 -47500 -47150 -46808 -46687 -46679 -46337 -45747 -45604 -45194 -44752 -44242 -44231 -44122 -43636 -43274 -42916 -42881 -42386 -42095 -41830 -41618 -41145 -40897 -40534 -40007 -39761 -39389 -39104 -38909 -38630 -38561 -38364 -38255 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of weights. Weight of i-th of them is 2wi pounds. In each step, Duff can lift some of the remaining weig... | [{"type": "stdin_stdout", "input": "100\n196 1681 196 0 61 93 196 196 196 196 196 0 0 96 18 1576 0 93 666463 18 93 1 1278 8939 93 196 196 1278 3 0 67416 869956 10 56489 196 745 39 783 196 8939 196 81 69634 4552 39 3 14 20 25 8 10 4 7302 0 19579 20 1140 15990 7302 0 19579 4142 11 1354 75252 93 311 1278 0 79475 10 75252 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time in the thicket of the mushroom forest lived mushroom gnomes. They were famous among their neighbors for their magic mushrooms. Their magic nature made it possible that between every two neighboring mushro... | [{"type": "stdin_stdout", "input": "62 47 14 888621154\n202 268 300 401 422 660 782 822 1164 1300 1571 1670 1713 1807 2677 2700 2747 2873 2956 3068 3798 4159 4221 4232 4485 4507 4803 5071 5161 5161 5595 5600 5623 5846 5867 5949 6140 6560 6727 6781 6873 7159 7218 7232 7241 7333 7369 7415 7486 7506 7538 7681 7781 8074 87... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVery soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was a... | [{"type": "stdin_stdout", "input": "10 4\nigtVqPgoW 3 24\nuc 1 381\nOxmov[Av 4 727\nxyRAaAk 2 378\nvYCV 4 67\nuf 2 478\nDawOytiYiH 1 775\nRS 1 663\npLhTehhjA 2 38\nkYWfb 3 595\n", "output": "DawOytiYiH RS\nuf xyRAaAk\nkYWfb igtVqPgoW\nOxmov[Av vYCV\n"}, {"type": "stdin_stdout", "input": "10 4\nigtVqPgoW 3 24\nuc 1 381\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSasha lives in a big happy family. At the Man's Day all the men of the family gather to celebrate it following their own traditions. There are n men in Sasha's family, so let's number them with integers from 1 to n.\n\nEa... | [{"type": "stdin_stdout", "input": "4 3\n1 2\n2 3\n3 4\n1 2 3 4\n", "output": "4\n4\n3\n2\n1\n"}, {"type": "stdin_stdout", "input": "4 3\n1 2\n2 3\n3 4\n1 2 3 3\n", "output": "3\n3\n2\n1\n"}, {"type": "stdin_stdout", "input": "4 3\n1 2\n2 3\n3 4\n1 1 3 4\n", "output": "3\n4\n3\n1\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasily has a number a, which he wants to turn into a number b. For this purpose, he can do two types of operations:\n\n * multiply the current number by 2 (that is, replace the number x by 2Β·x); \n * append the digit 1 ... | [{"type": "stdin_stdout", "input": "1 536870912\n", "output": "YES\n30\n1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 \n"}, {"type": "stdin_stdout", "input": "2 536870912\n", "output": "YES... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSanta Claus decided to disassemble his keyboard to clean it. After he returned all the keys back, he suddenly realized that some pairs of keys took each other's place! That is, Santa suspects that each key is either on it... | [{"type": "stdin_stdout", "input": "dofbgdppdvmwjwtdyphhmqliydxyjfxoopxiscevowleccmhwybrxitvujkfliamvqinlrpytyaqdlbywccprukoisyaseibuqbfqjcabkieimsggsakpnqliwhehnemewhychqrfiuyaecoydnromrh\ndofbgdppdvmwjwtdyphhmqliydxyjfxoopxiscevowleccmhwybsxitvujkfliamvqinlrpytyaqdlbywccprukoisyaseibuqbfqjcabkieimsggsakpnqliwhehnemew... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).\n\nThere are n members, numbered 1 through n. m pairs of m... | [{"type": "stdin_stdout", "input": "20 80\n17 4\n10 1\n11 10\n17 7\n15 10\n14 15\n13 1\n18 13\n3 13\n12 7\n9 13\n10 12\n14 12\n18 11\n4 7\n10 13\n11 3\n19 8\n14 7\n10 17\n14 3\n7 11\n11 14\n19 5\n10 14\n15 17\n3 1\n9 10\n11 1\n4 1\n11 4\n9 1\n12 3\n13 7\n1 14\n11 12\n7 1\n9 12\n18 15\n17 3\n7 15\n4 10\n7 18\n7 9\n12 17... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZane the wizard had never loved anyone before, until he fell in love with a girl, whose name remains unknown to us.\n\n<image>\n\nThe girl lives in house m of a village. There are n houses in that village, lining in a str... | [{"type": "stdin_stdout", "input": "100 1 100\n0 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 110 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo stay woke and attentive during classes, Karen needs some coffee!\n\n<image>\n\nKaren, a coffee aficionado, wants to know the optimal temperature for brewing the perfect cup of coffee. Indeed, she has spent some time re... | [{"type": "stdin_stdout", "input": "3 2 4\n91 288\n92 97\n116 271\n92 192\n93 97\n95 138\n90 100\n", "output": "83\n5\n26\n6\n"}, {"type": "stdin_stdout", "input": "3 2 4\n91 510\n92 97\n66 271\n51 94\n93 97\n95 316\n100 111\n", "output": "4\n5\n177\n12\n"}, {"type": "stdin_stdout", "input": "3 2 4\n91 288\n92 97\n116 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLeha somehow found an array consisting of n integers. Looking at it, he came up with a task. Two players play the game on the array. Players move one by one. The first player can choose for his move a subsegment of non-ze... | [{"type": "stdin_stdout", "input": "4\n1000000000 1000000000 1000000000 99999999\n", "output": "First\n"}, {"type": "stdin_stdout", "input": "4\n1000000000 1000000001 1000000000 99999999\n", "output": "First\n"}, {"type": "stdin_stdout", "input": "4\n1000000000 1000000001 1000000000 80256192\n", "output": "First\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a. Some element of this array ai is a local minimum iff it is strictly less than both of its neighbours (that is, ai < ai - 1 and ai < ai + 1). Also the element can be called local maximum iff it is... | [{"type": "stdin_stdout", "input": "4\n1 5 2 5\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "4\n1 5 2 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "4\n1 7 2 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "2\n-1 1100\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n1 3 2 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEhab is interested in the bitwise-xor operation and the special graphs. Mahmoud gave him a problem that combines both. He has a complete graph consisting of n vertices numbered from 0 to n - 1. For all 0 β€ u < v < n, vert... | [{"type": "stdin_stdout", "input": "1000000000000\n", "output": "20140978692096\n"}, {"type": "stdin_stdout", "input": "1000100000000\n", "output": "20142429742080\n"}, {"type": "stdin_stdout", "input": "1000100000010\n", "output": "20142429742357\n"}, {"type": "stdin_stdout", "input": "1001100000010\n", "output": "201... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a set of size m with integer elements between 0 and 2^{n}-1 inclusive. Let's build an undirected graph on these integers in the following way: connect two integers x and y with an edge if and only if x \\& y... | [{"type": "stdin_stdout", "input": "6 35\n5 7 10 11 13 14 17 18 25 27 28 29 30 31 33 35 36 37 39 40 41 43 46 47 50 52 55 56 57 58 59 60 61 62 63\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "6 30\n3 8 13 16 18 19 21 22 24 25 26 28 29 31 33 42 44 46 49 50 51 53 54 57 58 59 60 61 62 63\n", "output": "10\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJoy and Rock decided to play a game. They have N cards numbered from 0 to Nβ1. Joy asks Rock to reverse the position of the cards, i.e., to change the order from say, 0,1,2,3 to 3,2,1,0. He further asks Rock to reverse th... | [{"type": "stdin_stdout", "input": "50\n97615 11366\n129085 77040\n95395 90668\n94578 90360\n95339 55581\n87700 42042\n56227 28167\n59884 29641\n73283 42196\n97418 38777\n56720 48469\n63282 60569\n96985 12698\n149509 65772\n50106 7383\n70192 51557\n99640 4982\n55928 48029\n66498 33584\n63566 2727\n73526 37143\n57808 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJoy is a short and lazy guy, he uses elevator to reach his flat. But unfortunately elevator is not working today and he became sad. Suddenly God came and made the stairs magical, such that he can jump on it in a magical w... | [{"type": "stdin_stdout", "input": "100\n41\n18467\n6334\n26500\n19169\n15724\n11478\n29358\n26962\n24464\n5705\n28145\n23281\n16827\n9961\n491\n2995\n11942\n4827\n5436\n32391\n14604\n3902\n153\n292\n12382\n17421\n18716\n19718\n19895\n5447\n21726\n14771\n11538\n1869\n19912\n25667\n26299\n17035\n9894\n28703\n23811\n3132... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBen believes a lot in tarot cards. He believes that they are lucky for him. He even decides to wear clothes according to the color predicted by a draw of a card. This irritates his wife, because sometimes he wears the sam... | [{"type": "stdin_stdout", "input": "2\n5\n1 -1 1 1 5\n6\n1 0 0 -1 -1 13\n\n\nLLPDAS", "output": "1 2\n1 2\n"}, {"type": "stdin_stdout", "input": "2\n5\n1 0 -1 0 2\n6\n-1 -1 4 3 1 4\n\n\nEPMMAS", "output": "1 3\n2 5\n"}, {"type": "stdin_stdout", "input": "2\n5\n1 1 3 4 5\n6\n0 4 -1 3 1 10\n\n\nSAMPLE", "output": "2 5\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a string S of length N consisting of `R`, `G`, and `B`.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\n* S_i \\neq S_j, S_i \\neq S_k, and S_j... | [{"type": "stdin_stdout", "input": "39\nBBBGBBBRBGBRBGBRBGGBRRRBBGRRBBGGBRGBRBR", "output": "1800\n"}, {"type": "stdin_stdout", "input": "39\nRBRBRRBGGBBRRGBBGRRBGGBRBGBRBGBRBBBGBBB", "output": "1796\n"}, {"type": "stdin_stdout", "input": "39\nRRRBGRBGGBBRRGBBRBRBGGBRBGBRBGBRBBBGBBB", "output": "1804\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoder Mart sells 1000000 of each of the six items below:\n\n* Riceballs, priced at 100 yen (the currency of Japan) each\n* Sandwiches, priced at 101 yen each\n* Cookies, priced at 102 yen each\n* Cakes, priced at 103 ye... | [{"type": "stdin_stdout", "input": "386", "output": "0\n"}, {"type": "stdin_stdout", "input": "115", "output": "0\n"}, {"type": "stdin_stdout", "input": "173", "output": "0\n"}, {"type": "stdin_stdout", "input": "145", "output": "0\n"}, {"type": "stdin_stdout", "input": "192", "output": "0\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N squares in a row. The squares are numbered 1, 2, ..., N from left to right.\n\nYou have two pieces, initially placed on square A and B, respectively. You will be asked to process Q queries of the following kin... | [{"type": "stdin_stdout", "input": "11 16 10 1\n1 3 5 1 11 7 5 2 5 3 3 3 5 10 6 8", "output": "27\n"}, {"type": "stdin_stdout", "input": "11 16 10 1\n1 3 5 1 11 7 5 2 5 3 3 3 5 10 6 7", "output": "26\n"}, {"type": "stdin_stdout", "input": "11 16 10 1\n1 3 5 1 11 7 5 2 5 3 3 3 5 11 6 7", "output": "27\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a tree with N vertices, numbered 1 through N.\n\nThe i-th of the N-1 edges connects the vertices p_i and q_i.\n\nAmong the sequences of distinct vertices v_1, v_2, ..., v_M that satisfy the following condition, f... | [{"type": "stdin_stdout", "input": "10\n7 9\n1 2\n6 5\n8 1\n3 10\n6 5\n2 10\n9 6\n2 6", "output": "5"}, {"type": "stdin_stdout", "input": "10\n7 9\n1 2\n10 4\n8 2\n3 7\n6 5\n2 10\n9 6\n2 6", "output": "8"}, {"type": "stdin_stdout", "input": "10\n7 9\n1 2\n10 4\n8 2\n3 7\n6 5\n3 10\n9 6\n2 6", "output": "8"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe height of the student was measured at the medical examination. Create a program that takes height data as input, creates a frequency distribution, and outputs it. The frequency distribution is divided into 6 classes i... | [{"type": "stdin_stdout", "input": "21\n182.52038838661136\n173.59035199874677\n159.1654152748587\n178.37721834424076\n171.14400777912027\n182.81130283538022\n174.6786970584368\n172.29285424816956\n164.63708333553282\n170.35024430895632\n176.98250427300766\n170.33088547272038\n163.32499378168183\n173.12553016807985\n17... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThere are the following games.\n\nN characters are lined up in a vertical row. The color of these characters is red, blue, or yellow, and in the initial state, four or more characters of the same color are not ... | [{"type": "stdin_stdout", "input": "12\n3\n2\n1\n1\n1\n3\n2\n1\n2\n1\n1\n5\n2\n3\n2\n1\n2\n2\n5\n0\n0\n3\n2\n-1\n0\n0", "output": "8\n2\n1\n2\n"}, {"type": "stdin_stdout", "input": "12\n3\n2\n1\n1\n1\n3\n2\n2\n2\n2\n1\n5\n2\n3\n2\n1\n2\n2\n5\n1\n0\n3\n2\n-1\n0\n0", "output": "3\n2\n1\n2\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are a student of University of Aizu. And you work part-time at a restaurant.\n\nStaffs of the restaurant are well trained to be delighted to provide more delicious products faster.\n\nThe speed providing products part... | [{"type": "stdin_stdout", "input": "5\n13:57 59\n12:02 15\n12:91 21\n17:53 2\n16:09 14\n0", "output": "lunch 66\ndinner no guest\nmidnight no guest\n"}, {"type": "stdin_stdout", "input": "5\n13:57 67\n12:03 15\n12:19 21\n08:52 2\n16:09 14\n0", "output": "lunch 33\ndinner no guest\nmidnight no guest\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n3\nNNN\nNNN\nNNN\n\n\nOutput\n\nTaro\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Python code t... | [{"type": "stdin_stdout", "input": "3\nNNN\nNNO\nNNN", "output": "Taro\n"}, {"type": "stdin_stdout", "input": "3\nNMN\nNNO\nNNN", "output": "Taro\n"}, {"type": "stdin_stdout", "input": "3\nNMN\nNNP\nNNN", "output": "Taro\n"}, {"type": "stdin_stdout", "input": "3\nMMN\nNNO\nNNN", "output": "Taro\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDice Stamp\n\nDice stamp\n\nAt a local fair, you found a game store you've never seen before. This is a game in which N 6-sided dice are dropped and rolled on the board. More precisely, N buttons are tied to N dice on a o... | [{"type": "stdin_stdout", "input": "1\n0 0\n1 2 3 4 5 6\nRRRRBBBBLLLLFFFF\n2\n0 0\n1 1 1 1 1 1\nRRR\n2 2\n100 100 100 100 100 101\nFFF\n1\n1010 -1000\n1 2 3 4 5 6\nLFRB\n4\n-3 -4\n1 2 3 4 5 6\nBBBBBBBB\n4 -3\n11 12 13 14 15 16\nLLLLLLLL\n3 4\n21 22 23 24 25 26\nFFFFFFFF\n-4 3\n31 32 33 34 35 36\nRRRRRRRR\n3\n-2 -2\n9 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nD: Indecision-Indecision-\n\nproblem\n\nEbi-chan has been addicted to gal games lately, and her goal now is to capture two heroines at the same time.\n\nEbi-chan can use several events to increase her liking from the hero... | [{"type": "stdin_stdout", "input": "1 4\n4 0 6\n1 1 -1\n-1 -1 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "1 4\n4 0 6\n2 1 -1\n-1 -1 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "1 2\n4 0 6\n2 1 -1\n-1 -1 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "1 2\n4 0 6\n2 2 -1\n-1 -1 -1", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nC: Shuttle Run\n\nStory\n\nUniversity H has a unique physical fitness test program, aiming to grow the mindset of students. Among the items in the program, shuttle run is well-known as especially eccentric one. Surprising... | [{"type": "stdin_stdout", "input": "1 3\n0 125", "output": "125\n"}, {"type": "stdin_stdout", "input": "1 -2\n1 22", "output": "22\n"}, {"type": "stdin_stdout", "input": "32 4\n0 1", "output": "128\n"}, {"type": "stdin_stdout", "input": "2 50\n0 4", "output": "100\n"}, {"type": "stdin_stdout", "input": "1 -2\n1 26", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nModulo is very good at drawing trees.\n\nOver the years, Modulo has drawn a picture of a tree with $ N $ vertices. The vertices of this tree are numbered from $ 1 $ to $ N $, and the vertices $ a_i $ ... | [{"type": "stdin_stdout", "input": "7\n1 3\n2 3\n3 4\n20 5\n4 6\n6 7", "output": "1100111\n"}, {"type": "stdin_stdout", "input": "7\n1 3\n2 1\n3 4\n20 5\n4 6\n6 7", "output": "1111111\n"}, {"type": "stdin_stdout", "input": "7\n1 3\n2 3\n3 4\n4 5\n4 6\n3 7", "output": "1101111\n"}, {"type": "stdin_stdout", "input": "7\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which manipulates a weighted rooted tree $T$ with the following operations:\n\n* $add(v,w)$: add $w$ to the edge which connects node $v$ and its parent\n\n* $getSum(u)$: report the sum of weights of all ed... | [{"type": "stdin_stdout", "input": "2\n1 1\n0\n41\n1 2 3\n1 1\n1 1 1\n1 2", "output": "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n1 1\n1 2\n1 3\n0\n12\n0 3 1000\n0 2 1000\n0 1 1000\n1 1\n1 2\n1 3", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a rectangular grid of size n Γ m. Each cell has a number written on it; the number on the cell (i, j) is a_{i, j}. Your task is to calculate the number of paths from the upper-left cell (1, 1) to the bottom-right... | [{"type": "stdin_stdout", "input": "10 10 524287\n1 2 4 8 16 32 64 128 256 512\n2 4 8 16 32 64 128 256 512 1024\n4 8 16 32 64 128 256 512 1024 2048\n8 16 32 64 128 256 512 1024 2048 4096\n16 32 64 128 256 512 1024 2048 4096 8192\n32 64 128 256 512 1024 2048 4096 8192 16384\n64 128 256 512 1024 2048 4096 8192 16384 3276... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya owns three big integers β a, l, r. Let's define a partition of x such a sequence of strings s_1, s_2, ..., s_k that s_1 + s_2 + ... + s_k = x, where + is a concatanation of strings. s_i is the i-th element of the pa... | [{"type": "stdin_stdout", "input": "12212222221212222221221221222222121222222122\n28110439567417001223290131317494419039608149\n22222111112222222222221221222222121222222122\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "12212222221212222221221221222222121222222122\n55921027620815462813527065083325544968950004... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph consisting of n vertices. A number is written on each vertex; the number on vertex i is a_i. Initially there are no edges in the graph.\n\nYou may add some edges to this graph, but you ha... | [{"type": "stdin_stdout", "input": "10 10\n3 4 5 10 10 9 5 4 7 8\n1 5 5\n10 3 18\n1 7 20\n7 8 20\n10 4 8\n10 2 17\n9 4 2\n7 5 16\n1 8 17\n7 10 18\n", "output": "67\n"}, {"type": "stdin_stdout", "input": "2 1\n100000000000 100000000000\n1 2 199999999999\n", "output": "199999999999\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given array a_1, a_2, ..., a_n. Find the subsegment a_l, a_{l+1}, ..., a_r (1 β€ l β€ r β€ n) with maximum arithmetic mean (1)/(r - l + 1)β_{i=l}^{r}{a_i} (in floating-point numbers, i.e. without any rounding).\n\nIf... | [{"type": "stdin_stdout", "input": "101\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "101\n2 2 2 2 2 2 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree with vertices numerated from 1 to n. A tree is a connected graph without cycles. A rooted tree has a special vertex named root.\n\nAncestors of the vertex i are all vertices on the path from th... | [{"type": "stdin_stdout", "input": "8\n2 1\n-1 0\n1 1\n1 1\n1 1\n4 0\n5 1\n7 1\n", "output": "1 3 5 7 8\n"}, {"type": "stdin_stdout", "input": "8\n2 1\n-1 0\n1 1\n1 1\n1 1\n4 0\n5 1\n7 0\n", "output": "1 3 5\n"}, {"type": "stdin_stdout", "input": "8\n2 1\n-1 0\n1 0\n1 1\n2 1\n4 0\n5 1\n7 1\n", "output": "5 7 8\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is same as the next one, but has smaller constraints.\n\nIt was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home). Af... | [{"type": "stdin_stdout", "input": "42\n-5391 -2932\n-5391 -2868\n-5391 1744\n-5391 2236\n-5391 4148\n-5391 5217\n-5391 6188\n-3584 -2932\n-3584 -2868\n-3584 1744\n-3584 2236\n-3584 4148\n-3584 5217\n-3584 6188\n-1657 -2932\n-1657 -2868\n-1657 1744\n-1657 2236\n-1657 4148\n-1657 5217\n-1657 6188\n3218 -2932\n3218 -2868... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMelody Pond was stolen from her parents as a newborn baby by Madame Kovarian, to become a weapon of the Silence in their crusade against the Doctor. Madame Kovarian changed Melody's name to River Song, giving her a new id... | [{"type": "stdin_stdout", "input": "1219679533107\n", "output": "1 609839766552\n"}, {"type": "stdin_stdout", "input": "1044191868535\n", "output": "1 522095934266\n"}, {"type": "stdin_stdout", "input": "1041721920937\n", "output": "1 520860960467\n"}, {"type": "stdin_stdout", "input": "1025662663437\n", "output": "1 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are on the island which can be represented as a n Γ m table. The rows are numbered from 1 to n and the columns are numbered from 1 to m. There are k treasures on the island, the i-th of them is located at the position... | [{"type": "stdin_stdout", "input": "21 3 61 3\n18 3\n21 3\n11 3\n13 2\n5 2\n14 2\n10 3\n9 3\n12 1\n1 2\n7 2\n20 1\n16 3\n18 2\n9 1\n20 3\n17 3\n6 1\n4 2\n1 1\n3 1\n4 1\n6 3\n6 2\n2 1\n13 3\n5 3\n3 2\n13 1\n10 1\n11 1\n18 1\n11 2\n5 1\n19 2\n20 2\n16 1\n12 3\n2 2\n3 3\n19 3\n8 2\n15 3\n8 1\n14 1\n17 1\n21 1\n19 1\n21 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice became interested in periods of integer numbers. We say positive X integer number is periodic with length L if there exists positive integer number P with L digits such that X can be written as PPPPβ¦P. For example:\... | [{"type": "stdin_stdout", "input": "98779\n163329605173223304180189399899081111990037\n", "output": "100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two positive integers a and b. In one move you can increase a by 1 (replace a with a+1). Your task is to find the minimum number of moves you need to do in order to make a divisible by b. It is possible, tha... | [{"type": "stdin_stdout", "input": "21\n1 3218\n28 10924\n908802 141084\n82149 7374\n893257 19784\n3535315 802705\n2857 176\n691 227749\n1 3218\n28 10924\n436302 141084\n82149 9274\n893257 10248\n4004924 1003579\n2857 142\n114 209385\n1 1131\n28 10924\n1144405 141084\n132660 9274\n2346605 10248\n", "output": "3217\n108... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPhoenix has n coins with weights 2^1, 2^2, ..., 2^n. He knows that n is even.\n\nHe wants to split the coins into two piles such that each pile has exactly n/2 coins and the difference of weights between the two piles is ... | [{"type": "stdin_stdout", "input": "100\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define a function f(x) (x is a positive integer) as follows: write all digits of the decimal representation of x backwards, then get rid of the leading zeroes. For example, f(321) = 123, f(120) = 21, f(1000000) = 1,... | [{"type": "stdin_stdout", "input": "100\n1\n2\n3\n4\n5\n4\n7\n8\n9\n10\n11\n12\n13\n17\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n17\n28\n29\n30\n31\n32\n31\n34\n35\n36\n27\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n29\n54\n100\n56\n57\n58\n59\n109\n61\n62\n63\n120\n65\n66\n67\n68\n69\n70\n71\n7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the two versions is that this version asks the minimal possible answer.\n\nHomer likes arrays a lot. Today he is painting an array a_1, a_2, ..., a_n with two kinds of colors, white and black. ... | [{"type": "stdin_stdout", "input": "15\n4 3 9 8 10 10 14 11 2 15 2 12 12 3 15\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "15\n4 3 9 8 10 10 14 7 2 15 2 12 12 3 15\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "15\n4 4 9 8 10 10 14 7 2 15 2 12 12 3 15\n", "output": "10\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp found a rectangular table consisting of n rows and m columns. He noticed that each cell of the table has its number, obtained by the following algorithm \"by columns\": \n\n * cells are numbered starting from on... | [{"type": "stdin_stdout", "input": "5\n1 1 1\n2 2 3\n3 10 11\n100 100 7312\n1001000 1000010 1000000000000\n", "output": "1\n2\n14\n1174\n1000009998991\n"}, {"type": "stdin_stdout", "input": "5\n1 1 1\n2 2 2\n3 10 11\n100 100 7312\n1001000 1000010 1000000000000\n", "output": "1\n3\n14\n1174\n1000009998991\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sequence (b_1, b_2, β¦, b_k) is called strange, if the absolute difference between any pair of its elements is greater than or equal to the maximum element in the sequence. Formally speaking, it's strange if for every pa... | [{"type": "stdin_stdout", "input": "6\n4\n-1 -2 -1 1\n7\n-3 2 -2 0 -4 7 1\n5\n0 5 -3 2 -5\n3\n2 0 1\n4\n-3 -1 2 0\n6\n-3 -2 -1 1 1 1\n", "output": "3\n5\n4\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "6\n4\n-1 -2 -1 1\n7\n-3 2 -2 0 -4 7 1\n5\n0 5 -3 1 -5\n3\n2 0 1\n4\n-3 -1 2 0\n6\n-3 -2 -2 1 1 1\n", "output": "3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach of you probably has your personal experience of riding public transportation and buying tickets. After a person buys a ticket (which traditionally has an even number of digits), he usually checks whether the ticket i... | [{"type": "stdin_stdout", "input": "100\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100\n77183123282838... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.