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\nYou are given a positive integer N.\nFind the minimum positive integer divisible by both 2 and N.\n\n-----Constraints-----\n - 1 \\leq N \\leq 10^9\n - All values in input are integers.\n\n-----Input-----\nInput is given ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "1999999998\n"}, {"type": "stdin_stdout", "input": "433933447\n", "output": "867866894\n"}, {"type": "stdin_stdout", "input": "476190629\n", "output": "952381258\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word... | [{"type": "stdin_stdout", "input": "183\n", "output": "bon\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "hon\n"}, {"type": "stdin_stdout", "input": "440\n", "output": "pon\n"}, {"type": "stdin_stdout", "input": "438\n", "output": "pon\n"}, {"type": "stdin_stdout", "input": "575\n", "output": "hon\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's now the season of TAKOYAKI FESTIVAL!\nThis year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The deliciousness of the i-th takoyaki is d_i.\nAs is commonly known, when you eat two t... | [{"type": "stdin_stdout", "input": "50\n100 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\n", "output": "12250000\n"}, {"type": "stdin_stdout", "input": "41\n49 91 82 7 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two buttons, one of size A and one of size B.\nWhen you press a button of size X, you get X coins and the size of that button decreases by 1.\nYou will press a button twice. Here, you can press the same button t... | [{"type": "stdin_stdout", "input": "15 13\n", "output": "29\n"}, {"type": "stdin_stdout", "input": "14 16\n", "output": "31\n"}, {"type": "stdin_stdout", "input": "10 10\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "15 14\n", "output": "29\n"}, {"type": "stdin_stdout", "input": "16 17\n", "output": "33\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter.\nIt had been snowing for a while before it finally stopped. For some two adjacent ... | [{"type": "stdin_stdout", "input": "290178 291177\n", "output": "208323\n"}, {"type": "stdin_stdout", "input": "336594 337545\n", "output": "115131\n"}, {"type": "stdin_stdout", "input": "124075 124692\n", "output": "65961\n"}, {"type": "stdin_stdout", "input": "82747 83560\n", "output": "247331\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nServal is fighting with a monster.\nThe health of the monster is H.\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\nServal wins when the monster's h... | [{"type": "stdin_stdout", "input": "10000 1\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "10000 10000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "8772 81\n", "output": "109\n"}, {"type": "stdin_stdout", "input": "3497 7202\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "3982 4784\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are controlling a robot. They each have one switch that controls the robot.\n\nAlice started holding down her button A second after the start-up of the robot, and released her button B second after the start... | [{"type": "stdin_stdout", "input": "56 100 33 100\n", "output": "44\n"}, {"type": "stdin_stdout", "input": "0 100 0 100\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "0 75 25 100\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "10 90 20 80\n", "output": "60\n"}, {"type": "stdin_stdout", "input": "7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\n-----Constraints---... | [{"type": "stdin_stdout", "input": "105\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "104\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "134\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "135\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "164\n", "output": "2\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers re... | [{"type": "stdin_stdout", "input": "100 100\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "100 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "99 33\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "100 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "99 49\n", "output": "1\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKurohashi has never participated in AtCoder Beginner Contest (ABC).\nThe next ABC to be held is ABC N (the N-th ABC ever held).\nKurohashi wants to make his debut in some ABC x such that all the digits of x in base ten ar... | [{"type": "stdin_stdout", "input": "111\n", "output": "111\n"}, {"type": "stdin_stdout", "input": "112\n", "output": "222\n"}, {"type": "stdin_stdout", "input": "750\n", "output": "777\n"}, {"type": "stdin_stdout", "input": "234\n", "output": "333\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "999\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi and Aoki will have a battle using their monsters.\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\nThe two monsters will take tur... | [{"type": "stdin_stdout", "input": "100 1 100 1\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "85 7 30 19\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "85 7 23 19\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "38 11 7 79\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "45 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of ... | [{"type": "stdin_stdout", "input": "100 100\n#...................................................................................................\n.#..................................................................................................\n..#....................................................................... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPrint the circumference of a circle of radius R.\n\n-----Constraints-----\n - 1 \\leq R \\leq 100\n - All values in input are integers.\n\n-----Input-----\nInput is given from Standard Input in the following format:\nR\n\... | [{"type": "stdin_stdout", "input": "100\n", "output": "628.31853071795865162130\n"}, {"type": "stdin_stdout", "input": "73\n", "output": "458.67252742410977361942\n"}, {"type": "stdin_stdout", "input": "20\n", "output": "125.66370614359172463992\n"}, {"type": "stdin_stdout", "input": "38\n", "output": "238.761041672824... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\n-----Constraints-----\n - The length of S is 4.\n ... | [{"type": "stdin_stdout", "input": "ASSA\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "FFEE\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "AVVA\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "HHTT\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "ILIL\n", "output": "Yes\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have two integers: A and B.\nPrint the largest number among A + B, A - B, and A \\times B.\n\n-----Constraints-----\n - All values in input are integers.\n - -100 \\leq A,\\ B \\leq 100\n\n-----Input-----\nInput is giv... | [{"type": "stdin_stdout", "input": "100 100\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "-96 -16\n", "output": "1536\n"}, {"type": "stdin_stdout", "input": "36 80\n", "output": "2880\n"}, {"type": "stdin_stdout", "input": "-76 39\n", "output": "-37\n"}, {"type": "stdin_stdout", "input": "-13 3\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N mountains ranging from east to west, and an ocean to the west.\nAt the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.\nThe height of the i-th mountain from the... | [{"type": "stdin_stdout", "input": "20\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "20\n54 53 68 68 35 35 62 61 74 73 94 94 94 94 86 85 65 64 68 68\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "20\n8 12 14 17 23 26 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from $1$ to the number of steps in this stairway. She speaks every number aloud. For exampl... | [{"type": "stdin_stdout", "input": "48\n1 2 3 4 1 2 3 1 1 2 3 1 2 3 4 1 1 2 3 4 1 2 3 4 1 2 3 4 1 1 2 1 2 1 2 1 1 2 1 2 1 2 3 1 2 1 2 1\n", "output": "20\n4 3 1 3 4 1 4 4 4 1 2 2 2 1 2 2 3 2 2 1 "}, {"type": "stdin_stdout", "input": "8\n1 2 3 1 2 3 4 5\n", "output": "2\n3 5 "}, {"type": "stdin_stdout", "input": "7\n1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Vova found $n$ candy wrappers. He remembers that he bought $x$ candies during the first day, $2x$ candies during the second day, $4x$ candies during the third day, $\\dots$, $2^{k-1} x$ candies during the $k$-th ... | [{"type": "stdin_stdout", "input": "53\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm: if the last digit of the ... | [{"type": "stdin_stdout", "input": "999999999 49\n", "output": "99990\n"}, {"type": "stdin_stdout", "input": "999999999 50\n", "output": "9999\n"}, {"type": "stdin_stdout", "input": "1000000000 9\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "900000000 16\n", "output": "1\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ people in a row. The height of the $i$-th person is $a_i$. You can choose any subset of these people and try to arrange them into a balanced circle.\n\nA balanced circle is such an order of people that the d... | [{"type": "stdin_stdout", "input": "4\n200000 200000 200000 200000\n", "output": "4\n200000 200000 200000 200000 \n"}, {"type": "stdin_stdout", "input": "3\n200000 200000 200000\n", "output": "3\n200000 200000 200000 \n"}, {"type": "stdin_stdout", "input": "10\n2 3 6 7 4 6 3 2 6 6\n", "output": "5\n2 2 3 4 3 \n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi loves takoyaki - a ball-shaped snack.\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\nHow long does it take to make N t... | [{"type": "stdin_stdout", "input": "1000 1 1000\n", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "999 10 1000\n", "output": "100000\n"}, {"type": "stdin_stdout", "input": "522 575 426\n", "output": "426\n"}, {"type": "stdin_stdout", "input": "447 629 497\n", "output": "497\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N students in a school.\nWe will divide these students into some groups, and in each group they will discuss some themes.\nYou think that groups consisting of two or less students cannot have an effective discus... | [{"type": "stdin_stdout", "input": "1000\n", "output": "333\n"}, {"type": "stdin_stdout", "input": "303\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "807\n", "output": "269\n"}, {"type": "stdin_stdout", "input": "596\n", "output": "198\n"}, {"type": "stdin_stdout", "input": "604\n", "output": "201\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have A apples and P pieces of apple.\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\nFind the maximum number of apple pies we can make with what we ha... | [{"type": "stdin_stdout", "input": "100 100\n", "output": "200\n"}, {"type": "stdin_stdout", "input": "74 28\n", "output": "125\n"}, {"type": "stdin_stdout", "input": "39 85\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "93 70\n", "output": "174\n"}, {"type": "stdin_stdout", "input": "98 96\n", "output": "1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given positive integers A and B.\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\n-----Constraints-----\n - All values in input are integers.\n - 1 \\leq A \\leq B \\leq 20\n\n-----Input-----\nInpu... | [{"type": "stdin_stdout", "input": "20 20\n", "output": "40\n"}, {"type": "stdin_stdout", "input": "4 12\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "8 20\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "6 12\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "1 12\n", "output": "13\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi wants to be a member of some web service.\nHe tried to register himself with the ID S, which turned out to be already used by another user.\nThus, he decides to register using a string obtained by appending one ... | [{"type": "stdin_stdout", "input": "aaaaaaaaaa\naaaaaaaaaaa\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "vgxgpuamkx\nvgxgpuamkxk\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "chokudai\nchokudaiz\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "vfjaqmop\nodotkrjzr\n", "output": "No\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have two distinct integers A and B.\nPrint the integer K such that |A - K| = |B - K|.\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\n-----Constraints-----\n - All values in input are integers.\n - 0 \... | [{"type": "stdin_stdout", "input": "999999999 1000000000\n", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", "input": "369673908 845644227\n", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", "input": "232334010 962483782\n", "output": "597408896\n"}, {"type": "stdin_stdout", "input": "274100628 29096111\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a three-digit integer N. Does N contain the digit 7?\nIf so, print Yes; otherwise, print No.\n\n-----Constraints-----\n - 100 \\leq N \\leq 999\n\n-----Input-----\nInput is given from Standard Input in the follow... | [{"type": "stdin_stdout", "input": "117\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "777\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "974\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "477\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "758\n", "output": "Yes\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(101) = 1 + 0 + 1 = 2.\nGiven an integer N, determine if S(N) divides N.\n\n-----Constraints-----\n - 1 \\leq N \\leq 10^9\n\n-----Input--... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "873041724\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "689670774\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "5064791... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.\n(Assume that the positive x-axis points right, and the positive y-axis p... | [{"type": "stdin_stdout", "input": "67 -89 -90 -11\n", "output": "-168 -168 -11 -246\n"}, {"type": "stdin_stdout", "input": "-100 100 100 -100\n", "output": "300 100 100 300\n"}, {"type": "stdin_stdout", "input": "0 -100 -100 100\n", "output": "-300 0 -200 -200\n"}, {"type": "stdin_stdout", "input": "31 -41 -59 26\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the n... | [{"type": "stdin_stdout", "input": "abcdeabcde opqrsopqrs\n7 2\nabcdeabcde\n", "output": "6 2\n"}, {"type": "stdin_stdout", "input": "airport door\n5 5\nairport\n", "output": "4 5\n"}, {"type": "stdin_stdout", "input": "length depth\n3 1\nlength\n", "output": "2 1\n"}, {"type": "stdin_stdout", "input": "tea coffee\n4 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\nDetermine whether the string is a concatenation of two copies of some string.\nThat is, determine whether there is a stri... | [{"type": "stdin_stdout", "input": "100\ntttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "100\nyyxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight lin... | [{"type": "stdin_stdout", "input": "1000000000 1000000000 117928222 908877261\n", "output": "500000000000000000.000000 0\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 500000000 500000000\n", "output": "500000000000000000.000000 1\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 500000000 49... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Japan, people make offerings called hina arare, colorful crackers, on March 3.\nWe have a bag that contains N hina arare. (From here, we call them arare.)\nIt is known that the bag either contains arare in three colors... | [{"type": "stdin_stdout", "input": "100\nP P P G G P P P G G P P G G P G W G W G G G P G P P G P P P G G G P P G P G P P G P P G G G W G G G P P P W G P G G P G G G G G P P W P G G G G G P P G G P G P G G G G P G G G G W P G P P P G G P G P\n", "output": "Three\n"}, {"type": "stdin_stdout", "input": "100\nG G G G G W W... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe next lecture in a high school requires two topics to be discussed. The $i$-th topic is interesting by $a_i$ units for the teacher and by $b_i$ units for the students.\n\nThe pair of topics $i$ and $j$ ($i < j$) is cal... | [{"type": "stdin_stdout", "input": "14\n137698508 528184026 54130884 239033739 897037197 720680829 605286542 89272810 284191042 179359950 186766648 570400677 107541072 25121211\n195343970 709242622 422954170 980941827 265963618 812646456 943660193 344102432 295006337 221455256 203711937 632473368 334173424 49206958\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMishka got an integer array $a$ of length $n$ as a birthday present (what a surprise!).\n\nMishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it \"Mishka's Adjacent Re... | [{"type": "stdin_stdout", "input": "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000\n", "output": "9999 9 50605065 1 5 89 5 999999999 60506055 999999999\n"}, {"type": "stdin_stdout", "input": "5\n100000000 100000000 100000000 100000000 100000000\n", "output": "99999999 99999999 99999999 99999999 99999999\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph consisting of $n$ vertices and $m$ edges. Your task is to find the number of connected components which are cycles.\n\nHere are some definitions of graph theory.\n\nAn undirected graph co... | [{"type": "stdin_stdout", "input": "17 15\n1 8\n1 12\n5 11\n11 9\n9 15\n15 5\n4 13\n3 13\n4 3\n10 16\n7 10\n16 7\n14 3\n14 4\n17 6\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5 10\n1 2\n2 3\n3 4\n4 5\n5 1\n1 4\n2 4\n3 5\n3 1\n2 5\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 10\n1 2\n1 3\n1 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected tree of $n$ vertices. \n\nSome vertices are colored blue, some are colored red and some are uncolored. It is guaranteed that the tree contains at least one red vertex and at least one blue vert... | [{"type": "stdin_stdout", "input": "20\n1 2 1 1 0 0 0 1 1 1 0 0 0 1 0 2 0 2 1 1\n1 20\n2 3\n2 4\n2 14\n2 18\n3 10\n5 15\n5 16\n6 17\n7 15\n8 15\n9 17\n9 20\n11 14\n12 18\n12 20\n13 19\n15 17\n18 19\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n1 2 0 0 1 1 1 1 0 1\n1 3\n1 5\n2 10\n3 4\n3 8\n4 6\n4 7\n6 9\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings $s$ and $t$, both consisting of exactly $k$ lowercase Latin letters, $s$ is lexicographically less than $t$.\n\nLet's consider list of all strings consisting of exactly $k$ lowercase Latin letter... | [{"type": "stdin_stdout", "input": "12\nlylfekzszgqx\noewrpuflwlir\n", "output": "nbqykcppkvzu\n"}, {"type": "stdin_stdout", "input": "10\nzzzzzzzzzx\nzzzzzzzzzz\n", "output": "zzzzzzzzzy\n"}, {"type": "stdin_stdout", "input": "6\nnijfvj\ntvqhwp\n", "output": "qoztvz\n"}, {"type": "stdin_stdout", "input": "5\nafogk\nas... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo integer sequences existed initially, one of them was strictly increasing, and another one — strictly decreasing.\n\nStrictly increasing sequence is a sequence of integers $[x_1 < x_2 < \\dots < x_k]$. And strictly dec... | [{"type": "stdin_stdout", "input": "12\n12 8 1 3 7 5 9 6 4 10 11 2\n", "output": "YES\n1 1 0 0 1 0 0 1 1 0 0 1 \n"}, {"type": "stdin_stdout", "input": "9\n5 1 3 6 8 2 9 0 10\n", "output": "YES\n1 0 0 0 0 1 0 1 0 \n"}, {"type": "stdin_stdout", "input": "8\n3 2 0 1 0 1 2 3\n", "output": "YES\n1 1 0 1 1 0 0 0 \n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova plans to go to the conference by train. Initially, the train is at the point $1$ and the destination point of the path is the point $L$. The speed of the train is $1$ length unit per minute (i.e. at the first minute ... | [{"type": "stdin_stdout", "input": "10\n10 1 1 1\n10 1 1 2\n10 1 1 3\n10 1 1 4\n10 1 1 5\n10 1 1 6\n10 1 1 7\n10 1 1 8\n10 1 1 9\n10 1 1 10\n", "output": "9\n8\n7\n6\n5\n4\n3\n2\n1\n0\n"}, {"type": "stdin_stdout", "input": "10\n10 2 1 1\n10 2 1 2\n10 2 1 3\n10 2 1 4\n10 2 1 5\n10 2 1 6\n10 2 1 7\n10 2 1 8\n10 2 1 9\n10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ consisting of $n$ lowercase Latin letters. Polycarp wants to remove exactly $k$ characters ($k \\le n$) from the string $s$. Polycarp uses the following algorithm $k$ times:\n\n if there is at ... | [{"type": "stdin_stdout", "input": "15 3\ncccaabababaccbc\n", "output": "cccbbabaccbc\n"}, {"type": "stdin_stdout", "input": "26 26\nabcdefghijklmnopqrstuvwxyz\n", "output": "\n"}, {"type": "stdin_stdout", "input": "14 5\nhxehmvkybeklnj\n", "output": "xmvkyklnj\n"}, {"type": "stdin_stdout", "input": "15 9\ncccaabababac... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is constraints.\n\nIvan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wa... | [{"type": "stdin_stdout", "input": "78 36\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0\n1 52\n2 6\n9 43\n10 52\n4 63\n9 35\n10 67\n9 17\n3 43\n4 38\n1 27\n9 44\n6 74\n7 3\n8 18\n1 52\n1 68\n5 51\n5 2\n7 50\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. Th... | [{"type": "stdin_stdout", "input": "100 3\n...\n...\n...\n...\n...\n...\n...\n*..\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n.*.\n***\n.*.\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n..... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a three-digit positive integer N.\n\nDetermine whether N is a palindromic number.\n\nHere, a palindromic number is an integer that reads the same backward as forward in decimal notation.\n\n-----Constraints-... | [{"type": "stdin_stdout", "input": "575\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "171\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "123\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "812\n", "output": "No\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are playing One Card Poker.\n\nOne Card Poker is a two-player game using playing cards. \nEach card in this game shows an integer between 1 and 13, inclusive.\n\nThe strength of a card is determined by the ... | [{"type": "stdin_stdout", "input": "1 13\n", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "11 11\n", "output": "Draw\n"}, {"type": "stdin_stdout", "input": "8 6\n", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "9 7\n", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "3 2\n", "output": "Ali... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs a New Year's gift, Dolphin received a string s of length 19.\n\nThe string s has the following format: [five lowercase English letters],[seven lowercase English letters],[five lowercase English letters].\n\nDolphin wan... | [{"type": "stdin_stdout", "input": "happy,newyear,enjoy\n", "output": "happy newyear enjoy\n"}, {"type": "stdin_stdout", "input": "haiku,atcoder,tasks\n", "output": "haiku atcoder tasks\n"}, {"type": "stdin_stdout", "input": "abcde,fghihgf,edcba\n", "output": "abcde fghihgf edcba\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N students and M checkpoints on the xy-plane.\n\nThe coordinates of the i-th student (1 \\leq i \\leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \\leq j \\leq M) is (c_j,d_j).\n\nWhen t... | [{"type": "stdin_stdout", "input": "50 50\n-87868672 9773500\n38180447 36636308\n-93470873 38029088\n49678522 -87311634\n62792334 -82584220\n50941177 2445768\n-21746015 -16856077\n-69539173 -40150977\n-82915111 -60619217\n-42155179 93071641\n-3205477 16657057\n26789545 -1410866\n-32360553 -38239433\n-69707837 59109468\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\n-----Constraints-----\n - 1 \\leq a \\leq 10\n - a is an integer.\n\n-----Input-----\nInput is given from Standard Input in the following format:\na\n\n-----O... | [{"type": "stdin_stdout", "input": "10\n", "output": "1110\n"}, {"type": "stdin_stdout", "input": "5\n", "output": "155\n"}, {"type": "stdin_stdout", "input": "6\n", "output": "258\n"}, {"type": "stdin_stdout", "input": "7\n", "output": "399\n"}, {"type": "stdin_stdout", "input": "8\n", "output": "584\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.\n\nA pixel is the smallest element of an image, and in this problem it is a square of... | [{"type": "stdin_stdout", "input": "49 48\n..#.......#....#...###...##.##.####.#.##..#.####.\n#####.....#####.#.#.######...#.#.#####.#.###..##.\n#.##.#####...#..#...##...###.####.....########.#.\n...#....###...#####.#..##.##.......#..####.#.####\n#......##..##.###.###.##..####..###.......###...#\n..#....#.####.###.####... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn some other world, today is the day before Christmas Eve.\nMr. Takaha is buying N items at a department store. The regular price of the i-th item (1 \\leq i \\leq N) is p_i yen (the currency of Japan).\nHe has a discoun... | [{"type": "stdin_stdout", "input": "10\n10000\n10000\n10000\n10000\n10000\n10000\n10000\n10000\n10000\n10000\n", "output": "95000\n"}, {"type": "stdin_stdout", "input": "10\n8830\n106\n9248\n6388\n3562\n7160\n8452\n3486\n5802\n9228\n", "output": "57638\n"}, {"type": "stdin_stdout", "input": "9\n6126\n5482\n9198\n9274\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe restaurant AtCoder serves the following five dishes:\n - ABC Don (rice bowl): takes A minutes to serve.\n - ARC Curry: takes B minutes to serve.\n - AGC Pasta: takes C minutes to serve.\n - APC Ramen: takes D minutes ... | [{"type": "stdin_stdout", "input": "123\n123\n123\n123\n123\n", "output": "643\n"}, {"type": "stdin_stdout", "input": "101\n86\n119\n108\n57\n", "output": "481\n"}, {"type": "stdin_stdout", "input": "10\n80\n110\n70\n90\n", "output": "360\n"}, {"type": "stdin_stdout", "input": "57\n87\n123\n67\n47\n", "output": "393\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a sequence of N integers A_1, \\ldots, A_N.\nFind the (multiplicative) inverse of the sum of the inverses of these numbers, \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\n-----Constraints-----\n - 1 \\l... | [{"type": "stdin_stdout", "input": "100\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn some other world, today is Christmas Eve.\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\nHe decides to choose K trees from these trees and decorate th... | [{"type": "stdin_stdout", "input": "3 2\n1\n500000000\n1000000000\n", "output": "499999999\n"}, {"type": "stdin_stdout", "input": "5 3\n10\n15\n11\n14\n12\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5 3\n5\n7\n5\n7\n7\n", "output": "0\n"}] | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\n-----Constraints-----\n - \\alpha is an uppercase (A - Z) or lowercase (a - z) En... | [{"type": "stdin_stdout", "input": "B\n", "output": "A\n"}, {"type": "stdin_stdout", "input": "a\n", "output": "a\n"}, {"type": "stdin_stdout", "input": "A\n", "output": "A\n"}, {"type": "stdin_stdout", "input": "G\n", "output": "A\n"}, {"type": "stdin_stdout", "input": "Y\n", "output": "A\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a digit sequence S of length 4. You are wondering which of the following formats S is in:\n - YYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), ... | [{"type": "stdin_stdout", "input": "0112\n", "output": "AMBIGUOUS\n"}, {"type": "stdin_stdout", "input": "0101\n", "output": "AMBIGUOUS\n"}, {"type": "stdin_stdout", "input": "1905\n", "output": "YYMM\n"}, {"type": "stdin_stdout", "input": "1312\n", "output": "YYMM\n"}, {"type": "stdin_stdout", "input": "0348\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive). The order does not matter.\n\n-----Constraints-----\n - 2\\leq K\\leq 100\n - K is an in... | [{"type": "stdin_stdout", "input": "100\n", "output": "2500\n"}, {"type": "stdin_stdout", "input": "99\n", "output": "2450\n"}, {"type": "stdin_stdout", "input": "98\n", "output": "2401\n"}, {"type": "stdin_stdout", "input": "67\n", "output": "1122\n"}, {"type": "stdin_stdout", "input": "50\n", "output": "625\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDolphin loves programming contests. Today, he will take part in a contest in AtCoder.\n\nIn this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as \"21 o'clock\".\n\nThe current time is A o'clock, a... | [{"type": "stdin_stdout", "input": "23 23\n", "output": "22\n"}, {"type": "stdin_stdout", "input": "9 12\n", "output": "21\n"}, {"type": "stdin_stdout", "input": "19 0\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "22 1\n", "output": "23\n"}, {"type": "stdin_stdout", "input": "3 12\n", "output": "15\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is a member of a programming competition site, ButCoder.\nEach member of ButCoder is assigned two values: Inner Rating and Displayed Rating.\nThe Displayed Rating of a member is equal to their Inner Rating if th... | [{"type": "stdin_stdout", "input": "100 4111\n", "output": "4111\n"}, {"type": "stdin_stdout", "input": "22 3051\n", "output": "3051\n"}, {"type": "stdin_stdout", "input": "10 3141\n", "output": "3141\n"}, {"type": "stdin_stdout", "input": "11 3141\n", "output": "3141\n"}, {"type": "stdin_stdout", "input": "2 2919\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer N. Find the number of digits that N has in base K.\n\n-----Notes-----\nFor information on base-K representation, see Positional notation - Wikipedia.\n\n-----Constraints-----\n - All values in input ar... | [{"type": "stdin_stdout", "input": "1000000000 2\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "314159265 3\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "282475249 7\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "282475248 7\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "282... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.\nAt least how many sheets of paper does he need?\n\n-----Constraints-----\n - N is an integer.\n... | [{"type": "stdin_stdout", "input": "100\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "50\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "97\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "99\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "42\n", "output": "21\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nE869120's and square1001's 16-th birthday is coming soon.\n\nTakahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces.\nE869120 and square1001 were just about to eat A and B of those piece... | [{"type": "stdin_stdout", "input": "5 4\n", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "8 8\n", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "1 1\n", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "6 7\n", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "2 3\n", "output": "Yay!\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a string S consisting of digits 1, 2, ..., 9.\nLunlun, the Dachshund, will take out three consecutive digits from S, treat them as a single integer X and bring it to her master. (She cannot rearrange the digits.)... | [{"type": "stdin_stdout", "input": "1111111111\n", "output": "642\n"}, {"type": "stdin_stdout", "input": "2432423234\n", "output": "321\n"}, {"type": "stdin_stdout", "input": "8889998899\n", "output": "135\n"}, {"type": "stdin_stdout", "input": "1234567876\n", "output": "34\n"}, {"type": "stdin_stdout", "input": "69452... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere were $n$ types of swords in the theater basement which had been used during the plays. Moreover there were exactly $x$ swords of each type. $y$ people have broken into the theater basement and each of them has taken... | [{"type": "stdin_stdout", "input": "10\n100000000 200000000 300000000 20 500000000 600000000 700000000 800000000 900000000 1000000000\n", "output": "244999999 20\n"}, {"type": "stdin_stdout", "input": "10\n1000000000 1 2 3 4 5 6 7 8 9\n", "output": "8999999955 1\n"}, {"type": "stdin_stdout", "input": "10\n1 1000000000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a forest — an undirected graph with $n$ vertices such that each its connected component is a tree.\n\nThe diameter (aka \"longest shortest path\") of a connected undirected graph is the maximum number of edg... | [{"type": "stdin_stdout", "input": "100 50\n2 1\n3 4\n6 5\n7 8\n9 10\n11 12\n13 14\n12 13\n18 17\n21 22\n20 23\n20 21\n25 26\n28 27\n30 29\n32 31\n34 35\n33 35\n34 32\n37 36\n41 40\n43 44\n44 45\n47 48\n46 48\n50 49\n52 53\n53 54\n56 55\n57 58\n62 61\n65 64\n65 63\n67 66\n70 69\n71 73\n72 74\n71 74\n75 72\n77 76\n82 81... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ dormitories in Berland State University, they are numbered with integers from $1$ to $n$. Each dormitory consists of rooms, there are $a_i$ rooms in $i$-th dormitory. The rooms in $i$-th dormitory are number... | [{"type": "stdin_stdout", "input": "3 10\n1000000000 1000000000 1000000000\n543678543 567869543 1000000000 1000000001 1500000000 1999999999 2000000000 2000000001 2754432345 3000000000\n", "output": "1 543678543\n1 567869543\n1 1000000000\n2 1\n2 500000000\n2 999999999\n2 1000000000\n3 1\n3 754432345\n3 1000000000\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has guessed three positive integers $a$, $b$ and $c$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three num... | [{"type": "stdin_stdout", "input": "1000000000 666666667 666666667 666666666\n", "output": "333333333 333333333 333333334\n"}, {"type": "stdin_stdout", "input": "600000000 900000000 500000000 1000000000\n", "output": "100000000 400000000 500000000\n"}, {"type": "stdin_stdout", "input": "500000000 500000001 999999999 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a garland consisting of $n$ lamps. Each lamp is colored red, green or blue. The color of the $i$-th lamp is $s_i$ ('R', 'G' and 'B' — colors of lamps in the garland).\n\nYou have to recolor some lamps in this gar... | [{"type": "stdin_stdout", "input": "500\nBRGRRBBGGRBBRBBGGGRBGBGRGRRBRRRBGRBGBRGGGRBBRRBBBRGGBGBBBGGGRGRBBBRBGGBRGGGBRGGRBRGBBGBRRGGBGRGBGGGGGRBBRGBGGRBGGGRBRGGBBGRBBRRRGBRRBGGBGBGGGGRBGRGRRGGGBRBRRGBGGGRBRBBGBBGGBRBGBRRGGRRBGGRRRRBRGRBBBRRBGRBBGBGBRRGGBRRBBRRGGRRRBGBRBBGRRRRBGGGBRGRRBRRRRGGRBRRBBRRGRGBGRRRBRRGGBBGRRBB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer array of length $n$.\n\nYou have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the requi... | [{"type": "stdin_stdout", "input": "12\n1 2 3 4 5 6 7 8 9 10 11 12\n", "output": "12\n1 2 3 4 5 6 7 8 9 10 11 12 \n"}, {"type": "stdin_stdout", "input": "9\n6 7 8 3 4 5 9 10 11\n", "output": "6\n1 2 3 7 8 9 \n"}, {"type": "stdin_stdout", "input": "7\n3 3 4 5 6 7 8\n", "output": "6\n2 3 4 5 6 7 \n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given integers A and B, each between 1 and 3 (inclusive).\nDetermine if there is an integer C between 1 and 3 (inclusive) such that A \\times B \\times C is an odd number.\n\n-----Constraints-----\n - All values i... | [{"type": "stdin_stdout", "input": "3 1\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 1\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 3\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "3 3\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 2\n", "output": "No\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\nAlso, there is a bus going from Station B to Station C that costs Y yen.\nJoisino got a special ticket. With this ticket, she c... | [{"type": "stdin_stdout", "input": "100 100\n", "output": "150\n"}, {"type": "stdin_stdout", "input": "81 58\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "100 2\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "76 48\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "1 100\n", "output": "5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is going to set a 3-character password.\nHow many possible passwords are there if each of its characters must be a digit between 1 and N (inclusive)?\n\n-----Constraints-----\n - 1 \\leq N \\leq 9\n - N is an in... | [{"type": "stdin_stdout", "input": "5\n", "output": "125\n"}, {"type": "stdin_stdout", "input": "6\n", "output": "216\n"}, {"type": "stdin_stdout", "input": "7\n", "output": "343\n"}, {"type": "stdin_stdout", "input": "8\n", "output": "512\n"}, {"type": "stdin_stdout", "input": "9\n", "output": "729\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShichi-Go-San (literally \"Seven-Five-Three\") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.\nTakahashi is now X years old. Will his growth be celebrated... | [{"type": "stdin_stdout", "input": "5\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "3\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "7\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "6\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\n", "output": "NO\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDecades have passed since the beginning of AtCoder Beginner Contest.\nThe contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds shou... | [{"type": "stdin_stdout", "input": "1000\n", "output": "ABD\n"}, {"type": "stdin_stdout", "input": "1481\n", "output": "ABD\n"}, {"type": "stdin_stdout", "input": "1998\n", "output": "ABD\n"}, {"type": "stdin_stdout", "input": "1513\n", "output": "ABD\n"}, {"type": "stdin_stdout", "input": "1285\n", "output": "ABD\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate d... | [{"type": "stdin_stdout", "input": "6\n13\n29\n48\n105\n100\n", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "25\n26\n27\n28\n29\n91\n", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "0\n7\n9\n52\n123\n123\n", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "15\n18\n26\n35\n36\n18\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\n-----Constraints-----\n -... | [{"type": "stdin_stdout", "input": "4999\nzzzzzzzzzz\n", "output": "zzzzzzzzzz\n"}, {"type": "stdin_stdout", "input": "4998\nrainbow\n", "output": "rainbow\n"}, {"type": "stdin_stdout", "input": "3201\npurple\n", "output": "purple\n"}, {"type": "stdin_stdout", "input": "3200\npink\n", "output": "pink\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA programming competition site AtCode regularly holds programming contests.\nThe next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200.\nThe contest after the ABC is called ARC, ... | [{"type": "stdin_stdout", "input": "1199\n", "output": "ABC\n"}, {"type": "stdin_stdout", "input": "1200\n", "output": "ARC\n"}, {"type": "stdin_stdout", "input": "4208\n", "output": "AGC\n"}, {"type": "stdin_stdout", "input": "1234\n", "output": "ARC\n"}, {"type": "stdin_stdout", "input": "2799\n", "output": "ARC\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing... | [{"type": "stdin_stdout", "input": "119\n", "output": "991\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "111\n"}, {"type": "stdin_stdout", "input": "191\n", "output": "919\n"}, {"type": "stdin_stdout", "input": "111\n", "output": "999\n"}, {"type": "stdin_stdout", "input": "191\n", "output": "919\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice guesses the strings that Bob made for her.\n\nAt first, Bob came up with the secret string $a$ consisting of lowercase English letters. The string $a$ has a length of $2$ or more characters. Then, from string $a$ he... | [{"type": "stdin_stdout", "input": "11\nabbaac\nabbaac\nabbaac\nabbaac\nabbaac\nabbaac\nabbaac\nabbaac\nac\nbccddaaf\nzzzzzzzzzz\n", "output": "abac\nabac\nabac\nabac\nabac\nabac\nabac\nabac\nac\nbcdaf\nzzzzzz\n"}, {"type": "stdin_stdout", "input": "10\nabbaac\nac\nbccddaaf\nzzzzzzzzzz\nabbaac\nac\nbccddaaf\nzzzzzzzzzz... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim so... | [{"type": "stdin_stdout", "input": "5 1\n3 10 9 10 6\n", "output": "10.000000000000000\n"}, {"type": "stdin_stdout", "input": "5 4\n5 1 10 6 1\n", "output": "5.500000000000000\n"}, {"type": "stdin_stdout", "input": "5 2\n7 3 3 1 8\n", "output": "5.000000000000000\n"}, {"type": "stdin_stdout", "input": "5 3\n1 7 6 9 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp loves ciphers. He has invented his own cipher called repeating.\n\nRepeating cipher is used for strings. To encrypt the string $s=s_{1}s_{2} \\dots s_{m}$ ($1 \\le m \\le 10$), Polycarp uses the following algorit... | [{"type": "stdin_stdout", "input": "55\ncooooonnnnttttteeeeeeeeeeeeessssssssttttttttttttttttttt\n", "output": "coonteestt"}, {"type": "stdin_stdout", "input": "55\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "aaaaaaaaaa"}, {"type": "stdin_stdout", "input": "36\nabbcccddddeeeeeffffffggggggghhhh... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected weighted connected graph with $n$ vertices and $m$ edges without loops and multiple edges.\n\nThe $i$-th edge is $e_i = (u_i, v_i, w_i)$; the distance between vertices $u_i$ and $v_i$ along the... | [{"type": "stdin_stdout", "input": "8 10\n1 2 1\n2 3 2\n2 4 5\n1 4 2\n6 3 3\n6 1 3\n3 5 2\n3 7 1\n4 8 1\n6 2 4\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "6 7\n1 2 1\n2 3 1\n3 4 1\n4 5 1\n5 1 2\n2 6 2\n3 6 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5 6\n1 2 2\n2 3 1\n4 5 3\n2 4 2\n1 4 2\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a garland consisting of $n$ lamps. Each lamp is colored red, green or blue. The color of the $i$-th lamp is $s_i$ ('R', 'G' and 'B' — colors of lamps in the garland).\n\nYou have to recolor some lamps in this gar... | [{"type": "stdin_stdout", "input": "500\nBRGRRBBGGRBBRBBGGGRBGBGRGRRBRRRBGRBGBRGGGRBBRRBBBRGGBGBBBGGGRGRBBBRBGGBRGGGBRGGRBRGBBGBRRGGBGRGBGGGGGRBBRGBGGRBGGGRBRGGBBGRBBRRRGBRRBGGBGBGGGGRBGRGRRGGGBRBRRGBGGGRBRBBGBBGGBRBGBRRGGRRBGGRRRRBRGRBBBRRBGRBBGBGBRRGGBRRBBRRGGRRRBGBRBBGRRRRBGGGBRGRRBRRRRGGRBRRBBRRGRGBGRRRBRRGGBBGRRBB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi received otoshidama (New Year's money gifts) from N of his relatives.\nYou are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i r... | [{"type": "stdin_stdout", "input": "10\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n", "output": "380000000.0\n"}, {"type": "stdin_stdout", "input": "10\n22.49891780 BTC\n59.00375526 B... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an N-car train.\nYou are given an integer i. Find the value of j such that the following statement is true: \"the i-th car from the front of the train is the j-th car from the back.\"\n\n-----Constraints-----\n -... | [{"type": "stdin_stdout", "input": "100 1\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100 100\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "93 40\n", "output": "54\n"}, {"type": "stdin_stdout", "input": "89 21\n", "output": "69\n"}, {"type": "stdin_stdout", "input": "15 11\n", "output": "5\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the fir... | [{"type": "stdin_stdout", "input": "100\naernvaoeiuraxmueiwovioxmuaioervuaionuxiaomuahlhakaqduwbuvpgrrgreiufwuiaubewobsjdhfbajkslfhjcaklyuwee aibfaeqpwidbcuoifnydukfbavysknxyualdyksayfkjdafqiryekucyuwepaasfdasdfiocaudmiovuandksfucnaldsfumioxa\n", "output": "aaeirbnfvaaeoqepiwuirdabxcmuuoeiifwnoyvdiuokxfmbuaaviyosekrnvx... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S... | [{"type": "stdin_stdout", "input": "ABA\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "BBA\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "BAB\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "AAB\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "ABB\n", "output": "Yes\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it mean... | [{"type": "stdin_stdout", "input": "RRS\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "SSS\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "RSR\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "SRS\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "SSR\n", "output": "1\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi, who is A years old, is riding a Ferris wheel.\nIt costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for... | [{"type": "stdin_stdout", "input": "30 100\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "13 298\n", "output": "298\n"}, {"type": "stdin_stdout", "input": "60 654\n", "output": "654\n"}, {"type": "stdin_stdout", "input": "12 100\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "6 482\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is always an integer in Takahashi's mind.\nInitially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is + or -. When he eats +, the integer in his mind increases by 1... | [{"type": "stdin_stdout", "input": "-+--\n", "output": "-2\n"}, {"type": "stdin_stdout", "input": "----\n", "output": "-4\n"}, {"type": "stdin_stdout", "input": "--+-\n", "output": "-2\n"}, {"type": "stdin_stdout", "input": "+---\n", "output": "-2\n"}, {"type": "stdin_stdout", "input": "+-++\n", "output": "2\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S as input. This represents a valid date in the year 2019 in the yyyy/mm/dd format. (For example, April 30, 2019 is represented as 2019/04/30.)\nWrite a program that prints Heisei if the date repres... | [{"type": "stdin_stdout", "input": "2019/04/30\n", "output": "Heisei\n"}, {"type": "stdin_stdout", "input": "2019/01/01\n", "output": "Heisei\n"}, {"type": "stdin_stdout", "input": "2019/02/28\n", "output": "Heisei\n"}, {"type": "stdin_stdout", "input": "2019/04/29\n", "output": "Heisei\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions are constraints on $n$ and $k$.\n\nYou are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most $k$ most recent conversat... | [{"type": "stdin_stdout", "input": "10 4\n2 3 3 1 1 2 1 2 3 3\n", "output": "3\n1 3 2 \n"}, {"type": "stdin_stdout", "input": "9 2\n1 2 3 4 5 6 7 8 9\n", "output": "2\n9 8 \n"}, {"type": "stdin_stdout", "input": "7 2\n1 2 3 2 1 3 2\n", "output": "2\n2 1 \n"}, {"type": "stdin_stdout", "input": "3 4\n1 1 2\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has $n$ coins, the value of the $i$-th coin is $a_i$. It is guaranteed that all the values are integer powers of $2$ (i.e. $a_i = 2^d$ for some non-negative integer number $d$).\n\nPolycarp wants to know answers ... | [{"type": "stdin_stdout", "input": "1 10\n8\n1\n2\n3\n4\n5\n6\n7\n8\n9\n16\n", "output": "-1\n-1\n-1\n-1\n-1\n-1\n-1\n1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "1 10\n4\n1\n2\n3\n4\n5\n6\n7\n8\n9\n16\n", "output": "-1\n-1\n-1\n1\n-1\n-1\n-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "1 10\n2\n1\n2\n3\n4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero):\n\n Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ a... | [{"type": "stdin_stdout", "input": "69\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n2 3 3 4 1 4 1 4 1 4\n", "output": "6\n1 3 4 \n1 2 3 \n1 1 2 \n1 5 4 \n1 7 6 \n1 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp and his friends want to visit a new restaurant. The restaurant has $n$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $1$ to $n$ in the order from l... | [{"type": "stdin_stdout", "input": "7\n4 4\n0100\n4 4\n0100\n4 4\n0100\n4 4\n0100\n4 4\n0100\n4 4\n0100\n4 4\n0100\n", "output": "0\n0\n0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0\n", "output": "1\n2\n0\n1\n1\n1\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is constraints.\n\nYou are given $n$ segments on the coordinate axis $OX$. Segments can intersect, lie inside each other and even coincide. The $i$-th segment is $[l_i; r... | [{"type": "stdin_stdout", "input": "18 1\n116 138\n106 165\n105 130\n142 161\n99 128\n108 149\n82 162\n131 134\n167 167\n138 155\n76 150\n71 132\n100 167\n86 161\n88 152\n76 158\n142 150\n136 138\n", "output": "13\n1 2 3 4 6 7 10 11 12 13 14 15 16 \n"}, {"type": "stdin_stdout", "input": "16 3\n181 182\n183 184\n179 181... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne important contest will take place on the most famous programming platform (Topforces) very soon!\n\nThe authors have a pool of $n$ problems and should choose at most three of them into this contest. The prettiness of ... | [{"type": "stdin_stdout", "input": "1\n37\n166320 83160 41580 33264 27720 23760 20790 18480 16632 15120 13860 11880 11088 10395 9240 8316 7920 7560 6930 6160 5940 5544 5040 4752 4620 4158 3960 3780 3696 3465 3080 3024 2970 2772 2640 29 23\n", "output": "166372\n"}, {"type": "stdin_stdout", "input": "1\n53\n50 50 50 50 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo integer sequences existed initially — one of them was strictly increasing, and the other one — strictly decreasing.\n\nStrictly increasing sequence is a sequence of integers $[x_1 < x_2 < \\dots < x_k]$. And strictly ... | [{"type": "stdin_stdout", "input": "7\n7 2 7 3 3 1 4\n", "output": "YES\n2\n3 7 \n5\n7 4 3 2 1 \n"}, {"type": "stdin_stdout", "input": "5\n4 3 1 5 3\n", "output": "YES\n1\n3 \n4\n5 4 3 1 \n"}, {"type": "stdin_stdout", "input": "5\n0 1 2 3 4\n", "output": "YES\n0\n\n5\n4 3 2 1 0 \n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ products in the shop. The price of the $i$-th product is $a_i$. The owner of the shop wants to equalize the prices of all products. However, he wants to change prices smoothly.\n\nIn fact, the owner of the s... | [{"type": "stdin_stdout", "input": "5\n8 19551489\n31131899 17585660 3913937 14521321 5400652 96097161 58347480 35051437\n1 55716143\n15578410\n7 19560555\n65980880 53703939 20259503 99698023 98868060 83313210 9926424\n6 72321938\n59271765 72426489 16625497 51598082 31475864 53103921\n7 44965081\n49955408 62397026 3998... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integers. Each $a_i$ is one of the six following numbers: $4, 8, 15, 16, 23, 42$.\n\nYour task is to remove the minimum number of elements to make this array good.\n\nAn array ... | [{"type": "stdin_stdout", "input": "100\n4 42 23 23 8 42 16 23 42 16 42 8 4 23 4 4 23 42 16 42 23 23 23 42 4 42 8 8 16 23 15 23 16 4 42 15 15 23 16 15 16 4 4 15 23 42 42 15 8 23 8 23 4 15 16 15 42 8 23 16 15 42 23 8 4 16 15 16 23 16 16 4 23 16 8 23 16 15 23 4 4 8 15 4 4 15 8 23 23 4 4 8 8 4 42 15 4 4 42 16\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $a$ and $b$.\n\nIn one move, you can choose some integer $k$ from $1$ to $10$ and add it to $a$ or subtract it from $a$. In other words, you choose an integer $k \\in [1; 10]$ and perform $a := ... | [{"type": "stdin_stdout", "input": "11\n5 5\n13 42\n18 4\n1337 420\n123456789 1000000000\n100500 9000\n5 5\n13 42\n18 4\n1337 420\n123456789 1000000000\n", "output": "0\n3\n2\n92\n87654322\n9150\n0\n3\n2\n92\n87654322\n"}, {"type": "stdin_stdout", "input": "6\n5 5\n13 42\n18 4\n1337 420\n123456789 1000000000\n100500 90... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.