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 a binary string s (recall that a string is binary if each character is either 0 or 1).
Let f(t) be the decimal representation of integer t written in binary form (possibly with le... | instruction | 0 | 93,604 | 0 | 187,208 |
Yes | output | 1 | 93,604 | 0 | 187,209 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a binary string s (recall that a string is binary if each character is either 0 or 1).
Let f(t) be the decimal representation of integer t written in binary form (possibly with le... | instruction | 0 | 93,605 | 0 | 187,210 |
Yes | output | 1 | 93,605 | 0 | 187,211 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a binary string s (recall that a string is binary if each character is either 0 or 1).
Let f(t) be the decimal representation of integer t written in binary form (possibly with le... | instruction | 0 | 93,606 | 0 | 187,212 |
Yes | output | 1 | 93,606 | 0 | 187,213 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a binary string s (recall that a string is binary if each character is either 0 or 1).
Let f(t) be the decimal representation of integer t written in binary form (possibly with le... | instruction | 0 | 93,607 | 0 | 187,214 |
Yes | output | 1 | 93,607 | 0 | 187,215 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a binary string s (recall that a string is binary if each character is either 0 or 1).
Let f(t) be the decimal representation of integer t written in binary form (possibly with le... | instruction | 0 | 93,608 | 0 | 187,216 |
No | output | 1 | 93,608 | 0 | 187,217 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a binary string s (recall that a string is binary if each character is either 0 or 1).
Let f(t) be the decimal representation of integer t written in binary form (possibly with le... | instruction | 0 | 93,609 | 0 | 187,218 |
No | output | 1 | 93,609 | 0 | 187,219 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a binary string s (recall that a string is binary if each character is either 0 or 1).
Let f(t) be the decimal representation of integer t written in binary form (possibly with le... | instruction | 0 | 93,610 | 0 | 187,220 |
No | output | 1 | 93,610 | 0 | 187,221 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a binary string s (recall that a string is binary if each character is either 0 or 1).
Let f(t) be the decimal representation of integer t written in binary form (possibly with le... | instruction | 0 | 93,611 | 0 | 187,222 |
No | output | 1 | 93,611 | 0 | 187,223 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's denote the function f(s) that takes a string s consisting of lowercase Latin letters and dots, and returns a string consisting of lowercase Latin letters as follows:
1. let r be an empt... | instruction | 0 | 93,678 | 0 | 187,356 |
No | output | 1 | 93,678 | 0 | 187,357 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's denote the function f(s) that takes a string s consisting of lowercase Latin letters and dots, and returns a string consisting of lowercase Latin letters as follows:
1. let r be an empt... | instruction | 0 | 93,679 | 0 | 187,358 |
No | output | 1 | 93,679 | 0 | 187,359 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's denote the function f(s) that takes a string s consisting of lowercase Latin letters and dots, and returns a string consisting of lowercase Latin letters as follows:
1. let r be an empt... | instruction | 0 | 93,680 | 0 | 187,360 |
No | output | 1 | 93,680 | 0 | 187,361 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's denote the function f(s) that takes a string s consisting of lowercase Latin letters and dots, and returns a string consisting of lowercase Latin letters as follows:
1. let r be an empt... | instruction | 0 | 93,681 | 0 | 187,362 |
No | output | 1 | 93,681 | 0 | 187,363 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 β€ k1 < k2 < ... < k|x| β€ |s|).
You've got two strings β s and t. Let's consider all subsequences of string s, co... | instruction | 0 | 93,795 | 0 | 187,590 |
Tags: data structures, dp, strings
Correct Solution:
```
import bisect
import string
s = input()
t = input()
max_match = [0 for i in range(len(s))]
min_match = [0 for i in range(len(s))]
char_idx = [0 for i in range(30)]
char_occur = [ [] for i in range(30) ]
for (i, ch) in enumerate(t):
idx = ord(ch) - ord('a')... | output | 1 | 93,795 | 0 | 187,591 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 β€ k1 < k2 < ... < k|x| β€ |s|).
You've got two strings β s and t. ... | instruction | 0 | 93,796 | 0 | 187,592 |
No | output | 1 | 93,796 | 0 | 187,593 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 β€ k1 < k2 < ... < k|x| β€ |s|).
You've got two strings β s and t. ... | instruction | 0 | 93,797 | 0 | 187,594 |
No | output | 1 | 93,797 | 0 | 187,595 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 β€ k1 < k2 < ... < k|x| β€ |s|).
You've got two strings β s and t. ... | instruction | 0 | 93,798 | 0 | 187,596 |
No | output | 1 | 93,798 | 0 | 187,597 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 β€ k1 < k2 < ... < k|x| β€ |s|).
You've got two strings β s and t. ... | instruction | 0 | 93,799 | 0 | 187,598 |
No | output | 1 | 93,799 | 0 | 187,599 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters disappeared while writing the string. That's b... | instruction | 0 | 94,042 | 0 | 188,084 |
Tags: brute force, dp, greedy, strings
Correct Solution:
```
n = int(input())
s = input()
S = [ord(znak) - 97 for znak in s]
a = list(map(int, input().strip().split(' ')))
#print(n, S, a)
MOD = 10**9 + 7
st = [0]*(n+1)
st[0] = 1
maks = [0]*(n+1)
minway = [10**4]*(n+1)
minway[0] = 0
for i in range(1, n + 1):
cnt =... | output | 1 | 94,042 | 0 | 188,085 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters disappeared while writing the string. That's b... | instruction | 0 | 94,043 | 0 | 188,086 |
Tags: brute force, dp, greedy, strings
Correct Solution:
```
N, s, l = int(input()), [ord(x) - ord('a') for x in input()], [int(x) for x in input().split()]
arr = [[1, l[s[0]]]]
total = 1
ma = 1
t = 1
mi = 1
for c in s[1:]:
tmp = 0
for i in range(len(arr)):
arr[i][1] = min(arr[i][1],l[c])
if i + 1 >= arr[i][1]:
... | output | 1 | 94,043 | 0 | 188,087 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters disappeared while writing the string. That's b... | instruction | 0 | 94,044 | 0 | 188,088 |
Tags: brute force, dp, greedy, strings
Correct Solution:
```
from sys import stdin, stdout
n = int(stdin.readline())
s = stdin.readline().strip()
length = list(map(int, stdin.readline().strip().split()))
bn = [2 ** i for i in range(10 ** 3 + 2)]
dp = [0 for i in range(n + 10)]
dp[0] = 1
dp[-1] = 1
ans = [0, 1, 0]
dp... | output | 1 | 94,044 | 0 | 188,089 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters disappeared while writing the string. That's b... | instruction | 0 | 94,045 | 0 | 188,090 |
Tags: brute force, dp, greedy, strings
Correct Solution:
```
import math
import sys
from bisect import bisect_right, bisect_left, insort_right
from collections import Counter, defaultdict
from heapq import heappop, heappush
from itertools import accumulate, permutations, combinations
from sys import stdout
R = lambda:... | output | 1 | 94,045 | 0 | 188,091 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters disappeared while writing the string. That's b... | instruction | 0 | 94,046 | 0 | 188,092 |
Tags: brute force, dp, greedy, strings
Correct Solution:
```
import sys
from collections import deque
def debug(x, table):
for name, val in table.items():
if x is val:
print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
return None
def get_minsp(message, As):
min_sp = 1
... | output | 1 | 94,046 | 0 | 188,093 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters disappeared while writing the string. That's b... | instruction | 0 | 94,047 | 0 | 188,094 |
Tags: brute force, dp, greedy, strings
Correct Solution:
```
import sys
mod = pow(10, 9) + 7
n = int(sys.stdin.readline())
s = sys.stdin.readline()[:-1]
a = [int(x) for x in sys.stdin.readline().split()]
dp = [0 for _ in range(n+1)]
dp[0] = 1
def ci(c):
return ord(c)-ord('a')
l = 0
for i in range(1, n+1):
... | output | 1 | 94,047 | 0 | 188,095 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters disappeared while writing the string. That's b... | instruction | 0 | 94,048 | 0 | 188,096 |
Tags: brute force, dp, greedy, strings
Correct Solution:
```
#!/bin/python3
import sys
mod = 10 **9 + 7
n = int(input())
s = input()
cnt = list(map(int, input().split()))
dp = [0]
for i in range(0,n):
dp.append(0)
dp[0] = 1
ans2 = 1
for i in range(1,n + 1):
o = i -1
ml = cnt[ord(s[o]) - ord('a')]
l = 1
... | output | 1 | 94,048 | 0 | 188,097 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters disappeared while writing the string. That's b... | instruction | 0 | 94,049 | 0 | 188,098 |
Tags: brute force, dp, greedy, strings
Correct Solution:
```
N, s, l = int(input()), [ord(x) - ord('a') for x in input()], [int(x) for x in input().split()]
arr = [[1, l[s[0]]]]
total = 1
ma = 1
t = 1
mi = 1
for c in s[1:]:
tmp = 0
for i in range(len(arr)):
arr[i][1] = min(arr[i][1],l[c])
if i + 1 >= arr[i][1]:
... | output | 1 | 94,049 | 0 | 188,099 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters... | instruction | 0 | 94,050 | 0 | 188,100 |
Yes | output | 1 | 94,050 | 0 | 188,101 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters... | instruction | 0 | 94,051 | 0 | 188,102 |
Yes | output | 1 | 94,051 | 0 | 188,103 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters... | instruction | 0 | 94,052 | 0 | 188,104 |
Yes | output | 1 | 94,052 | 0 | 188,105 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters... | instruction | 0 | 94,053 | 0 | 188,106 |
Yes | output | 1 | 94,053 | 0 | 188,107 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters... | instruction | 0 | 94,054 | 0 | 188,108 |
No | output | 1 | 94,054 | 0 | 188,109 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters... | instruction | 0 | 94,055 | 0 | 188,110 |
No | output | 1 | 94,055 | 0 | 188,111 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters... | instruction | 0 | 94,056 | 0 | 188,112 |
No | output | 1 | 94,056 | 0 | 188,113 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters... | instruction | 0 | 94,057 | 0 | 188,114 |
No | output | 1 | 94,057 | 0 | 188,115 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.
Here, a ACGT string is a string that contains no characters other than `A`, `C`, `G` and `T`.
Constra... | instruction | 0 | 94,195 | 0 | 188,390 |
"Correct Solution:
```
import re
ans = max(map(len, re.findall("[ACGT]*", input())))
print(ans)
``` | output | 1 | 94,195 | 0 | 188,391 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.
Here, a ACGT string is a string that contains no characters other than `A`, `C`, `G` and `T`.
Constra... | instruction | 0 | 94,196 | 0 | 188,392 |
"Correct Solution:
```
a="".join(["1" if s in ["A","C","G","T"] else "0" for s in input()])
ans=[len(s) for s in a.split("0")]
print(max(ans))
``` | output | 1 | 94,196 | 0 | 188,393 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.
Here, a ACGT string is a string that contains no characters other than `A`, `C`, `G` and `T`.
Constra... | instruction | 0 | 94,197 | 0 | 188,394 |
"Correct Solution:
```
import re
data = input()
t = re.split('[^ACGT]+', data)
t.sort(key=len, reverse=True)
print(len(t[0]))
``` | output | 1 | 94,197 | 0 | 188,395 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.
Here, a ACGT string is a string that contains no characters other than `A`, `C`, `G` and `T`.
Constra... | instruction | 0 | 94,198 | 0 | 188,396 |
"Correct Solution:
```
import re
ll = list(map(len,re.sub('[^ACGT]',' ', input()).split()))
if len(ll) == 0:print(0)
else:print(max(ll))
``` | output | 1 | 94,198 | 0 | 188,397 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.
Here, a ACGT string is a string that contains no characters other than `A`, `C`, `G` and `T`.
Constra... | instruction | 0 | 94,199 | 0 | 188,398 |
"Correct Solution:
```
import re
result = re.findall('[ATCG]+',input(),re.S)
if len(result)>0:
print(max(list(map(len,result))))
else:
print(0)
``` | output | 1 | 94,199 | 0 | 188,399 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.
Here, a ACGT string is a string that contains no characters other than `A`, `C`, `G` and `T`.
Constra... | instruction | 0 | 94,200 | 0 | 188,400 |
"Correct Solution:
```
s = input()
m = 0
count = 0
for i in s:
if i in ["A","C","G","T"]: count+=1
else: count=0
m = max(m,count)
print(m)
``` | output | 1 | 94,200 | 0 | 188,401 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.
Here, a ACGT string is a string that contains no characters other than `A`, `C`, `G` and `T`.
Constra... | instruction | 0 | 94,201 | 0 | 188,402 |
"Correct Solution:
```
print(max(map(lambda x:len(x), "".join([_ if _ in "ACGT" else "_" for _ in str(input())]).split("_"))))
``` | output | 1 | 94,201 | 0 | 188,403 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.
Here, a ACGT string is a string that contains no characters other than `A`, `C`, `G` and `T`.
Constra... | instruction | 0 | 94,202 | 0 | 188,404 |
"Correct Solution:
```
import re
s=re.split("[^ACGT]", input())
a=[]
for i in range(len(s)):
a.append(len(s[i]))
print(max(a))
``` | output | 1 | 94,202 | 0 | 188,405 |
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 uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.
Here, a ACGT string is a string that contains ... | instruction | 0 | 94,209 | 0 | 188,418 |
No | output | 1 | 94,209 | 0 | 188,419 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length N and another string T of length M. These strings consist of lowercase English letters.
A string X is called a good string when the following conditions are all met:
* Let L be the length of X. L is divisible by b... | instruction | 0 | 94,211 | 0 | 188,422 |
"Correct Solution:
```
N,M=map(int,input().split());import fractions;L=M//fractions.gcd(M,N)*N;print((-1,L)[input()[::L//M]==input()[::L//N]])
``` | output | 1 | 94,211 | 0 | 188,423 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length N and another string T of length M. These strings consist of lowercase English letters.
A string X is called a good string when the following conditions are all met:
* Let L be the length of X. L is divisible by b... | instruction | 0 | 94,212 | 0 | 188,424 |
"Correct Solution:
```
N,M=map(int,input().split())
n,m=N,M
s=input()
t=input()
while m:
n,m=m,n%m
gcd=n
lcm=N*M//gcd
step1=N//gcd
step2=M//gcd
if all(s[i*step1]==t[i*step2] for i in range(gcd)):
print(lcm)
else:
print(-1)
``` | output | 1 | 94,212 | 0 | 188,425 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length N and another string T of length M. These strings consist of lowercase English letters.
A string X is called a good string when the following conditions are all met:
* Let L be the length of X. L is divisible by b... | instruction | 0 | 94,213 | 0 | 188,426 |
"Correct Solution:
```
from fractions import gcd
N, M = map(int, input().split())
S = input()
T = input()
g = gcd(N, M)
lcm = N * M // g
for i in range(g):
if S[i*N//g] != T[i*M//g]:
print(-1)
exit()
print(lcm)
``` | output | 1 | 94,213 | 0 | 188,427 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length N and another string T of length M. These strings consist of lowercase English letters.
A string X is called a good string when the following conditions are all met:
* Let L be the length of X. L is divisible by b... | instruction | 0 | 94,214 | 0 | 188,428 |
"Correct Solution:
```
import fractions
n, m = map(int, input().split())
s = input()
t = input()
sr = fractions.gcd(n, m)
sg, tg = n // sr, m // sr
for i in range(sr):
if s[i * sg] != t[i * tg]:
print(-1)
exit()
print(sg * m)
``` | output | 1 | 94,214 | 0 | 188,429 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length N and another string T of length M. These strings consist of lowercase English letters.
A string X is called a good string when the following conditions are all met:
* Let L be the length of X. L is divisible by b... | instruction | 0 | 94,215 | 0 | 188,430 |
"Correct Solution:
```
from math import gcd
def lcm(a,b):
return a*b//gcd(a,b)
N,M = map(int,input().split())
S = input()
T = input()
g = gcd(N,M)
l = lcm(N,M)
for i in range(g):
if S[l//M*i] != T[l//N*i]:
print(-1)
exit()
print(l)
``` | output | 1 | 94,215 | 0 | 188,431 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length N and another string T of length M. These strings consist of lowercase English letters.
A string X is called a good string when the following conditions are all met:
* Let L be the length of X. L is divisible by b... | instruction | 0 | 94,216 | 0 | 188,432 |
"Correct Solution:
```
n,m=map(int,input().split())
s=input()
t=input()
import fractions
g=fractions.gcd(n,m)
m0=m//g
n0=n//g
i=0
while i*n0<n and i*m0<m:
if s[i*n0]==t[i*m0]:
pass
else:
print(-1)
exit()
i+=1
print(n*m//g)
``` | output | 1 | 94,216 | 0 | 188,433 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length N and another string T of length M. These strings consist of lowercase English letters.
A string X is called a good string when the following conditions are all met:
* Let L be the length of X. L is divisible by b... | instruction | 0 | 94,217 | 0 | 188,434 |
"Correct Solution:
```
from fractions import gcd
N, M = map(int, input().split(" "))
S = input()
T = input()
G = gcd(N, M)
L = N * M // G
for i in range(G):
if S[i*N//G] != T[i*M//G]:
print(-1)
exit(0)
print(L)
``` | output | 1 | 94,217 | 0 | 188,435 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length N and another string T of length M. These strings consist of lowercase English letters.
A string X is called a good string when the following conditions are all met:
* Let L be the length of X. L is divisible by b... | instruction | 0 | 94,218 | 0 | 188,436 |
"Correct Solution:
```
from fractions import gcd
N, M = map(int, input().split())
S, T = [input() for _ in range(2)]
L = gcd(N, M)
print(N*M//L if all([S[i*N//L] == T[i*M//L] for i in range(L)]) else -1)
``` | output | 1 | 94,218 | 0 | 188,437 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.