name stringlengths 2 112 | description stringlengths 29 13k | private_tests dict | public_tests dict | generated_tests dict |
|---|---|---|---|---|
p03241 AtCoder Beginner Contest 112 - Partition | You are given integers N and M.
Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.
Constraints
* All values in input are integers.
* 1 \leq N \leq 10^5
* N \leq M \leq 10^9
Input... | {
"input": [],
"output": []
} | {
"input": [
"10 123",
"3 14",
"100000 1000000000"
],
"output": [
"3",
"2",
"10000"
]
} | {
"input": [
"5 123",
"100000 1010000000",
"110000 1010000000",
"100100 1010000000",
"5 16",
"100100 1010010001",
"101100 1010110000",
"101100 1000110000",
"101000 1000110010",
"101000 1100110010",
"101000 1100110011",
"101001 1110110011",
"010100 1110110010",
"... |
p03394 AtCoder Grand Contest 022 - GCD Sequence | Nagase is a top student in high school. One day, she's analyzing some properties of special sets of positive integers.
She thinks that a set S = \\{a_{1}, a_{2}, ..., a_{N}\\} of distinct positive integers is called special if for all 1 \leq i \leq N, the gcd (greatest common divisor) of a_{i} and the sum of the remai... | {
"input": [],
"output": []
} | {
"input": [
"3",
"4"
],
"output": [
"2 5 63",
"2 5 20 63"
]
} | {
"input": [],
"output": []
} |
p03558 AtCoder Beginner Contest 077 - Small Multiple | Find the smallest possible sum of the digits in the decimal notation of a positive multiple of K.
Constraints
* 2 \leq K \leq 10^5
* K is an integer.
Input
Input is given from Standard Input in the following format:
K
Output
Print the smallest possible sum of the digits in the decimal notation of a positive mu... | {
"input": [],
"output": []
} | {
"input": [
"41",
"6",
"79992"
],
"output": [
"5",
"3",
"36"
]
} | {
"input": [
"40",
"37450",
"70620",
"9",
"14",
"11849",
"48730",
"198",
"478",
"10989",
"10",
"78",
"8",
"155",
"45794",
"100",
"101",
"25",
"31",
"47",
"20",
"17",
"21",
"4",
"24",
"15",
"65",
"34375",
... |
p03712 AtCoder Beginner Contest 062 - Picture Frame | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}.
Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1.
... | {
"input": [],
"output": []
} | {
"input": [
"2 3\nabc\narc",
"1 1\nz"
],
"output": [
"#####\n#abc#\n#arc#\n#####",
"z#"
]
} | {
"input": [
"2 3\nabc\nbrc",
"1 1\ny",
"2 3\nabc\nbqc",
"0 1\ny",
"2 1\nabc\nbrc",
"1 1\nx",
"1 2\nz",
"0 2\nz",
"-2 0\nz",
"-2 -1\nz",
"1 -1\nz",
"1 0\nz",
"-20 3\nx",
"-20 5\nx",
"-20 6\nx",
"1 0\nv",
"2 3\nabc\naqc",
"2 3\nabd\nbqc",
"2 2... |
p03871 CODE FESTIVAL 2016 Grand Final - Dice Game | There are two (6-sided) dice: a red die and a blue die. When a red die is rolled, it shows i with probability p_i percents, and when a blue die is rolled, it shows j with probability q_j percents.
Petr and tourist are playing the following game. Both players know the probabilistic distributions of the two dice. First,... | {
"input": [],
"output": []
} | {
"input": [
"10 20 20 10 20 20\n20 20 20 10 10 20",
"25 25 25 25 0 0\n0 0 0 0 50 50"
],
"output": [
"0.550000000000",
"1.000000000000"
]
} | {
"input": [
"4 20 20 10 20 20\n20 20 20 10 10 20",
"25 25 25 25 0 1\n0 0 0 0 50 50",
"25 25 25 18 -1 0\n0 0 0 0 50 50",
"25 25 25 18 -1 1\n0 0 0 0 50 50",
"25 25 25 16 -1 1\n0 0 0 0 50 50",
"30 25 25 16 -1 1\n0 0 0 0 50 50",
"30 8 25 16 -1 1\n0 0 0 0 50 50",
"30 8 33 16 -1 1\n0 0 0 0 ... |
p04034 AtCoder Grand Contest 002 - Box and Ball | We have N boxes, numbered 1 through N. At first, box 1 contains one red ball, and each of the other boxes contains one white ball.
Snuke will perform the following M operations, one by one. In the i-th operation, he randomly picks one ball from box x_i, then he puts it into box y_i.
Find the number of boxes that may ... | {
"input": [],
"output": []
} | {
"input": [
"3 2\n1 2\n2 3",
"4 4\n1 2\n2 3\n4 1\n3 4",
"3 3\n1 2\n2 3\n2 3"
],
"output": [
"2",
"3",
"1"
]
} | {
"input": [
"6 2\n1 2\n2 3",
"4 4\n1 2\n2 3\n4 1\n3 0",
"6 2\n1 0\n2 6",
"6 2\n1 2\n2 6",
"6 2\n2 0\n2 6",
"3 2\n1 0\n2 3",
"4 4\n2 2\n2 3\n4 1\n3 4",
"4 4\n1 2\n2 3\n4 1\n1 0",
"6 2\n1 2\n4 6",
"3 2\n2 0\n2 3",
"6 4\n1 2\n2 3\n4 1\n1 0",
"6 2\n0 2\n4 6",
"6 2\n1 4... |
p00116 Rectangular Searching | There are a total of W x H squares, with H rows vertically and W columns horizontally. Some squares are marked. Create a program that reads the marked state of each square and outputs the maximum rectangular area consisting of only the unmarked squares.
The input data consists of one line of W characters, given H line... | {
"input": [],
"output": []
} | {
"input": [
"10 10\n...*....**\n..........\n**....**..\n........*.\n..*.......\n**........\n.*........\n..........\n....*..***\n.*....*...\n10 10\n..*....*..\n.*.*...*..\n*****..*..\n*...*..*..\n*...*..*..\n..........\n****.*...*\n..*..*...*\n.*...*...*\n****..***.\n2 3\n...\n...\n0 0"
],
"output": [
"28... | {
"input": [
"10 10\n...*....**\n..........\n**....**..\n........*.\n..*.......\n**........\n.*........\n..........\n....*..***\n.*....*...\n10 10\n..*....*..\n.*.*...*..\n*****..*..\n*...*..*..\n*...*..*..\n..........\n.***.*..**\n..*..*...*\n.*...*...*\n****..***.\n2 3\n...\n...\n0 0",
"10 10\n...*....**\n.... |
p00249 Ant Nest | Gaku decided to observe the ant's nest as a free study during the summer vacation. The transparent observation case that his grandpa prepared for his grandchildren is very unique and looks like Figure 1.
Ant nest
Figure 1
This case consists of two congruent convex polygons s1 and s2 and some rectangles. Place one o... | {
"input": [],
"output": []
} | {
"input": [
"4 1 1\n0 0\n1 0\n1 2\n0 2\n0 0 0"
],
"output": [
"1.000000"
]
} | {
"input": [
"4 1 1\n0 0\n1 0\n1 2\n-1 2\n0 0 0",
"4 1 1\n0 -1\n1 0\n1 2\n-1 2\n0 0 0",
"4 1 1\n0 -1\n1 0\n0 2\n-1 2\n0 0 0",
"4 2 1\n0 -1\n1 0\n1 2\n-1 2\n0 0 0",
"4 1 1\n0 0\n1 0\n1 2\n0 4\n0 0 0",
"4 1 1\n0 0\n1 0\n1 2\n-1 1\n0 0 0",
"4 2 1\n0 -1\n1 0\n2 2\n-1 2\n0 0 0",
"4 1 1\n-1 ... |
p00430 Square | There are n sheets of square paper of the same size. Align the bottom of these papers horizontally and arrange them in several rows. However, adjacent rows must be arranged so that the left side is not lower than the right side. For example, n When = 5, the following 7 ways of arranging are possible.
<image>
We wil... | {
"input": [],
"output": []
} | {
"input": [
"5\n5\n0"
],
"output": [
"5\n4 1\n3 2\n3 1 1\n2 2 1\n2 1 1 1\n1 1 1 1 1\n5\n4 1\n3 2\n3 1 1\n2 2 1\n2 1 1 1\n1 1 1 1 1"
]
} | {
"input": [
"5\n8\n0",
"5\n6\n0",
"5\n7\n0",
"5\n4\n0",
"5\n3\n0",
"5\n0\n0",
"5\n9\n0",
"5\n14\n0",
"5\n1\n0",
"5\n2\n0",
"5\n12\n0",
"5\n13\n0",
"5\n10\n0",
"5\n11\n0",
"5\n26\n0",
"5\n16\n0",
"5\n24\n0",
"5\n21\n0",
"5\n20\n0",
"5\n15... |
p00626 Chocolate with Heart Marks | Taro loves chocolate and when he returns from school he eats his favorite chocolate bar with a heart symbol on it. A recent pleasure is to eat all the heart symbol blocks to the end. Taro , Try to eat as many heartless blocks as possible, with all heartmark blocks connected.
<image>
However, Taro is still young, and ... | {
"input": [],
"output": []
} | {
"input": [
"4 4\n1 0 0 0\n0 0 1 0\n0 1 0 0\n1 0 0 1\n1 1\n1\n2 3\n1 0 0\n0 0 1\n0 0"
],
"output": [
"7\n0\n2"
]
} | {
"input": [
"4 4\n1 0 0 0\n0 0 1 0\n0 0 0 0\n1 0 0 1\n1 1\n1\n2 3\n1 0 0\n0 0 1\n0 0",
"4 4\n1 0 -1 1\n0 0 1 0\n0 0 0 0\n1 0 0 1\n1 1\n1\n2 3\n1 0 0\n0 0 1\n0 0",
"4 4\n1 -1 0 0\n0 0 1 0\n0 1 0 0\n0 0 0 1\n1 1\n1\n2 3\n1 0 0\n0 0 1\n0 0",
"4 4\n1 0 -1 0\n0 0 1 0\n0 0 0 0\n1 0 0 1\n1 1\n1\n1 3\n1 0 1\... |
p00770 Prime Caves | Prime Caves
An international expedition discovered abandoned Buddhist cave temples in a giant cliff standing on the middle of a desert. There were many small caves dug into halfway down the vertical cliff, which were aligned on square grids. The archaeologists in the expedition were excited by Buddha's statues in thos... | {
"input": [],
"output": []
} | {
"input": [
"49 22\n46 37\n42 23\n945 561\n1081 681\n1056 452\n1042 862\n973 677\n1000000 1000000\n0 0"
],
"output": [
"0 0\n6 43\n1 23\n20 829\n18 947\n10 947\n13 947\n23 947\n534 993541"
]
} | {
"input": [
"49 22\n46 37\n42 23\n945 561\n1081 681\n1056 512\n1042 862\n973 677\n1000000 1000000\n0 0",
"49 22\n46 27\n42 23\n945 561\n1081 681\n1056 452\n1042 862\n973 677\n1000000 1000000\n0 0",
"49 22\n46 27\n42 23\n945 561\n1081 681\n1056 452\n1042 333\n973 677\n1000000 1000000\n0 0",
"49 22\n46... |
p00901 ASCII Expression | Mathematical expressions appearing in old papers and old technical articles are printed with typewriter in several lines, where a fixed-width or monospaced font is required to print characters (digits, symbols and spaces). Let us consider the following mathematical expression.
<image>
It is printed in the following f... | {
"input": [],
"output": []
} | {
"input": [
"4\n........4...2..........\n(.1.-.----.)..*.-.5.+.6\n........2..............\n.......3...............\n3\n...3.\n-.---\n...4.\n4\n.3.+.4.*.-.2.\n-------------\n..........2..\n...-.1.-.2...\n2\n...2..3\n(.4..).\n1\n2.+.3.*.5.-.7.+.9\n1\n(.2.+.3.).*.(.5.-.7.).+.9\n3\n.2....3.\n4..+.---\n......5.\n3\n.... | {
"input": [
"4\n........4...2..........\n(.1.-.----.)..*.-.5.+.6\n........2..............\n.......3...............\n3\n...3.\n-.---\n...4.\n4\n.3.+.4.*.-.2.\n-------------\n..........2..\n...-.1.-.2...\n2\n...2..3\n(.4..).\n1\n2.+.3.*.5.-.7.+.9\n1\n(.2.+.3.).*.(.5.-.7.).+.9\n3\n.2....3.\n4..+.---\n......5.\n3\n.... |
p01034 Yu-kun Likes a Directed Graph | Background
The kindergarten attached to the University of Aizu is a kindergarten where children who love programming gather. Yu, one of the kindergarten children, loves drawing as much as programming. So far, Yu-kun has drawn many pictures with circles and arrows. The arrows are always drawn to connect the circles. On... | {
"input": [],
"output": []
} | {
"input": [
"7 8 -8\n0 1 5\n0 4 3\n1 2 10\n1 3 1\n3 6 6\n4 3 1\n4 5 2\n4 6 2",
"3 2 -1\n0 1 1\n0 2 5",
"3 2 -3\n0 1 1\n0 2 5",
"5 4 -30\n0 1 1\n1 3 15\n1 4 4\n2 1 3"
],
"output": [
"-1",
"NA",
"-2",
"-12"
]
} | {
"input": [
"7 8 -8\n0 1 5\n0 4 3\n1 2 10\n1 2 1\n3 6 6\n4 3 1\n4 5 2\n4 6 2",
"3 2 -1\n0 1 1\n0 2 9",
"7 4 -8\n0 1 5\n0 4 3\n1 2 10\n1 3 1\n3 6 6\n4 3 1\n4 5 2\n4 6 2",
"3 2 -4\n0 1 1\n0 2 5",
"7 4 -15\n0 1 5\n0 4 3\n1 2 10\n2 3 1\n3 6 6\n4 3 1\n4 8 2\n1 6 2",
"7 2 -8\n0 1 2\n0 4 3\n1 2 10\n... |
p01168 Lying about Your Age | You have moved to a new town. As starting a new life, you have made up your mind to do one thing: lying about your age. Since no person in this town knows your history, you don’t have to worry about immediate exposure. Also, in order to ease your conscience somewhat, you have decided to claim ages that represent your r... | {
"input": [],
"output": []
} | {
"input": [
"23 18 53\n46 30 47\n-1 -1 -1"
],
"output": [
"49\n-1"
]
} | {
"input": [
"23 29 53\n46 30 47\n-1 -1 -1",
"23 18 53\n91 30 47\n-1 -1 -1",
"23 18 97\n91 22 47\n-1 -1 -1",
"23 18 37\n91 30 47\n-1 -1 -1",
"23 29 53\n46 37 47\n-1 -1 -1",
"23 29 53\n46 37 67\n-1 -1 -1",
"23 18 138\n91 22 90\n-1 -1 -1",
"8 13 73\n92 30 60\n-1 -1 -1",
"12 13 28\n15... |
p01304 Heian-Kyo Walking | Heiankyo is known as a town with a grid of roads.
Hokusai, a cat who lives in Heiankyo, has to go from his home to a secret place on the outskirts of town every day for patrol. However, I get tired of following the same path every day, and there is a risk of being followed, so Hokusai wants to use a different route ev... | {
"input": [],
"output": []
} | {
"input": [
"4\n2 2\n0\n1 1\n2\n0 0 0 1\n0 0 1 0\n4 3\n4\n1 0 0 0\n3 3 4 3\n4 1 4 0\n0 2 0 3\n15 15\n0"
],
"output": [
"6\nMiserable Hokusai!\n5\n155117520"
]
} | {
"input": [
"4\n2 2\n0\n1 2\n2\n0 0 0 1\n0 0 1 0\n4 3\n4\n1 0 0 0\n3 3 4 3\n4 1 4 0\n0 2 0 3\n15 15\n0",
"4\n2 2\n0\n1 2\n2\n0 0 0 1\n0 0 1 0\n4 3\n4\n1 0 0 0\n3 3 4 3\n4 0 4 0\n0 2 0 3\n15 3\n0",
"4\n2 2\n0\n0 2\n2\n0 0 0 1\n0 0 1 0\n2 3\n4\n1 0 0 0\n3 3 4 3\n4 0 4 0\n0 2 0 3\n14 3\n0",
"4\n2 3\n0\n... |
p01473 Palindromic Anagram | Problem statement
Given the string $ S $. Find the number of all anagrams in $ S $ that are palindromic.
An anagram of the string $ X $ is an anagram of $ Y $, which means that $ X $ is equal to $ Y $, or that the rearranged characters of $ X $ are equal to $ Y $. For example, for the string abcd, abcd and cbda are a... | {
"input": [],
"output": []
} | {
"input": [
"ab",
"abba"
],
"output": [
"0",
"2"
]
} | {
"input": [
"ac",
"cbcb",
"cc",
"abca",
"bc",
"aaca",
"cb",
"aacb",
"ca",
"bacb",
"bbca",
"bcca",
"accb",
"ccca",
"accc",
"accd",
"acce",
"ecca",
"edca",
"acde",
"`cde",
"`bde",
"`ade",
"`dbe",
"d`be",
"eb`d",
... |
p01633 Hole | Problem Statement
Mr. Hagiwara, a witch, has a very negative personality. When she feels depressed, she uses the magic of digging to make holes and cry and fill them. The magic of digging is as follows.
She first draws N line segments on the ground. And when she casts the spell, a hole is created in the area surround... | {
"input": [],
"output": []
} | {
"input": [
"11\n0 0 10 0\n10 0 10 10\n10 10 0 10\n0 10 0 0\n1 2 9 2\n8 1 8 9\n9 8 1 8\n2 9 2 1\n8 11 11 8\n8 11 14 10\n11 8 10 14",
"8\n5 0 5 10\n5 10 0 5\n0 5 5 0\n10 0 10 10\n10 10 5 5\n5 5 10 0\n10 2 15 5\n15 5 10 8"
],
"output": [
"1",
"2"
]
} | {
"input": [
"11\n0 0 10 0\n10 0 10 10\n10 10 0 10\n0 10 0 0\n1 2 9 2\n8 1 8 9\n9 8 1 8\n2 9 2 1\n8 11 11 8\n8 11 14 10\n18 8 10 14",
"8\n5 0 5 10\n5 10 0 5\n0 5 5 0\n19 0 10 10\n10 10 3 5\n5 5 10 0\n10 2 15 8\n6 5 16 8",
"11\n0 1 10 -2\n10 1 10 10\n10 1 0 10\n0 5 1 1\n2 2 9 0\n9 1 8 9\n9 15 1 8\n2 3 2 1\... |
p01785 Polygon Guards | Example
Input
8
0 2
0 0
2 0
2 1
3 1
3 3
1 3
1 2
Output
1 | {
"input": [],
"output": []
} | {
"input": [
"8\n0 2\n0 0\n2 0\n2 1\n3 1\n3 3\n1 3\n1 2"
],
"output": [
"1"
]
} | {
"input": [
"8\n0 2\n0 0\n2 0\n2 1\n3 1\n3 3\n0 3\n1 2",
"8\n0 2\n0 0\n2 0\n2 1\n3 1\n3 3\n0 3\n1 0",
"8\n-1 2\n0 0\n2 0\n2 1\n3 1\n3 3\n0 3\n1 0",
"8\n0 2\n0 0\n2 0\n2 2\n3 1\n3 3\n0 3\n1 0",
"8\n-1 2\n0 -1\n2 0\n2 1\n3 1\n3 3\n0 3\n1 0",
"8\n0 2\n-1 0\n2 0\n2 2\n3 1\n3 3\n0 3\n1 0",
"8\... |
p01920 Binary Sequence | E: Binary Sequence-Binary Sequence-
story
I love binaries Bonald.Brvin.Bnuth! He is known as Uncle Bnuth, who is studying the nature of binary sequences at Offtunford University! By the way, if my name "Bonald.Brvin.Bnuth" is binarized from ASCII code, it will be "1000010 1101111 1101110 1100001 1101100 1100100 10111... | {
"input": [],
"output": []
} | {
"input": [
"10\n0101100110\n3\n3 3 1\n1 6 0\n2 5 1"
],
"output": [
"2\n1\n2"
]
} | {
"input": [
"10\n0101100110\n1\n3 3 1\n1 6 0\n2 5 1",
"10\n0101100110\n2\n3 3 1\n1 6 0\n2 6 2",
"10\n0101100110\n3\n3 3 0\n1 6 0\n2 5 1",
"10\n0101010110\n2\n3 3 1\n1 6 0\n2 6 2",
"10\n0101000110\n2\n3 3 1\n1 1 0\n4 6 2",
"10\n0101101110\n5\n3 3 0\n1 6 0\n2 5 1",
"10\n0101101110\n5\n3 4 1... |
p02058 Tree | G: Tree
problem
Given a tree consisting of N vertices. Each vertex of the tree is numbered from 1 to N. Of the N-1 edges, the i \ (= 1, 2, ..., N-1) edge connects the vertex u_i and the vertex v_i.
Write a program to find the number of K non-empty subgraph sets of this tree, each of which is concatenated and no two ... | {
"input": [],
"output": []
} | {
"input": [
"3 2\n1 2\n1 3"
],
"output": [
"5"
]
} | {
"input": [
"3 4\n1 2\n1 3",
"3 2\n1 2\n2 3",
"3 2\n2 2\n1 3",
"3 1\n1 2\n2 3",
"3 1\n1 2\n3 3",
"1 2\n1 2\n2 3",
"3 4\n1 2\n2 3",
"1 1\n1 2\n2 3",
"1 1\n2 2\n2 3",
"1 1\n2 3\n2 3",
"1 1\n2 3\n1 3",
"1 2\n2 3\n1 3",
"1 2\n2 3\n1 2",
"1 2\n2 3\n0 2",
"1 2\n1... |
p02200 Today's Random Number | Today's Random Number
E869120 You ran a campaign called "Today's Random Numbers" for N days. This is a project to generate a random number once a day and post the value on Twitter.
The "random numbers of the day" on day $ 1, 2, 3, \ dots, N $ were $ A_1, A_2, A_3, \ dots, A_N $, respectively.
E869120 You would be ha... | {
"input": [],
"output": []
} | {
"input": [
"5\n8 6 9 1 20"
],
"output": [
"2"
]
} | {
"input": [
"5\n8 0 9 1 20",
"5\n10 -2 3 1 0",
"5\n3 -2 1 2 4",
"5\n1 1 0 0 0",
"5\n8 0 11 1 20",
"5\n12 0 11 1 20",
"5\n15 0 11 1 20",
"5\n15 0 21 1 20",
"5\n15 0 21 0 20",
"5\n15 -1 21 0 20",
"5\n15 -1 21 0 22",
"5\n15 -1 3 0 22",
"5\n15 -1 3 1 22",
"5\n15 -1... |
p02354 The Smallest Window I | For a given array $a_1, a_2, a_3, ... , a_N$ of $N$ elements and an integer $S$, find the smallest sub-array size (smallest window length) where the sum of the sub-array is greater than or equal to $S$. If there is not such sub-array, report 0.
Constraints
* $1 \leq N \leq 10^5$
* $1 \leq S \leq 10^9$
* $1 \leq a_i \... | {
"input": [],
"output": []
} | {
"input": [
"6 4\n1 2 1 2 3 2",
"6 6\n1 2 1 2 3 2",
"3 7\n1 2 3"
],
"output": [
"2",
"3",
"0"
]
} | {
"input": [
"6 4\n1 2 0 2 3 2",
"6 6\n1 2 1 2 1 2",
"6 5\n1 2 0 2 2 2",
"6 5\n1 2 0 0 2 2",
"6 5\n1 0 0 0 2 2",
"6 5\n0 0 0 0 2 2",
"6 4\n1 2 1 2 6 2",
"6 5\n1 2 0 2 3 2",
"6 6\n1 1 1 2 1 2",
"6 5\n0 0 0 1 2 2",
"6 6\n1 2 0 2 3 2",
"3 6\n1 2 3",
"6 8\n1 2 0 2 3 2",... |
beatrice | Problem description
Tris (or as her parents call her Beatrice) is going through a series of training and evaluation to get into top 10 and remain in Dauntless Faction. She is currently placed 12th and will become faction-less if she fails, today.
Four (or Tobias) gives Tris a string, consisting of 'i'(s) and 'd'(s) on... | {
"input": [],
"output": []
} | {
"input": [
"1\niidiiii"
],
"output": [
"0 5"
]
} | {
"input": [
"1\niidiiij",
"1\nkiiiidi",
"1\nkhiiiei",
"1\nihikiei",
"1\njiijhei",
"1\njehjiij",
"1\nkfhjiii",
"1\niiijhfk",
"1\nkfhjhii",
"1\nikijhgg",
"1\nkgijhgg",
"1\nfmhekhi",
"1\nhjglmgh",
"1\niidiiik",
"1\nidiiiik",
"1\nkiiiiei",
"1\nieikihi",... |
cn01 | So, you are bored and you think about playing a game. The game is like, if you win your money will be
doubled and eleven dollars extra will be added to it. If you lose, your money will be halved (if the
amount is odd, it will be halved to the upper integer). The inital amount of money you have is 'X'. A
sequence of ... | {
"input": [],
"output": []
} | {
"input": [
"23\nLWLW",
"51\nL"
],
"output": [
"47",
"26"
]
} | {
"input": [],
"output": []
} |
flow017 | Three numbers A, B and C are the inputs. Write a program to find second largest among three numbers.
Input
The first line contains an integer T, total number of testcases. Then follow T lines, each line contains three integers A, B and C.
Output
Display the second largest among A, B and C.
Constraints
1 ≤ T ≤ 100... | {
"input": [],
"output": []
} | {
"input": [
"3 \n120 11 400\n10213 312 10\n10 3 450"
],
"output": [
"120\n312\n10\n"
]
} | {
"input": [
"3 \n120 14 400\n10213 312 10\n10 3 450",
"3 \n117 14 384\n10213 312 10\n10 3 450",
"3 \n178 14 384\n10213 312 10\n10 3 450",
"3 \n303 14 384\n10213 312 10\n10 0 450",
"3 \n6 14 766\n10213 312 10\n10 0 45",
"3 \n6 5 766\n10213 312 10\n10 0 45",
"3 \n0 5 766\n5757 312 12\n10 0 ... |
lincan | On the eve of Republic Day, Teacher decided to distribute candies among N students.She brought the candies in a box and
placed it in front of students. She allowed every student to take out some candies. But each one of them tried
to take out as much candies as possible. That's why, Not all students were happy. She c... | {
"input": [],
"output": []
} | {
"input": [
"3\n3\n1 2 3\n3\n1 2 1\n4\n9 7 8 0"
],
"output": [
"2\n-1\n12\n"
]
} | {
"input": [
"3\n4\n1 2 3\n3\n1 2 1\n4\n9 7 8 0",
"3\n4\n1 2 3\n3\n1 2 1\n4\n9 7 8 1",
"3\n3\n1 2 3\n3\n1 2 1\n4\n9 7 2 1",
"3\n3\n1 2 3\n3\n1 2 2\n4\n9 7 8 0",
"3\n3\n1 2 6\n3\n1 2 1\n4\n9 7 2 1",
"3\n3\n1 2 3\n3\n1 2 2\n4\n9 11 8 0",
"3\n3\n1 2 6\n3\n0 2 1\n4\n9 7 2 1",
"3\n3\n1 2 5\... |
predict | Chef Datta likes betting in Indian Premier League very much.
He has 10000 rupees. Today the match is between team A and team B. The winning probability of team A is PA, and hence winning probability of team B is PB = 1 − PA.
Datta is free to bet any integral amount of money on any of the two teams as long as the total... | {
"input": [],
"output": []
} | {
"input": [
"1\n0.510"
],
"output": [
"10098.000000\n"
]
} | {
"input": [
"1\n0.6759186611344643",
"1\n0.708840981965978",
"1\n0.9294355565670196",
"1\n0.9595986277439509",
"1\n0.6186929279275386",
"1\n0.7729986640771538",
"1\n0.8236072058581279",
"1\n0.9545782907106495",
"1\n0.9787853794502042",
"1\n0.8720036342335278",
"1\n0.804074... |
tachstck | [Chopsticks (singular: chopstick) are short, frequently tapered sticks used in pairs of equal length, which are used as the traditional eating utensils of China, Japan, Korea and Vietnam. Originated in ancient China, they can also be found in some areas of Tibet and Nepal that are close to Han Chinese populations, as w... | {
"input": [],
"output": []
} | {
"input": [
"5 2\n1\n3\n3\n9\n4"
],
"output": [
"2\n"
]
} | {
"input": [
"5 2\n2\n3\n3\n9\n4",
"5 2\n6\n0\n3\n9\n6",
"5 0\n6\n0\n3\n5\n4",
"5 2\n3\n3\n3\n9\n4",
"5 2\n6\n3\n3\n9\n4",
"5 2\n6\n3\n3\n9\n6",
"5 2\n0\n3\n3\n9\n4",
"5 2\n2\n3\n3\n9\n3",
"5 2\n6\n3\n3\n7\n4",
"5 2\n10\n3\n3\n9\n6",
"5 2\n9\n0\n3\n9\n6",
"5 2\n2\n3\n3\... |
1223_F. Stack Exterminable Arrays | Let's look at the following process: initially you have an empty stack and an array s of the length l. You are trying to push array elements to the stack in the order s_1, s_2, s_3, ... s_{l}. Moreover, if the stack is empty or the element at the top of this stack is not equal to the current element, then you just push... | {
"input": [],
"output": []
} | {
"input": [
"3\n5\n2 1 1 2 2\n6\n1 2 1 1 3 2\n9\n3 1 2 2 1 6 6 3 3\n"
],
"output": [
" 4\n 1\n 8\n"
]
} | {
"input": [
"3\n5\n2 1 1 2 2\n6\n1 2 1 1 3 2\n9\n3 1 2 2 1 6 5 3 3\n",
"3\n5\n2 1 1 2 2\n10\n1 2 1 1 3 2\n9\n3 1 2 2 1 6 5 3 3\n",
"3\n5\n2 1 1 2 2\n6\n1 2 1 1 3 2\n9\n3 1 2 2 1 6 6 1 3\n",
"3\n5\n2 1 1 2 2\n6\n1 2 1 1 3 2\n9\n3 1 4 2 1 6 7 3 3\n",
"3\n5\n2 1 1 2 2\n6\n2 2 1 1 3 2\n9\n3 1 2 2 1 6... |
130_I. Array sorting | Sorting arrays is traditionally associated with high-level languages. How hard can it be in Befunge? Sort the given array in non-descending order.
Input
The first line of input contains an integer n (1 ≤ n ≤ 100) — the size of the array. The following n lines contain the elements of the array, one per line. Each elem... | {
"input": [],
"output": []
} | {
"input": [
"5\n7\n1\n9\n7\n3\n",
"10\n60\n1\n60\n1\n60\n1\n60\n1\n60\n1\n"
],
"output": [
"1 3 7 7 9 \n",
"1 1 1 1 1 60 60 60 60 60 \n"
]
} | {
"input": [],
"output": []
} |
661_A. Lazy Caterer Sequence | Lazy caterer sequence is defined as the maximum number of pieces formed when slicing a convex pancake with n cuts (each cut is a straight line). The formula is Cn = n·(n + 1) / 2 + 1. You are given n; calculate n-th element of the sequence.
Input
The only line of the input contains an integer n (0 ≤ n ≤ 100).
Output... | {
"input": [],
"output": []
} | {
"input": [
"2\n",
"5\n"
],
"output": [
"4\n",
"16\n"
]
} | {
"input": [],
"output": []
} |
72_F. Oil | After the nationalization of the oil industry, Dr. Mosaddegh wants to dig some oil wells to extract all the oil in Persian Gulf. But Persian Gulf is huge and has an infinite amount of oil. So Dr. Mosaddegh works only on a rectangular plane of size n × m of the Persian Gulf. Each of the cells in this rectangle either co... | {
"input": [],
"output": []
} | {
"input": [
"2 3\n1 2\n1 2\n",
"4 4\n2 2 3\n3 2 3 1\n",
"2 3\n1 1\n0\n"
],
"output": [
"2\n",
"2\n",
"1\n"
]
} | {
"input": [],
"output": []
} |
car-names-4 | Brian built his own car and was confused about what name he should keep for it. He asked Roman for help. Roman being his good friend, suggested a lot of names.
Brian only liked names that:
- Consisted of exactly three distinct characters, say C1, C2 and C3
- Satisfied the criteria that the string was of the form - ... | {
"input": [],
"output": []
} | {
"input": [
"2\nbbbrrriii\nbrian\n\nSAMPLE"
],
"output": [
"OK\nNot OK\n"
]
} | {
"input": [
"2\nbbbrrriii\nbrian\n\nELPMAS",
"2\nbbarrriii\nbrian\n\nELPMAS",
"2\nbbarrriii\nbrian\n\nSAMPLE",
"2\nbbarrriii\nbiran\n\nSAMPLE",
"2\nbbarrriji\nbiran\n\nSAMPLE",
"2\nbbarrrijj\nbiran\n\nSAMPLE",
"2\nbbarrjijr\nbiran\n\nSAMPLE",
"2\nbb`rrjijr\nbiran\n\nSAMPLE",
"2\nb... |
dexters-payback-2 | Frustrated from Mandark's challenges, Dexter plans an invasion in Mandark's lab. He knows that the underground entrance is the best way to get inside. But still, he needs to defuse the bombs hidden under the tiles of the floor. Dexter knows that the entrance has rectangular floor, divided in 1x1 tiles, so he numbered ... | {
"input": [],
"output": []
} | {
"input": [
"2\n3 2\n3 3\n\nSAMPLE"
],
"output": [
"4\n5\n"
]
} | {
"input": [
"2\n3 2\n3 3\n\nSPMALE",
"2\n3 1\n3 3\n\nSPMALE",
"2\n3 1\n4 3\n\nSPMALE",
"2\n3 1\n4 4\n\nSPMALE",
"2\n1 1\n4 4\n\nSPMALE",
"2\n1 1\n4 0\n\nSPMALE",
"2\n3 0\n3 3\n\nSAMPLE",
"2\n3 1\n3 6\n\nSPMALE",
"2\n3 1\n4 7\n\nSPMALE",
"2\n3 0\n2 3\n\nSAMPLE",
"2\n3 2\n4 ... |
gcd-9 | Given an array of size N of integers with each element denoted as array[i] .
In this problem we are given a parameter K and we are supposed to find the size of the largest contiguous subarray whose GCD is atleast K
If there is no subarray whose GCD is atleast K , print "0".
INPUT
The first line contains 2 integers N... | {
"input": [],
"output": []
} | {
"input": [
"5 9\n10 20 5 15 45\n\nSAMPLE"
],
"output": [
"2"
]
} | {
"input": [
"5 9\n10 20 5 15 61\n\nSAMPLE",
"0 9\n10 20 5 15 61\n\nSAMPLE",
"0 9\n10 5 5 15 61\n\nSAMPLE",
"0 6\n10 5 5 15 61\n\nSAMPLE",
"0 6\n1 5 5 15 61\n\nSAMPLE",
"0 6\n1 5 5 15 61\n\nELPMAS",
"0 6\n1 5 5 15 86\n\nELPMAS",
"0 8\n1 5 5 15 86\n\nELPMAS",
"-1 8\n1 5 5 15 86\n\nE... |
roy-and-little-mario-4 | Roy has played a lot of Mario that he got bored of playing it again and again. So now he wants to design a stage of Mario game.
Right now he is simply designing a group of walls using bricks that little Mario has to cross over. Little Mario cannot jump more than 3 bricks' height, so Roy cannot create a wall of height ... | {
"input": [],
"output": []
} | {
"input": [
"1\n3\n\nSAMPLE"
],
"output": [
"4\n"
]
} | {
"input": [
"1\n3\n\nELPMAS",
"1\n4\n\nELPMAT",
"1\n1\n\nELPMAT",
"1\n2\n\nELPMAS",
"1\n5\n\nDLPMAS",
"1\n6\n\nDLPAMS",
"1\n8\n\nELPNAS",
"1\n11\n\nELPNAS",
"1\n12\n\nFKPMAT",
"1\n15\n\nFKPMAT",
"1\n10\n\nEKOMAV",
"1\n29\n\nFKPTAM",
"1\n17\n\nFKPTAM",
"1\n7\n\n... |
strings-1 | Anton and Artur are old friends. Today they practice in writing strings. Anton must write each string with the lengths exactly N , based on the alphabet of size M . And Arthur, on the contrary, should write each string with the lengths exactly M , based on the alphabet of size N . Guys spend 1 second to write a sin... | {
"input": [],
"output": []
} | {
"input": [
"3\n1 1\n1 3\n100 500\n\nSAMPLE"
],
"output": [
"YES\nNO\nNO\n"
]
} | {
"input": [
"3\n1 2\n1 3\n100 500\n\nSAMPLE",
"3\n1 1\n1 1\n100 500\n\nSAMPLE",
"3\n2 2\n1 3\n100 500\n\nSAMPME",
"3\n1 2\n1 1\n100 818\n\nEAPMLS",
"3\n1 2\n1 6\n100 100\n\nSAMPLE",
"3\n1 2\n1 3\n100 500\n\nSAMPME",
"3\n1 1\n1 1\n100 500\n\nSLMPAE",
"3\n1 1\n1 1\n100 564\n\nSLMPAE",
... |
p02600 M-SOLUTIONS Programming Contest 2020 - Kyu in AtCoder | M-kun is a competitor in AtCoder, whose highest rating is X.
In this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:
* From 400 through 599: 8-kyu
* From 600 through 799: 7-kyu
* From 800 through 999: 6-kyu
* From 1000 thro... | {
"input": [],
"output": []
} | {
"input": [
"725",
"1600"
],
"output": [
"7",
"2"
]
} | {
"input": [
"1359",
"543",
"1855",
"609",
"982",
"1485",
"1125",
"1764",
"554",
"417",
"979",
"424",
"470",
"826",
"1596",
"885",
"1543",
"969",
"412",
"654",
"646",
"915",
"512",
"456",
"1815",
"668",
"1307",... |
p02731 AtCoder Beginner Contest 159 - Maximum Volume | Given is a positive integer L. Find the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.
Constraints
* 1 ≤ L ≤ 1000
* L is an integer.
Input
Input is given from Standard Input in the following format:
L
Output
Print the maximum possible volume of a re... | {
"input": [],
"output": []
} | {
"input": [
"999",
"3"
],
"output": [
"36926037.000000000000",
"1.000000000000"
]
} | {
"input": [
"5",
"8",
"0",
"1",
"2",
"4",
"7",
"13",
"6",
"11",
"-1",
"-2",
"-3",
"-4",
"-5",
"-8",
"-6",
"-7",
"-11",
"-16",
"-17",
"14",
"17",
"26",
"9",
"12",
"21",
"24",
"19",
"35",
"32",
... |
p02864 AtCoder Beginner Contest 145 - Laminate | We will create an artwork by painting black some squares in a white square grid with 10^9 rows and N columns.
The current plan is as follows: for the i-th column from the left, we will paint the H_i bottommost squares and will not paint the other squares in that column.
Before starting to work, you can choose at most K... | {
"input": [],
"output": []
} | {
"input": [
"10 0\n1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000",
"6 2\n8 6 9 1 2 1",
"4 1\n2 3 4 1"
],
"output": [
"4999999996",
"7",
"3"
]
} | {
"input": [
"10 0\n2 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000",
"6 2\n8 3 9 1 2 1",
"10 0\n2 1001000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000",
"6 2\n8 0 9 1 2 1",
"10 0\n2 1001001000 1 1000000000 1 1000000000 1 1000000000 1 1000000000",
"6 4\n8 0 9 1 2 1",... |
p02999 AtCoder Beginner Contest 130 - Rounding | X and A are integers between 0 and 9 (inclusive).
If X is less than A, print 0; if X is not less than A, print 10.
Constraints
* 0 \leq X, A \leq 9
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X A
Output
If X is less than A, print 0; if X is not less th... | {
"input": [],
"output": []
} | {
"input": [
"6 6",
"7 5",
"3 5"
],
"output": [
"10",
"10",
"0"
]
} | {
"input": [
"0 6",
"7 0",
"3 0",
"0 8",
"11 0",
"0 0",
"0 3",
"11 -1",
"0 -1",
"-1 3",
"9 0",
"1 -1",
"-2 3",
"6 0",
"1 0",
"-2 6",
"6 -1",
"1 1",
"-3 6",
"5 -1",
"0 1",
"-5 6",
"5 0",
"0 2",
"-5 5",
"10 -1",
... |
p03140 NIKKEI Programming Contest 2019 - Touitsu | You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i betwe... | {
"input": [],
"output": []
} | {
"input": [
"9\ndifferent\ndifferent\ndifferent",
"4\nwest\neast\nwait",
"7\nzenkoku\ntouitsu\nprogram"
],
"output": [
"0",
"3",
"13"
]
} | {
"input": [
"9\ncifferent\ndifferent\ndifferent",
"4\nwest\neast\nw`it",
"7\nukoknez\ntouitsu\nprogram",
"9\ncjfferent\ndifferent\ndifferent",
"4\nwesu\neast\nw`it",
"9\ncjfferent\ndifferent\ntnereffid",
"4\nwetu\neast\nw`it",
"7\nukoknez\nustiunt\nprogram",
"9\ntnereffic\nciffere... |
p03284 AtCoder Beginner Contest 105 - AtCoder Crackers | Takahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible. When all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.
Constraints
* 1 \leq N,K \leq 100
* A... | {
"input": [],
"output": []
} | {
"input": [
"100 10",
"1 1",
"7 3"
],
"output": [
"0",
"0",
"1"
]
} | {
"input": [
"100 13",
"2 1",
"1 2",
"10 3",
"100 9",
"6 3",
"000 9",
"3 1",
"7 4",
"000 16",
"0 1",
"000 26",
"4 1",
"001 26",
"011 26",
"111 26",
"111 37",
"011 37",
"010 37",
"110 37",
"110 59",
"100 59",
"100 37",
"101... |
p03440 AtCoder Petrozavodsk Contest 001 - Forest | You are given a forest with N vertices and M edges. The vertices are numbered 0 through N-1. The edges are given in the format (x_i,y_i), which means that Vertex x_i and y_i are connected by an edge.
Each vertex i has a value a_i. You want to add edges in the given forest so that the forest becomes connected. To add a... | {
"input": [],
"output": []
} | {
"input": [
"1 0\n5",
"7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6",
"5 0\n3 1 4 1 5"
],
"output": [
"0",
"7",
"Impossible"
]
} | {
"input": [
"7 5\n1 2 3 4 5 6 10\n3 0\n4 0\n1 2\n1 3\n5 6",
"5 0\n3 0 4 1 5",
"1 0\n3 0 4 1 2",
"7 5\n1 2 3 4 5 6 0\n3 0\n4 0\n1 2\n1 3\n5 6",
"7 5\n1 2 3 4 5 6 10\n3 0\n4 0\n1 2\n1 3\n5 0",
"2 0\n3 -1 4 1 5",
"2 0\n4 -1 4 1 1",
"2 0\n4 0 1 1 1",
"2 0\n7 1 4 1 2",
"2 0\n-1 -1 ... |
p03598 AtCoder Beginner Contest 074 - Collecting Balls (Easy Version) | There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N.
In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th t... | {
"input": [],
"output": []
} | {
"input": [
"1\n10\n2",
"2\n9\n3 6",
"5\n20\n11 12 9 17 12"
],
"output": [
"4",
"12",
"74"
]
} | {
"input": [
"1\n18\n2",
"2\n9\n2 6",
"5\n20\n11 12 9 17 15",
"1\n23\n1",
"1\n23\n0",
"1\n25\n-1",
"1\n10\n3",
"5\n20\n11 12 9 17 1",
"2\n9\n1 6",
"5\n20\n8 12 9 17 15",
"1\n18\n-2",
"5\n19\n11 12 9 17 1",
"5\n20\n14 12 9 17 15",
"2\n7\n3 4",
"5\n20\n14 12 1... |
p03759 AtCoder Beginner Contest 058 - ι⊥l | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b.
Determine whether the arrangement of the poles is beautiful.
Constraints
* 1 \leq a,b,c \leq 10... | {
"input": [],
"output": []
} | {
"input": [
"2 5 6",
"3 2 1",
"2 4 6"
],
"output": [
"NO",
"YES",
"YES"
]
} | {
"input": [
"2 8 6",
"2 2 2",
"2 2 1",
"2 0 6",
"1 8 6",
"2 0 2",
"1 8 1",
"2 4 2",
"2 0 3",
"1 10 1",
"2 4 1",
"0 0 3",
"1 1 1",
"2 1 1",
"-1 0 3",
"1 1 0",
"2 1 0",
"0 -1 3",
"1 2 0",
"2 0 1",
"0 -1 1",
"0 2 0",
"2 0 0",
... |
p03921 CODE FESTIVAL 2016 Final (Parallel) - Interpretation | On a planet far, far away, M languages are spoken. They are conveniently numbered 1 through M.
For CODE FESTIVAL 20XX held on this planet, N participants gathered from all over the planet.
The i-th (1≦i≦N) participant can speak K_i languages numbered L_{i,1}, L_{i,2}, ..., L_{i,{}K_i}.
Two participants A and B can c... | {
"input": [],
"output": []
} | {
"input": [
"4 6\n3 1 2 3\n2 4 2\n2 4 6\n1 6",
"4 4\n2 1 2\n2 1 2\n1 3\n2 4 3"
],
"output": [
"YES",
"NO"
]
} | {
"input": [
"4 4\n2 1 2\n2 1 2\n0 3\n2 4 3",
"4 6\n3 2 3 3\n2 4 2\n2 4 6\n1 6",
"4 4\n2 2 2\n2 1 2\n0 3\n2 4 3",
"4 4\n2 2 2\n2 1 2\n1 3\n2 4 3",
"4 6\n3 1 3 3\n2 4 2\n2 4 6\n1 6",
"4 4\n2 2 2\n2 2 2\n0 3\n2 4 3",
"4 4\n2 2 2\n2 2 2\n0 3\n2 4 4",
"4 6\n3 2 3 4\n2 4 2\n2 4 6\n1 6",
... |
p00022 Maximum Sum Sequence | Given a sequence of numbers a1, a2, a3, ..., an, find the maximum sum of a contiguous subsequence of those numbers. Note that, a subsequence of one element is also a contiquous subsequence.
Input
The input consists of multiple datasets. Each data set consists of:
n
a1
a2
.
.
an
You can assume that 1 ≤ n ≤ 5000 ... | {
"input": [],
"output": []
} | {
"input": [
"7\n-5\n-1\n6\n4\n9\n-6\n-7\n13\n1\n2\n3\n2\n-2\n-1\n1\n2\n3\n2\n1\n-2\n1\n3\n1000\n-200\n201\n0"
],
"output": [
"19\n14\n1001"
]
} | {
"input": [
"7\n-5\n-2\n6\n4\n9\n-6\n-7\n13\n1\n2\n3\n2\n-2\n-1\n1\n2\n3\n2\n1\n-2\n1\n3\n1000\n-200\n201\n0",
"7\n-5\n-2\n6\n4\n9\n-6\n-7\n13\n1\n2\n3\n2\n-2\n-1\n1\n1\n3\n2\n1\n-2\n1\n3\n1000\n-200\n201\n0",
"7\n-5\n-2\n6\n8\n9\n-6\n-7\n13\n1\n2\n3\n2\n-2\n-1\n1\n1\n3\n2\n1\n-2\n1\n3\n1000\n-200\n201\n... |
p00153 Triangle and Circle | Create a program to determine the positional relationship between a triangle and a circle on a plane. All target figures shall include boundaries. The triangle is given the position of three vertices, and the circle is given the position of the center and the radius. The position is given by a set of two integers in a ... | {
"input": [],
"output": []
} | {
"input": [
"1 1\n3 1\n3 3\n3 2\n3\n3 12\n9 3\n11 12\n8 7\n5\n15 3\n17 7\n22 5\n7 6\n4\n6 11\n8 2\n16 9\n10 8\n2\n0 0"
],
"output": [
"b\nc\nd\na"
]
} | {
"input": [
"1 1\n3 1\n3 3\n3 2\n3\n3 12\n9 3\n11 12\n8 7\n5\n15 3\n17 7\n22 5\n7 6\n5\n6 11\n8 2\n16 9\n10 8\n2\n0 0",
"2 1\n3 1\n3 3\n3 2\n3\n3 12\n9 3\n11 12\n8 7\n5\n15 3\n17 7\n22 5\n7 6\n5\n6 11\n8 2\n16 9\n15 8\n0\n0 0",
"2 1\n3 1\n3 3\n3 2\n3\n3 12\n9 3\n11 12\n8 7\n5\n5 3\n17 7\n22 5\n7 6\n5\n6 ... |
p00310 The Number of Participants | Welcome to PC Koshien, players. At PC Koshien, competitions are currently being held in a total of three categories: programming category, mobile category, and Ichimai's picture CG category.
Given the number of participants in each department, create a program that calculates the total number of participants.
Input... | {
"input": [],
"output": []
} | {
"input": [
"10 10 20",
"100 0 0",
"1000 1000 1000"
],
"output": [
"40",
"100",
"3000"
]
} | {
"input": [
"20 10 20",
"100 0 1",
"0000 1000 1000",
"5 10 20",
"110 0 1",
"0000 0000 1000",
"6 10 20",
"110 -1 1",
"0001 0000 1000",
"6 10 15",
"110 0 2",
"0101 0000 1000",
"010 0 2",
"0100 0000 1000",
"9 15 15",
"0100 0010 1000",
"10 15 15",
"... |
p00474 Icicles | problem
There are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles.
There are N (2 ≤ N ≤ 100000 = 105) icicles under the eaves of JOI's house. These icicles are aligned and i cm (1 ≤ i ≤ N) from the left edge of the eaves. There are i-th icicles at the pos... | {
"input": [],
"output": []
} | {
"input": [
"4 6\n4\n2\n3\n5"
],
"output": [
"8"
]
} | {
"input": [
"4 6\n7\n2\n3\n5",
"4 6\n4\n1\n3\n5",
"1 6\n4\n2\n3\n1",
"4 10\n7\n1\n3\n5",
"4 11\n5\n2\n3\n5",
"4 5\n4\n2\n3\n1",
"1 6\n3\n2\n3\n1",
"1 6\n2\n2\n3\n1",
"4 9\n7\n2\n3\n5",
"1 6\n1\n0\n1\n1",
"4 11\n5\n2\n1\n5",
"1 5\n4\n2\n1\n0",
"1 13\n2\n2\n3\n2",
... |
p00666 World Domination | Evil organizations that attempt to conquer the world are everywhere, regardless of age, east or west fiction, non-fiction, but what on earth did they try to conquer the world? I suddenly thought about that because I was also planning to conquer the world. The only reason I want to conquer the world is to show the world... | {
"input": [],
"output": []
} | {
"input": [
"4\n0.200 3 0.500\n0.100 0 0.400\n0.900 1 1.000\n0.400 2 0.600\n2\n0.600 1 0.800\n0.500 0 1.000\n9\n0.200 7 0.600\n0.400 0 0.500\n0.700 8 1.000\n0.100 4 0.400\n0.200 2 0.600\n0.100 6 0.400\n0.100 5 0.400\n0.600 3 0.900\n0.500 1 0.900\n9\n0.300 8 0.900\n0.700 3 0.800\n0.300 0 0.900\n0.700 6 0.800\n0.2... | {
"input": [
"4\n0.200 3 0.500\n0.100 0 0.400\n0.900 1 1.000\n0.400 2 0.600\n2\n0.600 1 0.800\n0.500 0 1.000\n9\n0.200 7 0.600\n0.400 0 0.500\n0.700 8 1.000\n0.100 4 0.400\n0.200 2 0.600\n0.100 6 0.400\n0.18676017117330992 5 0.400\n0.600 3 0.900\n0.500 1 0.900\n9\n0.300 8 0.900\n0.700 3 0.800\n0.300 0 0.900\n0.70... |
p00809 Nim | Let's play a traditional game Nim. You and I are seated across a table and we have a hundred stones on the table (we know the number of stones exactly). We play in turn and at each turn, you or I can remove one to four stones from the heap. You play first and the one who removed the last stone loses.
In this game, you... | {
"input": [],
"output": []
} | {
"input": [
"1 101 4 4\n1 100 4 4\n3 97 8 7 6 5 4 3\n0"
],
"output": [
"0\n1\n1"
]
} | {
"input": [
"1 101 4 4\n1 100 4 4\n3 97 8 7 6 5 0 3\n0",
"1 001 8 4\n1 100 1 4\n3 97 12 7 6 5 0 3\n0",
"1 101 8 4\n1 100 1 4\n3 97 12 7 6 5 0 3\n0",
"1 101 5 4\n1 100 4 4\n3 97 8 7 6 5 4 3\n0",
"2 001 4 4\n1 100 4 4\n3 97 8 4 6 5 0 3\n0",
"1 101 8 4\n0 100 1 4\n3 97 11 7 0 5 1 3\n0",
"1 0... |
p00940 Deadlock Detection | Example
Input
2 2 7
3 4
3 2
1 3
1 1
2 2
1 2
2 1
1 2
2 2
1 1
Output
5 | {
"input": [],
"output": []
} | {
"input": [
"2 2 7\n3 4\n3 2\n1 3\n1 1\n2 2\n1 2\n2 1\n1 2\n2 2\n1 1"
],
"output": [
"5"
]
} | {
"input": [
"2 2 7\n5 4\n3 2\n1 3\n1 1\n2 2\n1 2\n2 1\n1 2\n2 2\n1 1",
"2 2 7\n3 4\n3 2\n1 3\n1 2\n2 2\n1 2\n2 1\n1 2\n2 2\n1 1",
"4 2 7\n3 4\n3 2\n1 3\n1 1\n2 2\n1 2\n2 1\n1 2\n2 2\n1 1",
"2 2 7\n3 4\n3 2\n1 3\n1 1\n2 2\n1 2\n2 1\n1 2\n2 4\n1 1",
"2 2 7\n5 4\n3 3\n1 3\n1 1\n2 2\n1 2\n2 1\n1 2\n2... |
p01073 Potatoes | Problem
Gaccho owns an N-sided field and M potatoes. Each field is numbered from 1 to N. Gaccho wants to increase the number of potatoes by planting and harvesting potatoes in the field.
Gaccho lives alone and can only manage fields up to the K side. In addition, the soil condition and area of each field vary, and ... | {
"input": [],
"output": []
} | {
"input": [
"5 100 3\n2 3 4 5 6\n50 40 20 10 5",
"5 100 3\n2 3 4 5 100\n50 40 20 10 1"
],
"output": [
"280",
"339"
]
} | {
"input": [
"5 100 3\n2 3 4 5 4\n50 40 20 10 5",
"5 100 3\n2 2 4 5 100\n50 40 20 10 1",
"5 100 3\n2 2 4 5 110\n50 40 20 10 1",
"5 110 3\n2 2 4 5 110\n50 40 20 10 1",
"5 110 3\n2 3 4 5 110\n50 40 20 10 1",
"5 100 3\n-1 3 4 5 4\n50 40 12 10 1",
"5 100 3\n-1 3 4 5 4\n50 15 12 10 1",
"5 0... |
p01207 Hit and Blow | Hit and blow is a popular code-breaking game played by two people, one codemaker and one codebreaker. The objective of this game is that the codebreaker guesses correctly a secret number the codemaker makes in his or her mind.
The game is played as follows. The codemaker first chooses a secret number that consists of ... | {
"input": [],
"output": []
} | {
"input": [
"2\n1234 3 0\n1245 3 0\n1\n1234 0 0\n2\n0123 0 4\n1230 0 4\n0"
],
"output": [
"1235\n????\n0132"
]
} | {
"input": [
"2\n1234 3 0\n1245 3 0\n0\n1234 0 0\n2\n0123 0 4\n1230 0 4\n0",
"2\n1234 3 0\n1739 3 0\n0\n1234 0 0\n2\n0123 0 5\n1230 0 4\n0",
"2\n1234 3 0\n1032 3 0\n0\n1234 0 0\n2\n0123 0 5\n1230 0 5\n0",
"2\n1234 3 0\n1245 2 0\n0\n1234 0 0\n2\n0123 0 4\n1230 -1 4\n0",
"2\n1234 3 0\n1035 3 0\n0\n1... |
p01343 Psychic Accelerator | In the west of Tokyo, there is a city named “Academy City.” There are many schools and laboratories to develop psychics in Academy City.
You are a psychic student of a school in Academy City. Your psychic ability is to give acceleration to a certain object.
You can use your psychic ability anytime and anywhere, but t... | {
"input": [],
"output": []
} | {
"input": [
"1 1\n0 0 2 0",
"2 1\n0 0 1 0\n1 1 0 1",
"3 2\n0 0 2 0\n1 -1 1 2\n0 1 2 1"
],
"output": [
"2.8284271082",
"5.2793638507",
"11.1364603512"
]
} | {
"input": [
"1 1\n0 0 2 -1",
"2 2\n0 0 1 0\n1 1 0 1",
"3 2\n-1 0 2 0\n1 -1 1 2\n0 1 2 1",
"1 1\n1 0 2 -1",
"2 2\n-1 0 1 0\n1 1 0 1",
"1 0\n1 0 2 -1",
"1 1\n0 0 3 0",
"3 4\n-1 0 2 0\n1 -1 1 2\n0 1 2 1",
"2 4\n0 0 1 0\n1 1 0 1",
"1 2\n1 0 2 -1",
"1 1\n0 0 5 0",
"1 2\n2 0... |
p01511 Three-way Branch | There is a grid that consists of W \times H cells. The upper-left-most cell is (1, 1). You are standing on the cell of (1,1) and you are going to move to cell of (W, H). You can only move to adjacent lower-left, lower or lower-right cells.
There are obstructions on several cells. You can not move to it. You cannot mov... | {
"input": [],
"output": []
} | {
"input": [
"2 4 1\n2 1\n2 2 1\n2 2\n0 0 0"
],
"output": [
"Case 1: 4\nCase 2: 0"
]
} | {
"input": [
"2 4 1\n2 1\n4 2 1\n2 2\n0 0 0",
"2 4 1\n2 1\n2 2 1\n2 1\n0 0 0",
"2 6 1\n2 1\n4 2 1\n2 2\n0 0 0",
"2 6 1\n2 1\n4 2 0\n2 2\n0 0 0",
"3 4 1\n2 1\n4 2 1\n2 2\n0 0 0",
"2 2 1\n2 1\n2 2 1\n2 1\n0 0 0",
"2 4 1\n2 2\n2 2 1\n2 2\n0 0 0",
"3 4 1\n2 1\n4 2 0\n2 2\n0 0 0",
"2 6 ... |
p01681 Putter | Problem Statement
Fox Ciel is practicing miniature golf, a golf game played with a putter club only. For improving golf skills, she believes it is important how well she bounces the ball against walls.
The field of miniature golf is in a two-dimensional plane and surrounded by $N$ walls forming a convex polygon. At f... | {
"input": [],
"output": []
} | {
"input": [
"4\n0 0\n-10 -10\n10 -10\n10 10\n-10 10\n0"
],
"output": [
"8"
]
} | {
"input": [
"4\n1 0\n-10 -10\n10 -10\n10 10\n-10 10\n0",
"4\n2 0\n-10 -10\n10 -10\n4 10\n-17 10\n0",
"4\n1 0\n-7 -10\n10 -10\n10 10\n-10 10\n0",
"4\n2 0\n-10 -10\n10 -10\n10 10\n-17 6\n0",
"4\n2 0\n-10 -10\n0 -10\n10 10\n-17 6\n0",
"4\n1 0\n-10 -15\n4 -10\n10 1\n-17 10\n0",
"4\n0 0\n-6 -2... |
p01825 Laser Cutter | Example
Input
3
0 1
0 0 0 1
0 1 0 2
0 2 0 3
Output
6.0000000000000000 | {
"input": [],
"output": []
} | {
"input": [
"3\n0 1\n0 0 0 1\n0 1 0 2\n0 2 0 3"
],
"output": [
"6.0000000000000000"
]
} | {
"input": [
"3\n0 1\n0 0 0 1\n0 0 0 2\n0 2 0 3",
"3\n-1 1\n0 0 0 2\n0 0 0 2\n0 2 0 3",
"3\n-1 1\n0 0 0 2\n0 0 0 2\n1 2 0 3",
"3\n-1 0\n0 0 0 2\n0 0 0 2\n1 0 0 3",
"3\n-1 0\n0 1 0 2\n0 0 0 2\n1 0 0 3",
"3\n-1 0\n0 1 0 1\n0 0 0 2\n1 0 0 3",
"3\n-1 0\n0 1 1 1\n0 0 0 2\n1 0 0 3",
"3\n-1 0... |
p01960 Tree Separator | You are given a tree $T$ and an integer $K$. You can choose arbitrary distinct two vertices $u$ and $v$ on $T$. Let $P$ be the simple path between $u$ and $v$. Then, remove vertices in $P$, and edges such that one or both of its end vertices is in $P$ from $T$. Your task is to choose $u$ and $v$ to maximize the number ... | {
"input": [],
"output": []
} | {
"input": [
"3 2\n1 2\n2 3",
"12 2\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n7 8\n8 9\n6 10\n10 11\n11 12",
"9 3\n1 2\n1 3\n1 4\n4 5\n4 6\n4 7\n7 8\n7 9",
"2 1\n1 2",
"7 3\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7",
"3 1\n1 2\n2 3"
],
"output": [
"0",
"4",
"2",
"0",
"1",
"1"
]
} | {
"input": [
"1 2\n1 2\n2 3",
"4 1\n1 2\n2 3",
"12 2\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n7 8\n8 9\n2 10\n10 11\n11 12",
"12 0\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n7 8\n8 9\n6 10\n10 11\n11 12",
"9 1\n1 2\n1 3\n1 4\n4 5\n4 6\n4 7\n7 8\n7 9",
"7 3\n1 2\n2 5\n3 4\n4 5\n5 6\n6 7",
"9 1\n1 2\n1 3\n1 4\n6 ... |
p02107 Demon's Plan | BackGround
In the Demon's Plan, 108 demons who control the desire are competing in the programming contest day and night. The organizer, Patron, is trying to invite the demons to "Rix-Magna", a place where all the souls gather. Patron wants to send an invitation to a demon who hasn't sent an invitation yet, but he dec... | {
"input": [],
"output": []
} | {
"input": [
"3 3\n1 2 3\n2 1 2\n3 2 1",
"3 5\n1 2 3 4 5\n5 4 3 2 1\n4 3 2 1 5"
],
"output": [
"0\n1",
"1\n2"
]
} | {
"input": [
"3 3\n1 2 3\n2 1 2\n3 1 1",
"3 5\n1 2 3 4 5\n5 4 3 2 1\n4 3 3 1 5",
"3 3\n2 2 3\n2 1 2\n3 1 1",
"3 4\n2 2 3\n2 1 2\n3 0 1",
"3 5\n1 0 3 5 5\n1 4 3 -1 0\n4 3 1 0 5",
"1 5\n1 -1 3 5 5\n1 4 3 -1 0\n4 0 1 0 5",
"1 5\n1 -1 3 4 0\n1 4 6 -1 1\n2 1 0 0 4",
"1 5\n1 -1 3 1 0\n1 6 6 ... |
p02247 Naive String Search | Find places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0.
Constraints
* 1 ≤ length of T ≤ 1000
* 1 ≤ length of P ≤ 1000
* The input consists of alphabetical characters and digits
Input
In the first line, a text T is given. In the second line, a strin... | {
"input": [],
"output": []
} | {
"input": [
"aabaaa\naa",
"xyzz\nyz"
],
"output": [
"0\n3\n4",
"1"
]
} | {
"input": [
"aaabaa\naa",
"aabaaa\nba",
"aaabaa\nba",
"aab`aa\naa",
"xyzy\nyz",
"aaaaba\naa",
"abaaaa\naa",
"abaaaa\nab",
"aaacab\naa",
"aaaaba\nba",
"abaaab\naa",
"ab`aaa\naa",
"baadaa\naa",
"abbbab\nbb",
"`babaa\nba",
"aaaaab\naa",
"`aabab\nab",
... |
p02394 Circle in a Rectangle | Write a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the central coordinate $(x, y)$ and radius $r$ of the circle are given.
Circle inside a rectangle
Cons... | {
"input": [],
"output": []
} | {
"input": [
"5 4 2 2 1",
"5 4 2 4 1"
],
"output": [
"Yes",
"No"
]
} | {
"input": [
"2 4 2 2 1",
"2 8 2 0 0",
"5 4 2 0 1",
"2 4 2 2 2",
"5 8 2 0 1",
"2 6 2 2 2",
"2 8 2 0 1",
"3 6 2 2 2",
"0 6 2 2 2",
"2 8 1 0 0",
"0 10 2 2 2",
"2 12 1 0 0",
"0 10 2 2 0",
"0 12 1 0 0",
"0 10 2 1 0",
"1 12 1 0 0",
"0 9 2 1 0",
"1 7 1... |
aran05 | Now that we have recovered all our data, we can return to hacking in to the hacker's system. Our sources tell us that this hacker's lust for power is so great that it is reflected in everything he does, everything he creates. Perhaps this knowledge can become his weakness in our hands, his thirst for power laying a tra... | {
"input": [],
"output": []
} | {
"input": [
"3\naranya\nreverse\ngear"
],
"output": [
"124\n252\n159"
]
} | {
"input": [],
"output": []
} |
cipher | Pakistan Team is obsessed with match fixing. Their bookie Asif is writing a letter to them and wants nobody else to be able to read it. They use a simple substitution cipher to encode his message. Each letter in the message is replaced with its corresponding letter in a substitution alphabet. A substitution alphabet is... | {
"input": [],
"output": []
} | {
"input": [
"2\nhello\nsachin"
],
"output": [
"abccd\nabcdef"
]
} | {
"input": [],
"output": []
} |
factsum | Given a positive integer K > 2, with prime
factorization:
K = p1^a1 * p2^a2 ... * pn^an
Compute the following:
S = a1*p1 + a2*p2 ... + an*pn.
Input
A list of
Output
For each integer compute the super factor
sum and output it on a single line.
Example
Input:
6
7
Output:
5
7 | {
"input": [],
"output": []
} | {
"input": [
"6\n7"
],
"output": [
"5\n7"
]
} | {
"input": [
"6\n9",
"6\n15",
"6\n2",
"6\n11",
"6\n12",
"6\n4",
"6\n6",
"6\n3",
"6\n14",
"6\n19",
"6\n36",
"6\n62",
"6\n22",
"6\n26",
"6\n33",
"6\n59",
"6\n31",
"6\n17",
"6\n38",
"6\n23",
"6\n51",
"6\n102",
"6\n39",
"6\n72... |
lckyst | A number is called as a lucky number if its decimal representation contains only the lucky digits, 4 and 7. e.g. 47, 744, 4 are lucky numbers, whereas 5, 17, 467 are not.
Recently, Na2a found a magic stone. With the help of this stone, he can multiply a number by any lucky number. Also, the magic stone can be used any ... | {
"input": [],
"output": []
} | {
"input": [
"2\n2 15"
],
"output": [
"2\n60\n"
]
} | {
"input": [
"2\n2 26",
"2\n2 3",
"2\n2 6",
"2\n2 7",
"2\n4 26",
"2\n2 5",
"2\n1 6",
"2\n4 7",
"2\n4 11",
"2\n4 5",
"2\n1 5",
"2\n4 4",
"2\n6 11",
"2\n3 5",
"2\n4 6",
"2\n1 11",
"2\n4 8",
"2\n2 11",
"2\n2 27",
"2\n3 26",
"2\n2 1",
... |
petersen | The following graph G is called a Petersen graph and its vertices have been numbered from 0 to 9. Some letters have also been assigned to vertices of G, as can be seen from the following picture:
Let's consider a walk W in graph G, which consists of L vertices W1, W2, ..., WL, such that Wi is connected with Wi + ... | {
"input": [],
"output": []
} | {
"input": [
"2\nAAB\nAABE"
],
"output": [
"501\n-1\n"
]
} | {
"input": [
"2\nAAB\nAACE",
"2\nBAA\nAACE",
"2\nBAA\nECAA",
"2\nBBA\nECAA",
"2\nBBA\nECAB",
"2\nAAB\nABAE",
"2\nBAB\nAACE",
"2\nBAA\nCEAA",
"2\nABB\nBACE",
"2\nBAA\nABAE",
"2\nBAB\nAACD",
"2\nAAB\nCEAA",
"2\nBAC\nAACD",
"2\nAAC\nAACD",
"2\nAAC\nAACE",
"... |
stones | Soma is a fashionable girl. She absolutely loves shiny stones that she can put on as jewellery accessories. She has been collecting stones since her childhood - now she has become really good with identifying which ones are fake and which ones are not. Her King requested for her help in mining precious stones, so she ... | {
"input": [],
"output": []
} | {
"input": [
"4\nabc\nabcdef\naA\nabAZ\naaa\na\nwhat\nnone"
],
"output": [
"3\n2\n1\n0\n"
]
} | {
"input": [
"4\nacb\nabcdef\naA\nabAZ\naaa\na\nwhat\nnone",
"4\nacb\nabcdef\nAa\nabZA\naaa\n`\nwhat\nnone",
"4\naca\nebcdaf\naA\nAbZa\n`aa\n`\nswha\nnomf",
"4\nac`\nebcdae\naA\nAbZa\n`aa\n_\nsvha\nnome",
"4\nac`\nebcdae\naA\nAbZ`\n`aa\n_\nsvha\nemon",
"4\n`ca\neacdae\naA\nAbZ`\n`aa\n_\nahvs\n... |
1417_A. Copy-paste | — Hey folks, how do you like this problem?
— That'll do it.
BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-paste spell as follows:
1. He chooses two piles (i, j) such that 1 ≤ i, j ≤ n and i ≠ j.
2. All candies from pile i are... | {
"input": [],
"output": []
} | {
"input": [
"3\n2 2\n1 1\n3 5\n1 2 3\n3 7\n3 2 2\n"
],
"output": [
"1\n5\n4\n"
]
} | {
"input": [
"3\n2 2\n2 1\n3 5\n1 2 3\n3 7\n3 2 2\n",
"3\n2 2\n1 1\n3 5\n1 2 3\n3 7\n4 2 2\n",
"3\n2 2\n2 1\n3 5\n1 3 3\n3 7\n3 2 2\n",
"3\n2 4\n1 1\n3 5\n1 2 3\n3 7\n4 2 2\n",
"3\n2 2\n2 1\n3 5\n1 3 3\n3 7\n4 2 2\n",
"3\n2 2\n2 1\n3 5\n1 4 3\n3 7\n4 2 2\n",
"3\n2 2\n1 1\n3 5\n1 2 4\n3 7\n... |
162_D. Remove digits | You are given a string. Remove all digits from it. When a character is removed from a string, all characters to the right of it are shifted one position to the left.
Input
The only line of input contains a string between 1 and 100 characters long. Each character of the string has ASCII-code between 33 (exclamation ma... | {
"input": [],
"output": []
} | {
"input": [
"VK-Cup-2012!\n",
"Go,Codeforces!\n"
],
"output": [
"VK-Cup-!\n",
"Go,Codeforces!\n"
]
} | {
"input": [],
"output": []
} |
300_D. Painting Square | Vasily the bear has got a large square white table of n rows and n columns. The table has got a black border around this table.
<image> The example of the initial table at n = 5.
Vasily the bear wants to paint his square table in exactly k moves. Each move is sequence of actions:
1. The bear chooses some square in... | {
"input": [],
"output": []
} | {
"input": [
"8\n1 0\n1 1\n3 0\n3 1\n2 0\n2 1\n3 2\n7 2\n"
],
"output": [
"1\n0\n1\n1\n1\n0\n0\n4\n"
]
} | {
"input": [
"8\n1 0\n1 1\n3 0\n3 1\n2 0\n2 1\n3 3\n7 2\n",
"8\n2 0\n1 1\n3 0\n3 1\n2 0\n2 0\n3 3\n7 2\n",
"8\n2 0\n1 1\n3 0\n3 2\n2 0\n2 0\n3 3\n7 2\n",
"8\n1 0\n1 1\n3 0\n3 1\n2 0\n2 1\n3 0\n7 2\n",
"8\n1 0\n1 1\n3 0\n3 1\n2 0\n2 0\n3 0\n7 2\n",
"8\n1 0\n1 1\n5 0\n6 1\n2 0\n2 1\n2 2\n7 2\n",... |
932_B. Recursive Queries | Let us define two functions f and g on positive integer numbers.
<image>
<image>
You need to process Q queries. In each query, you will be given three integers l, r and k. You need to print the number of integers x between l and r inclusive, such that g(x) = k.
Input
The first line of the input contains an integ... | {
"input": [],
"output": []
} | {
"input": [
"4\n82 94 6\n56 67 4\n28 59 9\n39 74 4\n",
"4\n22 73 9\n45 64 6\n47 55 7\n2 62 4\n"
],
"output": [
"3\n1\n1\n5\n",
"1\n4\n0\n8\n"
]
} | {
"input": [
"4\n82 94 6\n56 67 4\n28 23 9\n39 74 4\n",
"4\n22 73 9\n45 64 6\n47 55 7\n2 75 4\n",
"4\n82 94 6\n56 67 4\n28 59 9\n2 74 4\n",
"4\n22 73 9\n45 64 6\n47 55 7\n2 24 4\n",
"4\n82 94 6\n56 67 4\n28 23 9\n39 74 5\n",
"4\n82 94 6\n56 67 4\n28 23 9\n39 57 4\n",
"4\n22 73 9\n45 64 7\n... |
breaking-bad-3 | “All Hail The King.”
Middle aged, and overqualified highschool chemistry teacher Walter White has been diagnosed with lung cancer. To make sure his family is financially secure, he teams up with a former student Jesse Pinkman and turns to a life of crime to make and distribute the purest crystal meth on the streets.
... | {
"input": [],
"output": []
} | {
"input": [
"2\n2\n3 1\n4\n1 4 6 3\n\nSAMPLE"
],
"output": [
"3\n27\n"
]
} | {
"input": [
"2\n2\n3 1\n4\n1 4 6 3\n\nSBMPLE",
"2\n2\n5 1\n4\n1 4 6 3\n\nSBMPLE",
"2\n2\n5 0\n4\n1 4 6 3\n\nSBMPLE",
"2\n2\n3 1\n4\n2 4 6 3\n\nSAMPLE",
"2\n2\n5 0\n4\n1 5 6 3\n\nSBMPLE",
"2\n2\n5 0\n4\n1 1 6 3\n\nSBMPLE",
"2\n2\n3 0\n4\n2 4 6 3\n\nSAMPLE",
"2\n2\n5 0\n4\n1 6 6 3\n\nSB... |
g-game-with-letters | Valentina is looking for a new game to play with her friends.
She asks her mom Marcia for an idea.
After a moment Marcia described to girls the following simple game.
Girls are divided into n teams, indexed 1 through n.
Each girl chooses a lowercase letter, one of 'a' - 'z'.
Of course, some girls can choose the same l... | {
"input": [],
"output": []
} | {
"input": [
"3\n2 qwopwasp\nwdw\nabco\n5 eeeessaa\nvalentina\nesta\njugando\ncon\nmarcia\n5 ahi\nvalentina\nesta\njugando\ncon\nsusamigas\n\nSAMPLE"
],
"output": [
"1\n2\n1\n"
]
} | {
"input": [
"3\n2 qwopwasp\nwdw\nabco\n5 eeeessaa\nvalentina\nesta\njugando\ncon\niarcma\n5 ahi\nvalentina\nesta\njugando\ncon\nsusamigas\n\nSAMPLE",
"3\n2 pswwpoaq\ndww\nacco\n5 eeeessaa\nanitnelav\netta\njugandn\noco\niarcmb\n5 ahi\nvalentina\naste\noandguj\ncon\nsusamigas\n\nSAMPLE",
"3\n2 qwopwasp\nw... |
k-arrays | Milly is feeling bored during her winter vaccations, so she has decided to do some random fun on some arrays. She will take K number of arrays of same same size N. She will make all possible non-empty subsets of these arrays. She will make a Set S made up of the same-sized subsets of these arrays while considering the ... | {
"input": [],
"output": []
} | {
"input": [
"1\n2 2\n1 2\n3 4\n\nSAMPLE"
],
"output": [
"8 3"
]
} | {
"input": [],
"output": []
} |
p02581 AtCoder Beginner Contest 176 - Brave CHAIN | We have 3N cards arranged in a row from left to right, where each card has an integer between 1 and N (inclusive) written on it. The integer written on the i-th card from the left is A_i.
You will do the following operation N-1 times:
* Rearrange the five leftmost cards in any order you like, then remove the three le... | {
"input": [],
"output": []
} | {
"input": [
"3\n1 1 2 2 2 3 3 3 1",
"3\n1 1 2 2 3 3 3 2 1",
"2\n1 2 1 2 2 1"
],
"output": [
"3",
"1",
"2"
]
} | {
"input": [
"3\n0 1 2 2 2 3 3 3 1",
"2\n1 2 1 1 2 1",
"3\n1 1 2 1 2 3 3 3 2",
"2\n3 3 1 2 2 1",
"3\n1 1 2 2 2 3 3 3 2",
"2\n2 2 1 1 2 1",
"2\n2 1 1 1 2 1",
"2\n1 2 1 0 2 1",
"3\n0 1 1 2 2 3 3 3 1",
"2\n1 2 1 0 2 2",
"3\n1 1 2 1 2 2 3 3 2",
"3\n0 1 1 2 2 3 3 3 2",
"... |
p02712 AtCoder Beginner Contest 162 - FizzBuzz Sum | Let us define the FizzBuzz sequence a_1,a_2,... as follows:
* If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}.
* If the above does not hold but 3 divides i, a_i=\mbox{Fizz}.
* If none of the above holds but 5 divides i, a_i=\mbox{Buzz}.
* If none of the above holds, a_i=i.
Find the sum of all numbers among the first... | {
"input": [],
"output": []
} | {
"input": [
"1000000",
"15"
],
"output": [
"266666333332",
"60"
]
} | {
"input": [
"1100000",
"16",
"1110000",
"23",
"1110010",
"3",
"1111010",
"1111110",
"4",
"8",
"1",
"7",
"14",
"19",
"12",
"0",
"1000100",
"18",
"1101000",
"39",
"1010010",
"1111111",
"26",
"1101100",
"53",
"101101... |
p02841 Sumitomo Mitsui Trust Bank Programming Contest 2019 - November 30 | In this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019.
Integers M_1, D_1, M_2, and D_2 will be given as input.
It is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1.
Determine whether the date 2019-M_1-D_1 is the last day of a month.
Constraints
* Both 2019-M_1-D_1 and 20... | {
"input": [],
"output": []
} | {
"input": [
"11 16\n11 17",
"11 30\n12 1"
],
"output": [
"0",
"1"
]
} | {
"input": [
"11 30\n6 1",
"11 17\n11 17",
"6 30\n12 1",
"11 16\n11 28",
"11 24\n11 28",
"11 30\n18 1",
"11 8\n11 28",
"11 8\n11 17",
"11 16\n11 31",
"11 30\n35 1",
"11 8\n11 32",
"11 30\n2 1",
"11 3\n11 8",
"11 30\n26 1",
"11 16\n11 46",
"11 8\n11 33",
... |
p02978 AtCoder Grand Contest 035 - Add and Remove | There is a stack of N cards, each of which has a non-negative integer written on it. The integer written on the i-th card from the top is A_i.
Snuke will repeat the following operation until two cards remain:
* Choose three consecutive cards from the stack.
* Eat the middle card of the three.
* For each of the other ... | {
"input": [],
"output": []
} | {
"input": [
"10\n3 1 4 1 5 9 2 6 5 3",
"6\n5 2 4 1 6 9",
"4\n3 1 4 2"
],
"output": [
"115",
"51",
"16"
]
} | {
"input": [
"10\n3 1 4 1 5 9 2 11 5 3",
"6\n5 2 4 1 1 9",
"4\n1 1 4 2",
"10\n3 1 4 1 5 2 2 11 5 3",
"6\n5 2 4 1 1 15",
"4\n1 0 4 2",
"10\n3 1 4 1 5 2 2 11 5 4",
"6\n5 2 4 1 0 15",
"4\n1 0 2 2",
"10\n3 1 4 1 5 2 2 11 0 4",
"6\n5 2 4 0 0 15",
"4\n2 0 2 2",
"10\n5 1 4... |
p03118 World Tour Finals 2019 Open Contest - e | There is a very long bench. The bench is divided into M sections, where M is a very large integer.
Initially, the bench is vacant. Then, M people come to the bench one by one, and perform the following action:
* We call a section comfortable if the section is currently unoccupied and is not adjacent to any occupied s... | {
"input": [],
"output": []
} | {
"input": [
"5\nX--X-",
"20\n-X--X--X-X--X--X-X-X",
"100\nX-X-X-X-X-X-X-X-X-X--X-X-X-X-X-X-X-X-X-X-X-X-X-X-X--X--X-X-X-X--X--X-X-X--X-X-X--X-X--X--X-X--X-X-X-",
"5\nX-X-X",
"3\n---",
"1\nX"
],
"output": [
"0 0 1",
"0 0 183703705",
"0 0 435664291",
"500000004 0 833333337",
... | {
"input": [
"5\n-X--X",
"20\nX-X-X--X--X-X--X--X-",
"5\n-X-X-",
"20\n-X--X--X-X-----XXX-X",
"100\n-X-X-X--X-X--X--X-X--X-X-X--X-X-X--X--X-X-X-X--X--X-X-X-X-X-X-X-X-X-X-X-X-X-X-X--X-X-X-X-X-X-X-X-X-X",
"5\nX-X--",
"20\n-X.-X--X-X-----XXX-X",
"20\nX-XXX-----X-X--X-.X-",
"20\nX-XYX--... |
p03261 AtCoder Beginner Contest 109 - Shiritori | Takahashi is practicing shiritori alone again today.
Shiritori is a game as follows:
* In the first turn, a player announces any one word.
* In the subsequent turns, a player announces a word that satisfies the following conditions:
* That word is not announced before.
* The first character of that word is the same a... | {
"input": [],
"output": []
} | {
"input": [
"4\nhoge\nenglish\nhoge\nenigma",
"9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly",
"3\nabc\narc\nagc",
"8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa"
],
"output": [
"No",
"Yes",
"No",
"No"
]
} | {
"input": [
"4\nhoge\nenglish\nhnge\nenigma",
"9\nbasic\nc\npcp\nphp\npython\nnadesico\nocaml\nlua\nassembly",
"3\naac\narc\nagc",
"8\na\naa\naaa\naaaa\naaaaa\naaa`aa\naaa\naaaaaaa",
"4\nhoge\nenglish\nhnge\nemigma",
"9\nb`sic\nc\npcp\nphp\npython\nnadesico\nocaml\nlua\nassembly",
"3\naac... |
p03419 AtCoder Regular Contest 091 - Flip Flip and Flip...... | There is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region. The front and back sides of these cards can be distinguished, and initially every card faces up.
We will perform the following op... | {
"input": [],
"output": []
} | {
"input": [
"1 7",
"2 2",
"314 1592"
],
"output": [
"5",
"0",
"496080"
]
} | {
"input": [
"1 2",
"582 1592",
"0 0",
"582 932",
"0 -1",
"1018 932",
"1018 374",
"527 374",
"358 374",
"592 374",
"592 345",
"592 673",
"207 673",
"128 673",
"128 131",
"128 260",
"246 260",
"373 260",
"54 260",
"54 36",
"54 54",
... |
p03577 CODE FESTIVAL 2017 qual B - XXFESTIVAL | Rng is going to a festival.
The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer.
Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For ex... | {
"input": [],
"output": []
} | {
"input": [
"YAKINIKUFESTIVAL",
"CODEFESTIVALFESTIVAL",
"CODEFESTIVAL"
],
"output": [
"YAKINIKU",
"CODEFESTIVAL",
"CODE"
]
} | {
"input": [
"YAKINIJUFESTIVAL",
"CODEFESTIVALFERTIVAL",
"CODEFESTIVAM",
"LAVITSEFUJINIKAY",
"CPDEFESTIVAM",
"LAVITSEEUJINIKAY",
"CODEFESTIWALFESTIWAL",
"LAWITSEFLAWITSEFEDOC",
"BPDEFDSTIVBM",
"CODEFWSTIWALFESTIEAL",
"MBVITSDFEDPB",
"IAKINYJUEESTIVAL",
"COCEFWSTIWAL... |
p03734 AtCoder Regular Contest 073 - Simple Knapsack | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i.
You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W.
Your objective is to maximize the total value of the selected items.
Constraints
* 1 ≤ N ≤ 10... | {
"input": [],
"output": []
} | {
"input": [
"4 10\n1 100\n1 100\n1 100\n1 100",
"4 1\n10 100\n10 100\n10 100\n10 100",
"4 6\n2 1\n3 7\n4 10\n3 6",
"4 6\n2 1\n3 4\n4 10\n3 4"
],
"output": [
"400",
"0",
"13",
"11"
]
} | {
"input": [
"4 10\n1 100\n2 100\n1 100\n1 100",
"4 1\n10 100\n10 100\n10 101\n10 100",
"4 6\n2 1\n3 6\n4 10\n3 4",
"4 10\n1 000\n1 100\n1 100\n1 100",
"4 6\n2 1\n3 7\n4 10\n3 9",
"4 12\n2 1\n3 4\n4 10\n3 4",
"4 6\n2 1\n3 6\n4 8\n3 4",
"4 6\n2 1\n3 6\n4 10\n3 9",
"4 10\n1 100\n4 10... |
p03896 CODE FESTIVAL 2016 Relay (Parallel) - 3y3s Challenge | There are N persons, conveniently numbered 1 through N. They will take 3y3s Challenge for N-1 seconds.
During the challenge, each person must look at each of the N-1 other persons for 1 seconds, in some order.
If any two persons look at each other during the challenge, the challenge ends in failure.
Find the order i... | {
"input": [],
"output": []
} | {
"input": [
"2",
"7"
],
"output": [
"-1",
"2 3 4 5 6 7\n5 3 1 6 4 7\n2 7 4 1 5 6\n2 1 7 5 3 6\n1 4 3 7 6 2\n2 5 7 3 4 1\n2 6 1 4 5 3"
]
} | {
"input": [
"3",
"4",
"5",
"6",
"8",
"10",
"12",
"19",
"37",
"26",
"43",
"27",
"50",
"13",
"9",
"11",
"18",
"14",
"15",
"21",
"35",
"28",
"36",
"24",
"54",
"22",
"17",
"39",
"34",
"25",
"31",
... |
p00002 Digit Number | Write a program which computes the digit number of sum of two integers a and b.
Constraints
* 0 ≤ a, b ≤ 1,000,000
* The number of datasets ≤ 200
Input
There are several test cases. Each test case consists of two non-negative integers a and b which are separeted by a space in a line. The input terminates with EOF.
... | {
"input": [],
"output": []
} | {
"input": [
"5 7\n1 99\n1000 999"
],
"output": [
"2\n3\n4"
]
} | {
"input": [
"4 7\n1 99\n1000 999",
"10 10\n2 36\n1000 25",
"10 10\n2 3\n1000 6",
"0 1\n2 3\n1001 6",
"0 0\n3 0\n0101 6",
"1 1\n5 0\n0001 6",
"1 1\n5 0\n0001 9",
"2 0\n13 1\n1011 4",
"2 0\n13 1\n0011 4",
"0 -1\n0 0\n0010 7",
"0 -1\n0 0\n0111 7",
"-1 -1\n0 -1\n0111 14",
... |
p00134 Exit Survey | I conducted an exit poll of the shopping amount at a department store. Create a program that takes the shopping amount data as input, calculates the average shopping amount per person, and outputs it. The number of people surveyed shall be 100,000 or less, and the shopping amount per person shall not exceed 1 million y... | {
"input": [],
"output": []
} | {
"input": [
"6\n12300\n5600\n33800\n0\n26495\n52000"
],
"output": [
"21699"
]
} | {
"input": [
"6\n23426\n5600\n33800\n0\n26495\n52000",
"6\n23426\n5600\n33800\n0\n17519\n52000",
"6\n23426\n5600\n33800\n0\n14222\n52000",
"6\n23426\n5600\n33800\n0\n2007\n52000",
"6\n23426\n5600\n33800\n0\n2007\n80378",
"6\n23426\n5600\n33800\n0\n3681\n80378",
"6\n23426\n5600\n33800\n0\n3... |
p00267 The Lonely Girl's Lie | There is a game called Packet Monster. A game that catches, raises, fights and exchanges monsters, and is very popular all over Japan. Of course, in my class. That's why I also raise monsters so that I can play with everyone in this game, but sadly there is no opponent to play against. I'm not the type who is good at t... | {
"input": [],
"output": []
} | {
"input": [
"10\n4 9 1 9 5 9 2 3 2 1\n8 7 6 5 10 5 5 4 7 6\n5\n4 3 2 5 1\n4 4 4 4 4\n4\n4 1 3 2\n4 3 2 1\n0"
],
"output": [
"3\n1\nNA"
]
} | {
"input": [
"10\n4 9 1 9 5 9 2 3 2 1\n8 7 6 5 10 5 4 4 7 6\n5\n4 3 2 5 1\n4 4 4 4 4\n4\n4 1 3 2\n4 3 2 1\n0",
"10\n4 9 1 9 5 9 2 3 2 1\n8 7 6 5 10 5 4 4 7 6\n0\n4 3 2 5 1\n4 4 4 4 4\n4\n4 1 3 2\n4 3 2 1\n0",
"10\n4 9 1 9 5 9 2 3 2 1\n8 7 6 5 10 5 4 4 7 9\n0\n4 3 2 5 1\n4 4 4 4 4\n4\n4 1 3 2\n4 3 2 1\n0",... |
p00454 Paint Color | problem
Information I want to paint a rectangular veneer board to make a signboard for the promotion of the Olympic Games. Some rectangular masking tapes are pre-attached to the veneer board where I do not want to paint. We decided to paint each area with a different color. For example, in the case of Figure 5-1 we us... | {
"input": [],
"output": []
} | {
"input": [
"15 6\n10\n1 4 5 6\n2 1 4 5\n1 0 5 1\n6 1 7 5\n7 5 9 6\n7 0 9 2\n9 1 10 5\n11 0 14 1\n12 1 13 5\n11 5 14 6\n0 0"
],
"output": [
"5"
]
} | {
"input": [
"15 6\n10\n1 4 5 6\n2 1 4 5\n1 0 5 1\n6 1 7 5\n7 5 3 6\n7 0 9 2\n9 1 10 5\n11 0 14 1\n12 1 13 5\n11 5 14 6\n0 0",
"15 6\n10\n1 4 5 6\n2 1 0 5\n1 0 5 1\n6 1 7 5\n7 5 3 6\n7 0 9 2\n9 1 10 5\n11 0 14 1\n12 1 13 5\n11 5 14 6\n0 0",
"15 6\n10\n1 4 5 6\n2 1 4 5\n1 0 5 1\n6 1 7 5\n7 5 9 6\n7 0 18 2\... |
p00645 Mysterious Onslaught | In 2012, human beings have been exposed to fierce onslaught of unidentified mysterious extra-terrestrial creatures. We have exhaused because of the long war and can't regist against them any longer. Only you, an excellent wizard, can save us. Yes, it's time to stand up!
The enemies are dispatched to the earth with bei... | {
"input": [],
"output": []
} | {
"input": [
"5\n1 1 1 1 1\n1 0 0 0 1\n1 0 1 0 1\n1 0 0 0 1\n1 1 1 1 1\n3\n1 1 1\n1 1 1\n1 1 1\n5\n1 1 1 1 0\n1 1 1 1 0\n1 0 0 0 1\n0 1 1 1 1\n0 1 1 1 1\n0"
],
"output": [
"myonmyonmyon\nmyon\nmyonmyon"
]
} | {
"input": [
"5\n1 1 1 1 1\n1 0 0 0 1\n1 0 1 0 1\n1 0 0 0 1\n1 1 1 1 1\n3\n1 1 1\n1 1 1\n1 1 1\n5\n1 1 1 0 0\n1 1 1 1 0\n1 0 0 0 1\n0 1 1 1 1\n0 1 1 1 1\n0",
"5\n1 1 1 1 1\n1 0 0 0 1\n1 0 1 0 1\n1 0 0 0 1\n1 1 1 1 1\n3\n1 1 1\n1 1 1\n1 1 1\n5\n1 1 0 1 0\n1 1 1 1 0\n1 0 0 0 1\n0 1 1 1 1\n1 1 1 1 1\n0",
"5\... |
p00789 Square Coins | People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (= 172), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-credit coins, are available in Silverland.
There are four combinations of coins... | {
"input": [],
"output": []
} | {
"input": [
"2\n10\n30\n0"
],
"output": [
"1\n4\n27"
]
} | {
"input": [
"2\n10\n12\n0",
"2\n11\n3\n0",
"2\n16\n3\n0",
"2\n14\n3\n0",
"2\n10\n39\n0",
"2\n11\n6\n0",
"2\n17\n39\n0",
"2\n4\n1\n0",
"2\n2\n6\n0",
"2\n17\n37\n0",
"2\n0\n6\n0",
"2\n32\n1\n0",
"2\n32\n0\n0",
"2\n45\n0\n0",
"2\n85\n0\n0",
"2\n67\n0\n0",
... |
p00921 Don't Burst the Balloon | An open-top box having a square bottom is placed on the floor. You see a number of needles vertically planted on its bottom.
You want to place a largest possible spheric balloon touching the box bottom, interfering with none of the side walls nor the needles.
Java Specific: Submitted Java programs may not use "java.a... | {
"input": [],
"output": []
} | {
"input": [
"5 16\n70 66 40\n38 52 20\n40 35 10\n70 30 10\n20 60 10\n1 100\n54 75 200\n1 10\n90 10 1\n1 11\n54 75 200\n3 10\n53 60 1\n61 38 1\n45 48 1\n4 10\n20 20 10\n20 80 10\n80 20 10\n80 80 10\n0 0"
],
"output": [
"26.00000\n39.00000\n130.00000\n49.49777\n85.00000\n95.00000"
]
} | {
"input": [
"5 16\n70 66 40\n38 52 20\n40 35 10\n70 30 10\n20 60 10\n1 100\n54 75 200\n1 10\n90 14 1\n1 11\n54 75 200\n3 10\n53 60 1\n61 38 1\n45 48 1\n4 10\n20 20 10\n20 80 10\n80 20 10\n80 80 10\n0 0",
"5 19\n70 66 70\n38 52 20\n40 35 10\n70 30 10\n20 60 10\n1 100\n54 75 200\n1 10\n90 14 1\n1 11\n54 75 200... |
p01054 String Conversion | Problem
Jennifer and Marian presented Carla with the string S.
However, Carla is not happy to receive the string S.
I wanted the string T.
The three decided to work together to change the string S to the string T.
Jennifer first sorts the letters in any order.
Marian then exchanges the lowercase letters of the two ... | {
"input": [],
"output": []
} | {
"input": [
"3\nabc\nxyz",
"5\naaabb\nxyxyz"
],
"output": [
"0",
"1"
]
} | {
"input": [
"3\ncba\nxyz",
"5\naaabb\nxywyz",
"3\ncbb\nxyz",
"5\naaacb\nxywyz",
"3\ncbb\nzyx",
"5\nbcaaa\nxywyz",
"3\ndbb\nzyx",
"5\nbcaaa\nxywyy",
"3\ndbb\nxyz",
"5\nbcaba\nxywyy",
"3\ndbb\nzyy",
"5\ncbaba\nxywyy",
"5\ncbbba\nxywyy",
"5\ncbbba\nyywyx",
"5\... |
p01186 TV Watching | You are addicted to watching TV, and you watch so many TV programs every day. You have been in trouble recently: the airtimes of your favorite TV programs overlap.
Fortunately, you have both a TV and a video recorder at your home. You can therefore watch a program on air while another program (on a different channel) ... | {
"input": [],
"output": []
} | {
"input": [
"4\nOmoikkiriTV 12:00 13:00 5 1\nWaratteIitomo 12:00 13:00 10 2\nWatarusekennhaOnibakari 20:00 21:00 10 3\nSuzumiyaharuhiNoYuuutsu 23:00 23:30 100 40\n5\na 0:00 1:00 100 100\nb 0:00 1:00 101 101\nc 0:00 1:00 102 102\nd 0:00 1:00 103 103\ne 0:00 1:00 104 104\n0"
],
"output": [
"121\n207"
]
} | {
"input": [
"4\nOmoikkiriTV 12:00 13:00 5 1\nWaratteIitomo 12:00 13:00 10 2\nWatarusekennhaOnibakari 20:00 21:00 10 3\nSuzumiyaharuhiNoYuuutsu 23:00 23:30 100 40\n5\na 0:00 1:00 100 100\nb 0:00 1:00 101 101\nc 0:00 1:00 102 102\nc 0:00 1:00 103 103\ne 0:00 1:00 104 104\n0",
"4\nOmoikkiriTV 12:00 13:00 5 1\nW... |
p01323 Compile | Masa Kita, who entered the University of Tokyo, joined a circle called TSG (University of Tokyo Super Gamers).
This circle exhibits games at the Komaba Festival every year, and Masa Kita decided to create and display the games as well.
The game created by Kitamasa is a common falling block puzzle game such as the fol... | {
"input": [],
"output": []
} | {
"input": [
"3\n......\n......\n......\n......\n......\n......\n......\n......\n.RGB..\nRGOP..\nRGBPB.\nRGBPP.\nGBRGYP\nGBRRYP\nBGGRBB\nBPRGYY\nGGPRRY\nBYPPRB\nYGGGPB\nGYYYPR\nYRBRBR\nYBRBRB\nBRBRBR\nBRBRBR\n......\n......\n......\n......\n......\n......\n......\n......\n......\n......\n..OO..\n..OO.."
],
"o... | {
"input": [
"3\n......\n......\n......\n......\n......\n......\n......\n......\n.RGB..\nRGOP..\nRGBPB.\nRGBPP.\nGBRGYP\nGBRRYP\nBGGRBB\nBPRGYY\nGGPRRY\nBYPPRB\nYGGGPB\nRPYYYG\nYRBRBR\nYBRBRB\nBRBRBR\nBRBRBR\n......\n......\n......\n......\n......\n......\n......\n......\n......\n......\n..OO..\n..OO..",
"3\n... |
p01491 RabbitLunch | Example
Input
2 3 1 3 1 0
Output
2 | {
"input": [],
"output": []
} | {
"input": [
"2 3 1 3 1 0"
],
"output": [
"2"
]
} | {
"input": [
"2 3 1 3 1 1",
"1 4 1 3 0 1",
"1 4 1 3 0 2",
"4 3 1 3 0 1",
"2 3 1 0 0 1",
"4 3 0 5 0 3",
"8 3 0 5 0 3",
"8 5 0 5 0 3",
"4 73 0 1 1 0",
"8 9 0 7 0 3",
"4 73 0 2 1 0",
"8 11 0 7 0 3",
"4 12 1 0 0 1",
"4 37 1 0 1 0",
"8 5 0 5 0 5",
"6 11 0 7 0... |
p01653 Magical Bridges | Problem Statement
A magician lives in a country which consists of N islands and M bridges. Some of the bridges are magical bridges, which are created by the magician. Her magic can change all the lengths of the magical bridges to the same non-negative integer simultaneously.
This country has a famous 2-player race ga... | {
"input": [],
"output": []
} | {
"input": [
"3 2 2 3 1\n1 2 1\n1 3 2\n4 3 1 4 2\n2 1 3\n2 3 x\n4 3 x\n0 0 0 0 0"
],
"output": [
"1\n1"
]
} | {
"input": [
"3 2 2 3 1\n1 2 1\n1 3 2\n4 3 1 4 2\n2 1 4\n2 3 x\n4 3 x\n0 0 0 0 0",
"3 2 2 3 1\n1 2 1\n1 3 2\n4 3 1 4 2\n2 1 5\n2 3 x\n4 3 x\n0 0 0 0 0",
"3 2 2 3 1\n1 2 1\n1 3 1\n4 3 1 4 2\n2 1 3\n2 3 x\n4 3 x\n0 0 0 0 0",
"3 2 2 3 1\n1 2 2\n1 3 2\n4 3 1 4 2\n2 1 4\n2 3 x\n4 3 x\n0 0 0 0 0",
"3 2 ... |
p01804 Falling Block Puzzle | Falling Block Puzzle
Block drop
You are playing a falling block puzzle. As shown in the figure below, the field of this puzzle has a shape in which cubic cells are arranged in 2 squares x 2 squares in each row, and the rows are infinitely arranged on the top.
<image>
Each cell either has one block that fits snugly ... | {
"input": [],
"output": []
} | {
"input": [
"1 1\n##\n#.\n..\n..\n#.\n..\n1 1\n.#\n#.\n#.\n..\n..\n.#\n2 2\n##\n#.\n##\n#.\n..\n.#\n##\n#.\n#.\n..\n#.\n..\n1 3\n#.\n..\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n10 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#.... | {
"input": [
"1 1\n##\n#.\n..\n..\n#.\n..\n1 1\n.#\n#.\n#.\n..\n..\n.#\n2 2\n##\n#.\n##\n#.\n..\n.#\n##\n#.\n.#\n..\n#.\n..\n1 3\n#.\n..\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n10 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#.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.