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 | 5fb76e449544602e21cf9fd123e249e5 | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.io.UncheckedIOException;
import java.util.List;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | e11862e3ddf32f6b00844ad9f3082710 | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.util.*;
import java.io.*;
import java.text.*;
public class D1305 {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int n = sc.nextInt();
int[] lvl = new int[n];
ArrayList<Integer>[] adjList = new Arra... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 476abb64ea2996f3e08f7e20c8e860aa | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class D {
private void work() {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in), 1 << 16));
n = Integer.parseInt(sc.nextLine().trim());
adj = new int[n][n];
deg... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 8c10112ddf8cd377f6cc023b671c17f2 | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.io.*;
import java.util.Arrays;
import java.util.StringJoiner;
import java.util.StringTokenizer;
public class MainD {
static int N;
static Edge[] E;
public static void main(String[] args) {
FastScanner sc = new FastScanner(System.in);
N = sc.nextInt();
E = new Edge[N-1]... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 262bc976ea3274f261b7f162279570c2 | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.*;
public class A2 {
public s... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | b483e6415c671330e217b374e6a02ded | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.*;
public class A3 {
public s... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 38ba1b10879499d7cff4d1d5db99340e | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main implements Runnable{
Scanner sc;
final class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
try {
br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | a100bf4c9f3405daec0e8c24bf3daeef | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main implements Runnable{
Scanner sc;
final class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
try {
br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | ad9035946b8ad6c98c6c753185771d8a | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main implements Runnable {
boolean judge = false;
FastReader scn;
PrintWriter out;
String INPUT = "";
void solve() {
int n = scn.nextInt();
HashMap<Integer, HashSet<Integer>> gr = new HashMap<Integer, HashSet<Integer>>();
for(int i = 0; i < n - 1; i++) {
... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | ae7191f6c7663650c257e9084a4b8ae2 | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | // package OzonTechChallenge;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
public class ProblemD {
public static void main(String[] args)throws IOException {
BufferedReader br=new BufferedReader(new Input... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | c01ee77810fbf553455fb9326fc9b506 | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.ArrayList;
public class kuroni_celebration {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
k... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 1c4afc8fa1fb8aba2dde10e6f565df54 | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes |
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
import java.util.Stack;
public class ROUGH{
public static class FastReader {
BufferedReader br;
StringTokenizer root;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 3a8a30eb77e0e1820de1faf8d413764f | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import javafx.beans.property.IntegerProperty;
import java.util.*;
import java.io.*;
public class D {
public static void main(String[] args) throws IOException{
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.o... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | b68e35d8ab3b3a35be7c38041760730f | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.io.*;
import java.util.*;
public class D {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
ArrayList<Integer>[] g = new ArrayList[n];
for(int i = 0; i < n; i++) {
g[i] = new ArrayList<>();
}
for(int i = 0; i < n-1; i++) {
int u = sc.nex... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | d160197a9f4e0daec0fafa715af87ad4 | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int inf = (int) (1e9 + 7);
static int n;
static TreeSet<Integer> gr[];
static boolean good[];
static int cnt_good;
static void find(int v, int fin) {
if (v == fin || !good[v]) return;
good[v] = false;
cn... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 52750c1eb640891fbfd11e1f330d30d1 | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.io.*;
import java.util.*;
public class JavAki {
public static Scanner sc = new Scanner(System.in);
public static int n;
public static ArrayList<HashSet<Integer>> adj;
public static HashSet<Integer> leafList;
public static int ask(int u, int v) {
System.out.println("? " + (u+1) + " " + (v+1)); Syst... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 1c5798ce565386203b70a57b6b5012b5 | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | // package OzonTechChallenge;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
public class ProblemD {
public static void main(String[] args)throws IOException {
BufferedReader br=new BufferedReader(new Input... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 7bea763bb9c2cc6e68e57f2a27f4ef58 | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.*;
public class Main {
static int n;
static ArrayList<Arra... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 47368d47f1e9f8552bed1bc93fd042fa | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | //make sure to make new file!
import java.io.*;
import java.util.*;
//semi-t
public class DOzonb{
public static int n;
public static boolean[][] edges;
public static void main(String[] args)throws IOException{
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWri... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 46ca309873838fdb661d04c430f1cfcd | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Ozon2020D {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//PrintWriter writer = new PrintWriter(S... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 61a3dfd2d8bad7150fa66e005e63f779 | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | //package codeforces.ozontech2020;
import java.io.*;
import java.util.*;
public class KuroniAndCelebration {
public static void main(String[] args) {
// try {
// FastScanner in = new FastScanner(new FileInputStream("src/input.in"));
// PrintWriter out = new PrintWriter(new FileOutputS... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | 4ad6655f65f0b48a29237ed800d12beb | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.util.*;
import java.io.*;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static long mod = 1000000007;
static long inf = (long) 1e15;
static ArrayList<Integer>[] ad;
static int n, p, k;
static boolean[] in;
public static void main(String[] args) throws Exception {
Scanner sc... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | d7db404ed789618409337616eba77d0b | train_000.jsonl | 1583246100 | This is an interactive problem.After getting AC after 13 Time Limit Exceeded verdicts on a geometry problem, Kuroni went to an Italian restaurant to celebrate this holy achievement. Unfortunately, the excess sauce disoriented him, and he's now lost!The United States of America can be modeled as a tree (why though) with... | 256 megabytes | import java.util.*;
import java.io.*;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static long mod = 1000000007;
static long inf = (long) 1e15;
static ArrayList<Integer>[] ad;
static int n, p, k;
static boolean[] in;
public static void main(String[] args) throws Exception {
Scanner sc... | Java | ["6\n1 4\n4 2\n5 3\n6 3\n2 3\n\n3\n\n4\n\n4"] | 1 second | ["? 5 6\n\n? 3 1\n\n? 1 2\n\n! 4"] | NoteNote that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.The image below demonstrates the tree in the sample test: | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"trees",
"interactive"
] | a291ee66980d8b5856b24d1541e66fd0 | null | 1,900 | null | standard output | |
PASSED | fecbe88e31421431cd30ef91d0f99be7 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes |
import java.io.*;
import java.util.Arrays;
import java.util.Collections;
public class Boredom {
static long[] dp;
static int size = 100001;
public static void main(String[] args)throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
/* int t = Intege... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | dca06d3f0ecd3f764284bdabec5d0604 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.lang.reflect.Array;
import java.security.KeyPair;
import java.util.*;
import java.lang.*;
import java.io.*;
public final class ProblemA
{
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferP... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | b8defef9f2980cc0f39dfce17589f39c | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Scanner;
public class Solution {
static Scanner sc = new Scanner(System.in);
static PrintWriter pw = new PrintWriter(System.out);
public static void solve(int c, int n){
long[] count = new long[100001];
... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 790d88b02cb89419483b7fef65c7f536 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
static int mod=1000000007;
public static void main(String[] args) throws IOException {
Writer out=new Writer(System.out);
Reader in=new Reader(System.in);
int t=1;
while(t-->0) {
int n=in.nextInt();
int a[]=in.readArray(n);
long cnt... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 5f3274cb08c4ab360fe2581611181648 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main
{
public static void main(String []args) throws IOException {
FastScanner in = new FastScanner(System.in);
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
solve(in, out);
in.close();
o... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 4e0fd1e94768b5512c0ba37b76a66870 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes |
import java.util.*;
import java.io.*;
public class vc_hahaha {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str=br.readLine();
StringTokenizer st=new StringTokenizer(str);
int n=Integer.parseInt(st.nextToken())... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 00625345ca0ceaa84874f37931857dc5 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | /*
ID: davidzh8
PROG: subset
LANG: JAVA
*/
import java.io.*;
import java.util.*;
import java.lang.*;
public class boredom {
//Start Stub
static long startTime = System.nanoTime();
//Globals Go Here
//Globals End
public static void main(String[] args) throws IOException {
FastScanner sc =... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | ef205fd70b4671fba53a98d8903fc812 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class P_455A {
static final FS sc = new FS();
static final PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) {
int n = sc.nextInt();
in... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 16bb9dc7ffb1ef76f8bd911ae0f050e2 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Boredom {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int n = Integer... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 07f9a9d520d2300f1c6114b0d65820c1 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
public static void process(int test_number)throws IOException
{
int n = ni(), cnt[] = new int[1000*100 + 1];
long dp[] = new long[1000 * 100 +1];
for(int i = 1; i <= n; i++){
int num = ni();
... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | edf71f2b64d771f6ae728eb0271da9e5 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes |
import java.util.Scanner;
public class Boredom {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long arr[] = new long[100001];
for(int i = 0;i<n;i++)
{
arr[(int)sc.nextLong()]++;
}
long ans = 0;
long max2 = 0;
long max1 = 0;
for(int... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 70766a8c8d3baf7a2fc7b433eee8f382 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new Str... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | f416cbe231dcd7821f71be5bd2c903f3 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution{
public static long[] vals;
public static void main(final String[] args) throws IOException {
final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String input = br.readLine();
StringTokenizer st = new ... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | b2cde10f805ea65784ebe03ece4416eb | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.util.*;
import java.util.Scanner;
import java.io.*;
import javax.lang.model.util.ElementScanner6;
import static java.lang.System.out;
public class A455
{
public static void main(String args[])
{
FastReader in=new FastReader();
PrintWriter pr = new PrintWriter(new Buff... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 1f048d8c711b89dd174cd08e8c105eb9 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java .util.*;
public class Soln
{
static long count[];
static long dp[];
static int max=100007;
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
int n=s.nextInt();
count=new long[max];
dp=new long[max];
for(int i=0;i... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | e280c3cc56ff6077bc11cd0a7dae494c | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes |
import java.util.*;
import java.io.*;
public class Boredom {
// https://codeforces.com/problemset/problem/455/A
public static void main(String[] args) throws IOException, FileNotFoundException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader in = new BufferedReader(... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 20943b08edfe799aebf06f932f2cae50 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.util.*;
public class Boredom {
private static int temp;
private static int range = 0;
private static long[] dp = new long[100001];
private static long[] cnt = new long[100001];
private static int n;
public static void main(String[] args) {
final Scanner scanner = new Scanne... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 62abb35318a052ff91570f0e7e68c199 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | /*package whatever //do not write package name here */
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
public static long calc(long[] arr,long[] dp,int n){
dp[0]=0;
dp[1]=arr[1];
for(int i=2;i<100001;i++){
dp[i]=Math.max(dp[i-1],dp[i-2]+arr[i]*i);
... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 62e4362500c12c7039be5268e0911ae2 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.util.*;
import java.io.*;
public class Boredom {
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int N = sc.nextInt();
int max = 0;
long[] A = new long[100001];
for (int i = 0; i < N; i++) {
int x = sc.nextInt();
A... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 9bcf3d37ba11396c50cf3ae55a7da242 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;
import java.util.concurrent.*;
import java.text.*;
public class Solution {
public static final Scanner scanner = new Scanner(System.in);
public static Long getMaxPoints(int[] arr, int n) {
Long[] freq = new Long[1... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 04a5a2575547ce30cb2e9d7559af2871 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static long freq[];
static long memo[];
private static long f(int i){
if(i==0) return 0;
if(i==1) return freq[1];
if(memo[i]!=-1) return memo[i];
memo[i] = Math.max(f(i-1), f(i-2) + freq[i] * i);
return memo... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 7eac2c3d196d97368c4adc38febd9f4c | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static final int M = 1000000007;
static FastReader in = new FastReader();
static PrintWriter out = new PrintWriter(System.out);
// static Scanner in = new Scanner(System.in);
// File file = new File("input.txt");
// Scanner in = new Scanner(... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | 9a467ba7cc3e1076048785fedf48e119 | train_000.jsonl | 1407511800 | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d... | 256 megabytes | //Coded By Visnunathan
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.lang.*;
public class codeforces {
// static int[] arr;
// static int n,k;
public static void main(String[] args) {
FastScanner sc=new FastScanner();
// int T=sc.nextInt();
... | Java | ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"] | 1 second | ["2", "4", "10"] | NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points. | Java 11 | standard input | [
"dp"
] | 41b3e726b8146dc733244ee8415383c0 | The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105). | 1,500 | Print a single integer — the maximum number of points that Alex can earn. | standard output | |
PASSED | bdb9ad3f62902e27ac07d8730e93e075 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
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[] args) {
InputStrea... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 663c50395c000bebb14634c364330c0c | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
StringBuilder sb=new StringBuilder();
int n=sc.nextInt();
int k=sc.nextInt();
int a[]=new int[n];
... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | cebb815eb653ec7e6798aac1269ae0e1 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution1 {
private void solve() throws IOException {
int n = in.nextInt();
int k = in.nextInt();
Tovar[] t = new Tovar[n];
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = in.nextInt();
}
... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | c54a5cfb46a7fbed9f6ee9e6ab0d40b1 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | //package yahia;
import java.util.*;
import java.io.*;
public class yahia {
public static void main (String [] Yahia_Mostafa) {
Scanner sc =new Scanner(System.in);
int n=sc.nextInt(),k=sc.nextInt(),t=n-k;
int [ ] x=new int [n];
int [] y=new int[n];
Integer r [] =new Integer [n];
long sum=0; for (int i=0;... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 109a188e75bc6bbc63caa9b7d10aa13c | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes |
import java.io.*;
import java.util.*;
import static java.lang.Integer.parseInt;
import java.lang.Math;
;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tk;
//Scanne... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | d1bf45bb87a70d72f751b904013fe17b | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
static class Obj {
public int pr1;
public int pr2;
public int profit;
public Obj() {
pr1 = 0;
pr2 = 0;
profit = 0;
}
... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 0ae8bb16deaa48828b0bc160ddb78d79 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.awt.List;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
public class Watermelon {
public static void main(String[] args) t... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | b3d02175120fddf9e8779c4a59dc7d72 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Watermelon{
static int[] a;
static boolean[] visited;
public static void main (String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int n=sc.next... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | dce8f095c4ffa28b767a25ce7fac8172 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.io.*;
import java.util.*;
public class C {
public static void main(String[] args) throws Exception {
FastScannerC fs = new FastScannerC();
PrintWriter out = new PrintWriter(System.out);
int n = fs.nextInt(), k = fs.nextInt();
Buy[] a = new Buy[n];
int[] x = fs.n... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | b2bb2f031d4423815eb03fcddd3da381 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
public class FirstApp {
class Tov implements Comparable<Tov>{
int index;
float sailToAfter;
public Tov(int ind,float val){
index = ind;
sailToAfter = val;
}
@Override
public int compareTo(Tov tov){
if(this.sailToAfter < ... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 1c4ecba4953ba5490e229d16c5860bc4 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes |
import java.util.*;
public class SOLVE {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
int n = reader.nextInt();
int k = reader.nextInt();
int[] before = new int[n];
int[] diff = new int[n];
int sum = 0;
for (int i = 0; i < n; i++) {
before[i] = reader.nextInt();... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 0d4a4340a9d0e0bc2560f3b280fa9eec | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
public class TestFindBuyItem {
public static void main(String[] args) throws IOException {
// System.out.println("200000 0");
// for... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 4604f0f1dbc75bfab3d30e4cf408018a | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
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[] args) {
InputStrea... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 77a3c0d03bc9ef768c8d75b58ccf9ec0 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
static class Item implements Comparable {
public int price;
public int discountedPrice;
public int dif;
public Item() {
price = 0;
discountedPrice = 0;
... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 7a6c40a298fa26605ceb60e6261cb8bf | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.util.*;
import java.io.*;
public class hello
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String ne... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 302c868fdd5bb23356b9d2eacd344208 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes |
import java.util.*;
public class Dishonest_Sellers {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int n,k;
n=scanner.nextInt();
k=scanner.nextInt();
int a[]=new int[n];
int b[]=new int[n];
for(int i=0;i<n;i++) {
a[i]=scanner.nextInt();
}
for(int i=0;i<n;i++... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | a33b4d95e90005c27a6e1b9231f7924b | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | //author : Brijesh Patel
import java.io.*;
import java.math.*;
import java.util.*;
import javax.print.attribute.SetOfIntegerSyntax;
public class Main {
private static InputStream stream;
private static byte[] buf = new byte[1024];
private static int curChar;
private static int numChars;
private static ... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | e3ed4af0b0136985b5a02b7df33fbd3b | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | //author : Brijesh Patel
import java.io.*;
import java.math.*;
import java.util.*;
import javax.print.attribute.SetOfIntegerSyntax;
public class Main {
private static InputStream stream;
private static byte[] buf = new byte[1024];
private static int curChar;
private static int numChars;
private static ... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 7021671edce8f0599152bf96bcf8e980 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main {
class Num implements Comparable<Num> {
int x;
int index;
@Override
public int compareTo(Num num) {
return this.x - num.x;
}
}
int n, k;
Num[] a;
Num[] b;
public void sol... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 3fb8f3936a0abb955b507fd7b664022a | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class C {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();int k=sc.nextInt();
int a[]=new int[n];
int c[]=new int[n];
int b;
for(int i=0;i<n;i++)
{b=sc.nextInt();a[i]+=b;}
... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | a263a27a0926e992762d37f1f68cb945 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes |
import java.util.Arrays;
import java.util.Scanner;
public class C {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();int k=sc.nextInt();
int a[]=new int[n];
int c[]=new int[n];
int b;
for(int i=0;i<n;i++)
{b=sc.nextInt();a[i]+=b;}... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | cab9b23550d0671dadc732eae6daea28 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | af73c4f423a27d9c2c9f284f9e79899e | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | /*
Logic is the strongest weapon.
*/
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.Map.Entry;
public class Coding {
private static InputStream stream;
private static byte[] buf = new byte[1024];
private static int curChar;
private static int numChars;
private static... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 1e90e5c8703700e8a6277c7b5dc0074a | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(), k = sc.nextInt(),ans=0;
int[] b = new int[n], a = new int[n], d = new int[n];
for(int i=0 ; i<n ;i++){
b[i] = sc.nextInt();
ans+=b[i];
}
for(int i=0 ; i... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | cbe614a814fe324774d56424f1f31591 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.util.List;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class Tester{
public static void main(String[] args) throws Exception{
... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 155b500c95c37cebc870d8d79c4527be | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | //package cf;
import java.util.*;
import java.io.*;
public class Cf{
static class Node{
int diff,left,right;
Node(int left,int right,int diff){
this.diff=diff;
this.left=left;
this.right=right;
}
}
public static void main(Strin... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | f9a0b3e7e3796ab331274dafdd157938 | train_000.jsonl | 1488096300 | Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.Not all of sellers are honest, so now some products could be more expensive than after a week of discount... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.*;
public class Solution {
/... | Java | ["3 1\n5 4 6\n3 1 5", "5 3\n3 4 7 10 3\n4 5 5 12 5"] | 2 seconds | ["10", "25"] | NoteIn the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a wee... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy"
] | b5355e1f4439b198d2cc7dea01bc4bc3 | In the first line there are two positive integer numbers n and k (1 ≤ n ≤ 2·105, 0 ≤ k ≤ n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 104) — prices of items during discounts (i.e. right now). The third l... | 1,200 | Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now. | standard output | |
PASSED | 6dd6d5afa422be982d66b1e780347172 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.Scanner;
// 1042D - Fail (use fenwick trees)
public class PetyaAndArray {
static long T;
static long[] A;
static long[] SUM;
public static void main(String[] args) {
Loca... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | bca16ca4881d90029ad5d1375fe1eef7 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.util.*;
import java.io.*;
public class _1042_D {
public static void main(String[] args) throws IOException {
int N = readInt();
long T = readLong();
long arr[] = new long[N+1];
long BIT[] = new long[N+2];
long tot = 0;
PriorityQueue<Long > pq = new PriorityQueue<>(Collections.reverseOrder());... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | f925b02fca012fbfc742de82c6758645 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class D {
static int mod = 1000000007;
static InputReader in = new InputReader(System.in);
static Prin... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | f57a2d24ac55f2febe16b66e24c1785e | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class D {
static int mod = 1000000007;
static InputReader in = new InputReader(System.in);
static Prin... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | c6cd4ddace614e837289954aff072993 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 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.Collection;
import java.util.List;
import java.util.Map.Entry;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import ja... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 8d8507c4b8bbfbc07051ac90e3c449fa | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class CF1042D {
public static void main(String[] args) {
FastReader reader = new FastReader();
int n = reader.nextInt();
long t = reader.nextLong();
// S[C] - S[... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 857e7cd8e3e1bf00f653954af2e70d50 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
/**
* Created by himanshubhardwaj on 17/09/18.
* Statement: https://codeforces.com/contest/1042/problem/D
* Algo:
* 1. Sqrt Decomposition
* 2.
*/
public class Pet... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 36dc659651871f46c7bbb28f6b808193 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
/**
* Created by himanshubhardwaj on 17/09/18.
* Statement: https://codeforces.com/contest/1042/problem/D
* Algo:
* 1. Sqrt Decomposition: Submission: https://codef... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 39e0053308b0119267a128f88fa9b2a6 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
/**
* Created by himanshubhardwaj on 17/09/18.
* Statement: https://codeforces.com/contest/1042/problem/D
* Algo:
*/
public class PetyaAndArray {
public static ... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 350a7c09f795e81988c1564d8b2039ff | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
/**
* Created by himanshubhardwaj on 17/09/18.
* Statement: https://codeforces.com/contest/1042/problem/D
* Algo:
* 1. Sqrt Decomposition: Submission, https://codef... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 079c0c1d919987df0ee187e88f18820e | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes |
import java.io.*;
import java.util.*;
public class D {
static StringBuilder st = new StringBuilder() ;
public static void main(String[] args) throws Exception{
Scanner sc = new Scanner();
int n = sc.nextInt();
long t = sc.nextLong()-1;
long [] a = new long [n];
for(int i = 0 ; i < n ;i++)
a... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | fd432f6c8635f09bb3e8b9b384bb66be | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class PetyaAndArray {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | aa0e164556216b26751dcc4c07589926 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static InputReader in = new InputReader(System.in);
static PrintWriter out = new PrintWriter(System.out);
static int oo = (int)1e9;
// static long oo = (long)1e15;
static int mod = 1_000_000_007;
// static int mod = 998... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | d77335364bff4aa2ec0c4a57eb95b202 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static InputReader in = new InputReader(System.in);
static PrintWriter out = new PrintWriter(System.out);
static int oo = (int)1e9;
// static long oo = (long)1e15;
static int mod = 1_000_000_007;
// static int mod = 998... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 9aa85fafe18f6c9764b9ea471d2a54a4 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.util.*;
public class Encrypt {
public static Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
int n = scan.nextInt();
long t = scan.nextLong();
long[] pref = new long[n];
pref[0] = scan.nextInt();
for(int i=1;i<n;++i)
{
pref[i] = pref[i-1] + scan.nextLong();... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | cf73ed33303c20667b44bf94bf7fb842 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskE... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 8ef151c9cab222c21af63c8e7f9c0986 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Collectio... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 481185b3d4fe3466c55cf1a1f7a93906 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.awt.*;
import java.io.*;
import java.util.*;
public class Main implements Runnable {
int maxn = (int)2e5+111;
int inf = (int)1e18;
long mod = (long)1e9+7;
int n,m,k;
long pref[] = new long[maxn];
void solve() throws Exception {
n = in.nextInt();
long k = in.nextLon... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 51b671507436a545a8841ab126d50a2d | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Comparator;
public class Main {
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
private static boolean debug = false;
private String nextString() {
StringBuilder sb =... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | cbc71dc57d3688d4a2b0b77db0a17e8d | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
public class Solut... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 911f8b527977e8c7c809bafa52552f2a | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 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.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import static java.lang.Math.random;
import static java.util.Arrays.copyOf;
/**
* @author... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 846d5acd66d57f889ee7b7c2d9830e1c | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 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;
import java.util.TreeMap;
import static java.lang.Math.random;
import static java.util.Arrays.copyOf;
/**
* @author Don Li
*/
public cla... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 854f29807a1d33406f30b2a12a31e6ba | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 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.ArrayList;
import java.util.InputMismatchException;
import java.util.TreeSet;
... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 341c58a2f347a8181e3d2fcb1276dc92 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class D
{
static int mod = (int) (1e9+7);
static InputReader in;
static PrintWriter out;
static class SegmentTree {
long st[];
SegmentTree(int n) {
st = new long[4*n];
build(0... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | c78ac44cc04f8f900feabdde55b995fb | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
public class Main4 {
static int N;
static long T;
static int[] A;
public static void main(String[] args) {
FastScanner sc = new FastScanner(System.in);
... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 2442964d26aeb55886a34446f2aefed3 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class CF1042_D {
public static void main(String[] args) throws Throwable {
MyScanner sc = new MyScanner();
PrintWriter pw = new PrintWriter(System.out);
int n = sc.nextInt();
long t = sc.nextLong();
l... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output | |
PASSED | 78e3851e96a5161a1e8b8e335ee8e743 | train_000.jsonl | 1537171500 | Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in the array.Now he wonders what is the number of segments i... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) throws Exception {
M... | Java | ["5 4\n5 -1 3 4 -1", "3 0\n-1 2 -3", "4 -1\n-2 1 -2 3"] | 2 seconds | ["5", "4", "3"] | NoteIn the first example the following segments have sum less than $$$4$$$: $$$[2, 2]$$$, sum of elements is $$$-1$$$ $$$[2, 3]$$$, sum of elements is $$$2$$$ $$$[3, 3]$$$, sum of elements is $$$3$$$ $$$[4, 5]$$$, sum of elements is $$$3$$$ $$$[5, 5]$$$, sum of elements is $$$-1$$$ | Java 8 | standard input | [
"data structures",
"two pointers",
"divide and conquer"
] | 42c4adc1c4a10cc619c05a842e186e60 | The first line contains two integers $$$n$$$ and $$$t$$$ ($$$1 \le n \le 200\,000, |t| \le 2\cdot10^{14}$$$). The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$|a_{i}| \le 10^{9}$$$) — the description of Petya's array. Note that there might be negative, zero and positive elements. | 1,800 | Print the number of segments in Petya's array with the sum of elements less than $$$t$$$. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.