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\nFirst-rate specialists graduate from Berland State Institute of Peace and Friendship. You are one of the most talented students in this university. The education is not easy because you need to have fundamental knowledge ... | [{"type": "stdin_stdout", "input": "prntaxhysjfcfmrjngdsitlguahtpnwgbaxptubgpwcfxqehrulbxfcjssgocqncscduvyvarvwxzvmjoatnqfsvsilubexmwugedtzavyamqjqtkxzuslielibjnvkpvyrbndehsqcaqzcrmomqqwskwcypgqoawxdutnxmeivnfpzwvxiyscbfnloqjhjacsfnkfmbhgzpujrqdbaemjsqphokkiplblbflvadcyykcqrdohfasstobwrobslaofbasylwiizrpozvhtwyxtzl\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMemory 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 lengt... | [{"type": "stdin_stdout", "input": "100000 25000\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "167552 16353\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "113151 20996\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "141391 23890\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "1001... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVery soon there will be a parade of victory over alien invaders in Berland. Unfortunately, all soldiers died in the war and now the army consists of entirely new recruits, many of whom do not even know from which leg they... | [{"type": "stdin_stdout", "input": "10\n18 18\n71 471\n121 362\n467 107\n138 254\n13 337\n499 373\n337 387\n147 417\n76 417\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n18 30\n71 471\n121 362\n467 107\n170 127\n13 337\n499 373\n337 387\n147 417\n122 417\n", "output": "4"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's that time of the year, Felicity is around the corner and you can see people celebrating all around the Himalayan region. The Himalayan region has n gyms. The i-th gym has gi Pokemon in it. There are m distinct Pokemo... | [{"type": "stdin_stdout", "input": "100 2\n1 1\n1 2\n1 2\n1 1\n1 2\n1 1\n1 2\n1 1\n1 1\n1 1\n1 2\n1 1\n1 1\n1 1\n1 2\n1 1\n1 2\n1 1\n1 2\n1 2\n1 1\n1 1\n1 1\n1 2\n1 2\n1 2\n1 2\n1 1\n1 2\n1 1\n1 1\n1 2\n1 1\n1 1\n1 1\n1 2\n1 2\n1 1\n1 1\n1 1\n1 1\n1 2\n1 1\n1 2\n1 1\n1 2\n1 1\n1 2\n1 1\n1 2\n1 1\n1 2\n1 2\n1 2\n1 1\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fak... | [{"type": "stdin_stdout", "input": "688094\n", "output": "abcdefghijklmnopqrssrqpomlkjihgfebbbccddeeffgghhiijjkkllmmnnooppqqrrss abcdefghijklmnopqrs\n"}, {"type": "stdin_stdout", "input": "912733\n", "output": "abcdefghijklmnopqrstsrqpnljigfedbccddeeffgghhiijjkkllmmnnooppqqrrsstt abcdefghijklmnopqrst\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters. \n\nSuitability of string s is calculated by following metric:\n\nAny two letters can be swapped positions, th... | [{"type": "stdin_stdout", "input": "ccaaa?bc?baccbccccbca?cccab??aacccbaac?bccacc?accccaccbcbbcbc\ncbaaacccc\n", "output": "ccaaaabcabaccbccccbcaacccabaaaacccbaacabccaccaaccccaccbcbbcbc\n"}, {"type": "stdin_stdout", "input": "ccaaa?bc?bbccbccccbca?cccab??aacccbaac?bccacc?accccaccbcbbcbc\ncbaaacccc\n", "output": "ccaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWherever the destination is, whoever we meet, let's render this song together.\n\nOn a Cartesian coordinate plane lies a rectangular stage of size w Γ h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and ... | [{"type": "stdin_stdout", "input": "20 50000 50000\n2 45955 55488\n1 19804 29337\n2 3767 90811\n2 24025 33558\n1 46985 56518\n2 21094 30627\n2 5787 15320\n1 4262 91306\n2 37231 46764\n1 18125 27658\n1 36532 12317\n1 31330 40863\n1 18992 28525\n1 29387 38920\n1 44654 54187\n2 45485 55018\n2 36850 46383\n1 44649 54182\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enume... | [{"type": "stdin_stdout", "input": "10 10 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n1 1 9 1\n7 1 4 1\n10 1 7 1\n2 1 7 1\n3 1 2 1\n5 1 2 1\n10 1 5 1\n6 1 9 1\n", "output": "3\n4\n4\n3\n3\n4\n3\n3\n4\n3\n"}, {"type": "stdin_stdout", "input": "10 18 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n1 1 9 1\n7 1 4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.\n\nYou paint the numbers according to the following rules:\n... | [{"type": "stdin_stdout", "input": "26294 4\n2 3 5 6\n4 4 3 1 4 1 4 3 4 2 2 2 4 3 1 4 4 1 2 4 3 2 4 1 1 2 1 2 2 3 2 1 1 2 1 2 1 2 4 2 4 3 2 4 4 4 1 1 2 3 2 4 3 3 1 1 3 2 1 3 2 3 1 1 1 2 4 4 2 4 3 4 2 4 1 2 3 4 2 1 3 1 3 2 1 3 2 3 1 2 4 2 1 3 2 3 4 4 1 1 3 4 4 4 3 1 2 1 2 2 1 2 4 1 1 3 2 4 4 4 4 3 1 1 4 3 2 4 4 2 2 4 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHansa is throwing a birthday party. Seeing the extravagant parties thrown by her friends in the past, Hansa too decided to do something unique. Being a Computer Engineer herself, she knew just how to do it. She sent passw... | [{"type": "stdin_stdout", "input": "20\n24 je6kbgm514608c5g336fl2jmi46fb5h2j250lhcinhhfl4i90ee9jg5g3f6ab263hinmhj5c4i8d0flee0fa55c61lf5mh130354ji6fja6g7f3085jd8fkik5lmjkec983f0j19iimfn969j03a43kifkfjk2g6mfac255kbj83d9gfffbk70i17g7knkllabamje3ih8n5badfa7hm6k5ibgj19b290ib6blbjn6d1224935775ki8i5kfbheg26a3a07kh4ahm07d6alid... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGazi is a very talented mathematician, recently he discovered the majestic power of the number '9' so he wants to play a game with you. He tells you to pick any real integer [from 10 to 10^200], then subtract sum of digit... | [{"type": "stdin_stdout", "input": "4\n4_1\n52_2\n63_124\n25141452_5575\n\nSAMPLE", "output": "4\n0 or 9\n2\n8\n"}, {"type": "stdin_stdout", "input": "4\n4_1\n52_2\n63_124\n25141452_5575\n\nS@MPLE", "output": "4\n0 or 9\n2\n8\n"}, {"type": "stdin_stdout", "input": "4\n4_1\n52_2\n63_124\n25141452_5575\n\nR@MPLE", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Shino is interested in the fighting tournaments. Once she went to watch one of the tournaments. There were N fighters and i^{th} fighter will be represented by i. Each fighter has some distinct strength. Rules of t... | [{"type": "stdin_stdout", "input": "5 5\n1 13 3 21 5\n1\n2\n4\n2\n2\n\nELONAS", "output": "1\n2\n3\n2\n2\n"}, {"type": "stdin_stdout", "input": "5 5\n1 13 3 21 5\n1\n2\n4\n4\n2\n\nELONAS", "output": "1\n2\n3\n3\n2\n"}, {"type": "stdin_stdout", "input": "5 5\n1 3 0 10 4\n1\n2\n2\n5\n5\n\nSAMPLE", "output": "1\n2\n2\n1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGandalf the Grey is in trouble as Saurons eye Rearrived in the middle\n world. Now he has to prepare for the war, But in order to defeat Sauron \n he has to know the power of saurons eye on the day in which he wants... | [{"type": "stdin_stdout", "input": "100\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are on a game show \"Who Wants to Be a Millionaire\".The host presents you \"N\" number of closed doors.There is huge prize behind one door while there are sumo wrestlers behind rest of the doors.Initially you are ask... | [{"type": "stdin_stdout", "input": "444\n793\n255\n144\n906\n931\n102\n101\n301\n341\n340\n308\n524\n678\n587\n405\n718\n733\n466\n145\n13\n27\n717\n714\n899\n911\n121\n602\n864\n882\n876\n761\n886\n640\n697\n44\n29\n288\n938\n525\n331\n160\n940\n50\n445\n67\n65\n188\n735\n524\n600\n408\n836\n939\n949\n89\n967\n433\n92... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\n* the dogs number... | [{"type": "stdin_stdout", "input": "123456789", "output": "jjddja"}, {"type": "stdin_stdout", "input": "71095103", "output": "eynzga\n"}, {"type": "stdin_stdout", "input": "50389265", "output": "dffxhq\n"}, {"type": "stdin_stdout", "input": "56744729", "output": "dtdmwo\n"}, {"type": "stdin_stdout", "input": "61759127"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\n\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo she... | [{"type": "stdin_stdout", "input": "60 106 34\n92 41 43\n39 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "60 88 34\n92 41 43\n39 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "60 68 34\n92 41 43\n39 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of t... | [{"type": "stdin_stdout", "input": "10\nyakutsl 17\nkyastul 49\nysjutak 102\ntvl`kty 0\ntakvysi 11\nxavksks 3\nkstujby 117\nybstlvk 116\nyauktsk 317\njrkutay 111", "output": "10\n7\n2\n5\n4\n6\n1\n9\n8\n3\n"}, {"type": "stdin_stdout", "input": "10\nyakussl 17\nkyastul 49\nysjutak 102\ntvl`kty 1\ntakvysi 11\nxavksks 3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHow many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?\n\nConstraints\n\n* 1β€Mβ€23\n* M is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\n\nM\n\n... | [{"type": "stdin_stdout", "input": "182", "output": "-134\n"}, {"type": "stdin_stdout", "input": "339", "output": "-291\n"}, {"type": "stdin_stdout", "input": "-117", "output": "165\n"}, {"type": "stdin_stdout", "input": "467", "output": "-419\n"}, {"type": "stdin_stdout", "input": "-155", "output": "203\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`.\n\nYou are given a string s of length at least 3 consisting of... | [{"type": "stdin_stdout", "input": "intfrnationalization", "output": "i18n\n"}, {"type": "stdin_stdout", "input": "noitazilanoitanrftni", "output": "n18i\n"}, {"type": "stdin_stdout", "input": "ooitazilanoitanrftni", "output": "o18i\n"}, {"type": "stdin_stdout", "input": "onilazitanojianrftot", "output": "o18t\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each p... | [{"type": "stdin_stdout", "input": "11 12 -1", "output": "3\n"}, {"type": "stdin_stdout", "input": "11 20 -1", "output": "3\n"}, {"type": "stdin_stdout", "input": "5 -1 33", "output": "3\n"}, {"type": "stdin_stdout", "input": "5 -2 33", "output": "3\n"}, {"type": "stdin_stdout", "input": "3 17 -1", "output": "3\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet p (i) be the i-th prime number from the smallest. For example, 7 is the fourth prime number from the smallest, 2, 3, 5, 7, so p (4) = 7.\n\nGiven n, the sum of p (i) from i = 1 to n s\n\ns = p (1) + p (2) + .... + p (... | [{"type": "stdin_stdout", "input": "2\n219\n0", "output": "5\n136114\n"}, {"type": "stdin_stdout", "input": "2\n279\n0", "output": "5\n231208\n"}, {"type": "stdin_stdout", "input": "2\n195\n0", "output": "5\n105540\n"}, {"type": "stdin_stdout", "input": "2\n199\n0", "output": "5\n110364\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one ... | [{"type": "stdin_stdout", "input": "bbw\nbww\n+b+\nbwb\nwbx\nwbw\n0", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "caw\nwbw\n+b+\nbwb\nwxb\nwbw\n0", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "bbw\nbww\n+b+\nbwb\nwbx\nwbv\n0", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "cbw\nbww... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOrdinary Jigsaw puzzles are solved with visual hints; players solve a puzzle with the picture which the puzzle shows on finish, and the diverse patterns of pieces. Such Jigsaw puzzles may be suitable for human players, be... | [{"type": "stdin_stdout", "input": "6\nWwRR wwrg RRGb rGBG RGrb RrRg RGrg rgBB Wrgr\nRrGb WWGR rGgb Wbrg wgBb GgBg WbBG Wwwg WWGG\nRBbr Wrbr wGGG wggR WgGR WBWb WRgB wBgG WBgG\nwBrg rGgb WRrB WWbw wRRB RbbB WRrb wrbb WgrG\nWrwB WWww wRRB WGGb Wbbg WBgG WrbG Wrww RBgg\nWWgg RBrr Rggr RGBg Wbgr WGbg WBbr WGWB GGGg", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEmergency Evacuation\n\nThe Japanese government plans to increase the number of inbound tourists to forty million in the year 2020, and sixty million in 2030. Not only increasing touristic appeal but also developing touri... | [{"type": "stdin_stdout", "input": "0 1 3\n1 1\n-2 18\n0 4\n3 -1\n1 3\n0 1\n2 0", "output": "20\n"}, {"type": "stdin_stdout", "input": "0 1 3\n0 1\n-2 35\n0 3\n5 -1\n1 2\n0 1\n5 0", "output": "37\n"}, {"type": "stdin_stdout", "input": "0 3 3\n1 1\n-2 18\n0 3\n5 -1\n1 2\n0 1\n5 0", "output": "18\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlmost Identical Programs\n\nThe programming contest named Concours de Programmation Comtemporaine Interuniversitaire (CPCI) has a judging system similar to that of ICPC; contestants have to submit correct outputs for two... | [{"type": "stdin_stdout", "input": "print\"hello\";print133\nprint\"hello\";print123\nread\"B1input\";solve;output;\n;tuptuo;evlos;\"2B\"daer\nread\"C1\";solve;output\"C1ans\";\nread\"C2\";solve;output\"C2ans\";\n\"\"\"\"\"\"\"\"\n\"\"\"42\"\"#\"\"\nslow\"program\"\nfast\"code\"\n\"super\"fast\"program\"\n\"super\"fast... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem D: Legendary Sword\n\n* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.\n\nThe Demon King, who has finally revived, is about to invade the human world to wrap the ... | [{"type": "stdin_stdout", "input": "10 10\nS . . . . . . . . .\n. . . . . . . . . .\n. . . . 1 . . . . .\n. . . . . . . . . .\n. . . . . . . . . .\n. . . . . . . 3 . .\n. . . . . . . . . .\n. . . . . 4 . . . .\n. . . . . . . . . .\n2 . . . . . . . . G\n10 10\nS . . . . . 3 . . .\n. . 3 . . . . . . .\n. . . . 1 . . . . ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFizzBuzz is a game in which integers of 1 or more are spoken in order according to the following rules.\n\n* \"Fizz\" when divisible by 3\n\n* \"Buzz\" when divisible by 5\n\n* \"FizzBuzz\" when divisible by both 3 and 5\... | [{"type": "stdin_stdout", "input": "10010000000", "output": "990079BuzzFizz141999\n"}, {"type": "stdin_stdout", "input": "10010000001", "output": "90079BuzzFizz1419990\n"}, {"type": "stdin_stdout", "input": "10000000001", "output": "3FizzBuzz1418650796F\n"}, {"type": "stdin_stdout", "input": "10000001001", "output": "4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\nYou want to compete in ICPC (Internet Contest of Point Collection). In this contest, we move around in $N$ websites, numbered $1$ through $N$, within a time limit and collect points as many as possibl... | [{"type": "stdin_stdout", "input": "5 4 10\n4 3 1\n6 4 3\n3 2 4\n2 2 1\n0 5 3\n1 2\n2 1\n3 4\n4 5\n3 3 1000\n1000 2 100\n1 7 100\n10 9 100\n1 2\n1 1\n3 2\n1 0 5\n25 25 2\n1 -1 25\n25 25 2\n5 5 100\n1 1 20\n1 1 20\n10 1 1\n10 1 1\n10 1 0\n1 2\n2 1\n3 4\n4 5\n5 3\n3 3 100\n70 17 10\n50 16 20\n90 10 10\n1 2\n2 2\n2 3\n0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nB: Pivots\n\nproblem\n\nGiven a permutation of length N, a_1, a_2, ..., a_N, which is a permutation of integers from 1 to N. Also, Q queries are given in order for this permutation. In the i-th query, you have to do the f... | [{"type": "stdin_stdout", "input": "5 2\n1 5 3 2 4\n5 3", "output": "2 4 5 1 3\n"}, {"type": "stdin_stdout", "input": "5 0\n1 5 3 2 4\n5 3", "output": "1 5 3 2 4\n"}, {"type": "stdin_stdout", "input": "5 2\n1 5 3 2 4\n3 2", "output": "4 3 1 5 2\n"}, {"type": "stdin_stdout", "input": "5 1\n1 5 3 2 4\n5 3", "output": "3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, chef Ciel often hears about lucky numbers.\n\n\n\n\nEverybody knows that lucky numbers are positive integers\nwhose decimal representation contains only the lucky digits 4 and 7.\nFor example, numbers 47, 744, 4... | [{"type": "stdin_stdout", "input": "6\nklin 18\nCiel's Drink 174\nThe curry 2nd edition 677505\necis omelet 85855\nunagi 1\n She firsu amd last letters can eb a space 253", "output": "0\n"}, {"type": "stdin_stdout", "input": "6\nklin 18\nCiel's Drink 133\nThe curry 2nd edition 888888\necir omelet 85855\nunagi 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of integers. Vasya can permute (change order) its integers. He wants to do it so that as many as possible integers will become on a place where a smaller integer used to stand. Help Vasya find the m... | [{"type": "stdin_stdout", "input": "6\n300000000 200000000 300000000 200000000 1000000000 300000000\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "6\n300000000 200000000 173776099 200000000 1000000000 300000000\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "6\n300000000 200000000 173776099 200000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a plate and you want to add some gilding to it. The plate is a rectangle that we split into wΓ h cells. There should be k gilded rings, the first one should go along the edge of the plate, the second one β 2 cell... | [{"type": "stdin_stdout", "input": "100 100 20\n", "output": "4880\n"}, {"type": "stdin_stdout", "input": "100 100 25\n", "output": "5100\n"}, {"type": "stdin_stdout", "input": "100 100 16\n", "output": "4416\n"}, {"type": "stdin_stdout", "input": "110 100 25\n", "output": "5600\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMasha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor x, Egor on the... | [{"type": "stdin_stdout", "input": "1000 999 1000 1000 1000 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 999 1100 1000 1000 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "188 288 112 595 331 414\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "837 544 703 808 549 694\n",... | 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.\n\nYou have to remove at most one (i.e. zero or one) character of this string in such a way that the string you obtain will be lexicographically smallest a... | [{"type": "stdin_stdout", "input": "26\nlolthisiscoolfreehackforya\n", "output": "llthisiscoolfreehackforya\n"}, {"type": "stdin_stdout", "input": "26\nlolthisiscoolfrfehackforya\n", "output": "llthisiscoolfrfehackforya\n"}, {"type": "stdin_stdout", "input": "26\nayrofkcahefrfloocsisihtlol\n", "output": "arofkcahefrflo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGennady owns a small hotel in the countryside where he lives a peaceful life. He loves to take long walks, watch sunsets and play cards with tourists staying in his hotel. His favorite game is called \"Mau-Mau\".\n\nTo pl... | [{"type": "stdin_stdout", "input": "AS\n2H 4C TH JH AD\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4D\nAS AC AD AH 5H\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "KH\n3C QD 9S KS 8D\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "2S\n2D 3D 4D 5D 6D\n", "output": "YES\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTanya has n candies numbered from 1 to n. The i-th candy has the weight a_i.\n\nShe plans to eat exactly n-1 candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactl... | [{"type": "stdin_stdout", "input": "105\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 5 5 5 6\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "105\n5 5 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe guessed some integer number x. You are given a list of almost all its divisors. Almost all means that there are all divisors except 1 and x in the list.\n\nYour task is to find the minimum possible integer x that can b... | [{"type": "stdin_stdout", "input": "25\n2\n999389 999917\n2\n999307 999613\n2\n999529 999611\n2\n999221 999853\n2\n999683 999433\n2\n999907 999749\n2\n999653 999499\n2\n999769 999931\n2\n999809 999287\n2\n999233 999239\n2\n999553 999599\n2\n999371 999763\n2\n999491 999623\n2\n999961 999773\n2\n999671 999269\n2\n999883 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a uppercase Latin letters 'A' and b letters 'B'.\n\nThe period of the string is the smallest such positive integer k that s_i = s_{i~mod~k} (0-indexed) for each i. Note that this implies that k won't always ... | [{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "1999936805\n"}, {"type": "stdin_stdout", "input": "956817411 1000000000\n", "output": "1956733985\n"}, {"type": "stdin_stdout", "input": "839933539 1000000000\n", "output": "1839852485\n"}, {"type": "stdin_stdout", "input": "1000000000 956817411\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\... | [{"type": "stdin_stdout", "input": "485 9554485\n7759121368632736852539182753173468028218114958118158732302477551670775608015153610483175626465946144780731573954182900412248382710280376491925985206156109890139333293746203940442347501294009600230166311978044218247083102712257326301109220002496805123344816427514286225153... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n chips arranged in a circle, numbered from 1 to n. \n\nInitially each chip has black or white color. Then k iterations occur. During each iteration the chips change their colors according to the following rules... | [{"type": "stdin_stdout", "input": "101 2\nBWBWBWBWWWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBBWWBWBWBBBWBWBBBBBWBWWWBWWWBWWWBWBWBWWWBWBWB\n", "output": "BBBWBWWWWWWWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBBBBWWWWBBBBBBBBBBBBBBWWWWWWWWWWWWWWBWWWWWWWBBB\n"}, {"type": "stdin_stdout", "input": "101 2\nBWBWBWWWBWB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKuroni has n daughters. As gifts for them, he bought n necklaces and n bracelets:\n\n * the i-th necklace has a brightness a_i, where all the a_i are pairwise distinct (i.e. all a_i are different), \n * the i-th bracele... | [{"type": "stdin_stdout", "input": "2\n3\n1 9 16\n18 6 1\n3\n1 12 4\n6 2 15\n", "output": "1 9 16\n1 6 18\n1 4 12\n2 6 15\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 6 16\n18 6 1\n3\n1 12 4\n6 2 15\n", "output": "1 6 16\n1 6 18\n1 4 12\n2 6 15\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 6 16\n18 6 1\n3\n1 12 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDrazil likes heap very much. So he created a problem with heap:\n\nThere is a max heap with a height h implemented on the array. The details of this heap are the following:\n\nThis heap contains exactly 2^h - 1 distinct p... | [{"type": "stdin_stdout", "input": "2\n3 1\n14 6 3 5 4 2 1\n3 2\n7 4 5 1 3 2 1\n", "output": "1\n1 1 1 1 1 1\n4\n1 1 1 1\n"}, {"type": "stdin_stdout", "input": "2\n3 1\n14 6 3 5 4 2 1\n3 2\n7 6 5 1 3 2 1\n", "output": "1\n1 1 1 1 1 1\n4\n1 1 1 1\n"}, {"type": "stdin_stdout", "input": "2\n3 1\n14 6 3 5 4 2 1\n3 2\n9 6 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya very much likes gifts. Recently he has received a new laptop as a New Year gift from his mother. He immediately decided to give it to somebody else as what can be more pleasant than giving somebody gifts. And... | [{"type": "stdin_stdout", "input": "100\n42 23 48 88 36 6 18 70 96 1 34 40 46 22 39 55 85 93 45 67 71 75 59 9 21 3 86 63 65 68 20 38 73 31 84 90 50 51 56 95 72 33 49 19 83 76 54 74 100 30 17 98 15 94 4 97 5 99 81 27 92 32 89 12 13 91 87 29 60 11 52 43 35 58 10 25 16 80 28 2 44 61 8 82 66 69 41 24 57 62 78 37 79 77 53 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLord Omkar has permitted you to enter the Holy Church of Omkar! To test your worthiness, Omkar gives you a password which you must interpret!\n\nA password is an array a of n positive integers. You apply the following ope... | [{"type": "stdin_stdout", "input": "80\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\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\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\nYou are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to n, b_i = a_i β x (β denotes... | [{"type": "stdin_stdout", "input": "100\n74 88 64 8 9 27 63 64 79 97 92 38 26 1 4 4 2 64 53 62 24 82 76 40 48 58 40 59 3 56 35 37 0 30 93 71 14 97 49 37 96 59 56 55 70 88 77 99 51 55 71 25 10 31 26 50 61 18 35 55 49 33 86 25 65 74 89 99 5 27 2 9 67 29 76 68 66 22 68 59 63 16 62 25 35 57 63 35 41 68 86 22 91 67 61 3 92 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book on the bookshelf.\n\nIn one... | [{"type": "stdin_stdout", "input": "5\n7\n0 0 1 0 1 0 1\n3\n1 0 0\n5\n1 1 0 0 1\n6\n1 0 0 0 0 1\n5\n1 1 0 1 1\n", "output": "2\n0\n2\n4\n1\n"}, {"type": "stdin_stdout", "input": "5\n7\n0 0 1 0 1 0 1\n3\n1 0 0\n5\n1 1 0 1 1\n6\n1 0 0 0 0 1\n5\n1 1 0 1 1\n", "output": "2\n0\n1\n4\n1\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two positive integer sequences a_1, β¦, a_n and b_1, β¦, b_m. For each j = 1, β¦, m find the greatest common divisor of a_1 + b_j, β¦, a_n + b_j.\n\nInput\n\nThe first line contains two integers n and m (1 β€ n, ... | [{"type": "stdin_stdout", "input": "4 4\n1 25 121 169\n1 2 7 23\n", "output": "\n2 3 8 24\n"}, {"type": "stdin_stdout", "input": "4 4\n1 25 121 169\n1 1 7 23\n", "output": "2 2 8 24\n"}, {"type": "stdin_stdout", "input": "4 4\n1 25 121 169\n1 2 9 23\n", "output": "2 3 2 24\n"}, {"type": "stdin_stdout", "input": "4 4\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou were dreaming that you are traveling to a planet named Planetforces on your personal spaceship. Unfortunately, its piloting system was corrupted and now you need to fix it in order to reach Planetforces.\n\n<image>\n\... | [{"type": "stdin_stdout", "input": "6\n10 5\nRRRRRRRRRRUUUUU\n1 -1\nUDDDRLLL\n-3 -5\nLDLDLDDDR\n-1 2\nUULLLL\n6 -2\nRDULRLLDR\n-1 6\nRUDURUUUUR\n", "output": "YES\nYES\nYES\nYES\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "6\n10 5\nRRRRRRRRRRUUUUU\n1 1\nUDDDRLLL\n-3 -5\nLDLDLDDDR\n1 2\nLLLLUU\n3 -2\nRDULRLLDR\n-1 6\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSeiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations.\n\nA permutation a_1, a_2... | [{"type": "stdin_stdout", "input": "1\n264 695448956957126051\n", "output": "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.\n\nThe Berland capital's map is represented by an n Γ m rectangular table. Each cell of the table on the map repre... | [{"type": "stdin_stdout", "input": "99 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\nLittle Elephant loves Furik and Rubik, who he met in a small city Kremenchug.\n\nThe Little Elephant has two strings of equal length a and b, consisting only of uppercase English letters. The Little Elephant selects a pai... | [{"type": "stdin_stdout", "input": "147\nRJZCSVHLQANGDWUFVZEDLQBSCXBQVAHUKLQAULNYGEUADUECVWMQUTNQPEFRFYZHWQCOUDSFZMPYVXQMIYOGWCFVAJDBUHDXOPZCAZULLYLSJZITCSUQNCLNKUCVATCSJNHUWSBTUSZSMKNYRKS\nCZHMNCRNBKTJPDSEAZQRDEHZGWNLIHPPSMTANDLITUDTOGTLQGLXFJNXWTAPJRSYSBYJPKKBIQBSRQIGQTHDXZQFWHDVROCVFMMLNLEVSJJXQDUTTWGDLZHKJTPDIZASVX... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGoa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his ... | [{"type": "stdin_stdout", "input": "8 10\n1 2 3\n2 8 3\n1 4 1\n4 3 6\n3 7 7\n4 5 5\n5 7 2\n7 8 1\n1 6 8\n6 8 7\n0\n4 1 2 3 4\n0\n0\n0\n0\n0\n0\n", "output": " 8"}, {"type": "stdin_stdout", "input": "7 6\n1 2 1\n1 3 2\n2 4 3\n2 5 4\n3 5 6\n3 6 7\n0\n3 1 2 3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations:\n\n * d1 is the distance between the 1-st and the 2-nd station;\n * d2 is the distance between the 2... | [{"type": "stdin_stdout", "input": "100\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 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Olympic Games in Bercouver are in full swing now. Here everyone has their own objectives: sportsmen compete for medals, and sport commentators compete for more convenient positions to give a running commentary. Today ... | [{"type": "stdin_stdout", "input": "614 163 13\n613 -1796 18\n-749 679 12\n", "output": "-481.72161 -447.61301\n"}, {"type": "stdin_stdout", "input": "614 163 21\n613 -468 18\n-749 679 25\n", "output": "-214.30328 -350.95260\n"}, {"type": "stdin_stdout", "input": "614 163 13\n613 -1029 18\n-749 679 25\n", "output": "10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland is going through tough times β the dirt price has dropped and that is a blow to the country's economy. Everybody knows that Berland is the top world dirt exporter!\n\nThe President of Berland was forced to leave o... | [{"type": "stdin_stdout", "input": "100\n-683 303 245 -975 345 -159 529 -752 -349 -318 -275 -62 -449 -601 -687 691 491 -261 -576 425 -468 -235 446 536 143 152 -402 -491 363 -842 676 360 -461 -170 727 53 10 823 665 716 110 450 -154 -265 -926 636 -577 99 -719 -786 373 -286 994 -756 644 -800 220 -771 860 610 -613 -51 -398... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChubby Yang is studying linear equations right now. He came up with a nice problem. In the problem you are given an n Γ n matrix W, consisting of integers, and you should find two n Γ n matrices A and B, all the following... | [{"type": "stdin_stdout", "input": "8\n62 567 1749 1279 728 1267 1262 568\n77 827 717 1696 774 248 822 1266\n563 612 995 424 1643 68 338 1243\n1579 806 1254 468 184 2254 716 772\n1087 182 2051 772 605 1674 720 1349\n871 988 873 157 403 301 1519 1192\n1085 625 1395 1087 847 1360 679 594\n1278 1056 916 1313 472 840 53 12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginnin... | [{"type": "stdin_stdout", "input": "{a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order. Swaps are performed consec... | [{"type": "stdin_stdout", "input": "5\n1000000000 -1145904 0 5099626 9980471\n", "output": "4\n0 1\n1 2\n2 3\n3 4\n"}, {"type": "stdin_stdout", "input": "5\n1000000000 -1867820 0 5099626 9980471\n", "output": "4\n0 1\n1 2\n2 3\n3 4\n"}, {"type": "stdin_stdout", "input": "5\n1000000000 -1867820 0 7760746 9980471\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA large banner with word CODEFORCES was ordered for the 1000-th onsite round of CodeforcesΟ that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody e... | [{"type": "stdin_stdout", "input": "CODEFOGSIUZMZCMWAVQHNYFEKIEZQMAZOVEMDRMOEDBHAXPLBLDYYXCVTOOSJZVSQAKFXTBTZFWAYRZEMDEMVDJTDRXXAQBURCES\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "CODEFOGSIUZMZCMWAVQHNYFEKIEZQMAZOVEMDRMOEDBHAXPLBLDYYXCVTOOSJZVSQAKFXTBTZFWBYRZEMDEMVDJTDRXXAQBURCES\n", "output": "YES\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConnected undirected weighted graph without self-loops and multiple edges is given. Graph contains n vertices and m edges.\n\nFor each edge (u, v) find the minimal possible weight of the spanning tree that contains the ed... | [{"type": "stdin_stdout", "input": "4 6\n1 2 999999001\n1 3 999999003\n1 4 999999009\n2 3 999999027\n2 4 999999243\n3 4 999999729\n", "output": "2999997013\n2999997013\n2999997013\n2999997037\n2999997247\n2999997733\n"}, {"type": "stdin_stdout", "input": "7 14\n2 4 25\n6 4 5\n5 6 3\n5 7 9\n6 1 17\n4 7 6\n5 4 25\n1 2 23... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter a probationary period in the game development company of IT City Petya was included in a group of the programmers that develops a new turn-based strategy game resembling the well known \"Heroes of Might & Magic\". A... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "3000000003000000001\n"}, {"type": "stdin_stdout", "input": "1147564610\n", "output": "3950713605816050131\n"}, {"type": "stdin_stdout", "input": "1000010000\n", "output": "3000060003300030001\n"}, {"type": "stdin_stdout", "input": "1065935402\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak and Radewoosh are going to compete against each other in the upcoming algorithmic contest. They are equally skilled but they won't solve problems in the same order.\n\nThere will be n problems. The i-th problem has ... | [{"type": "stdin_stdout", "input": "50 1\n6 17 44 82 94 127 134 156 187 211 212 252 256 292 294 303 352 355 379 380 398 409 424 434 480 524 584 594 631 714 745 756 777 778 789 793 799 821 841 849 859 878 879 895 925 932 944 952 958 990\n15 16 40 42 45 71 143 100 117 120 174 181 186 318 221 268 289 332 376 394 403 409 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem. In the output section below you will see the information about flushing the output.\n\nBear Limak thinks of some hidden number β an integer from interval [2, 100]. Your task is to say if th... | [{"type": "stdin_stdout", "input": "no\nyes\nno\nno\nno\n", "output": "2\n3\n5\n7\n11\n13\n17\n19\n23\n29\n31\n37\n41\n43\n47\n4\n9\n25\n49\nprime\n"}, {"type": "stdin_stdout", "input": "no\nyes\nno\nnn\nno\n", "output": "2\n3\n5\n7\n11\n13\n17\n19\n23\n29\n31\n37\n41\n43\n47\n4\n9\n25\n49\nprime\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Mishka is a great traveller and she visited many countries. After thinking about where to travel this time, she chose XXX β beautiful, but little-known northern country.\n\nHere are some interesting facts about XXX... | [{"type": "stdin_stdout", "input": "76 24\n6814 3834 1131 6256 2598 850 7353 1702 5773 1699 35 5103 1368 2258 7891 7455 8546 7316 7428 8864 6536 5750 8455 2624 7326 2197 8239 3806 3016 7126 85 3249 1138 6783 9684 4417 7417 3660 6334 7324 9760 9755 7605 9891 3676 8784 8739 8266 3272 9250 5875 939 4130 6540 7813 6867 914... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA new airplane SuperPuperJet has an infinite number of rows, numbered with positive integers starting with 1 from cockpit to tail. There are six seats in each row, denoted with letters from 'a' to 'f'. Seats 'a', 'b' and ... | [{"type": "stdin_stdout", "input": "1000000100000000000a\n", "output": "4000000399999999995\n"}, {"type": "stdin_stdout", "input": "1000000000000000100e\n", "output": "4000000000000000393\n"}, {"type": "stdin_stdout", "input": "1000001000000000100e\n", "output": "4000004000000000393\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe process of mammoth's genome decoding in Berland comes to its end!\n\nOne 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 ... | [{"type": "stdin_stdout", "input": "252\n???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????C????????????????????????????????????????????????????????????????\n", "output": "AAAAAAAAAAA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given N points on a plane. Write a program which will find the sum of squares of distances between all pairs of points.\n\nInput\n\nThe first line of input contains one integer number N (1 β€ N β€ 100 000) β the num... | [{"type": "stdin_stdout", "input": "30\n-7 -23\n-2 5\n13 8\n12 17\n15 -18\n20 6\n21 8\n-13 12\n-4 -20\n-11 -16\n-6 16\n1 -1\n5 -12\n13 -17\n11 10\n8 -9\n-13 3\n19 -13\n-19 -8\n-14 10\n10 3\n-16 -8\n-17 16\n-14 -15\n5 1\n-13 -14\n13 17\n-12 -8\n2 1\n18 5\n", "output": "279169\n"}, {"type": "stdin_stdout", "input": "30\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn the way to school, Karen became fixated on the puzzle game on her phone!\n\n<image>\n\nThe game is played as follows. In each level, you have a grid with n rows and m columns. Each cell originally contains the number 0... | [{"type": "stdin_stdout", "input": "1 100\n396 314 350 362 287 349 266 289 297 305 235 226 256 385 302 304 253 192 298 238 360 366 163 340 247 395 318 260 252 281 178 188 252 379 212 187 354 232 225 159 290 335 387 234 383 215 356 182 323 280 195 209 263 215 322 262 334 157 189 214 195 386 220 209 177 193 368 174 270 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLeha like all kinds of strange things. Recently he liked the function F(n, k). Consider all possible k-element subsets of the set [1, 2, ..., n]. For subset find minimal element in it. F(n, k) β mathematical expectation o... | [{"type": "stdin_stdout", "input": "7\n-1 -1 2 7 28 3 -1\n1 0 6 3 1 0 -1\n", "output": "2 7 -1 -1 -1 3 28\n"}, {"type": "stdin_stdout", "input": "7\n-1 1 4 16 15 3 -1\n2 0 4 3 2 2 2\n", "output": "15 16 -1 -1 4 3 1\n"}, {"type": "stdin_stdout", "input": "7\n-1 1 4 16 15 3 -1\n2 0 4 3 1 2 2\n", "output": "4 16 -1 -1 15 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTop-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills.\n\nHer problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove ... | [{"type": "stdin_stdout", "input": "1111111111101111111111111111111111111011111111111111111111111101111011111101111111111101111111111111\n", "output": "yes\n"}, {"type": "stdin_stdout", "input": "0110111111111111111111011111111110110111110111111111111111111111111111111111111110111111111111111111\n", "output": "yes\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA group of university students wants to get to the top of a mountain to have a picnic there. For that they decided to use a cableway.\n\nA cableway is represented by some cablecars, hanged onto some cable stations by a ca... | [{"type": "stdin_stdout", "input": "100 100 100\n", "output": "179"}, {"type": "stdin_stdout", "input": "100 0 100\n", "output": "179"}, {"type": "stdin_stdout", "input": "100 100 0\n", "output": "178"}, {"type": "stdin_stdout", "input": "0 100 100\n", "output": "179"}, {"type": "stdin_stdout", "input": "45 52 14\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence number 1 is situated n... | [{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere 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 th... | [{"type": "stdin_stdout", "input": "6 6\n1 1 3 2 2 2\n1 0 0 1 0 0\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "6 6\n6 2 6 2 3 4\n0 1 0 0 0 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "6 6\n6 2 6 2 3 4\n0 1 0 1 0 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "6 6\n4 3 5 4 5 2\n0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are going to the beach with the idea to build the greatest sand castle ever in your head! The beach is not as three-dimensional as you could have imagined, it can be decribed as a line of spots to pile up sand pillars... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "1414213562\n"}, {"type": "stdin_stdout", "input": "999999997351043581 1000000000000000000\n", "output": "1414213561\n"}, {"type": "stdin_stdout", "input": "1036191544337895 1000000000000000000\n", "output": "45523434\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAbhinav and Manav both being one of the best coders of SVNIT went onto participate in ACM ICPC Regional Contest. Apparently Manavβs team the 3Horsemen stood ahead of Abhinavβs team akatsuki11 in the contest though both so... | [{"type": "stdin_stdout", "input": "3\n-2 20\n-4 12\n1 -1\n\nDASPMK", "output": "1580\n1044\n8\n"}, {"type": "stdin_stdout", "input": "3\n-1 20\n-4 8\n2 -1\n\nDASPMK", "output": "1580\n20\n14\n"}, {"type": "stdin_stdout", "input": "3\n-1 20\n-4 8\n1 -1\n\nDASPKM", "output": "1580\n20\n8\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe hero of this story is a toddler named BooBoo. Inspired by the legendary competitive coder Gena, BooBoo has also started preparing to race to the top of the ranks.\n\nBooBoo is going to practice N different problems in... | [{"type": "stdin_stdout", "input": "680 478\n27436 32744 23403 9394 31389 21512 9460 3738 8344 4419 20737 2938 8741 12881 20986 23654 13084 30328 6555 23930 27450 21075 22183 7357 4469 24019 15067 22603 12685 25475 23841 10164 12260 29968 3079 21663 20367 10504 9327 9907 24237 26082 16520 9911 31991 24127 21245 7415 12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three numbers. Is there a way to replace variables A, B and C with these numbers so the equality Aβ+βBβ=βC is correct?\n\nInput:\n\nThere are three numbers X1, X2 and X3 (1ββ€βXiββ€β10^100), each on a separate... | [{"type": "stdin_stdout", "input": "200000000000000000000000000000000000000000000000000000000000000000000000000000\n100000000000000000000000000000000000000000000000000000000000000000000000000000\n300000000000000000000000000000000000000000000000000000000000000000000000000000", "output": "YES\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSee Russian Translation\n\nAfter a long term relationship, Anandi and Jagdish decided to marry. Anandi being a studious girl decided to complete her studies first. What next, she comes to ABC Public School. Her classes ha... | [{"type": "stdin_stdout", "input": "1000\n95826533\n697966550\n727500248\n362956232\n865442540\n84081600\n851909520\n1233464854\n702072000\n659689540\n76854625\n182999070\n217414176\n425562800\n851385832\n809399625\n451207330\n552961750\n798208049\n907783680\n302185500\n147137087\n30605240\n944894200\n847649260\n720255... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRhezo is the new manager of Specialist Cinema Hall. A new movie is being released this Friday and Rhezo wants people in the hall to be seated according to some rules. His rules are weird and he likes that no 2 people in a... | [{"type": "stdin_stdout", "input": "500 10\n500", "output": "616800443"}, {"type": "stdin_stdout", "input": "500 10\n393", "output": "616800443"}, {"type": "stdin_stdout", "input": "500 10\n437", "output": "616800443"}, {"type": "stdin_stdout", "input": "500 10\n495", "output": "616800443"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rectangular grid with n rows and m columns. The rows are numbered 1 to n, from bottom to top, and the columns are numbered 1 to m, from left to right. \n\nYou are also given k special fields in the form ... | [{"type": "stdin_stdout", "input": "11 15 0\n2 1\n5 2\n\nTAMQME", "output": "961249\n"}, {"type": "stdin_stdout", "input": "11 8 0\n2 1\n5 2\n\nTAMQME", "output": "19448\n"}, {"type": "stdin_stdout", "input": "3 3 2\n2 2\n3 2\n\nSAMPLE", "output": "1 3 2\n"}, {"type": "stdin_stdout", "input": "3 3 2\n2 2\n3 2\n\nSAMOLE... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.\n\nDetermine whether N is a multiple of 9.\n\nConstraints\n\n* 0 \\leq N < 10^{200000}\n* N is an... | [{"type": "stdin_stdout", "input": "43165772851244846603292934806287404438359408161025207810958396401279994362320741051019", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "54657569343041921475636299350747138782938284453807770660744571129118363583648327949663", "output": "No\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n* 1 \\leq... | [{"type": "stdin_stdout", "input": "223214 200001", "output": "534704743\n"}, {"type": "stdin_stdout", "input": "402106 200001", "output": "533363909\n"}, {"type": "stdin_stdout", "input": "141421 60408", "output": "832536804\n"}, {"type": "stdin_stdout", "input": "107814 81103", "output": "472847449\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th tes... | [{"type": "stdin_stdout", "input": "3\n2\n2 1\n3 -1\n2\n3 1\n2 -1\n2\n1 1\n2 0", "output": "0\n"}, {"type": "stdin_stdout", "input": "3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "3\n2\n2 0\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 -1", "output": "1\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet us define the oddness of a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n} as \\sum_{i = 1}^n |i - p_i|.\n\nFind the number of permutations of {1,\\ 2,\\ ...,\\ n} of oddness k, modulo 10^9+7.\n\nCo... | [{"type": "stdin_stdout", "input": "47 22", "output": "733787098\n"}, {"type": "stdin_stdout", "input": "39 16", "output": "497121432\n"}, {"type": "stdin_stdout", "input": "44 16", "output": "171958174\n"}, {"type": "stdin_stdout", "input": "44 26", "output": "218927913\n"}, {"type": "stdin_stdout", "input": "20 26", ... | 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.\n\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... | [{"type": "stdin_stdout", "input": "3\n100000010 JPY\n101.54312519525404 BTC\n0.7484698184790549 BTC", "output": "138870816.105\n"}, {"type": "stdin_stdout", "input": "3\n100000010 JPY\n100.90596986559768 BTC\n0.7484698184790549 BTC", "output": "138628697.08\n"}, {"type": "stdin_stdout", "input": "3\n100000010 JPY\n102... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer N.\n\nConstruct any one N-by-N matrix a that satisfies the conditions below. It can be proved that a solution always exists under the constraints of this problem.\n\n* 1 \\leq a_{i,j} \\leq 10^{15... | [{"type": "stdin_stdout", "input": "96", "output": "19167 611331466 31895 1422867846 44611 3124420608 70037 5791569642 82693 8939361380 108103 13048788822 120707 17609823524 145889 26810459198 183773 36056078828 196199 45900952250 233951 60592607148 258997 70284792882 271373 80366299832 296147 98867787510 333847 123834... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three integers, A, B and C.\nAmong them, two are the same, but the remaining one is different from the rest.\nFor example, when A=5,B=7,C=5, A and C are the same, but B is different.\nFind the one that is di... | [{"type": "stdin_stdout", "input": "-123 100 100", "output": "-123\n"}, {"type": "stdin_stdout", "input": "-157 100 100", "output": "-157\n"}, {"type": "stdin_stdout", "input": "-100 100 100", "output": "-100"}, {"type": "stdin_stdout", "input": "-25 100 100", "output": "-25\n"}, {"type": "stdin_stdout", "input": "-19 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi loves sorting.\n\nHe has a permutation (p_1,p_2,...,p_N) of the integers from 1 through N. Now, he will repeat the following operation until the permutation becomes (1,2,...,N):\n\n* First, we will define high a... | [{"type": "stdin_stdout", "input": "10\n2 10 5 7 2 8 4 9 16 1", "output": "7\n"}, {"type": "stdin_stdout", "input": "10\n4 10 5 7 2 -1 4 9 8 1", "output": "8\n"}, {"type": "stdin_stdout", "input": "10\n2 10 5 2 3 6 4 9 8 1", "output": "6\n"}, {"type": "stdin_stdout", "input": "10\n2 10 5 7 2 6 4 9 8 1", "output": "8\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is drawing a segment on grid paper.\n\nFrom a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).\n\nWhen Takahashi draws a segment connecting the lower left... | [{"type": "stdin_stdout", "input": "124 -2 -1 -1", "output": "125\n"}, {"type": "stdin_stdout", "input": "241 -2 -1 -1", "output": "242\n"}, {"type": "stdin_stdout", "input": "121 -1 -1 0", "output": "122\n"}, {"type": "stdin_stdout", "input": "116 1 -2 -1", "output": "118\n"}, {"type": "stdin_stdout", "input": "209 -1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke is having another barbeque party.\n\nThis time, he will make one serving of Skewer Meal.\n\nHe has a stock of N Skewer Meal Packs. The i-th Skewer Meal Pack contains one skewer, A_i pieces of beef and B_i pieces of ... | [{"type": "stdin_stdout", "input": "3\n11 3\n2 2\n0 2", "output": "12951\n"}, {"type": "stdin_stdout", "input": "3\n12 2\n2 3\n2 0", "output": "11783\n"}, {"type": "stdin_stdout", "input": "3\n12 2\n2 3\n1 0", "output": "11753\n"}, {"type": "stdin_stdout", "input": "3\n3 1\n0 4\n7 9", "output": "262332\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is arbitrary. The conductor patr... | [{"type": "stdin_stdout", "input": "4\na->f->c->b->d\nb<-c<-a<-d<-e\nb->a->c<-a->c->d<-c<-a<-b->a->c->d->e<-d\na->e<-a<-d->a->e<-a<-d<-c->d->a<-d<-c<-b->c->d<-c", "output": "afcbd\nedacb\nbacde\nbcdae\n"}, {"type": "stdin_stdout", "input": "4\n`->f->c->b->d\nb<-c<-a<-d<-e\nb->a->c<-a->c->d<-c<-a<-b->a->c->d->e<-d\na->e... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a 32-bit real type with 7 bits from the right as the decimal part, the following 24 bits as the integer part, and the leftmost 1 bit as the sign part as shown below (b1, ..., b32). Represents 0 or 1).\n\n<image>\... | [{"type": "stdin_stdout", "input": "8\n00101110\n66920828\n00000080\n00000040\n000000c0\n00100110\n45306216\n07f00009", "output": "8226.125\n13444112.3125\n1.0\n0.5\n1.5\n8194.125\n9068740.171875\n1040384.0703125\n"}, {"type": "stdin_stdout", "input": "8\n00100100\n45780507\n00000080\n00000040\n0c000000\n00000101\n1533... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nPlay by arranging white and black stones on the table. First, place the stones on the left edge of the table. Then place the stones in the second place from the left. Repeat this n times to arrange n stones in ... | [{"type": "stdin_stdout", "input": "8\n1\n0\n0\n0\n1\n0\n0\n0\n4\n1\n-1\n0\n1\n1\n1\n1\n1\n0", "output": "8\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "8\n1\n1\n0\n1\n0\n0\n0\n1\n4\n1\n0\n0\n1\n1\n0\n1\n1\n0", "output": "0\n0\n1\n0\n"}, {"type": "stdin_stdout", "input": "8\n1\n1\n1\n1\n0\n-1\n0\n1\n3\n1\n0\n1\n1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Dango's family has extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in near future. They al... | [{"type": "stdin_stdout", "input": "3\n1 2 2 3\n0 1 2 2\n1 2 0 3\n7\n1 2 0 1\n0 2 3 1\n0 0 3 1\n2 1 1 2\n5 3 4 2\n4 3 6 0\n4 -1 5 1\n0", "output": "1\n1\n"}, {"type": "stdin_stdout", "input": "3\n1 1 2 3\n0 1 2 2\n1 2 0 3\n7\n1 2 2 1\n0 2 3 2\n0 1 3 -1\n2 1 1 2\n5 3 4 2\n4 3 6 2\n4 2 5 1\n0", "output": "1\n2\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have an analog clock whose three hands (the second hand, the minute hand and the hour hand) rotate quite smoothly. You can measure two angles between the second hand and two other hands.\n\nWrite a program to find the ... | [{"type": "stdin_stdout", "input": "12 0 0 0\n12 11 59 59\n12 1 56 0\n12 1 56 3\n12 1 56 34\n12 3 9 43\n12 3 10 14\n12 2 17 58\n12 7 18 0\n10 7 23 0\n12 7 23 31\n2 0 38 19\n2 0 39 0\n2 0 39 30\n2 1 6 14\n2 1 20 1\n2 1 20 31\n3 2 19 0\n3 2 59 30\n4 0 28 48\n5 1 5 37\n5 1 10 10\n5 1 7 41\n11 0 36 0\n0 0 0 0", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGiven the string S, which consists of lowercase letters and numbers. Follow the steps below to compress the length of string S.\n\n1. Change the order of the characters in the character string to any order.\nEx... | [{"type": "stdin_stdout", "input": "0ig3hd12fz99", "output": "10\n"}, {"type": "stdin_stdout", "input": "0hg3hd12fz99", "output": "11\n"}, {"type": "stdin_stdout", "input": "0hg3hd13fz99", "output": "12\n"}, {"type": "stdin_stdout", "input": "0hf3hd12fz99", "output": "11\n"}, {"type": "stdin_stdout", "input": "99zf21dh... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nACM countries have rivers that flow from east to west in the center. This river flows from the neighboring country in the west through the neighboring country in ACM to the neighboring country in the east, and the total l... | [{"type": "stdin_stdout", "input": "1 1 100\n50 200 20 40 0\n1\n2 4 101\n7 4 2 4 1\n19 5 1 4 0\n5\n3\n10\n1\n1 2 3\n2 1 1 1 0\n1\n3\n1 2 6\n5 16 1 1 1\n2\n3\n0 0 0", "output": "110.0000000000\n111.1500000000\n5.3333333333\n64.3333333333\n"}, {"type": "stdin_stdout", "input": "1 1 110\n50 200 20 40 0\n1\n2 4 101\n7 4 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nDimension exists from $ 1 $ dimension to $ N $ dimension. AOR Ika can move between dimensions. Specifically, when AOR Ika is in the $ i $ dimension, she can move freely to the $ j $ dimension ($ i> j $), but in... | [{"type": "stdin_stdout", "input": "3 1 2 3\n0 -1 10\n1 3", "output": "10\n"}, {"type": "stdin_stdout", "input": "3 1 2 3\n1 0 11\n2 3", "output": "11\n"}, {"type": "stdin_stdout", "input": "3 1 2 3\n1 0 13\n2 3", "output": "13\n"}, {"type": "stdin_stdout", "input": "3 2 2 3\n0 0 14\n2 3", "output": "14\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA direced graph is strongly connected if every two nodes are reachable from each other. In a strongly connected component of a directed graph, every two nodes of the component are mutually reachable.\n\nConstraints\n\n* 1... | [{"type": "stdin_stdout", "input": "9 6\n1 1\n1 0\n1 4\n2 4\n4 3\n4 2\n4\n1 1\n-1 3\n2 -1\n3 4", "output": "1\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "5 6\n0 1\n1 0\n1 0\n2 4\n4 1\n3 2\n4\n0 1\n-1 0\n2 0\n3 4", "output": "1\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "9 6\n0 1\n1 0\n1 2\n2 4\n4 3\n4 2\n4\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.\n\nStrictly speaking, it makes a photo of a... | [{"type": "stdin_stdout", "input": "2\n240945287 28477772 1496174734 106174079\n", "output": "97526692469552229\n"}, {"type": "stdin_stdout", "input": "2\n240945287 28477772 1496174734 174902664\n", "output": "96930557139611326\n"}, {"type": "stdin_stdout", "input": "2\n240945287 45763153 1496174734 174902664\n", "outp... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.