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
1d36a3058a8cbf293eb811c8721c1e7c
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package farrelativesparty; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java....
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
b34e461dd35f0cf632ad97c729ca95f2
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class FarRelativeProblem { public static void main(String[] args) { InputReader r = new InputReader(System.in); int n = r.ne...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
715b5cb57abb889f1bf0a4e7a240f855
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; /* * To change this license header, choose License Headers in Project Properties. * To change this template ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
9563422a909c699afc9cfe56a7b923d6
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.*; import java.math.*; public class Main { public static void main(String[] args)throws IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int arrayMen[]=new int[366]; int arr...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
9d97a6108b6b2ad9b0c2851f0c1ca9a8
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.*; import java.io.*; public class BoysGirls { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int n = in.nextInt(); String s = in.nextLine(); int[] boy = new int[367]; int[] girl = new int[367]; for (int i = 0; i < n; i++) { s = in.nextLi...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
ac0202e5bacd8dfaa70fcbb2e83e2072
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.util.StringTokenizer; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int n...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
d0920f2a8cc473015f596fbeb115b195
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package far.relative.problem; import java.util.Scanner; /** * * @author Himanshu Khare */ public class FarRelativeProblem { /...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
63a1d04891cc58e524807cd3db06549c
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Created by MohannadHassanPersonal on 2/20/16. */ public class FarRelativeProblem { public static void main (String [] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
90929292d40ba573338e3dabe7633701
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class B629 { BufferedReader br; StringTokenizer in; PrintWriter out; public String nextToken() throws IOException { ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
b10cdad970c8dc83941cf142db6edd3d
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static Scanner in= new Scanner(System.in); public static void main (String[] args) throws java.lang.Except...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
d73c8301b5e992aeb7f7d411391589c8
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.*; import java.util.*; public class Solution { private static void solve(InputReader in, OutputWriter out) { int n = in.nextInt(); int[] m, f; m = new int[368]; f = new int[368]; String gender; int left, right; for (int i = 0; i < n; i++) { ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
4c97d58e9dd1873da58fb2c21d7be786
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String [] args)throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); StringTokenizer st; int maledays[] = new int[400]; int femdays[] = new int[400]; for...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
6fe4174a0345792e1639d341480deef5
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner lee=new Scanner(System.in); int n=lee.nextInt(); String []v=new String[n]; int []M=new int[n]; int []F=new int[n]; for (int i = 0; i <n; i++) { v[i]=lee.next(); M[i]=lee.nextInt(); F[i]=lee.nextInt(); } i...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
93c5520837613b242b10d3ab7f30985e
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.*; import java.io.*; public class farfar{ public static void main(String args[]) throws IOException{ BufferedReader lector = new BufferedReader(new InputStreamReader(System.in)); int tmp1 = Integer.parseInt(lector.readLine()); int tal[][] = new int[tmp1][3]; for(int n =0;n<tmp1;n++){ String t[] = lecto...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
059cc8c6fa9e0b57c172d9ffa8cf9a23
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.*; public class B629 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int[] ms = new int[400], fs = new int[400]; for(int i = 0; i<n; i++) { char c= input.next().charAt(0); int[] a = c == 'M' ? ms : fs; int s = input.nextInt(), b = i...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
f788eb157bc181363e9af0d6cb815f64
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Scanner; import java.util.HashSet; import java.util.Iterator; //package codeforce; /* @author Kbk*/ public class Abc { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int N=sc.nextInt(); String gender[]=new String[N]; int startday[]=new ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
b27c2f9f2c0e5c8a6a07ed2b247155ae
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); int n = stdin.nextInt(); Friend[] frd = new Friend[n]; stdin.nextLine(); for (int i = 0; i < n; i++) { String s = stdin.nextLine(); String[] ss = s.split(" "); char sex = ss[0].ch...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
ceee154225e9879e4fba28da3df0b6a3
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class P629B { InputStream is; PrintWriter out; String INPUT = "6\n" + "M 128 130\n" + "F 128 131\n" + ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
ac075590e21383fa40d44ee629a83ca1
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Scanner; /** * Feb 20, 2016 | 6:08:03 PM * <pre> * <u>Description</u> * * </pre> * * @author Essiennta Emmanuel (colourfulemmanuel@gmail.com) */ public class ProblemB{ int solve(char[] sex, int[] be, int[] en){ int[] nf = new int[400]; int[] nm = new int[400]; for...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
334318c1bad2d485adeafa3ac968945e
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws IOException { Reader.init(System.in); int m[] = new int[370]; int f[] = new int[370]; int n ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
9a124cb4bc66e2c617b8cf80078e7166
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { static Scanner in = new Scanner(System.in); static int f[]; static int m[]; static int n; public static void main(String[] args) { f = new int[380]; m = new int[380]; n =in...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
1cf0a1cb5726b9bba54e010e6f2fc49c
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
//package com.company.codeforces.div2.train; import java.io.IOException; import java.util.Scanner; /** * Created by Daniil on 5/19/2016. */ public class Task2 { public static void main(String[] args) throws IOException { //Scanner scanner = new Scanner(new FileInputStream("file.in")); Scanner s...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
b245cc0a3bcb79fb5045cc0c6f8daab7
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.util.Set; import java.util.Map.Entry; import java.util.HashMap; import java.util.Iterator; import java.math.BigDecimal; public class test { public static void main(String[] args) { Scanner...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
cecfbce2587460bd978014fd3bdaf0bc
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Scanner; public class FarRelativeProblem { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[][] ar = new int[367][2]; int[] gender = new int[n]; int[][] time = new int[n][2]; for (int i = 0; i < n; i++) { gender[i] = in.next().charA...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
146e69940162c066997b775d88cf602f
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.*; public class Main { static class Friend{ public char sex; public int start; public int end; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); Friend[] friends = n...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
137ac8c40dee00aa2dae6a9de6e72cb6
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
//package Codeforces.Div2B_343.Code1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /* * some cheeky quote */ public class Main { FastScanner in; PrintWriter out; public void solve() throws IOE...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
b228c61da6ae84bfcea4784fb1ae0c59
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
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); solve(in, out); out.close(); } ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
30802d0316782b463bcce9021b7b7b76
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Scanner; import java.util.InputMismatchException; public class Main { public static void main(String [] args) { Scanner in = new Scanner(System.in); Task task = new Task(); task.solve(in); } } class Task { final int MAXN = 5005; final int MAXRANGE = 370; /...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
85837b48e4fff10bbfce5a150895dbf7
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Scanner; /** * @author sadasidha * @since 2/10/16 */ public class Main { public static Scanner sc = new Scanner(System.in); static int[] m = new int[370]; static int[] f = new int[370]; public static void main(String[] args) { int n = sc.nextInt(); while (n-- > 0)...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
5d516506d67759bffe7aa5fdf2d38713
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class B { public static void main(String[] args) { Scanner in = new Scanner(System.in); Plan[] ar = new Plan[in.nextInt()*2]; for(int i =0; i<ar.length/2; i++){ char c = in.next().charAt(0); int start = in.nextInt(); int end = in.nextInt(); ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
b3c3a34b4eedb588afc1d75b1efca266
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Scanner; import java.util.StringTokenizer; public class problema2 { static class Triplet { char gender; int a; int b; Triplet(char gender, int a, int b) { this.gender = gender; this.a = a; this.b = b; } } public static void main(String[] args) { Scanner sc = new Scanner(S...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
94eb5a7432ffbfbaa8b8419692159c09
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Codeforces { public static void main(String[] args) { int[] shabab = new int[500]; int[] halageem = new int[500]; Scanner in = new Scanner(System.in); int n = in.nextInt(); ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
649913223ff81bd6b5f70fcf02918ab6
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader;import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Friends { static StringTokenizer st; static Buf...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
090d501df0fc0b040f0d75cc88944ab4
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Bit...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
36f8ac00dd3bd1dec0d0c255307bc78b
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.*; import java.io.*; public class FarProblem { /************************ SOLUTION STARTS HERE ************************/ static class Pair { char gender; int l,r; Pair(char gender,int l,int r) { this.gender = gender; this.l = l; this.r = r; } @Override public String toStrin...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
3535b38fc699c7c1fed45d35c4458601
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.text.*; public class Problem { public static int solve(ArrayList<Integer[]> m, ArrayList<Integer[]> f) { int best = 0; for (int day = 1; day <= 366; day++) { int nm = 0; int nf = 0; for (int mi = 0; mi < m.size(); mi++) if (m.get(...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
c0aee694f4fe93a6dd249583c40fb98f
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Scanner; public class Attempt { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[] D = new char[n]; int[] l = new int[n]; int[] r = new int[n]; for (int i=0; i<n; i++) { ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
4e4a51be466f4c29d3e2511c2b261c7e
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.IOException; import java.util.*; public class Problem { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); int n = sc.nextInt(); int c[][] = new int[2][370]; for(int i = 1; i <= n; i++) { char s[] = new char[3]; s[0] = sc.nextString().charAt(0); ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
7ae516802d2590c98b6044a7ffd8c052
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.*; public class Lab12 { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sin = new Scanner(System.in); int n = sin.nextInt(); int arr[] = new int[367]; int brr[] = new int[367]; for (int i = 0...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
516d87c536ead53c52c53a199af410ce
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.IOException; import java.io.InputStream; public class B629 { public static void main(String[] args) throws IOException { InputReader reader = new InputReader(System.in); int N = reader.readInt(); int[] M = new int[367]; int[] W = new int[367]; for (int n=0;...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
fc056c9c71e9fcfbe0a8892c856d682f
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Scanner; public class CodeforcesD { public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); char c; int a, b; int[] m = new int[367]; int[] f = new int[367]; for(int i=0; i<n; i++){ if(in.next().equals("M")){ m[in.nextInt()-1]++; ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
9c364e424538f2c75579ec9b90782160
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B343 { public void solve() throws IOException { int n = nextInt(); int[...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
532391144c82be9cb6388ba76124f68e
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLin...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
c2a6771800c8b8c541d455d33f490937
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Scanner; public class Test{ class Pair{ int malec; int femalec; Pair(){ malec=0; femalec=0; } } public static Scanner sb; public static void main(String[] args){ sb=new Scanner(System.in); int n=sb.nextInt();int i,j,k,day1,day2,max=0;char a; String input[][]=new String[n][3]; ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
23e1e9bf7b7592ba050e9ebbaa95c47e
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.*; import java.util.*; public final class fd2 { static FastScanner sc=new FastScanner(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter out=new PrintWriter(System.out); public static void main(String args[]) throws Exception { int n=sc.nextInt(); Node[] a=...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
c0994f348e884b331dcfef1b793eda2e
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class B { static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer tok = new StringTokenizer(""); static int[][] cnt; public static...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
d75eafd450fcf5354f4bd740c71a1db0
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import java.io.*; import java.util.*; public class C343B { private static StringTokenizer st; public static void nextLine(BufferedReader br) throws IOException { st = new StringTokenizer(br.readLine()); } public stat...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
536d495c6cd99c03cbb0b654b576080f
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class ProblemB { public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out); new Prob...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
22b1fb6a684dd0b236283ce47c639c70
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class test_b { public static void main(String[] args) { MyScanner sc = new MyScanner(); int n = sc.nextInt(); int[]a[] = new...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
d8f4e2dbec387a31bda747c4a935f88b
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.*; import java.lang.*; import java.util.*; public class Test1{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); boolean[] mrr = new boolean[n]; int[] a = new int[n]; int[] b = new int[n];...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
0af27763544c831519ffa76643bd4f16
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Scanner; public class FarRelativesProblem { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[] boys=new int[368]; int[] girls=new int[368]; for(int i=1;i<=n;i++) { if(sc.next().equals("M")) { boys[sc.nextInt()]++; boys[...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
d4b46748093d94f989f1e3b90c6bfdc0
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String[]args){ Scanner ss=new Scanner(System.in); int n=ss.nextInt(),ans=0,temp=0,m,f; String input[]; ss.nextLine(); Range list[]=new Range[n]; for(int i=0;i<n;i++){ input=ss.nextLine().split(" "); list[i]=...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
bb1781e97c99155aa44aadde4e54f0c3
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
//package srm343; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class B { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.pars...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
24b671ad634155e1c48051ecd4c68fca
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Scanner; public class FarRelative { public static void main(String ... arg){ Scanner s = new Scanner(System.in); int n = s.nextInt(); long countM[] = new long[370]; ...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
a188ce076ce6a638f78c48602672ec78
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class B { public static int guestsCanCome(int day, int guests[][], int i, int length) { if (i >= length) { return 0; } int countGuest = 0; if (day >= guests[i][0] && day <= guest...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
1495a3bcc40b23b03596cea47d041721
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class B { public static void main(String [] args) throws IOException { BufferedReader br = new BufferedReader(new...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
a42007a13677bd1ec77fdc271165a17a
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; import java.util.StringTokenizer; public class B { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); scan.nextLine(); ArrayList<Res> males = new ArrayList<Res>(); Array...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
83befa44efbf031c47fc8e75f2ef9e54
train_003.jsonl
1455986100
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.Far cars are as weird as Far Far Awa...
256 megabytes
import java.util.Scanner; public class Relative { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); int[] m = new int[368]; int[] f = new int[368]; while(n-- > 0) { String s = sc.nextLine(...
Java
["4\nM 151 307\nF 343 352\nF 117 145\nM 24 128", "6\nM 128 130\nF 128 131\nF 131 140\nF 131 141\nM 131 200\nM 140 200"]
2 seconds
["2", "4"]
NoteIn the first sample, friends 3 and 4 can come on any day in range [117, 128].In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.
Java 7
standard input
[ "brute force" ]
75d500bad37fbd2c5456a942bde09cd3
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends. Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 36...
1,100
Print the maximum number of people that may come to Famil Door's party.
standard output
PASSED
bb85413de5bdd5403598708a468d87f8
train_003.jsonl
1474119900
ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a &gt; c, then eve...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner inp = new Scanner(System.in); int n, c, count = 1; n = inp.nextInt(); c = inp.nextInt(); int[] arr = new int[n]; for (int i=0; i<n; i++) { arr[i] = inp.nextInt(); } for (int i=0; i<n-1; i++) { ...
Java
["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"]
2 seconds
["3", "2"]
NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 &gt; 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ...
Java 11
standard input
[ "implementation" ]
fb58bc3be4a7a78bdc001298d35c6b21
The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 &lt; t2 &lt; ... &lt; tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word.
800
Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn.
standard output
PASSED
5a1eb22c8eb0f1cc929d5d580352ba78
train_003.jsonl
1474119900
ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a &gt; c, then eve...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.Collections; import java.util.StringTokenizer; public class Codeforces716A { public static void main(String[] args) { FastScanner sc=new FastScanner(); int n = sc.nextInt() , c = sc...
Java
["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"]
2 seconds
["3", "2"]
NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 &gt; 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ...
Java 11
standard input
[ "implementation" ]
fb58bc3be4a7a78bdc001298d35c6b21
The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 &lt; t2 &lt; ... &lt; tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word.
800
Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn.
standard output
PASSED
09c965703c0b3954266b59cb87559469
train_003.jsonl
1474119900
ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a &gt; c, then eve...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.math.BigDecimal; import java.math.BigInteger; public class JavaApplication9 { //******************************************************************...
Java
["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"]
2 seconds
["3", "2"]
NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 &gt; 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ...
Java 11
standard input
[ "implementation" ]
fb58bc3be4a7a78bdc001298d35c6b21
The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 &lt; t2 &lt; ... &lt; tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word.
800
Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn.
standard output
PASSED
153e2c8e422360c8474de0d3761485f0
train_003.jsonl
1474119900
ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a &gt; c, then eve...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner ob=new Scanner(System....
Java
["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"]
2 seconds
["3", "2"]
NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 &gt; 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ...
Java 11
standard input
[ "implementation" ]
fb58bc3be4a7a78bdc001298d35c6b21
The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 &lt; t2 &lt; ... &lt; tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word.
800
Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn.
standard output
PASSED
843ba6583ffcb81cd1563b290a4052ad
train_003.jsonl
1582473900
VK news recommendation system daily selects interesting publications of one of $$$n$$$ disjoint categories for each user. Each publication belongs to exactly one category. For each category $$$i$$$ batch algorithm selects $$$a_i$$$ publications.The latest A/B test suggests that users are reading recommended publication...
512 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; ...
Java
["5\n3 7 9 7 8\n5 2 5 7 5", "5\n1 2 3 4 5\n1 1 1 1 1"]
2 seconds
["6", "0"]
NoteIn the first example, it is possible to find three publications of the second type, which will take 6 seconds.In the second example, all news categories contain a different number of publications.
Java 8
standard input
[ "data structures", "sortings", "greedy" ]
6bceaf308c38d234ba931c13e4f70929
The first line of input consists of single integer $$$n$$$ — the number of news categories ($$$1 \le n \le 200\,000$$$). The second line of input consists of $$$n$$$ integers $$$a_i$$$ — the number of publications of $$$i$$$-th category selected by the batch algorithm ($$$1 \le a_i \le 10^9$$$). The third line of input...
1,700
Print one integer — the minimal required time for the targeted algorithm to get rid of categories with the same size.
standard output
PASSED
d5c2a11e6bd4197930dadd7d4f58a092
train_003.jsonl
1582473900
VK news recommendation system daily selects interesting publications of one of $$$n$$$ disjoint categories for each user. Each publication belongs to exactly one category. For each category $$$i$$$ batch algorithm selects $$$a_i$$$ publications.The latest A/B test suggests that users are reading recommended publication...
512 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; import java.util.Map.Entry; import static java.lang.Math.*; public class A extends PrintWriter { void run() { int n = nextInt(); int[] a = nextArray(n); int[] t = nextArray(n); Integer[] order = new Integer[n]; ...
Java
["5\n3 7 9 7 8\n5 2 5 7 5", "5\n1 2 3 4 5\n1 1 1 1 1"]
2 seconds
["6", "0"]
NoteIn the first example, it is possible to find three publications of the second type, which will take 6 seconds.In the second example, all news categories contain a different number of publications.
Java 8
standard input
[ "data structures", "sortings", "greedy" ]
6bceaf308c38d234ba931c13e4f70929
The first line of input consists of single integer $$$n$$$ — the number of news categories ($$$1 \le n \le 200\,000$$$). The second line of input consists of $$$n$$$ integers $$$a_i$$$ — the number of publications of $$$i$$$-th category selected by the batch algorithm ($$$1 \le a_i \le 10^9$$$). The third line of input...
1,700
Print one integer — the minimal required time for the targeted algorithm to get rid of categories with the same size.
standard output
PASSED
32fc476bf94fab56fad4ba94424303af
train_003.jsonl
1582473900
VK news recommendation system daily selects interesting publications of one of $$$n$$$ disjoint categories for each user. Each publication belongs to exactly one category. For each category $$$i$$$ batch algorithm selects $$$a_i$$$ publications.The latest A/B test suggests that users are reading recommended publication...
512 megabytes
import java.util.*; public class reccommendations { public static void main(String[] args) { Scanner x = new Scanner(System.in); int n = x.nextInt(); int[] arr = new int[n]; News[] newsarr = new News[n]; for(int i = 0; i < n; i++) { arr[i] = x.nextInt(); }...
Java
["5\n3 7 9 7 8\n5 2 5 7 5", "5\n1 2 3 4 5\n1 1 1 1 1"]
2 seconds
["6", "0"]
NoteIn the first example, it is possible to find three publications of the second type, which will take 6 seconds.In the second example, all news categories contain a different number of publications.
Java 8
standard input
[ "data structures", "sortings", "greedy" ]
6bceaf308c38d234ba931c13e4f70929
The first line of input consists of single integer $$$n$$$ — the number of news categories ($$$1 \le n \le 200\,000$$$). The second line of input consists of $$$n$$$ integers $$$a_i$$$ — the number of publications of $$$i$$$-th category selected by the batch algorithm ($$$1 \le a_i \le 10^9$$$). The third line of input...
1,700
Print one integer — the minimal required time for the targeted algorithm to get rid of categories with the same size.
standard output
PASSED
e5cb647f0672844ecaa645c231c0a442
train_003.jsonl
1422705600
Programming teacher Dmitry Olegovich is going to propose the following task for one of his tests for students:You are given a tree T with n vertices, specified by its adjacency matrix a[1... n, 1... n]. What is the output of the following pseudocode?used[1 ... n] = {0, ..., 0};procedure dfs(v): print v; used[v] =...
256 megabytes
//package codeforces.cfr289div2; import java.util.Arrays; import java.util.Scanner; /** * Created by raggzy on 01-Feb-15. */ public class F { static int MODULO = 1000000007; int n; int[] a; int[][] g; // i - root, next childs int f(int i, int j) { if (i == j) { return 1...
Java
["3\n1 2 3", "3\n1 3 2"]
1 second
["2", "1"]
null
Java 7
standard input
[ "dp", "trees" ]
a93294df0a596850d5080cc024ffddcd
The first line contains the positive integer n (1 ≤ n ≤ 500) — the length of sequence b. The second line contains n positive integers b1, b2, ..., bn (1 ≤ bi ≤ n). It is guaranteed that b is a permutation, or in other words, each of the numbers 1, 2, ..., n appears exactly once in the sequence b. Also it is guaranteed...
2,300
Output the number of trees satisfying the conditions above modulo 109 + 7.
standard output
PASSED
b38b92641c3e6876289ce0a1dc1d3c75
train_003.jsonl
1422705600
Programming teacher Dmitry Olegovich is going to propose the following task for one of his tests for students:You are given a tree T with n vertices, specified by its adjacency matrix a[1... n, 1... n]. What is the output of the following pseudocode?used[1 ... n] = {0, ..., 0};procedure dfs(v): print v; used[v] =...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Ite...
Java
["3\n1 2 3", "3\n1 3 2"]
1 second
["2", "1"]
null
Java 7
standard input
[ "dp", "trees" ]
a93294df0a596850d5080cc024ffddcd
The first line contains the positive integer n (1 ≤ n ≤ 500) — the length of sequence b. The second line contains n positive integers b1, b2, ..., bn (1 ≤ bi ≤ n). It is guaranteed that b is a permutation, or in other words, each of the numbers 1, 2, ..., n appears exactly once in the sequence b. Also it is guaranteed...
2,300
Output the number of trees satisfying the conditions above modulo 109 + 7.
standard output
PASSED
d02340ff14ecfac362235f2b3ad28f70
train_003.jsonl
1422705600
Programming teacher Dmitry Olegovich is going to propose the following task for one of his tests for students:You are given a tree T with n vertices, specified by its adjacency matrix a[1... n, 1... n]. What is the output of the following pseudocode?used[1 ... n] = {0, ..., 0};procedure dfs(v): print v; used[v] =...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Ite...
Java
["3\n1 2 3", "3\n1 3 2"]
1 second
["2", "1"]
null
Java 7
standard input
[ "dp", "trees" ]
a93294df0a596850d5080cc024ffddcd
The first line contains the positive integer n (1 ≤ n ≤ 500) — the length of sequence b. The second line contains n positive integers b1, b2, ..., bn (1 ≤ bi ≤ n). It is guaranteed that b is a permutation, or in other words, each of the numbers 1, 2, ..., n appears exactly once in the sequence b. Also it is guaranteed...
2,300
Output the number of trees satisfying the conditions above modulo 109 + 7.
standard output
PASSED
3a40a73f73770e159c0b7e6f5c8671dd
train_003.jsonl
1422705600
Programming teacher Dmitry Olegovich is going to propose the following task for one of his tests for students:You are given a tree T with n vertices, specified by its adjacency matrix a[1... n, 1... n]. What is the output of the following pseudocode?used[1 ... n] = {0, ..., 0};procedure dfs(v): print v; used[v] =...
256 megabytes
import java.io.*; import java.util.*; public class e { static int n; static int[] p; static long mod = (long)1e9+7; public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); n = input.nextInt(); p = new int[n]; for(int i = 0; i<n; i++) p[i]...
Java
["3\n1 2 3", "3\n1 3 2"]
1 second
["2", "1"]
null
Java 7
standard input
[ "dp", "trees" ]
a93294df0a596850d5080cc024ffddcd
The first line contains the positive integer n (1 ≤ n ≤ 500) — the length of sequence b. The second line contains n positive integers b1, b2, ..., bn (1 ≤ bi ≤ n). It is guaranteed that b is a permutation, or in other words, each of the numbers 1, 2, ..., n appears exactly once in the sequence b. Also it is guaranteed...
2,300
Output the number of trees satisfying the conditions above modulo 109 + 7.
standard output
PASSED
3f5efb23ba77ad7a15d5343bca5474ff
train_003.jsonl
1422705600
Programming teacher Dmitry Olegovich is going to propose the following task for one of his tests for students:You are given a tree T with n vertices, specified by its adjacency matrix a[1... n, 1... n]. What is the output of the following pseudocode?used[1 ... n] = {0, ..., 0};procedure dfs(v): print v; used[v] =...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class CF289F { static int[] a; static int[][] dp; static int MOD = 1_000_000_007; static int f(int l, int r) { if (l >= r) return 1; if (dp[l][r] != -1) return dp[l][r]; long answer = 0; f...
Java
["3\n1 2 3", "3\n1 3 2"]
1 second
["2", "1"]
null
Java 7
standard input
[ "dp", "trees" ]
a93294df0a596850d5080cc024ffddcd
The first line contains the positive integer n (1 ≤ n ≤ 500) — the length of sequence b. The second line contains n positive integers b1, b2, ..., bn (1 ≤ bi ≤ n). It is guaranteed that b is a permutation, or in other words, each of the numbers 1, 2, ..., n appears exactly once in the sequence b. Also it is guaranteed...
2,300
Output the number of trees satisfying the conditions above modulo 109 + 7.
standard output
PASSED
2b7e1b7ad76fedc64dedf1c313a27c03
train_003.jsonl
1422705600
Programming teacher Dmitry Olegovich is going to propose the following task for one of his tests for students:You are given a tree T with n vertices, specified by its adjacency matrix a[1... n, 1... n]. What is the output of the following pseudocode?used[1 ... n] = {0, ..., 0};procedure dfs(v): print v; used[v] =...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class F { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); ...
Java
["3\n1 2 3", "3\n1 3 2"]
1 second
["2", "1"]
null
Java 7
standard input
[ "dp", "trees" ]
a93294df0a596850d5080cc024ffddcd
The first line contains the positive integer n (1 ≤ n ≤ 500) — the length of sequence b. The second line contains n positive integers b1, b2, ..., bn (1 ≤ bi ≤ n). It is guaranteed that b is a permutation, or in other words, each of the numbers 1, 2, ..., n appears exactly once in the sequence b. Also it is guaranteed...
2,300
Output the number of trees satisfying the conditions above modulo 109 + 7.
standard output
PASSED
dcb7b31bb21bfe5fe6318e0bdc2f9585
train_003.jsonl
1422705600
Programming teacher Dmitry Olegovich is going to propose the following task for one of his tests for students:You are given a tree T with n vertices, specified by its adjacency matrix a[1... n, 1... n]. What is the output of the following pseudocode?used[1 ... n] = {0, ..., 0};procedure dfs(v): print v; used[v] =...
256 megabytes
import java.io.*; import java.util.*; public class progressmonitor { private static InputReader in; private static PrintWriter out; public static int mod = 1000000007; public static void main(String[] args) throws IOException { in = new InputReader(System.in); out = new PrintWriter(System.out, true); ...
Java
["3\n1 2 3", "3\n1 3 2"]
1 second
["2", "1"]
null
Java 7
standard input
[ "dp", "trees" ]
a93294df0a596850d5080cc024ffddcd
The first line contains the positive integer n (1 ≤ n ≤ 500) — the length of sequence b. The second line contains n positive integers b1, b2, ..., bn (1 ≤ bi ≤ n). It is guaranteed that b is a permutation, or in other words, each of the numbers 1, 2, ..., n appears exactly once in the sequence b. Also it is guaranteed...
2,300
Output the number of trees satisfying the conditions above modulo 109 + 7.
standard output
PASSED
4098382fb388d70856c6b432c2cc0a8d
train_003.jsonl
1422705600
Programming teacher Dmitry Olegovich is going to propose the following task for one of his tests for students:You are given a tree T with n vertices, specified by its adjacency matrix a[1... n, 1... n]. What is the output of the following pseudocode?used[1 ... n] = {0, ..., 0};procedure dfs(v): print v; used[v] =...
256 megabytes
import java.io.*; import java.util.*; public class F { public static void main(String[] args) throws IOException { new F().solve(); } void solve() throws IOException { FastScanner in = new FastScanner(System.in); long mod = (long) (1e+9) + 7; int n = in.nextInt(); ...
Java
["3\n1 2 3", "3\n1 3 2"]
1 second
["2", "1"]
null
Java 7
standard input
[ "dp", "trees" ]
a93294df0a596850d5080cc024ffddcd
The first line contains the positive integer n (1 ≤ n ≤ 500) — the length of sequence b. The second line contains n positive integers b1, b2, ..., bn (1 ≤ bi ≤ n). It is guaranteed that b is a permutation, or in other words, each of the numbers 1, 2, ..., n appears exactly once in the sequence b. Also it is guaranteed...
2,300
Output the number of trees satisfying the conditions above modulo 109 + 7.
standard output
PASSED
e8ed0b736e2d1f1b9faf35f930254c4f
train_003.jsonl
1557671700
Let $$$s$$$ be some string consisting of symbols "0" or "1". Let's call a string $$$t$$$ a substring of string $$$s$$$, if there exists such number $$$1 \leq l \leq |s| - |t| + 1$$$ that $$$t = s_l s_{l+1} \ldots s_{l + |t| - 1}$$$. Let's call a substring $$$t$$$ of string $$$s$$$ unique, if there exist only one such $...
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.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class...
Java
["4 4", "5 3", "7 3"]
1 second
["1111", "01010", "1011011"]
NoteIn the first test, it's easy to see, that the only unique substring of string $$$s = $$$"1111" is all string $$$s$$$, which has length $$$4$$$.In the second test a string $$$s = $$$"01010" has minimal unique substring $$$t =$$$"101", which has length $$$3$$$.In the third test a string $$$s = $$$"1011011" has minima...
Java 8
standard input
[ "greedy", "constructive algorithms", "math", "brute force", "strings" ]
7e8baa4fb780f11e66bb2b7078e34c04
The first line contains two integers $$$n$$$ and $$$k$$$, separated by spaces ($$$1 \leq k \leq n \leq 100\,000$$$, $$$(k \bmod 2) = (n \bmod 2)$$$).
2,200
Print a string $$$s$$$ of length $$$n$$$, consisting of symbols "0" and "1". Minimal length of the unique substring of $$$s$$$ should be equal to $$$k$$$. You can find any suitable string. It is guaranteed, that there exists at least one such string.
standard output
PASSED
2ef9f9b2958ef362e510a4dce9e163b6
train_003.jsonl
1557671700
Let $$$s$$$ be some string consisting of symbols "0" or "1". Let's call a string $$$t$$$ a substring of string $$$s$$$, if there exists such number $$$1 \leq l \leq |s| - |t| + 1$$$ that $$$t = s_l s_{l+1} \ldots s_{l + |t| - 1}$$$. Let's call a substring $$$t$$$ of string $$$s$$$ unique, if there exist only one such $...
256 megabytes
//package com.krakn.CF.D1159; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n, k; n = sc.nextInt(); k = sc.nextInt(); int a = (n - k) / 2; StringBuilder s = new StringBuilder(); ...
Java
["4 4", "5 3", "7 3"]
1 second
["1111", "01010", "1011011"]
NoteIn the first test, it's easy to see, that the only unique substring of string $$$s = $$$"1111" is all string $$$s$$$, which has length $$$4$$$.In the second test a string $$$s = $$$"01010" has minimal unique substring $$$t =$$$"101", which has length $$$3$$$.In the third test a string $$$s = $$$"1011011" has minima...
Java 8
standard input
[ "greedy", "constructive algorithms", "math", "brute force", "strings" ]
7e8baa4fb780f11e66bb2b7078e34c04
The first line contains two integers $$$n$$$ and $$$k$$$, separated by spaces ($$$1 \leq k \leq n \leq 100\,000$$$, $$$(k \bmod 2) = (n \bmod 2)$$$).
2,200
Print a string $$$s$$$ of length $$$n$$$, consisting of symbols "0" and "1". Minimal length of the unique substring of $$$s$$$ should be equal to $$$k$$$. You can find any suitable string. It is guaranteed, that there exists at least one such string.
standard output
PASSED
b00caac13450273d1d20e29421d9ca2e
train_003.jsonl
1557671700
Let $$$s$$$ be some string consisting of symbols "0" or "1". Let's call a string $$$t$$$ a substring of string $$$s$$$, if there exists such number $$$1 \leq l \leq |s| - |t| + 1$$$ that $$$t = s_l s_{l+1} \ldots s_{l + |t| - 1}$$$. Let's call a substring $$$t$$$ of string $$$s$$$ unique, if there exist only one such $...
256 megabytes
import static java.lang.Math.*; import static java.util.Arrays.*; import java.util.*; import java.io.*; public class A { ArrayList<String> arr = new ArrayList<>() ; int n , k ; void brute(String s , int idx) { if(idx == n) { int min = 1 << 30 ; for(int i = 0 ; i...
Java
["4 4", "5 3", "7 3"]
1 second
["1111", "01010", "1011011"]
NoteIn the first test, it's easy to see, that the only unique substring of string $$$s = $$$"1111" is all string $$$s$$$, which has length $$$4$$$.In the second test a string $$$s = $$$"01010" has minimal unique substring $$$t =$$$"101", which has length $$$3$$$.In the third test a string $$$s = $$$"1011011" has minima...
Java 8
standard input
[ "greedy", "constructive algorithms", "math", "brute force", "strings" ]
7e8baa4fb780f11e66bb2b7078e34c04
The first line contains two integers $$$n$$$ and $$$k$$$, separated by spaces ($$$1 \leq k \leq n \leq 100\,000$$$, $$$(k \bmod 2) = (n \bmod 2)$$$).
2,200
Print a string $$$s$$$ of length $$$n$$$, consisting of symbols "0" and "1". Minimal length of the unique substring of $$$s$$$ should be equal to $$$k$$$. You can find any suitable string. It is guaranteed, that there exists at least one such string.
standard output
PASSED
300a3e118b622ccc4ec704545d1c3371
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import static java.lang.Math.*; import java.util.*; public class E { public E () { sc.nextInt(); int K = sc.nextInt(); int [] A = sc.nextInts(); TreeMap<Integer, Integer> L = new TreeMap<>(); for (int k : req(K)) for (int a : A) { int x = k*a, y = INF; if (L.containsKey(x)) y = L.get(x); ...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
2faf313a695f493db65db6b119dcfbe8
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.BufferedReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Arrays; import java.io.InputStreamReader; import java.io.IOException; /** * Built using CHelper...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
c8bc631ac18c4833741258ab48e4060e
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class ProblemE { private static final long INF = 123456789123456L; BufferedReader rd; private ProblemE() throws IOException { rd = new BufferedReader(new InputStreamReader(S...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
c2fc21af9f1e384e628d3bb48f3dfaa5
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Map.Entry; import java.util.StringTokenizer; import java.util.TreeMap; public class ATM { public static void main(String[] args) { InputReader...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
e44c139873bab1465a62b05d7f302325
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class E { BufferedReader reader; StringTokenizer tokenizer; PrintWriter out; public void solve() throws IOException { int N = nextInt(); int...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
1151b48d19cae2f31d456ba1128abeb0
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class E { void solve() throws IOException { int n=nextInt(); int k=nextInt(); int[] a=new int[n]; for(int i=0;i<n;i++){ a[i]=nextInt(); } int q=nextInt(); for(int Q=0;Q<q;...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
bde27e1c1039e2003c936f1017a7b91f
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class TaskA { public static void main(String args[] ) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
77b2c5783483783a99f8359e8334444e
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.io.*; import java.util.*; public class vkE { static InputReader in = new InputReader(); static String str; static String[] arr; public static void main(String[] args) throws Exception { str = in.readLine(); int n = Integer.parseInt(str.substring(0, str.indexOf(" "))); int k = Integer.parseInt(st...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
bbf60af5c36e0224fe63244e14f8399e
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.util.*; public class e { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(), k = input.nextInt(); boolean[] have = new boolean[10000001]; int[] vals = new int[n]; for(int i = 0; i<n; i++) have[vals[i] = input.nextInt()] = true; in...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
89cb1150373f6b1646b4e816b5d74e42
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class E { static void solve() throws IOException { int n = nextInt(); int k = nextInt(); ...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
4316d8e03d8055725ef350ae7b52928a
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.util.*; import java.io.*; public class E { public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out); new E(new FastScanner(), out); out.close(); } public E(FastScanner in, PrintWriter out) { int N = in.nextInt(); int K = in.nex...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
9a69c688aaf4ba0dd697ce356697d530
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import static java.lang.Math.*; import java.util.*; import java.io.*; public class E { public void solve() throws Exception { int n = nextInt(), k = nextInt(); int[] types = nextArr(n); TreeMap<Long, Integer> m = new TreeMap<Long, Integer>(); for (int i=0; i<n; ++i) for (int j=0; j<=k; ++j) { long s = (...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
cdbbe07277f9c3cc19c046539a781274
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.PrintStream; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import ja...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
51830e307deb715c91d7e2a8b1a841c7
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.util.HashSet; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top * @author Ar...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
ce59192bf9600bfa0fa62516c4380e34
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
//package vk2015.r1; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; public class E2 { InputStream is; PrintWriter out; String INPUT = ""; void s...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
1299c4a410cfe2acc78308854c3054f5
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.util.HashSet; import java.util.Scanner; import java.util.Vector; public class E { public static final boolean DEBUG = false; Scanner sc; public void debug(Object o) { if (DEBUG) { int ln = Thread.currentThread().getStackTrace()[2].getLineNumber(); String fn = Thread.currentThread().getStackTrac...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
fa9bacda84a1bfd0fcb7f70cf52777ce
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.util.InputMismatchException; import java.io.InputStream; import java.util.HashMap; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; /** * Built using CHelper plug-in * Actual solution is at the top * @author George Marcus */ public class Main { public static void ma...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
409293b1888e4fe85610633b16b21f8c
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.util.HashSet; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.math.BigInteger; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.Set; import java.util.StringTokenizer; /** * Built using CHelper plu...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
aff29be5a5086c22387c403fee18d229
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.util.*; public class E { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); Map<Long, Integer> M = new HashMap<Long, Integer>(); long[] A = new long[n]; for(int i=0; i<n; i++) { A[i] = in.nextLong(); ...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
788ef96bd71644273dd7d9d09925ff80
train_003.jsonl
1426946400
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most k bills from it, and the bi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; public class E { static InputStreamReader isr = new InputStreamReader(System.in); static BufferedReader br = new Buffered...
Java
["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15"]
2 seconds
["6\n20\n19\n20\n-1\n3\n-1\n-1", "1\n1\n1\n2\n2\n2\n2\n-1"]
null
Java 7
standard input
[ "brute force" ]
5d8521e467cad53cf9403200e4c99b89
The first line contains two integers n, k (1 ≤ n ≤ 5000, 1 ≤ k ≤ 20). The next line contains n space-separated integers ai (1 ≤ ai ≤ 107) — the denominations of the bills that are used in the country. Numbers ai follow in the strictly increasing order. The next line contains integer q (1 ≤ q ≤ 20) — the number of reque...
1,900
For each request for cash withdrawal print on a single line the minimum number of bills it can be done, or print  - 1, if it is impossible to get the corresponding sum.
standard output
PASSED
129a7c2520870928ecc34fffb565cebb
train_003.jsonl
1603548300
Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ...
256 megabytes
import java.util.*; import java.io.*; public class CodeForcesB { public static void main(String[] args)throws IOException { Scanner sc=new Scanner(System.in); // Scanner sc=new Scanner(new File("../../ip.txt")); int tc,n,i,j,a[][]; tc=sc.nextInt(); while(tc-->0) { n=sc...
Java
["2\n4\n2"]
1.5 seconds
["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
df6ee0d8bb25dc2040adf1f115f4a83b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square.
900
For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any.
standard output
PASSED
0d728c6a704fc768e107d4fd1b652153
train_003.jsonl
1603548300
Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ...
256 megabytes
import java.util.*; import java.util.*; import java.io.*; import java.lang.*; import java.math.BigInteger; public class A { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() ...
Java
["2\n4\n2"]
1.5 seconds
["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
df6ee0d8bb25dc2040adf1f115f4a83b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square.
900
For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any.
standard output
PASSED
2ccb3552746830fd8aaab371935e6b83
train_003.jsonl
1603548300
Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ...
256 megabytes
import java.util.*; import java.util.*; import java.io.*; import java.lang.*; import java.math.BigInteger; public class A { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() {...
Java
["2\n4\n2"]
1.5 seconds
["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
df6ee0d8bb25dc2040adf1f115f4a83b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square.
900
For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any.
standard output
PASSED
391ad2aaa4338e6ffc3d3649f14327e3
train_003.jsonl
1603548300
Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public final class prime_square{ public static void main(String[] args) throws java.lang.Exception{ Reader r = new Reader(); r.init(System.in); int t = r.nextInt(); while(t-->0){ int n = r.nextInt(); ...
Java
["2\n4\n2"]
1.5 seconds
["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
df6ee0d8bb25dc2040adf1f115f4a83b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square.
900
For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any.
standard output