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
7715077a92a895dfdee9e6d70d6f7608
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.StringTokenizer; public class B { static FastScanner sc = new FastScanner(); static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); static void solve(){ int n = sc.nextInt(); int q = sc.nextInt(); char[]chars...
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
9a6419802e50fad94c8c5b7a6549260a
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.text.*; import java.math.*; import java.util.regex.*; public class JaiShreeRam{ static Scanner in=new Scanner(); static long mod = 1000000007; static ArrayList<ArrayList<Integer>> adj; public static void main(String[] args) throws Exception{ //int z...
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
4fc6927fe3f9166b588af23d4ea3dae2
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 B { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(); int qs = sc.nextInt(); char[] s = sc.next().toCharArray(); int count = 0; for(int i = 0; i < n-2; i++) { if(s[i] == 'a' && s[i+1] == 'b' && s[i+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
835d5090b28b7fbe6ddbd3c7a8afb3f7
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 B1609 { public static void main(String[] args) { FastScanner sc = new FastScanner("in.txt"); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); int q = sc.nextInt(); char[] s = sc.nextLine().toCh...
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
891681e9d95f768ddfa3deaed9b77ce0
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 boolean prime[] = new boolean[25001]; // public static int Lcm(int a,int b) // { int max=Math.max(a,b); // for(int i=1;;i++) // { // if((max*i)%a==0&&(max*i)%b==0) // return (max*i); // } // } // public static Str...
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
8a3402da55bbf06cbbc7f8d2c0a35348
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 TimePass { public static void main (String[] args) throws java.lang.Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(System.out); int testCases=1; while(testCases--...
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
3c0a17df2511dd882f97083c5e5ce256
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 final PrintWriter out =new PrintWriter(System.out); static final FastReader sc = new FastReader(); //I invented a new word!Plagiarism! //Did you hear about the mathematician who’s afraid of negative numbers?He’l...
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
ec941107f393912a7569184458e9c6bb
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 TimePass { public static void main (String[] args) throws java.lang.Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(System.out); int testCases=1; while(testCases--...
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
e1396c0388ab84ac11cda531fd3e05d9
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 whatever //do not write package name here */ import java.io.*; import java.util.*; import java.util.Scanner; public class Gfg{ public static void main(String args[]){ Scanner s = new Scanner(System.in); int size = s.nextInt(); int q = s.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
aef0eaa6fa16365deac040379c081a5f
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
//Utilities import java.io.*; import java.util.*; public class a { static int t; static int n, q; static char[] a; static int cnt; static int pos; static char newC; public static void main(String[] args) throws IOException { t = 1; while (t-- > 0) { n = in.iscan(); q = in.iscan(); 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
2e828a6a7b9997fdf970f130ba92cb71
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.Arrays; import java.util.Scanner; import java.util.stream.Collectors; import java.util.stream.IntStream; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); sc.nextInt(); int q = sc.nextInt(); String s = sc.next(); int[] positions = ...
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
08b1293e6c07ecfbc2eb53d3f7457912
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.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(); Pr...
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
0ed1a48154efe77e1572a48371b6253c
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
/***** ---> :) Vijender Srivastava (: <--- *****/ import java.util.Queue; import java.util.LinkedList; import java.util.*; import java.lang.*; // import java.lang.reflect.Array; import java.io.*; public class Main { static FastReader sc =new FastReader(); static PrintWr...
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
75959ff83475029a3e69f274f7be4e85
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 test { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pr = new PrintWriter(new OutputStreamWriter(System.out)); // long t = Long.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
3c7f2dbcde75a688f9e98961c31fea63
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
/** * B_William_the_Vigilant */ import java.util.*; import java.io.*; public class B_William_the_Vigilant { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new Inp...
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
939e038e2afff541a52b716482db357a
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 Willian_The_Viligant_1609B { public static void main(String[] args) { Scanner Sc = new Scanner(System.in); int n = Sc.nextInt(), q = Sc.nextInt(); String s = Sc.next(); char[] list = s.toCharArray(); int count = 0; for(int i = 0; i < n - 2; 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
e1ee59a779c2c2d13479f7c9f60ff782
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.lang.reflect.Array; import java.util.*; import java.lang.*; import java.io.*; public class practice { public static void main(String[] args) throws IOException { Reader.init(System.in); int n = Reader.nextInt(); int q = Reader.nextInt(); String s = Read...
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
1b25cf078aa0384cae4eda9cf7ddb8a9
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 practice; import java.io.*;import java.util.*; public class Main { static int fun(String s) { int c=0; for(int i=0;i<s.length()-2;i++) { if(s.substring(i,i+3).equals("abc")) c++; } return c; } static boolean check(int i, char[] s) { int n = s.length; if(i >= 2) if(s[i-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
b19cd95b21767a9441148c6472815ae8
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 Set<Integer> sieve; public static void main(String[] args) { MyScanner s = new MyScanner(); // int testcases=s.nextInt(); // sieve(); // while(testcases-->0) { 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
b89b6bf59ca58cf1ae00d9942a8cba04
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.codeforces.Practise; import java.io.*; public class WilliamTheVigilant { //Don't Confuse Always make things simple //Experience is the name of the game // You won't fail until you stop trying....... // you can solve one problem by many approaches. when you stuck you are going to ...
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
4e44f432a62f3e6e424e32ad80bdddca
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 { public static void main (String[] args) throws IOException { Kattio io = new Kattio(); int n = io.nextInt(); int q = io.nextInt(); String s = io.next(); int total = 0; for (int i=0; i<n-2; i++) { if (s.substring(i, i+3).equals("abc")) { tot...
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
6f27c905b8cf5d82a180a5c7ba234d1d
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 B { static FastScanner fs = new FastScanner(); static PrintWriter pw = new PrintWriter(System.out); static StringBuilder sb = new StringBuilder(""); final static int N = (int) 2e6 + 1; static long n, q; static char[] c = new char[N]; static int cnt ...
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
bf59f91f030a7c7432fd5d7f8adcc479
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
/* _oo0oo_ o8888888o 88" . "88 (| -_- |) 0\ = /0 ___/`---'\___ .' \\| |// '. / \\||| : |||// \ / _||||| -:- |||||- \ ...
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
15fe81ee8fda471e69400b0e06a3edd4
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.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.uti...
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
db22a6b674774622c6f3b384f48a7f48
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.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.uti...
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
42660617e83d1bd897381661dc306166
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.BigInteger; import java.util.*; public class Main { static int MOD = 1000000007; // After writing solution, quick scan for: // array out of bounds // special cases e.g. n=1? // npe, particularly in maps // // Big numbers arithmetic bugs: // 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
b571281f481d7425098e97421223af8d
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 WilliamVigilant { static final int MOD = (int) 1e9 + 7; static boolean abc(char []c,int pos){ if(pos+2>=c.length) return false; return c[pos]=='a'&&c[pos+1]=='b'&&c[pos+2]=='c'; } 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
f9f43d52a7bddfeb7950842933073666
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 Contest2; import java.util.Scanner; public class WilliamTheVigilant { static StringBuilder sb; public static void main(String[] args) { Scanner scan = new Scanner(System.in); int len = scan.nextInt(); int queries = scan.nextInt(); scan.nextLine(); sb = new StringBuilder(scan.nextLine(...
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
2042a99f02f238dededf422952c5e7a3
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 { public static void main(String[] args) { FScanner sc = new FScanner(); //int t=sc.nextInt(); // while(t-->0) { int n=sc.nextInt(); int q=sc.nextInt(); String s=sc.next(); int count=0; for(int i=0;i<n-2;i++) { if(s.charA...
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 8
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
82b5e0d931b58336eb50331c83c85487
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
/* Challenge 1: Newbie to CM in 1year (Dec 2021 - Nov 2022) 5* Codechef Challenge 2: CM to IM in 1 year (Dec 2022 - Nov 2023) 6* Codechef Challenge 3: IM to GM in 1 year (Dec 2023 - Nov 2024) 7* Codechef Goal: Become better in CP! Key: Consistency and Discipline Desire: SDE @ Google USA...
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 8
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
c57331895ee23dda3365747a34dd9373
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.*; /* Challenge 1: Pupil to CM in 1year (Dec 2021 - Nov 2022) 🔥 5* Codechef Challenge 2: CM to IM in 1 year (Dec 2022 - Nov 2023) 🔥🔥 6* Codechef Challenge 3: IM to GM in 1 year (Dec 2023 - Nov 2024) 🔥🔥🔥 7* Codechef Goal: Become better ...
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 8
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
c78431a4fbaa3a85d7c5c98cf9908af0
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.*; public class Main { static final int INF = 0x3f3f3f3f; static final long LNF = 0x3f3f3f3f3f3f3f3fL; public static void main(String[] args) throws IOException { initReader(); int n=nextInt(); int q=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 8
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
97ad89df89735351c42ece748f7d6f99
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.*; public class Codechef { static int[] num_to_bits = new int[] { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; static int co...
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 8
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
60d22d6f8cc39ff4fcdf6649151df358
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; /* * * @author Sabirov Jakhongir * */ public class Simple { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int n = cin.nextInt(); int m = cin.nextInt(); char a[]; String s = cin.next(); 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 8
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
5c3842e9b29b9ff413f4f0a694eb9caf
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 Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int q = scanner.nextInt(); char[] chars = new char[n]; scanner.nextLine(); chars = scanner.nextLine()....
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 8
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
de3a3d5ef2f0dcaa210838c62dba0728
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 B { public static void main(String[] args) throws IOException { Reader sc = new Reader(); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); int q = sc.nextInt(); char[] arr = sc.next().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 8
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
32ad6d81dbed7855680994e07cdc32cc
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.Arrays; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Scanner; public class xoxo { public static void main(String[]args){ FastScanner c = new FastScanner(); int a =c.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 8
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
b78779b311a334fd40589c3d239ae4f0
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.Arrays; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Scanner; public class xoxo { public static void main(String[]args){ Scanner c = new Scanner(System.in); int a =c.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 8
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
9e45a7d6a3652c917d117e8f671894a2
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.*; public class a729 { public static void main(String[] args) { // try { BufferedWriter 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 8
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
28fe4370f81d29ba6b4bfd1cef446c5b
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 { public static void main(String[] hi) { FastIO io = new FastIO(); int n = io.nextInt(), q = io.nextInt(); char array[] = io.next().toCharArray(); int count = 0; int[] v = new int[array.length]; for (int i=0; i<n-2; i++) { if ...
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 8
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
933bfab729d7a5c7937e7347136a2190
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.BigInteger; import java.util.*; import java.lang.*; import static java.lang.Math.*; // Sachin_2961 submission // public class Codeforces { static void solve() { int n = fs.nInt(), q = fs.nInt(); char[]str = fs.n().toCharArray(); int count ...
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 8
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
f575b931216ee5ac0b9680199f11a867
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.util.stream.LongStream; import java.io.*; import java.lang.reflect.Array; import java.math.*; public class Main{ public static void main(String[] args) { FastReader fr = new FastReader(); PrintWriter out = new PrintWriter(System.out); Scanner sc= new Scann...
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 8
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
16b5d779c26d26867c16e8ff8acea655
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 WilliamTheVigilant { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } Str...
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 8
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
6763faf623147455661ba7fd4c57dfda
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 a { public static void main(String[] args){ FastScanner sc = new FastScanner(); int t = 1; while(t-- > 0){ int n = sc.nextInt(); int q = sc.nextInt(); String s = sc.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 8
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
2389af08f99dbd295610b1eb58523dad
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 CFsolve { public static void main(String[] args) { FastScanner input = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(); int q = input.nextInt(); StringBuilder str = new StringBu...
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 8
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
19bb8f704b5d5ecbc337ab2b782cb953
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.*; public class Solution { static int t; static int n; static int q; static int[] a; static String s; static FastReader fr = 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 8
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
5b1c50866b81b6365bd0dbdcc3196528
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.StringReader; import java.lang.reflect.Array; import java.math.BigInteger; import java.text.ParseException; import java.text.SimpleDateFo...
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 8
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
3cc659b46c403abd263713c0fa8a27e9
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.BigInteger; //code by tishrah_ public class _practise { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String 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 8
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
01a0d26348474e311485fbbe61ef4005
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 contest.DeltixRoundAutumn2021; import java.io.*; import java.util.*; /*********************** @oj: codeforces @id: hitwanyang @email: 296866643@qq.com @date: 2021/11/28 23:07 @url: https://codeforc.es/contest/1609/problem/B ***********************/ public class B1609 { InputStream is;...
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 8
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
33826a0d4347490f9664c5893eaff2cf
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 { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = in.nextInt(), q = in.nextInt(); char[] s = in.next().toCharArray(); int res...
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 8
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
2d9316903e22559f0f6dafd8fafd599a
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 { public static void main(String args[]){ FScanner in = new FScanner(); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int q=in.nextInt(); char s[]=in.next().toCharArray(); int arr[]=new int[100001]; long c=0; for(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 8
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
e0242650a16bcb5710acfbb595dcaf65
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.StringTokenizer; public class B { static BufferedReader br; static StringTokenizer st; static PrintWriter pw; static String nextToken() { try { ...
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 8
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
640f38912a0bb99476e073d8d97d3c46
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 { public static void main(String[] args) { //for (int t = IO.nextInt(), i = 0; i < t; i++) new SolB().solve(); IO.close(); } } class SolB { int n, q; char[] s; SolB() { n = IO.nextInt(); q = IO.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 8
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
91efcb7676e783ce0ebdca2e3c553fbf
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 WilliamAndVigilant { public static void main(String[] args) { FastReader in=new FastReader(); PrintWriter out=new PrintWriter(System.out); int n=in.nextInt(); int q=in.nextInt(); String s=in.nextLine(); ...
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 8
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
2d0efa68b75e55d592cedf0163d3e166
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.StringTokenizer; import java.util.TreeSet; import static java.lang.System.out; public class pre80 { static class FastReader { BufferedReader br; StringTokenizer st; public FastRea...
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 8
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
9ec2b236a970af0f00851484de1d9c80
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 WilliamTheVigilant { static int count(char[] s , int n){ int ans = 0; for(int i=0; i<n ;i++){ if(s[i] == 'a' && i<n-2) if(s[i+1] == 'b' && s[i+2] == 'c') ans++; } return ans...
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 8
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
a4a5054e18bf0f6690a4a7e8f108afd2
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.StringTokenizer; public class Solution { public static void main(String[] args) throws Exception { Solution solution = new Solution(); solution.solve(); //solution.tes...
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 8
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
ff6d94d4374ad8dbca0b2bf16ef29b9f
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.StringReader; import java.lang.reflect.Array; import java.math.BigInteger; import java.text.ParseException; import java.text.SimpleDateFo...
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 8
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
6bf5cdb7c26e91f6c55ddc52a418b9f9
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 Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc = new Scanner(System.in); int n = 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 8
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
2b3852cf863536ce99c60f1ac3bdf812
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 Dec8A { static boolean[] isPrime; public static void main(String[] args) { FastScanner sc=new FastScanner(); TreeSet<Integer> st=new TreeSet<>(); int n=sc.nextInt(); int q=sc.nextInt(); String str=sc.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 8
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
0efeb2ddbfff936ac3baa73b75edec4a
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 MyCpClass{ public static void main(String []args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); String []ip = br.readLine().trim().spli...
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 8
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
b64a2c898f67be706ac2c0367bac7a1b
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
// Online Java Compiler // Use this editor to write, compile and run your Java code online import java.io.*; public class HelloWorld { static int count = 0; public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(Sy...
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 8
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
4d99e3ea86906d9d2b48aed9b150a201
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 Contest_yandexA{ public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int q = input.nextInt(); char[] c = input.next().toCharArray(); int count = 0; for(int i = 0;i<=n-3;i++){ if(c[i] == 'a' && c[i+1] == 'b...
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 8
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
ecc0e90c4f9df2ae087a2af2beba8698
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.deltix_autumn; import java.io.*; import java.util.*; import static java.lang.Math.*; //Think through the entire logic before jump into coding! //If you are out of ideas, take a guess! It is better than doing nothing! //Read both C and D, it is possible that D is easier than C for you! //Be awar...
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 8
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
e58d00ad876c263e2e6382d2cd6c76ea
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 Grow13 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int q = sc.nextInt(); String str = sc.next(); char cha[] = str.toCharArray(); ArrayList<Integer> ans = new ArrayList<>(); int res = Find(cha, 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 8
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
d29236f7ffe0752c80cacba25250bd11
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 Main { BufferedReader in; PrintWriter out; Main() { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); } void solve() throws IOExcept...
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 8
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
dd1d60239bad7f893ca55010a14f0685
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 Wiliam{ public static boolean funl(char ar[], int i,int n){ if (i-2<0) return false; if (ar[i-2]=='a' && ar[i-1]=='b' && ar[i]=='c') return true; return false; } public static boolean funm(char ar[], int i,int n){ if (i-1<0) return fal...
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 8
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
bfb3be922299cde271ab9b3036a95875
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.*; public class A { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(), q = sc.nextInt(); char[] s = sc.next().toCharArray(); int count = 0; ...
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 8
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
e680c7834da63c615cf2f3568adb32ed
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; import java.io.FileInputStream; import java.io.InputStream; import java.io.StringReader; import java.util.*; public class Main { public static class Dsu{ int[] parent; Set<Integer>[] rest; Set<Integer>[] restrictions; D...
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 8
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
6be15d4cae0fa3b8ab7ce5dbaccbe5dc
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.*; import static java.lang.Math.max; import static java.lang.System.*; import static java.util.Arrays.parallelSetAll; import static java.util.Arrays.sort; import static 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 8
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
5a06a45bee0ba26c0778909f17ea0c08
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 Problem2 { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int n = sc.nextInt(); int q = 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 8
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
b30fc2e8882e66810be5c2224decf0c3
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 A { //--------------------------INPUT READER---------------------------------// static class fs { public BufferedReader br; StringTokenizer st = new StringTokenizer(""); public fs() { this(System.in); } public fs(Inpu...
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 8
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
0280c60369275f21c7301589c4b60fdf
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.io.OutputStream; import java.io.IOException; import java.util.InputMismatchException; import java.io.InputStreamReader; import java.util.TreeSet; import java.io.Writer; import java.io.BufferedRea...
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 8
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
0ccfc97e715c7b4d511b062348a87a97
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.PrintWriter; // System.out is a PrintStream import java.util.InputMismatchException; public class B { private static int MOD = (int)1e9 + 7, mod = 99_82_44_353; private static double PI = 3.14159265358979323846; public static void ma...
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 8
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
9ff196fd6c914e6fda057d570432c4de
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 A { FastScanner in; PrintWriter out; boolean systemIO = true; public class Fenvik { long[] sum; public Fenvik(int n) { sum = new long[n]; } public void add(int x, long d) { for (; x < sum.length; x = (x | (x + 1))) { sum[x] +=...
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 8
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
366f297302a6df24540295436cfb4060
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.StringTokenizer; public class William_the_Vigilant { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Re...
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 8
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
98f798ba303aab5c46d3ab74d1e96de2
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) { Scanner in = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = in.nextInt(), query = in.nextInt(); char ch[] = in.next().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 8
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
79fdda8c742e308e72813e0afbaaa2f6
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 Scanner sc = new Scanner(new BufferedInputStream(System.in)); static int sc(){return sc.nextInt();} static long scl(){return sc.nextLong();} static double scd(){return sc.nextDouble();}; static String scs(){return sc.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 8
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
3041e8e761d09b6d7c2f62840d50f3cd
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 B1609 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = in.nextInt(); int Q = in.nextInt(); char[] S = in.next().toCharArray(); int count = 0; for (int n=2; n<N; 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 8
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
c91a905be81890f43851fbaed73ceefa
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 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 n = i(); int q = i(); String s = in.nextL...
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 8
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
81a070d80a700d08f4cf833fdd79cdc7
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 WilliamTheWigilant{ static long mod = 1000000007L; static MyScanner sc = new MyScanner(); static void solve(){ int n = sc.nextInt(); int q = sc.nextInt(); char arr[] = sc.nextLine().toCharArray(); int count = 0; ...
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 8
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
814e7cb742f681ad82c036fa70dc2fd9
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 code { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); int q=sc.nextInt(); StringBuilder s=new StringBuilder(sc.next()); int count=0; for (int j = 2; j<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 8
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
cb60e390397ed120e09421891f528a72
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 WilliamTheVigilant { public static void main(String[] args) { new WilliamTheVigilant().run(); } BufferedReader br; PrintWriter out; long mod = (long) (1e9 + 7), inf = (long) (3e18); class pair { int F, S; ...
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 8
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
a0cd9209a3e9a194dc0473861b2ccb41
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 { public static void main(String[] args) throws Exception { int tc = 1; for (int i = 0; i < tc; i++) { solve(); } io.close(); } private static void solve() throws Exception { 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 8
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
20f79e6cc04e78d6666037b377280c80
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.*; import java.math.BigInteger; public final class A { static PrintWriter out = new PrintWriter(System.out); static StringBuilder ans=new StringBuilder(); static FastReader in=new FastReader(); static ArrayList<Integer> g[]; static l...
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 8
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
f03b43cb6ce16062571a39ee87bbc8cc
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.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; ...
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 8
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
c342ff092a8b6a21f9802d15cd8cc9c6
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 a { public static void main(String[] args){ FastScanner sc = new FastScanner(); int t = 1; while(t-- > 0){ int n = sc.nextInt(); int q = sc.nextInt(); String s = sc.next(); char arr[] = ne...
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 8
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
248b9155e3446e0be521de0266ba12fe
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 cf { static FastReader in=new FastReader(); static final Random random=new Random(); static long mod=1000000007L; static HashMap<String,Integer>map=new HashMap<>(); public static void main(String args[]) throws IOException { Fast...
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 8
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
604c1a267c906bd90121e210c840afc2
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.nio.Buffer; import java.util.Scanner; public class fastTemp { public static void main(String[] args) throws IOException,NumberFormatException { BufferedReader br = new BufferedReader(new 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 8
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
17f46dbcfa0f4d4f5ef4ae538b2f9d83
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
/* stream Butter! eggyHide eggyVengeance I need U xiao rerun when */ import static java.lang.Math.*; import java.util.*; import java.io.*; import java.math.*; public class x1609B { public static void main(String hi[]) throws Exception { BufferedReader infile = new BufferedReader(new Inp...
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 8
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
35eb7a8e479c2a2764e3e2a62d4ab571
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 WilliamTheVigilant { public static void main(String[] args) throws IOException { FastIO fr = new FastIO(); PrintWriter pr = new PrintWriter(new OutputStreamWriter(System.out)); int n = fr.nextInt(); int q = fr.nextInt(); int count = 0; ...
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 8
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
91693aecc4eb83ef43b1854bf3b13fd6
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.*; public class CF1 { public static void main(String[] args) { FastScanner sc=new FastScanner(); // int T=sc.nextInt(); int T=1; for (int tt=0; tt<T; tt++){ ...
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 8
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
276bebee6fdcec48e2cca0ef7d3801cb
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.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Random; ...
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 8
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
8291fa70d26fa08903b903401569c89b
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 B_William_the_Vigilant{ public static void main (String[] args){ FastReader s = new FastReader(); int t=1;//t=s.ni(); for(int test=1;test<=t;test++){ int n=s.ni(),q=s.ni();int ans=0; String S...
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 8
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
e7e27e1f38e43ba9260d3439f5b985b2
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.BigDecimal; import java.util.*; public class Main { private static final int ma = (int) 2e5 + 10; static char[] str; public static void main(String[] args) throws Exception { initReader(); int n=nextInt(); int q=nextInt(); 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 8
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
07d683adf4b57c7041e9ed09c18b4314
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 boolean f=false; public static void main (String[] args) throws java.lang.Exception { Scanner ...
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 8
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
4ab909ffe82f9e13e5d44914fdf5ed2c
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; public class DeltixRoundB { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); args=(br.readLine()).split(" "); ...
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 8
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
3c6e3faaa61edadf67052a859e6011e8
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 WilliamVigilant{ public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int q = input.nextInt(); char[] c = input.next().toCharArray(); int count = 0; for(int i = 0;i<=n-3;i++){ if(c[i] == 'a' && c[i+1] == 'b...
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 8
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
8a0fa186989502560ba0b2f81d7f7312
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.math.BigInteger; import java.sql.Time; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util...
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 8
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
60bb2ddc56c256c52cb812b97a1a1228
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: RonWonWon * CREATED: 01.12.2021 01:20:35 /*==========================================================================*/ import java.io.*; import java.util.*; public class B { public static void main(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 8
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