id stringlengths 6 117 | description stringlengths 29 13k | code stringlengths 9 465k | language class label 4
classes | test_samples dict | source class label 5
classes |
|---|---|---|---|---|---|
42_A. Guilty — to the kitchen!_1900 | It's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This should also improve his algebra skills.
According to the borscht recipe it consists of n ingredients that have to be mixed in propor... | n,v=map(int,input().split())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
mini=10**9
for i in range(n):
mini=min(mini,b[i]/a[i])
sm=0
for i in range(n):
sm=sm+mini*a[i]
print(min(sm,v)) | 3Python3 | {
"input": [
"1 100\n1\n40\n",
"2 100\n1 1\n60 60\n",
"2 100\n1 1\n25 30\n",
"5 5005\n5 53 65 52 99\n21 49 9 3 66\n",
"14 3615\n81 79 13 94 54 69 92 5 47 98 40 64 44 88\n52 73 7 12 29 40 46 47 60 66 63 68 71 4\n",
"7 529\n77 18 67 64 43 51 30\n35 87 17 52 1 97 84\n",
"16 1718\n42 68 96 52 ... | 2CODEFORCES |
42_A. Guilty — to the kitchen!_1901 | It's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This should also improve his algebra skills.
According to the borscht recipe it consists of n ingredients that have to be mixed in propor... | import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
public class Main implements Runnable {
public void solve() throws IOException {
int n = nextInt(), V = nextInt();
int[ ] a = new int[n];
for(int i = 0; i < n; ++i) {
a[i] = nextInt();
... | 4JAVA | {
"input": [
"1 100\n1\n40\n",
"2 100\n1 1\n60 60\n",
"2 100\n1 1\n25 30\n",
"5 5005\n5 53 65 52 99\n21 49 9 3 66\n",
"14 3615\n81 79 13 94 54 69 92 5 47 98 40 64 44 88\n52 73 7 12 29 40 46 47 60 66 63 68 71 4\n",
"7 529\n77 18 67 64 43 51 30\n35 87 17 52 1 97 84\n",
"16 1718\n42 68 96 52 ... | 2CODEFORCES |
451_D. Count Good Substrings_1902 | We call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. For example, "aabba" is good, because after the merging step it will become "aba".
Given a string, you have to find two values:
1. the number of good substrings of even length;
2. the number of good ... | s = raw_input()
n = len(s)
c = [[0, 1, 0, 0] for _ in range(n)]
for i in range(1, n):
if s[i] == s[i - 1]:
c[i][0] += c[i - 1][1]
c[i][1] += c[i - 1][0]
c[i][2] += c[i - 1][3]
c[i][3] += c[i - 1][2]
else:
c[i][0] += c[i - 1][3]
c[i][1] += c[i - 1][2]
c[i][... | 1Python2 | {
"input": [
"babaa\n",
"bb\n",
"baab\n",
"babb\n",
"bbabaaabaaaabaabbababbbabababaabaaaaabbaabbbbbaababaabbbaabaabaaaababaabaabbabaaabaabbbabbaaaaaaabaabababaaabaaabbbabbabbaabaaabaabbbbbabbababbbbbbbababbababbbabbbbbababaaaababaabbabaaabbaaabaabbbbabbaaababbbbbbaaabbaaabbaaabaaaaaababaabababaaba... | 2CODEFORCES |
451_D. Count Good Substrings_1903 | We call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. For example, "aabba" is good, because after the merging step it will become "aba".
Given a string, you have to find two values:
1. the number of good substrings of even length;
2. the number of good ... | #include <bits/stdc++.h>
const long long INF = 1e18;
const int MOD = 1e9 + 7;
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
string s;
cin >> s;
int n = s.size();
long long b_odd = 0, b_even = 0;
long long a_odd = 0, a_even = 0;
long long res = 0, reso = 0;
for (int i = 0; i < n; ++... | 2C++ | {
"input": [
"babaa\n",
"bb\n",
"baab\n",
"babb\n",
"bbabaaabaaaabaabbababbbabababaabaaaaabbaabbbbbaababaabbbaabaabaaaababaabaabbabaaabaabbbabbaaaaaaabaabababaaabaaabbbabbabbaabaaabaabbbbbabbababbbbbbbababbababbbabbbbbababaaaababaabbabaaabbaaabaabbbbabbaaababbbbbbaaabbaaabbaaabaaaaaababaabababaaba... | 2CODEFORCES |
451_D. Count Good Substrings_1904 | We call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. For example, "aabba" is good, because after the merging step it will become "aba".
Given a string, you have to find two values:
1. the number of good substrings of even length;
2. the number of good ... | s = input()
blocks = []
evenA = [0]
oddA = [0]
evenB = [0]
oddB = [0]
even = True
for x in s:
evenA.append(evenA[-1])
oddA.append(oddA[-1])
evenB.append(evenB[-1])
oddB.append(oddB[-1])
if x == 'a':
if even:
evenA[-1] += 1
else:
oddA[-1] += 1
else:
... | 3Python3 | {
"input": [
"babaa\n",
"bb\n",
"baab\n",
"babb\n",
"bbabaaabaaaabaabbababbbabababaabaaaaabbaabbbbbaababaabbbaabaabaaaababaabaabbabaaabaabbbabbaaaaaaabaabababaaabaaabbbabbabbaabaaabaabbbbbabbababbbbbbbababbababbbabbbbbababaaaababaabbabaaabbaaabaabbbbabbaaababbbbbbaaabbaaabbaaabaaaaaababaabababaaba... | 2CODEFORCES |
451_D. Count Good Substrings_1905 | We call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. For example, "aabba" is good, because after the merging step it will become "aba".
Given a string, you have to find two values:
1. the number of good substrings of even length;
2. the number of good ... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class D {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | 4JAVA | {
"input": [
"babaa\n",
"bb\n",
"baab\n",
"babb\n",
"bbabaaabaaaabaabbababbbabababaabaaaaabbaabbbbbaababaabbbaabaabaaaababaabaabbabaaabaabbbabbaaaaaaabaabababaaabaaabbbabbabbaabaaabaabbbbbabbababbbbbbbababbababbbabbbbbababaaaababaabbabaaabbaaabaabbbbabbaaababbbbbbaaabbaaabbaaabaaaaaababaabababaaba... | 2CODEFORCES |
474_C. Captain Marmot_1906 | Captain Marmot wants to prepare a huge and important battle against his enemy, Captain Snake. For this battle he has n regiments, each consisting of 4 moles.
Initially, each mole i (1 ≤ i ≤ 4n) is placed at some position (xi, yi) in the Cartesian plane. Captain Marmot wants to move some moles to make the regiments com... | import math
def dis(a,b):
x1,y1=a
x2,y2=b
return (x2-x1)**2+(y2-y1)**2
def rotate(origin, point, angle):
"""
Rotate a point counterclockwise by a given angle around a given origin.
The angle should be given in radians.
"""
angle=math.radians(angle)
ox, oy = origin
px, py = poin... | 1Python2 | {
"input": [
"4\n1 1 0 0\n-1 1 0 0\n-1 1 0 0\n1 -1 0 0\n1 1 0 0\n-2 1 0 0\n-1 1 0 0\n1 -1 0 0\n1 1 0 0\n-1 1 0 0\n-1 1 0 0\n-1 1 0 0\n2 2 0 1\n-1 0 0 -2\n3 0 0 -2\n-1 1 -2 0\n",
"1\n1 0 2 0\n-1 0 -2 0\n0 1 0 2\n0 -1 0 -2\n",
"4\n1 0 0 0\n0 2 0 0\n-1 0 0 0\n0 -2 0 0\n1 0 0 0\n0 1 0 0\n-1 0 0 0\n0 -1 0 0\n1... | 2CODEFORCES |
474_C. Captain Marmot_1907 | Captain Marmot wants to prepare a huge and important battle against his enemy, Captain Snake. For this battle he has n regiments, each consisting of 4 moles.
Initially, each mole i (1 ≤ i ≤ 4n) is placed at some position (xi, yi) in the Cartesian plane. Captain Marmot wants to move some moles to make the regiments com... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
long long sqr(long long a) { return a * a; }
long long dist(pair<int, int> a, pair<int, int> b) {
return sqr(a.first - b.first) + sqr(a.second - b.second);
}
pair<int, int> newval(pair<int, int> a, pair<int, int> b) {
pair<int, int> v((b.first -... | 2C++ | {
"input": [
"4\n1 1 0 0\n-1 1 0 0\n-1 1 0 0\n1 -1 0 0\n1 1 0 0\n-2 1 0 0\n-1 1 0 0\n1 -1 0 0\n1 1 0 0\n-1 1 0 0\n-1 1 0 0\n-1 1 0 0\n2 2 0 1\n-1 0 0 -2\n3 0 0 -2\n-1 1 -2 0\n",
"1\n1 0 2 0\n-1 0 -2 0\n0 1 0 2\n0 -1 0 -2\n",
"4\n1 0 0 0\n0 2 0 0\n-1 0 0 0\n0 -2 0 0\n1 0 0 0\n0 1 0 0\n-1 0 0 0\n0 -1 0 0\n1... | 2CODEFORCES |
474_C. Captain Marmot_1908 | Captain Marmot wants to prepare a huge and important battle against his enemy, Captain Snake. For this battle he has n regiments, each consisting of 4 moles.
Initially, each mole i (1 ≤ i ≤ 4n) is placed at some position (xi, yi) in the Cartesian plane. Captain Marmot wants to move some moles to make the regiments com... | #a+b-y
#x+b-a
#1 -
import sys
input=sys.stdin.readline
def distSq(p1,p2):
return (p1[0]-p2[0])*(p1[0]-p2[0])+(p1[1]-p2[1])*(p1[1]-p2[1])
def isSquare(p1, p2, p3, p4):
d2 = distSq(p1, p2) # from p1 to p2
d3 = distSq(p1, p3) # from p1 to p3
d4 = distSq(p1, p4) # from p1 to p4
# If length... | 3Python3 | {
"input": [
"4\n1 1 0 0\n-1 1 0 0\n-1 1 0 0\n1 -1 0 0\n1 1 0 0\n-2 1 0 0\n-1 1 0 0\n1 -1 0 0\n1 1 0 0\n-1 1 0 0\n-1 1 0 0\n-1 1 0 0\n2 2 0 1\n-1 0 0 -2\n3 0 0 -2\n-1 1 -2 0\n",
"1\n1 0 2 0\n-1 0 -2 0\n0 1 0 2\n0 -1 0 -2\n",
"4\n1 0 0 0\n0 2 0 0\n-1 0 0 0\n0 -2 0 0\n1 0 0 0\n0 1 0 0\n-1 0 0 0\n0 -1 0 0\n1... | 2CODEFORCES |
474_C. Captain Marmot_1909 | Captain Marmot wants to prepare a huge and important battle against his enemy, Captain Snake. For this battle he has n regiments, each consisting of 4 moles.
Initially, each mole i (1 ≤ i ≤ 4n) is placed at some position (xi, yi) in the Cartesian plane. Captain Marmot wants to move some moles to make the regiments com... | import java.io.*;
import java.math.*;
import java.security.KeyStore.Entry;
import java.util.*;
public class TestClass {
private static InputStream stream;
private static byte[] buf = new byte[1024];
private static int curChar;
private static int numChars;
private static SpaceCharFilter filter;
private static Pri... | 4JAVA | {
"input": [
"4\n1 1 0 0\n-1 1 0 0\n-1 1 0 0\n1 -1 0 0\n1 1 0 0\n-2 1 0 0\n-1 1 0 0\n1 -1 0 0\n1 1 0 0\n-1 1 0 0\n-1 1 0 0\n-1 1 0 0\n2 2 0 1\n-1 0 0 -2\n3 0 0 -2\n-1 1 -2 0\n",
"1\n1 0 2 0\n-1 0 -2 0\n0 1 0 2\n0 -1 0 -2\n",
"4\n1 0 0 0\n0 2 0 0\n-1 0 0 0\n0 -2 0 0\n1 0 0 0\n0 1 0 0\n-1 0 0 0\n0 -1 0 0\n1... | 2CODEFORCES |
498_B. Name That Tune_1910 | It turns out that you are a great fan of rock band AC/PE. Peter learned that and started the following game: he plays the first song of the list of n songs of the group, and you have to find out the name of the song. After you tell the song name, Peter immediately plays the following song in order, and so on.
The i-th... | def main():
n, time = map(int, raw_input().split())
pp, qq, tt, qqtt = [], [], [], []
for i in xrange(n):
a, b = raw_input().split()
p = float(a) / 100.
pp.append(p)
q = 1. - p
qq.append(q)
t = int(b) - 1
tt.append(t)
qqtt.append(q ** t)
t_... | 1Python2 | {
"input": [
"2 2\n50 2\n10 1\n",
"2 2\n0 2\n0 2\n",
"3 3\n50 3\n50 2\n25 2\n",
"2 2\n0 2\n100 2\n",
"37 4648\n53 3169\n66 4152\n81 4540\n98 4302\n51 4427\n42 2556\n35 2288\n56 2401\n12 3864\n45 4223\n93 1809\n4 2372\n17 4357\n67 1700\n19 4508\n5 2586\n99 2754\n4 3163\n97 4171\n27 4345\n82 4509\n2... | 2CODEFORCES |
498_B. Name That Tune_1911 | It turns out that you are a great fan of rock band AC/PE. Peter learned that and started the following game: he plays the first song of the list of n songs of the group, and you have to find out the name of the song. After you tell the song name, Peter immediately plays the following song in order, and so on.
The i-th... | #include <bits/stdc++.h>
using namespace std;
const int MAX = 5010;
int main() {
int n, T;
scanf("%d%d", &n, &T);
double ds1[MAX] = {};
double ds2[MAX] = {};
double *rs = ds1, *rs2 = ds2;
double res[MAX] = {};
for (int i = 0; i < n; ++i) {
rs2[0] = i == 0;
int P, t;
scanf("%d%d", &P, &t);
... | 2C++ | {
"input": [
"2 2\n50 2\n10 1\n",
"2 2\n0 2\n0 2\n",
"3 3\n50 3\n50 2\n25 2\n",
"2 2\n0 2\n100 2\n",
"37 4648\n53 3169\n66 4152\n81 4540\n98 4302\n51 4427\n42 2556\n35 2288\n56 2401\n12 3864\n45 4223\n93 1809\n4 2372\n17 4357\n67 1700\n19 4508\n5 2586\n99 2754\n4 3163\n97 4171\n27 4345\n82 4509\n2... | 2CODEFORCES |
498_B. Name That Tune_1912 | It turns out that you are a great fan of rock band AC/PE. Peter learned that and started the following game: he plays the first song of the list of n songs of the group, and you have to find out the name of the song. After you tell the song name, Peter immediately plays the following song in order, and so on.
The i-th... | import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import jav... | 4JAVA | {
"input": [
"2 2\n50 2\n10 1\n",
"2 2\n0 2\n0 2\n",
"3 3\n50 3\n50 2\n25 2\n",
"2 2\n0 2\n100 2\n",
"37 4648\n53 3169\n66 4152\n81 4540\n98 4302\n51 4427\n42 2556\n35 2288\n56 2401\n12 3864\n45 4223\n93 1809\n4 2372\n17 4357\n67 1700\n19 4508\n5 2586\n99 2754\n4 3163\n97 4171\n27 4345\n82 4509\n2... | 2CODEFORCES |
521_C. Pluses everywhere_1913 | Vasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out n numbers on a single line. After that, Vasya began to write out different ways to put pluses ("+") in the line between certain digits in the line so that the result was a correct arithmetic expression; formally, no ... | def main():
n, k = map(int, raw_input().split())
s = map(int, raw_input().strip())
mod = 1000000007
if k == 0:
ans = 0
for x in s:
ans = (ans * 10 + x) % mod
print ans
return
f = [1]
for i in xrange(1, 100001):
f.append(f[-1] * i % mod)
inv... | 1Python2 | {
"input": [
"3 1\n108\n",
"3 2\n108\n",
"57 13\n177946005798852216692528643323484389368821547834013121843\n",
"16 15\n8086179429588546\n",
"14 6\n00000000000001\n",
"200 100\n5698871975581557589328225408146769846248580378214263136938518099974663962255455988428119336734228355923883410691738816... | 2CODEFORCES |
521_C. Pluses everywhere_1914 | Vasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out n numbers on a single line. After that, Vasya began to write out different ways to put pluses ("+") in the line between certain digits in the line so that the result was a correct arithmetic expression; formally, no ... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int mod = 1e9 + 7;
int n, k;
int inv[MAXN];
int a[MAXN];
int pow(int a, int b) {
long long res = 1, tmp = a;
while (b) {
if (b & 1) res = res * tmp % mod;
tmp = tmp * tmp % mod;
b >>= 1;
}
return res;
}
void solve() {
lon... | 2C++ | {
"input": [
"3 1\n108\n",
"3 2\n108\n",
"57 13\n177946005798852216692528643323484389368821547834013121843\n",
"16 15\n8086179429588546\n",
"14 6\n00000000000001\n",
"200 100\n5698871975581557589328225408146769846248580378214263136938518099974663962255455988428119336734228355923883410691738816... | 2CODEFORCES |
521_C. Pluses everywhere_1915 | Vasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out n numbers on a single line. After that, Vasya began to write out different ways to put pluses ("+") in the line between certain digits in the line so that the result was a correct arithmetic expression; formally, no ... | n, k = map(int, input().split())
t = list(map(int, input()))
p, d = 1, 10 ** 9 + 7
s, f = 0, [1] * n
for i in range(2, n): f[i] = (i * f[i - 1]) % d
c = lambda a, b: 0 if a > b else (f[b] * pow(f[a] * f[b - a], d - 2, d)) % d
if k:
u = [0] * (n + 1)
p = [1] * (n + 1)
for i in range(n):
u[i... | 3Python3 | {
"input": [
"3 1\n108\n",
"3 2\n108\n",
"57 13\n177946005798852216692528643323484389368821547834013121843\n",
"16 15\n8086179429588546\n",
"14 6\n00000000000001\n",
"200 100\n5698871975581557589328225408146769846248580378214263136938518099974663962255455988428119336734228355923883410691738816... | 2CODEFORCES |
521_C. Pluses everywhere_1916 | Vasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out n numbers on a single line. After that, Vasya began to write out different ways to put pluses ("+") in the line between certain digits in the line so that the result was a correct arithmetic expression; formally, no ... | import java.util.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
public class Main{
// ArrayList<Integer> lis = new ArrayList<Integer>();
// ArrayList<String> lis = new ArrayList<String>();
// PriorityQueue<P> que... | 4JAVA | {
"input": [
"3 1\n108\n",
"3 2\n108\n",
"57 13\n177946005798852216692528643323484389368821547834013121843\n",
"16 15\n8086179429588546\n",
"14 6\n00000000000001\n",
"200 100\n5698871975581557589328225408146769846248580378214263136938518099974663962255455988428119336734228355923883410691738816... | 2CODEFORCES |
548_E. Mike and Foam_1917 | Mike is a bartender at Rico's bar. At Rico's, they put beer glasses in a special shelf. There are n kinds of beer at Rico's numbered from 1 to n. i-th kind of beer has ai milliliters of foam on it.
<image>
Maxim is Mike's boss. Today he told Mike to perform q queries. Initially the shelf is empty. In each request, Ma... | #include <bits/stdc++.h>
using namespace std;
static const int maxn = 5e5 + 6;
int sp[maxn];
vector<int> divisor[maxn];
void seive() {
for (int i = 2; i < maxn; i++) sp[i] = i;
for (int i = 2; i < maxn; i++) {
for (int j = 1; 1LL * i * j < maxn; j++) {
sp[i * j] = min(sp[i * j], sp[i]);
divisor[i * ... | 2C++ | {
"input": [
"5 6\n1 2 3 4 6\n1\n2\n3\n4\n5\n1\n",
"5 10\n1 1 1 1 1\n1\n2\n3\n4\n5\n5\n4\n3\n2\n1\n",
"1 1\n1\n1\n",
"1 2\n499590\n1\n1\n",
"3 3\n151790 360570 1\n2\n3\n3\n",
"5 10\n1 1 1 1 1\n1\n2\n3\n4\n5\n1\n4\n3\n2\n1\n",
"5 6\n1 2 3 4 6\n1\n2\n4\n4\n5\n1\n",
"5 6\n1 2 3 4 6\n1\n2\... | 2CODEFORCES |
548_E. Mike and Foam_1918 | Mike is a bartender at Rico's bar. At Rico's, they put beer glasses in a special shelf. There are n kinds of beer at Rico's numbered from 1 to n. i-th kind of beer has ai milliliters of foam on it.
<image>
Maxim is Mike's boss. Today he told Mike to perform q queries. Initially the shelf is empty. In each request, Ma... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class Main
{
final static int AMAX = 600000;
long[] coef = new long[ AM... | 4JAVA | {
"input": [
"5 6\n1 2 3 4 6\n1\n2\n3\n4\n5\n1\n",
"5 10\n1 1 1 1 1\n1\n2\n3\n4\n5\n5\n4\n3\n2\n1\n",
"1 1\n1\n1\n",
"1 2\n499590\n1\n1\n",
"3 3\n151790 360570 1\n2\n3\n3\n",
"5 10\n1 1 1 1 1\n1\n2\n3\n4\n5\n1\n4\n3\n2\n1\n",
"5 6\n1 2 3 4 6\n1\n2\n4\n4\n5\n1\n",
"5 6\n1 2 3 4 6\n1\n2\... | 2CODEFORCES |
575_B. Bribes_1919 | Ruritania is a country with a very badly maintained road network, which is not exactly good news for lorry drivers that constantly have to do deliveries. In fact, when roads are maintained, they become one-way. It turns out that it is sometimes impossible to get from one town to another in a legal way – however, we kno... | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
register long long x = 0, f = 1;
register char c = getchar();
for (; !isdigit(c); c = getchar())
if (c == '-') f = -1;
for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
return x * f;
}
struct Edge {
long long to,... | 2C++ | {
"input": [
"5\n1 2 0\n2 3 0\n5 1 1\n3 4 1\n5\n5 4 5 2 2\n",
"4\n1 2 1\n3 2 0\n2 4 0\n10\n3 4 1 3 1 4 2 3 1 4\n",
"4\n1 2 1\n3 2 0\n2 4 0\n10\n3 4 2 3 4 2 3 4 2 4\n",
"8\n2 1 1\n2 3 1\n8 7 0\n5 6 0\n7 5 1\n1 5 0\n2 4 0\n15\n3 7 1 1 2 2 7 6 4 4 3 8 6 3 7\n",
"4\n1 2 1\n3 2 0\n3 4 0\n10\n3 4 2 3 4 ... | 2CODEFORCES |
575_B. Bribes_1920 | Ruritania is a country with a very badly maintained road network, which is not exactly good news for lorry drivers that constantly have to do deliveries. In fact, when roads are maintained, they become one-way. It turns out that it is sometimes impossible to get from one town to another in a legal way – however, we kno... | import java.io.*;
import java.util.*;
import java.math.*;
import javax.management.MalformedObjectNameException;
public class B implements Runnable {
private static BufferedReader in;
private static PrintWriter out;
private static StringTokenizer st;
private static Random rnd;
static class Edge {
int to, type;... | 4JAVA | {
"input": [
"5\n1 2 0\n2 3 0\n5 1 1\n3 4 1\n5\n5 4 5 2 2\n",
"4\n1 2 1\n3 2 0\n2 4 0\n10\n3 4 1 3 1 4 2 3 1 4\n",
"4\n1 2 1\n3 2 0\n2 4 0\n10\n3 4 2 3 4 2 3 4 2 4\n",
"8\n2 1 1\n2 3 1\n8 7 0\n5 6 0\n7 5 1\n1 5 0\n2 4 0\n15\n3 7 1 1 2 2 7 6 4 4 3 8 6 3 7\n",
"4\n1 2 1\n3 2 0\n3 4 0\n10\n3 4 2 3 4 ... | 2CODEFORCES |
596_E. Wilbur and Strings_1921 | Wilbur the pig now wants to play with strings. He has found an n by m table consisting only of the digits from 0 to 9 where the rows are numbered 1 to n and the columns are numbered 1 to m. Wilbur starts at some square and makes certain moves. If he is at square (x, y) and the digit d (0 ≤ d ≤ 9) is written at position... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 202;
const int maxs = 1000004;
int data[maxn * maxn], n, m, q;
int iscir[maxn * maxn], cir[maxn * maxn][10], N[maxn * maxn];
int X[10], Y[10];
void readin() {
scanf("%d%d%d", &n, &m, &q);
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++) {
... | 2C++ | {
"input": [
"4 2 5\n01\n23\n45\n67\n0 1\n0 -1\n0 1\n0 -1\n0 1\n0 -1\n0 1\n0 -1\n0 1\n0 -1\n0000000000\n010101011101\n32232232322\n44343222342444324\n6767\n",
"1 1 2\n0\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n0000000000000\n2413423432432\n",
"4 9 66\n948394151\n570018719\n639380858\n297865879\n... | 2CODEFORCES |
596_E. Wilbur and Strings_1922 | Wilbur the pig now wants to play with strings. He has found an n by m table consisting only of the digits from 0 to 9 where the rows are numbered 1 to n and the columns are numbered 1 to m. Wilbur starts at some square and makes certain moves. If he is at square (x, y) and the digit d (0 ≤ d ≤ 9) is written at position... | //package codeforces.cfr331div2;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;
/**
* Created by raggzy on 3/10/2016.
*/
public class E {
private static int n;
private static int m;
private static Cell[][] ... | 4JAVA | {
"input": [
"4 2 5\n01\n23\n45\n67\n0 1\n0 -1\n0 1\n0 -1\n0 1\n0 -1\n0 1\n0 -1\n0 1\n0 -1\n0000000000\n010101011101\n32232232322\n44343222342444324\n6767\n",
"1 1 2\n0\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n0000000000000\n2413423432432\n",
"4 9 66\n948394151\n570018719\n639380858\n297865879\n... | 2CODEFORCES |
618_B. Guess the Permutation_1923 | Bob has a permutation of integers from 1 to n. Denote this permutation as p. The i-th element of p will be denoted as pi. For all pairs of distinct integers i, j between 1 and n, he wrote the number ai, j = min(pi, pj). He writes ai, i = 0 for all integer i from 1 to n.
Bob gave you all the values of ai, j that he wro... | from math import *
from Queue import *
from sys import *
n = int(raw_input())
res = [set() for i in range(n+1)]
size = [n+1 for i in range(n+1)]
for i in range(1,n+1):
for j in range(1,n+1):
res[i].add(j)
size[i] = n
for i in range(n):
a = map(int, raw_input().split())
for j in range(len(a))... | 1Python2 | {
"input": [
"2\n0 1\n1 0\n",
"5\n0 2 2 1 2\n2 0 4 1 3\n2 4 0 1 3\n1 1 1 0 1\n2 3 3 1 0\n",
"10\n0 1 5 2 5 3 4 5 5 5\n1 0 1 1 1 1 1 1 1 1\n5 1 0 2 6 3 4 6 6 6\n2 1 2 0 2 2 2 2 2 2\n5 1 6 2 0 3 4 8 8 7\n3 1 3 2 3 0 3 3 3 3\n4 1 4 2 4 3 0 4 4 4\n5 1 6 2 8 3 4 0 9 7\n5 1 6 2 8 3 4 9 0 7\n5 1 6 2 7 3 4 7 7 0\... | 2CODEFORCES |
618_B. Guess the Permutation_1924 | Bob has a permutation of integers from 1 to n. Denote this permutation as p. The i-th element of p will be denoted as pi. For all pairs of distinct integers i, j between 1 and n, he wrote the number ai, j = min(pi, pj). He writes ai, i = 0 for all integer i from 1 to n.
Bob gave you all the values of ai, j that he wro... | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> matrix[52];
int n;
vector<int> fila(52, 0);
cin >> n;
for (int i = int(0); i < int(n); i++) {
for (int j = int(0); j < int(n); j++) {
int num;
cin >> num;
matrix[i].push_back(num);
}
}
for (int i = int(0); i <... | 2C++ | {
"input": [
"2\n0 1\n1 0\n",
"5\n0 2 2 1 2\n2 0 4 1 3\n2 4 0 1 3\n1 1 1 0 1\n2 3 3 1 0\n",
"10\n0 1 5 2 5 3 4 5 5 5\n1 0 1 1 1 1 1 1 1 1\n5 1 0 2 6 3 4 6 6 6\n2 1 2 0 2 2 2 2 2 2\n5 1 6 2 0 3 4 8 8 7\n3 1 3 2 3 0 3 3 3 3\n4 1 4 2 4 3 0 4 4 4\n5 1 6 2 8 3 4 0 9 7\n5 1 6 2 8 3 4 9 0 7\n5 1 6 2 7 3 4 7 7 0\... | 2CODEFORCES |
618_B. Guess the Permutation_1925 | Bob has a permutation of integers from 1 to n. Denote this permutation as p. The i-th element of p will be denoted as pi. For all pairs of distinct integers i, j between 1 and n, he wrote the number ai, j = min(pi, pj). He writes ai, i = 0 for all integer i from 1 to n.
Bob gave you all the values of ai, j that he wro... | # from pprint import pprint
n = int(input())
a = []
for i in range(n):
row = [int(k) for k in input().split()]
a.append(row)
result = [0] * n
for k in range(1, n):
# print('k=', k)
for i in range(n):
countK = 0
countNonK = 0
for j in range(n):
if a[i][j] == k:
... | 3Python3 | {
"input": [
"2\n0 1\n1 0\n",
"5\n0 2 2 1 2\n2 0 4 1 3\n2 4 0 1 3\n1 1 1 0 1\n2 3 3 1 0\n",
"10\n0 1 5 2 5 3 4 5 5 5\n1 0 1 1 1 1 1 1 1 1\n5 1 0 2 6 3 4 6 6 6\n2 1 2 0 2 2 2 2 2 2\n5 1 6 2 0 3 4 8 8 7\n3 1 3 2 3 0 3 3 3 3\n4 1 4 2 4 3 0 4 4 4\n5 1 6 2 8 3 4 0 9 7\n5 1 6 2 8 3 4 9 0 7\n5 1 6 2 7 3 4 7 7 0\... | 2CODEFORCES |
618_B. Guess the Permutation_1926 | Bob has a permutation of integers from 1 to n. Denote this permutation as p. The i-th element of p will be denoted as pi. For all pairs of distinct integers i, j between 1 and n, he wrote the number ai, j = min(pi, pj). He writes ai, i = 0 for all integer i from 1 to n.
Bob gave you all the values of ai, j that he wro... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int i=sc.nextInt();
int x=-1;
int max=-1;
for (int m=0;m<i;m++) {
for (int n=0;n<i;n++) {
int s=sc.nextInt();
if (s>x) {
x=s;
}
}
if (x>max) {
max=x;
}else if... | 4JAVA | {
"input": [
"2\n0 1\n1 0\n",
"5\n0 2 2 1 2\n2 0 4 1 3\n2 4 0 1 3\n1 1 1 0 1\n2 3 3 1 0\n",
"10\n0 1 5 2 5 3 4 5 5 5\n1 0 1 1 1 1 1 1 1 1\n5 1 0 2 6 3 4 6 6 6\n2 1 2 0 2 2 2 2 2 2\n5 1 6 2 0 3 4 8 8 7\n3 1 3 2 3 0 3 3 3 3\n4 1 4 2 4 3 0 4 4 4\n5 1 6 2 8 3 4 0 9 7\n5 1 6 2 8 3 4 9 0 7\n5 1 6 2 7 3 4 7 7 0\... | 2CODEFORCES |
638_D. Three-dimensional Turtle Super Computer _1927 | A super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepiped of size n × m × k, split into 1 × 1 × 1 cells, each cell contains exactly one CPU. Thus, each CPU can be simultaneously identified as a group of three numbers from the layer nu... | n, m, k = map(int, raw_input().split())
a = [[raw_input() for _ in xrange(m)]]
for _ in xrange(n - 1):
raw_input()
a.append([raw_input() for _ in xrange(m)])
ans = 0
for i in xrange(n):
for j in xrange(m):
for l in xrange(k):
if a[i][j][l] == '0':
continue
... | 1Python2 | {
"input": [
"1 1 10\n0101010101\n",
"2 2 3\n000\n000\n\n111\n111\n",
"3 3 3\n111\n111\n111\n\n111\n111\n111\n\n111\n111\n111\n",
"1 1 3\n111\n",
"1 3 1\n1\n1\n1\n",
"3 1 1\n1\n\n1\n\n1\n",
"3 1 1\n1\n\n0\n\n1\n",
"1 1 3\n011\n",
"1 3 1\n1\n0\n1\n",
"6 8 3\n011\n001\n000\n100\n... | 2CODEFORCES |
638_D. Three-dimensional Turtle Super Computer _1928 | A super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepiped of size n × m × k, split into 1 × 1 × 1 cells, each cell contains exactly one CPU. Thus, each CPU can be simultaneously identified as a group of three numbers from the layer nu... | #include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int INFi = 1e9 * 2;
const int maxN = 100;
const int P = 998244353;
const int md = 1e9 + 7;
double getTime() { return clock() / (double)CLOCKS_PER_SEC; };
int state[maxN][maxN][maxN];
int di[4] = {0, 0, 1};
int dj[4] = {0, 1, 0};
int de[4] =... | 2C++ | {
"input": [
"1 1 10\n0101010101\n",
"2 2 3\n000\n000\n\n111\n111\n",
"3 3 3\n111\n111\n111\n\n111\n111\n111\n\n111\n111\n111\n",
"1 1 3\n111\n",
"1 3 1\n1\n1\n1\n",
"3 1 1\n1\n\n1\n\n1\n",
"3 1 1\n1\n\n0\n\n1\n",
"1 1 3\n011\n",
"1 3 1\n1\n0\n1\n",
"6 8 3\n011\n001\n000\n100\n... | 2CODEFORCES |
638_D. Three-dimensional Turtle Super Computer _1929 | A super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepiped of size n × m × k, split into 1 × 1 × 1 cells, each cell contains exactly one CPU. Thus, each CPU can be simultaneously identified as a group of three numbers from the layer nu... | def main():
s = input().split()
n, m, k = int(s[0]), int(s[1]), int(s[2])
processor = []
for x in range(n):
for y in range(m):
s = input()
for z in s:
processor.append(int(z) == 1)
if x < n - 1:
emptyLine = input()
counter = 0
m... | 3Python3 | {
"input": [
"1 1 10\n0101010101\n",
"2 2 3\n000\n000\n\n111\n111\n",
"3 3 3\n111\n111\n111\n\n111\n111\n111\n\n111\n111\n111\n",
"1 1 3\n111\n",
"1 3 1\n1\n1\n1\n",
"3 1 1\n1\n\n1\n\n1\n",
"3 1 1\n1\n\n0\n\n1\n",
"1 1 3\n011\n",
"1 3 1\n1\n0\n1\n",
"6 8 3\n011\n001\n000\n100\n... | 2CODEFORCES |
638_D. Three-dimensional Turtle Super Computer _1930 | A super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepiped of size n × m × k, split into 1 × 1 × 1 cells, each cell contains exactly one CPU. Thus, each CPU can be simultaneously identified as a group of three numbers from the layer nu... | import sun.security.tools.KeyStoreUtil;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
public class Main {
StreamTokenizer in;
PrintWriter out;
void solve() throws IOException {
int n = nI();
int m = nI();
int k = nI();
int s = 0;
boolean [][... | 4JAVA | {
"input": [
"1 1 10\n0101010101\n",
"2 2 3\n000\n000\n\n111\n111\n",
"3 3 3\n111\n111\n111\n\n111\n111\n111\n\n111\n111\n111\n",
"1 1 3\n111\n",
"1 3 1\n1\n1\n1\n",
"3 1 1\n1\n\n1\n\n1\n",
"3 1 1\n1\n\n0\n\n1\n",
"1 1 3\n011\n",
"1 3 1\n1\n0\n1\n",
"6 8 3\n011\n001\n000\n100\n... | 2CODEFORCES |
666_B. World Tour_1931 | A famous sculptor Cicasso goes to a world tour!
Well, it is not actually a world-wide. But not everyone should have the opportunity to see works of sculptor, shouldn't he? Otherwise there will be no any exclusivity. So Cicasso will entirely hold the world tour in his native country — Berland.
Cicasso is very devoted ... | #!/usr/bin/env python
from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
from heapq import heappop, heappush
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
INF = float('inf')
... | 1Python2 | {
"input": [
"8 9\n1 2\n2 3\n3 4\n4 1\n4 5\n5 6\n6 7\n7 8\n8 5\n",
"4 15\n1 2\n1 4\n1 2\n1 4\n1 1\n1 3\n2 1\n2 4\n3 1\n3 2\n4 1\n4 2\n4 2\n4 4\n4 3\n",
"4 3\n3 2\n2 1\n1 4\n",
"4 14\n1 3\n1 1\n2 4\n2 2\n2 3\n2 4\n2 1\n3 3\n3 1\n3 4\n3 4\n4 1\n4 4\n4 1\n",
"4 6\n1 2\n1 3\n1 4\n2 3\n3 4\n4 2\n",
... | 2CODEFORCES |
666_B. World Tour_1932 | A famous sculptor Cicasso goes to a world tour!
Well, it is not actually a world-wide. But not everyone should have the opportunity to see works of sculptor, shouldn't he? Otherwise there will be no any exclusivity. So Cicasso will entirely hold the world tour in his native country — Berland.
Cicasso is very devoted ... | #include <bits/stdc++.h>
using namespace std;
vector<int> u[3005];
int sp[3005][3005];
int n, m;
vector<pair<int, int> > fin[3005];
vector<pair<int, int> > fout[3005];
int p[4];
int bp[4];
int bl;
void upd() {
int l = 0;
for (int i = (0); i < (3); i++) l += sp[p[i]][p[i + 1]];
if (l > bl) {
for (int i = (1); ... | 2C++ | {
"input": [
"8 9\n1 2\n2 3\n3 4\n4 1\n4 5\n5 6\n6 7\n7 8\n8 5\n",
"4 15\n1 2\n1 4\n1 2\n1 4\n1 1\n1 3\n2 1\n2 4\n3 1\n3 2\n4 1\n4 2\n4 2\n4 4\n4 3\n",
"4 3\n3 2\n2 1\n1 4\n",
"4 14\n1 3\n1 1\n2 4\n2 2\n2 3\n2 4\n2 1\n3 3\n3 1\n3 4\n3 4\n4 1\n4 4\n4 1\n",
"4 6\n1 2\n1 3\n1 4\n2 3\n3 4\n4 2\n",
... | 2CODEFORCES |
666_B. World Tour_1933 | A famous sculptor Cicasso goes to a world tour!
Well, it is not actually a world-wide. But not everyone should have the opportunity to see works of sculptor, shouldn't he? Otherwise there will be no any exclusivity. So Cicasso will entirely hold the world tour in his native country — Berland.
Cicasso is very devoted ... | import java.io.*;
import java.util.*;
public class R349qB {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int n = in.nextInt();
int m = in.nextInt();
MyArrayList g[] = new MyArrayList[n];
MyArrayList r[] = new MyArr... | 4JAVA | {
"input": [
"8 9\n1 2\n2 3\n3 4\n4 1\n4 5\n5 6\n6 7\n7 8\n8 5\n",
"4 15\n1 2\n1 4\n1 2\n1 4\n1 1\n1 3\n2 1\n2 4\n3 1\n3 2\n4 1\n4 2\n4 2\n4 4\n4 3\n",
"4 3\n3 2\n2 1\n1 4\n",
"4 14\n1 3\n1 1\n2 4\n2 2\n2 3\n2 4\n2 1\n3 3\n3 1\n3 4\n3 4\n4 1\n4 4\n4 1\n",
"4 6\n1 2\n1 3\n1 4\n2 3\n3 4\n4 2\n",
... | 2CODEFORCES |
690_A1. Collective Mindsets (easy)_1934 | Tonight is brain dinner night and all zombies will gather together to scarf down some delicious brains. The artful Heidi plans to crash the party, incognito, disguised as one of them. Her objective is to get away with at least one brain, so she can analyze the zombies' mindset back home and gain a strategic advantage.
... | print (input() + 1) >> 1 | 1Python2 | {
"input": [
"1\n",
"4\n",
"1000000000\n",
"536870912\n",
"16\n",
"6\n",
"18\n",
"13\n",
"20\n",
"7\n",
"10\n",
"8\n",
"2\n",
"21736\n",
"12\n",
"9\n",
"9999\n",
"873467\n",
"536870910\n",
"17\n",
"4124980\n",
"15\n",
"5\n",
... | 2CODEFORCES |
690_A1. Collective Mindsets (easy)_1935 | Tonight is brain dinner night and all zombies will gather together to scarf down some delicious brains. The artful Heidi plans to crash the party, incognito, disguised as one of them. Her objective is to get away with at least one brain, so she can analyze the zombies' mindset back home and gain a strategic advantage.
... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
cout << (n + 1) / 2 << "\n";
return 0;
}
| 2C++ | {
"input": [
"1\n",
"4\n",
"1000000000\n",
"536870912\n",
"16\n",
"6\n",
"18\n",
"13\n",
"20\n",
"7\n",
"10\n",
"8\n",
"2\n",
"21736\n",
"12\n",
"9\n",
"9999\n",
"873467\n",
"536870910\n",
"17\n",
"4124980\n",
"15\n",
"5\n",
... | 2CODEFORCES |
690_A1. Collective Mindsets (easy)_1936 | Tonight is brain dinner night and all zombies will gather together to scarf down some delicious brains. The artful Heidi plans to crash the party, incognito, disguised as one of them. Her objective is to get away with at least one brain, so she can analyze the zombies' mindset back home and gain a strategic advantage.
... | n = int(input())
print(n // 2 + n % 2) | 3Python3 | {
"input": [
"1\n",
"4\n",
"1000000000\n",
"536870912\n",
"16\n",
"6\n",
"18\n",
"13\n",
"20\n",
"7\n",
"10\n",
"8\n",
"2\n",
"21736\n",
"12\n",
"9\n",
"9999\n",
"873467\n",
"536870910\n",
"17\n",
"4124980\n",
"15\n",
"5\n",
... | 2CODEFORCES |
690_A1. Collective Mindsets (easy)_1937 | Tonight is brain dinner night and all zombies will gather together to scarf down some delicious brains. The artful Heidi plans to crash the party, incognito, disguised as one of them. Her objective is to get away with at least one brain, so she can analyze the zombies' mindset back home and gain a strategic advantage.
... | import java.util.Scanner;
public class CollectiveMindsets {
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.println((n+1)/2);
}
} | 4JAVA | {
"input": [
"1\n",
"4\n",
"1000000000\n",
"536870912\n",
"16\n",
"6\n",
"18\n",
"13\n",
"20\n",
"7\n",
"10\n",
"8\n",
"2\n",
"21736\n",
"12\n",
"9\n",
"9999\n",
"873467\n",
"536870910\n",
"17\n",
"4124980\n",
"15\n",
"5\n",
... | 2CODEFORCES |
712_D. Memory and Scores_1938 | Memory and his friend Lexa are competing to get higher score in one popular computer game. Memory starts with score a and Lexa starts with score b. In a single turn, both Memory and Lexa get some integer in the range [ - k;k] (i.e. one integer among - k, - k + 1, - k + 2, ..., - 2, - 1, 0, 1, 2, ..., k - 1, k) and add... | #include <bits/stdc++.h>
using namespace std;
int m[2][303300];
int *p1, *p2;
int offset = 151500;
int off = 120000;
int resa[303300];
int mod = 1e9 + 7;
void solve(int a, int k, int t) {
p1 = m[0] + offset;
p2 = m[1] + offset;
memset(m, 0, sizeof(m));
p1[a] = 1;
for (int i = 0; i < t; i++) {
if (i == 2) ... | 2C++ | {
"input": [
"1 2 2 1\n",
"1 1 1 2\n",
"2 12 3 1\n",
"38 38 701 74\n",
"10 10 1000 100\n",
"2 56 438 41\n",
"40 94 510 53\n",
"69 69 443 53\n",
"60 60 86 51\n",
"40 40 955 95\n",
"14 47 184 49\n",
"3 7 8 6\n",
"81 13 607 21\n",
"1 8 1 4\n",
"45 54 4 5\n",
... | 2CODEFORCES |
712_D. Memory and Scores_1939 | Memory and his friend Lexa are competing to get higher score in one popular computer game. Memory starts with score a and Lexa starts with score b. In a single turn, both Memory and Lexa get some integer in the range [ - k;k] (i.e. one integer among - k, - k + 1, - k + 2, ..., - 2, - 1, 0, 1, 2, ..., k - 1, k) and add... | mod=10**9+7
f=[0]*500000
def POW(a,b):
if(b==0):
return 1
if(b&1):
return POW(a,b//2)**2*a%mod
else:
return POW(a,b//2)**2
def C(n,m):
if(m>n):
return 0
t=f[n]*POW(f[m],mod-2)%mod*POW(f[n-m],mod-2)%mod
return t
f[0]=1
for i in range(1,500000):
f[i]=f[i-1]*i%mod
a,b,k,t=map(int,input().split(' '))
an... | 3Python3 | {
"input": [
"1 2 2 1\n",
"1 1 1 2\n",
"2 12 3 1\n",
"38 38 701 74\n",
"10 10 1000 100\n",
"2 56 438 41\n",
"40 94 510 53\n",
"69 69 443 53\n",
"60 60 86 51\n",
"40 40 955 95\n",
"14 47 184 49\n",
"3 7 8 6\n",
"81 13 607 21\n",
"1 8 1 4\n",
"45 54 4 5\n",
... | 2CODEFORCES |
712_D. Memory and Scores_1940 | Memory and his friend Lexa are competing to get higher score in one popular computer game. Memory starts with score a and Lexa starts with score b. In a single turn, both Memory and Lexa get some integer in the range [ - k;k] (i.e. one integer among - k, - k + 1, - k + 2, ..., - 2, - 1, 0, 1, 2, ..., k - 1, k) and add... | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class D {
static StringTokenizer st;
static BufferedReader br;... | 4JAVA | {
"input": [
"1 2 2 1\n",
"1 1 1 2\n",
"2 12 3 1\n",
"38 38 701 74\n",
"10 10 1000 100\n",
"2 56 438 41\n",
"40 94 510 53\n",
"69 69 443 53\n",
"60 60 86 51\n",
"40 40 955 95\n",
"14 47 184 49\n",
"3 7 8 6\n",
"81 13 607 21\n",
"1 8 1 4\n",
"45 54 4 5\n",
... | 2CODEFORCES |
733_C. Epidemic in Monstropolis_1941 | There was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue for an appointment to the only doctor in the city.
Soon, monsters became hungry and began to eat each other.
One monster can eat other monster if its weight is strictly greater than the weight of the monste... | n = input()
a = map(int, raw_input().split())
k = input()
b = map(int, raw_input().split())
def _remove(t, i, j, M):
# print 'i= ', i, 'j=', j, 'M=', M
if t[j]==M or t[i]==M:
if t[j]==M:
i, j = j, i
if t[j]==M:
return None, None
return i, i-j
return None, Non... | 1Python2 | {
"input": [
"5\n1 1 1 3 3\n3\n2 1 6\n",
"6\n1 2 2 2 1 2\n2\n5 5\n",
"5\n1 2 3 4 5\n1\n15\n",
"3\n2 1 3\n1\n6\n",
"3\n3 2 1\n1\n6\n",
"3\n1 2 2\n1\n5\n",
"2\n1 1\n1\n1\n",
"5\n1 2 3 4 5\n3\n1 2 3\n",
"5\n3 3 2 2 1\n2\n8 3\n",
"3\n3 2 5\n1\n10\n",
"6\n2 1 2 2 1 2\n2\n5 5\n",... | 2CODEFORCES |
733_C. Epidemic in Monstropolis_1942 | There was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue for an appointment to the only doctor in the city.
Soon, monsters became hungry and began to eat each other.
One monster can eat other monster if its weight is strictly greater than the weight of the monste... | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5 + 4;
int main() {
vector<pair<long long, char> > ans;
long long n, st[MAX_N],
pr[MAX_N] = {
0,
};
long long sum = 0;
scanf("%lld", &n);
for (int i = 0; i < n; i++) {
scanf("%lld", &st[i]);
pr[i] = st[i];
sum ... | 2C++ | {
"input": [
"5\n1 1 1 3 3\n3\n2 1 6\n",
"6\n1 2 2 2 1 2\n2\n5 5\n",
"5\n1 2 3 4 5\n1\n15\n",
"3\n2 1 3\n1\n6\n",
"3\n3 2 1\n1\n6\n",
"3\n1 2 2\n1\n5\n",
"2\n1 1\n1\n1\n",
"5\n1 2 3 4 5\n3\n1 2 3\n",
"5\n3 3 2 2 1\n2\n8 3\n",
"3\n3 2 5\n1\n10\n",
"6\n2 1 2 2 1 2\n2\n5 5\n",... | 2CODEFORCES |
733_C. Epidemic in Monstropolis_1943 | There was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue for an appointment to the only doctor in the city.
Soon, monsters became hungry and began to eat each other.
One monster can eat other monster if its weight is strictly greater than the weight of the monste... | def main():
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
sum1, sum2 = 0, 0
for i in a:
sum1 += i
for i in b:
sum2 += i
# validar que podemos obtener solucion
if sum1 != sum2:
print('NO')
ret... | 3Python3 | {
"input": [
"5\n1 1 1 3 3\n3\n2 1 6\n",
"6\n1 2 2 2 1 2\n2\n5 5\n",
"5\n1 2 3 4 5\n1\n15\n",
"3\n2 1 3\n1\n6\n",
"3\n3 2 1\n1\n6\n",
"3\n1 2 2\n1\n5\n",
"2\n1 1\n1\n1\n",
"5\n1 2 3 4 5\n3\n1 2 3\n",
"5\n3 3 2 2 1\n2\n8 3\n",
"3\n3 2 5\n1\n10\n",
"6\n2 1 2 2 1 2\n2\n5 5\n",... | 2CODEFORCES |
733_C. Epidemic in Monstropolis_1944 | There was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue for an appointment to the only doctor in the city.
Soon, monsters became hungry and began to eat each other.
One monster can eat other monster if its weight is strictly greater than the weight of the monste... |
import java.awt.Point;
import java.awt.geom.Line2D;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.security.GuardedObject;
i... | 4JAVA | {
"input": [
"5\n1 1 1 3 3\n3\n2 1 6\n",
"6\n1 2 2 2 1 2\n2\n5 5\n",
"5\n1 2 3 4 5\n1\n15\n",
"3\n2 1 3\n1\n6\n",
"3\n3 2 1\n1\n6\n",
"3\n1 2 2\n1\n5\n",
"2\n1 1\n1\n1\n",
"5\n1 2 3 4 5\n3\n1 2 3\n",
"5\n3 3 2 2 1\n2\n8 3\n",
"3\n3 2 5\n1\n10\n",
"6\n2 1 2 2 1 2\n2\n5 5\n",... | 2CODEFORCES |
757_D. Felicity's Big Secret Revealed_1945 | The gym leaders were fascinated by the evolutions which took place at Felicity camp. So, they were curious to know about the secret behind evolving Pokemon.
The organizers of the camp gave the gym leaders a PokeBlock, a sequence of n ingredients. Each ingredient can be of type 0 or 1. Now the organizers told the gym ... | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys, math, random, operator
MOD = 10**9 + 7
INF = 10**9
pr = lambda *args: sys.stdout.write(" ".join(str(x) for x in args) + "\n")
epr = lambda *args: sys.stderr.write(" ".join(str(x) for x in args) + "\n")
die = lambda *args: pr(*args) ^ exit(0)
read_str = raw_inp... | 1Python2 | {
"input": [
"4\n1011\n",
"2\n10\n",
"75\n010110111011010010011101000010001010011111100101000101001100110010001010100\n",
"75\n111111111111111111111111111111111111111111111111111111111111111111111111111\n",
"60\n001100010011100010101011000011101010111101011101111101001001\n",
"75\n000000000100... | 2CODEFORCES |
757_D. Felicity's Big Secret Revealed_1946 | The gym leaders were fascinated by the evolutions which took place at Felicity camp. So, they were curious to know about the secret behind evolving Pokemon.
The organizers of the camp gave the gym leaders a PokeBlock, a sequence of n ingredients. Each ingredient can be of type 0 or 1. Now the organizers told the gym ... | #include <bits/stdc++.h>
using namespace std;
int n;
long long b[30];
string s;
int mod;
int memo[602222][76];
long long solve(int mask, int i) {
if (i == n) {
for (int j = 0; j < 30; j++) {
if (mask == b[j]) {
return 1;
}
}
return 0;
}
int &ret = memo[mask][i];
if (ret != -1) re... | 2C++ | {
"input": [
"4\n1011\n",
"2\n10\n",
"75\n010110111011010010011101000010001010011111100101000101001100110010001010100\n",
"75\n111111111111111111111111111111111111111111111111111111111111111111111111111\n",
"60\n001100010011100010101011000011101010111101011101111101001001\n",
"75\n000000000100... | 2CODEFORCES |
757_D. Felicity's Big Secret Revealed_1947 | The gym leaders were fascinated by the evolutions which took place at Felicity camp. So, they were curious to know about the secret behind evolving Pokemon.
The organizers of the camp gave the gym leaders a PokeBlock, a sequence of n ingredients. Each ingredient can be of type 0 or 1. Now the organizers told the gym ... | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import java.util.*;
import java.io.*;
public class A
{
static int n;
static int[] arr;
static char[] s;
static int[][] dp;
public static void main(String[] args) throws IOException
{
f ... | 4JAVA | {
"input": [
"4\n1011\n",
"2\n10\n",
"75\n010110111011010010011101000010001010011111100101000101001100110010001010100\n",
"75\n111111111111111111111111111111111111111111111111111111111111111111111111111\n",
"60\n001100010011100010101011000011101010111101011101111101001001\n",
"75\n000000000100... | 2CODEFORCES |
779_A. Pupils Redistribution_1948 | In Berland each high school student is characterized by academic performance — integer value between 1 and 5.
In high school 0xFF there are two groups of pupils: the group A and the group B. Each group consists of exactly n students. An academic performance of each student is known — integer value between 1 and 5.
Th... | import sys
n = int(sys.stdin.readline())
l = sys.stdin.readline()
a1 = map(lambda x: int(x), l.split(' '))
l = sys.stdin.readline()
a2 = map(lambda x: int(x), l.split(' '))
d1 = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0}
d2 = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0}
for i in range(n):
d1[a1[i]] += 1
d2[a2[i]] += 1
#print d1
#print d2... | 1Python2 | {
"input": [
"6\n1 1 1 1 1 1\n5 5 5 5 5 5\n",
"4\n5 4 4 4\n5 5 4 5\n",
"9\n3 2 5 5 2 3 3 3 2\n4 1 4 1 1 2 4 4 1\n",
"1\n5\n3\n",
"100\n3 4 5 3 5 4 5 4 4 4 2 4 5 4 3 2 3 4 3 5 2 5 2 5 4 3 4 2 5 2 5 3 4 5 2 5 4 2 4 5 4 3 2 4 4 5 2 5 5 3 3 5 2 4 4 2 3 3 2 5 5 5 2 4 5 5 4 2 2 5 3 3 2 4 4 2 4 5 5 2 5 5... | 2CODEFORCES |
779_A. Pupils Redistribution_1949 | In Berland each high school student is characterized by academic performance — integer value between 1 and 5.
In high school 0xFF there are two groups of pupils: the group A and the group B. Each group consists of exactly n students. An academic performance of each student is known — integer value between 1 and 5.
Th... | #include <bits/stdc++.h>
using namespace std;
int n, a[200], b[200], t, ans;
map<int, int> mp;
map<int, int> c;
map<int, int> d;
set<int> s;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
mp[a[i]]++;
c[a[i]]++;
}
for (int i = 0; i < n; i++) {
cin >> b[i];
mp[b[i]]++;
d... | 2C++ | {
"input": [
"6\n1 1 1 1 1 1\n5 5 5 5 5 5\n",
"4\n5 4 4 4\n5 5 4 5\n",
"9\n3 2 5 5 2 3 3 3 2\n4 1 4 1 1 2 4 4 1\n",
"1\n5\n3\n",
"100\n3 4 5 3 5 4 5 4 4 4 2 4 5 4 3 2 3 4 3 5 2 5 2 5 4 3 4 2 5 2 5 3 4 5 2 5 4 2 4 5 4 3 2 4 4 5 2 5 5 3 3 5 2 4 4 2 3 3 2 5 5 5 2 4 5 5 4 2 2 5 3 3 2 4 4 2 4 5 5 2 5 5... | 2CODEFORCES |
779_A. Pupils Redistribution_1950 | In Berland each high school student is characterized by academic performance — integer value between 1 and 5.
In high school 0xFF there are two groups of pupils: the group A and the group B. Each group consists of exactly n students. An academic performance of each student is known — integer value between 1 and 5.
Th... | n = int(input())
linea = list(map(int, input().split()))
lineb = list(map(int, input().split()))
lines = linea + lineb
c1 = lines.count(1)
c2 = lines.count(2)
c3 = lines.count(3)
c4 = lines.count(4)
c5 = lines.count(5)
cc1 = linea.count(1)
cc2 = linea.count(2)
cc3 = linea.count(3)
cc4 = linea.count(4)
cc5 = linea.count... | 3Python3 | {
"input": [
"6\n1 1 1 1 1 1\n5 5 5 5 5 5\n",
"4\n5 4 4 4\n5 5 4 5\n",
"9\n3 2 5 5 2 3 3 3 2\n4 1 4 1 1 2 4 4 1\n",
"1\n5\n3\n",
"100\n3 4 5 3 5 4 5 4 4 4 2 4 5 4 3 2 3 4 3 5 2 5 2 5 4 3 4 2 5 2 5 3 4 5 2 5 4 2 4 5 4 3 2 4 4 5 2 5 5 3 3 5 2 4 4 2 3 3 2 5 5 5 2 4 5 5 4 2 2 5 3 3 2 4 4 2 4 5 5 2 5 5... | 2CODEFORCES |
779_A. Pupils Redistribution_1951 | In Berland each high school student is characterized by academic performance — integer value between 1 and 5.
In high school 0xFF there are two groups of pupils: the group A and the group B. Each group consists of exactly n students. An academic performance of each student is known — integer value between 1 and 5.
Th... | import java.io.*;
import java.util.*;
public class TestClass {
public static void main(String args[] ) throws IOException {
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pout = new PrintWriter(System.out);
int n = Integer.parseInt(obj.readLine());
... | 4JAVA | {
"input": [
"6\n1 1 1 1 1 1\n5 5 5 5 5 5\n",
"4\n5 4 4 4\n5 5 4 5\n",
"9\n3 2 5 5 2 3 3 3 2\n4 1 4 1 1 2 4 4 1\n",
"1\n5\n3\n",
"100\n3 4 5 3 5 4 5 4 4 4 2 4 5 4 3 2 3 4 3 5 2 5 2 5 4 3 4 2 5 2 5 3 4 5 2 5 4 2 4 5 4 3 2 4 4 5 2 5 5 3 3 5 2 4 4 2 3 3 2 5 5 5 2 4 5 5 4 2 2 5 3 3 2 4 4 2 4 5 5 2 5 5... | 2CODEFORCES |
802_I. Fake News (hard)_1952 | Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia messages and she is now trying to measure the self-similarity of the message... | #include <bits/stdc++.h>
using namespace std;
const int N = 200500;
struct state {
int len, link;
map<char, int> next;
};
state st[N];
int sz, last;
void sa_init() {
last = st[0].len = 0;
sz = 1;
st[0].link = -1;
}
void sa_extend(char c) {
int k = sz++, p;
st[k].len = st[last].len + 1;
for (p = last; p ... | 2C++ | {
"input": [
"4\naa\nabcd\nccc\nabcc\n",
"1\na\n",
"10\ncclbvczicnbrvrzzcvtp\nqpppmppmwppoypywqbxi\nfoftxsfvvdoxffvfslsp\najddklkkladeqjqmkmlq\ncmxmhccmrrccmoxpyfpf\nknnadqaoxaoxmnmexodo\nnbwtjvwsluntlwplnwbn\nbbrpsovbuuwvfsrzfuru\nfhntkhwunnsfhknnnwfn\nxxxxcxdkakxnankxfndx\n",
"10\ncccjcuuquj\nhththa... | 2CODEFORCES |
802_I. Fake News (hard)_1953 | Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia messages and she is now trying to measure the self-similarity of the message... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Random;
import java.util.InputMismatchException;
import java.util.HashMap;
import java.util.Deque;
import java.util.function.Function;
import java.util.ArrayList;
import java.util.Map;
import java.io.OutputStreamWriter... | 4JAVA | {
"input": [
"4\naa\nabcd\nccc\nabcc\n",
"1\na\n",
"10\ncclbvczicnbrvrzzcvtp\nqpppmppmwppoypywqbxi\nfoftxsfvvdoxffvfslsp\najddklkkladeqjqmkmlq\ncmxmhccmrrccmoxpyfpf\nknnadqaoxaoxmnmexodo\nnbwtjvwsluntlwplnwbn\nbbrpsovbuuwvfsrzfuru\nfhntkhwunnsfhknnnwfn\nxxxxcxdkakxnankxfndx\n",
"10\ncccjcuuquj\nhththa... | 2CODEFORCES |
825_E. Minimal Labels_1954 | You are given a directed acyclic graph with n vertices and m edges. There are no self-loops or multiple edges between any pair of vertices. Graph can be disconnected.
You should assign labels to all vertices in such a way that:
* Labels form a valid permutation of length n — an integer sequence such that each integ... | from sys import stdin, stdout
from heapq import heappush as hpush, heappop as hpop
n, m = map(int, raw_input().strip().split())
inp = stdin.readlines()
out = [0 for i in xrange(n)]
g = [[] for i in xrange(n + 1)] # the reverse graph
outdeg = [0 for i in xrange(n + 1)] # outdegree
# process input
for line in inp:
... | 1Python2 | {
"input": [
"3 3\n1 2\n1 3\n3 2\n",
"4 5\n3 1\n4 1\n2 3\n3 4\n2 4\n",
"5 4\n3 1\n2 1\n2 3\n4 5\n",
"2 1\n2 1\n",
"100 10\n73 55\n29 76\n15 12\n94 46\n77 67\n76 16\n72 50\n41 40\n89 75\n27 22\n",
"5 10\n5 2\n4 1\n2 1\n3 4\n2 4\n3 2\n5 4\n3 5\n3 1\n5 1\n",
"100 10\n73 41\n29 76\n15 12\n94 4... | 2CODEFORCES |
825_E. Minimal Labels_1955 | You are given a directed acyclic graph with n vertices and m edges. There are no self-loops or multiple edges between any pair of vertices. Graph can be disconnected.
You should assign labels to all vertices in such a way that:
* Labels form a valid permutation of length n — an integer sequence such that each integ... | #include <bits/stdc++.h>
using namespace std;
int n, m;
int a, b;
int D[100010];
int vis[100010];
vector<int> E[100010];
priority_queue<int> Q;
int main() {
cin >> n >> m;
for (int i = 1; i <= m; i++) {
cin >> a >> b;
D[a]++;
E[b].push_back(a);
}
for (int i = n; i >= 1; i--)
if (D[i] == 0) Q.pus... | 2C++ | {
"input": [
"3 3\n1 2\n1 3\n3 2\n",
"4 5\n3 1\n4 1\n2 3\n3 4\n2 4\n",
"5 4\n3 1\n2 1\n2 3\n4 5\n",
"2 1\n2 1\n",
"100 10\n73 55\n29 76\n15 12\n94 46\n77 67\n76 16\n72 50\n41 40\n89 75\n27 22\n",
"5 10\n5 2\n4 1\n2 1\n3 4\n2 4\n3 2\n5 4\n3 5\n3 1\n5 1\n",
"100 10\n73 41\n29 76\n15 12\n94 4... | 2CODEFORCES |
825_E. Minimal Labels_1956 | You are given a directed acyclic graph with n vertices and m edges. There are no self-loops or multiple edges between any pair of vertices. Graph can be disconnected.
You should assign labels to all vertices in such a way that:
* Labels form a valid permutation of length n — an integer sequence such that each integ... | #!/usr/local/bin/python3
from collections import defaultdict
import heapq
num_nodes, num_edges = map(int, input().split())
ins = defaultdict(set)
out = defaultdict(int)
for _ in range(num_edges):
node_out, node_in = map(int, input().split())
ins[node_in].add(node_out)
out[node_out] += 1
zeros = [-node ... | 3Python3 | {
"input": [
"3 3\n1 2\n1 3\n3 2\n",
"4 5\n3 1\n4 1\n2 3\n3 4\n2 4\n",
"5 4\n3 1\n2 1\n2 3\n4 5\n",
"2 1\n2 1\n",
"100 10\n73 55\n29 76\n15 12\n94 46\n77 67\n76 16\n72 50\n41 40\n89 75\n27 22\n",
"5 10\n5 2\n4 1\n2 1\n3 4\n2 4\n3 2\n5 4\n3 5\n3 1\n5 1\n",
"100 10\n73 41\n29 76\n15 12\n94 4... | 2CODEFORCES |
825_E. Minimal Labels_1957 | You are given a directed acyclic graph with n vertices and m edges. There are no self-loops or multiple edges between any pair of vertices. Graph can be disconnected.
You should assign labels to all vertices in such a way that:
* Labels form a valid permutation of length n — an integer sequence such that each integ... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.util.Collection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.Fi... | 4JAVA | {
"input": [
"3 3\n1 2\n1 3\n3 2\n",
"4 5\n3 1\n4 1\n2 3\n3 4\n2 4\n",
"5 4\n3 1\n2 1\n2 3\n4 5\n",
"2 1\n2 1\n",
"100 10\n73 55\n29 76\n15 12\n94 46\n77 67\n76 16\n72 50\n41 40\n89 75\n27 22\n",
"5 10\n5 2\n4 1\n2 1\n3 4\n2 4\n3 2\n5 4\n3 5\n3 1\n5 1\n",
"100 10\n73 41\n29 76\n15 12\n94 4... | 2CODEFORCES |
848_C. Goodbye Souvenir_1958 | I won't feel lonely, nor will I be sorrowful... not before everything is buried.
A string of n beads is left as the message of leaving. The beads are numbered from 1 to n from left to right, each having a shape numbered by integers between 1 and n inclusive. Some beads may have the same shapes.
The memory of a shape ... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100001;
int arr[MAXN];
set<int> mp[MAXN];
map<int, int> loga[MAXN];
void add(int a, int b, int x) {
for (int i = a + 1; i < MAXN; i += i & -i)
for (int j = b + 1; j < MAXN; j += j & -j) loga[i][j] += x;
}
long long get(int a, int b) {
long long ret ... | 2C++ | {
"input": [
"7 5\n1 3 2 1 4 2 3\n1 1 4\n2 2 3\n1 1 7\n2 4 5\n1 1 7\n",
"7 6\n1 2 3 1 3 2 1\n2 3 7\n2 1 3\n1 7 2\n1 3 2\n2 1 6\n2 5 7\n",
"10 10\n8 10 1 4 4 2 1 2 10 1\n1 5 6\n1 6 8\n1 6 1\n1 10 5\n1 5 8\n1 2 8\n2 5 6\n2 1 5\n2 1 2\n2 5 8\n",
"1 1\n1\n2 1 1\n",
"7 6\n1 2 3 1 3 2 1\n2 3 7\n2 1 3\n1... | 2CODEFORCES |
848_C. Goodbye Souvenir_1959 | I won't feel lonely, nor will I be sorrowful... not before everything is buried.
A string of n beads is left as the message of leaving. The beads are numbered from 1 to n from left to right, each having a shape numbered by integers between 1 and n inclusive. Some beads may have the same shapes.
The memory of a shape ... | import java.util.*;
import java.io.*;
/*
7 1
1 2 3 1 3 2 1
2 3 7
2 1 3
1 7 2
1 3 2
2 1 6
5 4
5 1 4 3 5
1 3 3
2 2 2
1 2 4
2 2 4
5 3
5 1 4 3 5
1 3 3
1 2 4
2 2 4
5 2
5 4 4 4 2
1 4 2
2 2 4
5 2
1 5 5 5 3
1 4 5
2 1 5
*/
public class e
{
public static void main(String[] arg) throws IOException
{
new e();
}
final ... | 4JAVA | {
"input": [
"7 5\n1 3 2 1 4 2 3\n1 1 4\n2 2 3\n1 1 7\n2 4 5\n1 1 7\n",
"7 6\n1 2 3 1 3 2 1\n2 3 7\n2 1 3\n1 7 2\n1 3 2\n2 1 6\n2 5 7\n",
"10 10\n8 10 1 4 4 2 1 2 10 1\n1 5 6\n1 6 8\n1 6 1\n1 10 5\n1 5 8\n1 2 8\n2 5 6\n2 1 5\n2 1 2\n2 5 8\n",
"1 1\n1\n2 1 1\n",
"7 6\n1 2 3 1 3 2 1\n2 3 7\n2 1 3\n1... | 2CODEFORCES |
870_A. Search for Pretty Integers_1960 | You are given two lists of non-zero digits.
Let's call an integer pretty if its (base 10) representation has at least one digit from the first list and at least one digit from the second list. What is the smallest positive pretty integer?
Input
The first line contains two integers n and m (1 ≤ n, m ≤ 9) — the length... | def pretty_integer(first, second):
pretty_integer = []
first.sort()
second.sort()
for i in range(len(first)):
if first[i] in second:
return first[i]
else:
for j in range(len(second)):
pretty_integer.append(first[i]+second[j])
pretty... | 1Python2 | {
"input": [
"8 8\n1 2 3 4 5 6 7 8\n8 7 6 5 4 3 2 1\n",
"2 3\n4 2\n5 7 6\n",
"4 3\n1 3 5 9\n2 8 9\n",
"1 2\n5\n2 5\n",
"2 4\n8 9\n1 2 3 9\n",
"9 9\n9 8 7 6 5 4 3 2 1\n9 8 7 6 5 4 3 2 1\n",
"2 2\n1 5\n2 5\n",
"3 2\n4 5 6\n1 5\n",
"9 9\n5 4 3 2 1 6 7 8 9\n3 2 1 5 4 7 8 9 6\n",
"3... | 2CODEFORCES |
870_A. Search for Pretty Integers_1961 | You are given two lists of non-zero digits.
Let's call an integer pretty if its (base 10) representation has at least one digit from the first list and at least one digit from the second list. What is the smallest positive pretty integer?
Input
The first line contains two integers n and m (1 ≤ n, m ≤ 9) — the length... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int a[100], b[100];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
for (int i = 0; i < m; i++) {
cin >> b[i];
}
sort(b, b + m);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
... | 2C++ | {
"input": [
"8 8\n1 2 3 4 5 6 7 8\n8 7 6 5 4 3 2 1\n",
"2 3\n4 2\n5 7 6\n",
"4 3\n1 3 5 9\n2 8 9\n",
"1 2\n5\n2 5\n",
"2 4\n8 9\n1 2 3 9\n",
"9 9\n9 8 7 6 5 4 3 2 1\n9 8 7 6 5 4 3 2 1\n",
"2 2\n1 5\n2 5\n",
"3 2\n4 5 6\n1 5\n",
"9 9\n5 4 3 2 1 6 7 8 9\n3 2 1 5 4 7 8 9 6\n",
"3... | 2CODEFORCES |
870_A. Search for Pretty Integers_1962 | You are given two lists of non-zero digits.
Let's call an integer pretty if its (base 10) representation has at least one digit from the first list and at least one digit from the second list. What is the smallest positive pretty integer?
Input
The first line contains two integers n and m (1 ≤ n, m ≤ 9) — the length... | a,b=map(int,input().split())
s=input().split()
x=list(map(int,s))
s=input().split()
y=list(map(int,s))
o=10
for i in range(a):
for j in range(b):
if x[i]==y[j]:
if x[i]<o:
o=x[i]
x1=min(x)
y1=min(y)
if o<10:
print(o)
else:
print(min(y1,x1)*10+max(x1,y1))
| 3Python3 | {
"input": [
"8 8\n1 2 3 4 5 6 7 8\n8 7 6 5 4 3 2 1\n",
"2 3\n4 2\n5 7 6\n",
"4 3\n1 3 5 9\n2 8 9\n",
"1 2\n5\n2 5\n",
"2 4\n8 9\n1 2 3 9\n",
"9 9\n9 8 7 6 5 4 3 2 1\n9 8 7 6 5 4 3 2 1\n",
"2 2\n1 5\n2 5\n",
"3 2\n4 5 6\n1 5\n",
"9 9\n5 4 3 2 1 6 7 8 9\n3 2 1 5 4 7 8 9 6\n",
"3... | 2CODEFORCES |
870_A. Search for Pretty Integers_1963 | You are given two lists of non-zero digits.
Let's call an integer pretty if its (base 10) representation has at least one digit from the first list and at least one digit from the second list. What is the smallest positive pretty integer?
Input
The first line contains two integers n and m (1 ≤ n, m ≤ 9) — the length... |
import java.io.*;
import java.util.*;
public class Sum
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int e=0;
int n=in.nextInt();
int m =in.nextInt();
boolean[] first = new bool... | 4JAVA | {
"input": [
"8 8\n1 2 3 4 5 6 7 8\n8 7 6 5 4 3 2 1\n",
"2 3\n4 2\n5 7 6\n",
"4 3\n1 3 5 9\n2 8 9\n",
"1 2\n5\n2 5\n",
"2 4\n8 9\n1 2 3 9\n",
"9 9\n9 8 7 6 5 4 3 2 1\n9 8 7 6 5 4 3 2 1\n",
"2 2\n1 5\n2 5\n",
"3 2\n4 5 6\n1 5\n",
"9 9\n5 4 3 2 1 6 7 8 9\n3 2 1 5 4 7 8 9 6\n",
"3... | 2CODEFORCES |
896_E. Welcome home, Chtholly_1964 | — I... I survived.
— Welcome home, Chtholly.
— I kept my promise...
— I made it... I really made it!
After several days of fighting, Chtholly Nota Seniorious miraculously returned from the fierce battle.
As promised, Willem is now baking butter cake for her.
However, although Willem is skilled in making dessert, ... | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx")
using namespace std;
int a[100010], n, m;
int main() {
register int i;
float x;
scanf("%d%d", &n, &m);
for (i = 1; i <= n; ++i) scanf("%d", &a[i]);
for (register int k, l, r, s; m--;) {
scanf("%d%d%d%f", &k... | 2C++ | {
"input": [
"5 6\n1 5 5 5 8\n2 2 5 5\n1 2 4 3\n2 2 5 2\n2 2 5 5\n1 3 5 1\n2 1 5 1\n",
"8 13\n75 85 88 100 105 120 122 128\n1 1 8 70\n2 3 8 30\n1 3 8 3\n2 2 5 15\n1 2 4 10\n2 1 5 5\n1 2 7 27\n2 1 5 5\n1 3 7 12\n1 1 7 4\n2 1 8 1\n1 4 8 5\n2 1 8 1\n",
"7 7\n1 9 2 6 8 1 7\n2 1 7 1\n2 2 5 2\n1 4 7 7\n2 2 4 2\... | 2CODEFORCES |
896_E. Welcome home, Chtholly_1965 | — I... I survived.
— Welcome home, Chtholly.
— I kept my promise...
— I made it... I really made it!
After several days of fighting, Chtholly Nota Seniorious miraculously returned from the fierce battle.
As promised, Willem is now baking butter cake for her.
However, although Willem is skilled in making dessert, ... | import java.util.*;
/**
* Created by mcl on 2017/12/2.
*/
public class Main {
public static void main(String[] args) {
new Main().cal();
}
static class Block {
int nMin;
int nMax;
int left;
int right;
int off;
int[] parent = null;
int[] c = null;
Block(int left, int rig... | 4JAVA | {
"input": [
"5 6\n1 5 5 5 8\n2 2 5 5\n1 2 4 3\n2 2 5 2\n2 2 5 5\n1 3 5 1\n2 1 5 1\n",
"8 13\n75 85 88 100 105 120 122 128\n1 1 8 70\n2 3 8 30\n1 3 8 3\n2 2 5 15\n1 2 4 10\n2 1 5 5\n1 2 7 27\n2 1 5 5\n1 3 7 12\n1 1 7 4\n2 1 8 1\n1 4 8 5\n2 1 8 1\n",
"7 7\n1 9 2 6 8 1 7\n2 1 7 1\n2 2 5 2\n1 4 7 7\n2 2 4 2\... | 2CODEFORCES |
918_A. Eleven_1966 | Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
<image>
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested th... | '''input
15
'''
import sys
n = input()
st = ['o']*n
if n == 1:
print "O"
sys.exit(0)
o = 1
t = 1
st[0] = 'O'
st[1] = 'O'
for i in range(100):
th = o+t
if th > n:
break
else:
st[th-1] = 'O'
o = t
t = th
print ''.join(st) | 1Python2 | {
"input": [
"8\n",
"15\n",
"381\n",
"1000\n",
"5\n",
"781\n",
"999\n",
"805\n",
"3\n",
"61\n",
"256\n",
"512\n",
"1\n",
"17\n",
"2\n",
"933\n",
"85\n",
"49\n",
"431\n",
"9\n",
"859\n",
"339\n",
"6\n",
"7\n",
"254\n",
... | 2CODEFORCES |
918_A. Eleven_1967 | Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
<image>
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested th... | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int n;
set<int> s;
inline void init() {
int x = 1, y = 1;
s.insert(1);
for (int z = 2; z <= 1000; z = x + y) {
s.insert(z);
x = y, y = z;
}
}
int main() {
ios_base::sync_with_stdio(false);
init();
cin >> n;
for (int i = 1; ... | 2C++ | {
"input": [
"8\n",
"15\n",
"381\n",
"1000\n",
"5\n",
"781\n",
"999\n",
"805\n",
"3\n",
"61\n",
"256\n",
"512\n",
"1\n",
"17\n",
"2\n",
"933\n",
"85\n",
"49\n",
"431\n",
"9\n",
"859\n",
"339\n",
"6\n",
"7\n",
"254\n",
... | 2CODEFORCES |
918_A. Eleven_1968 | Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
<image>
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested th... | n=int(input())
a,b,r=1,2,''
for i in range(1,n+1):
if i==a: r+='O';a,b=b,a+b
else: r+='o'
print(r) | 3Python3 | {
"input": [
"8\n",
"15\n",
"381\n",
"1000\n",
"5\n",
"781\n",
"999\n",
"805\n",
"3\n",
"61\n",
"256\n",
"512\n",
"1\n",
"17\n",
"2\n",
"933\n",
"85\n",
"49\n",
"431\n",
"9\n",
"859\n",
"339\n",
"6\n",
"7\n",
"254\n",
... | 2CODEFORCES |
918_A. Eleven_1969 | Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
<image>
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested th... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.Set;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**... | 4JAVA | {
"input": [
"8\n",
"15\n",
"381\n",
"1000\n",
"5\n",
"781\n",
"999\n",
"805\n",
"3\n",
"61\n",
"256\n",
"512\n",
"1\n",
"17\n",
"2\n",
"933\n",
"85\n",
"49\n",
"431\n",
"9\n",
"859\n",
"339\n",
"6\n",
"7\n",
"254\n",
... | 2CODEFORCES |
940_A. Points on the line_1970 | We've got no test cases. A big olympiad is coming up. But the problemsetters' number one priority should be adding another problem to the round.
The diameter of a multiset of points on the line is the largest distance between two points from this set. For example, the diameter of the multiset {1, 3, 2, 1} is 2.
Diame... | n, d = map(int, raw_input().strip().split())
arr = sorted(map(int, raw_input().strip().split()))
ans = n
for i in xrange(n):
for j in xrange(i, n):
if arr[j]-arr[i]<=d:
ans=min(n-(j-i+1), ans)
else:
break
print ans | 1Python2 | {
"input": [
"6 3\n1 3 4 6 9 10\n",
"3 1\n2 1 4\n",
"3 0\n7 7 7\n",
"1 100\n22\n",
"3 2\n1 50 99\n",
"100 56\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 6... | 2CODEFORCES |
940_A. Points on the line_1971 | We've got no test cases. A big olympiad is coming up. But the problemsetters' number one priority should be adding another problem to the round.
The diameter of a multiset of points on the line is the largest distance between two points from this set. For example, the diameter of the multiset {1, 3, 2, 1} is 2.
Diame... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, d;
cin >> n >> d;
int *a = new int[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
int ans = 0;
for (int i = 0; i < n; i++) {
for (int j = i; j < n; j++) {
if (a[j] - a[i] <= d && j - i + 1 > ans) {
... | 2C++ | {
"input": [
"6 3\n1 3 4 6 9 10\n",
"3 1\n2 1 4\n",
"3 0\n7 7 7\n",
"1 100\n22\n",
"3 2\n1 50 99\n",
"100 56\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 6... | 2CODEFORCES |
940_A. Points on the line_1972 | We've got no test cases. A big olympiad is coming up. But the problemsetters' number one priority should be adding another problem to the round.
The diameter of a multiset of points on the line is the largest distance between two points from this set. For example, the diameter of the multiset {1, 3, 2, 1} is 2.
Diame... | n,d = map(int,input().split())
a=list(map(int,input().split()))
a.sort();
i=0
cnt=0
cnt1=0
if n==1:
print("0")
else:
for i in range(n):
cnt=0
for j in range(i+1,n):
d1=a[j]-a[i]
if d1>d:
break;
cnt+=1
if(cnt1<cnt):
cnt1=cnt... | 3Python3 | {
"input": [
"6 3\n1 3 4 6 9 10\n",
"3 1\n2 1 4\n",
"3 0\n7 7 7\n",
"1 100\n22\n",
"3 2\n1 50 99\n",
"100 56\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 6... | 2CODEFORCES |
940_A. Points on the line_1973 | We've got no test cases. A big olympiad is coming up. But the problemsetters' number one priority should be adding another problem to the round.
The diameter of a multiset of points on the line is the largest distance between two points from this set. For example, the diameter of the multiset {1, 3, 2, 1} is 2.
Diame... | import java.io.*;
import java.util.*;
import java.math.*;
public class Competitive_2 {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n=in.nextInt(), d=in.nextInt();
int arr[] = new int[n];
for(int i=0; i<n; i++)
arr[i] = in.nextInt();
Arrays.sort(arr);
int ... | 4JAVA | {
"input": [
"6 3\n1 3 4 6 9 10\n",
"3 1\n2 1 4\n",
"3 0\n7 7 7\n",
"1 100\n22\n",
"3 2\n1 50 99\n",
"100 56\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 6... | 2CODEFORCES |
967_D. Resource Distribution_1974 | One department of some software company has n servers of different specifications. Servers are indexed with consecutive integers from 1 to n. Suppose that the specifications of the j-th server may be expressed with a single integer number c_j of artificial resource units.
In order for production to work, it is needed ... | from __future__ import division
from sys import stdin, stdout
from bisect import *
rint = lambda: int(stdin.readline())
rints = lambda: [int(x) for x in stdin.readline().split()]
rint_2d = lambda n: [rint() for _ in range(n)]
rints_2d = lambda n: [rints() for _ in range(n)]
rint_enu = lambda: [(int(x), i + 1) for i, x... | 1Python2 | {
"input": [
"4 20 32\n21 11 11 12\n",
"4 11 32\n5 5 16 16\n",
"6 8 16\n3 5 2 9 8 7\n",
"5 12 20\n7 8 4 11 9\n",
"2 1 1\n1 1000000\n",
"2 1 1\n1 1\n",
"2 1 2\n1 1\n",
"6 8 16\n3 5 2 9 8 7\n",
"15 250 200\n71 2 77 69 100 53 54 40 73 32 82 58 24 82 41\n",
"4 12 11\n4 4 6 11\n",
... | 2CODEFORCES |
967_D. Resource Distribution_1975 | One department of some software company has n servers of different specifications. Servers are indexed with consecutive integers from 1 to n. Suppose that the specifications of the j-th server may be expressed with a single integer number c_j of artificial resource units.
In order for production to work, it is needed ... | #include <bits/stdc++.h>
using namespace std;
typedef struct node {
int index;
long long num;
node() {}
node(int _index, long long _num) {
index = _index;
num = _num;
}
} node;
bool cmp(const node& a, const node& b) { return a.num < b.num; }
int mylowerbound(const vector<node>& vec, long long n) {
i... | 2C++ | {
"input": [
"4 20 32\n21 11 11 12\n",
"4 11 32\n5 5 16 16\n",
"6 8 16\n3 5 2 9 8 7\n",
"5 12 20\n7 8 4 11 9\n",
"2 1 1\n1 1000000\n",
"2 1 1\n1 1\n",
"2 1 2\n1 1\n",
"6 8 16\n3 5 2 9 8 7\n",
"15 250 200\n71 2 77 69 100 53 54 40 73 32 82 58 24 82 41\n",
"4 12 11\n4 4 6 11\n",
... | 2CODEFORCES |
967_D. Resource Distribution_1976 | One department of some software company has n servers of different specifications. Servers are indexed with consecutive integers from 1 to n. Suppose that the specifications of the j-th server may be expressed with a single integer number c_j of artificial resource units.
In order for production to work, it is needed ... | # ---------------------------iye ha aam zindegi---------------------------------------------
import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
#threading.stack_size(10**8)
mo... | 3Python3 | {
"input": [
"4 20 32\n21 11 11 12\n",
"4 11 32\n5 5 16 16\n",
"6 8 16\n3 5 2 9 8 7\n",
"5 12 20\n7 8 4 11 9\n",
"2 1 1\n1 1000000\n",
"2 1 1\n1 1\n",
"2 1 2\n1 1\n",
"6 8 16\n3 5 2 9 8 7\n",
"15 250 200\n71 2 77 69 100 53 54 40 73 32 82 58 24 82 41\n",
"4 12 11\n4 4 6 11\n",
... | 2CODEFORCES |
967_D. Resource Distribution_1977 | One department of some software company has n servers of different specifications. Servers are indexed with consecutive integers from 1 to n. Suppose that the specifications of the j-th server may be expressed with a single integer number c_j of artificial resource units.
In order for production to work, it is needed ... | import java.util.*;
import java.io.*;
public class Source {
static Node array[];
static int n, x1, x2;
static void build(int x, int y, boolean flag) {
StringBuilder sb1 = new StringBuilder();
StringBuilder sb2 = new StringBuilder();
for (int i = 1; i <= n; i++) {
int va... | 4JAVA | {
"input": [
"4 20 32\n21 11 11 12\n",
"4 11 32\n5 5 16 16\n",
"6 8 16\n3 5 2 9 8 7\n",
"5 12 20\n7 8 4 11 9\n",
"2 1 1\n1 1000000\n",
"2 1 1\n1 1\n",
"2 1 2\n1 1\n",
"6 8 16\n3 5 2 9 8 7\n",
"15 250 200\n71 2 77 69 100 53 54 40 73 32 82 58 24 82 41\n",
"4 12 11\n4 4 6 11\n",
... | 2CODEFORCES |
993_D. Compute Power_1978 | You need to execute several tasks, each associated with number of processors it needs, and the compute power it will consume.
You have sufficient number of analog computers, each with enough processors for any task. Each computer can execute up to one task at a time, and no more than two tasks total. The first task ca... | #include <bits/stdc++.h>
using namespace std;
int n;
long long f[1000][1000], sum[1000];
struct arr {
long long x, y;
} a[1000];
bool cmp(arr x, arr y) { return (x.x > y.x) || ((x.x == y.x) && (x.y > y.y)); }
int check(long long x) {
for (int i = 0; i <= n; i++)
for (int j = 0; j <= n; j++) f[i][j] = 1000000000... | 2C++ | {
"input": [
"6\n8 10 9 9 8 10\n1 1 1 1 1 1\n",
"6\n8 10 9 9 8 10\n1 10 5 5 1 10\n",
"5\n21581303 73312811 99923326 93114466 53291492\n32 75 75 33 5\n",
"10\n7 9 8 9 4 8 5 2 10 5\n6 6 7 8 9 7 10 1 1 7\n",
"50\n2 10 10 6 8 1 5 10 3 4 3 5 5 8 4 5 8 2 3 3 3 8 8 5 5 5 5 8 2 5 1 5 4 8 3 7 10 8 6 1 4 9 ... | 2CODEFORCES |
993_D. Compute Power_1979 | You need to execute several tasks, each associated with number of processors it needs, and the compute power it will consume.
You have sufficient number of analog computers, each with enough processors for any task. Each computer can execute up to one task at a time, and no more than two tasks total. The first task ca... | # Codeforces Round #488 by NEAR (Div. 2)
import collections
from functools import cmp_to_key
#key=cmp_to_key(lambda x,y: 1 if x not in y else -1 )
import math
import sys
def getIntList():
return list(map(int, input().split()))
import bisect
def makePair(z):
return [(z[i], z[i+1]) for i in range(0,le... | 3Python3 | {
"input": [
"6\n8 10 9 9 8 10\n1 1 1 1 1 1\n",
"6\n8 10 9 9 8 10\n1 10 5 5 1 10\n",
"5\n21581303 73312811 99923326 93114466 53291492\n32 75 75 33 5\n",
"10\n7 9 8 9 4 8 5 2 10 5\n6 6 7 8 9 7 10 1 1 7\n",
"50\n2 10 10 6 8 1 5 10 3 4 3 5 5 8 4 5 8 2 3 3 3 8 8 5 5 5 5 8 2 5 1 5 4 8 3 7 10 8 6 1 4 9 ... | 2CODEFORCES |
993_D. Compute Power_1980 | You need to execute several tasks, each associated with number of processors it needs, and the compute power it will consume.
You have sufficient number of analog computers, each with enough processors for any task. Each computer can execute up to one task at a time, and no more than two tasks total. The first task ca... | //package round488;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
public class D {
InputStream is;
PrintWriter out;
String INPUT = "";
void sol... | 4JAVA | {
"input": [
"6\n8 10 9 9 8 10\n1 1 1 1 1 1\n",
"6\n8 10 9 9 8 10\n1 10 5 5 1 10\n",
"5\n21581303 73312811 99923326 93114466 53291492\n32 75 75 33 5\n",
"10\n7 9 8 9 4 8 5 2 10 5\n6 6 7 8 9 7 10 1 1 7\n",
"50\n2 10 10 6 8 1 5 10 3 4 3 5 5 8 4 5 8 2 3 3 3 8 8 5 5 5 5 8 2 5 1 5 4 8 3 7 10 8 6 1 4 9 ... | 2CODEFORCES |
attack-or-be-attacked_1981 | You are given an NxM chessboard. Find the number of pairs of different positions of a bishop and a PQ-knight where they don't attack each other modulo 10^9 + 7.
A bishop can move to square if it's on the same diagonal with it.
A PQ-knight with given integers P and Q (P doesn't equals Q) can move to the square if the ... | from sys import stdin
def res(n,m):
x = n-1; fir = (x*(x+1)*(x-1))/3;ti = m-n+1
return n*m + 2*(2*fir + ti*n*(n-1))
a=stdin.readline().split()
x = int(a[0]);y=int(a[1]);p=int(a[2]);q=int(a[3]);
m=x;n=y
if m < n:
m=y;n=x
total = m*n*m*n
rem = 0
fir = n-p
sec = m-q
if fir < 1:
fir = 0
if sec < 1:
sec = 0
rem+=4*fi... | 1Python2 | {
"input": [
"2 5 1 2\n\nSAMPLE",
"92891 8181 398 787",
"1 10 3 4"
],
"output": [
"62",
"353972355",
"90"
]
} | 3HACKEREARTH |
chintu-and-his-girlfriend_1982 | Like other girlfriends Chintu's girlfriend is also very demanding. This time she is demanding for bracelet having atleast k special beads. A bracelet is composed of N strands. Each strand can have any number of beads and each bead has a letter engraved on it. A bead is called a special bead if the letter engraved on it... | n,k=map(int,raw_input().split())
ans=set([chr(i) for i in xrange(97,97+26+1)])
for _ in xrange(n):
ans=ans.intersection(set(list(raw_input())))
if len(ans)>=k:
print ":-)"
else:
print ":-(" | 1Python2 | {
"input": [
"3 2\nabcde\naabaa\nasdba\n\nSAMPLE",
"46 2\nymivskswbowdlmyctckjfnmagbhvoucvtfjxbhyymxbfju\naxasehtiojbldsutdlgsblytjflcqqdcwgou\nituvqxeukxkpufrijyaerhhgu\nybitfkyuvfsrthawrgvjkoitdugua\nklaaprrnbrfjiwjawcfwxeexdubtvutjwplscuovbhtbjcytbxnvjauu\nnfouyprrydhuehcbemulvbmdjkaspmixnupkuejfkqevkbnu\n... | 3HACKEREARTH |
dummy-3-1_1983 | In this problem, you are given list of N numbers from 1 to N. They may be written in any order. You are to create a special list out of the given list. It should be such that the position of integer i is the i-th number in the given list. We will call this new list an inverse list. If the given list is an inverse list ... | test=int(input())
for i in range(test):
numn=int(input())
lst=[]
lst=map(int,raw_input().split())
lst2=[ 0 for x in range(len(lst))]
for j in range(len(lst)):
lst2[lst[j]-1]=j+1
if lst==lst2:print'inverse'
else:print'not inverse' | 1Python2 | {
"input": [
"2\n3\n3 1 2\n3\n1 2 3\n\nSAMPLE",
"35\n44\n31 39 40 21 12 32 7 35 2 20 15 4 33 9 27 29 42 17 25 10 37 18 8 1 34 44 6 26 5 23 41 36 28 16 13 14 43 11 19 38 3 22 24 30 \n19\n18 2 9 14 6 15 10 7 5 4 19 17 3 12 16 11 1 8 13 \n52\n17 42 3 33 11 2 32 44 8 6 43 15 4 51 40 28 38 25 21 46 20 18 29 19 52 ... | 3HACKEREARTH |
guess-the-permutation-easy-contest_1984 | In this problem your goal is to guess some secret permutation A of integers from 1 to 16.
There are 17 tests in this problem. Test number i for 1 ≤ i ≤ 16 will have the following form:
the first line of the input contains string "ELEMENT" (without quotes)
the second line of the input of the test i contains two intege... | x = raw_input()
if x == "PERMUTATION":
print("13 15 1 6 14 4 5 7 2 16 9 11 10 12 8 3")
else:
a, b = map(int, raw_input().split(' '))
if (a == 1):
print(13)
elif a == 2:
print(15)
elif a == 3:
print(1)
elif a == 4:
print(6)
elif a == 5:
print(14)
elif a == 6:
print(4)
elif a == 7:
print(5)
elif a... | 1Python2 | {
"input": [
"ELEMENT\n1 13",
"ELEMENT\n6 4",
"ELEMENT\n2 15",
"ELEMENT\n9 2",
"ELEMENT\n16 3",
"ELEMENT\n4 6"
],
"output": [
"13\n",
"4\n",
"15\n",
"2\n",
"3\n",
"6\n"
]
} | 3HACKEREARTH |
little-stuart-and-evil-hackers-2_1985 | Evil hackers are trying to hack the database of HackerEarth.com.
After a lot of work they figure out that the encryption key used by HackerEarth to securely store the data is really just a random large number.
After a bit more work they figure out that the key is in form of a^b( a power b).
So now they call in the evil... | # Binomial coefficient with mod inverse of prime. Calculate binom (n, r) % p.
MAXN = 200005
MOD = 10 ** 9 + 7
f = [0] * MAXN
def binom (n, r, p):
# print binom (10 ** 18, 2545354543534, 9973)
if n < 0 or r < 0 or n < r: return 0
# Precalculate factorial.
if f [0] != 1: # Factorial already precalculat... | 1Python2 | {
"input": [
"4\n1 2\n1 1\n2 1\n2 3\n\nSAMPLE",
"1000\n73004 67426\n91627 69478\n61297 68278\n24234 83945\n47637 96401\n94242 97144\n85353 14705\n99269 44776\n88928 91446\n52876 40296\n37601 12385\n93013 8451\n18937 66949\n7883 75710\n6581 60221\n4664 95936\n43998 12643\n65414 5294\n80920 5999\n5590 44908\n18... | 3HACKEREARTH |
mystery-12_1986 | Lets think of an infinite series of numbers such that the difference between any two consecutive numbers is d. Let the first number in the sequence be a.
Now your task is to find the multiple that occurs first in the sequence of a given number n and print its index in the output.
Input
1st line T denoting test cases.... | from sys import stdin
import math
t = int(stdin.readline())
for _ in xrange(t):
a,b = map(int,stdin.readline().split())
p = int(stdin.readline())
if b%p==0:
if a%p==0:
print 0
else:
print -1
else:
rem = (p - a%p)%p
b = b%p
inv = pow(b, p-2, p)
rem = (rem * inv)%p
print rem | 1Python2 | {
"input": [
"2\n5 6\n7\n4 9\n11\n\nSAMPLE",
"10\n844452700697263162 119646220083568392\n617\n624716331013886830 420232882599498616\n263\n371747750780382310 31328662274583882\n151\n155589359406144136 349833477687741817\n263\n890649303306320035 470504750916794312\n509\n172858306891107873 404374317528704778\n17... | 3HACKEREARTH |
primestring_1987 | Alice has just learnt about primeStrings. A string is a primeString if the number of distinct alphabets used in the string is a prime and also the number of occurrences of each alphabet in the string is also a prime.
Given a String you need to tell if it is a primeString or not.
Input:
First line contains T which is t... | import math
array = [0]
def calculate_primes(num):
global array
array = (num+1)*[0]
lim = int(math.sqrt(num))
for i in range(2,lim):
j = i*i
if not array[j]:
while(j < num):
array[j] = 1
j = j + i
array[0] = 1
array[1] = 1
return
def isPrime(num):
return not array[num]
if __name__ == "__ma... | 1Python2 | {
"input": [
"3\nababb\nabcab\naabbccdd\n\nSAMPLE",
"3\nababb\nabcab\naabbccdd\n\nS@MPLE",
"3\nababc\nabcab\nddccbbaa\n\nS@MPLE",
"3\nababc\nbabba\ndcdcbbaa\n\nS@MPLE",
"3\naabbb\nbabba\naabbccdd\n\nEAMOSL",
"3\nbbaba\nabcbc\nccbcbbaa\n\nSM>OLD",
"3\ncbaac\nbacab\nacaccadd\n\nELPM@S",
... | 3HACKEREARTH |
saxie-and-strings_1988 | Saxie is a programming enthusiast. He has always been amazed by the beauty of strings. He always dreams of going to Byteland and playing with strings. One day he had a nightmare that Dr. Evil had attacked the strings. When he came forward to protect the strings, Dr. Evil asked him if every substring of S has its revers... | for _ in xrange(input()):
s=raw_input()
if s==s[::-1]:
print "YES"
else:
print "NO" | 1Python2 | {
"input": [
"2\naba\nax\n\nSAMPLE",
"2\naba\nxa\n\nSAMPLE",
"2\naab\n`x\n\nTAMPLE",
"2\naba\nx`\n\nSAMPLE",
"2\naba\n`x\n\nSAMPLE",
"2\naba\n`x\n\nTAMPLE",
"2\naab\nx`\n\nTAMPLE",
"2\nbaa\nx`\n\nTAMPLE",
"2\naab\nxa\n\nTAMPLE",
"2\nbaa\nxa\n\nTAMPLE",
"2\nbaa\nxa\n\nTMAPLE... | 3HACKEREARTH |
tablets_1989 | Therasa is a Nurse. She wants to give some tablets to the patients in her practice. All the patients sit in a line and each of them has a rating score according to his or her health score. Therasa wants to give at least 1 tablet for each patient. Patients get jealous of their immediate neighbors, so if two patients s... | import sys
inp = sys.stdin.readline
def noTablets(a, n):
countTablets = 1
countIf = 1
countElse = 1
ind = 0
for i in range(1, n):
if a[i] > a[i-1]:
countIf += 1
countElse = 0
countTablets += countIf;
ind = countIf
elif a[i-1] == a[i]:
countIf = 1
countElse = 0
countTablets += 1
ind = 1... | 1Python2 | {
"input": [
"3\n1\n2\n2\n\nSAMPLE",
"3\n1\n2\n2",
"3\n2\n2\n2",
"3\n1\n2\n2\n\nSAMPME",
"3\n2\n0\n2\n\nSAMPME",
"3\n2\n1\n0\n\nSAMQLE",
"3\n2\n2\n4",
"3\n2\n2\n2\n\nSAMPME",
"3\n1\n3\n2\n\nSAMPME",
"3\n1\n3\n2\n\nSAMPLE",
"3\n1\n3\n2\n\nSAMQLE",
"3\n1\n1\n2\n\nSAMQLE",... | 3HACKEREARTH |
who-will-survive-in-the-end_1990 | Ali baba did a trick on the forty thieves and was able to trap them inside a big cave which was the home of wild wolves. The thieves are without any weapons, only the chief of the thieves has knife. With no weapons they will not be able to fight with the wolves, so they decide to kill themselves rather than being eate... | import sys
from math import log, floor
def lucky( n ):
return 2*(n - 2**(int(floor(log(n,2)))))+1
cases= int(sys.stdin.readline())
current= 0
while current < cases:
current += 1
n = int(sys.stdin.readline())
print lucky( n ) | 1Python2 | {
"input": [
"4\n5\n11\n45\n23987443\n\nSAMPLE",
"4\n5\n11\n45\n28960650\n\nSAMPLE",
"4\n5\n11\n45\n19738501\n\nSAMPLE",
"4\n5\n6\n45\n19738501\n\nSAMPLE",
"4\n5\n6\n73\n19738501\n\nRALPME",
"4\n5\n6\n73\n28777926\n\nRALPME",
"4\n7\n6\n73\n28777926\n\nEMPLAR",
"4\n7\n6\n88\n28777926\n\... | 3HACKEREARTH |
p02630 AtCoder Beginner Contest 171 - Replacing_1991 | You have a sequence A composed of N positive integers: A_{1}, A_{2}, \cdots, A_{N}.
You will now successively do the following Q operations:
* In the i-th operation, you replace every element whose value is B_{i} with C_{i}.
For each i (1 \leq i \leq Q), find S_{i}: the sum of all elements in A just after the i-th... | #!/usr/bin/env python
from __future__ import division, print_function
import os
import sys
from collections import Counter
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():
n = int(... | 1Python2 | {
"input": [
"2\n1 2\n3\n1 100\n2 100\n100 1000",
"4\n1 2 3 4\n3\n1 2\n3 4\n2 4",
"4\n1 1 1 1\n3\n1 2\n2 1\n3 5",
"4\n1 2 3 3\n3\n1 2\n3 4\n2 4",
"4\n2 1 1 1\n3\n1 2\n2 1\n3 5",
"4\n1 2 3 3\n3\n1 2\n3 4\n0 4",
"4\n0 1 1 1\n3\n1 2\n2 1\n3 5",
"4\n1 3 3 3\n3\n1 2\n3 4\n0 4",
"4\n1 3 ... | 5ATCODER |
p02630 AtCoder Beginner Contest 171 - Replacing_1992 | You have a sequence A composed of N positive integers: A_{1}, A_{2}, \cdots, A_{N}.
You will now successively do the following Q operations:
* In the i-th operation, you replace every element whose value is B_{i} with C_{i}.
For each i (1 \leq i \leq Q), find S_{i}: the sum of all elements in A just after the i-th... | #include<iostream>
using namespace std;
int main(){
int n,q;
long long s=0;
cin>>n;
int a[n];
for(int i=0;i<n;i++) cin>>a[i];
cin>>q;
int p[100005]={0};
for(int i=0;i<n;i++){
s+=a[i];
p[a[i]]++;
}
for(int i=0;i<q;i++){
int b,c;
cin>>b>>c;
s+=(c-b)*p[b];
p[c]+=p[b];
p[b]=0;
cout<<s<<end... | 2C++ | {
"input": [
"2\n1 2\n3\n1 100\n2 100\n100 1000",
"4\n1 2 3 4\n3\n1 2\n3 4\n2 4",
"4\n1 1 1 1\n3\n1 2\n2 1\n3 5",
"4\n1 2 3 3\n3\n1 2\n3 4\n2 4",
"4\n2 1 1 1\n3\n1 2\n2 1\n3 5",
"4\n1 2 3 3\n3\n1 2\n3 4\n0 4",
"4\n0 1 1 1\n3\n1 2\n2 1\n3 5",
"4\n1 3 3 3\n3\n1 2\n3 4\n0 4",
"4\n1 3 ... | 5ATCODER |
p02630 AtCoder Beginner Contest 171 - Replacing_1993 | You have a sequence A composed of N positive integers: A_{1}, A_{2}, \cdots, A_{N}.
You will now successively do the following Q operations:
* In the i-th operation, you replace every element whose value is B_{i} with C_{i}.
For each i (1 \leq i \leq Q), find S_{i}: the sum of all elements in A just after the i-th... | n = int(input())
la = list(map(int, input().split()))
sa = sum(la)
l_cnt = [0]*100001
for i in la:
l_cnt[i] += 1
q = int(input())
for i in range(q):
b, c = map(int, input().split())
sa += (c-b)*l_cnt[b]
print(sa)
l_cnt[c] += l_cnt[b]
l_cnt[b] = 0 | 3Python3 | {
"input": [
"2\n1 2\n3\n1 100\n2 100\n100 1000",
"4\n1 2 3 4\n3\n1 2\n3 4\n2 4",
"4\n1 1 1 1\n3\n1 2\n2 1\n3 5",
"4\n1 2 3 3\n3\n1 2\n3 4\n2 4",
"4\n2 1 1 1\n3\n1 2\n2 1\n3 5",
"4\n1 2 3 3\n3\n1 2\n3 4\n0 4",
"4\n0 1 1 1\n3\n1 2\n2 1\n3 5",
"4\n1 3 3 3\n3\n1 2\n3 4\n0 4",
"4\n1 3 ... | 5ATCODER |
p02630 AtCoder Beginner Contest 171 - Replacing_1994 | You have a sequence A composed of N positive integers: A_{1}, A_{2}, \cdots, A_{N}.
You will now successively do the following Q operations:
* In the i-th operation, you replace every element whose value is B_{i} with C_{i}.
For each i (1 \leq i \leq Q), find S_{i}: the sum of all elements in A just after the i-th... | import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] $){
Scanner s = new Scanner(System.in);
int N = s.nextInt();
long sum = 0;
long[] S = new long[100000+1];
for(int i = 0; i < N; i++){
int A = s.nextInt();
sum += A;
S[A]++;
}
int Q = s.nextInt();
... | 4JAVA | {
"input": [
"2\n1 2\n3\n1 100\n2 100\n100 1000",
"4\n1 2 3 4\n3\n1 2\n3 4\n2 4",
"4\n1 1 1 1\n3\n1 2\n2 1\n3 5",
"4\n1 2 3 3\n3\n1 2\n3 4\n2 4",
"4\n2 1 1 1\n3\n1 2\n2 1\n3 5",
"4\n1 2 3 3\n3\n1 2\n3 4\n0 4",
"4\n0 1 1 1\n3\n1 2\n2 1\n3 5",
"4\n1 3 3 3\n3\n1 2\n3 4\n0 4",
"4\n1 3 ... | 5ATCODER |
p02761 AtCoder Beginner Contest 157 - Guess The Number_1995 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`.
* The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)
* The s_i-th digit from the left is c_i. \left(i ... | N, M = map(int, raw_input().split())
s = [0]*M
c = [0]*M
for i in range(M):
s[i], c[i] = map(int, raw_input().split())
s[i] -= 1
for i in range(0 if N==1 else 10**(N-1), 10**N):
i = str(i)
ok = True
for j in range(M):
if i[s[j]]!=str(c[j]):
ok = False
if ok:
print i
exit(0)
print -1
| 1Python2 | {
"input": [
"3 1\n1 0",
"3 3\n1 7\n3 2\n1 7",
"3 2\n2 1\n2 3",
"3 3\n1 14\n3 2\n1 7",
"3 0\n2 1\n2 3",
"3 1\n2 1\n1 3",
"3 1\n0 1\n1 0",
"3 3\n1 7\n3 4\n1 7",
"3 2\n2 0\n1 3",
"3 3\n0 2\n3 2\n1 1",
"3 2\n3 0\n2 6",
"1 1\n0 1\n1 0",
"2 1\n0 1\n1 0",
"2 0\n0 0\n2... | 5ATCODER |
p02761 AtCoder Beginner Contest 157 - Guess The Number_1996 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`.
* The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)
* The s_i-th digit from the left is c_i. \left(i ... | #include<bits/stdc++.h>
using namespace std;
int n,m;
int a[10];
int main(){
cin>>n>>m;
memset(a,-1,sizeof a);
int f=1;
while(m--){
int pos,c;
cin>>pos>>c;
if(a[pos]!=-1&&c!=a[pos]){
f=0;
break;
}
else a[pos]=c;
}
if(n==1){
if(a[1]==-1)a[1]=0;
}
else{
if(a[1]==0){
f=0;
}
if(a[1]==-1)a... | 2C++ | {
"input": [
"3 1\n1 0",
"3 3\n1 7\n3 2\n1 7",
"3 2\n2 1\n2 3",
"3 3\n1 14\n3 2\n1 7",
"3 0\n2 1\n2 3",
"3 1\n2 1\n1 3",
"3 1\n0 1\n1 0",
"3 3\n1 7\n3 4\n1 7",
"3 2\n2 0\n1 3",
"3 3\n0 2\n3 2\n1 1",
"3 2\n3 0\n2 6",
"1 1\n0 1\n1 0",
"2 1\n0 1\n1 0",
"2 0\n0 0\n2... | 5ATCODER |
p02761 AtCoder Beginner Contest 157 - Guess The Number_1997 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`.
* The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)
* The s_i-th digit from the left is c_i. \left(i ... | N,M = map(int,input().split())
SCdash = [[int(i) for i in input().split()] for m in range(M)]
SC = [[scc[0]-1,str(scc[1])] for scc in SCdash]
SG = [(0,10),(10,100),(100,1000)]
for x in range(*SG[N-1]):
keta = str(x)
if all([keta[s]==c for s,c in SC]):
print(x)
exit()
print(-1)
| 3Python3 | {
"input": [
"3 1\n1 0",
"3 3\n1 7\n3 2\n1 7",
"3 2\n2 1\n2 3",
"3 3\n1 14\n3 2\n1 7",
"3 0\n2 1\n2 3",
"3 1\n2 1\n1 3",
"3 1\n0 1\n1 0",
"3 3\n1 7\n3 4\n1 7",
"3 2\n2 0\n1 3",
"3 3\n0 2\n3 2\n1 1",
"3 2\n3 0\n2 6",
"1 1\n0 1\n1 0",
"2 1\n0 1\n1 0",
"2 0\n0 0\n2... | 5ATCODER |
p02761 AtCoder Beginner Contest 157 - Guess The Number_1998 | If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`.
* The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)
* The s_i-th digit from the left is c_i. \left(i ... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
Integer[] num = new Integer[n];
boolean isNumber = true;
for (int i = 0; i < m; i++) {
... | 4JAVA | {
"input": [
"3 1\n1 0",
"3 3\n1 7\n3 2\n1 7",
"3 2\n2 1\n2 3",
"3 3\n1 14\n3 2\n1 7",
"3 0\n2 1\n2 3",
"3 1\n2 1\n1 3",
"3 1\n0 1\n1 0",
"3 3\n1 7\n3 4\n1 7",
"3 2\n2 0\n1 3",
"3 3\n0 2\n3 2\n1 1",
"3 2\n3 0\n2 6",
"1 1\n0 1\n1 0",
"2 1\n0 1\n1 0",
"2 0\n0 0\n2... | 5ATCODER |
p02896 AtCoder Grand Contest 039 - Min Product Sum_1999 | For each of the K^{NM} ways to write an integer between 1 and K (inclusive) in every square in a square grid with N rows and M columns, find the value defined below, then compute the sum of all those K^{NM} values, modulo D.
* For each of the NM squares, find the minimum among the N+M-1 integers written in the square'... | #include <bits/stdc++.h>
#define int long long
using std::cin;
using std::cout;
const int N = 105;
int f[N][N][N], g[N][N], p[N][N], mo;
signed main() {
int n, m, k;
cin >> n >> m >> k >> mo;
f[0][0][0] = 1;
for (int i = 0; i <= 100; ++ i) {
g[i][0] = 1;
for (int j = 1; j <= i; ++ j) {
g[i][j] = (g[i - 1... | 2C++ | {
"input": [
"2 3 4 998244353",
"31 41 59 998244353",
"2 2 2 998244353",
"2 3 2 998244353",
"31 27 59 998244353",
"2 5 2 998244353",
"36 27 59 998244353",
"2 5 3 998244353",
"36 48 59 998244353",
"1 5 3 998244353",
"36 48 23 998244353",
"1 4 3 998244353",
"36 83 23 ... | 5ATCODER |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.