message
stringlengths
2
23.8k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
97
109k
cluster
float64
0
0
__index_level_0__
int64
194
217k
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a set of strings S. Each string consists of lowercase Latin letters. For each string in this set, you want to calculate the minimum number of seconds required to type this string. To type a string, you have to start with an em...
instruction
0
25,725
0
51,450
Tags: data structures, dfs and similar, dp Correct Solution: ``` import io import os DEBUG = False def dfs(trie, root, preorder=None, postorder=None): stack = [root] seen = set() while stack: nodeId = stack.pop() if nodeId not in seen: if preorder: preorder(nod...
output
1
25,725
0
51,451
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a set of strings S. Each string consists of lowercase Latin letters. For each string in this set, you want to calculate the minimum number of seconds required to type this string....
instruction
0
25,726
0
51,452
No
output
1
25,726
0
51,453
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a set of strings S. Each string consists of lowercase Latin letters. For each string in this set, you want to calculate the minimum number of seconds required to type this string....
instruction
0
25,727
0
51,454
No
output
1
25,727
0
51,455
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a set of strings S. Each string consists of lowercase Latin letters. For each string in this set, you want to calculate the minimum number of seconds required to type this string....
instruction
0
25,728
0
51,456
No
output
1
25,728
0
51,457
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a set of strings S. Each string consists of lowercase Latin letters. For each string in this set, you want to calculate the minimum number of seconds required to type this string....
instruction
0
25,729
0
51,458
No
output
1
25,729
0
51,459
Provide a correct Python 3 solution for this coding contest problem. Problem Given the strings $ s $, $ t $. First, let the string set $ A = $ {$ s $}, $ B = \ phi $. At this time, I want to perform the following operations as much as possible. operation step1 Perform the following processing for all $ u ∊ A $. 1...
instruction
0
26,520
0
53,040
"Correct Solution: ``` s = input() t = " " + input() line = [1] next = 1 t_size = len(t) flag = False for i in s: if t[next] == i: line[0] += 1 next = line[0] line += [0] j = 0 while line[j] == t_size: line[j] = 0 next = line[j + 1] = line[j + 1] + 1 ...
output
1
26,520
0
53,041
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Problem Given the strings $ s $, $ t $. First, let the string set $ A = $ {$ s $}, $ B = \ phi $. At this time, I want to perform the following operations as much as possible. operation step1...
instruction
0
26,521
0
53,042
No
output
1
26,521
0
53,043
Provide tags and a correct Python 3 solution for this coding contest problem. Consider some set of distinct characters A and some string S, consisting of exactly n characters, where each character is present in A. You are given an array of m integers b (b_1 < b_2 < ... < b_m). You are allowed to perform the followi...
instruction
0
26,563
0
53,126
Tags: combinatorics, strings Correct Solution: ``` n,m,a=map(int,input().split()) b=list(map(int,input().split())) for i in range(m): if i==0: diffs=[b[0]] else: diffs.append(b[i]-b[i-1]) powers=[a%998244353] for i in range(30): powers.append(powers[-1]**2%998244353) def power(x,y,binpowers)...
output
1
26,563
0
53,127
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider some set of distinct characters A and some string S, consisting of exactly n characters, where each character is present in A. You are given an array of m integers b (b_1 < b_2 < ... <...
instruction
0
26,564
0
53,128
No
output
1
26,564
0
53,129
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider some set of distinct characters A and some string S, consisting of exactly n characters, where each character is present in A. You are given an array of m integers b (b_1 < b_2 < ... <...
instruction
0
26,565
0
53,130
No
output
1
26,565
0
53,131
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a string s consisting only of first 20 lowercase Latin letters ('a', 'b', ..., 't'). Recall that the substring s[l; r] of the string s is the string s_l s_{l + 1} ... s_r. For exa...
instruction
0
26,653
0
53,306
No
output
1
26,653
0
53,307
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a string s consisting only of first 20 lowercase Latin letters ('a', 'b', ..., 't'). Recall that the substring s[l; r] of the string s is the string s_l s_{l + 1} ... s_r. For exa...
instruction
0
26,654
0
53,308
No
output
1
26,654
0
53,309
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a string s consisting only of first 20 lowercase Latin letters ('a', 'b', ..., 't'). Recall that the substring s[l; r] of the string s is the string s_l s_{l + 1} ... s_r. For exa...
instruction
0
26,655
0
53,310
No
output
1
26,655
0
53,311
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a string s consisting only of first 20 lowercase Latin letters ('a', 'b', ..., 't'). Recall that the substring s[l; r] of the string s is the string s_l s_{l + 1} ... s_r. For exa...
instruction
0
26,656
0
53,312
No
output
1
26,656
0
53,313
Provide tags and a correct Python 3 solution for this coding contest problem. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); * then perform the next step n times; * at th...
instruction
0
26,790
0
53,580
Tags: greedy, implementation, strings Correct Solution: ``` t = int(input()) for i in range(0,t): s = list(input()) s = [ord(s[j])-96 for j in range(0,len(s))] # s.sort() n = len(s) if 1 not in s: print("NO") continue l=s.index(1)-1 r = s.index(1)+1 k=2 f=1 # print(s) while(...
output
1
26,790
0
53,581
Provide tags and a correct Python 3 solution for this coding contest problem. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); * then perform the next step n times; * at th...
instruction
0
26,791
0
53,582
Tags: greedy, implementation, strings Correct Solution: ``` from collections import defaultdict for _ in range(int(input())): x=input() arr=[0]*123 c=len(x) aa=0 for i in range(c): arr[ord(x[i])]+=1 if x[i]=='a': aa=i flag=0 for j in range(97,97+c): ...
output
1
26,791
0
53,583
Provide tags and a correct Python 3 solution for this coding contest problem. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); * then perform the next step n times; * at th...
instruction
0
26,792
0
53,584
Tags: greedy, implementation, strings Correct Solution: ``` # print(ord('z')) for _ in range(int(input())): s = input() A_idx = -1 mx = 0 mp = {} dup = False for i in range(len(s)): if s[i] == 'a': A_idx = i if s[i] not in mp: mp[s[i]] = 1 else: ...
output
1
26,792
0
53,585
Provide tags and a correct Python 3 solution for this coding contest problem. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); * then perform the next step n times; * at th...
instruction
0
26,793
0
53,586
Tags: greedy, implementation, strings Correct Solution: ``` #DaRk DeveLopeR import sys #taking input as string input = lambda: sys.stdin.readline().rstrip("\r\n") inp = lambda: list(map(int,sys.stdin.readline().rstrip("\r\n").split())) mod = 10**9+7; Mod = 998244353; INF = float('inf') #_____________________________...
output
1
26,793
0
53,587
Provide tags and a correct Python 3 solution for this coding contest problem. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); * then perform the next step n times; * at th...
instruction
0
26,794
0
53,588
Tags: greedy, implementation, strings Correct Solution: ``` import string lett = string.ascii_lowercase def isAlf(ss): start = ss.find('a') if start == -1: return False n = len(ss) if n == 1: return True l = start-1 r = start+1 ll = 1 for i in range(1, 26): if ...
output
1
26,794
0
53,589
Provide tags and a correct Python 3 solution for this coding contest problem. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); * then perform the next step n times; * at th...
instruction
0
26,795
0
53,590
Tags: greedy, implementation, strings Correct Solution: ``` t = int(input()) for _ in range(t): dummy = input() l = list(dummy) start = 0 end = len(l) - 1 count = len(l) # print(ord(l[0])) while start <= end and count: if ord(l[start] ) == (count + 96): start+=1 e...
output
1
26,795
0
53,591
Provide tags and a correct Python 3 solution for this coding contest problem. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); * then perform the next step n times; * at th...
instruction
0
26,796
0
53,592
Tags: greedy, implementation, strings Correct Solution: ``` t = int(input()) for i in range(t): text = input() length = len(text) ans = True for j in range(length): if text[0] == chr(97 + length - j - 1): text = text[1:] elif text[-1] == chr(97 + length - j - 1): ...
output
1
26,796
0
53,593
Provide tags and a correct Python 3 solution for this coding contest problem. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); * then perform the next step n times; * at th...
instruction
0
26,797
0
53,594
Tags: greedy, implementation, strings Correct Solution: ``` import os import sys from io import BytesIO, IOBase from types import GeneratorType from collections import defaultdict BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer ...
output
1
26,797
0
53,595
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); *...
instruction
0
26,798
0
53,596
Yes
output
1
26,798
0
53,597
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); *...
instruction
0
26,799
0
53,598
Yes
output
1
26,799
0
53,599
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); *...
instruction
0
26,800
0
53,600
Yes
output
1
26,800
0
53,601
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); *...
instruction
0
26,801
0
53,602
Yes
output
1
26,801
0
53,603
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); *...
instruction
0
26,802
0
53,604
No
output
1
26,802
0
53,605
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); *...
instruction
0
26,803
0
53,606
No
output
1
26,803
0
53,607
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); *...
instruction
0
26,804
0
53,608
No
output
1
26,804
0
53,609
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm: * first, write an empty string to s (i.e. perform the assignment s := ""); *...
instruction
0
26,805
0
53,610
No
output
1
26,805
0
53,611
Provide tags and a correct Python 3 solution for this coding contest problem. Hamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 ≀ i ≀ |a|), such that ai β‰  bi, where ai is the i-th symbol of string a, bi is the i-th symbol of string b. For exa...
instruction
0
26,806
0
53,612
Tags: constructive algorithms, greedy, math, matrices Correct Solution: ``` def get_input(): a, b, d = map(int, input().split()) c, e = map(int, input().split()) f = int(input()) return [a, b, c, d, e, f] def check_condition(a, b, c, d, e, f): condition1 = (a + b + c) % 2 == 0 conditi...
output
1
26,806
0
53,613
Provide tags and a correct Python 3 solution for this coding contest problem. Hamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 ≀ i ≀ |a|), such that ai β‰  bi, where ai is the i-th symbol of string a, bi is the i-th symbol of string b. For exa...
instruction
0
26,807
0
53,614
Tags: constructive algorithms, greedy, math, matrices Correct Solution: ``` def get_input(): a, b, d = map(int, input().split()) c, e = map(int, input().split()) f = int(input()) return [a, b, c, d, e, f] def check_condition(a, b, c, d, e, f): condition1 = (a + b + c) % 2 == 0 condition2 = (d ...
output
1
26,807
0
53,615
Provide tags and a correct Python 3 solution for this coding contest problem. Hamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 ≀ i ≀ |a|), such that ai β‰  bi, where ai is the i-th symbol of string a, bi is the i-th symbol of string b. For exa...
instruction
0
26,808
0
53,616
Tags: constructive algorithms, greedy, math, matrices Correct Solution: ``` h = [[0 in range(10)] for j in range(10)] for i in range(1, 4): h[i] = [0 for j in range(i + 1)] + list(map(int, input().split())) #for i in range(1, 4): # print(" ".join(map(str, h[i][1:5]))) if (h[1][2] + h[1][3] < h[2][3] or (h[1][2] ...
output
1
26,808
0
53,617
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Hamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 ≀ i ≀ |a|), such that ai β‰  bi, where ai is the i-th symbol of strin...
instruction
0
26,809
0
53,618
No
output
1
26,809
0
53,619
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Hamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 ≀ i ≀ |a|), such that ai β‰  bi, where ai is the i-th symbol of strin...
instruction
0
26,810
0
53,620
No
output
1
26,810
0
53,621
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Hamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 ≀ i ≀ |a|), such that ai β‰  bi, where ai is the i-th symbol of strin...
instruction
0
26,811
0
53,622
No
output
1
26,811
0
53,623
Provide tags and a correct Python 3 solution for this coding contest problem. Alica and Bob are playing a game. Initially they have a binary string s consisting of only characters 0 and 1. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so o...
instruction
0
27,584
0
55,168
Tags: games Correct Solution: ``` t=int(input()) for _ in range(t): s=input() cnt0=s.count("0") cnt1=s.count("1") ans=min(cnt0,cnt1) if ans%2==0: print("NET") else: print("DA") ```
output
1
27,584
0
55,169
Provide tags and a correct Python 3 solution for this coding contest problem. Alica and Bob are playing a game. Initially they have a binary string s consisting of only characters 0 and 1. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so o...
instruction
0
27,585
0
55,170
Tags: games Correct Solution: ``` z=int(input()) for h in range(z): a=list(map(int,input())) cnt=0 while True: flag=0 for i in range(len(a)-1): if len(a)>1: if (a[i]==0 and a[i+1]) or (a[i]==1 and a[i+1]==0): cnt+=1 flag=1 ...
output
1
27,585
0
55,171
Provide tags and a correct Python 3 solution for this coding contest problem. Alica and Bob are playing a game. Initially they have a binary string s consisting of only characters 0 and 1. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so o...
instruction
0
27,586
0
55,172
Tags: games Correct Solution: ``` def saurabh(B): A=len(B) x=[B[0]] count=0 for i in range(1,len(B)): if x==[]: x.append(B[i]) elif x[-1]!=B[i]: x.pop() count+=1 else: x.append(B[i]) if count%2==1: return 'DA' else: ...
output
1
27,586
0
55,173
Provide tags and a correct Python 3 solution for this coding contest problem. Alica and Bob are playing a game. Initially they have a binary string s consisting of only characters 0 and 1. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so o...
instruction
0
27,587
0
55,174
Tags: games Correct Solution: ``` t=int(input()) a=[] for i in range(t): n=input() s=0 g=0 r=0 b=0 h=len(n)//2 for i in range(len(n)//2): g=n.count('01') b+=g n=n.replace('01','') r=n.count('10') b+=r n=n.replace('10','') if len(n)==2 and n...
output
1
27,587
0
55,175
Provide tags and a correct Python 3 solution for this coding contest problem. Alica and Bob are playing a game. Initially they have a binary string s consisting of only characters 0 and 1. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so o...
instruction
0
27,588
0
55,176
Tags: games Correct Solution: ``` t = int(input()) for _ in range(t): s = [int(i) for i in input()] ct0 = 0 ct1 = 0 for i in s: if i == 1: ct1 += 1 else: ct0 += 1 ct = min(ct0, ct1) if ct%2: print("DA") else: print("N...
output
1
27,588
0
55,177
Provide tags and a correct Python 3 solution for this coding contest problem. Alica and Bob are playing a game. Initially they have a binary string s consisting of only characters 0 and 1. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so o...
instruction
0
27,589
0
55,178
Tags: games Correct Solution: ``` from typing import AnyStr t=int(input()) answer=[] while t>0: s=input() c0=0 c1=0 for i in s: if i=='0': c0+=1 else: c1+=1 if min(c0,c1)%2==1: answer.append('DA') else: answer.append('NET') t-=1 prin...
output
1
27,589
0
55,179
Provide tags and a correct Python 3 solution for this coding contest problem. Alica and Bob are playing a game. Initially they have a binary string s consisting of only characters 0 and 1. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so o...
instruction
0
27,590
0
55,180
Tags: games Correct Solution: ``` t = int(input()) for i in range(t): s = input() print('DA' if min(s.count('0'), s.count('1')) % 2 == 1 else 'NET') ```
output
1
27,590
0
55,181
Provide tags and a correct Python 3 solution for this coding contest problem. Alica and Bob are playing a game. Initially they have a binary string s consisting of only characters 0 and 1. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so o...
instruction
0
27,591
0
55,182
Tags: games Correct Solution: ``` t=int(input()) def alice(st): j=1 while True: if "10" in st: a=st.index("10") st=st[:a]+st[a+2:] j+=1 elif "01" in st: a=st.index("01") st=st[:a]+st[a+2:] j+=1 else: break if j%2==0: return "DA" else: return "NET" li=[] for i in range(t): li=l...
output
1
27,591
0
55,183
Provide tags and a correct Python 2 solution for this coding contest problem. Alica and Bob are playing a game. Initially they have a binary string s consisting of only characters 0 and 1. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so o...
instruction
0
27,592
0
55,184
Tags: games Correct Solution: ``` from sys import stdin, stdout from collections import Counter, defaultdict from itertools import permutations, combinations raw_input = stdin.readline pr = stdout.write mod=10**9+7 def ni(): return int(raw_input()) def li(): return map(int,raw_input().split()) def pn(n): ...
output
1
27,592
0
55,185
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alica and Bob are playing a game. Initially they have a binary string s consisting of only characters 0 and 1. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the s...
instruction
0
27,598
0
55,196
No
output
1
27,598
0
55,197
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a string s consisting of n lowercase Latin letters. Let's denote k-substring of s as a string subsk = sksk + 1..sn + 1 - k. Obviously, subs1 = s, and there are exactly <image> suc...
instruction
0
28,015
0
56,030
No
output
1
28,015
0
56,031
Provide a correct Python 3 solution for this coding contest problem. You are given a string $t$ and a set $S$ of $N$ different strings. You need to separate $t$ such that each part is included in $S$. For example, the following 4 separation methods satisfy the condition when $t = abab$ and $S = \\{a, ab, b\\}$. * $a...
instruction
0
28,219
0
56,438
"Correct Solution: ``` from collections import defaultdict import sys def solve(): readline = sys.stdin.readline write = sys.stdout.write mod = 10**9 + 9 base = 37 ca = ord('a') N = int(readline()) SS = [readline().strip() for i in range(N)] SS.sort(key = len) T = readline().strip(...
output
1
28,219
0
56,439
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, the Fair Nut has written k strings of length n, consisting of letters "a" and "b". He calculated c β€” the number of strings that are prefixes of at least one of the written strings. Every string was counted only one time. Then, he ...
instruction
0
28,294
0
56,588
Tags: greedy, strings Correct Solution: ``` n,k=map(int,input().split()) s=input() t=input() res,tp=0,1 for i in range(n): tp*=2 if s[i]=='b': tp-=1 if t[i]=='a': tp-=1 res+=min(tp,k) tp=min(tp,1e9) print(res) ```
output
1
28,294
0
56,589
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, the Fair Nut has written k strings of length n, consisting of letters "a" and "b". He calculated c β€” the number of strings that are prefixes of at least one of the written strings. Every string was counted only one time. Then, he ...
instruction
0
28,295
0
56,590
Tags: greedy, strings Correct Solution: ``` # by the authority of GOD author: manhar singh sachdev # import os,sys from io import BytesIO, IOBase def main(): n,k = map(int,input().split()) s = input().strip() t = input().strip() diff,ans = 0,0 for i in range(n): if diff+1 < k: ...
output
1
28,295
0
56,591