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
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters. Suitability of string s is calculated by following metric: Any two letters can b...
instruction
0
5,548
0
11,096
Yes
output
1
5,548
0
11,097
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters. Suitability of string s is calculated by following metric: Any two letters can b...
instruction
0
5,549
0
11,098
Yes
output
1
5,549
0
11,099
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters. Suitability of string s is calculated by following metric: Any two letters can b...
instruction
0
5,550
0
11,100
Yes
output
1
5,550
0
11,101
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters. Suitability of string s is calculated by following metric: Any two letters can b...
instruction
0
5,551
0
11,102
No
output
1
5,551
0
11,103
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters. Suitability of string s is calculated by following metric: Any two letters can b...
instruction
0
5,552
0
11,104
No
output
1
5,552
0
11,105
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters. Suitability of string s is calculated by following metric: Any two letters can b...
instruction
0
5,553
0
11,106
No
output
1
5,553
0
11,107
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters. Suitability of string s is calculated by following metric: Any two letters can b...
instruction
0
5,554
0
11,108
No
output
1
5,554
0
11,109
Provide tags and a correct Python 3 solution for this coding contest problem. Suppose you are given a string s of length n consisting of lowercase English letters. You need to compress it using the smallest possible number of coins. To compress the string, you have to represent s as a concatenation of several non-emp...
instruction
0
5,827
0
11,654
Tags: dp, strings Correct Solution: ``` def f(x): z=[0 for i in range(len(x))] l=0 r=0 for i in range(1,len(x)): if i<=r: z[i]=min(z[i-l],r-i+1) while i+z[i]<len(x) and x[z[i]]==x[i+z[i]]: z[i]+=1 if i+z[i]-1>r: l,r=i,i+z[i]-1 return z a=li...
output
1
5,827
0
11,655
Provide tags and a correct Python 3 solution for this coding contest problem. Suppose you are given a string s of length n consisting of lowercase English letters. You need to compress it using the smallest possible number of coins. To compress the string, you have to represent s as a concatenation of several non-emp...
instruction
0
5,828
0
11,656
Tags: dp, strings Correct Solution: ``` n, a, b = map(int, input().split()) s = input() lcp = [[0]*n for _ in ' '*n] for i in range(n-1, -1, -1): for r in range(n-1, -1, -1): if s[i] == s[r]: if i == n - 1 or r == n - 1: lcp[i][r] = 1 else: lcp[i][r] ...
output
1
5,828
0
11,657
Provide tags and a correct Python 3 solution for this coding contest problem. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i (1 ≤ i ≤ min(|x|, |y|)), that xi < yi, and for...
instruction
0
5,893
0
11,786
Tags: brute force, constructive algorithms, hashing, implementation, string suffix structures, strings Correct Solution: ``` __author__ = 'Utena' from heapq import heappushpop, heapify,heappop,heappush string=input() s=len(string) k=int(input()) total=0 line=[] for i in range(s): line.append((string[i],i)) heapify(...
output
1
5,893
0
11,787
Provide tags and a correct Python 3 solution for this coding contest problem. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i (1 ≤ i ≤ min(|x|, |y|)), that xi < yi, and for...
instruction
0
5,894
0
11,788
Tags: brute force, constructive algorithms, hashing, implementation, string suffix structures, strings Correct Solution: ``` s=input() l=len(s) k=int(input()) if l*(l+1)/2<k: print('No such line.') else: a=[i for i in range(l)] p=0 ans='' while True: t=[(s[i+p],i) for i in a] t=sorted(t) i=j=0 prod=0 whil...
output
1
5,894
0
11,789
Provide tags and a correct Python 3 solution for this coding contest problem. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i (1 ≤ i ≤ min(|x|, |y|)), that xi < yi, and for...
instruction
0
5,895
0
11,790
Tags: brute force, constructive algorithms, hashing, implementation, string suffix structures, strings Correct Solution: ``` import heapq as hq s = input() k = int(input()) n = len(s) news = [([s[i]], i + 1) for i in range(n)] if k > n * (n + 1) // 2: print('No such line.') exit() hq.heapify(news) for i i...
output
1
5,895
0
11,791
Provide tags and a correct Python 3 solution for this coding contest problem. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i (1 ≤ i ≤ min(|x|, |y|)), that xi < yi, and for...
instruction
0
5,896
0
11,792
Tags: brute force, constructive algorithms, hashing, implementation, string suffix structures, strings Correct Solution: ``` from heapq import * s=input() k=int(input()) n=len(s) ss=[(s[i],i) for i in range(n)] heapify(ss) if k>n*(n+1)/2: print('No such line.') else: while k: k-=1 t=heappop(ss) ...
output
1
5,896
0
11,793
Provide tags and a correct Python 3 solution for this coding contest problem. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i (1 ≤ i ≤ min(|x|, |y|)), that xi < yi, and for...
instruction
0
5,897
0
11,794
Tags: brute force, constructive algorithms, hashing, implementation, string suffix structures, strings Correct Solution: ``` import sys,heapq x=input(); k=int(input()); i=0; h=[(x[i],i+1) for i in range(len(x))]; heapq.heapify(h); while(True): i=i+1; if(not h): print("No such line."); sys.exit()...
output
1
5,897
0
11,795
Provide tags and a correct Python 3 solution for this coding contest problem. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i (1 ≤ i ≤ min(|x|, |y|)), that xi < yi, and for...
instruction
0
5,898
0
11,796
Tags: brute force, constructive algorithms, hashing, implementation, string suffix structures, strings Correct Solution: ``` from heapq import * l=input() k=int(input()) n=len(l) if k>n*(n+1)/2: print("No such line.") quit() ss=[(l[i],i) for i in range(n)] heapify(ss) while k: k-=1 t=heappop(ss) if ...
output
1
5,898
0
11,797
Provide tags and a correct Python 3 solution for this coding contest problem. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i (1 ≤ i ≤ min(|x|, |y|)), that xi < yi, and for...
instruction
0
5,899
0
11,798
Tags: brute force, constructive algorithms, hashing, implementation, string suffix structures, strings Correct Solution: ``` import heapq from heapq import heappush, heappop, heappushpop a = input() n = int(input()) c=list(a) l = len(c) num = 0 if (l*l+l)/2 < n: print('No such line.') else: d = [] # for i...
output
1
5,899
0
11,799
Provide tags and a correct Python 3 solution for this coding contest problem. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i (1 ≤ i ≤ min(|x|, |y|)), that xi < yi, and for...
instruction
0
5,900
0
11,800
Tags: brute force, constructive algorithms, hashing, implementation, string suffix structures, strings Correct Solution: ``` ''' Created on 2016-4-28 @author: chronocorax ''' from heapq import heapify, heappush, heappop S = input() k = int(input()) n = len(S) H = [([S[i]], i + 1) for i in range(n)] if k > n * (n + 1)...
output
1
5,900
0
11,801
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i...
instruction
0
5,901
0
11,802
Yes
output
1
5,901
0
11,803
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i...
instruction
0
5,902
0
11,804
Yes
output
1
5,902
0
11,805
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i...
instruction
0
5,903
0
11,806
Yes
output
1
5,903
0
11,807
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i...
instruction
0
5,904
0
11,808
Yes
output
1
5,904
0
11,809
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i...
instruction
0
5,905
0
11,810
No
output
1
5,905
0
11,811
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i...
instruction
0
5,906
0
11,812
No
output
1
5,906
0
11,813
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i...
instruction
0
5,907
0
11,814
No
output
1
5,907
0
11,815
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day in the IT lesson Anna and Maria learned about the lexicographic order. String x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i...
instruction
0
5,908
0
11,816
No
output
1
5,908
0
11,817
Provide tags and a correct Python 2 solution for this coding contest problem. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba" is a 3-complete word, while "abccba" is not. ...
instruction
0
5,909
0
11,818
Tags: dfs and similar, dsu, greedy, implementation, strings Correct Solution: ``` from sys import stdin, stdout from collections import Counter, defaultdict from itertools import permutations, combinations from fractions import gcd raw_input = stdin.readline pr = stdout.write def in_arr(): return map(int,raw_inpu...
output
1
5,909
0
11,819
Provide tags and a correct Python 3 solution for this coding contest problem. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba" is a 3-complete word, while "abccba" is not. ...
instruction
0
5,910
0
11,820
Tags: dfs and similar, dsu, greedy, implementation, strings Correct Solution: ``` from collections import Counter for lp in range(int(input())): n,k=map(int,input().split()) s=input() q,t=0,1 for j in range((k+1)//2): l=[] for i in range(j,n,k):l.append(s[i]) if k%2==0 or j!=(k+1...
output
1
5,910
0
11,821
Provide tags and a correct Python 3 solution for this coding contest problem. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba" is a 3-complete word, while "abccba" is not. ...
instruction
0
5,911
0
11,822
Tags: dfs and similar, dsu, greedy, implementation, strings Correct Solution: ``` from sys import stdin from collections import defaultdict, Counter from math import ceil t = int(input()) for _ in range(t): n, k = map(int, stdin.readline().split()) S = stdin.readline().strip() count = 0 sub_k = [] for i i...
output
1
5,911
0
11,823
Provide tags and a correct Python 3 solution for this coding contest problem. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba" is a 3-complete word, while "abccba" is not. ...
instruction
0
5,912
0
11,824
Tags: dfs and similar, dsu, greedy, implementation, strings Correct Solution: ``` #input = raw_input from collections import Counter def answer(): n, k = map(int, input().split(" ")) s = input() bunkatu_s_list = [s[i:i+k] for i in range(0, n, k)] bunkatu_n = n // k half_s_list = [] out = 0 ...
output
1
5,912
0
11,825
Provide tags and a correct Python 3 solution for this coding contest problem. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba" is a 3-complete word, while "abccba" is not. ...
instruction
0
5,913
0
11,826
Tags: dfs and similar, dsu, greedy, implementation, strings Correct Solution: ``` from sys import stdin inp = stdin.readline t = int(inp().strip()) for c in range(t): n, k = [int(x) for x in inp().strip().split()] array = list(inp().strip()) d1 = {} for i in range(n): if i%k < k/2: ...
output
1
5,913
0
11,827
Provide tags and a correct Python 3 solution for this coding contest problem. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba" is a 3-complete word, while "abccba" is not. ...
instruction
0
5,914
0
11,828
Tags: dfs and similar, dsu, greedy, implementation, strings Correct Solution: ``` from collections import Counter import sys sys.setrecursionlimit(10 ** 5) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) ...
output
1
5,914
0
11,829
Provide tags and a correct Python 3 solution for this coding contest problem. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba" is a 3-complete word, while "abccba" is not. ...
instruction
0
5,915
0
11,830
Tags: dfs and similar, dsu, greedy, implementation, strings Correct Solution: ``` import os, sys, bisect, copy from collections import defaultdict, Counter, deque from functools import lru_cache #use @lru_cache(None) if os.path.exists('in.txt'): sys.stdin=open('in.txt','r') if os.path.exists('out.txt'): sys.stdout=op...
output
1
5,915
0
11,831
Provide tags and a correct Python 3 solution for this coding contest problem. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba" is a 3-complete word, while "abccba" is not. ...
instruction
0
5,916
0
11,832
Tags: dfs and similar, dsu, greedy, implementation, strings Correct Solution: ``` #------------------------template--------------------------# import os import sys from math import * from collections import * from fractions import * from bisect import * from heapq import* from io import BytesIO, IOBase def vsInput(): ...
output
1
5,916
0
11,833
Provide tags and a correct Python 3 solution for this coding contest problem. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba" is a 3-complete word, while "abccba" is not. ...
instruction
0
5,917
0
11,834
Tags: dfs and similar, dsu, greedy, implementation, strings Correct Solution: ``` def solve(s, k): n = len(s) r = n//k res = 0 for j in range(k//2): d = [0] * 26 for i in range(r): d[ord(s[i*k+j]) - 97] += 1 d[ord(s[i*k+k-1-j]) - 97] += 1 res += 2*r - max(...
output
1
5,917
0
11,835
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba...
instruction
0
5,918
0
11,836
Yes
output
1
5,918
0
11,837
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba...
instruction
0
5,919
0
11,838
Yes
output
1
5,919
0
11,839
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba...
instruction
0
5,920
0
11,840
Yes
output
1
5,920
0
11,841
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba...
instruction
0
5,921
0
11,842
Yes
output
1
5,921
0
11,843
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba...
instruction
0
5,922
0
11,844
No
output
1
5,922
0
11,845
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba...
instruction
0
5,923
0
11,846
No
output
1
5,923
0
11,847
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba...
instruction
0
5,924
0
11,848
No
output
1
5,924
0
11,849
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Word s of length n is called k-complete if * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. For example, "abaaba...
instruction
0
5,925
0
11,850
No
output
1
5,925
0
11,851
Provide tags and a correct Python 3 solution for this coding contest problem. For some binary string s (i.e. each character s_i is either '0' or '1'), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length 2 were written. For each pair (substring of length 2), the number ...
instruction
0
5,926
0
11,852
Tags: constructive algorithms, dfs and similar, math Correct Solution: ``` t=int(input()) for i in range(t): n=list(map(int,input().split())) ans="" if n[1]==0: if n[0]==0: print("1"*(n[2]+1)) else: print("0"*(n[0]+1)) continue cnt=0 for i in range(n[1...
output
1
5,926
0
11,853
Provide tags and a correct Python 3 solution for this coding contest problem. For some binary string s (i.e. each character s_i is either '0' or '1'), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length 2 were written. For each pair (substring of length 2), the number ...
instruction
0
5,927
0
11,854
Tags: constructive algorithms, dfs and similar, math Correct Solution: ``` for _ in range(int(input())): n0, n1, n2 = map(int, input().split(' ')) if n0 > 0 and n2 > 0: n1 -= 1 if n0 != 0: print(0, end='') for i in range(n0): print(0, end='') if n2 != 0: p...
output
1
5,927
0
11,855
Provide tags and a correct Python 3 solution for this coding contest problem. For some binary string s (i.e. each character s_i is either '0' or '1'), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length 2 were written. For each pair (substring of length 2), the number ...
instruction
0
5,928
0
11,856
Tags: constructive algorithms, dfs and similar, math Correct Solution: ``` import sys reader = (s.rstrip() for s in sys.stdin) input = reader.__next__ def gift(): for _ in range(t): n0,n1,n2=list(map(int,input().split())) ans='' if n0>0: ans='0'+'0'*(n0) if n1>0: ...
output
1
5,928
0
11,857
Provide tags and a correct Python 3 solution for this coding contest problem. For some binary string s (i.e. each character s_i is either '0' or '1'), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length 2 were written. For each pair (substring of length 2), the number ...
instruction
0
5,929
0
11,858
Tags: constructive algorithms, dfs and similar, math Correct Solution: ``` for i in range(int(input())): a, b, c = map(int, input().split()) s = '' s1 = '1' * c s0 = '0' * a if b > 0: s += '1' for j in range(b): if j % 2 == 0: s += '0' else: ...
output
1
5,929
0
11,859
Provide tags and a correct Python 3 solution for this coding contest problem. For some binary string s (i.e. each character s_i is either '0' or '1'), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length 2 were written. For each pair (substring of length 2), the number ...
instruction
0
5,930
0
11,860
Tags: constructive algorithms, dfs and similar, math Correct Solution: ``` tim = {'00': 0, '01': 1, '10': 1, '11': 2} def binary_find(): def dfs(s,i,j,k): if (i > n0) or (j > n1) or (k > n2): return False if (i == n0) and (j == n1) and (k == n2): print(s) return T...
output
1
5,930
0
11,861
Provide tags and a correct Python 3 solution for this coding contest problem. For some binary string s (i.e. each character s_i is either '0' or '1'), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length 2 were written. For each pair (substring of length 2), the number ...
instruction
0
5,931
0
11,862
Tags: constructive algorithms, dfs and similar, math Correct Solution: ``` import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdi...
output
1
5,931
0
11,863
Provide tags and a correct Python 3 solution for this coding contest problem. For some binary string s (i.e. each character s_i is either '0' or '1'), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length 2 were written. For each pair (substring of length 2), the number ...
instruction
0
5,932
0
11,864
Tags: constructive algorithms, dfs and similar, math Correct Solution: ``` t=int(input()) for you in range(t): l=input().split() n0=int(l[0]) n1=int(l[1]) n2=int(l[2]) if(n0==0 and n1==0): for i in range(n2+1): print(1,end="") print() elif(n1==0 and n2==0): fo...
output
1
5,932
0
11,865
Provide tags and a correct Python 3 solution for this coding contest problem. For some binary string s (i.e. each character s_i is either '0' or '1'), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length 2 were written. For each pair (substring of length 2), the number ...
instruction
0
5,933
0
11,866
Tags: constructive algorithms, dfs and similar, math Correct Solution: ``` # https://codeforces.com/problemset/problem/1352/F def checkEven(n): if n % 2 == 0: return True else: return False def main(): n = int(input()) arr = [] for _ in range(n): temp = list(map(int, inpu...
output
1
5,933
0
11,867