problem_id int64 0 1.52k | problem_name stringlengths 5 112 | description stringlengths 209 6.47k | lang stringclasses 4
values | code stringlengths 7 95.5k | status stringclasses 3
values | passed int64 0 24 | total int64 0 25 | error stringclasses 567
values | failures stringlengths 2 2k | source stringclasses 5
values | difficulty stringclasses 13
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
6 | 1012_E. Cycle sort | You are given an array of n positive integers a_1, a_2, ..., a_n. You can perform the following operation any number of times: select several distinct indices i_1, i_2, ..., i_k (1 ≤ i_j ≤ n) and move the number standing at the position i_1 to the position i_2, the number at the position i_2 to the position i_3, ..., t... | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 300000;
map<int, int> mapa;
map<pair<int, int>, vector<int>> pos;
vector<int> g[MAXN];
int ptr[MAXN];
int used[MAXN];
void euler(int v, vector<int> &res) {
used[v] = true;
for (; ptr[v] < (int)(g[v]).size();) {
++ptr[v];
int u = g[v][ptr[v] - 1]... | partial | 11 | 23 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n5\n1 4 2 3 5", "got": "1\n5\n5 2 3 4 1"}, {"idx": 6, "reason": "wrong_answer", "expected": "1\n2\n2 5", "got": "1\n2\n5 2"}, {"idx": 9, "reason": "wrong_answer", "expected": "1\n5\n1 3 5 2 4", "got": "1\n5\n3 5 2 4 1"}, {"idx": 10, "reason": "wrong_answer", "expecte... | codeforces | E | |
6 | 1012_E. Cycle sort | You are given an array of n positive integers a_1, a_2, ..., a_n. You can perform the following operation any number of times: select several distinct indices i_1, i_2, ..., i_k (1 ≤ i_j ≤ n) and move the number standing at the position i_1 to the position i_2, the number at the position i_2 to the position i_3, ..., t... | cpp | #include <bits/stdc++.h>
using namespace std;
template <class BidirIt>
BidirIt prev(BidirIt it,
typename iterator_traits<BidirIt>::difference_type n = 1) {
advance(it, -n);
return it;
}
template <class ForwardIt>
ForwardIt next(ForwardIt it,
typename iterator_traits<ForwardIt>::differenc... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_vr7yfsbp/tmpq4pans1q.cpp: In function ‘void dfs(int)’:
/tmp/sbx_vr7yfsbp/tmpq4pans1q.cpp:31:3: error: reference to ‘visit’ is ambiguous
31 | visit[u] = true;
| ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
from /tmp/sbx_vr7yfsbp/... | [] | codeforces | E |
6 | 1012_E. Cycle sort | You are given an array of n positive integers a_1, a_2, ..., a_n. You can perform the following operation any number of times: select several distinct indices i_1, i_2, ..., i_k (1 ≤ i_j ≤ n) and move the number standing at the position i_1 to the position i_2, the number at the position i_2 to the position i_3, ..., t... | java | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.io.IOException;
import java.util.Random;
import java.util.ArrayList;
import java.io.UncheckedIOException;
import java.util.List;
import java.io.Closeable;
import java.io... | partial | 11 | 23 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n5\n1 4 2 3 5", "got": "1\n5\n5 2 3 4 1"}, {"idx": 6, "reason": "wrong_answer", "expected": "1\n2\n2 5", "got": "1\n2\n5 2"}, {"idx": 9, "reason": "wrong_answer", "expected": "1\n5\n1 3 5 2 4", "got": "1\n5\n3 5 2 4 1"}, {"idx": 10, "reason": "wrong_answer", "expecte... | codeforces | E | |
6 | 1012_E. Cycle sort | You are given an array of n positive integers a_1, a_2, ..., a_n. You can perform the following operation any number of times: select several distinct indices i_1, i_2, ..., i_k (1 ≤ i_j ≤ n) and move the number standing at the position i_1 to the position i_2, the number at the position i_2 to the position i_3, ..., t... | java | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
public class E {
int[] sorted(int[] a) {
a = a.clone();
for (int i = 0; i < a.length; i++) {
int j = rand(0, i);
int tmp = a[i];
a[i] = a[j];
a[j] = tmp;
}
return a;
}
void solve(int[] a, int s) {
int n = a.... | partial | 19 | 23 | [{"idx": 13, "reason": "wrong_answer", "expected": "2\n2\n1 5\n3\n2 3 4", "got": "2\n3\n2 3 4\n2\n1 5"}, {"idx": 15, "reason": "wrong_answer", "expected": "2\n3\n1 5 2\n2\n3 4", "got": "2\n2\n3 4\n3\n1 5 2"}, {"idx": 21, "reason": "wrong_answer", "expected": "2\n2\n1 2\n2\n3 5", "got": "2\n2\n3 5\n2\n1 2"}, {"idx": 22,... | codeforces | E | |
6 | 1012_E. Cycle sort | You are given an array of n positive integers a_1, a_2, ..., a_n. You can perform the following operation any number of times: select several distinct indices i_1, i_2, ..., i_k (1 ≤ i_j ≤ n) and move the number standing at the position i_1 to the position i_2, the number at the position i_2 to the position i_3, ..., t... | java | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Random;
import java.util.ArrayList;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
... | partial | 11 | 23 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n5\n1 4 2 3 5", "got": "1\n5\n5 2 3 4 1"}, {"idx": 6, "reason": "wrong_answer", "expected": "1\n2\n2 5", "got": "1\n2\n5 2"}, {"idx": 9, "reason": "wrong_answer", "expected": "1\n5\n1 3 5 2 4", "got": "1\n5\n3 5 2 4 1"}, {"idx": 10, "reason": "wrong_answer", "expecte... | codeforces | E | |
7 | 1037_E. Trips | There are n persons who initially don't know each other. On each morning, two of them, who were not friends before, become friends.
We want to plan a trip for every evening of m days. On each trip, you have to select a group of people that will go on the trip. For every person, one of the following should hold:
* ... | python2 | import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')
n,m,k = m... | all_fail | 0 | 5 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_6cms73fv/tmp5pnk0jzx.py\", line 12, in <module>\n n,m,k = map(int,raw_input().split(\" \"))\nValueError: invalid literal for int() with base 10: ''\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_er... | codeforces | E | |
11 | 1149_E. Election Promises | In Byteland, there are two political parties fighting for seats in the Parliament in the upcoming elections: Wrong Answer Party and Time Limit Exceeded Party. As they want to convince as many citizens as possible to cast their votes on them, they keep promising lower and lower taxes.
There are n cities in Byteland, co... | java |
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class CF1149E {
public static void main(String[] args) throws Exception {
... | all_fail | 0 | 18 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.io.FileNotFoundException: D:\\DATABASE\\TESTCASE\\Code.in (No such file or directory)\n\tat java.base/java.io.FileInputStream.open0(Native Method)\n\tat java.base/java.io.File", "stdout_tail": ""}, {"idx": 1, "reason": "runtime... | codeforces | E | |
16 | 1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | python3 | import io
import os
from collections import Counter, defaultdict, deque, namedtuple
# From: https://github.com/cheran-senthil/PyRival/blob/master/pyrival/data_structures/SegmentTree.py
class SegmentTree:
def __init__(self, data, default=0, func=max):
"""initialize the segment tree with data"""
sel... | all_fail | 0 | 3 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_xvqmjrsz/tmpji01jh19.py\", line 129, in <module>\n (N,) = [int(x) for x in input().split()]\n ^^^^\nValueError: not enough values to unpack (expec", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_er... | codeforces | F | |
18 | 1354_F. Summoning Minions | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.
Polycarp can summon n different minions. The initial power level of the i-th minion is a_i, and when it is summoned, all previously summoned minions' power levels are increased by b_i. The minions c... | cpp | #include <bits/stdc++.h>
using namespace std;
struct Edge {
long long to, dis, next, cost;
} edge[24050];
long long num = -1;
bool vis[10010];
long long mincost;
long long pre[10010], head[10010], cost[10010], last[10010], flow[10010], n, k,
a[110], b[110], s, t, maxflow;
long long to[110];
void add(long long f, ... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n5 3 -3 4 -4 1 -1 2\n3\n1 -1 2\n5\n5 4 3 2 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n5 3 -3 4 -4 1 -1 2\n3\n1 -1 2\n5\n5 4 3 2 1"}] | codeforces | F | |
18 | 1354_F. Summoning Minions | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.
Polycarp can summon n different minions. The initial power level of the i-th minion is a_i, and when it is summoned, all previously summoned minions' power levels are increased by b_i. The minions c... | cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
void read(int &val) {
int x = 0;
int bz = 1;
char c;
for (c = getchar(); (c < '0' || c > '9') && c != '-'; c = getchar())
;
if (c == '-') {
bz = -1;
c = getchar();
}
for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n5 1 -1 3 -3 4 -4 2\n1\n2\n5\n5 4 3 2 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n5 1 -1 3 -3 4 -4 2\n1\n2\n5\n5 4 3 2 1"}] | codeforces | F | |
18 | 1354_F. Summoning Minions | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.
Polycarp can summon n different minions. The initial power level of the i-th minion is a_i, and when it is summoned, all previously summoned minions' power levels are increased by b_i. The minions c... | cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
int solve() {
int n, k;
cin >> n >> k;
vector<pair<pair<int, int>, int>> arr(n);
for (int i = 0; i < n; i++)
cin >> arr[i].first.second >> arr[i].first.first, arr[i].second = i + 1;
sort(arr.begin(), arr.end());
vector<int> a(n), b(n);
... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n2 1 -1 3 -3 4 -4 5\n3\n1 -1 2\n5\n5 4 3 2 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n2 1 -1 3 -3 4 -4 5\n3\n1 -1 2\n5\n5 4 3 2 1"}] | codeforces | F | |
18 | 1354_F. Summoning Minions | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.
Polycarp can summon n different minions. The initial power level of the i-th minion is a_i, and when it is summoned, all previously summoned minions' power levels are increased by b_i. The minions c... | java | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.stream.IntStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.s... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n2 1 -1 3 -3 4 -4 5\n3\n1 -1 2\n5\n5 4 3 2 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n2 1 -1 3 -3 4 -4 5\n3\n1 -1 2\n5\n5 4 3 2 1"}] | codeforces | F | |
18 | 1354_F. Summoning Minions | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.
Polycarp can summon n different minions. The initial power level of the i-th minion is a_i, and when it is summoned, all previously summoned minions' power levels are increased by b_i. The minions c... | python3 | from sys import stdin, gettrace
from heapq import nlargest
if not gettrace():
def input():
return next(stdin)[:-1]
# def input():
# return stdin.buffer.readline()
INF = int(10E10)
def main():
def solve():
n, k = map(int, input().split())
mm = []
for i in range(1,n+1):
... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n2 1 -1 3 -3 4 -4 5\n3\n1 -1 2\n5\n5 4 3 2 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n2 1 -1 3 -3 4 -4 5\n3\n1 -1 2\n5\n5 4 3 2 1"}] | codeforces | F | |
18 | 1354_F. Summoning Minions | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.
Polycarp can summon n different minions. The initial power level of the i-th minion is a_i, and when it is summoned, all previously summoned minions' power levels are increased by b_i. The minions c... | java | /**
* @author egaeus
* @mail sebegaeusprogram@gmail.com
* @veredict
* @url
* @category
* @date
**/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static java.lang.Integer.parseInt;
public class ... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n5 4 -4 3 -3 1 -1 2\n3\n1 -1 2\n5\n5 4 3 2 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n5 4 -4 3 -3 1 -1 2\n3\n1 -1 2\n5\n5 4 3 2 1"}] | codeforces | F | |
18 | 1354_F. Summoning Minions | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.
Polycarp can summon n different minions. The initial power level of the i-th minion is a_i, and when it is summoned, all previously summoned minions' power levels are increased by b_i. The minions c... | python3 | from operator import itemgetter
import sys
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(r... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n5 1 -1 3 -3 4 -4 2\n3\n1 -1 2\n5\n5 4 3 2 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n5 1 -1 3 -3 4 -4 2\n3\n1 -1 2\n5\n5 4 3 2 1"}] | codeforces | F | |
18 | 1354_F. Summoning Minions | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.
Polycarp can summon n different minions. The initial power level of the i-th minion is a_i, and when it is summoned, all previously summoned minions' power levels are increased by b_i. The minions c... | python3 | def read_int():
return int(input())
def read_ints():
return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
n, k = read_ints()
p = []
for i in range(n):
ai, bi = read_ints()
p.append((bi, ai, i + 1))
p.sort()
dp = [[0 for j in range(k + 1)] for i in ... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n2 1 -1 3 -3 4 -4 5\n3\n1 -1 2\n5\n5 4 3 2 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "8\n2 3 -3 4 -4 1 -1 5\n3\n1 -1 2\n5\n5 4 3 2 1", "got": "8\n2 1 -1 3 -3 4 -4 5\n3\n1 -1 2\n5\n5 4 3 2 1"}] | codeforces | F | |
19 | 1374_E1. Reading Books (easy version) | Easy and hard versions are actually different problems, so read statements of both problems completely and carefully.
Summer vacation has started so Alice and Bob want to play and joy, but... Their mom doesn't think so. She says that they have to read some amount of books before all entertainments. Alice and Bob will ... | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
int n, k, a, b;
long long t;
vector<long long> ve[2][2];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> k;
for (int i = (0); i < (n); i++) {
cin >> t >> a >> b;
... | partial | 15 | 18 | [{"idx": 12, "reason": "runtime_error", "rc": -11, "stderr": "", "stdout_tail": ""}, {"idx": 14, "reason": "runtime_error", "rc": -11, "stderr": "", "stdout_tail": ""}, {"idx": 16, "reason": "runtime_error", "rc": -11, "stderr": "", "stdout_tail": ""}] | codeforces | E | |
19 | 1374_E1. Reading Books (easy version) | Easy and hard versions are actually different problems, so read statements of both problems completely and carefully.
Summer vacation has started so Alice and Bob want to play and joy, but... Their mom doesn't think so. She says that they have to read some amount of books before all entertainments. Alice and Bob will ... | python3 | import sys
input=sys.stdin.readline
f=lambda :list(map(int, input().strip('\n').split()))
n, k=f()
_11=[]
_01=[]
_10=[]
for _ in range(n):
t, a, b=f()
if a and b:
_11.append(t)
elif a:
_10.append(t)
elif b:
_01.append(t)
_01.sort(); _10.sort(); _11.sort()
for i in range(1, len(_01)):
_01[i]+=_01[i-1]
for i ... | partial | 8 | 18 | [{"idx": 8, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_mw2w0qth/tmpc2xg5tth.py\", line 5, in <module>\n n, k=f()\n ^^^^\nValueError: too many values to unpack (expected 2)\n", "stdout_tail": ""}, {"idx": 9, "reason": "runtime_error", "rc": 1, "stderr": "Tr... | codeforces | E | |
19 | 1374_E1. Reading Books (easy version) | Easy and hard versions are actually different problems, so read statements of both problems completely and carefully.
Summer vacation has started so Alice and Bob want to play and joy, but... Their mom doesn't think so. She says that they have to read some amount of books before all entertainments. Alice and Bob will ... | cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INFLL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
vector<int> alice, bobo, osdois;
for (int i = 0; i < n; i++) {
bool a, b;... | partial | 13 | 18 | [{"idx": 8, "reason": "wrong_answer", "expected": "-1", "got": "4"}, {"idx": 10, "reason": "wrong_answer", "expected": "-1", "got": "3"}, {"idx": 12, "reason": "wrong_answer", "expected": "-1", "got": "5"}, {"idx": 15, "reason": "wrong_answer", "expected": "-1", "got": "2"}, {"idx": 16, "reason": "wrong_answer", "expec... | codeforces | E | |
19 | 1374_E1. Reading Books (easy version) | Easy and hard versions are actually different problems, so read statements of both problems completely and carefully.
Summer vacation has started so Alice and Bob want to play and joy, but... Their mom doesn't think so. She says that they have to read some amount of books before all entertainments. Alice and Bob will ... | java | import java.io.*;
import java.util.*;
public class Codeforces
{
public static void main(String args[])throws Exception
{
BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
String s[]=bu.readLine().split(" ");
int n=Integ... | partial | 13 | 18 | [{"idx": 8, "reason": "wrong_answer", "expected": "-1", "got": "26"}, {"idx": 9, "reason": "wrong_answer", "expected": "-1", "got": "59"}, {"idx": 12, "reason": "wrong_answer", "expected": "-1", "got": "173"}, {"idx": 13, "reason": "wrong_answer", "expected": "-1", "got": "59"}, {"idx": 17, "reason": "wrong_answer", "e... | codeforces | E | |
19 | 1374_E1. Reading Books (easy version) | Easy and hard versions are actually different problems, so read statements of both problems completely and carefully.
Summer vacation has started so Alice and Bob want to play and joy, but... Their mom doesn't think so. She says that they have to read some amount of books before all entertainments. Alice and Bob will ... | python3 | from collections import deque
n, k = map(int, input().split())
onla = []
onlb = []
both = []
for i in range(n):
a, b, c = map(int, input().split())
if b == 1 and c == 1:
both.append(a)
elif c == 1:
onlb.append(a)
elif b == 1:
onla.append(a)
if len(both) + len(onla) < k or len(bot... | partial | 8 | 18 | [{"idx": 8, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_s7fci9gq/tmplj0ml0by.py\", line 2, in <module>\n n, k = map(int, input().split())\n ^^^^\nValueError: too many values to unpack (expected 2)\n", "stdout_tail": ""}, {"idx": 9, "reason": "runtime_error"... | codeforces | E | |
19 | 1374_E1. Reading Books (easy version) | Easy and hard versions are actually different problems, so read statements of both problems completely and carefully.
Summer vacation has started so Alice and Bob want to play and joy, but... Their mom doesn't think so. She says that they have to read some amount of books before all entertainments. Alice and Bob will ... | python3 | class Book:
def __init__(self, time, for_alice, for_bob):
self.time = time
self.for_alice = bool(for_alice)
self.for_bob = bool(for_bob)
self.status = ('A' if self.for_alice else '') + ('B' if self.for_bob else '')
def get(li, i):
try:
return li[i].time
except Index... | partial | 8 | 18 | [{"idx": 8, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_e15ot9du/tmpijq2uvis.py\", line 16, in <module>\n n, k = map(int, input().split())\n ^^^^\nValueError: too many values to unpack (expected 2)\n", "stdout_tail": ""}, {"idx": 9, "reason": "runtime_error... | codeforces | E | |
19 | 1374_E1. Reading Books (easy version) | Easy and hard versions are actually different problems, so read statements of both problems completely and carefully.
Summer vacation has started so Alice and Bob want to play and joy, but... Their mom doesn't think so. She says that they have to read some amount of books before all entertainments. Alice and Bob will ... | java | import java.util.*;
public class readingBooks {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int k = input.nextInt();
ArrayList<Integer>[] arr = new ArrayList[4];
for(int i = 0; i < 4; i++){
arr[i] = n... | partial | 8 | 18 | [{"idx": 8, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: Index 7 out of bounds for length 4\n\tat readingBooks.main(readingBooks.java:16)\n", "stdout_tail": ""}, {"idx": 9, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\... | codeforces | E | |
19 | 1374_E1. Reading Books (easy version) | Easy and hard versions are actually different problems, so read statements of both problems completely and carefully.
Summer vacation has started so Alice and Bob want to play and joy, but... Their mom doesn't think so. She says that they have to read some amount of books before all entertainments. Alice and Bob will ... | python2 | input = raw_input
range = xrange
import sys
inp = [int(x) for x in sys.stdin.read().split()]; ii = 0
seg = [0]*200000
def offset(x):
return x + 100000
def encode(x, y):
return (x<<20) + y
def upd(node, L, R, pos, val):
if L+1 == R:
seg[node] += val
seg[offset(node)] = seg[node]*L
return
M = (L+R)>>1
if po... | partial | 3 | 18 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_nb4s5pxa/tmp8m3fk8if.py\", line 41, in <module>\n t, a, b = inp[ii:ii+3]; ii += 3\nValueError: need more than 2 values to unpack\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "std... | codeforces | E | |
19 | 1374_E1. Reading Books (easy version) | Easy and hard versions are actually different problems, so read statements of both problems completely and carefully.
Summer vacation has started so Alice and Bob want to play and joy, but... Their mom doesn't think so. She says that they have to read some amount of books before all entertainments. Alice and Bob will ... | python2 | n,k = map(int,raw_input().split())
both = [];alice = [];bob = []
for _ in range(n):
t,a,b = map(int,raw_input().split())
if a&b:
both.append(t)
elif a:
alice.append(t)
elif b:
bob.append(t)
alice.sort()
bob.sort()
for i in range(min(len(alice),len(bob))):
both.append(alice[i]... | partial | 8 | 18 | [{"idx": 8, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_9_nzis5j/tmp1vq2hnbs.py\", line 1, in <module>\n n,k = map(int,raw_input().split())\nValueError: too many values to unpack\n", "stdout_tail": ""}, {"idx": 9, "reason": "runtime_error", "rc": 1, "stderr": ... | codeforces | E | |
19 | 1374_E1. Reading Books (easy version) | Easy and hard versions are actually different problems, so read statements of both problems completely and carefully.
Summer vacation has started so Alice and Bob want to play and joy, but... Their mom doesn't think so. She says that they have to read some amount of books before all entertainments. Alice and Bob will ... | python2 | from __future__ import division, print_function
def main():
# Template 1.0
import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, floor
from heapq import heappush, heappop, heapify, nlargest, nsmal... | partial | 8 | 18 | [{"idx": 8, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_0trttdk8/tmpd47abl1y.py\", line 210, in <module>\n main()\n File \"/tmp/sbx_0trttdk8/tmpd47abl1y.py\", line 42, in main\n n,k = MAP()\nValueError: t", "stdout_tail": ""}, {"idx": 9, "reason": "runtime... | codeforces | E | |
20 | 1398_A. Bad Triangle | You are given an array a_1, a_2, ... , a_n, which is sorted in non-decreasing order (a_i ≤ a_{i + 1}).
Find three indices i, j, k such that 1 ≤ i < j < k ≤ n and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to a_i, a_j and a_k (for example it is possible to... | python3 | t=int(input())
for z in range(t):
n=int(input())
arr=list(map(int,input().split()))
min= arr[0] + arr[1]
pos=True
for i in range(2,n):
if(arr[i]>=min):
pos=False
posf=i
break
if(pos):
print("-1")
else:
print("1 2", posf+1)
| partial | 7 | 12 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 2 7\n-1\n1 2 3", "got": "1 2 3\n-1\n1 2 3"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 7\n-1\n1 2 3", "got": "1 2 3\n-1\n1 2 3"}, {"idx": 2, "reason": "wrong_answer", "expected": "1 2 6", "got": "1 2 4"}, {"idx": 7, "reason": "wrong_answer", "expected": "... | codeforces | A | |
20 | 1398_A. Bad Triangle | You are given an array a_1, a_2, ... , a_n, which is sorted in non-decreasing order (a_i ≤ a_{i + 1}).
Find three indices i, j, k such that 1 ≤ i < j < k ≤ n and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to a_i, a_j and a_k (for example it is possible to... | python3 | t=int(input())
for _ in range(t):
n=int(input())
a=list(map(int,input().split()))
f=0
for i in range(2,len(a)):
if a[0]+a[1]<=a[i]:
f=1
print("1 2",i+1)
break
if f==0:
print(-1)
| partial | 7 | 12 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 2 7\n-1\n1 2 3", "got": "1 2 3\n-1\n1 2 3"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 7\n-1\n1 2 3", "got": "1 2 3\n-1\n1 2 3"}, {"idx": 2, "reason": "wrong_answer", "expected": "1 2 6", "got": "1 2 4"}, {"idx": 7, "reason": "wrong_answer", "expected": "... | codeforces | A | |
20 | 1398_A. Bad Triangle | You are given an array a_1, a_2, ... , a_n, which is sorted in non-decreasing order (a_i ≤ a_{i + 1}).
Find three indices i, j, k such that 1 ≤ i < j < k ≤ n and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to a_i, a_j and a_k (for example it is possible to... | python2 | # Author: yumtam
# Created at: 2020-08-27 18:53
from __future__ import division, print_function
_interactive = False
def main():
for _ in range(int(input())):
n = int(input())
ar = input_as_list()
a, b, c = ar[0], ar[1], ar[-1]
if a + b <= c:
print(1, 2, n)
... | all_fail | 0 | 12 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_7lhqtimz/tmpv_ubh1tz.py\", line 69, in <module>\n main()\n File \"/tmp/sbx_7lhqtimz/tmpv_ubh1tz.py\", line 8, in main\n for _ in range(int(input())", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_... | codeforces | A | |
20 | 1398_A. Bad Triangle | You are given an array a_1, a_2, ... , a_n, which is sorted in non-decreasing order (a_i ≤ a_{i + 1}).
Find three indices i, j, k such that 1 ≤ i < j < k ≤ n and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to a_i, a_j and a_k (for example it is possible to... | python3 | for t in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(2,n):
l = i
r =n-1
if a[0]+a[1]<=a[l]:
c+=1
print(1,2,i+1)
break
if c==0:
print(-1)
| partial | 7 | 12 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 2 7\n-1\n1 2 3", "got": "1 2 3\n-1\n1 2 3"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 7\n-1\n1 2 3", "got": "1 2 3\n-1\n1 2 3"}, {"idx": 2, "reason": "wrong_answer", "expected": "1 2 6", "got": "1 2 4"}, {"idx": 7, "reason": "wrong_answer", "expected": "... | codeforces | A | |
21 | 1421_B. Putting Bricks in the Wall | Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like [walls](https://www.youtube.com/watch?v=YR5ApYxkU-U), he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.
Roger Waters has a square grid of size n× n and he wants to traverse his grid f... | java |
import javax.swing.tree.TreeNode;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class TestClass {
static final class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[1024];
private int curChar;
private int n... | partial | 2 | 7 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n3 4\n2\n1 2\n2 1\n0", "got": "1\n3 4\n2\n2 3\n3 2\n0"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n1 2\n2 1", "got": "2\n4 5\n5 4"}, {"idx": 3, "reason": "wrong_answer", "expected": "2\n1 2\n2 3", "got": "2\n2 1\n3 2"}, {"idx": 5, "reason": "wrong_answer",... | codeforces | B | |
21 | 1421_B. Putting Bricks in the Wall | Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like [walls](https://www.youtube.com/watch?v=YR5ApYxkU-U), he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.
Roger Waters has a square grid of size n× n and he wants to traverse his grid f... | java | // No sorcery shall prevail. //
import java.util.*;
import java.io.*;
public class InVoker {
//Variables
static long mod = 1000000007;
static long mod2 = 998244353;
static FastReader inp= new FastReader();
static PrintWriter out= new PrintWriter(System.out);
public static void main(String args[]) { ... | partial | 3 | 7 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n3 4\n2\n1 2\n2 1\n0", "got": "1\n3 4\n2\n3 2\n2 3\n0"}, {"idx": 1, "reason": "wrong_answer", "expected": "2\n1 2\n2 3", "got": "2\n2 1\n3 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n1 2\n2 1", "got": "2\n5 4\n4 5"}, {"idx": 6, "reason": "wrong_answer",... | codeforces | B | |
21 | 1421_B. Putting Bricks in the Wall | Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like [walls](https://www.youtube.com/watch?v=YR5ApYxkU-U), he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.
Roger Waters has a square grid of size n× n and he wants to traverse his grid f... | java | import java.lang.reflect.Array;
import java.util.*;
public class Solution {
public static boolean check(String x,String y,String[][] s){
int n=s.length-1;
int a=s[0][1].equals(y)?1:0;
int b=s[1][0].equals(y)?1:0;
int c=s[n][n-1].equals(x)?1:0;
int d=s[n-1][n].equals(x)?1:0;
... | partial | 4 | 7 | [{"idx": 1, "reason": "wrong_answer", "expected": "2\n1 2\n2 3", "got": "2\n2 1\n3 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n1 2\n2 1", "got": "2\n5 4\n4 5"}, {"idx": 6, "reason": "wrong_answer", "expected": "2\n1 2\n2 1", "got": "2\n10 9\n9 10"}] | codeforces | B | |
21 | 1421_B. Putting Bricks in the Wall | Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like [walls](https://www.youtube.com/watch?v=YR5ApYxkU-U), he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.
Roger Waters has a square grid of size n× n and he wants to traverse his grid f... | python3 | t=int(input())
for i in range(t):
n=int(input())
l=[]
for i in range(n):
l.append(list(input()))
if l[0][1]=='0' and l[1][0]=='0':
if l[n-2][n-1]=='0' and l[n-1][n-2]=='0':
print(2)
print(n-1,n)
print(n,n-1)
elif l[n-2][n-1]=='0' and l[n-1][n-2... | partial | 2 | 7 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n3 4\n2\n1 2\n2 1\n0", "got": "1\n3 4\n2\n2 3\n3 2\n0"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n1 2\n2 1", "got": "2\n4 5\n5 4"}, {"idx": 3, "reason": "wrong_answer", "expected": "2\n1 2\n2 3", "got": "2\n2 1\n3 2"}, {"idx": 5, "reason": "wrong_answer",... | codeforces | B | |
21 | 1421_B. Putting Bricks in the Wall | Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like [walls](https://www.youtube.com/watch?v=YR5ApYxkU-U), he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.
Roger Waters has a square grid of size n× n and he wants to traverse his grid f... | python3 | for _ in range(int(input())):
n = int(input());grid = [input() for i in range(n)];a, b, c, d = grid[0][1], grid[1][0], grid[-2][-1], grid[-1][-2];e = []; f = []
if a != '0':e.append((1, 2))
if b != '0':e.append((2, 1))
if c != '1':e.append((n-1, n))
if d != '1':e.append((n, n-1))
if c != '0':f.append((n-1,n))
if... | partial | 3 | 7 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n3 4\n2\n1 2\n2 1\n0", "got": "1\n3 4\n2\n2 3\n3 2\n0"}, {"idx": 1, "reason": "wrong_answer", "expected": "2\n1 2\n2 3", "got": "2\n2 3\n1 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "2\n1 2\n2 3", "got": "2\n3 2\n2 1"}, {"idx": 5, "reason": "wrong_answer",... | codeforces | B | |
21 | 1421_B. Putting Bricks in the Wall | Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like [walls](https://www.youtube.com/watch?v=YR5ApYxkU-U), he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.
Roger Waters has a square grid of size n× n and he wants to traverse his grid f... | cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX;
const long long int inf64 = LLONG_MAX;
vector<string> vect;
long long int n;
vector<pair<int, int> > d4{{-1, 0}, {1, 0}, {0, 1}, {0, -1}};
bool good(long long int xx, long long int yy) {
return (xx < n and xx >= 0 and yy < n and yy >= 0);
}
int ma... | partial | 1 | 7 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n3 4\n2\n1 2\n2 1\n0", "got": "1\n3 4\n2\n2 3\n3 2\n0"}, {"idx": 1, "reason": "wrong_answer", "expected": "2\n1 2\n2 3", "got": "2\n2 3\n1 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n1 2\n2 1", "got": "2\n2 1\n1 2"}, {"idx": 3, "reason": "wrong_answer",... | codeforces | B | |
21 | 1421_B. Putting Bricks in the Wall | Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like [walls](https://www.youtube.com/watch?v=YR5ApYxkU-U), he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.
Roger Waters has a square grid of size n× n and he wants to traverse his grid f... | cpp | #include <bits/stdc++.h>
using namespace std;
int Tc, N;
char Grid[205][205];
int main() {
cin >> Tc;
while (Tc--) {
cin >> N;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) cin >> Grid[i][j];
}
if (Grid[1][2] == Grid[2][1]) {
if (Grid[N - 1][N] == Grid[N][N - 1] && Grid[1][... | partial | 3 | 7 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n3 4\n2\n1 2\n2 1\n0", "got": "1\n3 4\n2\n3 2\n2 3\n0"}, {"idx": 1, "reason": "wrong_answer", "expected": "2\n1 2\n2 3", "got": "2\n2 1\n3 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n1 2\n2 1", "got": "2\n5 4\n4 5"}, {"idx": 6, "reason": "wrong_answer",... | codeforces | B | |
21 | 1421_B. Putting Bricks in the Wall | Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like [walls](https://www.youtube.com/watch?v=YR5ApYxkU-U), he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.
Roger Waters has a square grid of size n× n and he wants to traverse his grid f... | python2 | for _ in range(input()):
n=input()
l=[]
for i in range(n):
k=raw_input()
l.append(k)
sq1=l[0][1]
sq2=l[1][0]
sq3=l[n-1][n-2]
sq4=l[n-2][n-1]
switch=[]
if sq1==sq2:
if sq3==sq1:
switch.append([n,n-1])
if sq4==sq1:
switch.append([... | partial | 2 | 7 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n3 4\n2\n1 2\n2 1\n0", "got": "1\n3 4\n2\n3 2\n2 3\n0"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n1 2\n2 1", "got": "2\n5 4\n4 5"}, {"idx": 3, "reason": "wrong_answer", "expected": "2\n1 2\n2 3", "got": "2\n2 1\n3 2"}, {"idx": 5, "reason": "wrong_answer",... | codeforces | B | |
21 | 1421_B. Putting Bricks in the Wall | Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like [walls](https://www.youtube.com/watch?v=YR5ApYxkU-U), he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.
Roger Waters has a square grid of size n× n and he wants to traverse his grid f... | python2 | from __future__ import division, print_function
''' Hey stalker :) '''
INF = 10 ** 10
TEST_CASES = True
from collections import defaultdict, deque, Counter
from functools import reduce
from bisect import bisect_left
def main():
n = get_int()
mat = [list(input()) for _ in range(n)]
indexes = [(1,0), (0,1)... | partial | 1 | 7 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n3 4\n2\n1 2\n2 1\n0", "got": "1\n3 4\n2\n2 1\n1 2\n0"}, {"idx": 1, "reason": "wrong_answer", "expected": "2\n1 2\n2 3", "got": "2\n2 1\n3 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n1 2\n2 1", "got": "2\n2 1\n1 2"}, {"idx": 3, "reason": "wrong_answer",... | codeforces | B | |
21 | 1421_B. Putting Bricks in the Wall | Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like [walls](https://www.youtube.com/watch?v=YR5ApYxkU-U), he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.
Roger Waters has a square grid of size n× n and he wants to traverse his grid f... | python2 | #!/usr/bin/env python
from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
def main():
t = int(input())
for _ in range(t):... | all_fail | 0 | 7 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n3 4\n2\n1 2\n2 1\n0", "got": "2\n4 3\n3 3\n0\n2\n4 4\n3 5"}, {"idx": 1, "reason": "wrong_answer", "expected": "2\n1 2\n2 3", "got": "2\n2 3\n3 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n1 2\n2 1", "got": "2\n5 4\n4 5"}, {"idx": 3, "reason": "wrong_ans... | codeforces | B | |
22 | 1466_F. Euclid's nightmare | You may know that Euclid was a mathematician. Well, as it turns out, Morpheus knew it too. So when he wanted to play a mean trick on Euclid, he sent him an appropriate nightmare.
In his bad dream Euclid has a set S of n m-dimensional vectors over the Z_2 field and can perform vector addition on them. In other words h... | python2 | # Author: yumtam
# Created at: 2020-12-31 01:27
from __future__ import division, print_function
_interactive = False
def main():
n, m = input_as_list()
A = [input_with_offset(-1)[1:] for _ in range(n)]
uf = DisjointSetUnion(m)
dims = 0
for e in A:
if len(e) == 1:
x = e[0]
... | all_fail | 0 | 9 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_4tyeg1sa/tmpjl_ar4_m.py\", line 148, in <module>\n main()\n File \"/tmp/sbx_4tyeg1sa/tmpjl_ar4_m.py\", line 8, in main\n n, m = input_as_list()\nVal", "stdout_tail": ""}, {"idx": 1, "reason": "runtime... | codeforces | F | |
24 | 1513_C. Add One | You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the operation once.
You have to find the length of n after applying m operations. Since... | java | import java.util.*;
import java.io.*;
public class A2oj2 {
static FastReader sc;
static PrintWriter out;
static int mod = 1000000007;
public static void main(String[] args) throws IOException {
if (System.getProperty("ONLINE_JUDGE") == null) {
File f1 = new File("input.txt");
... | all_fail | 0 | 2 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.io.FileNotFoundException: input.txt (No such file or directory)\n\tat java.base/java.io.FileInputStream.open0(Native Method)\n\tat java.base/java.io.FileInputStream.open(Fi", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_er... | codeforces | C | |
24 | 1513_C. Add One | You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the operation once.
You have to find the length of n after applying m operations. Since... | python2 | from __future__ import division
from sys import stdin, stdout
def fast2():
import os, sys, atexit
from cStringIO import StringIO as BytesIO
# range = xrange
sys.stdout = BytesIO()
atexit.register(lambda: os.write(1, sys.stdout.getvalue()))
return BytesIO(os.read(0, os.fstat(0).st_size)).readli... | all_fail | 0 | 2 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_ozyguc0i/tmp6xvn962m.py\", line 34, in <module>\n for _ in range(int(input())):\nValueError: invalid literal for int() with base 10: ''\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": ... | codeforces | C | |
25 | 1540_C1. Converging Array (Easy Version) | This is the easy version of the problem. The only difference is that in this version q = 1. You can make hacks only if both versions of the problem are solved.
There is a process that takes place on arrays a and b of length n and length n-1 respectively.
The process is an infinite sequence of operations. Each operat... | python2 | from __future__ import division,print_function
from heapq import*
import sys
le = sys.__stdin__.read().split("\n")[::-1]
mo=10**9+7
if 1:
n=int(le.pop())
c = list(map(int,le.pop().split()))
b = list(map(int,le.pop().split()))
le.pop()
x=int(le.pop())
prefb=[b[0]]
for k in b[1:]:
pref... | partial | 24 | 25 | [{"idx": 12, "reason": "timeout"}] | codeforces | C | |
27 | 20_B. Equation | You are given an equation:
Ax2 + Bx + C = 0.
Your task is to find the number of distinct roots of the equation and print all of them in ascending order.
Input
The first line contains three integer numbers A, B and C ( - 105 ≤ A, B, C ≤ 105). Any coefficient may be equal to 0.
Output
In case of infinite root cou... | java | import java.io.*;
import java.util.*;
public class Main implements Runnable {
public void _main() throws IOException {
double a = nextDouble();
double b = nextDouble();
double c = nextDouble();
Locale.setDefault(Locale.UK);
if (a == 0) {
if (b == 0) {
if (c == 0)
out.print(-1);
else
ou... | partial | 23 | 25 | [{"idx": 2, "reason": "wrong_answer", "expected": "2\n0.052497\n19.188713", "got": "2\n0.05250\n19.18871"}, {"idx": 4, "reason": "wrong_answer", "expected": "2\n-1.708204\n11.708204", "got": "2\n-1.70820\n11.70820"}] | codeforces | B | |
27 | 20_B. Equation | You are given an equation:
Ax2 + Bx + C = 0.
Your task is to find the number of distinct roots of the equation and print all of them in ascending order.
Input
The first line contains three integer numbers A, B and C ( - 105 ≤ A, B, C ≤ 105). Any coefficient may be equal to 0.
Output
In case of infinite root cou... | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a == 0) {
if (b == 0 && c != 0) cout << 0 << endl;
if (b == 0 && c == 0) cout << -1 << endl;
if (b != 0 && c == 0) cout << 1 << endl << "0,0000000000" << endl;
if (b != 0 && c != 0) {
cout << 1 <<... | partial | 23 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "1\n0.000000", "got": "1\n0,0000000000"}, {"idx": 3, "reason": "wrong_answer", "expected": "1\n-0.000000", "got": "1\n0,0000000000"}] | codeforces | B | |
27 | 20_B. Equation | You are given an equation:
Ax2 + Bx + C = 0.
Your task is to find the number of distinct roots of the equation and print all of them in ascending order.
Input
The first line contains three integer numbers A, B and C ( - 105 ≤ A, B, C ≤ 105). Any coefficient may be equal to 0.
Output
In case of infinite root cou... | python2 | from math import sqrt
a, b, c = map(float, raw_input().split())
delta = b**2-4*a*c
if (a == 0):
print -1 if ((b == 0) and (c == 0)) else 0 if ((b == 0) and (c != 0)) else 1
if (b != 0): print "%.5f" %(-c/b)
elif (delta > 0):
print 2
for i in range(2):
print "%.5f" %sorted([(-b+sqrt(delta))/(2*a)... | partial | 23 | 25 | [{"idx": 2, "reason": "wrong_answer", "expected": "2\n0.052497\n19.188713", "got": "2\n0.05250\n19.18871"}, {"idx": 4, "reason": "wrong_answer", "expected": "2\n-1.708204\n11.708204", "got": "2\n-1.70820\n11.70820"}] | codeforces | B | |
28 | 235_D. Graph Game | In computer science, there is a method called "Divide And Conquer By Node" to solve some hard problems about paths on a tree. Let's desribe how this method works by function:
solve(t) (t is a tree):
1. Chose a node x (it's common to chose weight-center) in tree t. Let's call this step "Line A".
2. Deal with all... | java | //package round146;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
public class D3 {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni();
int[] from = new int[n];
int[] to = new i... | all_fail | 0 | 14 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.NegativeArraySizeException: -49\n\tat D3.solve(D3.java:16)\n\tat D3.run(D3.java:103)\n\tat D3.main(D3.java:110)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\"... | codeforces | D | |
28 | 235_D. Graph Game | In computer science, there is a method called "Divide And Conquer By Node" to solve some hard problems about paths on a tree. Let's desribe how this method works by function:
solve(t) (t is a tree):
1. Chose a node x (it's common to chose weight-center) in tree t. Let's call this step "Line A".
2. Deal with all... | java | //package round146;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
public class D {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni();
int[] from = new int[n];
int[] to = new in... | all_fail | 0 | 14 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.NegativeArraySizeException: -49\n\tat D.solve(D.java:16)\n\tat D.run(D.java:217)\n\tat D.main(D.java:224)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.... | codeforces | D | |
29 | 260_B. Ancient Prophesy | A recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is a string that only consists of digits and characters "-".
We'll say that some date is mentioned in the Prophesy if there is a substring in the Prophesy that is the date's record in the format "dd-mm-yyyy". We'll say tha... | cpp | #include <bits/stdc++.h>
using namespace std;
char s[100005];
int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
map<string, int> my;
void check(char* s) {
if (((s[0]) >= '0' && (s[0]) <= '9') && ((s[1]) >= '0' && (s[1]) <= '9') &&
((s[3]) >= '0' && (s[3]) <= '9') && ((s[4]) >= '0' && (s[4]) <= '9') ... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_9mk1ytkx/tmp_dhqn_4f.cpp: In function ‘int main()’:
/tmp/sbx_9mk1ytkx/tmp_dhqn_4f.cpp:21:3: error: ‘gets’ was not declared in this scope; did you mean ‘getw’?
21 | gets(s);
| ^~~~
| getw
/tmp/sbx_9mk1ytkx/tmp_dhqn_4f.cpp:26:8: error: ‘typeof’ was not declared in this scope
... | [] | codeforces | B |
31 | 309_B. Context Advertising | Advertising has become part of our routine. And now, in the era of progressive technologies, we need your ideas to make advertising better!
In this problem we'll look at a simplified version of context advertising. You've got a text, consisting of exactly n words. A standard advertising banner has exactly r lines, eac... | cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1000100, L = 5000500, BufL = 220;
char ch[N + L] = {}, buf[BufL] = {};
int n, r, c, l, a[N] = {}, p[N] = {}, f[N] = {}, g[N] = {};
int main() {
gets(buf + 1);
sscanf(buf + 1, "%d%d%d", &n, &r, &c);
gets(ch + 1);
l = strlen(ch + 1);
for (int i = 1, to... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_x836aez0/tmp4q8b3s_s.cpp: In function ‘int main()’:
/tmp/sbx_x836aez0/tmp4q8b3s_s.cpp:7:3: error: ‘gets’ was not declared in this scope; did you mean ‘getw’?
7 | gets(buf + 1);
| ^~~~
| getw
| [] | codeforces | B |
31 | 309_B. Context Advertising | Advertising has become part of our routine. And now, in the era of progressive technologies, we need your ideas to make advertising better!
In this problem we'll look at a simplified version of context advertising. You've got a text, consisting of exactly n words. A standard advertising banner has exactly r lines, eac... | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = int(1e6) + 10;
const int MAX_M = 21;
int n, r, c;
int a[MAX_N], b[MAX_N];
int f[MAX_N][MAX_M];
char buffer[MAX_N * 6];
int main() {
scanf("%d%d%d\n", &n, &r, &c);
c++;
gets(buffer);
int m = strlen(buffer);
buffer[m++] = ' ';
for (int i = 0, j =... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_qdcdoimq/tmpij5nowky.cpp: In function ‘int main()’:
/tmp/sbx_qdcdoimq/tmpij5nowky.cpp:12:3: error: ‘gets’ was not declared in this scope; did you mean ‘getw’?
12 | gets(buffer);
| ^~~~
| getw
/tmp/sbx_qdcdoimq/tmpij5nowky.cpp:10:8: warning: ignoring return value of ‘int scanf... | [] | codeforces | B |
32 | 354_E. Lucky Number Representation | We know that lucky digits are digits 4 and 7, however Vasya's got another favorite digit 0 and he assumes it also is lucky! Lucky numbers are such non-negative integers whose decimal record only contains lucky digits. For example, numbers 0, 47, 7074 are lucky, but 1, 7377, 895, -7 are not.
Vasya has t important posi... | cpp | #include <bits/stdc++.h>
using namespace std;
set<long long> kharab = {1, 2, 3, 5, 6, 9, 10, 13, 17, 31, 34,
37, 38, 41, 43, 45, 46, 49, 50, 53, 57, 71,
83, 111, 123, 391, 403, 437, 457, 471, 483, 511, 523};
long long a[6];
vector<long long> D[43... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": " 7 7 7 ", "got": "7 7 7 7 7 7\n-1\n444 0 0 0 0 0\n7 0 0 0 0 0\n47 4 0 0 0 0"... | codeforces | E | |
32 | 354_E. Lucky Number Representation | We know that lucky digits are digits 4 and 7, however Vasya's got another favorite digit 0 and he assumes it also is lucky! Lucky numbers are such non-negative integers whose decimal record only contains lucky digits. For example, numbers 0, 47, 7074 are lucky, but 1, 7377, 895, -7 are not.
Vasya has t important posi... | cpp | #include <bits/stdc++.h>
using namespace std;
int D[3] = {0, 4, 7};
string S;
vector<int> way[50];
int dp[20][10];
int nxt[20][10];
int getdp(int x, int y) {
int &ref = dp[x][y];
if (ref != -1) {
return ref;
}
if (x == S.size()) {
return ref = (y == 0);
}
int mod10 = ((S[x] - '0') - y + 20) % 10;
... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": " 7 7 7 ", "got": "7 7 7 7 7 7\n-1\n444 0 0 0 0 0\n7 0 0 0 0 0\n47 4 0 0 0 0"... | codeforces | E | |
32 | 354_E. Lucky Number Representation | We know that lucky digits are digits 4 and 7, however Vasya's got another favorite digit 0 and he assumes it also is lucky! Lucky numbers are such non-negative integers whose decimal record only contains lucky digits. For example, numbers 0, 47, 7074 are lucky, but 1, 7377, 895, -7 are not.
Vasya has t important posi... | java | import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution ... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": " 7 7 7 ", "got": "7 7 7 7 7 7\n-1\n444 0 0 0 0 0\n7 0 0 0 0 0\n47 4 0 0 0 0"... | codeforces | E | |
36 | 44_B. Cola | To celebrate the opening of the Winter Computer School the organizers decided to buy in n liters of cola. However, an unexpected difficulty occurred in the shop: it turned out that cola is sold in bottles 0.5, 1 and 2 liters in volume. At that, there are exactly a bottles 0.5 in volume, b one-liter bottles and c of two... | java | import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputRead... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_bxpwislf/Main.java:1: error: package org.omg.PortableInterceptor does not exist
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
^
1 error
| [] | codeforces | B |
36 | 44_B. Cola | To celebrate the opening of the Winter Computer School the organizers decided to buy in n liters of cola. However, an unexpected difficulty occurred in the shop: it turned out that cola is sold in bottles 0.5, 1 and 2 liters in volume. At that, there are exactly a bottles 0.5 in volume, b one-liter bottles and c of two... | python2 | import math
n, a, b, c = [int(i) for i in raw_input().split()]
ans = 0
for i in range(0, a+1):
for j in range(0, b+1):
t = (n - 0.5*i - j)/2
if t >= 0 and t <= c and t == math.floor(t):
ans += 1
print(ans) | partial | 24 | 25 | [{"idx": 17, "reason": "timeout"}] | codeforces | B | |
38 | 545_C. Woodcutters | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.
There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each ... | java | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main extends PrintWriter {
BufferedReader in;
StringTokenizer stok;
final Random rand = new Random(31);
final int inf = (int) 1e9;
final long linf = (long) 1e18;
class Item implements Comparable<Item> {
... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_dor7qquq/Main.java:107: error: as of release 9, '_' is a keyword, and may not be used as an identifier
int _ = a[i];
^
/tmp/sbx_dor7qquq/Main.java:109: error: as of release 9, '_' is a keyword, and may not be used as an identifier
a[x] = _;
... | [] | codeforces | C |
42 | 663_A. Rebus | You are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer n. The goal is to replace each question mark with some positive integer from 1 to n, such that equality holds.
Input
The only line of the input contains a re... | java | import java.io.*;
import java.util.*;
import java.util.Map.Entry;
public class Task_Rnd664_B {
final static String input_file_name = "input/Rnd664_B.txt";
public static void main(String[] args)
{
//!!!!!!!!!!111
reader.init(true); //to server
//reader.init(false);
run();
wr.flush();
}
public... | partial | 15 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "Possible\n40 + 1 - 1 + 1 + 1 = 42", "got": "Possible\n1 + 1 - 1 + 1 + 40 = 42"}, {"idx": 4, "reason": "wrong_answer", "expected": "Possible\n999999 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 -... | codeforces | A | |
42 | 663_A. Rebus | You are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer n. The goal is to replace each question mark with some positive integer from 1 to n, such that equality holds.
Input
The only line of the input contains a re... | java | var rebus = readline().split(' ').map(String);
var count = {plus: 1, minus: 0}; // number of + and - in rebus
for (var i = 0; i < rebus.length; i++) {
if (rebus[i] == '+') {
count.plus += 1;
} else if (rebus[i] == '-') {
count.minus += 1;
}
if (rebus[i] == '=') {
n = Number(rebus[i + 1]);
}
}
// Do I need... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_d1l6biin/Main.java:1: error: class, interface, enum, or record expected
var rebus = readline().split(' ').map(String);
^
/tmp/sbx_d1l6biin/Main.java:3: error: class, interface, enum, or record expected
var count = {plus: 1, minus: 0}; // number of + and - in rebus
^
/tmp/sbx_d1l6biin/Main.java:5:... | [] | codeforces | A |
42 | 663_A. Rebus | You are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer n. The goal is to replace each question mark with some positive integer from 1 to n, such that equality holds.
Input
The only line of the input contains a re... | cpp | #include <bits/stdc++.h>
using namespace std;
string s[505];
vector<int> P, N;
int main() {
int id = 0, pos = 0, neg = 0;
while (cin >> s[id]) {
if (s[id] == "=") break;
if (s[id] == "?") {
if (id == 0 || s[id - 1] == "+")
pos++;
else
neg++;
}
id++;
cin >> s[id];
... | partial | 7 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "Possible\n40 + 1 - 1 + 1 + 1 = 42", "got": "Possible\n40 +1 -1 +1 +1 = 42"}, {"idx": 3, "reason": "wrong_answer", "expected": "Possible\n1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + ... | codeforces | A | |
42 | 663_A. Rebus | You are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer n. The goal is to replace each question mark with some positive integer from 1 to n, such that equality holds.
Input
The only line of the input contains a re... | python2 | class Number:
def __init__(sign, number=None):
self.__sign = sign
self.__number = number
def solve_rebus(left_part, right_part):
added = left_part.count("+") + 1
subtracted = left_part.count("-")
max_number = added * right_part - subtracted
min_number = added - subtracted * right_... | partial | 15 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "Possible\n40 + 1 - 1 + 1 + 1 = 42", "got": "Possible\n1 + 1 - 1 + 1 + 40 = 42"}, {"idx": 4, "reason": "wrong_answer", "expected": "Possible\n999999 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 -... | codeforces | A | |
42 | 663_A. Rebus | You are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer n. The goal is to replace each question mark with some positive integer from 1 to n, such that equality holds.
Input
The only line of the input contains a re... | cpp | #include <bits/stdc++.h>
using namespace std;
char a[1002];
int i, j;
int k;
int n, q1, q2;
int an1[102], an2[102];
bool tiv(int x) {
if (a[x] < '0') return false;
if (a[x] > '9') return false;
return true;
}
int main() {
cin.getline(a, 1000);
k = (int)(strlen(a));
for (i = 0; i < k; i++) {
if (i != 0 &... | partial | 12 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "Possible\n40 + 1 - 1 + 1 + 1 = 42", "got": "Possible\n1 + 1 - 42 + 40 + 42 = 42"}, {"idx": 4, "reason": "wrong_answer", "expected": "Possible\n999999 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1... | codeforces | A | |
42 | 663_A. Rebus | You are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer n. The goal is to replace each question mark with some positive integer from 1 to n, such that equality holds.
Input
The only line of the input contains a re... | python2 | import sys
def fail():
print('Impossible')
sys.exit()
line = raw_input().strip()
parts = line.split()
n = int(parts[-1])
plus = (line.count('+') + 1) * [ n ]
minus = line.count('-') * [ 1 ]
x = sum(plus) - sum(minus) - n
if x < 0:
fail()
for i, value in enumerate(plus):
if x == 0:
break
de... | partial | 15 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "Possible\n40 + 1 - 1 + 1 + 1 = 42", "got": "Possible\n1 + 1 - 1 + 1 + 40 = 42"}, {"idx": 4, "reason": "wrong_answer", "expected": "Possible\n999999 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 -... | codeforces | A | |
42 | 663_A. Rebus | You are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer n. The goal is to replace each question mark with some positive integer from 1 to n, such that equality holds.
Input
The only line of the input contains a re... | python2 | def solve():
rebus = raw_input()
plus=1
minus=0
for x in xrange(len(rebus)):
if rebus[x]=='+':
plus+=1
else:
if rebus[x]=='-':
minus+=1
if rebus[x]=='=':
break
n=int(rebus[x+2:])
if plus==1 and minus==0:
print "P... | partial | 13 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "Possible\n40 + 1 - 1 + 1 + 1 = 42", "got": "Possible\n11 + 11 - 1 + 11 + 10 = 42"}, {"idx": 4, "reason": "wrong_answer", "expected": "Possible\n999999 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - ... | codeforces | A | |
43 | 70_C. Lucky Tickets | In Walrusland public transport tickets are characterized by two integers: by the number of the series and by the number of the ticket in the series. Let the series number be represented by a and the ticket number — by b, then a ticket is described by the ordered pair of numbers (a, b).
The walruses believe that a tic... | cpp | #include <bits/stdc++.h>
using namespace std;
int in() {
int a;
scanf("%d", &a);
return a;
}
int gcm(int a, int b) {
if (b > a) return gcm(b, a);
if (a % b == 0)
return b;
else
return gcm(b, a % b);
}
int calc_rev(int x) {
int ret = 0;
while (x) {
int a = x % 10;
ret = ret * 10 + a;
... | partial | 22 | 25 | [{"idx": 9, "reason": "wrong_answer", "expected": "2222 1001", "got": "1001 2222"}, {"idx": 10, "reason": "wrong_answer", "expected": "4444 1001", "got": "1001 4444"}, {"idx": 23, "reason": "wrong_answer", "expected": "1001 123", "got": "123 1001"}] | codeforces | C | |
43 | 70_C. Lucky Tickets | In Walrusland public transport tickets are characterized by two integers: by the number of the series and by the number of the ticket in the series. Let the series number be represented by a and the ticket number — by b, then a ticket is described by the ordered pair of numbers (a, b).
The walruses believe that a tic... | cpp | #include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, vector<int> > M;
map<pair<int, int>, int> Mcnt;
const long long inf = (long long)1E16;
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int rev(int x) {
int y = 0;
while (x) {
y = y * 10 + x % 10;
x /= 10;
}
retur... | partial | 22 | 25 | [{"idx": 9, "reason": "wrong_answer", "expected": "2222 1001", "got": "1001 2222"}, {"idx": 10, "reason": "wrong_answer", "expected": "4444 1001", "got": "1001 4444"}, {"idx": 23, "reason": "wrong_answer", "expected": "1001 123", "got": "123 1001"}] | codeforces | C | |
43 | 70_C. Lucky Tickets | In Walrusland public transport tickets are characterized by two integers: by the number of the series and by the number of the ticket in the series. Let the series number be represented by a and the ticket number — by b, then a ticket is described by the ordered pair of numbers (a, b).
The walruses believe that a tic... | cpp | #include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> A, B;
int maxx, maxy;
long long w, ansx = 100001, ansy = 100001;
int gcd(int x, int y) {
if (y == 0) return x;
return gcd(y, x % y);
}
int rev(int x) {
int tmp = 0;
while (x) {
tmp = tmp * 10 + x % 10;
x /= 10;
}
return tmp;
}
in... | partial | 22 | 25 | [{"idx": 9, "reason": "wrong_answer", "expected": "2222 1001", "got": " 1001 2222"}, {"idx": 10, "reason": "wrong_answer", "expected": "4444 1001", "got": " ... | codeforces | C | |
43 | 70_C. Lucky Tickets | In Walrusland public transport tickets are characterized by two integers: by the number of the series and by the number of the ticket in the series. Let the series number be represented by a and the ticket number — by b, then a ticket is described by the ordered pair of numbers (a, b).
The walruses believe that a tic... | java |
import java.util.HashMap;
import java.util.Scanner;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author duc
*/
public class CF70_C {
static int reverseNumber(int n) {
int m = 0;
while (n > 0) {
m = m * 10 + n%10;
... | partial | 22 | 25 | [{"idx": 9, "reason": "wrong_answer", "expected": "2222 1001", "got": "1001 2222"}, {"idx": 10, "reason": "wrong_answer", "expected": "4444 1001", "got": "1001 4444"}, {"idx": 23, "reason": "wrong_answer", "expected": "1001 123", "got": "123 1001"}] | codeforces | C | |
43 | 70_C. Lucky Tickets | In Walrusland public transport tickets are characterized by two integers: by the number of the series and by the number of the ticket in the series. Let the series number be represented by a and the ticket number — by b, then a ticket is described by the ordered pair of numbers (a, b).
The walruses believe that a tic... | java | import java.io.*;
import java.awt.geom.Point2D;
import java.text.*;
import java.math.*;
import java.util.*;
public class Main implements Runnable {
final String filename = "";
public void solve() throws Exception {
int maxx = iread(), maxy = iread(), w = iread();
final int max = 100000;
Pair[] p = new Pair[... | partial | 22 | 25 | [{"idx": 9, "reason": "wrong_answer", "expected": "2222 1001", "got": "1001 2222"}, {"idx": 10, "reason": "wrong_answer", "expected": "4444 1001", "got": "1001 4444"}, {"idx": 23, "reason": "wrong_answer", "expected": "1001 123", "got": "123 1001"}] | codeforces | C | |
43 | 70_C. Lucky Tickets | In Walrusland public transport tickets are characterized by two integers: by the number of the series and by the number of the ticket in the series. Let the series number be represented by a and the ticket number — by b, then a ticket is described by the ordered pair of numbers (a, b).
The walruses believe that a tic... | java | import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
public class C70 {
public static void main(String[] args) throws IOException {
Scanner in = new Scan... | partial | 22 | 25 | [{"idx": 9, "reason": "wrong_answer", "expected": "2222 1001", "got": "1001 2222"}, {"idx": 10, "reason": "wrong_answer", "expected": "4444 1001", "got": "1001 4444"}, {"idx": 23, "reason": "wrong_answer", "expected": "1001 123", "got": "123 1001"}] | codeforces | C | |
43 | 70_C. Lucky Tickets | In Walrusland public transport tickets are characterized by two integers: by the number of the series and by the number of the ticket in the series. Let the series number be represented by a and the ticket number — by b, then a ticket is described by the ordered pair of numbers (a, b).
The walruses believe that a tic... | python2 | from collections import defaultdict
from fractions import gcd
(max_x, max_y, w) = map( int, raw_input().split() )
def Pair(x):
inv_x = 0
val = x
while val:
inv_x = inv_x * 10 + val % 10
val /= 10
uc = gcd( x, inv_x )
return ( x/uc, inv_x/uc )
def Reverse(P):
return ( P[1], P[0... | partial | 21 | 25 | [{"idx": 5, "reason": "timeout"}, {"idx": 9, "reason": "wrong_answer", "expected": "2222 1001", "got": "1001 2222"}, {"idx": 10, "reason": "timeout"}, {"idx": 23, "reason": "wrong_answer", "expected": "1001 123", "got": "123 1001"}] | codeforces | C | |
43 | 70_C. Lucky Tickets | In Walrusland public transport tickets are characterized by two integers: by the number of the series and by the number of the ticket in the series. Let the series number be represented by a and the ticket number — by b, then a ticket is described by the ordered pair of numbers (a, b).
The walruses believe that a tic... | python2 | from fractions import gcd
from collections import defaultdict
def do_rev(x):
if x == 0: return 0
r = int(str(x)[::-1])
g = gcd(x, r)
return (x / g, r / g)
(maxx, maxy, w) = map(int, raw_input().split())
rev = [do_rev(x) for x in xrange(max(maxx, maxy) + 1)]
ab = defaultdict(int)
ba = defaultdict(int)
for x in xr... | partial | 22 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "5 7", "got": "7 5"}, {"idx": 4, "reason": "wrong_answer", "expected": "22 22", "got": "44 11"}, {"idx": 16, "reason": "wrong_answer", "expected": "9 11", "got": "11 9"}] | codeforces | C | |
44 | 730_J. Bottles | Nick has n bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda ai and bottle volume bi (ai ≤ bi).
Nick has decided to pour all remaining soda into minimal number of bottles, moreover he has to do it as soon as possible. Nick spends x seconds to pour x units of soda... | python3 |
# minTime[bottle][bottlesUsed][volume]
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
minTime = [[{} for j in range(101)] for k in range(101)]
minTime[1][1][b[0] - a[0]] = 0
minTime[1][0][-a[0]] = a[0]
validVolumes = {-a[0], b[0]-a[0]}
for bottle in range(1, n):
... | partial | 17 | 25 | [{"idx": 8, "reason": "timeout"}, {"idx": 9, "reason": "timeout"}, {"idx": 14, "reason": "timeout"}, {"idx": 16, "reason": "timeout"}, {"idx": 17, "reason": "timeout"}] | codeforces | J | |
44 | 730_J. Bottles | Nick has n bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda ai and bottle volume bi (ai ≤ bi).
Nick has decided to pour all remaining soda into minimal number of bottles, moreover he has to do it as soon as possible. Nick spends x seconds to pour x units of soda... | python3 | import sys
input = sys.stdin.buffer.readline
n = int(input())
soda = list(map(int, input().split()))
volume = list(map(int, input().split()))
dp = [[{} for j in range(n + 1)] for k in range(n + 1)]
dp[0][1][volume[0] - soda[0]] = 0
total = soda[0]
for i in range(0, n - 1):
total += soda[i + 1]
dp[i + 1][1][vo... | partial | 17 | 25 | [{"idx": 8, "reason": "timeout"}, {"idx": 9, "reason": "timeout"}, {"idx": 14, "reason": "timeout"}, {"idx": 16, "reason": "timeout"}, {"idx": 17, "reason": "timeout"}] | codeforces | J | |
45 | 776_A. A Serial Killer | Our beloved detective, Sherlock is currently trying to catch a serial killer who kills a person each day. Using his powers of deduction, he came to know that the killer has a strategy for selecting his next victim.
The killer starts with two potential victims on his first day, selects one of these two, kills selected ... | python2 | name_set = {}
seed_name1, seed_name2 = raw_input().split()
name_set[seed_name1] = 1
name_set[seed_name2] = 1
print ' '.join(list(name_set))
n = int(raw_input())
for i in range(n):
murdered_name, new_name = raw_input().split()
del name_set[murdered_name]
name_set[new_name] = 1
print ' '.join(list(name_se... | partial | 2 | 12 | [{"idx": 0, "reason": "wrong_answer", "expected": "icm codeforces\nicm technex", "got": "codeforces icm\ntechnex icm"}, {"idx": 1, "reason": "wrong_answer", "expected": "ross rachel\njoey rachel\njoey phoebe\njoey monica\njoey chandler", "got": "rachel ross\nrachel joey\nphoebe joey\nmonica joey\nchandler joey"}, {"idx... | codeforces | A | |
46 | 7_B. Memory Manager | There is little time left before the release of the first national operating system BerlOS. Some of its components are not finished yet — the memory manager is among them. According to the developers' plan, in the first release the memory manager will be very simple and rectilinear. It will support three operations:
... | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
int t, m, n, id[MAXN], size[MAXN], num = 1;
char op[20];
bool free(int p, int n) {
if (p + n - 1 > m) return false;
for (int i = 0; i < n; ++i) {
if (id[p + i] != 0) return false;
}
return true;
}
int main() {
ios_base::sync_with_stdio(0)... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_9xnbii23/tmpf25tdk99.cpp: In function ‘int main()’:
/tmp/sbx_9xnbii23/tmpf25tdk99.cpp:22:21: error: reference to ‘size’ is ambiguous
22 | int tsz = size[j];
| ^~~~
In file included from /usr/include/c++/11/string:54,
from /usr/include/c++/11... | [] | codeforces | B |
48 | 868_A. Bark to Unlock | As technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new phone, Arkady's pet dog Mu-mu has to bark the password once. The phone represents a password as a string of two lowercase English letters.
Mu-mu's enemy Kashtanka wants to unlock Mu-mu's p... | java | import java.util.Scanner;
public class Codechef {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String x = input.next();
int n = input.nextInt(), c = 0, c1 = 0;
String[] s = new String[n];
for (int i = 0; i < n; i++) {
s[i] = i... | all_fail | 0 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 2, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 3, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 4, "reason": "wrong_answer", "e... | codeforces | A | |
48 | 868_A. Bark to Unlock | As technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new phone, Arkady's pet dog Mu-mu has to bark the password once. The phone represents a password as a string of two lowercase English letters.
Mu-mu's enemy Kashtanka wants to unlock Mu-mu's p... | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
char a, b;
scanf("%c%c", &a, &b);
int n;
scanf("%d", &n);
getchar();
char s[n][10];
for (int i = 0; i < n; i++) {
gets(s[i]);
}
bool mark[2];
memset(mark, 0, sizeof(mark));
for (int i = 0; i < n; i++) {
if (s[i][0] == a && s[i][1] ... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_p811_9e2/tmplk7rle4z.cpp: In function ‘int main()’:
/tmp/sbx_p811_9e2/tmplk7rle4z.cpp:11:5: error: ‘gets’ was not declared in this scope; did you mean ‘getw’?
11 | gets(s[i]);
| ^~~~
| getw
/tmp/sbx_p811_9e2/tmplk7rle4z.cpp:5:8: warning: ignoring return value of ‘int sc... | [] | codeforces | A |
50 | 915_A. Garden | Luba thinks about watering her garden. The garden can be represented as a segment of length k. Luba has got n buckets, the i-th bucket allows her to water some continuous subsegment of garden of length exactly ai each hour. Luba can't water any parts of the garden that were already watered, also she can't water the gro... | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, result;
scanf("%d %d", &n, &k);
for (int i = 0; i < n; i++) {
int a;
scanf("%d", &a);
if (k % a == 0) result = min(result, k / a);
}
printf("%d\n", result);
return 0;
}
| partial | 9 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "2", "got": "-1654744840"}, {"idx": 1, "reason": "wrong_answer", "expected": "7", "got": "-1216678936"}, {"idx": 2, "reason": "wrong_answer", "expected": "7", "got": "-281759528"}, {"idx": 3, "reason": "wrong_answer", "expected": "1", "got": "-911740520"}, {"idx": 4, "r... | codeforces | A | |
52 | 990_E. Post Lamps | Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has n positions to install lamps, they correspond to the integer numbers from 0 to n - 1 on the OX axis. However, some positions are blocked an... | python3 | import sys
from math import ceil
n, m, k = map(int, sys.stdin.readline().split())
places = [True for _ in range(n)]
for x in map(int, sys.stdin.readline().split()):
places[x] = False
costs = list(map(int, sys.stdin.readline().split()))
if not places[0]:
print(-1)
sys.exit(0)
longest_streak = 0
streak = 0
... | partial | 24 | 25 | [{"idx": 18, "reason": "timeout"}] | codeforces | E | |
76 | p01222 Walk under a Scorching Sun | Edward R. Nelson is visiting a strange town for some task today. This city is built on a two-dimensional flat ground with several vertical buildings each of which forms a convex polygon when seen from above on it (that is to say, the buidlings are convex polygon columns). Edward needs to move from the point S to the po... | cpp | #include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <utility>
#include <map>
using namespace std;
const double EPS = 1e-6;
const double INF = 1e12;
const double PI = acos(-1);
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#d... | all_fail | 0 | 1 | [{"idx": 0, "reason": "wrong_answer", "expected": "11.213", "got": "11.2132"}] | aizu | UNKNOWN | |
76 | p01222 Walk under a Scorching Sun | Edward R. Nelson is visiting a strange town for some task today. This city is built on a two-dimensional flat ground with several vertical buildings each of which forms a convex polygon when seen from above on it (that is to say, the buidlings are convex polygon columns). Edward needs to move from the point S to the po... | cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
static const double PI = acos(-1.0);
template<class T> T GCD( T x, T y ) { return x ? GCD(y%x,x) : y; }
struct Rational
{
Rational( long long num = 0, long long den = 1 )... | all_fail | 0 | 1 | [{"idx": 0, "reason": "wrong_answer", "expected": "11.213", "got": "11.2132034356"}] | aizu | UNKNOWN | |
76 | p01222 Walk under a Scorching Sun | Edward R. Nelson is visiting a strange town for some task today. This city is built on a two-dimensional flat ground with several vertical buildings each of which forms a convex polygon when seen from above on it (that is to say, the buidlings are convex polygon columns). Edward needs to move from the point S to the po... | cpp | #include<bits/stdc++.h>
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-7)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define COUNTER_CLOCKWISE 1
#define CLOCKWISE -1
#define ONLINE_BACK 2
#define ONLINE_FRONT -2
#define ON_SEGMENT 0
using namespace std;
const bool debug = false; /... | all_fail | 0 | 1 | [{"idx": 0, "reason": "wrong_answer", "expected": "11.213", "got": "11.2132034356"}] | aizu | UNKNOWN | |
80 | p01974 Pigeonhole principle | problem
Given $ N $ different natural numbers $ a_i $. I decided to make a pair by choosing a different natural number from the given natural numbers. Output one pair that can be created with a value difference that is a multiple of $ N -1 $.
It should be noted that such a pair always exists.
Example
Input
5
1... | cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> a(n);
for(int i = 0 ; i < n ; ++i){
cin >> a[i];
for(int j = 0 ; j < i ; ++j){
if(abs(a[i] - a[j]) % (n - 1) == 0){
cout << a[i] << " " << a[j] << endl;
... | all_fail | 0 | 1 | [{"idx": 0, "reason": "wrong_answer", "expected": "2 10", "got": "10 2"}] | aizu | UNKNOWN | |
80 | p01974 Pigeonhole principle | problem
Given $ N $ different natural numbers $ a_i $. I decided to make a pair by choosing a different natural number from the given natural numbers. Output one pair that can be created with a value difference that is a multiple of $ N -1 $.
It should be noted that such a pair always exists.
Example
Input
5
1... | python3 | N = int(input())
a = [int(x) for x in input().split()]
x, y = -1, -1
for i in range(N) :
for j in range(N) :
if i != j and abs(a[i] - a[j]) % (N - 1) == 0 :
x, y = i, j
print(a[x], a[y])
| all_fail | 0 | 1 | [{"idx": 0, "reason": "wrong_answer", "expected": "2 10", "got": "10 2"}] | aizu | UNKNOWN | |
90 | 101_C. Vectors | At a geometry lesson Gerald was given a task: to get vector B out of vector A. Besides, the teacher permitted him to perform the following operations with vector А:
* Turn the vector by 90 degrees clockwise.
* Add to the vector a certain vector C.
Operations could be performed in any order any number of times.
... | java | import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class BetaRound79_Div1_C implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
public static void main(String[] args) {
... | all_fail | 0 | 25 | [{"idx": 0, "reason": "runtime_error", "rc": 255, "stderr": "java.io.FileNotFoundException: input.txt (No such file or directory)\n\tat java.base/java.io.FileInputStream.open0(Native Method)\n\tat java.base/java.io.FileInputStream.open(FileInputStream.java:216)\n\tat", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_... | codeforces | C | |
91 | 1043_A. Elections | Awruk is taking part in elections in his school. It is the final round. He has only one opponent — Elodreip. The are n students in the school. Each student has exactly k votes and is obligated to use all of them. So Awruk knows that if a person gives a_i votes for Elodreip, than he will get exactly k - a_i votes from t... | java | 'use strict';
const n = Number(readline());
const a = readline().split(' ').map(Number);
let votes = 0;
let max_a = 0;
for (let i = 0; i < n; i++) {
max_a = Math.max(max_a, a[i]);
votes += a[i];
}
print(Math.max(Math.ceil((2 * votes + 1) / n), max_a)); | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_3iwcil55/Main.java:1: error: unclosed character literal
'use strict';
^
/tmp/sbx_3iwcil55/Main.java:1: error: unclosed character literal
'use strict';
^
/tmp/sbx_3iwcil55/Main.java:4: error: class, interface, enum, or record expected
const a = readline().split(' ').map(Number);
^
/tmp/... | [] | codeforces | A |
93 | 1136_D. Nastya Is Buying Lunch | At the big break Nastya came to the school dining room. There are n pupils in the school, numbered from 1 to n. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya, but she is not going to de... | python3 | # Testing
# https://codeforces.com/contest/1136/submission/51182491
# with super quick input
import os
def read_input():
s = os.read(0,os.fstat(0).st_size)
inp = []
numb = 0
for i in range(len(s)):
if s[i]>=48:
numb = 10*numb + s[i]-48
elif s[i]!=13: #\r
inp.appe... | all_fail | 0 | 12 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_lhbhkysf/tmp1dh4jcx7.py\", line 20, in <module>\n inp = read_input()\n ^^^^^^^^^^^^\n File \"/tmp/sbx_lhbhkysf/tmp1dh4jcx7.py\", line 16, in ", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_... | codeforces | D | |
93 | 1136_D. Nastya Is Buying Lunch | At the big break Nastya came to the school dining room. There are n pupils in the school, numbered from 1 to n. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya, but she is not going to de... | python2 | from __future__ import print_function
import os
from cStringIO import StringIO
input = StringIO(os.read(0, os.fstat(0).st_size)).readline
print = lambda x: os.write(1, str(x).encode())
def main():
n, m = map(int, input().split())
p = [int(i) - 1 for i in input().split()]
pos = p[-1]
graph = [set() ... | all_fail | 0 | 12 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_b7dp4npt/tmp2jfdoeov.py\", line 29, in <module>\n main()\n File \"/tmp/sbx_b7dp4npt/tmp2jfdoeov.py\", line 11, in main\n n, m = map(int, input().sp", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_... | codeforces | D | |
93 | 1136_D. Nastya Is Buying Lunch | At the big break Nastya came to the school dining room. There are n pupils in the school, numbered from 1 to n. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya, but she is not going to de... | python2 | import os
from cStringIO import StringIO
input = StringIO(os.read(0, os.fstat(0).st_size)).readline
def main():
n, m = map(int, input().split())
p = [int(i) - 1 for i in input().split()]
pos = p[-1]
graph = [set() for _ in range(n)]
for i in range(m):
u, v = map(int, input().split())
... | all_fail | 0 | 12 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_wh1imc3n/tmpt4nfg9pe.py\", line 26, in <module>\n main()\n File \"/tmp/sbx_wh1imc3n/tmpt4nfg9pe.py\", line 8, in main\n n, m = map(int, input().spl", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_... | codeforces | D | |
94 | 1155_A. Reverse a Substring | You are given a string s consisting of n lowercase Latin letters.
Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position 3 and ends in position 6), but "aa" or "d" aren't substrings of this string. So the substring of the string s from po... | cpp | #include <bits/stdc++.h>
using namespace std;
int n, m, a, b, c, d;
struct node {
int a, b;
};
bool cmp(node x, node y) {
if (x.a == y.a) return x.b > y.b;
return x.a > y.a;
}
string s;
int num[30];
char cr, cr1;
int check(char cc) {
for (int i = cc - 'a' + 1; i < 26; ++i) {
if (num[i]) return num[i];
}
... | partial | 16 | 18 | [{"idx": 9, "reason": "wrong_answer", "expected": "YES\n2 3", "got": "YES\n1 3"}, {"idx": 11, "reason": "wrong_answer", "expected": "YES\n2 3", "got": "YES\n1 3"}] | codeforces | A | |
94 | 1155_A. Reverse a Substring | You are given a string s consisting of n lowercase Latin letters.
Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position 3 and ends in position 6), but "aa" or "d" aren't substrings of this string. So the substring of the string s from po... | python2 | import sys
n = int(raw_input())
inputStr = raw_input()
arr = [-1 for x in range(26)]
for idx,c in enumerate(inputStr):
arr[ord(c) - ord('a')] = idx
for idx,c in enumerate(inputStr):
o = ord(c) - ord('a')
for jdx in range(o):
if arr[jdx] > idx:
print "YES"
print idx+1... | partial | 9 | 18 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n2 3", "got": "YES\n2 7"}, {"idx": 5, "reason": "wrong_answer", "expected": "YES\n1 2", "got": "YES\n1 4"}, {"idx": 7, "reason": "wrong_answer", "expected": "YES\n1 2", "got": "YES\n1 4"}, {"idx": 9, "reason": "wrong_answer", "expected": "YES\n2 3", "got": "YES\n1 ... | codeforces | A | |
95 | 1176_F. Destroy it! | You are playing a computer card game called Splay the Sire. Currently you are struggling to defeat the final boss of the game.
The boss battle consists of n turns. During each turn, you will get several cards. Each card has two parameters: its cost c_i and damage d_i. You may play some of your cards during each turn i... | python2 | from __future__ import division, print_function
DEBUG = 0
import os, sys
from atexit import register
from io import BytesIO
import itertools
if sys.version_info[0] < 3:
input = raw_input
range = xrange
filter = itertools.ifilter
map = itertools.imap
zip = itertools.izip
if DEBUG:
debug_prin... | all_fail | 0 | 3 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_knx9pjx_/tmpvcwtd9xv.py\", line 89, in <module>\n main()\n File \"/tmp/sbx_knx9pjx_/tmpvcwtd9xv.py\", line 36, in main\n n = int(input())\nValueErro", "stdout_tail": ""}, {"idx": 1, "reason": "runtime... | codeforces | F | |
96 | 1195_D2. Submarine in the Rybinsk Sea (hard edition) | This problem differs from the previous one only in the absence of the constraint on the equal length of all numbers a_1, a_2, ..., a_n.
A team of SIS students is going to make a trip on a submarine. Their target is an ancient treasure in a sunken ship lying on the bottom of the Great Rybinsk sea. Unfortunately, the st... | java | import com.sun.org.apache.bcel.internal.generic.BIPUSH;
import java.io.*;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
public class D {
static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
sta... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_zxe25r0e/D.java:1: error: package com.sun.org.apache.bcel.internal.generic is not visible
import com.sun.org.apache.bcel.internal.generic.BIPUSH;
^
(package com.sun.org.apache.bcel.internal.generic is declared in module java.xml, which does not export it)
... | [] | codeforces | D |
98 | 1277_E. Two Fairs | There are n cities in Berland and some pairs of them are connected by two-way roads. It is guaranteed that you can pass from any city to any other, moving along the roads. Cities are numerated from 1 to n.
Two fairs are currently taking place in Berland — they are held in two different cities a and b (1 ≤ a, b ≤ n; a ... | python2 | import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')
def find(... | all_fail | 0 | 1 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_9fw800dh/tmpoenq41sv.py\", line 30, in <module>\n t = int(input())\nValueError: invalid literal for int() with base 10: ''\n", "stdout_tail": ""}] | codeforces | E | |
100 | 1382_A. Common Subsequence | You are given two arrays of integers a_1,…,a_n and b_1,…,b_m.
Your task is to find a non-empty array c_1,…,c_k that is a subsequence of a_1,…,a_n, and also a subsequence of b_1,…,b_m. If there are multiple answers, find one of the smallest possible length. If there are still multiple of the smallest possible length, f... | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, m;
cin >> n >> m;
int arr[n];
int arr1[m];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
for (int i = 0; i < m; i++) {
cin >> arr1[i];
}
int num = -1;
for (int i = ... | partial | 6 | 8 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n1 4\nYES\n1 3\nNO\nYES\n1 3\nYES\n1 1", "got": "YES\n1 4\nYES\n1 3\nNO\nYES\n1 3\nYES\n1 5"}, {"idx": 5, "reason": "wrong_answer", "expected": "YES\n1 4\nYES\n1 3\nNO\nYES\n1 3\nYES\n1 1", "got": "YES\n1 4\nYES\n1 3\nNO\nYES\n1 3\nYES\n1 5"}] | codeforces | A | |
100 | 1382_A. Common Subsequence | You are given two arrays of integers a_1,…,a_n and b_1,…,b_m.
Your task is to find a non-empty array c_1,…,c_k that is a subsequence of a_1,…,a_n, and also a subsequence of b_1,…,b_m. If there are multiple answers, find one of the smallest possible length. If there are still multiple of the smallest possible length, f... | python3 | #!/usr/bin/env python3
import io
import os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
def get_str():
return input().decode().strip()
def rint():
return map(int, input().split())
def oint():
return int(input())
t = oint()
for _ in range(t):
n, m = rint()
a = set(rint())
b =... | all_fail | 0 | 8 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_j81v2a5i/tmpxra2dtcc.py\", line 16, in <module>\n t = oint()\n ^^^^^^\n File \"/tmp/sbx_j81v2a5i/tmpxra2dtcc.py\", line 14, in oint\n return ", "stdout_tail": ""}, {"idx": 1, "reason": "runtime... | codeforces | A | |
100 | 1382_A. Common Subsequence | You are given two arrays of integers a_1,…,a_n and b_1,…,b_m.
Your task is to find a non-empty array c_1,…,c_k that is a subsequence of a_1,…,a_n, and also a subsequence of b_1,…,b_m. If there are multiple answers, find one of the smallest possible length. If there are still multiple of the smallest possible length, f... | python3 | a=int(input())#no. of test cases
for i in range(a):
l,r=map(int,input().split())
s1 = set(map(int, input().split()))
s2= set(map(int,input().split()))
s3= s1.intersection(s2)
if len(s3)!=0:
print("Yes")
print(1,min(s3))
else:
print("NO") | all_fail | 0 | 8 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n1 4\nYES\n1 3\nNO\nYES\n1 3\nYES\n1 1", "got": "Yes\n1 4\nYes\n1 3\nNO\nYes\n1 3\nYes\n1 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES\n1 1", "got": "Yes\n1 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "YES\n1 3", "got": "Yes\n1 3"}, {"idx": ... | codeforces | A | |
100 | 1382_A. Common Subsequence | You are given two arrays of integers a_1,…,a_n and b_1,…,b_m.
Your task is to find a non-empty array c_1,…,c_k that is a subsequence of a_1,…,a_n, and also a subsequence of b_1,…,b_m. If there are multiple answers, find one of the smallest possible length. If there are still multiple of the smallest possible length, f... | java | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int m = sc.nextInt();
HashSet<Integer> h =... | partial | 6 | 8 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n1 4\nYES\n1 3\nNO\nYES\n1 3\nYES\n1 1", "got": "YES\n1 4\nYES\n1 3\nNO\nYES\n1 3\nYES\n1 5"}, {"idx": 5, "reason": "wrong_answer", "expected": "YES\n1 4\nYES\n1 3\nNO\nYES\n1 3\nYES\n1 1", "got": "YES\n1 4\nYES\n1 3\nNO\nYES\n1 3\nYES\n1 5"}] | codeforces | A |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.