problem_id
stringlengths
6
31
task_type
stringclasses
1 value
prompt
stringlengths
29
13.2k
verification_info
stringlengths
160
168M
codeforces_primeintellect_300
deepcoder
Solve the following coding problem using the programming language python: Today an outstanding event is going to happen in the forest — hedgehog Filya will come to his old fried Sonya! Sonya is an owl and she sleeps during the day and stay awake from minute l_1 to minute r_1 inclusive. Also, during the minute k she p...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"1 10 9 20 1\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 100 50 200 75\\n\", \"output\": \"50\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6 6 5 8 9\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 10000...
codeforces_primeintellect_301
deepcoder
Solve the following coding problem using the programming language python: The process of mammoth's genome decoding in Berland comes to its end! One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"8\\nAG?C??CT\\n\", \"output\": \"AGACGTCT\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4\\nAGCT\\n\", \"output\": \"AGCT\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6\\n????G?\\n\", \"output\": \"===\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4...
codeforces_primeintellect_302
deepcoder
Solve the following coding problem using the programming language python: Ilya is an experienced player in tic-tac-toe on the 4 × 4 field. He always starts and plays with Xs. He played a lot of games today with his friend Arseny. The friends became tired and didn't finish the last game. It was Ilya's turn in the game ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"xx..\\n.oo.\\nx...\\noox.\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"x.ox\\nox..\\nx.o.\\noo.x\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"x..x\\n..oo\\no...\\nx.xo\\n\", \"output\": \"YES\\n\"}, {\"ty...
codeforces_primeintellect_303
deepcoder
Solve the following coding problem using the programming language python: Vasya has an array a consisting of positive integer numbers. Vasya wants to divide this array into two non-empty consecutive parts (the prefix and the suffix) so that the sum of all elements in the first part equals to the sum of elements in the...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3\\n1 3 2\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5\\n1 2 3 4 5\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5\\n2 2 3 4 5\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5\\...
codeforces_primeintellect_304
deepcoder
Solve the following coding problem using the programming language python: A few years ago, Hitagi encountered a giant crab, who stole the whole of her body weight. Ever since, she tried to avoid contact with others, for fear that this secret might be noticed. To get rid of the oddity and recover her weight, a special...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 2\\n11 0 0 14\\n5 4\\n\", \"output\": \"Yes\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6 1\\n2 3 0 8 9 10\\n5\\n\", \"output\": \"No\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4 1\\n8 94 0 4\\n89\\n\", \"output\": \"Yes\\n\"}, {\"type\": \"stdin...
codeforces_primeintellect_305
deepcoder
Solve the following coding problem using the programming language python: The Duck song For simplicity, we'll assume that there are only three types of grapes: green grapes, purple grapes and black grapes. Andrew, Dmitry and Michal are all grapes' lovers, however their preferences of grapes are different. To make al...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"1 6 2\\n4 3 3\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 1 1\\n4 3 2\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 1 100000\\n4 2 99995\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"in...
codeforces_primeintellect_306
deepcoder
Solve the following coding problem using the programming language python: While swimming at the beach, Mike has accidentally dropped his cellphone into the water. There was no worry as he bought a cheap replacement phone with an old-fashioned keyboard. The keyboard has only ten digital equal-sized keys, located in the...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3\\n586\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n09\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"9\\n123456789\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3\\n911\\n\",...
codeforces_primeintellect_307
deepcoder
Solve the following coding problem using the programming language python: Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assistant. Shop, where Noora...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 2\\n2 1\\n3 5\\n2 3\\n1 5\\n\", \"output\": \"10\"}, {\"type\": \"stdin_stdout\", \"input\": \"4 1\\n0 2\\n0 3\\n3 5\\n0 6\\n\", \"output\": \"5\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 1\\n5 8\\n\", \"output\": \"8\"}, {\"type\": \"stdin_stdout\", \...
codeforces_primeintellect_308
deepcoder
Solve the following coding problem using the programming language python: It is a balmy spring afternoon, and Farmer John's n cows are ruminating about link-cut cacti in their stalls. The cows, labeled 1 through n, are arranged so that the i-th cow occupies the i-th stall from the left. However, Elsie, after realizing...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"5 2\\n\", \"output\": \"10\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 10\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"100000 2\\n\", \"output\": \"399990\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 1\\n\", \"output\": ...
codeforces_primeintellect_309
deepcoder
Solve the following coding problem using the programming language python: Ivan is collecting coins. There are only $N$ different collectible coins, Ivan has $K$ of them. He will be celebrating his birthday soon, so all his $M$ freinds decided to gift him coins. They all agreed to three terms: Everyone must gift as ma...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"20 15 2 3\\n\", \"output\": \"1\"}, {\"type\": \"stdin_stdout\", \"input\": \"10 11 2 4\\n\", \"output\": \"-1\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 1 1 1\\n\", \"output\": \"2\"}, {\"type\": \"stdin_stdout\", \"input\": \"10 2 9 7\\n\", \"output\":...
codeforces_primeintellect_310
deepcoder
Solve the following coding problem using the programming language python: Polycarp 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 white cells with black so that...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"5 4\\nWWWW\\nWWWB\\nWWWB\\nWWBB\\nWWWW\\n\", \"output\": \"5\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 2\\nBB\\n\", \"output\": \"-1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 3\\nWWW\\nWWW\\nWWW\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdi...
codeforces_primeintellect_311
deepcoder
Solve the following coding problem using the programming language python: There is a beautiful garden of stones in Innopolis. Its most beautiful place is the $n$ piles with stones numbered from $1$ to $n$. EJOI participants have visited this place twice. When they first visited it, the number of stones in piles wa...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"5\\n1 2 3 4 5\\n2 1 4 3 5\\n\", \"output\": \"Yes\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5\\n1 1 1 1 1\\n1 0 1 0 1\\n\", \"output\": \"Yes\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3\\n2 3 9\\n1 7 9\\n\", \"output\": \"No\\n\"}, {\"type\": \"...
codeforces_primeintellect_312
deepcoder
Solve the following coding problem using the programming language python: Alice got many presents these days. So she decided to pack them into boxes and send them to her friends. There are $n$ kinds of presents. Presents of one kind are identical (i.e. there is no way to distinguish two gifts of the same kind). Prese...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"1 3\\n\", \"output\": \"7\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 2\\n\", \"output\": \"9\"}, {\"type\": \"stdin_stdout\", \"input\": \"1000000000 1000000000\\n\", \"output\": \"751201557\"}, {\"type\": \"stdin_stdout\", \"input\": \"489132389 96\\n\"...
codeforces_primeintellect_313
deepcoder
Solve the following coding problem using the programming language python: Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3\\n\", \"output\": \"4 5\"}, {\"type\": \"stdin_stdout\", \"input\": \"6\\n\", \"output\": \"8 10\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n\", \"output\": \"-1\"}, {\"type\": \"stdin_stdout\", \"input\": \"17\\n\", \"output\": \"144 145\"}, {\"type\...
codeforces_primeintellect_314
deepcoder
Solve the following coding problem using the programming language python: Imp is watching a documentary about cave painting. [Image] Some numbers, carved in chaotic order, immediately attracted his attention. Imp rapidly proposed a guess that they are the remainders of division of a number n by all integers i from 1...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 4\\n\", \"output\": \"No\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 3\\n\", \"output\": \"Yes\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 1\\n\", \"output\": \"Yes\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"744 18\\n\", \"output\": \"No...
codeforces_primeintellect_315
deepcoder
Solve the following coding problem using the programming language python: Kuro has recently won the "Most intelligent cat ever" contest. The three friends then decided to go to Katie's home to celebrate Kuro's winning. After a big meal, they took a small break then started playing games. Kuro challenged Katie to crea...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3 1\\n-1 0 1\\n\", \"output\": \"6\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 1\\n1 0\\n\", \"output\": \"1\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 1\\n-1\\n\", \"output\": \"2\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 0\\n-1\\n\", \"output...
codeforces_primeintellect_316
deepcoder
Solve the following coding problem using the programming language python: The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $(Ox)$ axis. On this street, there are $n$ antennas, numbered from $1$ to $n$. The $i$-th antenna lies on the position $x_i$ and has an initial ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3 595\\n43 2\\n300 4\\n554 10\\n\", \"output\": \"281\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 1\\n1 1\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 50\\n20 0\\n3 1\\n\", \"output\": \"30\\n\"}, {\"type\": \"stdin_stdout\"...
codeforces_primeintellect_317
deepcoder
Solve the following coding problem using the programming language python: You have a set of items, each having some integer weight not greater than $8$. You denote that a subset of items is good if total weight of items in the subset does not exceed $W$. You want to calculate the maximum possible weight of a good sub...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"10\\n1 2 3 4 5 6 7 8\\n\", \"output\": \"10\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"0\\n0 0 0 0 0 0 0 0\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3\\n0 4 1 0 0 9 8 3\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\...
codeforces_primeintellect_318
deepcoder
Solve the following coding problem using the programming language python: Someone gave Alyona an array containing n positive integers a_1, a_2, ..., a_{n}. In one operation, Alyona can choose any element of the array and decrease it, i.e. replace with any positive integer that is smaller than the current one. Alyona c...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"5\\n1 3 3 3 6\\n\", \"output\": \"5\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n2 1\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n1\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n1000000000\\n\...
codeforces_primeintellect_319
deepcoder
Solve the following coding problem using the programming language python: Recently Vasya found a golden ticket — a sequence which consists of $n$ digits $a_1a_2\dots a_n$. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For example, ticket $350178$ ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"5\\n73452\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4\\n1248\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n00\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3\\n555\\n\", \...
codeforces_primeintellect_320
deepcoder
Solve the following coding problem using the programming language python: Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that they...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"wjmzbmr\\n\", \"output\": \"CHAT WITH HER!\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"xiaodao\\n\", \"output\": \"IGNORE HIM!\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"sevenkplus\\n\", \"output\": \"CHAT WITH HER!\\n\"}, {\"type\": \"stdin_stdout...
codeforces_primeintellect_321
deepcoder
Solve the following coding problem using the programming language python: This morning, Roman woke up and opened the browser with $n$ opened tabs numbered from $1$ to $n$. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 2\\n1 1 -1 1\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"14 3\\n-1 1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 1\\n\", \"output\": \"9\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4 2\\n1 1 1 -1\\n\", \"output\": \"2\\n\"}, {\"type\": \"s...
codeforces_primeintellect_322
deepcoder
Solve the following coding problem using the programming language python: R3D3 spent some time on an internship in MDCS. After earning enough money, he decided to go on a holiday somewhere far, far away. He enjoyed suntanning, drinking alcohol-free cocktails and going to concerts of popular local bands. While listenin...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 1 2\\n\", \"output\": \"12\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 1 5\\n\", \"output\": \"6\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 1 1\\n\", \"output\": \"5\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 5 5\\n\", \"output\": \"6...
codeforces_primeintellect_323
deepcoder
Solve the following coding problem using the programming language python: The circle line of the Roflanpolis subway has $n$ stations. There are two parallel routes in the subway. The first one visits stations in order $1 \to 2 \to \ldots \to n \to 1 \to 2 \to \ldots$ (so the next stop after station $x$ is equal to $(...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"5 1 4 3 2\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"10 2 1 9 10\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4 3 4 2 1\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"100 2 97 8...
codeforces_primeintellect_324
deepcoder
Solve the following coding problem using the programming language python: Unlucky year in Berland is such a year that its number n can be represented as n = x^{a} + y^{b}, where a and b are non-negative integer numbers. For example, if x = 2 and y = 3 then the years 4 and 17 are unlucky (4 = 2^0 + 3^1, 17 = 2^3 + 3^...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"2 3 1 10\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 5 10 22\\n\", \"output\": \"8\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 3 3 5\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 2 1 10\\n\", \"ou...
codeforces_primeintellect_325
deepcoder
Solve the following coding problem using the programming language python: Beroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos and suggestions of how to fix them. Beroffice works only with small English letters (i.e. with 26 letters from ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"hellno\\n\", \"output\": \"hell no \\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"abacaba\\n\", \"output\": \"abacaba \\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"asdfasdf\\n\", \"output\": \"asd fasd f \\n\"}, {\"type\": \"stdin_stdout\", \"input\": ...
codeforces_primeintellect_326
deepcoder
Solve the following coding problem using the programming language python: Anton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to prepare n potions. Anton has a special kettle, that can prepare one potions in x seconds. Also, he knows spells of ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"20 3 2\\n10 99\\n2 4 3\\n20 10 40\\n4 15\\n10 80\\n\", \"output\": \"20\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"20 3 2\\n10 99\\n2 4 3\\n200 100 400\\n4 15\\n100 800\\n\", \"output\": \"200\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"10 3 3\\n10...
codeforces_primeintellect_327
deepcoder
Solve the following coding problem using the programming language python: Recall that a binary search tree is a rooted binary tree, whose nodes each store a key and each have at most two distinguished subtrees, left and right. The key in each node must be greater than any key stored in the left subtree, and less than ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5\\n\", \"output\": \"1\\n\"}, {\"type\"...
codeforces_primeintellect_328
deepcoder
Solve the following coding problem using the programming language python: You might have heard about the next game in Lara Croft series coming out this year. You also might have watched its trailer. Though you definitely missed the main idea about its plot, so let me lift the veil of secrecy. Lara is going to explore...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 3 0\\n\", \"output\": \"1 1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4 3 11\\n\", \"output\": \"1 2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4 3 7\\n\", \"output\": \"3 2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1000000000 2 19999999...
codeforces_primeintellect_329
deepcoder
Solve the following coding problem using the programming language python: Today, Osama gave Fadi an integer $X$, and Fadi was wondering about the minimum possible value of $max(a, b)$ such that $LCM(a, b)$ equals $X$. Both $a$ and $b$ should be positive integers. $LCM(a, b)$ is the smallest positive integer that is d...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"2\\n\", \"output\": \"1 2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6\\n\", \"output\": \"2 3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4\\n\", \"output\": \"1 4\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n\", \"output\": \"1 1\\n\"}, {...
codeforces_primeintellect_330
deepcoder
Solve the following coding problem using the programming language python: Berland annual chess tournament is coming! Organizers have gathered 2·n chess players who should be divided into two teams with n people each. The first team is sponsored by BerOil and the second team is sponsored by BerMobile. Obviously, organ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"2\\n1 3 2 4\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n3 3\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5\\n1 1 1 1 2 2 3 3 3 3\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": ...
codeforces_primeintellect_331
deepcoder
Solve the following coding problem using the programming language python: You are given an array of n elements, you must make it a co-prime array in as few moves as possible. In each move you can insert any positive integral number you want not greater than 10^9 in any place in the array. An array is co-prime if any...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3\\n2 7 28\\n\", \"output\": \"1\\n2 7 1 28\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n1\\n\", \"output\": \"0\\n1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n548\\n\", \"output\": \"0\\n548\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"...
codeforces_primeintellect_332
deepcoder
Solve the following coding problem using the programming language python: We have a sequence of N integers: A_1, A_2, \cdots, A_N. You can perform the following operation between 0 and K times (inclusive): - Choose two integers i and j such that i \neq j, each between 1 and N (inclusive). Add 1 to A_i and -1 to A_j, ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"2 3\\n8 20\\n\", \"output\": \"7\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 10\\n3 5\\n\", \"output\": \"8\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4 5\\n10 1 2 22\\n\", \"output\": \"7\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"8 7\\n1 ...
codeforces_primeintellect_333
deepcoder
Solve the following coding problem using the programming language python: Cat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of the greatest cat programmers ever exist, Neko wants to utilize this algorithm to create the perfect longcat. Assume that we have a cat with a numbe...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"39\\n\", \"output\": \"4\\n5 3 \"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"7\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1000000\\n\", \"output\": \"7\\n14 ...
codeforces_primeintellect_334
deepcoder
Solve the following coding problem using the programming language python: Luba thinks about watering her garden. The garden can be represented as a segment of length k. Luba has got n buckets, the i-th bucket allows her to water some continuous subsegment of garden of length exactly a_{i} each hour. Luba can't water a...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3 6\\n2 3 5\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6 7\\n1 2 3 4 5 6\\n\", \"output\": \"7\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 97\\n1 10 50 97 2\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\"...
codeforces_primeintellect_335
deepcoder
Solve the following coding problem using the programming language python: On 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 places his grasshopper t...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"5 2\\n#G#T#\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6 1\\nT....G\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"7 3\\nT..#..G\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6 ...
codeforces_primeintellect_336
deepcoder
Solve the following coding problem using the programming language python: It's a beautiful April day and Wallace is playing football with his friends. But his friends do not know that Wallace actually stayed home with Gromit and sent them his robotic self instead. Robo-Wallace has several advantages over the other guy...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 10 13 10 3 1\\n\", \"output\": \"4.3750000000\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 4 6 2 2 1\\n\", \"output\": \"-1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 10 15 17 9 2\\n\", \"output\": \"11.3333333333\\n\"}, {\"type\": \"stdin_std...
codeforces_primeintellect_337
deepcoder
Solve the following coding problem using the programming language python: Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! Every day there was a breakfast, a dinner and a supper in a dining room of the sanatorium (of course, in this order). The only t...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3 2 1\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 0 0\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 1 1\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1000000000000000000 0 100000...
codeforces_primeintellect_338
deepcoder
Solve the following coding problem using the programming language python: You are given two strings a and b. You have to remove the minimum possible number of consecutive (standing one after another) characters from string b in such a way that it becomes a subsequence of string a. It can happen that you will not need ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"hi\\nbob\\n\", \"output\": \"-\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"abca\\naccepted\\n\", \"output\": \"ac\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"abacaba\\nabcdcba\\n\", \"output\": \"abcba\\n\"}, {\"type\": \"stdin_stdout\", \"input\": ...
codeforces_primeintellect_339
deepcoder
Solve the following coding problem using the programming language python: Vasya has a pile, that consists of some number of stones. $n$ times he either took one stone from the pile or added one stone to the pile. The pile was non-empty before each operation of taking one stone from the pile. You are given $n$ operati...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3\\n---\\n\", \"output\": \"0\"}, {\"type\": \"stdin_stdout\", \"input\": \"4\\n++++\\n\", \"output\": \"4\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n-+\\n\", \"output\": \"1\"}, {\"type\": \"stdin_stdout\", \"input\": \"5\\n++-++\\n\", \"output\": \"3...
codeforces_primeintellect_340
deepcoder
Solve the following coding problem using the programming language python: Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found himself in year 2084, and buying kefir there is much more complicated. Kolya is hungr...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"10\\n11\\n9\\n8\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"10\\n5\\n6\\n1\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n2\\n2\\n1\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1...
codeforces_primeintellect_341
deepcoder
Solve the following coding problem using the programming language python: Two bored soldiers are playing card war. Their card deck consists of exactly n cards, numbered from 1 to n, all values are different. They divide cards between them in some manner, it's possible that they have different number of cards. Then the...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4\\n2 1 3\\n2 4 2\\n\", \"output\": \"6 2\"}, {\"type\": \"stdin_stdout\", \"input\": \"3\\n1 2\\n2 1 3\\n\", \"output\": \"-1\"}, {\"type\": \"stdin_stdout\", \"input\": \"5\\n4 5 3 2 4\\n1 1\\n\", \"output\": \"1 1\"}, {\"type\": \"stdin_stdout\", \"input\"...
codeforces_primeintellect_342
deepcoder
Solve the following coding problem using the programming language python: You have probably registered on Internet sites many times. And each time you should enter your invented password. Usually the registration form automatically checks the password's crypt resistance. If the user's password isn't complex enough, a ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"abacaba\\n\", \"output\": \"Too weak\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"X12345\\n\", \"output\": \"Too weak\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"CONTEST_is_STARTED!!11\\n\", \"output\": \"Correct\\n\"}, {\"type\": \"stdin_stdout\", \...
codeforces_primeintellect_343
deepcoder
Solve the following coding problem using the programming language python: In Berland each high school student is characterized by academic performance — integer value between 1 and 5. In high school 0xFF there are two groups of pupils: the group A and the group B. Each group consists of exactly n students. An academi...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4\\n5 4 4 4\\n5 5 4 5\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6\\n1 1 1 1 1 1\\n5 5 5 5 5 5\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n5\\n3\\n\", \"output\": \"-1\\n\"}, {\"type\": \"stdin_stdout...
codeforces_primeintellect_344
deepcoder
Solve the following coding problem using the programming language python: Imagine a city with n horizontal streets crossing m vertical streets, forming an (n - 1) × (m - 1) grid. In order to increase the traffic flow, mayor of the city has decided to make each street one way. This means in each horizontal street, the ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3 3\\n><>\\nv^v\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4 6\\n<><>\\nv^v^v^\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 2\\n<>\\nv^\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"in...
codeforces_primeintellect_345
deepcoder
Solve the following coding problem using the programming language python: Implication is a function of two logical arguments, its value is false if and only if the value of the first argument is true and the value of the second argument is false. Implication is written by using character '$\rightarrow$', and the arg...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4\\n0 1 1 0\\n\", \"output\": \"YES\\n0->1->1->0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n1 1\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n0\\n\", \"output\": \"YES\\n0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": ...
codeforces_primeintellect_346
deepcoder
Solve the following coding problem using the programming language python: You have two variables a and b. Consider the following sequence of actions performed with these variables: If a = 0 or b = 0, end the process. Otherwise, go to step 2; If a ≥ 2·b, then set the value of a to a - 2·b, and repeat step 1. Otherwise,...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"12 5\\n\", \"output\": \"0 1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"31 12\\n\", \"output\": \"7 12\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1000000000000000000 7\\n\", \"output\": \"8 7\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"319602...
codeforces_primeintellect_347
deepcoder
Solve the following coding problem using the programming language python: Find the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x that a ≤ x ≤ b and x is divisible by k. -----Input----- The only line contains three space-separated integers k,...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"1 1 10\\n\", \"output\": \"10\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 -4 4\\n\", \"output\": \"5\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 1 1\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 0 0\\n\", \"output\": \...
codeforces_primeintellect_348
deepcoder
Solve the following coding problem using the programming language python: Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536... Your tas...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"7\\n\", \"output\": \"7\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"21\\n\", \"output\": \"5\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n\", \"output\": \"2\\n\"}, {\"type\...
codeforces_primeintellect_349
deepcoder
Solve the following coding problem using the programming language python: A telephone number is a sequence of exactly $11$ digits such that its first digit is 8. Vasya and Petya are playing a game. Initially they have a string $s$ of length $n$ ($n$ is odd) consisting of digits. Vasya makes the first move, then playe...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"13\\n8380011223344\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"15\\n807345619350641\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"19\\n8181818181111111111\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin...
codeforces_primeintellect_350
deepcoder
Solve the following coding problem using the programming language python: Andrey thinks he is truly a successful developer, but in reality he didn't know about the binary search algorithm until recently. After reading some literature Andrey understood that this algorithm allows to quickly find a certain number $x$ in ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 1 2\\n\", \"output\": \"6\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"123 42 24\\n\", \"output\": \"824071958\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 1 0\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1000 501 501\\n\...
codeforces_primeintellect_351
deepcoder
Solve the following coding problem using the programming language python: Andrey received a postcard from Irina. It contained only the words "Hello, Andrey!", and a strange string consisting of lowercase Latin letters, snowflakes and candy canes. Andrey thought that this string is an encrypted message, and decided to ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"hw?ap*yn?eww*ye*ar\\n12\\n\", \"output\": \"hwapppyewyar\"}, {\"type\": \"stdin_stdout\", \"input\": \"ab?a\\n2\\n\", \"output\": \"aa\"}, {\"type\": \"stdin_stdout\", \"input\": \"ab?a\\n3\\n\", \"output\": \"aba\"}, {\"type\": \"stdin_stdout\", \"input\": \...
codeforces_primeintellect_352
deepcoder
Solve the following coding problem using the programming language python: Vasya started working in a machine vision company of IT City. Vasya's team creates software and hardware for identification of people by their face. One of the project's know-how is a camera rotating around its optical axis on shooting. People ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"60\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"-60\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"0\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"44\\n\", \"output\": \"0\\n\"}, {\"ty...
codeforces_primeintellect_353
deepcoder
Solve the following coding problem using the programming language python: Carl is a beginner magician. He has a blue, b violet and c orange magic spheres. In one move he can transform two spheres of the same color into one sphere of any other color. To make a spell that has never been seen before, he needs at least x ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 4 0\\n2 1 2\\n\", \"output\": \"Yes\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 6 1\\n2 7 2\\n\", \"output\": \"No\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 3 3\\n2 2 2\\n\", \"output\": \"Yes\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \...
codeforces_primeintellect_354
deepcoder
Solve the following coding problem using the programming language python: Amr doesn't like Maths as he finds it really boring, so he usually sleeps in Maths lectures. But one day the teacher suspected that Amr is sleeping and asked him a question to make sure he wasn't. First he gave Amr two positive integers n and k...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"1 2 1000\\n\", \"output\": \"4\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 2 1000\\n\", \"output\": \"45\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 3 1103\\n\", \"output\": \"590\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 17 10000\\n\", \"output...
codeforces_primeintellect_355
deepcoder
Solve the following coding problem using the programming language python: Students in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces made of two blocks and m of the students use pieces made of three blocks. Th...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"1 3\\n\", \"output\": \"9\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 2\\n\", \"output\": \"8\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 0\\n\", \"output\": \"10\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4 2\\n\", \"output\": \"9\\n\"}, ...
codeforces_primeintellect_356
deepcoder
Solve the following coding problem using the programming language python: Petya and Vasya decided to play a game. They have n cards (n is an even number). A single integer is written on each card. Before the game Petya will choose an integer and after that Vasya will choose another integer (different from the number ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4\\n11\\n27\\n27\\n11\\n\", \"output\": \"YES\\n11 27\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n6\\n6\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6\\n10\\n20\\n30\\n20\\n10\\n20\\n\", \"output\": \"NO\\n\"}, {\"type\": \...
codeforces_primeintellect_357
deepcoder
Solve the following coding problem using the programming language python: Daenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains a_{i} soldiers. She wants to bring her army to the other side of the sea to get the Iron Throne. She has recently bought an airplane to carry her army thr...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"2 2\\n5 8\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 2\\n7 1\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 2\\n4 4\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 4\\n2 2 1...
codeforces_primeintellect_358
deepcoder
Solve the following coding problem using the programming language python: Salem gave you $n$ sticks with integer positive lengths $a_1, a_2, \ldots, a_n$. For every stick, you can change its length to any other positive integer length (that is, either shrink or stretch it). The cost of changing the stick's length fro...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3\\n10 1 4\\n\", \"output\": \"3 7\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5\\n1 1 2 2 3\\n\", \"output\": \"2 0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n5\\n\", \"output\": \"4 0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n1 2\\...
codeforces_primeintellect_359
deepcoder
Solve the following coding problem using the programming language python: Карта звёздного неба представляет собой прямоугольное поле, состоящее из n строк по m символов в каждой строке. Каждый символ — это либо «.» (означает пустой участок неба), либо «*» (означает то, что в этом месте на небе есть звезда). Новое из...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 4\\n....\\n..*.\\n...*\\n..**\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 3\\n*.*\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 1\\n.\\n*\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"inp...
codeforces_primeintellect_360
deepcoder
Solve the following coding problem using the programming language python: A girl named Sonya is studying in the scientific lyceum of the Kingdom of Kremland. The teacher of computer science (Sonya's favorite subject!) invented a task for her. Given an array $a$ of length $n$, consisting only of the numbers $0$ and $1...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3 2\\n0 1 0\\n\", \"output\": \"333333336\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 1\\n1 1 1 0 0\\n\", \"output\": \"0\"}, {\"type\": \"stdin_stdout\", \"input\": \"6 4\\n1 0 0 1 1 0\\n\", \"output\": \"968493834\"}, {\"type\": \"stdin_stdout\", \"inpu...
codeforces_primeintellect_361
deepcoder
Solve the following coding problem using the programming language python: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"6 3\\n\", \"output\": \"4\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"8 5\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"22 4\\n\", \"output\": \"6\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4 3\\n\", \"output\": \"3\\n\"}, ...
codeforces_primeintellect_362
deepcoder
Solve the following coding problem using the programming language python: The determinant of a matrix 2 × 2 is defined as follows:$\operatorname{det} \left(\begin{array}{ll}{a} & {b} \\{c} & {d} \end{array} \right) = a d - b c$ A matrix is called degenerate if its determinant is equal to zero. The norm ||A|| of a m...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"1 2\\n3 4\\n\", \"output\": \"0.2000000000\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 0\\n0 1\\n\", \"output\": \"0.5000000000\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1000000000 0\\n0 1000000000\\n\", \"output\": \"500000000.0000000000\\n\"},...
codeforces_primeintellect_363
deepcoder
Solve the following coding problem using the programming language python: In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 1 2\\n1 2 1 1\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4 1 1\\n1 1 2 1\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 1 1\\n1\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 1 ...
codeforces_primeintellect_364
deepcoder
Solve the following coding problem using the programming language python: Each student eagerly awaits the day he would pass the exams successfully. Thus, Vasya was ready to celebrate, but, alas, he didn't pass it. However, many of Vasya's fellow students from the same group were more successful and celebrated after th...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"10 10 5 20\\n\", \"output\": \"5\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 2 0 4\\n\", \"output\": \"-1\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 2 2 1\\n\", \"output\": \"-1\"}, {\"type\": \"stdin_stdout\", \"input\": \"98 98 97 100\\n\", \"outpu...
codeforces_primeintellect_365
deepcoder
Solve the following coding problem using the programming language python: Pasha has a wooden stick of some positive integer length n. He wants to perform exactly three cuts to get four parts of the stick. Each part must have some positive integer length and the sum of these lengths will obviously be n. Pasha likes r...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"6\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"20\\n\", \"output\": \"4\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n\", \"output\": \"0\\n\"}, {\"type\...
codeforces_primeintellect_366
deepcoder
Solve the following coding problem using the programming language python: The Fair Nut likes kvass very much. On his birthday parents presented him $n$ kegs of kvass. There are $v_i$ liters of kvass in the $i$-th keg. Each keg has a lever. You can pour your glass by exactly $1$ liter pulling this lever. The Fair Nut l...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3 3\\n4 3 5\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 4\\n5 3 4\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 7\\n1 2 3\\n\", \"output\": \"-1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 1\\n1\\...
codeforces_primeintellect_367
deepcoder
Solve the following coding problem using the programming language python: The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h_1 cm from the ground. On the height h_2 cm (h_2 > h_1) on the same tree hung an apple and the c...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"10 30\\n2 1\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"10 13\\n1 1\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"10 19\\n1 2\\n\", \"output\": \"-1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 50\\n5 ...
codeforces_primeintellect_368
deepcoder
Solve the following coding problem using the programming language python: A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with the same task if you were on his place? [Ima...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"10 3 5 2 3\\n\", \"output\": \"16\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 3 1 6 7\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"982068341 55 57 106 109\\n\", \"output\": \"513558662\\n\"}, {\"type\": \"stdin_stdout\", \"inp...
codeforces_primeintellect_369
deepcoder
Solve the following coding problem using the programming language python: There are n employees in Alternative Cake Manufacturing (ACM). They are now voting on some very important question and the leading world media are trying to predict the outcome of the vote. Each of the employees belongs to one of two fractions:...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"5\\nDDRRR\\n\", \"output\": \"D\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6\\nDDRRRR\\n\", \"output\": \"R\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\nD\\n\", \"output\": \"D\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\nR\\n\", \"outpu...
codeforces_primeintellect_370
deepcoder
Solve the following coding problem using the programming language python: Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than $a$ and screen height not greater than $b$. Monocarp is also used to TV ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"17 15 5 3\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"14 16 7 22\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4 2 6 4\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"10000000000000000...
codeforces_primeintellect_371
deepcoder
Solve the following coding problem using the programming language python: The number "zero" is called "love" (or "l'oeuf" to be precise, literally means "egg" in French), for example when denoting the zero score in a game of tennis. Aki is fond of numbers, especially those with trailing zeros. For example, the numbe...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"6 9\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"38 11\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 2\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 10\\n\", \"output\": \"1\\n\"}...
codeforces_primeintellect_372
deepcoder
Solve the following coding problem using the programming language python: A frog is initially at position $0$ on the number line. The frog has two positive integers $a$ and $b$. From a position $k$, it can either jump to position $k+a$ or $k-b$. Let $f(x)$ be the number of distinct integers the frog can reach if it n...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"7 5 3\\n\", \"output\": \"19\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1000000000 1 2019\\n\", \"output\": \"500000001500000001\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"100 100000 1\\n\", \"output\": \"101\\n\"}, {\"type\": \"stdin_stdout\", \"...
codeforces_primeintellect_373
deepcoder
Solve the following coding problem using the programming language python: Where do odds begin, and where do they end? Where does hope emerge, and will they ever break? Given an integer sequence a_1, a_2, ..., a_{n} of length n. Decide whether it is possible to divide it into an odd number of non-empty subsegments, th...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3\\n1 3 5\\n\", \"output\": \"Yes\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5\\n1 0 1 5 1\\n\", \"output\": \"Yes\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3\\n4 3 1\\n\", \"output\": \"No\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"4\\n3 9...
codeforces_primeintellect_374
deepcoder
Solve the following coding problem using the programming language python: One spring day on his way to university Lesha found an array A. Lesha likes to split arrays into several parts. This time Lesha decided to split the array A into several, possibly one, new arrays so that the sum of elements in each of the new ar...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3\\n1 2 -3\\n\", \"output\": \"YES\\n3\\n1 1\\n2 2\\n3 3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"8\\n9 -12 3 4 -4 -10 7 3\\n\", \"output\": \"YES\\n8\\n1 1\\n2 2\\n3 3\\n4 4\\n5 5\\n6 6\\n7 7\\n8 8\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\...
codeforces_primeintellect_375
deepcoder
Solve the following coding problem using the programming language python: You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes. Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3454\\n\", \"output\": \"YES\\n344\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"10\\n\", \"output\": \"YES\\n0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"111111\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"8996988892\\n\",...
codeforces_primeintellect_376
deepcoder
Solve the following coding problem using the programming language python: In a building where Polycarp lives there are equal number of flats on each floor. Unfortunately, Polycarp don't remember how many flats are on each floor, but he remembers that the flats are numbered from 1 from lower to upper floors. That is, t...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"10 3\\n6 2\\n2 1\\n7 3\\n\", \"output\": \"4\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"8 4\\n3 1\\n6 2\\n5 2\\n2 1\\n\", \"output\": \"-1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"8 3\\n7 2\\n6 2\\n1 1\\n\", \"output\": \"2\\n\"}, {\"type\": \"s...
codeforces_primeintellect_377
deepcoder
Solve the following coding problem using the programming language python: Bishwock is a chess figure that consists of three squares resembling an "L-bar". This figure can be rotated by 90, 180 and 270 degrees so it can have four possible states: XX XX .X X. X. .X XX XX Bishwocks don't attack any s...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"00\\n00\\n\", \"output\": \"1\"}, {\"type\": \"stdin_stdout\", \"input\": \"00X00X0XXX0\\n0XXX0X00X00\\n\", \"output\": \"4\"}, {\"type\": \"stdin_stdout\", \"input\": \"0X0X0\\n0X0X0\\n\", \"output\": \"0\"}, {\"type\": \"stdin_stdout\", \"input\": \"0XXX0\\...
codeforces_primeintellect_378
deepcoder
Solve the following coding problem using the programming language python: Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters. Let A be a set of positions in the string. Let's call it pretty if following conditions are met: let...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"11\\naaaaBaabAbA\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"12\\nzACaAbbaazzC\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3\\nABC\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\...
codeforces_primeintellect_379
deepcoder
Solve the following coding problem using the programming language python: You are given a sequence a consisting of n integers. You may partition this sequence into two sequences b and c in such a way that every element belongs exactly to one of these sequences. Let B be the sum of elements belonging to b, and C be t...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3\\n1 -2 0\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6\\n16 23 16 15 42 8\\n\", \"output\": \"120\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n-1\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"100\\...
codeforces_primeintellect_380
deepcoder
Solve the following coding problem using the programming language python: A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it im...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"6 9 2 4\\n\", \"output\": \"4\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6 10 2 4\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6 5 4 3\\n\", \"output\": \"-1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 2 1 1\\n\", \"outp...
codeforces_primeintellect_381
deepcoder
Solve the following coding problem using the programming language python: You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q. For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo". ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"5 2 3\\nHello\\n\", \"output\": \"2\\nHe\\nllo\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"10 9 5\\nCodeforces\\n\", \"output\": \"2\\nCodef\\norces\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6 4 5\\nPrivet\\n\", \"output\": \"-1\\n\"}, {\"type\": ...
codeforces_primeintellect_382
deepcoder
Solve the following coding problem using the programming language python: A sportsman starts from point x_{start} = 0 and runs to point with coordinate x_{finish} = m (on a straight line). Also, the sportsman can jump — to jump, he should first take a run of length of not less than s meters (in this case for these s m...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3 10 1 3\\n3 4 7\\n\", \"output\": \"RUN 2\\nJUMP 3\\nRUN 1\\nJUMP 2\\nRUN 2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 9 2 3\\n6 4\\n\", \"output\": \"IMPOSSIBLE\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"10 100 2 8\\n93 35 24 87 39 46 86 37 73...
codeforces_primeintellect_383
deepcoder
Solve the following coding problem using the programming language python: Two positive integers a and b have a sum of s and a bitwise XOR of x. How many possible values are there for the ordered pair (a, b)? -----Input----- The first line of the input contains two integers s and x (2 ≤ s ≤ 10^12, 0 ≤ x ≤ 10^12), th...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"9 5\\n\", \"output\": \"4\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 3\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 2\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6 0\\n\", \"output\": \"1\\n\"}, {...
codeforces_primeintellect_384
deepcoder
Solve the following coding problem using the programming language python: Long story short, shashlik is Miroslav's favorite food. Shashlik is prepared on several skewers simultaneously. There are two states for each skewer: initial and turned over. This time Miroslav laid out $n$ skewers parallel to each other, and e...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"7 2\\n\", \"output\": \"2\\n1 6 \\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 1\\n\", \"output\": \"2\\n1 4 \\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"10 0\\n\", \"output\": \"10\\n1 2 3 4 5 6 7 8 9 10 \\n\"}, {\"type\": \"stdin_stdout\", \"input...
codeforces_primeintellect_385
deepcoder
Solve the following coding problem using the programming language python: Let's define a function $f(p)$ on a permutation $p$ as follows. Let $g_i$ be the greatest common divisor (GCD) of elements $p_1$, $p_2$, ..., $p_i$ (in other words, it is the GCD of the prefix of length $i$). Then $f(p)$ is the number of distinc...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"2\\n\", \"output\": \"1\"}, {\"type\": \"stdin_stdout\", \"input\": \"3\\n\", \"output\": \"4\"}, {\"type\": \"stdin_stdout\", \"input\": \"6\\n\", \"output\": \"120\"}, {\"type\": \"stdin_stdout\", \"input\": \"10\\n\", \"output\": \"15120\"}, {\"type\": \"s...
codeforces_primeintellect_386
deepcoder
Solve the following coding problem using the programming language python: One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowe...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"ABABBBACFEYUKOTT\\n\", \"output\": \"4\"}, {\"type\": \"stdin_stdout\", \"input\": \"AAA\\n\", \"output\": \"1\"}, {\"type\": \"stdin_stdout\", \"input\": \"A\\n\", \"output\": \"1\"}, {\"type\": \"stdin_stdout\", \"input\": \"B\\n\", \"output\": \"2\"}, {\"t...
codeforces_primeintellect_387
deepcoder
Solve the following coding problem using the programming language python: You may have heard of the pie rule before. It states that if two people wish to fairly share a slice of pie, one person should cut the slice in half, and the other person should choose who gets which slice. Alice and Bob have many slices of pie,...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3\\n141 592 653\\n\", \"output\": \"653 733\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5\\n10 21 10 21 10\\n\", \"output\": \"31 41\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n100000\\n\", \"output\": \"0 100000\\n\"}, {\"type\": \"stdin_stdout...
codeforces_primeintellect_388
deepcoder
Solve the following coding problem using the programming language python: You've got a positive integer sequence a_1, a_2, ..., a_{n}. All numbers in the sequence are distinct. Let's fix the set of variables b_1, b_2, ..., b_{m}. Initially each variable b_{i} (1 ≤ i ≤ m) contains the value of zero. Consider the follow...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"5\\n1 2 3 6 8\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3\\n3 6 5\\n\", \"output\": \"-1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"6\\n2 4 8 6 10 18\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"7\\...
codeforces_primeintellect_389
deepcoder
Solve the following coding problem using the programming language python: Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help. Filya is given an array of non-negative integers a_1, a_2, ..., a_{n}. First, he pick an integer x a...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"5\\n1 3 3 2 1\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5\\n1 2 3 4 5\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n1 2\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3\\n1...
codeforces_primeintellect_390
deepcoder
Solve the following coding problem using the programming language python: The main street of Berland is a straight line with n houses built along it (n is an even number). The houses are located at both sides of the street. The houses with odd numbers are at one side of the street and are numbered from 1 to n - 1 in t...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 2\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"8 5\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 1\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 2\\n\", \"output\": \"1\\n\"}, {...
codeforces_primeintellect_391
deepcoder
Solve the following coding problem using the programming language python: There is unrest in the Galactic Senate. Several thousand solar systems have declared their intentions to leave the Republic. Master Heidi needs to select the Jedi Knights who will go on peacekeeping missions throughout the galaxy. It is well-kno...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"5 2\\n1 1 2 2 1\\n1 2\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 1\\n1\\n1\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 1\\n1 1\\n1\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"inp...
codeforces_primeintellect_392
deepcoder
Solve the following coding problem using the programming language python: Mishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in a wonderful sunny morning, walking around blocks of ice, Mishka met her friend Chris, and they started playing the game. R...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3\\n3 5\\n2 1\\n4 2\\n\", \"output\": \"Mishka\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n6 1\\n1 6\\n\", \"output\": \"Friendship is magic!^^\"}, {\"type\": \"stdin_stdout\", \"input\": \"3\\n1 5\\n3 3\\n2 2\\n\", \"output\": \"Chris\"}, {\"type\": \"...
codeforces_primeintellect_393
deepcoder
Solve the following coding problem using the programming language python: One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but he ra...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"3 3\\n111\\n1*1\\n111\\n\", \"output\": \"YES\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 4\\n*.*.\\n1211\\n\", \"output\": \"NO\"}, {\"type\": \"stdin_stdout\", \"input\": \"1 10\\n.....1*1..\\n\", \"output\": \"YES\"}, {\"type\": \"stdin_stdout\", \"inp...
codeforces_primeintellect_394
deepcoder
Solve the following coding problem using the programming language python: After passing a test, Vasya got himself a box of $n$ candies. He decided to eat an equal amount of candies each morning until there are no more candies. However, Petya also noticed the box and decided to get some candies for himself. This means...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"68\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"1\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2\\n\", \"output\": \"1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"42\\n\", \"output\": \"1\\n\"}, {\"type...
codeforces_primeintellect_395
deepcoder
Solve the following coding problem using the programming language python: A necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one. $0$ You can remove a link or a pearl and insert it between two other existing links or pearls (or between a link a...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"-o-o--\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"-o---\\n\", \"output\": \"YES\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"-o---o-\\n\", \"output\": \"NO\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"ooo\\n\", \"output\"...
codeforces_primeintellect_396
deepcoder
Solve the following coding problem using the programming language python: n hobbits are planning to spend the night at Frodo's house. Frodo has n beds standing in a row and m pillows (n ≤ m). Each hobbit needs a bed and at least one pillow to sleep, however, everyone wants as many pillows as possible. Of course, it's ...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"4 6 2\\n\", \"output\": \"2\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 10 3\\n\", \"output\": \"4\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 6 1\\n\", \"output\": \"3\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 3 3\\n\", \"output\": \"1...
codeforces_primeintellect_397
deepcoder
Solve the following coding problem using the programming language python: You are given an array $a_1, a_2, \dots , a_n$ and two integers $m$ and $k$. You can choose some subarray $a_l, a_{l+1}, \dots, a_{r-1}, a_r$. The cost of subarray $a_l, a_{l+1}, \dots, a_{r-1}, a_r$ is equal to $\sum\limits_{i=l}^{r} a_i - k...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"7 3 10\\n2 -4 15 -3 4 8 3\\n\", \"output\": \"7\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 2 1000\\n-13 -4 -9 -20 -11\\n\", \"output\": \"0\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"5 10 10\\n1000000000 1000000000 1000000000 1000000000 10000000...
codeforces_primeintellect_398
deepcoder
Solve the following coding problem using the programming language python: You are given a rectangular grid of lattice points from (0, 0) to (n, m) inclusive. You have to choose exactly 4 different points to build a polyline possibly with self-intersections and self-touching. This polyline should be as long as possible...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"1 1\\n\", \"output\": \"1 1\\n0 0\\n1 0\\n0 1\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"0 10\\n\", \"output\": \"0 1\\n0 10\\n0 0\\n0 9\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"10 10\\n\", \"output\": \"10 9\\n0 0\\n10 10\\n1 0\\n\"}, {\"type\"...
codeforces_primeintellect_399
deepcoder
Solve the following coding problem using the programming language python: Not so long ago company R2 bought company R1 and consequently, all its developments in the field of multicore processors. Now the R2 laboratory is testing one of the R1 processors. The testing goes in n steps, at each step the processor gets so...
{"ground_truth": "[{\"type\": \"stdin_stdout\", \"input\": \"2 1 1 2\\n1\\n\", \"output\": \"Correct\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"3 1 1 3\\n2\\n\", \"output\": \"Correct\\n\"}, {\"type\": \"stdin_stdout\", \"input\": \"2 1 1 3\\n2\\n\", \"output\": \"Incorrect\\n\"}, {\"type\": \"stdin_stdout\", \"i...