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 a correct Python 3 solution for this coding contest problem. For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\{a,b,c,b,d,a,b\\}$ and $Y = \\{b,d,c,a,b,a\\}$, the sequence $\\{b,c,a\\}$ is a common subs...
instruction
0
57,127
0
114,254
"Correct Solution: ``` for _ in[0]*int(input()): X,Y,z=input(),input(),[] for y in Y: s=i=0 for k in z: t=X.find(y,s)+1 if t<1:break if t<k:z[i]=t s=k;i+=1 else: t=X.find(y,s)+1 if t:z+=[t] print(len(z)) ```
output
1
57,127
0
114,255
Provide a correct Python 3 solution for this coding contest problem. For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\{a,b,c,b,d,a,b\\}$ and $Y = \\{b,d,c,a,b,a\\}$, the sequence $\\{b,c,a\\}$ is a common subs...
instruction
0
57,128
0
114,256
"Correct Solution: ``` # ALDS_10_C - 最長共通部分列 import sys # def main(): # q = int(input()) # # for _ in range(q): # X = list(str(sys.stdin.readline().strip())) # Y = list(str(sys.stdin.readline().strip())) # # dp = [[0] * (len(X) + 1) for _ in range(len(Y) + 1)] # # for y in ran...
output
1
57,128
0
114,257
Provide a correct Python 3 solution for this coding contest problem. For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\{a,b,c,b,d,a,b\\}$ and $Y = \\{b,d,c,a,b,a\\}$, the sequence $\\{b,c,a\\}$ is a common subs...
instruction
0
57,129
0
114,258
"Correct Solution: ``` def len_LCS(X,Y): x_l = len(X) y_l = len(Y) lcs_row = [0 for _ in range(x_l+1)] for j in range(y_l): y_j = Y[j] lcs_row_p = lcs_row[:] # lcs_row_p: [i] [i+1] # lcs_row : [i] [i+1] for i in range(x_l): if X[i] == y_j: ...
output
1
57,129
0
114,259
Provide a correct Python 3 solution for this coding contest problem. For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\{a,b,c,b,d,a,b\\}$ and $Y = \\{b,d,c,a,b,a\\}$, the sequence $\\{b,c,a\\}$ is a common subs...
instruction
0
57,130
0
114,260
"Correct Solution: ``` import sys def lcs(X, Y): indices = [0] for c in Y: for i in range(len(indices) - 1, -1, -1): tmp = X.find(c, indices[i]) if tmp + 1: if i + 1 < len(indices): indices[i + 1] = min(indices[i + 1], tmp + 1) ...
output
1
57,130
0
114,261
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\{a,b,c,b,d,a,b\\}$ and $Y = \\{b,d,...
instruction
0
57,131
0
114,262
Yes
output
1
57,131
0
114,263
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\{a,b,c,b,d,a,b\\}$ and $Y = \\{b,d,...
instruction
0
57,132
0
114,264
Yes
output
1
57,132
0
114,265
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\{a,b,c,b,d,a,b\\}$ and $Y = \\{b,d,...
instruction
0
57,133
0
114,266
Yes
output
1
57,133
0
114,267
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\{a,b,c,b,d,a,b\\}$ and $Y = \\{b,d,...
instruction
0
57,134
0
114,268
Yes
output
1
57,134
0
114,269
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\{a,b,c,b,d,a,b\\}$ and $Y = \\{b,d,...
instruction
0
57,135
0
114,270
No
output
1
57,135
0
114,271
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\{a,b,c,b,d,a,b\\}$ and $Y = \\{b,d,...
instruction
0
57,136
0
114,272
No
output
1
57,136
0
114,273
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\{a,b,c,b,d,a,b\\}$ and $Y = \\{b,d,...
instruction
0
57,137
0
114,274
No
output
1
57,137
0
114,275
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\{a,b,c,b,d,a,b\\}$ and $Y = \\{b,d,...
instruction
0
57,138
0
114,276
No
output
1
57,138
0
114,277
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a string s consisting of n lowercase Latin letters. Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position 3 and ends in position 6), but "aa" or...
instruction
0
57,212
0
114,424
Tags: implementation, sortings, strings Correct Solution: ``` n=int(input()) a=input() lo,hi=0,0 flag=0 for i in range(n-1): x=a[i] y=a[i+1] if x>y: flag=1 lo=i+1 hi=i+2 break if flag==1: print("YES") print(lo,hi) else: print("NO") ```
output
1
57,212
0
114,425
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a string s consisting of n lowercase Latin letters. Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position 3 and ends in position 6), but "aa" or...
instruction
0
57,213
0
114,426
Tags: implementation, sortings, strings Correct Solution: ``` n = int(input()) s = input() for i in range(0, n-1): if s[i+1] < s[i]: print('YES') print(i+1, i + 2) exit(0) print('NO') ```
output
1
57,213
0
114,427
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a string s consisting of n lowercase Latin letters. Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position 3 and ends in position 6), but "aa" or...
instruction
0
57,214
0
114,428
Tags: implementation, sortings, strings Correct Solution: ``` input() a=input() r=-1 for i,x in enumerate(zip(a,a[1:])): if x[0]>x[1]:r=i+1 print([f'YES\n{r} {r+1}','NO'][r<0]) ```
output
1
57,214
0
114,429
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a string s consisting of n lowercase Latin letters. Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position 3 and ends in position 6), but "aa" or...
instruction
0
57,215
0
114,430
Tags: implementation, sortings, strings Correct Solution: ``` def main(): from sys import stdin, stdout n = int(stdin.readline().rstrip()) s = stdin.readline().rstrip() flag = True for i in range(n - 1): if s[i] <= s[i + 1]: continue else: stdout.write("YES\n" + str(i + 1) + " " + str(i + 2) + "\n") ...
output
1
57,215
0
114,431
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a string s consisting of n lowercase Latin letters. Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position 3 and ends in position 6), but "aa" or...
instruction
0
57,216
0
114,432
Tags: implementation, sortings, strings Correct Solution: ``` n = int(input()) s = input() flag = False #start, stop = -1 for i in range(n-1): if s[i]>s[i+1]: flag = True print("YES") print(i+1, i+2) break if not flag: print("NO") ```
output
1
57,216
0
114,433
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a string s consisting of n lowercase Latin letters. Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position 3 and ends in position 6), but "aa" or...
instruction
0
57,217
0
114,434
Tags: implementation, sortings, strings Correct Solution: ``` n = int(input()) s = input() i = 0 while i < n - 1 and s[i] <= s[i + 1]: i += 1 if i == n - 1: print('NO') else: print('YES') print('{} {}'.format(i + 1, i + 2)) ```
output
1
57,217
0
114,435
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a string s consisting of n lowercase Latin letters. Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position 3 and ends in position 6), but "aa" or...
instruction
0
57,218
0
114,436
Tags: implementation, sortings, strings Correct Solution: ``` n=int(input()) a=str(input()) c=ord(a[0]) for i in range(1,n): if c<=ord(a[i]): c=ord(a[i]) else: print("YES") print(i,i+1) exit() print("NO") ```
output
1
57,218
0
114,437
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a string s consisting of n lowercase Latin letters. Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position 3 and ends in position 6), but "aa" or...
instruction
0
57,219
0
114,438
Tags: implementation, sortings, strings Correct Solution: ``` n = int(input()) string = input() flag = 0 for i in range(0,n-1): if string[i] > string[i+1]: flag = 1 print("YES") print(i+1,i+2) break if flag == 0: print("NO") ```
output
1
57,219
0
114,439
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 define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in ...
instruction
0
57,220
0
114,440
Yes
output
1
57,220
0
114,441
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 define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in ...
instruction
0
57,221
0
114,442
Yes
output
1
57,221
0
114,443
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 define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in ...
instruction
0
57,222
0
114,444
Yes
output
1
57,222
0
114,445
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 define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in ...
instruction
0
57,223
0
114,446
Yes
output
1
57,223
0
114,447
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 define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in ...
instruction
0
57,224
0
114,448
No
output
1
57,224
0
114,449
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 define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in ...
instruction
0
57,225
0
114,450
No
output
1
57,225
0
114,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 string s consisting of n lowercase Latin letters. Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in ...
instruction
0
57,226
0
114,452
No
output
1
57,226
0
114,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 string s consisting of n lowercase Latin letters. Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in ...
instruction
0
57,227
0
114,454
No
output
1
57,227
0
114,455
Provide tags and a correct Python 3 solution for this coding contest problem. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-st...
instruction
0
57,364
0
114,728
Tags: implementation, strings Correct Solution: ``` k = int(input()) def f(s): a='' for i in set(s): if s.count(i)%k: return False else: a+=s.count(i)//k*i return a s=f(input()) print(s*k if s else -1) ```
output
1
57,364
0
114,729
Provide tags and a correct Python 3 solution for this coding contest problem. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-st...
instruction
0
57,365
0
114,730
Tags: implementation, strings Correct Solution: ``` track = dict() k = int(input()) s = input() for i in s: if not (i in track.keys()): track[i] = 0 track[i] += 1 poss = True for i in track.keys(): if(track[i] % k != 0): poss = False print(-1) break if(poss): sub = "" ...
output
1
57,365
0
114,731
Provide tags and a correct Python 3 solution for this coding contest problem. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-st...
instruction
0
57,366
0
114,732
Tags: implementation, strings Correct Solution: ``` k=int(input()) string=input() size=len(string)//k if len(string)%k!=0: print(-1) exit() dict={} for c in string: dict[c]=string.count(c) ans=sum([x//k for x in dict.values()]) List=dict.keys() y="".join(x*(dict[x]//k) for x in List) if ans==size: prin...
output
1
57,366
0
114,733
Provide tags and a correct Python 3 solution for this coding contest problem. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-st...
instruction
0
57,367
0
114,734
Tags: implementation, strings Correct Solution: ``` import sys k=int(input()) s=list(input()) count=[0]*26 n=len(s) ans='' for i in range(n): count[ord(s[i])-97]+=1 for i in range(26): if count[i]%k!=0: print(-1) sys.exit() else: ans+=chr(i+97)*(count[i]//k) print(ans*k) ```
output
1
57,367
0
114,735
Provide tags and a correct Python 3 solution for this coding contest problem. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-st...
instruction
0
57,368
0
114,736
Tags: implementation, strings Correct Solution: ``` k = int(input()) s = input() chars = "".join(set(s)) kstring = "" for i in chars: if s.count(i) % k != 0: kstring = -1 break kstring += i * (s.count(i) // k) if kstring == -1: print(kstring) else: print(kstring * k) ```
output
1
57,368
0
114,737
Provide tags and a correct Python 3 solution for this coding contest problem. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-st...
instruction
0
57,369
0
114,738
Tags: implementation, strings Correct Solution: ``` k=int(input()) s=input() l=list(s) x=sorted(list(set(map(str,l)))) c=0 ct=[] for i in range(len(x)): ct.append(l.count(x[i])) if (l.count(x[i]))%k==0: c+=1 if c==len(x): r="" for i in range(len(x)): r+= x[i]*((ct[i])//k) print(r*k)...
output
1
57,369
0
114,739
Provide tags and a correct Python 3 solution for this coding contest problem. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-st...
instruction
0
57,370
0
114,740
Tags: implementation, strings Correct Solution: ``` k=int(input()) s=list(input()) d={} for x in s: d[x]=d.get(x,0)+1 for x in d: if d[x]%k: print(-1); break d[x]//=k else: s='' for x in d: for i in range(d[x]): s+=x ans=[s for _ in range(k)] print(''.join(ans)) ```
output
1
57,370
0
114,741
Provide tags and a correct Python 3 solution for this coding contest problem. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-st...
instruction
0
57,371
0
114,742
Tags: implementation, strings Correct Solution: ``` def kstring(s, k): if len(s)%k != 0: return "" else: from collections import Counter d = dict(Counter(s)) ans = [] for letter in d: count = d[letter] if count%k == 0: ans.append(letter*(count//k)) else: return "" ans = "".join(ans) ans...
output
1
57,371
0
114,743
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, ...
instruction
0
57,372
0
114,744
Yes
output
1
57,372
0
114,745
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, ...
instruction
0
57,373
0
114,746
Yes
output
1
57,373
0
114,747
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, ...
instruction
0
57,374
0
114,748
Yes
output
1
57,374
0
114,749
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, ...
instruction
0
57,375
0
114,750
Yes
output
1
57,375
0
114,751
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, ...
instruction
0
57,376
0
114,752
No
output
1
57,376
0
114,753
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, ...
instruction
0
57,377
0
114,754
No
output
1
57,377
0
114,755
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, ...
instruction
0
57,378
0
114,756
No
output
1
57,378
0
114,757
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, ...
instruction
0
57,379
0
114,758
No
output
1
57,379
0
114,759
Provide tags and a correct Python 3 solution for this coding contest problem. Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one. GukiZ has strings a, b, and c. He wants to obtain string k by swapping some letters in a, so that k should contain as many non-o...
instruction
0
57,540
0
115,080
Tags: brute force, constructive algorithms, implementation, strings Correct Solution: ``` from collections import Counter from collections import defaultdict def get_single(a, b): res = 2 ** 32 for s in b.keys(): res = min(res, a[s] // b[s]) return res def get_count(a, b, c): best = 0, get_single(a, c) r1 = ...
output
1
57,540
0
115,081
Provide tags and a correct Python 3 solution for this coding contest problem. Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one. GukiZ has strings a, b, and c. He wants to obtain string k by swapping some letters in a, so that k should contain as many non-o...
instruction
0
57,541
0
115,082
Tags: brute force, constructive algorithms, implementation, strings Correct Solution: ``` sa = input() a = [0] * 26 for i in sa: a[ord(i) - ord('a')] += 1 sb = input() b = [0] * 26 for i in sb: b[ord(i) - ord('a')] += 1 sc = input() c = [0] * 26 for i in sc: c[ord(i) - ord('a')] += 1 def zu(n): m ...
output
1
57,541
0
115,083
Provide tags and a correct Python 3 solution for this coding contest problem. Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one. GukiZ has strings a, b, and c. He wants to obtain string k by swapping some letters in a, so that k should contain as many non-o...
instruction
0
57,542
0
115,084
Tags: brute force, constructive algorithms, implementation, strings Correct Solution: ``` contest = True if not contest: fin = open("in", "r") inp = input if contest else lambda: fin.readline()[:-1] read = lambda: tuple(map(int, inp().split())) def cstr(s): d = {} for c in s: if not c in d: ...
output
1
57,542
0
115,085
Provide tags and a correct Python 3 solution for this coding contest problem. Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one. GukiZ has strings a, b, and c. He wants to obtain string k by swapping some letters in a, so that k should contain as many non-o...
instruction
0
57,543
0
115,086
Tags: brute force, constructive algorithms, implementation, strings Correct Solution: ``` a = input() b = input() c = input() all_set = set(a + b + c) def getMin(object_dict, sub_dict): return min([object_dict[ch] // sub_dict[ch] for ch in sub_dict.keys() if sub_dict[ch] > 0]) a_dict = {ch : a.count(ch) for ch in a...
output
1
57,543
0
115,087
Provide tags and a correct Python 3 solution for this coding contest problem. Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one. GukiZ has strings a, b, and c. He wants to obtain string k by swapping some letters in a, so that k should contain as many non-o...
instruction
0
57,544
0
115,088
Tags: brute force, constructive algorithms, implementation, strings Correct Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,copy from itertools import chain, dropwhile, permutations, combinations from collections import defaultdict, deque # Guide: # 1. construct complex data ty...
output
1
57,544
0
115,089
Provide tags and a correct Python 3 solution for this coding contest problem. Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one. GukiZ has strings a, b, and c. He wants to obtain string k by swapping some letters in a, so that k should contain as many non-o...
instruction
0
57,545
0
115,090
Tags: brute force, constructive algorithms, implementation, strings Correct Solution: ``` INF = 999999999999999999999999999999999999999 a = input() b = input() c = input() a_letters = [0] * 26 b_letters = [0] * 26 c_letters = [0] * 26 for code in range(ord('a'), ord('z') + 1): letter = chr(code) a_letters[co...
output
1
57,545
0
115,091