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
c88cf5a50187156c6dd0e87645ff6ba3
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Arrays; public class Cv { //==========================Solution============================// public static voi...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
200ad313ee337c4eaa5d1f13f2a35324
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import static java.lang.Math.*; import static java.lang.System.out; public class Main { static class Reader{ BufferedReader br; StringTokenizer st; public Reader(boolean f) throws IOException{ if(f) { ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
893db2e02c9f041cb89bc50fb2960e5e
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; public class A1609 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int t=0; t<T; t++) { int N = in.nextInt(); int[] A = new int[N]; long power = 1; ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
fa271af5d739ce42fa6487a64d49624a
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args){ new Main().run(); } int N = 20; int a[] =new int[N]; void run() { Scanner sc = new Scanner(System.in); ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
aa7aeff2da262e93c54d00bfb417597e
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class A_Divide_and_Multiply { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int t = sc.nextInt(); while (t-- > 0) { long n = sc.nextLong(), arr[] = sc.readLongArray(...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
f1d255efa508d434035f2dfca447825b
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class DivideAndMultiply { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int test = sc.nextInt(); while (test-- > 0) { int n = sc.nextInt(); int[] nums = new int[n]; for (int i = 0; i < n; i++) { ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
782172c08617c754e65216bed17e7c7a
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); for (int k = 0; k < t; k++) { int n = scn.nextInt(); long[] arr = new long[n]; for (int i = 0; i < n; i++) {...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
b026e4ed51c12e2f0d1d6c44c437854a
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
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 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
b8a345dd9d106a0981d01f03f9af1578
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; //import javafx.util.*; public class Main { static FastReader in = new FastReader(); public static void main(String args[])throws IOException { /* * star,rope,TPST * BS,LST,MS,MQ */ int t = i(); while(t-- > 0){ int n = i(); lo...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
412078c6244f5a69939ce6e20793a207
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; public class Stc { static Scanner scan = new Scanner(System.in); public static void main(String[] args) { int n = scan.nextInt(); while (n-- > 0) A(); } public static void A(){ int n = scan.nextInt(); List<Integer> list = ne...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
4cbfa1ef9f70cd6f91bebf67e9e3c900
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); int test = in.nextInt(); for(int ii = 1;ii<=test;ii++) { long n = in.nextLong(),c = 0; Long a[] = new Long[(int) n]; ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
c335b4c94d04a6bd5be471f42aab9e3b
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.System.*; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; public class pre1{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
172f18af3cb926ddcc92fa1940ab422f
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; public class Prueba { public static void main(String[] args) { int casos, n; Scanner sc = new Scanner(System.in); casos = sc.nextInt(); for(int i=0; i<casos; i++) { n = sc.nextInt(); long[] numeros = new long[n]; for(int j = 0; j<n; j++...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
16fe8b6839adcfe304d218c1128727a2
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; public class Main { public static Scanner reader=new Scanner(System.in); public static void main (String[]args) { ArrayList<Long> numbers=new ArrayList<Long>(); int counter=0; int t=0; int casesNum=0; casesNum=reader.nextInt(); reader.nextLine();...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
25ab08a6cb3b646e94946a245e19e6c6
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; import java.lang.Math; public class MyClass{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int casos = sc.nextInt(); ArrayList<Long> input = new ArrayList<>(); ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
98a331dba90e60eb56a827a3b579e097
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; public class Maximizar_suma{ public static void main(String args[]) { Scanner reader=new Scanner(System.in); int nTimes=0; nTimes=reader.nextInt(); for(int h=0;h<nTimes;h++){ int t=reader.nextInt(); long[] numArray=new long[...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
2eec0a8064f842c83030d467edfde89b
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; public class Main { private static Scanner in = new Scanner(System.in); public static void main(String[] args) { int t = Integer.parseInt(in.nextLine()); for (int i = 0; i < t; i++) { int n = Integer.parseInt(in.nextLine()); String array = in.nextLine(); ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
97de7519b83f896e5a5048be577d7d44
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
//import com.sun.security.jgss.GSSUtil; import java.util.Arrays; import java.util.Scanner; public class forces { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- > 0) { int n = scanner.nextInt(); ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
a8b907fd7223690478c9115b49f1b1aa
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Codeforces { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); int T = Integer.parseInt(br.read...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
946a4b721f0e1c3eb1b41059a554f848
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class fastTemp { public static void main(String[] args) throws IOException, NumberFormatException { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); w...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
936ba0f6ccff6a3310d4019905ee13e9
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.Scanner; public class prob2 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int num = input.nextInt(); int numOfQ = input.nextInt(); input.nextLine(); String s = input.nextLine(); char[] c = s.toC...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
0b06d9b5614c1c2f44aa102e646cd221
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class vigilant2 { static BufferedReader sc = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) throws IOException { String line1 = sc.readLine()...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
0baf4f76b8d79f950ac0008f6a859c13
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; public class Main { private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private FastWriter wr; private Reader rd; public final int MOD = 1000000007; /************************************************** FAST IN...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
6c46e95906524bb9e35f6f303ef06605
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; public class Main { private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private static FastWriter wr; private static Reader rd; public final int MOD = 1000000007; /********************************************...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
125a644f3e6f2b9c2b6de1d805354a32
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; public class Main { private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private static FastWriter wr; private static Reader rd; public final int MOD = 1000000007; /********************************************...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
540b11368ed0b8a1fddfe4eb7d32ff5c
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; public class Main { private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private static FastWriter wr; private static Reader rd; public final int MOD = 1000000007; /********************************************...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
d5ced5b09b41d854c27fc79c7eac8dc3
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static char[] s; static int n; public static void main(String[] args) { FastScanner fs=new FastScanner(); /****** CODE STARTS HERE *****/ //----------------------------------------------------------------------------------------------...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
70653e199117e3b5bf814bbfebc22476
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { FastScanner fs=new FastScanner(); /****** CODE STARTS HERE *****/ //------------------------------------------------------------------------------------------------------------ int cnt = 1; ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
9ddaeb5f952ccf7a3df41dde13d33a79
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.StringTokenizer; import ja...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
54550a9afcb532d9b2b44f391865738a
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Scanner; import java.util.StringTokenizer; public class B { static class RealScanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
babcd842afefb775901a9c532c0a39ab
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static long mod = (int)1e9+7; static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main (String[] args) throws java.lang.Exception { FastReader sc =new FastReader(); ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
f0f0c426ff6771b82e159e71f9dd607a
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static PrintWriter out = new PrintWriter((System.out)); static Kioken sc = new Kioken(); public static void main(String[] args) { int t = 1; solve(); out.close(); } public static void solve() ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
2b93516ba64826a957869fcc1d90ddbc
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class WilliamtheVig { public static void main(String[] args) throws Exception { CustomScanner sc = new CustomScanner(); CustomPrinter cp = new CustomPrinter(); int len = sc.nextInt(); int queries = sc.nextInt(); char[...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
3d71ee2030d40e0734addc76655715d7
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
//package Codeforces.PractiseR1100; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class WilliamVigilant { public static void main(String[] args) throws Exception {new Wil...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
a2629ee2e96e0c50354999da1d539f4b
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException; import java.io.IOException;import java.io.InputStream;import java.io.PrintWriter; import java.security.AccessControlException;import java.util.List;import java.util.TreeSet; public class _B {static public void main(final String[] a...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
797fe1a8110fe122301368dfb66dadfb
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; import java.util.stream.Collectors; import java.text.DecimalFormat; public class A{ static FastScanner scan=new FastScanner(); public static PrintWriter...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
5623860878cc9043c1b2702a7e2eb609
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; public class snackDown3 { public static class FastReader { BufferedReader b; StringTokenizer s; public FastReader() { b=new BufferedReader(new InputStreamReader(System.in)); } String next() { while(s==null...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
a9dd0fdc8a43800ee80ddc5e909a0a34
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class B { void go() { int n = Reader.nextInt(); int m = Reader.nextInt(); char[] s = Reader.next().toCharArray(); int tot = 0; for(int i = 0; i < n; i++) { if(i > 0 && i < n - 1) { if(s[i -...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
02ed953274c5e11617cadf29f855f0aa
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class no { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str1 = in.readLine(); String[] spl = str1.split (" "); int length = Integer.pars...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
bd487c0ef09ab469abdbc92b011a0775
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class no { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str1 = in.readLine(); String[] spl = str1.split (" "); int length = Integer.pars...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
b1e2d7996637d3aa174fe9c43bd4cc95
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.lang.Math; import java.io.* ; public class Account { public static class Pair<Object1 ,Object2> { Object1 key ; Object2 val ; Pair(Object1 key ,Object2 val) { this.key = key ; this.val = val ; } Pair() {} ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
b959430a9a3d0f0b8b503c3daa6e7940
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.File; import java.io.FileInputStream; import java.util.*; public class Main { // static final File ip = new File("input.txt"); // static final File op = new File("...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
da46879ee24cca0462cc35b9dd5c36b3
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class A1{ static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out)); static StringTokenizer st; static final long mod=1000000007; public stat...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
f65cdb391cb6c8ab83ae504719377e30
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class B_William_the_Vigilant { static final int MOD = (int) 1e9 + 7; static final int INT_POSITIVE_INFINITY = Integer.MAX_VALUE; static final long LONG_POSITIVE_INFINITY = Long.MAX_VALUE; stati...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
ade96b5f409360133fa14e4909deff6c
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Solutionb { public static void main(String arg[]) throws IOException { CustomInputReader sc = new CustomInputReader(); PrintWriter pw = new PrintWriter(System.out); int in[] = sc.nextIntArr(2); ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
08619db01929b43eba0a0c6f22493d82
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
// Working program with FastReader import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class B_William_the_Vigilant { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
12d00a2aa7fa32624f1a6a534207c072
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main (String[] args) throws java.lang.Exception { FastReader sc = new FastReader(); //int t = sc.nextInt(); //whi...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
7f079b64c977080367f2d64ee1a0b39b
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
e08a377cd788d30b997a9e9941f1b2b9
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static long mod = (int)1e9+7; static PrintWriter out=new PrintWriter(new BufferedOutputStream(System.out)); public static void main (String[] args) throws java.lang.Exception { FastReader sc =new FastReader(...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
4f32f32a36a50582e9cb102b4520729f
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class William { static BufferedReader br; static PrintWriter pw; static StringTokenizer token; static int length; static int numQueries; static char[] s; static int numABC; public static void main(String args[]) throws IOException { ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
987430812c0892a95e0959e98c9430ce
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class William { static BufferedReader br; static PrintWriter pw; static StringTokenizer token; static int length; static int numQueries; static char[] s; static int numABC; public static void main(String args[]) throws IOException { ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
3eaeeaa605f67458b2ae5c672cfd40f5
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Double.parseDouble; import static java.lang.Math.PI; import static java.lang.Math.min; import static java.lang.System.arraycopy; import static java.lang.System.exit; import static java.util.Arrays.copyOf; ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
72de052c23dc6be2b03a2a93c393aaa4
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main{ //見なくていいよ ここから------------------------------------------ static class InputIterator{ ArrayList<String> inputLine = new ArrayList<>(buf); int index = 0; int max; String read; InputIterator(){ BufferedReader br = new BufferedRe...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
d378b8c99268f2deddcf8a7aa9b2d3e1
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main{ //見なくていいよ ここから------------------------------------------ static class InputIterator{ ArrayList<String> inputLine = new ArrayList<>(buf); int index = 0; int max; String read; InputIterator(){ BufferedReader br = new BufferedRe...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
7495222642a615debde2b2c8a3225291
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class InputReader { BufferedReader reader; StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } String next() { // reads i...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
f0a608337faf886a3766bc4b83dc3d5b
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class Main{ public static void main (String[] args){ Scanner in=new Scanner(System.in); int n=in.nextInt(),q=in.nextInt(),i,r=0; char s[]=in.next().toCharArray(); char c; for(int j=0;j<n-2;j++) if(s[j]=='a' && s[j+1]=='b' && s[j+2]...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
0219bc19c90c131a445ea356986f0b87
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.Scanner; public class ProblemB { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int stringLine = scanner.nextInt(), queriesCount = scanner.nextInt(); scanner.nextLine(); char[] str = scanner.nextLine().toCharArray(); ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
1be13f005d997193c82905c8b5f1103f
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { private static boolean arr[] = sieve(1000001); private static ArrayList<Long> primes = new ArrayList<>(); private static int freq[] = new int[200005]; private static int mod = (int) (1e9 + 7); private static final int IMA...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
bde75a57d0f1a55a32f3b87e21d5c47f
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { private static boolean arr[] = sieve(1000001); private static ArrayList<Long> primes = new ArrayList<>(); private static int freq[] = new int[200005]; private static int mod = (int) (1e9 + 7); private static final int IMA...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
44be8f52e296e69bb0109d39c33093b7
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class DeltixRound2 { static FastScanner fs; static FastWriter fw; static boolean checkOnlineJudge = System.getProperty("ONLINE_JUDGE") == null; private static final int mod = (int) (1e9 + 7); private st...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
0c87dfef44e70b337552126c2c17fe68
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class Main { static long mod = 1000000007; static long max ; static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main(String[] args) throws IOException { FastReader sc = new FastReader(); int t = 1; wh...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
958388c1935eff6edde806b1ac4ebcd4
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
/* 🅻🅴🅰🆁🅽🅸🅽🅶 */ //✅// import java.util.*; import java.io.*; import java.lang.*; public class B { static FastReader sc = new FastReader(); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) throws Exception { // int t = sc.nextInt(); /...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
4dba95af1cd0bd44ffcd52fef77bbe22
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class ProblemB { public static void main(String[] args) throws Exception { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(f.readLine()); in...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
63a81800e76456b5e0f40a8f512f5867
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.lang.*; public class b { // static int mod = 998244353; static int mod = 1000000007; private static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
7e0690629acd31b455f9cf60089a35b7
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
/* Codeforces Problem 1609B */ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class WilliamVigilant { public static void main(String[] args) throws IOException { FastIO in = new FastIO(System.in); int n = in.nextInt(); int q = in.nextInt(); ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
9e445ff53f22f06f7e6c256d54b8622f
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class xorspecialist { static Scanner sc=new Scanner(System.in); static PrintWriter out=new PrintWriter(System.out); public static void main(String[] args) { long t=1; while(t-->0){ solve(); } o...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
96bb08a15a5847646b04443b89a7aaa2
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class practice { static char vowels[] = new char[]{'a', 'e', 'i', 'o', 'u'}; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new Print...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
c0c715c958c68ce5c2b77d2f905d5bb0
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Random; import java.util.StringTokenizer; /* */ pub...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
088e4fa3ec8a495bd450daf851508702
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
//package cp; import java.io.*; import java.util.*; public class ProblemA{ static long mod = 1000000007L; // map.put(a[i],map.getOrDefault(a[i],0)+1); // map.putIfAbsent; static MyScanner sc = new MyScanner(); //<----------------------------------------------WRITE HERE---------------...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
18c7974a53d8db0f16f3831b9103975f
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; //import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; public class Algorithm { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); // ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
da74597c97212dec09702e679dac7b24
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; public class B_William_the_Vigilant { public static void main(String[] args) { OutputStream outputStream = System.out; Prin...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
a3750f98fbbe8d891fb7bf1d1f1716ef
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
//package com.company;//comment this line while submitting the answer otherwise you'll get WA; //not all import are used to solve every problem .. but these are the most important one import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; imp...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
ac4a6b81ae643e917f2d16c390ab58d6
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
/** * @author -- Sourav Joshi */ import java.io.*; import java.util.*; import static java.lang.Math.*; public class Solution { /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
83c3dc06b01a1ae1b1ce8ca6e93d2b8a
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; public class William_The_Vigilant { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int q = sc.nextInt(); String str = "abc"; Pair arr[] = new Pair[q]; sc.nextLine(); String s = sc.n...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
c0ac7a26785e88793259d2f96e6ed961
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; public class HelloWorld{ public static void main(String []args){ Scanner sc=new Scanner(System.in); // while(t-->0){ int n=sc.nextInt(); int q=sc.nextInt(); String str=sc.next(); int ans=0; StringBuilder sb...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
9eacb7d8c51d98bd4dc75acf855b47f1
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
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 sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); St...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
25fdb3fbc6b02566a6df18e86f885af4
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.*; public class Codeforces { static int mod= 1000000007; static int ans=0; public static void main(String[] args) throws Exception...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
2a3125a4286dd7488cfb9057d9d48088
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.HashSet; import java.io.Writer; import java.io.OutputStreamWr...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
7a083ebed48645f0371e02ccec834dbd
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; import java.util.*; public class D { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
47aa7381337ab2ada961da458184cc3e
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
fa6e4740dbb03f422e3db961ac52c35b
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; public class abcary { public static void main(String arg[]) { Scanner Sc=new Scanner(System.in); int n=Sc.nextInt(); int q=Sc.nextInt(); Sc.nextLine(); String S=Sc.next(); int abc=0; char ar[]=new char[n]; for(int i=...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
c36d2185c228cd9aea3ae21df21cf3da
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class WilliamTheVigilant1609B { public static void main(String[] args) throws IOException ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
91d25ddf8366911a2bcb2e8bfd5903da
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
// package cf_1609b; import java.util.Scanner; /** * * @author MRayhanFerdousFaisal */ public class Cf_1609b { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int n = cin.nextInt(); int m = cin.nextInt(); char str[] = cin.next(...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
294cfc8d7a3fd73bd59e3525a2d53f86
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class Sol { public static boolean solve(char c[],int pos) { if(pos+2>=c.length) return false; if(c[pos]=='a' && c[pos+1]=='b' && c[pos+2]=='c') return true; else return false; } public static void main(String[] args) throws IOException { Scanner sc=new Sc...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
8f2fed9641d94c2196723e36ecbc7217
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
// हर हर महादेव import java.util.*; import java.lang.*; import java.io.*; import java.math.BigInteger; import java.text.DecimalFormat; public final class Solution { static int inf = Integer.MAX_VALUE; static long mod = 1000000000 + 7; static int count=0; static void ne(Scanner sc, BufferedWri...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
2faae4aa95cc114fb96f116de9531a9b
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; // @author : Dinosparton public class test { static class Pair{ long x; long y; Pair(long x,long y){ this.x = x; this.y = y; } } static class Sort implements Comparator<Pa...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
e3da8fa5e9f5de8abc6ac59bc9bd2a73
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Main { static class Pair { int l,r,x; public Pair(int l,int r,int x) { this.l=l; this.r=r; this.x=x; } } static int...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
6b5a3a727868ffdd6e23b1e8649e17fe
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class B { private static boolean hasString(int index, char[] s) { for(int i = index-2; i <= index; i++) { if(i >= 0 && i < s.length-2) { if(s[i] == 'a' && s[i+1] == ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
897edad5af0dadbae0ab5f8a964a5dce
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String[] args) { Scanner obj = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int len = 1; while (len-- != 0) { int n = obj.nextInt(); ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
9f556316666b55c6a3bb3091a5cc9d9b
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
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 {static class FastReader { BufferedReader br; StringTokenizer st; pub...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
ed0d2b6e17107f2dc7817a1b7ab4bba8
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
// package c1609; import java.io.File; import java.lang.invoke.MethodHandles; import java.util.Arrays; import java.util.Random; import java.util.Scanner; // // Deltix Round, Autumn 2021 (open for everyone, rated, Div. 1 + Div. 2) 2021-11-28 06:35 // B. William the Vigilant // https://codeforces.com/contest/1609/probl...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
b608d0339f3054869531778c69dbfeb3
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; public class Codeforces { // public static void main(String[] args) { // Scanner scanner = new Scanner(System.in); // int T = scanner.nextInt(); // // while (T-- > 0) { // int N = scanner.nextInt(); // long[] arr = new long[N]; // ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
833c71e92558da7df3c809f596236fb9
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
/* بسم الله الرحمن الرحيم /$$$$$ /$$$$$$ /$$ /$$ /$$$$$$ |__ $$ /$$__ $$ |$$ |$$ /$$__ $$ | $$| $$ \ $$| $$|$...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
54772a016adddc38f0549a71022a3860
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class C{ public static void main(String[] args) { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = 1; for(int tt=0;tt<t;tt++) { int n = fs.nextInt(); int q = fs.nextInt(); String str = fs.next(); char[...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
bec03864a5fcb07bccd4854d2fba6a4e
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
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 Main { public static void main(String[] args) { FastReader fastReader = new FastReader(); Prin...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
a0ccf1e1718edbb77119a56754ea27d0
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.util.InputMismatchException; /** * @author ethan55 */ public class Solution { public static void main(String[] args) { TestRunner.run(); } public static class TestCase { static f...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
c3f2c0916aff5e34d37972ee8d03075d
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
/* "Everything in the universe is balanced. Every disappointment you face in life will be balanced by something good for you! Keep going, never give up." */ import java.util.*; import java.lang.*; import java.io.*; public class Solution { static int...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
863f20668dd505a4b7d6d75b58c74daa
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); public static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); public static int mod = (int)1e9+7; public static void main(...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
487494d627c29aa3be004a3515e47306
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
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; /** * * @author eslam */ public class WilliamTheVigilant { static class FastReader { BufferedR...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output
PASSED
91345b61170e3bfb9e9839a9c3a5df52
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class DeltixB { static char[] s; public static void main(String[] args) { JS scan = new JS(); PrintWriter out =new PrintWriter(System.out); int n = scan.nextInt(); int q = scan.nextInt(); s = scan.next().toCharArra...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 11
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
1,100
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a substring.
standard output