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. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the outpu...
instruction
0
15,999
0
31,998
Tags: bitmasks, chinese remainder theorem, constructive algorithms, interactive, math Correct Solution: ``` from itertools import chain, cycle, islice, repeat from operator import itemgetter d = 26 a = ord('a') t = input() n = len(t) p = [0]*n for b in (d ** 2, d, 1): if n >= b: q = (repeat(chr(a + i), b)...
output
1
15,999
0
31,999
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: "fced", "xyz",...
instruction
0
16,012
0
32,024
Yes
output
1
16,012
0
32,025
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: "fced", "xyz",...
instruction
0
16,013
0
32,026
Yes
output
1
16,013
0
32,027
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: "fced", "xyz",...
instruction
0
16,014
0
32,028
Yes
output
1
16,014
0
32,029
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: "fced", "xyz",...
instruction
0
16,015
0
32,030
Yes
output
1
16,015
0
32,031
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: "fced", "xyz",...
instruction
0
16,016
0
32,032
No
output
1
16,016
0
32,033
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: "fced", "xyz",...
instruction
0
16,017
0
32,034
No
output
1
16,017
0
32,035
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: "fced", "xyz",...
instruction
0
16,018
0
32,036
No
output
1
16,018
0
32,037
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: "fced", "xyz",...
instruction
0
16,019
0
32,038
No
output
1
16,019
0
32,039
Provide tags and a correct Python 3 solution for this coding contest problem. Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead. <image> Today Tavas fell asleep in Malekas' place. While he was sleeping, Malekas did a li...
instruction
0
16,378
0
32,756
Tags: greedy, hashing, string suffix structures, strings Correct Solution: ``` n, m = map(int, input().split()) s = input() sl = len(s) if m: y = map(int, input().split()) else: y = [] def prefix_func(s): pi = [0] * len(s) for i in range(1, len(s)): j = pi[i - 1] while j > 0 and s[i] !=...
output
1
16,378
0
32,757
Provide tags and a correct Python 3 solution for this coding contest problem. Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead. <image> Today Tavas fell asleep in Malekas' place. While he was sleeping, Malekas did a li...
instruction
0
16,379
0
32,758
Tags: greedy, hashing, string suffix structures, strings Correct Solution: ``` # -*- coding: utf-8 -*- def solve(): n, m = map(int, input().split()) p = input() if m == 0: return powmod(n) delta = len(p) - 1 ys = map(int, input().split()) tail = 0 free_chars = 0 for y in ys: ...
output
1
16,379
0
32,759
Provide tags and a correct Python 3 solution for this coding contest problem. Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead. <image> Today Tavas fell asleep in Malekas' place. While he was sleeping, Malekas did a li...
instruction
0
16,380
0
32,760
Tags: greedy, hashing, string suffix structures, strings Correct Solution: ``` import sys def prefix(s): m = len(s) v = [0]*len(s) for i in range(1,len(s)): k = v[i-1] while k > 0 and s[k] != s[i]: k = v[k-1] if s[k] == s[i]: k = k + 1 v[i] = k w ...
output
1
16,380
0
32,761
Provide tags and a correct Python 3 solution for this coding contest problem. Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead. <image> Today Tavas fell asleep in Malekas' place. While he was sleeping, Malekas did a li...
instruction
0
16,381
0
32,762
Tags: greedy, hashing, string suffix structures, strings Correct Solution: ``` def preZ(s): #preprocessing by Z algo n = len(s) z = [0]*n z[0] = n r = 0 if n==1: return z while r+1<n and s[r]==s[r+1]: r+=1 z[1] = r #note z=length! not 0-indexed l = 1 if r>0 else 0 for...
output
1
16,381
0
32,763
Provide tags and a correct Python 3 solution for this coding contest problem. Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead. <image> Today Tavas fell asleep in Malekas' place. While he was sleeping, Malekas did a li...
instruction
0
16,382
0
32,764
Tags: greedy, hashing, string suffix structures, strings Correct Solution: ``` # -*- coding: utf-8 -*- def solve(): n, m = map(int, input().split()) p = input() if m == 0: return powmod(n) delta = len(p) - 1 ys = map(int, input().split()) tail = 0 free_chars = 0 for...
output
1
16,382
0
32,765
Provide tags and a correct Python 3 solution for this coding contest problem. Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead. <image> Today Tavas fell asleep in Malekas' place. While he was sleeping, Malekas did a li...
instruction
0
16,383
0
32,766
Tags: greedy, hashing, string suffix structures, strings Correct Solution: ``` import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode...
output
1
16,383
0
32,767
Provide tags and a correct Python 3 solution for this coding contest problem. Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead. <image> Today Tavas fell asleep in Malekas' place. While he was sleeping, Malekas did a li...
instruction
0
16,384
0
32,768
Tags: greedy, hashing, string suffix structures, strings Correct Solution: ``` # -*- coding: utf-8 -*- def solve(): mod = 10**9 + 7 n, m = map(int, input().split()) p = input() if m == 0: return powmod(n) delta = len(p) - 1 ys = map(int, input().split()) answer = 1 tail = 0 ...
output
1
16,384
0
32,769
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead. <image> Today Tavas fell asleep in Malekas'...
instruction
0
16,385
0
32,770
No
output
1
16,385
0
32,771
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead. <image> Today Tavas fell asleep in Malekas'...
instruction
0
16,386
0
32,772
No
output
1
16,386
0
32,773
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead. <image> Today Tavas fell asleep in Malekas'...
instruction
0
16,387
0
32,774
No
output
1
16,387
0
32,775
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead. <image> Today Tavas fell asleep in Malekas'...
instruction
0
16,388
0
32,776
No
output
1
16,388
0
32,777
Provide a correct Python 3 solution for this coding contest problem. We have a string s consisting of lowercase English letters. Snuke can perform the following operation repeatedly: * Insert a letter `x` to any position in s of his choice, including the beginning and end of s. Snuke's objective is to turn s into ...
instruction
0
16,664
0
33,328
"Correct Solution: ``` s = input() t= "".join(c for c in s if c!="x") if t!=t[::-1]: print(-1) else: ans=0 i=0 j=0 l=len(s) while i+j<l-1: if s[i] != s[l-1-j]: ans+=1 if s[i] == "x" : i+=1 else : j+=1 else: i+=1 j+=1 ...
output
1
16,664
0
33,329
Provide a correct Python 3 solution for this coding contest problem. We have a string s consisting of lowercase English letters. Snuke can perform the following operation repeatedly: * Insert a letter `x` to any position in s of his choice, including the beginning and end of s. Snuke's objective is to turn s into ...
instruction
0
16,669
0
33,338
"Correct Solution: ``` s=input() S="a"+s[::]+"a" s=s.replace("x","") if s[:len(s)//2]!=s[:-(len(s)//2)-1:-1]: print(-1) quit() r=0 l=len(S)-1 ans=0 while r<l: R,L=0,0 while S[r+R]=="x": R+=1 while S[l-L]=="x": L+=1 ans+=abs(R-L) r+=R+1 l-=L+1 print(ans) ```
output
1
16,669
0
33,339
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan wants to play a game with you. He picked some string s of length n consisting only of lowercase Latin letters. You don't know this string. Ivan has informed you about all its improper prefixes and suffixes (i.e. prefixes and suffixes ...
instruction
0
16,863
0
33,726
Tags: strings Correct Solution: ``` def solve(e): g=[0 for i in range(2*n-2)] check=[0 for i in range(2*n-2)] for i in range(n): f=e[0:i+1] for j in range(2*n-2): if(a[j]==f and check[j]==0): g[j]=1 check[j]=1 break for i in ran...
output
1
16,863
0
33,727
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan wants to play a game with you. He picked some string s of length n consisting only of lowercase Latin letters. You don't know this string. Ivan has informed you about all its improper prefixes and suffixes (i.e. prefixes and suffixes ...
instruction
0
16,864
0
33,728
Tags: strings Correct Solution: ``` n = int(input()) a = [] for i in range(2*n-2): a.append(input()) S = '' P = '' Lnm1 = [] Lnm2 = [] ans = [] for i in a: if len(i) == n-1: Lnm1.append(i) elif len(i) == n-2: Lnm2.append(i) flag = 0 if n == 2: print("PS") elif n == 1: print("P") els...
output
1
16,864
0
33,729
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan wants to play a game with you. He picked some string s of length n consisting only of lowercase Latin letters. You don't know this string. Ivan has informed you about all its improper prefixes and suffixes (i.e. prefixes and suffixes ...
instruction
0
16,865
0
33,730
Tags: strings Correct Solution: ``` n=int(input()) k=2*n-2 a=[] b=[] c=[] for i in range(k): s=input() a.append(s) c.append(s) a.sort() for i in range(k): if(len(a[i])==n-1): b.append(a[i]) s1=b[0][1:n-1] s2=b[1][0:n-2] if(s1==s2): x=b[0][0] p=b[0] su=b[1] else: x=b[1][0] ...
output
1
16,865
0
33,731
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan wants to play a game with you. He picked some string s of length n consisting only of lowercase Latin letters. You don't know this string. Ivan has informed you about all its improper prefixes and suffixes (i.e. prefixes and suffixes ...
instruction
0
16,866
0
33,732
Tags: strings Correct Solution: ``` for _ in range(1): n = int(input()) limit = (2*n)-2 ind = {} e = {} d = {} for i in range(1,limit+1): s = input() if len(s) in d: d[len(s)].append(s) else: d[len(s)] = [s] if s in ind: ind[s...
output
1
16,866
0
33,733
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan wants to play a game with you. He picked some string s of length n consisting only of lowercase Latin letters. You don't know this string. Ivan has informed you about all its improper prefixes and suffixes (i.e. prefixes and suffixes ...
instruction
0
16,867
0
33,734
Tags: strings Correct Solution: ``` n = int(input()) a = [input() for i in range(2*n - 2)] sorted_a = sorted(a, key=len, reverse=True) guess = sorted_a[0] + sorted_a[1][-1] guess2 = sorted_a[1] + sorted_a[0][-1] check = [0]* len(a) for i in range(0,len(a),2): if(not((guess.startswith(sorted_a[i]) and guess.endswith(s...
output
1
16,867
0
33,735
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan wants to play a game with you. He picked some string s of length n consisting only of lowercase Latin letters. You don't know this string. Ivan has informed you about all its improper prefixes and suffixes (i.e. prefixes and suffixes ...
instruction
0
16,868
0
33,736
Tags: strings Correct Solution: ``` from collections import namedtuple SPos = namedtuple("SPos", "string, pos") n = int(input()) levels = [[] for _ in range(n)] for i in range(2 * n - 2): s = input() levels[len(s)].append(SPos(string=s, pos=i)) checkpoint = 1 for i in range(2, n): # Try to see if anythi...
output
1
16,868
0
33,737
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan wants to play a game with you. He picked some string s of length n consisting only of lowercase Latin letters. You don't know this string. Ivan has informed you about all its improper prefixes and suffixes (i.e. prefixes and suffixes ...
instruction
0
16,869
0
33,738
Tags: strings Correct Solution: ``` n = int(input()) a = [] fe = -1 se = -1 for i in range(2*n - 2): s = input() if len(s) == n - 1: if fe == -1: fe = i else: se = i a.append(s) fl = True s = a[fe] + a[se][-1] b = [''] * len(a) pr = [False] * n su = [False] * n for i ...
output
1
16,869
0
33,739
Provide tags and a correct Python 3 solution for this coding contest problem. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Let's call a substring t of string s unique, if t...
instruction
0
16,896
0
33,792
Tags: constructive algorithms, math, strings Correct Solution: ``` n, k = [int(x) for x in input().split()] if k == 1: print("1" + "0"*(n-1)) elif 3*k <= n: # print("2") print(("0" * ((n-k)//2)) + "1" + ("0"*(k-2)) + "1" + "0" * ((n-k)//2)) else: tmp = "0" * ((n-k)//2) + "1" s = tmp s = tmp * (n...
output
1
16,896
0
33,793
Provide tags and a correct Python 3 solution for this coding contest problem. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Let's call a substring t of string s unique, if t...
instruction
0
16,897
0
33,794
Tags: constructive algorithms, math, strings Correct Solution: ``` N, K = map(int, input().split()) if N == K: print("0"*N) elif K == 1: print("0"*(N-1) + "1") elif K == 3: print("1" + "0"*(N-4) + "101") else: res = ["0"]*N for i in range(0, N, N//2-K//2+1): res[i] = "1" print(''.join(re...
output
1
16,897
0
33,795
Provide tags and a correct Python 3 solution for this coding contest problem. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Let's call a substring t of string s unique, if t...
instruction
0
16,898
0
33,796
Tags: constructive algorithms, math, strings Correct Solution: ``` n, k = map( int, input().split() ) d = n - k d = d // 2 l = [] while n > 0: i = min(n,d) while i>0: l.append('1') i -= 1 n -= 1 if n > 0: l.append('0') n -= 1 print( "".join( l ) ) ```
output
1
16,898
0
33,797
Provide tags and a correct Python 3 solution for this coding contest problem. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Let's call a substring t of string s unique, if t...
instruction
0
16,899
0
33,798
Tags: constructive algorithms, math, strings Correct Solution: ``` n,k=map(int,input().split()) a=(n-k)//2 for i in range(n): if((i+1)%(a+1)==0): print("1",end='') else: print("0",end='') ```
output
1
16,899
0
33,799
Provide tags and a correct Python 3 solution for this coding contest problem. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Let's call a substring t of string s unique, if t...
instruction
0
16,900
0
33,800
Tags: constructive algorithms, math, strings Correct Solution: ``` #saved n, k = map(int, input().split()) if n == k: print('1' * n) elif k == 1: print('0' + '1' * (n - 1)) else: x = (n - k) // 2 a = '0' * x + '1' print(a * (n // (x + 1)) + '0' * (n % (x + 1))) ```
output
1
16,900
0
33,801
Provide tags and a correct Python 3 solution for this coding contest problem. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Let's call a substring t of string s unique, if t...
instruction
0
16,901
0
33,802
Tags: constructive algorithms, math, strings Correct Solution: ``` #------------------------template--------------------------# import os import sys from math import * from collections import * # from fractions import * # from functools import * from heapq import * from bisect import * from io import BytesIO, IOBase de...
output
1
16,901
0
33,803
Provide tags and a correct Python 3 solution for this coding contest problem. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Let's call a substring t of string s unique, if t...
instruction
0
16,902
0
33,804
Tags: constructive algorithms, math, strings Correct Solution: ``` n, k = list(map(int,input().split())) chuj_twojej_starej = (n - k) // 2 + 1 i = 1 while True: if i % chuj_twojej_starej == 0: print(0, end = "") else: print(1, end = "") if i == n: break i += 1 ```
output
1
16,902
0
33,805
Provide tags and a correct Python 3 solution for this coding contest problem. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Let's call a substring t of string s unique, if t...
instruction
0
16,903
0
33,806
Tags: constructive algorithms, math, strings Correct Solution: ``` from collections import * from math import * n,k = map(int,input().split()) x = (n-k)//2+1 for i in range(1,n+1): if(i%x) == 0: print(1,end="") else: print(0,end="") print() ```
output
1
16,903
0
33,807
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Le...
instruction
0
16,904
0
33,808
Yes
output
1
16,904
0
33,809
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Le...
instruction
0
16,905
0
33,810
Yes
output
1
16,905
0
33,811
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Le...
instruction
0
16,906
0
33,812
Yes
output
1
16,906
0
33,813
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Le...
instruction
0
16,907
0
33,814
Yes
output
1
16,907
0
33,815
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Le...
instruction
0
16,908
0
33,816
No
output
1
16,908
0
33,817
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Le...
instruction
0
16,909
0
33,818
No
output
1
16,909
0
33,819
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Le...
instruction
0
16,910
0
33,820
No
output
1
16,910
0
33,821
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Le...
instruction
0
16,911
0
33,822
No
output
1
16,911
0
33,823
Provide tags and a correct Python 3 solution for this coding contest problem. While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem. Given two strings a and b, find the length of their longe...
instruction
0
17,314
0
34,628
Tags: constructive algorithms, strings Correct Solution: ``` strng1, strng2 = input(), input() if strng1 == strng2: print(-1) elif len(strng1) > len(strng2): print(len(strng1)) else: print(len(strng2)) ```
output
1
17,314
0
34,629
Provide tags and a correct Python 3 solution for this coding contest problem. While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem. Given two strings a and b, find the length of their longe...
instruction
0
17,315
0
34,630
Tags: constructive algorithms, strings Correct Solution: ``` first = input() second = input() m = '' counter = 0 def compute(a, b): m = a[:] counter = len(m) if a == b: return -1 for i in range(0, len(m)): if m not in b: return counter else: counter-=1 ...
output
1
17,315
0
34,631
Provide tags and a correct Python 3 solution for this coding contest problem. While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem. Given two strings a and b, find the length of their longe...
instruction
0
17,316
0
34,632
Tags: constructive algorithms, strings Correct Solution: ``` a=str(input()) b=str(input()) c=list(b) d=list(a) if a==b: print(-1) elif len(c)==0 or len(d)==0: print(-1) else: print(max(len(c),len(d))) ```
output
1
17,316
0
34,633
Provide tags and a correct Python 3 solution for this coding contest problem. While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem. Given two strings a and b, find the length of their longe...
instruction
0
17,317
0
34,634
Tags: constructive algorithms, strings Correct Solution: ``` a = input() b = input() if a == b: otv = -1 elif len(a) > len(b): otv = len(a) else: otv = len(b) print(otv) ```
output
1
17,317
0
34,635
Provide tags and a correct Python 3 solution for this coding contest problem. While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem. Given two strings a and b, find the length of their longe...
instruction
0
17,318
0
34,636
Tags: constructive algorithms, strings Correct Solution: ``` s = input() w = input() print('-1' if s == w else max(len(s), len(w))) ```
output
1
17,318
0
34,637