exec_outcome stringclasses 1
value | code_uid stringlengths 32 32 | file_name stringclasses 111
values | prob_desc_created_at stringlengths 10 10 | prob_desc_description stringlengths 63 3.8k | prob_desc_memory_limit stringclasses 18
values | source_code stringlengths 117 65.5k | lang_cluster stringclasses 1
value | prob_desc_sample_inputs stringlengths 2 802 | prob_desc_time_limit stringclasses 27
values | prob_desc_sample_outputs stringlengths 2 796 | prob_desc_notes stringlengths 4 3k ⌀ | lang stringclasses 5
values | prob_desc_input_from stringclasses 3
values | tags listlengths 0 11 | src_uid stringlengths 32 32 | prob_desc_input_spec stringlengths 28 2.37k ⌀ | difficulty int64 -1 3.5k ⌀ | prob_desc_output_spec stringlengths 17 1.47k ⌀ | prob_desc_output_to stringclasses 3
values | hidden_unit_tests stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PASSED | 57f9475a263b2ee191e1d23ff0f7c5d2 | train_003.jsonl | 1605796500 | You are given a string $$$s$$$, consisting of brackets of two types: '(', ')', '[' and ']'.A string is called a regular bracket sequence (RBS) if it's of one of the following types: empty string; '(' + RBS + ')'; '[' + RBS + ']'; RBS + RBS. where plus is a concatenation of two strings.In one move you can choose a ... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
public static void main(String args[]) throws Exception {
BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
Scanner sc = new Scanner (System.in);
//int T = sc.nextInt();
int T = Integer.parseInt(br.read... | Java | ["5\n()\n[]()\n([)]\n)]([\n)[(]"] | 1 second | ["1\n2\n2\n0\n1"] | NoteIn the first example you can just erase the whole string.In the second example you can first erase the brackets on positions $$$1$$$ and $$$2$$$: "[]()", then "()" is left. After that you can erase it whole. You could erase the whole string from the beginning but you would get one move instead of two.In the third e... | Java 8 | standard input | [
"greedy"
] | db9cec57d8ed5e914818ce9b439eb0f9 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Each of the next $$$t$$$ lines contains a non-empty string, consisting only of characters '(', ')', '[' and ']'. The total length of the strings over all testcases doesn't exceed $$$2 \cdot 10^5$$$. | 800 | For each testcase print a single integer — the maximum number of moves you can perform on a given string $$$s$$$. | standard output | |
PASSED | 5807777339af0a1bc2b630d56e5fb754 | train_003.jsonl | 1605796500 | You are given a string $$$s$$$, consisting of brackets of two types: '(', ')', '[' and ']'.A string is called a regular bracket sequence (RBS) if it's of one of the following types: empty string; '(' + RBS + ')'; '[' + RBS + ']'; RBS + RBS. where plus is a concatenation of two strings.In one move you can choose a ... | 256 megabytes | /* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class C
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scann... | Java | ["5\n()\n[]()\n([)]\n)]([\n)[(]"] | 1 second | ["1\n2\n2\n0\n1"] | NoteIn the first example you can just erase the whole string.In the second example you can first erase the brackets on positions $$$1$$$ and $$$2$$$: "[]()", then "()" is left. After that you can erase it whole. You could erase the whole string from the beginning but you would get one move instead of two.In the third e... | Java 8 | standard input | [
"greedy"
] | db9cec57d8ed5e914818ce9b439eb0f9 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Each of the next $$$t$$$ lines contains a non-empty string, consisting only of characters '(', ')', '[' and ']'. The total length of the strings over all testcases doesn't exceed $$$2 \cdot 10^5$$$. | 800 | For each testcase print a single integer — the maximum number of moves you can perform on a given string $$$s$$$. | standard output | |
PASSED | 0a8efee08b84b45cbab5e5dbce7c5e07 | train_003.jsonl | 1605796500 | You are given a string $$$s$$$, consisting of brackets of two types: '(', ')', '[' and ']'.A string is called a regular bracket sequence (RBS) if it's of one of the following types: empty string; '(' + RBS + ')'; '[' + RBS + ']'; RBS + RBS. where plus is a concatenation of two strings.In one move you can choose a ... | 256 megabytes | import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Scanner;
import java.util.function.Function;
import java.util.stream.Collectors;
public class _C {
... | Java | ["5\n()\n[]()\n([)]\n)]([\n)[(]"] | 1 second | ["1\n2\n2\n0\n1"] | NoteIn the first example you can just erase the whole string.In the second example you can first erase the brackets on positions $$$1$$$ and $$$2$$$: "[]()", then "()" is left. After that you can erase it whole. You could erase the whole string from the beginning but you would get one move instead of two.In the third e... | Java 8 | standard input | [
"greedy"
] | db9cec57d8ed5e914818ce9b439eb0f9 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Each of the next $$$t$$$ lines contains a non-empty string, consisting only of characters '(', ')', '[' and ']'. The total length of the strings over all testcases doesn't exceed $$$2 \cdot 10^5$$$. | 800 | For each testcase print a single integer — the maximum number of moves you can perform on a given string $$$s$$$. | standard output | |
PASSED | 18eba599aaefa7b210a8d1e8a827c508 | train_003.jsonl | 1605796500 | You are given a string $$$s$$$, consisting of brackets of two types: '(', ')', '[' and ']'.A string is called a regular bracket sequence (RBS) if it's of one of the following types: empty string; '(' + RBS + ')'; '[' + RBS + ']'; RBS + RBS. where plus is a concatenation of two strings.In one move you can choose a ... | 256 megabytes | //package a;
import java.io.*;
import java.util.*;
public class A{
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
// BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
// String str[]=br.rea... | Java | ["5\n()\n[]()\n([)]\n)]([\n)[(]"] | 1 second | ["1\n2\n2\n0\n1"] | NoteIn the first example you can just erase the whole string.In the second example you can first erase the brackets on positions $$$1$$$ and $$$2$$$: "[]()", then "()" is left. After that you can erase it whole. You could erase the whole string from the beginning but you would get one move instead of two.In the third e... | Java 8 | standard input | [
"greedy"
] | db9cec57d8ed5e914818ce9b439eb0f9 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Each of the next $$$t$$$ lines contains a non-empty string, consisting only of characters '(', ')', '[' and ']'. The total length of the strings over all testcases doesn't exceed $$$2 \cdot 10^5$$$. | 800 | For each testcase print a single integer — the maximum number of moves you can perform on a given string $$$s$$$. | standard output | |
PASSED | 4d8a4f767626aab66ca8b60dbfff952c | train_003.jsonl | 1605796500 | You are given a string $$$s$$$, consisting of brackets of two types: '(', ')', '[' and ']'.A string is called a regular bracket sequence (RBS) if it's of one of the following types: empty string; '(' + RBS + ')'; '[' + RBS + ']'; RBS + RBS. where plus is a concatenation of two strings.In one move you can choose a ... | 256 megabytes | import java.io.*;
import java.util.*;
final public class C {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int tst = Integer.parseInt(br.readLine());
whil... | Java | ["5\n()\n[]()\n([)]\n)]([\n)[(]"] | 1 second | ["1\n2\n2\n0\n1"] | NoteIn the first example you can just erase the whole string.In the second example you can first erase the brackets on positions $$$1$$$ and $$$2$$$: "[]()", then "()" is left. After that you can erase it whole. You could erase the whole string from the beginning but you would get one move instead of two.In the third e... | Java 8 | standard input | [
"greedy"
] | db9cec57d8ed5e914818ce9b439eb0f9 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Each of the next $$$t$$$ lines contains a non-empty string, consisting only of characters '(', ')', '[' and ']'. The total length of the strings over all testcases doesn't exceed $$$2 \cdot 10^5$$$. | 800 | For each testcase print a single integer — the maximum number of moves you can perform on a given string $$$s$$$. | standard output | |
PASSED | 5f12878da97536c7e7368d3d25ebb21a | train_003.jsonl | 1605796500 | You are given a string $$$s$$$, consisting of brackets of two types: '(', ')', '[' and ']'.A string is called a regular bracket sequence (RBS) if it's of one of the following types: empty string; '(' + RBS + ')'; '[' + RBS + ']'; RBS + RBS. where plus is a concatenation of two strings.In one move you can choose a ... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args) {
// Use the Scanner class
Scanner sc = new Scanner(System.in);
/*
int n = sc.nextInt(); // read input as integer
long k = sc.nextLong(); // read input as long
doubl... | Java | ["5\n()\n[]()\n([)]\n)]([\n)[(]"] | 1 second | ["1\n2\n2\n0\n1"] | NoteIn the first example you can just erase the whole string.In the second example you can first erase the brackets on positions $$$1$$$ and $$$2$$$: "[]()", then "()" is left. After that you can erase it whole. You could erase the whole string from the beginning but you would get one move instead of two.In the third e... | Java 8 | standard input | [
"greedy"
] | db9cec57d8ed5e914818ce9b439eb0f9 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Each of the next $$$t$$$ lines contains a non-empty string, consisting only of characters '(', ')', '[' and ']'. The total length of the strings over all testcases doesn't exceed $$$2 \cdot 10^5$$$. | 800 | For each testcase print a single integer — the maximum number of moves you can perform on a given string $$$s$$$. | standard output | |
PASSED | 76ba48d99883ff4f3258d05fc4f2d865 | train_003.jsonl | 1605796500 | You are given a string $$$s$$$, consisting of brackets of two types: '(', ')', '[' and ']'.A string is called a regular bracket sequence (RBS) if it's of one of the following types: empty string; '(' + RBS + ')'; '[' + RBS + ']'; RBS + RBS. where plus is a concatenation of two strings.In one move you can choose a ... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner khar = new Scanner(System.in);
int t = khar.nextInt();
for (int j = 0; j <t; j++) {
String s = khar.next();
int par = 0;
int crosh = 0;
int max = 0;
for (in... | Java | ["5\n()\n[]()\n([)]\n)]([\n)[(]"] | 1 second | ["1\n2\n2\n0\n1"] | NoteIn the first example you can just erase the whole string.In the second example you can first erase the brackets on positions $$$1$$$ and $$$2$$$: "[]()", then "()" is left. After that you can erase it whole. You could erase the whole string from the beginning but you would get one move instead of two.In the third e... | Java 8 | standard input | [
"greedy"
] | db9cec57d8ed5e914818ce9b439eb0f9 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Each of the next $$$t$$$ lines contains a non-empty string, consisting only of characters '(', ')', '[' and ']'. The total length of the strings over all testcases doesn't exceed $$$2 \cdot 10^5$$$. | 800 | For each testcase print a single integer — the maximum number of moves you can perform on a given string $$$s$$$. | standard output | |
PASSED | 60072f89eb83bdafcae7f4d58f09cdf7 | train_003.jsonl | 1605796500 | You are given a string $$$s$$$, consisting of brackets of two types: '(', ')', '[' and ']'.A string is called a regular bracket sequence (RBS) if it's of one of the following types: empty string; '(' + RBS + ')'; '[' + RBS + ']'; RBS + RBS. where plus is a concatenation of two strings.In one move you can choose a ... | 256 megabytes | import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t;
t = in.nextInt();
while ((t--) > 0) {
String s = in.next();
int openC = 0;
int openS = 0;
int ans = 0;... | Java | ["5\n()\n[]()\n([)]\n)]([\n)[(]"] | 1 second | ["1\n2\n2\n0\n1"] | NoteIn the first example you can just erase the whole string.In the second example you can first erase the brackets on positions $$$1$$$ and $$$2$$$: "[]()", then "()" is left. After that you can erase it whole. You could erase the whole string from the beginning but you would get one move instead of two.In the third e... | Java 8 | standard input | [
"greedy"
] | db9cec57d8ed5e914818ce9b439eb0f9 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Each of the next $$$t$$$ lines contains a non-empty string, consisting only of characters '(', ')', '[' and ']'. The total length of the strings over all testcases doesn't exceed $$$2 \cdot 10^5$$$. | 800 | For each testcase print a single integer — the maximum number of moves you can perform on a given string $$$s$$$. | standard output | |
PASSED | 5c9ff2c1ced9fa5000c13ac0e17e4905 | train_003.jsonl | 1605796500 | You are given a string $$$s$$$, consisting of brackets of two types: '(', ')', '[' and ']'.A string is called a regular bracket sequence (RBS) if it's of one of the following types: empty string; '(' + RBS + ')'; '[' + RBS + ']'; RBS + RBS. where plus is a concatenation of two strings.In one move you can choose a ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class Solution
{
public static void main(String []args) throws IOException
{
BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(buf.readLine().trim());
while(t-->0)
{
String str = buf.readLine... | Java | ["5\n()\n[]()\n([)]\n)]([\n)[(]"] | 1 second | ["1\n2\n2\n0\n1"] | NoteIn the first example you can just erase the whole string.In the second example you can first erase the brackets on positions $$$1$$$ and $$$2$$$: "[]()", then "()" is left. After that you can erase it whole. You could erase the whole string from the beginning but you would get one move instead of two.In the third e... | Java 8 | standard input | [
"greedy"
] | db9cec57d8ed5e914818ce9b439eb0f9 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Each of the next $$$t$$$ lines contains a non-empty string, consisting only of characters '(', ')', '[' and ']'. The total length of the strings over all testcases doesn't exceed $$$2 \cdot 10^5$$$. | 800 | For each testcase print a single integer — the maximum number of moves you can perform on a given string $$$s$$$. | standard output | |
PASSED | 5403e86d3e505a8a0d2d3f365aacd29c | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* @author khokharnikunj8
*/
public class Main {
public static void main(String[] args) {
... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | de735d60e03d3a0e59478f45b20fc6d3 | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.awt.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.List;
import java.util.Queue;
import static java.lang.Math.max;
import static java.lang.Math.min;
public class D implements Runnable{
// SOLUTION AT THE TOP OF CODE!!!
// HACK ... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | 270f46ede4ecafb1b8874329f92d1a38 | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int k=s.nextInt();
long[] arr=new long[n+1];
for(int i=1;i<n+1;i++)
{
arr[i]=s.nextLong();
}
long[] pre=new long[n+1];
... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | f8eab5d987ce4690361052951334b229 | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
import java.lang.StringBuilder;
import java.util.Arrays;
//maintain: array on vertices
//a[i]:
public class Test10 {
public static void main(String[] Args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nex... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | 2ab6120a808a1477d5361bf5ab70eeb3 | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {new Main().run();}
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
void run(){
work();
out.flush();
}
long mod=998244353L;
void work() {
int n=in.nextInt();
int k=in.nextIn... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | e1599cf94b285396bfb0b7f5e7042c0f | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.InputMismatchException;
public class D {
InputStream is;
PrintWriter out;
String INPUT = "7 3\n" +
"3 1... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | 93e3b6594349803d1850f5b50c0d04dc | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes |
//package que_a;
import java.io.*;
import java.util.*;
public class utkarsh {
InputStream is;
PrintWriter out;
long mod = (long) (1e9 + 7);
boolean SHOW_TIME;
void solve() {
//Enter code here utkarsh
//SHOW_TIME = true;
int n = ni();
int k = ni();
... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | ab851780ffba795683d62d111de1c7dc | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.BigInteger;
import java.util.Map.Entry;
import static java.lang.Math.*;
public class D extends PrintWriter {
void run() {
int n = nextInt();
int k = nextInt();
long[] a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = nextLong();
}
long ans =... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | 7a1a57133955eff844ac4f3fd68b1e3e | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | 903415d32636ab6b21eb985294869f10 | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public class D {
static int N, K;
static long[] values;
static long target;
static int[][] posible;
sta... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | c639dfd7721550758defe43b01ba7daa | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | /*
* Author Ayub Subhaniya
* Institute DA-IICT
*/
import java.io.*;
import java.math.*;
import java.util.*;
public class Tester
{
InputStream in;
PrintWriter out;
long mod=(long)1e9+7;
int MAX=(int)1e5+7;
double eps=1e-6;
int n,k;
long a[];
void solve()
{
n=ni();
... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | 2efc3c9dd68460697e062499c3e64832 | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
class Node {
int id;
long mask;
public Node(int id,long mask){
this.id=id;
this.mask=mask;
}
public boolean equals(Node t1){
if(t1 instanceof Node){
return id==t1.id && mask==t1.mask;
}else return... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | 3a13840a7d1d01bde9c11ae65b63ce27 | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.io.*;
import java.math.*;
import java.security.KeyStore.Entry;
import java.util.*;
/*
yash jobanputra
DA-IICT
*/
public class yash {
private static InputStream stream;
... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | fa78806aa395581101ccf799bb492e23 | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.io.*;
import java.math.*;
import java.security.KeyStore.Entry;
import java.util.*;
/*
yash jobanputra
DA-IICT
*/
public class yash {
private static InputStream stream;
... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | b820e2b122789cdacfadfffc26cb575c | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | /**
* Created by Baelish on 5/27/2018.
*/
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class D_3 {
public static void main(String[] args)throws Exception {
FastReader in = new FastReader(System.in);
PrintWriter pw = new PrintWriter(System.out);
n = in.next... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | 8beede907baf1ee8a501e300d98731d5 | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes |
import java.util.Scanner;
public class BOOKSHELVES {
public static void main(String args[]) throws Exception
{
long[] a ;
Scanner sc= new Scanner(System.in);
int n=sc.nextInt();
int parts=sc.nextInt();
a=new long[n+1];
for(int i=1;i<=n;i++)
{
a[i]=sc.nextLong();
}
long... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | 4a93188a275d24ce6699934463437705 | train_003.jsonl | 1527432600 | Mr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with some books on it, each book has an integer positive price.Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office.He learned that in the new office... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class AvitoD {
static Map<Integer, Long> get_sum = new HashMap<Integer, Long>();
static long[] books;
static int n;
static int totalShelves;
public static void main(String[] args) {
FastScanner sc = new FastScann... | Java | ["10 4\n9 14 28 1 7 13 15 29 2 31", "7 3\n3 14 15 92 65 35 89"] | 1 second | ["24", "64"] | NoteIn the first example you can split the books as follows:$$$$$$(9 + 14 + 28 + 1 + 7) \& (13 + 15) \& (29 + 2) \& (31) = 24.$$$$$$In the second example you can split the books as follows:$$$$$$(3 + 14 + 15 + 92) \& (65) \& (35 + 89) = 64.$$$$$$ | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | 9862db32dfd8eab8714d17aaaa338acd | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 50$$$) — the number of books and the number of shelves in the new office. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots a_n$$$, ($$$0 < a_i < 2^{50}$$$) — the prices of the books in the order they stand on the old sh... | 1,900 | Print the maximum possible beauty of $$$k$$$ shelves in the new office. | standard output | |
PASSED | d33fcc081f169282d76c3012207df084 | train_003.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[])
{
FastReader input=new FastReader();
PrintWriter out=new PrintWriter(System.out);
int T=input.nextInt();
while(T-->0)
{
int n=input.nextInt();
String a... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 8 | standard input | [
"greedy",
"graphs",
"two pointers",
"dsu",
"sortings",
"trees",
"strings"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 47bd2e706b5df49b0a7c4b921ec27913 | train_003.jsonl | 1440261000 | In this task you need to process a set of stock exchange orders and use them to create order book.An order is an instruction of some participant to buy or sell stocks on stock exchange. The order number i has price pi, direction di — buy or sell, and integer qi. This means that the participant is ready to buy or sell q... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
HashMap<Integer,Integer> mapB = new HashMap<>();
HashMap<Integer,Integer> mapS = new HashMap<>();
int n = sc.nextInt();
int s = sc.nextInt();
sc.nex... | Java | ["6 2\nB 10 3\nS 50 2\nS 40 1\nS 50 6\nB 20 4\nB 25 10"] | 2 seconds | ["S 50 8\nS 40 1\nB 25 10\nB 20 4"] | NoteDenote (x, y) an order with price x and volume y. There are 3 aggregated buy orders (10, 3), (20, 4), (25, 10) and two sell orders (50, 8), (40, 1) in the sample.You need to print no more than two best orders for each direction, so you shouldn't print the order (10 3) having the worst price among buy orders. | Java 11 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 267c04c77f97bbdf7697dc88c7bfa4af | The input starts with two positive integers n and s (1 ≤ n ≤ 1000, 1 ≤ s ≤ 50), the number of orders and the book depth. Next n lines contains a letter di (either 'B' or 'S'), an integer pi (0 ≤ pi ≤ 105) and an integer qi (1 ≤ qi ≤ 104) — direction, price and volume respectively. The letter 'B' means buy, 'S' means se... | 1,300 | Print no more than 2s lines with aggregated orders from order book of depth s. The output format for orders should be the same as in input. | standard output | |
PASSED | 633f7acb12fa164165f97a3f49a24797 | train_003.jsonl | 1440261000 | In this task you need to process a set of stock exchange orders and use them to create order book.An order is an instruction of some participant to buy or sell stocks on stock exchange. The order number i has price pi, direction di — buy or sell, and integer qi. This means that the participant is ready to buy or sell q... | 256 megabytes | import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.StringTokenizer;
public class B {
public static void main(String[] args) {
HashMap<Long, Long> buy = new HashMap<>();
HashMap<Long, Long> sell = new HashMap<>();
int n = io.nex... | Java | ["6 2\nB 10 3\nS 50 2\nS 40 1\nS 50 6\nB 20 4\nB 25 10"] | 2 seconds | ["S 50 8\nS 40 1\nB 25 10\nB 20 4"] | NoteDenote (x, y) an order with price x and volume y. There are 3 aggregated buy orders (10, 3), (20, 4), (25, 10) and two sell orders (50, 8), (40, 1) in the sample.You need to print no more than two best orders for each direction, so you shouldn't print the order (10 3) having the worst price among buy orders. | Java 11 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 267c04c77f97bbdf7697dc88c7bfa4af | The input starts with two positive integers n and s (1 ≤ n ≤ 1000, 1 ≤ s ≤ 50), the number of orders and the book depth. Next n lines contains a letter di (either 'B' or 'S'), an integer pi (0 ≤ pi ≤ 105) and an integer qi (1 ≤ qi ≤ 104) — direction, price and volume respectively. The letter 'B' means buy, 'S' means se... | 1,300 | Print no more than 2s lines with aggregated orders from order book of depth s. The output format for orders should be the same as in input. | standard output | |
PASSED | 76f3c1caeb91975ed56e1325d5adc285 | train_003.jsonl | 1440261000 | In this task you need to process a set of stock exchange orders and use them to create order book.An order is an instruction of some participant to buy or sell stocks on stock exchange. The order number i has price pi, direction di — buy or sell, and integer qi. This means that the participant is ready to buy or sell q... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class r3p1 {
public static void main(String[] args) throws IOException {
FastScanner sc = new FastScanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int n = sc.nextInt();
int a = sc.nextInt();
... | Java | ["6 2\nB 10 3\nS 50 2\nS 40 1\nS 50 6\nB 20 4\nB 25 10"] | 2 seconds | ["S 50 8\nS 40 1\nB 25 10\nB 20 4"] | NoteDenote (x, y) an order with price x and volume y. There are 3 aggregated buy orders (10, 3), (20, 4), (25, 10) and two sell orders (50, 8), (40, 1) in the sample.You need to print no more than two best orders for each direction, so you shouldn't print the order (10 3) having the worst price among buy orders. | Java 11 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 267c04c77f97bbdf7697dc88c7bfa4af | The input starts with two positive integers n and s (1 ≤ n ≤ 1000, 1 ≤ s ≤ 50), the number of orders and the book depth. Next n lines contains a letter di (either 'B' or 'S'), an integer pi (0 ≤ pi ≤ 105) and an integer qi (1 ≤ qi ≤ 104) — direction, price and volume respectively. The letter 'B' means buy, 'S' means se... | 1,300 | Print no more than 2s lines with aggregated orders from order book of depth s. The output format for orders should be the same as in input. | standard output | |
PASSED | 31d12ee79c2137bb74b7990b06853f68 | train_003.jsonl | 1440261000 | In this task you need to process a set of stock exchange orders and use them to create order book.An order is an instruction of some participant to buy or sell stocks on stock exchange. The order number i has price pi, direction di — buy or sell, and integer qi. This means that the participant is ready to buy or sell q... | 256 megabytes | import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.TreeMap;
public class Main {
public static void main(String[] args) throws Exception{
OrderBook res = new OrderBook();
res.resolve();
}
static class OrderBook {
public void resolve () {
Scanner scan = new Scanner(System.in);
int... | Java | ["6 2\nB 10 3\nS 50 2\nS 40 1\nS 50 6\nB 20 4\nB 25 10"] | 2 seconds | ["S 50 8\nS 40 1\nB 25 10\nB 20 4"] | NoteDenote (x, y) an order with price x and volume y. There are 3 aggregated buy orders (10, 3), (20, 4), (25, 10) and two sell orders (50, 8), (40, 1) in the sample.You need to print no more than two best orders for each direction, so you shouldn't print the order (10 3) having the worst price among buy orders. | Java 11 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 267c04c77f97bbdf7697dc88c7bfa4af | The input starts with two positive integers n and s (1 ≤ n ≤ 1000, 1 ≤ s ≤ 50), the number of orders and the book depth. Next n lines contains a letter di (either 'B' or 'S'), an integer pi (0 ≤ pi ≤ 105) and an integer qi (1 ≤ qi ≤ 104) — direction, price and volume respectively. The letter 'B' means buy, 'S' means se... | 1,300 | Print no more than 2s lines with aggregated orders from order book of depth s. The output format for orders should be the same as in input. | standard output | |
PASSED | 8232b9739dc2b80b2516f0f71a3202ad | train_003.jsonl | 1440261000 | In this task you need to process a set of stock exchange orders and use them to create order book.An order is an instruction of some participant to buy or sell stocks on stock exchange. The order number i has price pi, direction di — buy or sell, and integer qi. This means that the participant is ready to buy or sell q... | 256 megabytes | import javafx.util.Pair;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int glubina = in.nextInt();
ArrayList<Pair<Integer,... | Java | ["6 2\nB 10 3\nS 50 2\nS 40 1\nS 50 6\nB 20 4\nB 25 10"] | 2 seconds | ["S 50 8\nS 40 1\nB 25 10\nB 20 4"] | NoteDenote (x, y) an order with price x and volume y. There are 3 aggregated buy orders (10, 3), (20, 4), (25, 10) and two sell orders (50, 8), (40, 1) in the sample.You need to print no more than two best orders for each direction, so you shouldn't print the order (10 3) having the worst price among buy orders. | Java 11 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 267c04c77f97bbdf7697dc88c7bfa4af | The input starts with two positive integers n and s (1 ≤ n ≤ 1000, 1 ≤ s ≤ 50), the number of orders and the book depth. Next n lines contains a letter di (either 'B' or 'S'), an integer pi (0 ≤ pi ≤ 105) and an integer qi (1 ≤ qi ≤ 104) — direction, price and volume respectively. The letter 'B' means buy, 'S' means se... | 1,300 | Print no more than 2s lines with aggregated orders from order book of depth s. The output format for orders should be the same as in input. | standard output | |
PASSED | 69e0ba218e8e48a2fc0a41a9fc75f705 | train_003.jsonl | 1440261000 | In this task you need to process a set of stock exchange orders and use them to create order book.An order is an instruction of some participant to buy or sell stocks on stock exchange. The order number i has price pi, direction di — buy or sell, and integer qi. This means that the participant is ready to buy or sell q... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class OrderBook {
public static void r(int arr[],int l,int m,int r) {
int n1=m-l+1;
int n2=r-m;
int L[]=new int[n1];
int R[]=new int[n2];
for(int i=0;i<n1;i++)
{
L[i]=arr[l+i];
}
for(int j=0;j<n2;j++)
{
R[j]=arr[m+1+j];
}
... | Java | ["6 2\nB 10 3\nS 50 2\nS 40 1\nS 50 6\nB 20 4\nB 25 10"] | 2 seconds | ["S 50 8\nS 40 1\nB 25 10\nB 20 4"] | NoteDenote (x, y) an order with price x and volume y. There are 3 aggregated buy orders (10, 3), (20, 4), (25, 10) and two sell orders (50, 8), (40, 1) in the sample.You need to print no more than two best orders for each direction, so you shouldn't print the order (10 3) having the worst price among buy orders. | Java 11 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 267c04c77f97bbdf7697dc88c7bfa4af | The input starts with two positive integers n and s (1 ≤ n ≤ 1000, 1 ≤ s ≤ 50), the number of orders and the book depth. Next n lines contains a letter di (either 'B' or 'S'), an integer pi (0 ≤ pi ≤ 105) and an integer qi (1 ≤ qi ≤ 104) — direction, price and volume respectively. The letter 'B' means buy, 'S' means se... | 1,300 | Print no more than 2s lines with aggregated orders from order book of depth s. The output format for orders should be the same as in input. | standard output | |
PASSED | 818c3c295792552750d22b956fe3be4d | train_003.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | // Main Code at the Bottom
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;
public class Main {
//Fast IO class
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
boolean env=System.getProperty("ONLINE_JUD... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1 = t1, ..., si = ti, si + 1 > ti + 1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 11 | standard input | [
"brute force"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1 ≤ n ≤ 1000; 1 ≤ p ≤ 26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 9855015c0c670e630e9254cc7bca3f9f | train_003.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes |
import java.util.*;
import java.io.*;
public class NotoPalindromes {
// https://codeforces.com/contest/465/problem/C
public static void main(String[] args) throws IOException, FileNotFoundException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader in = new BufferedR... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1 = t1, ..., si = ti, si + 1 > ti + 1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 11 | standard input | [
"brute force"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1 ≤ n ≤ 1000; 1 ≤ p ≤ 26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | fafc6e2ea72d41d5e2bb22b4e61c906e | train_003.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes |
import java.util.Scanner;
public class Main {
static int arr[][], dp[][], N, K, p;
static long s[][];
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
p = input.nextInt() - 1 + 'a';
input.nextLine();
String ... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1 = t1, ..., si = ti, si + 1 > ti + 1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 11 | standard input | [
"brute force"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1 ≤ n ≤ 1000; 1 ≤ p ≤ 26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 70726987d1c9f2cee2b411de854e4e30 | train_003.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Random;
import java.util.StringTokenizer;
public class Contest {
static PrintWriter out = new PrintWriter(System.out);
static final Random random = new... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1 = t1, ..., si = ti, si + 1 > ti + 1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 11 | standard input | [
"brute force"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1 ≤ n ≤ 1000; 1 ≤ p ≤ 26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 65c80c0ae031e15604fa9e024d129a8a | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;
public class B {
Scanner sc = new Scanner(System.in);
void doIt() {
int ans = -1;
int N = sc.nextInt();
int [] a = new int[N];
for(int i = 0; i < N; i++) a[i] = sc.nextInt();
int down_cnt = 0;
int down_pos = 0... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 7149f700afb4d44fb00549541ff88503 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[n];
int[] c = new int[n];
boolean b = true;
int ind = -1, min = 100001;
for (int i = 0; i < n; i++) {
... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 2b1eb8e964480670942663238ed0734d | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class B259 {
InputStream is;
PrintWriter out;
/**
* Go to Sublime, copy & pase the input Use Ctrl+A, Ctrl+Shift+L, Ctrl+... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 414468761824467ae6cd31e9a743641d | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 3cb68263c30bbb1b448474be5a671157 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.PriorityQueue;... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 712b22d17615a1b733e100d95482e859 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class B_259 {
public static void main(String[] args) throws IOException {
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(input);
i... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | a75ecd4621bbe55e8a2e5bb7175413d8 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.*;
import java.util.*;
public class b1 {
public static void main(String[] args) throws FileNotFoundException {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = in.nextInt();
... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 266c5bb8c92917dd72c3f6cada1909d9 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class LittlePonyandSortbyShift {
public static void main(String[] args) throws IOException {
Init(System.in);
int n = nextInt();
int a[] = new int[n]... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 3ebda1fd7f340b26d2ac3db7f414b205 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | /**
* Created by Phillip on 8/9/2014.
*/
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args)throws IOException{
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] input = new int[n];
for(int i=0;i<n;i++) input[i] = in.nextI... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 5f9b3fd2af672f4b757d307b5a942054 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.util.Scanner;
public class so {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
sc.nextLine();
int a[]=new int[n];
a[0]=sc.nextInt();
int k=0;
int j=0;
for(int i=1;i<n;i++)
{
a[i]=sc.nextInt();
if(a[i]<a[i-1])
{k++;
j=i;
}
}
if(a[0... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 074c7e1838e087e25b7092b7e8fbc7c5 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | /*
ID: sharnob1
PROG: ride
LANG: JAVA
*/
import java.io.*;
import java.util.*;
public class ride {
public static void main(String[] args) {
FastScanner scanner = new FastScanner();
int n = scanner.nextInt();
int[] arr = new int[n];
int index = n-1;
boolean sw = false;
... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | a6b78dd435dc639c96e1aa2b8eaa0b9b | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.util.Scanner;
public class B_Little_Pony_and_Sort_by_Shift {
static public void main(String arr[]) {
Scanner x = new Scanner(System.in);
int n = x.nextInt(), eq1, sq1, eq2 = 0, sq2 = 0 , temp , count = 0;
boolean flag = true, one = true , first = true;
eq1 = sq1 = x.nextInt();
for (int i = 1; i... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 1252ed78407674c45b594aa54daf7eba | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.util.*;
import java.io.*;
public class Cf259b {
public static void main(String[] args) throws IOException {
InputStreamReader fin = new InputStreamReader(System.in);
StreamTokenizer scr = new StreamTokenizer(fin);
scr.nextToken();
int n = (int)scr.nval;
int [] a =... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 756e385395aa5e0d4e14ad47e55120bf | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int n;
Scanner s = new Scanner(System.in);
n = s.nextInt();
int[] a = new int[n];
boolean pico = false;
for(int i = 0 ; i<n ; i++) {
a[i] = s.nextInt();
}
... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 5d31e958a34ed2fc7c10e85d83d45302 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.util.*;
public class _454B_Little_Pony_and_Sort_by_Shift {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[n];
int[] c = new int[n];
int start = 0;
for (int i = 0; i < n; i++)
a[i] = in.nextInt();
for (int i = 1; i < ... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 593063cfce289363e35bfc00d8b5bca8 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.util.Scanner;
public class Little_Pony_and_Sort_by_Shift {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b[] =new int[a];
for( int i=0 ; i< a; i++)
b[i] = in.nextInt();
int min = b[0] ,ind =0 , coun... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 5f1163fa3f48ef933660557bb1f8b6b7 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes |
import java.io.*;
import java.util.*;
public class B {
FastScanner in = new FastScanner(System.in);
PrintWriter out = new PrintWriter(System.out);
public void run() {
int n = in.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = in.nextInt();
}
int cnt = 0, cur = 0;
for (in... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 5621ff5bf2546bd945ba057a1ff9b1cf | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class B259 {
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 039669b51d0d769fae85bc1056aadb7f | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Created by DELL on 30-Jan-16.
*/
public class Main
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static void main(String ar[]) throws IOException
{
Main demo ... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 4353d7dfee5e69776aae5bd5bf6190b6 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class SortByShift {
public static void main(String[] args) throws IOException {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
String input;... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 10809cd89a9c306770dd69eb695944db | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.util.*;
import java.io.*;
public class Test {
public static void main(String[] args){
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
int a[] = new int[n];
for(int i = 0; i < n;i++){
a[i] = cin.nextInt();
}
int flag = 0;
in... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | d444b8df7d96867ed017e5e88912ba3c | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual so... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 6c719759f2885c7b0178d26a7b9d20a7 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
import java.util.Arrays;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public cla... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 05aa0aa0c6936bc10971fef725cc5115 | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public final class LittlePonyandSortbyShift {
private static BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) {
try {
i... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 8d94b36e73944db2aa59d29a10bed22c | train_003.jsonl | 1406907000 | One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning:a1, a2, ..., an → an, a1, a2, ..., an - 1. Help Twilig... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Solution {
static class Escanner {
BufferedReader in;
StringTokenizer st;
... | Java | ["2\n2 1", "3\n1 3 2", "2\n1 2"] | 1 second | ["1", "-1", "0"] | null | Java 7 | standard input | [
"implementation"
] | c647e36495fb931ac72702a12c6bfe58 | The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,200 | If it's impossible to sort the sequence output -1. Otherwise output the minimum number of operations Twilight Sparkle needs to sort it. | standard output | |
PASSED | 7a9e1381e5706c678eb3027abb8079d4 | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes |
/*
9 2
1 1 1 1 1 0 0 0 0
1 2
1 5
5 6
5 7
2 3
2 4
3 8
3 9
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
public class Question {
static boolean[... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | fe1f5151cfcaaa27957c8f14cff13b95 | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class B {
void solve() {
int n = readInt();
char[] a = readString().toCharArray();
int[][] b = new int... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | e80a88d02de344d3694c328e5ec03c27 | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes | import java.util.*;
public class CFE67B {
public static void main(String[] args) {
Scanner scanny = new Scanner(System.in);
int len = scanny.nextInt();
scanny.nextLine();
char[] s = scanny.nextLine().toCharArray();
int[][] arr = new int[26][len];
int[] at = new int[26];
for(int i = 0; i < len; i++) {
... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | 21df2da7db37ff1568248c340cc2c432 | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public final class CF
{
public static void main(String[]args)throws IOException
{
//int K=(int)Math.pow(10,9)+7;
FastReader ob=new FastReader();
StringBuffer sb=new StringBuffer();
int n=ob.nextInt();
String s=ob.nextLin... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | 3d420e440aea9e932e86e0a70e5dcf50 | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes |
import java.util.ArrayList;
import java.util.Scanner;
public class training {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = sc.next();
int m = sc.nextInt();
String t;
ArrayList<ArrayList<Integer>> ar... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | 3778d91b2e0a8bda1e7e9dcf7cb31cfc | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes | //package cf;
import java.util.*;
import java.io.*;
public class Cf{
static class Node{
int sum,occur;
Node(int sum){
this.sum=sum;
}
}
public static void main(String[]args){
Scanner in=new Scanner(System.in);
PrintWriter out=new PrintWriter(Sy... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | 3ba638c9fde61c6b206bb9c83d2f7d84 | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int l = sc.nextInt();
String word = sc.next();
int cases = sc.nextInt();
int[] num = new int[26]; //how much each letter appears
int[][] loc = new int[26][l]; //the order of where it appe... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | f2315caa0422933b8a8ed5a5ad8c3a83 | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | 84d42d55c4902347610beb3e922231f7 | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes | //package com.company;
import java.io.*;
import java.util.*;
public class Main {
private static HashMap<Character,Integer> [] line = new HashMap[2000000];
public static void main(String[] args) throws IOException {
// write your code here
BufferedReader br = new BufferedReader(new InputStreamReader(Syste... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | ca4c1c2f3300780d0af0cdc9fbe93076 | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes | import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
public class Scratch {
private static class Data {
final List<Integer> positions;
Integer currentIdx;
private Data(List<Integ... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | 22d5b60bd7cad034ff52cf2800bf20f5 | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes | import java.util.*;
public class B1187 {
static void init(List<ArrayList<Integer>> arr, char s[]) {
for(int i = 0; i<26; i++) {
arr.add(new ArrayList<Integer>());
}
for(int i = 0; i < s.length; i++) {
arr.get(s[i] - 'a').add(i+1);
}
}
public static... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | 4e717b3aba2a135881f03f394f72f53b | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Sc... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | 21099d2b84d9e3654c6aa7795c935823 | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Iterator;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamW... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | 1b646435d94398ab9897a961668da70b | train_003.jsonl | 1561905900 | The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.u... | Java | ["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"] | 2 seconds | ["5\n6\n5\n2\n9"] | null | Java 8 | standard input | [
"binary search",
"implementation",
"strings"
] | 8736df815ea0fdf390cc8d500758bf84 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ... | 1,300 | For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro... | standard output | |
PASSED | 9db158a169f24133bd973a604d5644c2 | train_003.jsonl | 1606633500 | There is a prison that can be represented as a rectangular matrix with $$$n$$$ rows and $$$m$$$ columns. Therefore, there are $$$n \cdot m$$$ prison cells. There are also $$$n \cdot m$$$ prisoners, one in each prison cell. Let's denote the cell in the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.There's a s... | 256 megabytes | import java.util.*;
public class PrisonBreak {
static long getTime(long n, long m, long r, long c) {
long c1[] = new long[] { 1, 1 };
long c2[] = new long[] { 1, m };
long c3[] = new long[] { n, 1 };
long c4[] = new long[] { n, m };
long d1 = Math.abs(r - c1[0]) + Math.abs(... | Java | ["3\n10 10 1 1\n3 5 2 4\n10 2 5 1"] | 1 second | ["18\n4\n6"] | null | Java 8 | standard input | [
"brute force",
"math"
] | 3a3fbb61c7e1ccda69cd6d186da653ae | The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$, the number of test cases. Each of the next $$$t$$$ lines contains four space-separated integers $$$n$$$, $$$m$$$, $$$r$$$, $$$c$$$ ($$$1 \le r \le n \le 10^9$$$, $$$1 \le c \le m \le 10^9$$$). | null | Print $$$t$$$ lines, the answers for each test case. | standard output | |
PASSED | 8885173056f1ff20cf5473e8985999f7 | train_003.jsonl | 1606633500 | There is a prison that can be represented as a rectangular matrix with $$$n$$$ rows and $$$m$$$ columns. Therefore, there are $$$n \cdot m$$$ prison cells. There are also $$$n \cdot m$$$ prisoners, one in each prison cell. Let's denote the cell in the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.There's a s... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class TechnoCupA {
static FastScanner in;
static PrintWriter out;
static class FastScanner{
StringTokenizer st;
BufferedReader br;
FastScanner(InputStream s){
br = new BufferedReader(new InputStreamReader(s));... | Java | ["3\n10 10 1 1\n3 5 2 4\n10 2 5 1"] | 1 second | ["18\n4\n6"] | null | Java 8 | standard input | [
"brute force",
"math"
] | 3a3fbb61c7e1ccda69cd6d186da653ae | The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$, the number of test cases. Each of the next $$$t$$$ lines contains four space-separated integers $$$n$$$, $$$m$$$, $$$r$$$, $$$c$$$ ($$$1 \le r \le n \le 10^9$$$, $$$1 \le c \le m \le 10^9$$$). | null | Print $$$t$$$ lines, the answers for each test case. | standard output | |
PASSED | 71d3199cd6208e09120d7b7aed3328c0 | train_003.jsonl | 1606633500 | There is a prison that can be represented as a rectangular matrix with $$$n$$$ rows and $$$m$$$ columns. Therefore, there are $$$n \cdot m$$$ prison cells. There are also $$$n \cdot m$$$ prisoners, one in each prison cell. Let's denote the cell in the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.There's a s... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A1 {
public static PrintWriter out;
public static void main(String[] args) {
MyScanner sc = new MyScanner();... | Java | ["3\n10 10 1 1\n3 5 2 4\n10 2 5 1"] | 1 second | ["18\n4\n6"] | null | Java 8 | standard input | [
"brute force",
"math"
] | 3a3fbb61c7e1ccda69cd6d186da653ae | The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$, the number of test cases. Each of the next $$$t$$$ lines contains four space-separated integers $$$n$$$, $$$m$$$, $$$r$$$, $$$c$$$ ($$$1 \le r \le n \le 10^9$$$, $$$1 \le c \le m \le 10^9$$$). | null | Print $$$t$$$ lines, the answers for each test case. | standard output | |
PASSED | de2b383ecde556f29e9e1d822e4ccc64 | train_003.jsonl | 1606633500 | There is a prison that can be represented as a rectangular matrix with $$$n$$$ rows and $$$m$$$ columns. Therefore, there are $$$n \cdot m$$$ prison cells. There are also $$$n \cdot m$$$ prisoners, one in each prison cell. Let's denote the cell in the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.There's a s... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Place here class purpose.
*
* @author Kirill
* @since 29.11.2020
*/
public class TaskARule {
public static void main(String[] args) throws IOException {
TaskARule task = new TaskARule();
task.res... | Java | ["3\n10 10 1 1\n3 5 2 4\n10 2 5 1"] | 1 second | ["18\n4\n6"] | null | Java 8 | standard input | [
"brute force",
"math"
] | 3a3fbb61c7e1ccda69cd6d186da653ae | The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$, the number of test cases. Each of the next $$$t$$$ lines contains four space-separated integers $$$n$$$, $$$m$$$, $$$r$$$, $$$c$$$ ($$$1 \le r \le n \le 10^9$$$, $$$1 \le c \le m \le 10^9$$$). | null | Print $$$t$$$ lines, the answers for each test case. | standard output | |
PASSED | a1b4389e0789dd8b9030370757598092 | train_003.jsonl | 1606633500 | There is a prison that can be represented as a rectangular matrix with $$$n$$$ rows and $$$m$$$ columns. Therefore, there are $$$n \cdot m$$$ prison cells. There are also $$$n \cdot m$$$ prisoners, one in each prison cell. Let's denote the cell in the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.There's a s... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static StringTokenizer st = null;
private static int nextInt() throws IOException {
return Integer.parseInt(next());
}
private stat... | Java | ["3\n10 10 1 1\n3 5 2 4\n10 2 5 1"] | 1 second | ["18\n4\n6"] | null | Java 8 | standard input | [
"brute force",
"math"
] | 3a3fbb61c7e1ccda69cd6d186da653ae | The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$, the number of test cases. Each of the next $$$t$$$ lines contains four space-separated integers $$$n$$$, $$$m$$$, $$$r$$$, $$$c$$$ ($$$1 \le r \le n \le 10^9$$$, $$$1 \le c \le m \le 10^9$$$). | null | Print $$$t$$$ lines, the answers for each test case. | standard output | |
PASSED | cfb7ff11471a802951b1efb27a0cd4ef | train_003.jsonl | 1606633500 | There is a prison that can be represented as a rectangular matrix with $$$n$$$ rows and $$$m$$$ columns. Therefore, there are $$$n \cdot m$$$ prison cells. There are also $$$n \cdot m$$$ prisoners, one in each prison cell. Let's denote the cell in the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.There's a s... | 256 megabytes | import java.util.Scanner;
public class PrisionBreak {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
int m = sc.nextInt();
int r = sc.nextI... | Java | ["3\n10 10 1 1\n3 5 2 4\n10 2 5 1"] | 1 second | ["18\n4\n6"] | null | Java 8 | standard input | [
"brute force",
"math"
] | 3a3fbb61c7e1ccda69cd6d186da653ae | The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$, the number of test cases. Each of the next $$$t$$$ lines contains four space-separated integers $$$n$$$, $$$m$$$, $$$r$$$, $$$c$$$ ($$$1 \le r \le n \le 10^9$$$, $$$1 \le c \le m \le 10^9$$$). | null | Print $$$t$$$ lines, the answers for each test case. | standard output | |
PASSED | 6e64bb05a9080474e6d7c807bcbc4820 | train_003.jsonl | 1606633500 | There is a prison that can be represented as a rectangular matrix with $$$n$$$ rows and $$$m$$$ columns. Therefore, there are $$$n \cdot m$$$ prison cells. There are also $$$n \cdot m$$$ prisoners, one in each prison cell. Let's denote the cell in the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.There's a s... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class R687A {
public static void main(String[] args) {
// TODO Auto-generated method stub
int t = scn.nextInt();
... | Java | ["3\n10 10 1 1\n3 5 2 4\n10 2 5 1"] | 1 second | ["18\n4\n6"] | null | Java 8 | standard input | [
"brute force",
"math"
] | 3a3fbb61c7e1ccda69cd6d186da653ae | The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$, the number of test cases. Each of the next $$$t$$$ lines contains four space-separated integers $$$n$$$, $$$m$$$, $$$r$$$, $$$c$$$ ($$$1 \le r \le n \le 10^9$$$, $$$1 \le c \le m \le 10^9$$$). | null | Print $$$t$$$ lines, the answers for each test case. | standard output | |
PASSED | 1785a31bec101d4229b3e41a7112f47e | train_003.jsonl | 1606633500 | There is a prison that can be represented as a rectangular matrix with $$$n$$$ rows and $$$m$$$ columns. Therefore, there are $$$n \cdot m$$$ prison cells. There are also $$$n \cdot m$$$ prisoners, one in each prison cell. Let's denote the cell in the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.There's a s... | 256 megabytes | import java.util.*;
import java.lang.Math;
public class A{
public static void main(String asfasaa[]){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
int m=sc.nextInt();
int r=sc.nextInt();
int c=sc.next... | Java | ["3\n10 10 1 1\n3 5 2 4\n10 2 5 1"] | 1 second | ["18\n4\n6"] | null | Java 8 | standard input | [
"brute force",
"math"
] | 3a3fbb61c7e1ccda69cd6d186da653ae | The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$, the number of test cases. Each of the next $$$t$$$ lines contains four space-separated integers $$$n$$$, $$$m$$$, $$$r$$$, $$$c$$$ ($$$1 \le r \le n \le 10^9$$$, $$$1 \le c \le m \le 10^9$$$). | null | Print $$$t$$$ lines, the answers for each test case. | standard output | |
PASSED | c7b1773e17a24b653be084abb3271c9d | train_003.jsonl | 1606633500 | There is a prison that can be represented as a rectangular matrix with $$$n$$$ rows and $$$m$$$ columns. Therefore, there are $$$n \cdot m$$$ prison cells. There are also $$$n \cdot m$$$ prisoners, one in each prison cell. Let's denote the cell in the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.There's a s... | 256 megabytes | import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = Integer.parseInt(in.nextLine());
int[] result = new int[t];
for (int i = 0; i < t; i++) {
... | Java | ["3\n10 10 1 1\n3 5 2 4\n10 2 5 1"] | 1 second | ["18\n4\n6"] | null | Java 8 | standard input | [
"brute force",
"math"
] | 3a3fbb61c7e1ccda69cd6d186da653ae | The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$, the number of test cases. Each of the next $$$t$$$ lines contains four space-separated integers $$$n$$$, $$$m$$$, $$$r$$$, $$$c$$$ ($$$1 \le r \le n \le 10^9$$$, $$$1 \le c \le m \le 10^9$$$). | null | Print $$$t$$$ lines, the answers for each test case. | standard output | |
PASSED | a728abff91401d6a85d4d2fa33f291a0 | train_003.jsonl | 1606633500 | There is a prison that can be represented as a rectangular matrix with $$$n$$$ rows and $$$m$$$ columns. Therefore, there are $$$n \cdot m$$$ prison cells. There are also $$$n \cdot m$$$ prisoners, one in each prison cell. Let's denote the cell in the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.There's a s... | 256 megabytes | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class TaskA {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int cnt = scanner.nextInt();
List<Integer> list = new ArrayList<>();
for (int i = 0; i < cnt; i++) {
... | Java | ["3\n10 10 1 1\n3 5 2 4\n10 2 5 1"] | 1 second | ["18\n4\n6"] | null | Java 8 | standard input | [
"brute force",
"math"
] | 3a3fbb61c7e1ccda69cd6d186da653ae | The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$, the number of test cases. Each of the next $$$t$$$ lines contains four space-separated integers $$$n$$$, $$$m$$$, $$$r$$$, $$$c$$$ ($$$1 \le r \le n \le 10^9$$$, $$$1 \le c \le m \le 10^9$$$). | null | Print $$$t$$$ lines, the answers for each test case. | standard output | |
PASSED | 8bc3c3dcc1caf31247c7fcac591a6384 | train_003.jsonl | 1606633500 | There is a prison that can be represented as a rectangular matrix with $$$n$$$ rows and $$$m$$$ columns. Therefore, there are $$$n \cdot m$$$ prison cells. There are also $$$n \cdot m$$$ prisoners, one in each prison cell. Let's denote the cell in the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.There's a s... | 256 megabytes | import java.awt.event.MouseAdapter;
import java.io.*;
import java.lang.reflect.Array;
import java.util.StringTokenizer;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
int t = nextInt();
for (int i = 0; i < t; i++) {
in... | Java | ["3\n10 10 1 1\n3 5 2 4\n10 2 5 1"] | 1 second | ["18\n4\n6"] | null | Java 8 | standard input | [
"brute force",
"math"
] | 3a3fbb61c7e1ccda69cd6d186da653ae | The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$, the number of test cases. Each of the next $$$t$$$ lines contains four space-separated integers $$$n$$$, $$$m$$$, $$$r$$$, $$$c$$$ ($$$1 \le r \le n \le 10^9$$$, $$$1 \le c \le m \le 10^9$$$). | null | Print $$$t$$$ lines, the answers for each test case. | standard output | |
PASSED | 35da4f6065300b40591b40cd72d39cb6 | train_003.jsonl | 1606633500 | There is a prison that can be represented as a rectangular matrix with $$$n$$$ rows and $$$m$$$ columns. Therefore, there are $$$n \cdot m$$$ prison cells. There are also $$$n \cdot m$$$ prisoners, one in each prison cell. Let's denote the cell in the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.There's a s... | 256 megabytes | //SHIVAM GARG
import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef
{
public static HashMap<Integer, Integer> tracker;
public static void main (String[] args) throws java.lang.Exception {
FastReader reader = new FastReader();
int tests = reader.nextInt();
for(int test... | Java | ["3\n10 10 1 1\n3 5 2 4\n10 2 5 1"] | 1 second | ["18\n4\n6"] | null | Java 8 | standard input | [
"brute force",
"math"
] | 3a3fbb61c7e1ccda69cd6d186da653ae | The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$, the number of test cases. Each of the next $$$t$$$ lines contains four space-separated integers $$$n$$$, $$$m$$$, $$$r$$$, $$$c$$$ ($$$1 \le r \le n \le 10^9$$$, $$$1 \le c \le m \le 10^9$$$). | null | Print $$$t$$$ lines, the answers for each test case. | standard output | |
PASSED | 4b8b1bddcb4f9ff6391a17da8464baad | train_003.jsonl | 1592921100 | Lee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called "Critic"...The game is a one versus one game. It has $$$t$$$ rounds, each round has two integers $$$s_i$$$ and $$$e_i$$$ (whi... | 256 megabytes | // upsolve with kaiboy, coached by rainboy
import java.io.*;
import java.util.*;
public class CF1369F extends PrintWriter {
CF1369F() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1369F o = new CF1369F(); o.main(); o.flush();
}
int test(long a, long b... | Java | ["3\n5 8\n1 4\n3 10", "4\n1 2\n2 3\n3 4\n4 5", "1\n1 1", "2\n1 9\n4 5", "2\n1 2\n2 8", "6\n216986951114298167 235031205335543871\n148302405431848579 455670351549314242\n506251128322958430 575521452907339082\n1 768614336404564650\n189336074809158272 622104412002885672\n588320087414024192 662540324268197150"] | 2 seconds | ["1 1", "0 0", "0 1", "0 0", "1 0", "1 0"] | NoteRemember, whoever writes an integer greater than $$$e_i$$$ loses. | Java 11 | standard input | [
"dp",
"dfs and similar",
"games"
] | a0376bf145f4d9b5fbc1683956c203df | The first line contains the integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of rounds the game has. Then $$$t$$$ lines follow, each contains two integers $$$s_i$$$ and $$$e_i$$$ ($$$1 \le s_i \le e_i \le 10^{18}$$$) — the $$$i$$$-th round's information. The rounds are played in the same order as given in input, ... | 2,700 | Print two integers. The first one should be 1 if Lee can be the winner independent of Ice Bear's moves, and 0 otherwise. The second one should be 1 if Lee can be the loser independent of Ice Bear's moves, and 0 otherwise. | standard output | |
PASSED | b21e9472fd8177dcf4ac50cdebce1129 | train_003.jsonl | 1592921100 | Lee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called "Critic"...The game is a one versus one game. It has $$$t$$$ rounds, each round has two integers $$$s_i$$$ and $$$e_i$$$ (whi... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class F {
static final boolean RUN_TIMING = false;
static char[] inputBuffer = new char[1 << 20];
static PushbackReader in = new PushbackReader(new BufferedReader(new InputStreamReader(System.in)), 1 << 20);
static PrintWriter out = new P... | Java | ["3\n5 8\n1 4\n3 10", "4\n1 2\n2 3\n3 4\n4 5", "1\n1 1", "2\n1 9\n4 5", "2\n1 2\n2 8", "6\n216986951114298167 235031205335543871\n148302405431848579 455670351549314242\n506251128322958430 575521452907339082\n1 768614336404564650\n189336074809158272 622104412002885672\n588320087414024192 662540324268197150"] | 2 seconds | ["1 1", "0 0", "0 1", "0 0", "1 0", "1 0"] | NoteRemember, whoever writes an integer greater than $$$e_i$$$ loses. | Java 11 | standard input | [
"dp",
"dfs and similar",
"games"
] | a0376bf145f4d9b5fbc1683956c203df | The first line contains the integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of rounds the game has. Then $$$t$$$ lines follow, each contains two integers $$$s_i$$$ and $$$e_i$$$ ($$$1 \le s_i \le e_i \le 10^{18}$$$) — the $$$i$$$-th round's information. The rounds are played in the same order as given in input, ... | 2,700 | Print two integers. The first one should be 1 if Lee can be the winner independent of Ice Bear's moves, and 0 otherwise. The second one should be 1 if Lee can be the loser independent of Ice Bear's moves, and 0 otherwise. | standard output | |
PASSED | 9dea083b45a36f4b9dfbbb1dbdbe9e5b | train_003.jsonl | 1592921100 | Lee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called "Critic"...The game is a one versus one game. It has $$$t$$$ rounds, each round has two integers $$$s_i$$$ and $$$e_i$$$ (whi... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class F {
public static void main(String[] args) {
FastScanner fs=new FastScanner();
int rounds=fs.nextInt();
long[] sm... | Java | ["3\n5 8\n1 4\n3 10", "4\n1 2\n2 3\n3 4\n4 5", "1\n1 1", "2\n1 9\n4 5", "2\n1 2\n2 8", "6\n216986951114298167 235031205335543871\n148302405431848579 455670351549314242\n506251128322958430 575521452907339082\n1 768614336404564650\n189336074809158272 622104412002885672\n588320087414024192 662540324268197150"] | 2 seconds | ["1 1", "0 0", "0 1", "0 0", "1 0", "1 0"] | NoteRemember, whoever writes an integer greater than $$$e_i$$$ loses. | Java 11 | standard input | [
"dp",
"dfs and similar",
"games"
] | a0376bf145f4d9b5fbc1683956c203df | The first line contains the integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of rounds the game has. Then $$$t$$$ lines follow, each contains two integers $$$s_i$$$ and $$$e_i$$$ ($$$1 \le s_i \le e_i \le 10^{18}$$$) — the $$$i$$$-th round's information. The rounds are played in the same order as given in input, ... | 2,700 | Print two integers. The first one should be 1 if Lee can be the winner independent of Ice Bear's moves, and 0 otherwise. The second one should be 1 if Lee can be the loser independent of Ice Bear's moves, and 0 otherwise. | standard output | |
PASSED | 6bbd86e4fe30ce347abc199c9eb7fbd2 | train_003.jsonl | 1592921100 | Lee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called "Critic"...The game is a one versus one game. It has $$$t$$$ rounds, each round has two integers $$$s_i$$$ and $$$e_i$$$ (whi... | 256 megabytes | //package round652;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class F {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
// e s
// for(int ... | Java | ["3\n5 8\n1 4\n3 10", "4\n1 2\n2 3\n3 4\n4 5", "1\n1 1", "2\n1 9\n4 5", "2\n1 2\n2 8", "6\n216986951114298167 235031205335543871\n148302405431848579 455670351549314242\n506251128322958430 575521452907339082\n1 768614336404564650\n189336074809158272 622104412002885672\n588320087414024192 662540324268197150"] | 2 seconds | ["1 1", "0 0", "0 1", "0 0", "1 0", "1 0"] | NoteRemember, whoever writes an integer greater than $$$e_i$$$ loses. | Java 11 | standard input | [
"dp",
"dfs and similar",
"games"
] | a0376bf145f4d9b5fbc1683956c203df | The first line contains the integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of rounds the game has. Then $$$t$$$ lines follow, each contains two integers $$$s_i$$$ and $$$e_i$$$ ($$$1 \le s_i \le e_i \le 10^{18}$$$) — the $$$i$$$-th round's information. The rounds are played in the same order as given in input, ... | 2,700 | Print two integers. The first one should be 1 if Lee can be the winner independent of Ice Bear's moves, and 0 otherwise. The second one should be 1 if Lee can be the loser independent of Ice Bear's moves, and 0 otherwise. | standard output | |
PASSED | 82c38993241e4959f5c8c60521418dfc | train_003.jsonl | 1592921100 | Lee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called "Critic"...The game is a one versus one game. It has $$$t$$$ rounds, each round has two integers $$$s_i$$$ and $$$e_i$$$ (whi... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Queue;
public class Main {
public static void main(final String[] args) throws Exception {
final FastScanner scanner = new FastScanner();
final Solution solver = new Solution();
/... | Java | ["3\n5 8\n1 4\n3 10", "4\n1 2\n2 3\n3 4\n4 5", "1\n1 1", "2\n1 9\n4 5", "2\n1 2\n2 8", "6\n216986951114298167 235031205335543871\n148302405431848579 455670351549314242\n506251128322958430 575521452907339082\n1 768614336404564650\n189336074809158272 622104412002885672\n588320087414024192 662540324268197150"] | 2 seconds | ["1 1", "0 0", "0 1", "0 0", "1 0", "1 0"] | NoteRemember, whoever writes an integer greater than $$$e_i$$$ loses. | Java 11 | standard input | [
"dp",
"dfs and similar",
"games"
] | a0376bf145f4d9b5fbc1683956c203df | The first line contains the integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of rounds the game has. Then $$$t$$$ lines follow, each contains two integers $$$s_i$$$ and $$$e_i$$$ ($$$1 \le s_i \le e_i \le 10^{18}$$$) — the $$$i$$$-th round's information. The rounds are played in the same order as given in input, ... | 2,700 | Print two integers. The first one should be 1 if Lee can be the winner independent of Ice Bear's moves, and 0 otherwise. The second one should be 1 if Lee can be the loser independent of Ice Bear's moves, and 0 otherwise. | standard output | |
PASSED | 8f1719f5bf735aa19a2f7c2d3cea5c5f | train_003.jsonl | 1592921100 | Lee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called "Critic"...The game is a one versus one game. It has $$$t$$$ rounds, each round has two integers $$$s_i$$$ and $$$e_i$$$ (whi... | 256 megabytes | import java.io.*;
import java.util.*;
public class SolutionF {
static Random random;
static boolean benchmark = false;
static long timeStamp;
public static void main(String[] args) {
FastScanner in = new FastScanner();
PrintWriter out = new PrintWriter(new BufferedOutputStream(Syste... | Java | ["3\n5 8\n1 4\n3 10", "4\n1 2\n2 3\n3 4\n4 5", "1\n1 1", "2\n1 9\n4 5", "2\n1 2\n2 8", "6\n216986951114298167 235031205335543871\n148302405431848579 455670351549314242\n506251128322958430 575521452907339082\n1 768614336404564650\n189336074809158272 622104412002885672\n588320087414024192 662540324268197150"] | 2 seconds | ["1 1", "0 0", "0 1", "0 0", "1 0", "1 0"] | NoteRemember, whoever writes an integer greater than $$$e_i$$$ loses. | Java 11 | standard input | [
"dp",
"dfs and similar",
"games"
] | a0376bf145f4d9b5fbc1683956c203df | The first line contains the integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of rounds the game has. Then $$$t$$$ lines follow, each contains two integers $$$s_i$$$ and $$$e_i$$$ ($$$1 \le s_i \le e_i \le 10^{18}$$$) — the $$$i$$$-th round's information. The rounds are played in the same order as given in input, ... | 2,700 | Print two integers. The first one should be 1 if Lee can be the winner independent of Ice Bear's moves, and 0 otherwise. The second one should be 1 if Lee can be the loser independent of Ice Bear's moves, and 0 otherwise. | standard output | |
PASSED | 9f8115300649bc74e8a2c16ee083047e | train_003.jsonl | 1592921100 | Lee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called "Critic"...The game is a one versus one game. It has $$$t$$$ rounds, each round has two integers $$$s_i$$$ and $$$e_i$$$ (whi... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.uti... | Java | ["3\n5 8\n1 4\n3 10", "4\n1 2\n2 3\n3 4\n4 5", "1\n1 1", "2\n1 9\n4 5", "2\n1 2\n2 8", "6\n216986951114298167 235031205335543871\n148302405431848579 455670351549314242\n506251128322958430 575521452907339082\n1 768614336404564650\n189336074809158272 622104412002885672\n588320087414024192 662540324268197150"] | 2 seconds | ["1 1", "0 0", "0 1", "0 0", "1 0", "1 0"] | NoteRemember, whoever writes an integer greater than $$$e_i$$$ loses. | Java 11 | standard input | [
"dp",
"dfs and similar",
"games"
] | a0376bf145f4d9b5fbc1683956c203df | The first line contains the integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of rounds the game has. Then $$$t$$$ lines follow, each contains two integers $$$s_i$$$ and $$$e_i$$$ ($$$1 \le s_i \le e_i \le 10^{18}$$$) — the $$$i$$$-th round's information. The rounds are played in the same order as given in input, ... | 2,700 | Print two integers. The first one should be 1 if Lee can be the winner independent of Ice Bear's moves, and 0 otherwise. The second one should be 1 if Lee can be the loser independent of Ice Bear's moves, and 0 otherwise. | standard output | |
PASSED | 8d872d716da6ea7644c8130cd2148a3b | train_003.jsonl | 1592921100 | Lee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called "Critic"...The game is a one versus one game. It has $$$t$$$ rounds, each round has two integers $$$s_i$$$ and $$$e_i$$$ (whi... | 256 megabytes | import java.io.*;
import java.text.*;
import java.util.*;
import java.math.*;
public class template {
public static void main(String[] args) throws Exception {
new template().run();
}
public void run() throws Exception {
FastScanner f = new FastScanner();
PrintWriter out = new... | Java | ["3\n5 8\n1 4\n3 10", "4\n1 2\n2 3\n3 4\n4 5", "1\n1 1", "2\n1 9\n4 5", "2\n1 2\n2 8", "6\n216986951114298167 235031205335543871\n148302405431848579 455670351549314242\n506251128322958430 575521452907339082\n1 768614336404564650\n189336074809158272 622104412002885672\n588320087414024192 662540324268197150"] | 2 seconds | ["1 1", "0 0", "0 1", "0 0", "1 0", "1 0"] | NoteRemember, whoever writes an integer greater than $$$e_i$$$ loses. | Java 11 | standard input | [
"dp",
"dfs and similar",
"games"
] | a0376bf145f4d9b5fbc1683956c203df | The first line contains the integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of rounds the game has. Then $$$t$$$ lines follow, each contains two integers $$$s_i$$$ and $$$e_i$$$ ($$$1 \le s_i \le e_i \le 10^{18}$$$) — the $$$i$$$-th round's information. The rounds are played in the same order as given in input, ... | 2,700 | Print two integers. The first one should be 1 if Lee can be the winner independent of Ice Bear's moves, and 0 otherwise. The second one should be 1 if Lee can be the loser independent of Ice Bear's moves, and 0 otherwise. | standard output | |
PASSED | d0d7128970406e27f75c659ea2ed63b1 | train_003.jsonl | 1367769900 | Yaroslav likes algorithms. We'll describe one of his favorite algorithms. The algorithm receives a string as the input. We denote this input string as a. The algorithm consists of some number of command. Сommand number i looks either as si >> wi, or as si <> wi, where si and wi are some possibly empty str... | 256 megabytes | /**
* Created with IntelliJ IDEA.
* User: svasilinets
* Date: 05.05.13
* Time: 22:07
*/
public class E {
public static void main(String[] args) {
System.out.println("9??>>??0");
System.out.println("8??<>9");
System.out.println("7??<>8");
System.out.println("6??<>7");
S... | Java | ["2\n10\n79"] | 2 seconds | ["10<>11\n79<>80"] | null | Java 6 | standard input | [] | 90929863d289a475b766d5f2b0cd7c61 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the set. The next n lines contains one positive integer each. All the given numbers are less than 1025. | 2,500 | Print the algorithm which can individually increase each number of the set. In the i-th line print the command number i without spaces. Your algorithm will be launched for each of these numbers. The answer will be considered correct if: Each line will a correct algorithm command (see the description in the problem... | standard output | |
PASSED | 7814bc8663eba9e577997e07ddc846a3 | train_003.jsonl | 1367769900 | Yaroslav likes algorithms. We'll describe one of his favorite algorithms. The algorithm receives a string as the input. We denote this input string as a. The algorithm consists of some number of command. Сommand number i looks either as si >> wi, or as si <> wi, where si and wi are some possibly empty str... | 256 megabytes | import java.util.*; //Scanner;
import java.io.PrintWriter; //PrintWriter
public class R182_Div2_E //Name: Yaroslav and Algorithm
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
solve(in, out);
out.close();
in.close();
}
... | Java | ["2\n10\n79"] | 2 seconds | ["10<>11\n79<>80"] | null | Java 7 | standard input | [] | 90929863d289a475b766d5f2b0cd7c61 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the set. The next n lines contains one positive integer each. All the given numbers are less than 1025. | 2,500 | Print the algorithm which can individually increase each number of the set. In the i-th line print the command number i without spaces. Your algorithm will be launched for each of these numbers. The answer will be considered correct if: Each line will a correct algorithm command (see the description in the problem... | standard output | |
PASSED | 21e2fa514a14467c86f6d4cbccf0fd21 | train_003.jsonl | 1367769900 | Yaroslav likes algorithms. We'll describe one of his favorite algorithms. The algorithm receives a string as the input. We denote this input string as a. The algorithm consists of some number of command. Сommand number i looks either as si >> wi, or as si <> wi, where si and wi are some possibly empty str... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author vadimmm
*/
public class Mai... | Java | ["2\n10\n79"] | 2 seconds | ["10<>11\n79<>80"] | null | Java 7 | standard input | [] | 90929863d289a475b766d5f2b0cd7c61 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the set. The next n lines contains one positive integer each. All the given numbers are less than 1025. | 2,500 | Print the algorithm which can individually increase each number of the set. In the i-th line print the command number i without spaces. Your algorithm will be launched for each of these numbers. The answer will be considered correct if: Each line will a correct algorithm command (see the description in the problem... | standard output | |
PASSED | b60900dce81873661aed31b4aed01a2d | train_003.jsonl | 1367769900 | Yaroslav likes algorithms. We'll describe one of his favorite algorithms. The algorithm receives a string as the input. We denote this input string as a. The algorithm consists of some number of command. Сommand number i looks either as si >> wi, or as si <> wi, where si and wi are some possibly empty str... | 256 megabytes | 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.StringTokenizer;
public class E {
private static StringTokenizer tokenizer;
private static BufferedReader bf... | Java | ["2\n10\n79"] | 2 seconds | ["10<>11\n79<>80"] | null | Java 7 | standard input | [] | 90929863d289a475b766d5f2b0cd7c61 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the set. The next n lines contains one positive integer each. All the given numbers are less than 1025. | 2,500 | Print the algorithm which can individually increase each number of the set. In the i-th line print the command number i without spaces. Your algorithm will be launched for each of these numbers. The answer will be considered correct if: Each line will a correct algorithm command (see the description in the problem... | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.