File size: 9,359 Bytes
394b215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
[
  {
    "contest_date": "2025-04-06T00:00:00",
    "difficulty": "hard",
    "hidden_tests": [
      {
        "input": "4564\n253140288 293305612 750791934 354530934 444237786 846682985 925663544 35056",
        "output_len": 14
      },
      {
        "input": "63\n55449 10966 48278 28854 34199 76708 21835 56522 25159 46992 15075 8370 92014 ",
        "output_len": 8
      },
      {
        "input": "52\n68827 19447 33671 78983 20435 49677 76409 38586 94127 92586 61661 8698 11095 ",
        "output_len": 8
      }
    ],
    "problem_id": "arc196_a",
    "public_tests": [
      {
        "input": "4\n1 2 5 3",
        "output": "5",
        "testtype": "stdin"
      },
      {
        "input": "7\n3 1 4 1 5 9 2",
        "output": "14",
        "testtype": "stdin"
      },
      {
        "input": "5\n1 1 1 1 1",
        "output": "0",
        "testtype": "stdin"
      }
    ],
    "source": "livecodebench/code_generation_lite:v6",
    "starter_code": "",
    "statement": "You are given a length-N sequence A = (A_1, A_2, \\ldots, A_N).\nYou will repeatedly perform the following operation until the sequence has length at most 1: choose two adjacent numbers and remove both from the sequence.\nThe score obtained in one operation is the absolute difference of the two chosen numbers.\nFind the maximum possible total score obtained.\n\nInput\n\nThe input is given from Standard Input in the following format:\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the maximum possible total score ob",
    "title": "Adjacent Delete"
  },
  {
    "contest_date": "2025-03-22T00:00:00",
    "difficulty": "hard",
    "hidden_tests": [
      {
        "input": "ZGBZMOLYGOLZUCBBPIAQVSSGHCYUYQWQNQJDENSNCDNCDNYEXAZONVNAPKXICLCDLWALLFAHLCTEGAGV",
        "output_len": 166
      },
      {
        "input": "UOMWVSNBMWSNYVWBFOCIWFOQPRTYABPKJOBZZNGRUCXEAMVNKAGAWYAVQTDGDTUG",
        "output_len": 128
      },
      {
        "input": "XCU",
        "output_len": 6
      }
    ],
    "problem_id": "abc398_f",
    "public_tests": [
      {
        "input": "ABC",
        "output": "ABCBA",
        "testtype": "stdin"
      },
      {
        "input": "Z",
        "output": "Z",
        "testtype": "stdin"
      },
      {
        "input": "TREE",
        "output": "TREERT",
        "testtype": "stdin"
      }
    ],
    "source": "livecodebench/code_generation_lite:v6",
    "starter_code": "",
    "statement": "Find one shortest palindrome that has S as its prefix.\n\nInput\n\nThe input is given from Standard Input in the following format:\nS\n\nOutput\n\nPrint the answer.\r\nIf multiple solutions exist, any of them is accepted.\n\nConstraints\n\n\n- S is a string of length between 1 and 500000, inclusive, consisting of uppercase English letters.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nABCBA\r\n\nABCBA is a shortest palindrome that has S= ABC as its prefix.\n\nSample Input 2\n\nZ\n\nSample Output 2\n\nZ\r\n\nZ is a shortest palindro",
    "title": "ABCBA"
  },
  {
    "contest_date": "2025-04-05T00:00:00",
    "difficulty": "easy",
    "hidden_tests": [
      {
        "input": "286",
        "output_len": 3
      },
      {
        "input": "20",
        "output_len": 3
      },
      {
        "input": "26",
        "output_len": 3
      }
    ],
    "problem_id": "abc400_a",
    "public_tests": [
      {
        "input": "10",
        "output": "40",
        "testtype": "stdin"
      },
      {
        "input": "11",
        "output": "-1",
        "testtype": "stdin"
      },
      {
        "input": "400",
        "output": "1",
        "testtype": "stdin"
      }
    ],
    "source": "livecodebench/code_generation_lite:v6",
    "starter_code": "",
    "statement": "In the ceremony commemorating ABC400, we want to arrange 400 people in a rectangular formation of A rows and B columns without any gaps.\nYou are given a positive integer A. Print the value of a positive integer B for which such an arrangement is possible. If there is no such positive integer B, print -1.\n\nInput\n\nThe input is given from Standard Input in the following format:\nA\n\nOutput\n\nPrint the value of B or -1 as specified by the problem statement.\n\nConstraints\n\n\n- A is an integer between 1 an",
    "title": "ABC400 Party"
  },
  {
    "contest_date": "2025-04-06T00:00:00",
    "difficulty": "hard",
    "hidden_tests": [
      {
        "input": "118\nWWWWBWBWWBWBWWWWWWWBWBWWBBBBBBBWBBWBBWBWBWBWBWWWBBBWBWBWBWWBWWWWWWBBWWBBWBWB",
        "output_len": 2
      },
      {
        "input": "108\nBBBWWBWBWWBWBBWWBWWBWBWWBWWWWBWWWBWBWBWWWBBWWWBBWWWBWBBBWWWWBBWBWBBBWBWWWBWB",
        "output_len": 2
      },
      {
        "input": "8\nWWBWBWWBWBBBWWBB",
        "output_len": 2
      }
    ],
    "problem_id": "arc196_c",
    "public_tests": [
      {
        "input": "2\nBWBW",
        "output": "1",
        "testtype": "stdin"
      },
      {
        "input": "4\nBWWBWBWB",
        "output": "0",
        "testtype": "stdin"
      },
      {
        "input": "9\nBWWBWBBBWWBWBBWWBW",
        "output": "240792",
        "testtype": "stdin"
      }
    ],
    "source": "livecodebench/code_generation_lite:v6",
    "starter_code": "",
    "statement": "There is a directed graph with 2N vertices and 2N-1 edges.\r\nThe vertices are numbered 1, 2, \\ldots, 2N, and the i-th edge is a directed edge from vertex i to vertex i+1.\nYou are given a length-2N string S = S_1 S_2 \\ldots S_{2N} consisting of N Ws and N Bs.\r\nVertex i is colored white if S_i is W, and black if S_i is B.\nYou will perform the following series of operations:\n\n- Partition the 2N vertices into N pairs, each consisting of one white vertex and one black vertex.\n- For each pair, add a di",
    "title": "Strongly Connected"
  },
  {
    "contest_date": "2025-04-05T00:00:00",
    "difficulty": "medium",
    "hidden_tests": [
      {
        "input": "2 2\n..\n..\n2 2 2 1",
        "output_len": 2
      },
      {
        "input": "8 5\n....#\n...#.\n.##.#\n###.#\n##...\n###.#\n.#..#\n.##..\n4 4 2 5",
        "output_len": 2
      },
      {
        "input": "6 4\n..##\n...#\n##..\n.#..\n..#.\n...#\n4 1 1 1",
        "output_len": 2
      }
    ],
    "problem_id": "abc400_d",
    "public_tests": [
      {
        "input": "10 10\n..........\n#########.\n#.......#.\n#..####.#.\n##....#.#.\n#####.#.#.\n.##.#.#.#.\n###.#.#.#.\n###.#.#.#.\n#.....#...\n1 1 7 1",
        "output": "1",
        "testtype": "stdin"
      },
      {
        "input": "2 2\n.#\n#.\n1 1 2 2",
        "output": "1",
        "testtype": "stdin"
      },
      {
        "input": "1 3\n.#.\n1 1 1 3",
        "output": "1",
        "testtype": "stdin"
      },
      {
        "input": "20 20\n####################\n##...##....###...###\n#.....#.....#.....##\n#..#..#..#..#..#..##\n#..#..#....##..#####\n#.....#.....#..#####\n#.....#..#..#..#..##\n#..#..#.....#.....##\n#..#..#....###...###\n####################\n####################\n##..#..##...###...##\n##..#..#.....#.....#\n##..#..#..#..#..#..#\n##..#..#..#..#..#..#\n##.....#..#..#..#..#\n###....#..#..#..#..#\n#####..#.....#.....#\n#####..##...###...##\n####################\n3 3 18 18",
        "output": "3",
        "testtype": "stdin"
      }
    ],
    "source": "livecodebench/code_generation_lite:v6",
    "starter_code": "",
    "statement": "Takahashi is about to go buy eel at a fish shop.\nThe town where he lives is divided into a grid of H rows and W columns. Each cell is either a road or a wall.\r\nLet us denote the cell at the i-th row from the top (1\\leq i \\leq H) and the j-th column from the left (1\\leq j \\leq W) as cell (i,j).\r\nInformation about each cell is given by H strings S_1,S_2,\\ldots,S_H, each of length W. Specifically, if the j-th character of S_i (1\\leq i \\leq H,1\\leq j\\leq W) is ., cell (i,j) is a road; if it is #, ce",
    "title": "Takahashi the Wall Breaker"
  },
  {
    "contest_date": "2025-03-22T00:00:00",
    "difficulty": "hard",
    "hidden_tests": [
      {
        "input": "5 4\n1 2\n1 3\n1 4\n1 5",
        "output_len": 10
      },
      {
        "input": "128 2871\n1 68\n24 62\n13 107\n21 41\n6 89\n10 106\n24 88\n25 53\n21 44\n2 72\n2 95\n29 79\n1",
        "output_len": 10
      },
      {
        "input": "6 5\n1 6\n3 6\n2 6\n4 6\n5 6",
        "output_len": 10
      }
    ],
    "problem_id": "abc398_g",
    "public_tests": [
      {
        "input": "4 3\n1 2\n2 3\n3 4",
        "output": "Aoki",
        "testtype": "stdin"
      },
      {
        "input": "4 2\n1 2\n3 4",
        "output": "Takahashi",
        "testtype": "stdin"
      },
      {
        "input": "9 5\n2 9\n2 3\n4 6\n5 7\n1 8",
        "output": "Aoki",
        "testtype": "stdin"
      }
    ],
    "source": "livecodebench/code_generation_lite:v6",
    "starter_code": "",
    "statement": "You are given a simple undirected graph with N vertices and M edges, with vertices labeled 1 to N and edges labeled 1 to M. The i-th edge connects vertices U_i and V_i. Initially, G does not contain an odd cycle.\nTakahashi and Aoki will play a game using this graph G. With Aoki going first, they take turns performing the following operation:\n\n- Choose a pair of integers (i,j) with 1 \\leq i < j \\leq N that satisfies both of the following conditions, then add an edge connecting vertices i and j to",
    "title": "Not Only Tree Game"
  }
]