message stringlengths 2 23.4k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 129 108k | cluster float64 6 6 | __index_level_0__ int64 258 216k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of relations: synonymy (i. e. the two words mean the same) and antonymy (i. e. the two words mean the opposite). From time to time ... | instruction | 0 | 1,365 | 6 | 2,730 |
Tags: data structures, dfs and similar, dp, dsu, graphs
Correct Solution:
```
def union(u,v,parent):
x = find(u,parent)
y = find(v,parent)
if x==y:
return
parent[x]=y
def find(u,parent):
k = parent[u]
while k != parent[k]:
k = parent[k]
while parent[u] != k:
u, parent[u]... | output | 1 | 1,365 | 6 | 2,731 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of relations: synonymy (i. e. the two words mean the same) and antonymy (i. e. the two words mean the opposite). From time to time ... | instruction | 0 | 1,366 | 6 | 2,732 |
Tags: data structures, dfs and similar, dp, dsu, graphs
Correct Solution:
```
n,m,q=map(int,input().split())
a=input().split()
c={x:([x],[]) for x in a}
for i in range(m):
t,x,y=input().split()
if t=='2':
sign=1
else: sign=0
if c[x][0] is c[y][1-sign]:
print("NO")
continue
pr... | output | 1 | 1,366 | 6 | 2,733 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of relations: synonymy (i. e. the two words mean the same) and antonymy (i. e. the two words mean the opposite). From time to time ... | instruction | 0 | 1,367 | 6 | 2,734 |
Tags: data structures, dfs and similar, dp, dsu, graphs
Correct Solution:
```
class Union:
def __init__(self, n):
self.p = {i:i for i in range(n)}
self.rank = {i:1 for i in range(n)}
def find(self, x):
if x < 0: return x
if self.p[x] != x:
self.p[x] ... | output | 1 | 1,367 | 6 | 2,735 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of relations: synonymy (i. e. the two words mean the same) and antonymy (i. e. the two words mean the opposite). From time to time ... | instruction | 0 | 1,368 | 6 | 2,736 |
Tags: data structures, dfs and similar, dp, dsu, graphs
Correct Solution:
```
f = lambda: input().split()
n, m, k = map(int, f())
c = {x: ([x], []) for x in f()}
for i in range(m):
t, x, y = f()
s = 2 - int(t)
cx, cy = c[x], c[y]
if cx[0] is cy[s]:
print('NO')
continue
print('... | output | 1 | 1,368 | 6 | 2,737 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of relations: synonymy (i. e. the two words mean the same) and antonymy (i. e. the t... | instruction | 0 | 1,369 | 6 | 2,738 |
No | output | 1 | 1,369 | 6 | 2,739 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of relations: synonymy (i. e. the two words mean the same) and antonymy (i. e. the t... | instruction | 0 | 1,370 | 6 | 2,740 |
No | output | 1 | 1,370 | 6 | 2,741 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of relations: synonymy (i. e. the two words mean the same) and antonymy (i. e. the t... | instruction | 0 | 1,371 | 6 | 2,742 |
No | output | 1 | 1,371 | 6 | 2,743 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of relations: synonymy (i. e. the two words mean the same) and antonymy (i. e. the t... | instruction | 0 | 1,372 | 6 | 2,744 |
No | output | 1 | 1,372 | 6 | 2,745 |
Provide a correct Python 3 solution for this coding contest problem.
Advanced Creative Mobile (ACM) has decided to develop a GUI application to be installed in a new portable computer.
As shown in the figure below, the GUI has a nested structure in which it has one main panel, several panels are arranged on it, and s... | instruction | 0 | 1,609 | 6 | 3,218 |
"Correct Solution:
```
class Panel:
def __init__(self, name, points, children):
self.name = name
self.x1 = points[0]
self.x2 = points[2]
self.y1 = points[1]
self.y2 = points[3]
self.children = children
self.child_cnt = len(children)
def search(self, x, y)... | output | 1 | 1,609 | 6 | 3,219 |
Provide a correct Python 3 solution for this coding contest problem.
Advanced Creative Mobile (ACM) has decided to develop a GUI application to be installed in a new portable computer.
As shown in the figure below, the GUI has a nested structure in which it has one main panel, several panels are arranged on it, and s... | instruction | 0 | 1,610 | 6 | 3,220 |
"Correct Solution:
```
class Panel(object):
def __init__(self, name, depth, child, x1, y1, x2, y2):
self.name = name
self.depth = depth
self.child = child
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
def touch(self, x, y, depth):
if depth <... | output | 1 | 1,610 | 6 | 3,221 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The famous joke programming language HQ9+ has only 4 commands. In this problem we will explore its subset — a language called HQ...
Input
The only line of the input is a string between 1 and 106 characters long.
Output
Output "Yes" or "N... | instruction | 0 | 2,768 | 6 | 5,536 |
Tags: *special, constructive algorithms
Correct Solution:
```
from collections import Counter
import re
def issquare(n):
return round(n**0.5)**2==n
def check_orig(code):
counts = Counter(code)
orig = ''
if not issquare(counts['Q']):
return ''
nq = round(counts['Q']**0.5)
if counts['H']... | output | 1 | 2,768 | 6 | 5,537 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The famous joke programming language HQ9+ has only 4 commands. In this problem we will explore its subset — a language called HQ...
Input
The only line of the input is a string between 1 and 106 characters long.
Output
Output "Yes" or "N... | instruction | 0 | 2,769 | 6 | 5,538 |
Tags: *special, constructive algorithms
Correct Solution:
```
a = input()
b = []
h = ''
c = 0
for i in a:
if i == 'Q':
c += 1
if c == 0:
print('Yes')
exit(0)
r = -1
for i in range(1001):
if i*i == c:
r = i
break
if r == -1:
print('No')
exit(0)
h = [a.split('Q')[0], a.split('Q')[-1]]
c = [len(h[0]), len(h[1]... | output | 1 | 2,769 | 6 | 5,539 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The famous joke programming language HQ9+ has only 4 commands. In this problem we will explore its subset — a language called HQ...
Input
The only line of the input is a string between 1 and 106 characters long.
Output
Output "Yes" or "N... | instruction | 0 | 2,770 | 6 | 5,540 |
Tags: *special, constructive algorithms
Correct Solution:
```
import sys
s = input()
qc = s.count('Q')
qs = int(qc ** 0.5)
hc = s.count('H')
if qs == 0:
print('Yes')
sys.exit(0)
if not qc == qs ** 2:
print('No')
sys.exit(0)
if not hc % (qs + 1) == 0:
print('No')
sys.exit(0)
t = s.split('Q')
pr... | output | 1 | 2,770 | 6 | 5,541 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release of the product.
You are to implement t... | instruction | 0 | 2,904 | 6 | 5,808 |
Tags: implementation, strings
Correct Solution:
```
from sys import stdin, stdout
class text:
def __init__(self, lines):
self.center_left = True
self.lines = list(map(lambda x: x.strip(), lines))
self.characters = max(map(lambda x: len(x), self.lines))
def print_head(self):
print... | output | 1 | 2,904 | 6 | 5,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release of the product.
You are to implement t... | instruction | 0 | 2,905 | 6 | 5,810 |
Tags: implementation, strings
Correct Solution:
```
__author__ = 'Darren'
def solve():
import sys
stdin = sys.stdin if True else open('data')
texts = [line.strip() for line in stdin]
max_length = max(map(len, texts))
left_more = False
print('*' * (max_length + 2))
for i in range(len(texts... | output | 1 | 2,905 | 6 | 5,811 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release of the product.
You are to implement t... | instruction | 0 | 2,906 | 6 | 5,812 |
Tags: implementation, strings
Correct Solution:
```
from sys import stdin
from math import ceil, floor
doc = [line.strip() for line in stdin]
max_len = max(len(line) for line in doc)
counter = 1
print('*' * (max_len+2))
for line in doc:
line_diff = (max_len-len(line))//2
if (max_len-len(line)) % 2 != 0:
... | output | 1 | 2,906 | 6 | 5,813 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release of the product.
You are to implement t... | instruction | 0 | 2,907 | 6 | 5,814 |
Tags: implementation, strings
Correct Solution:
```
from sys import stdin
#bringing them closer left or right alternatively
#stdin...
def CF_5B():
lines=[]
for line in stdin.readlines():
line=line.strip()
lines.append(line)
length=0
for i in range(len(lines)):
if len(lines[i])>le... | output | 1 | 2,907 | 6 | 5,815 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release of the product.
You are to implement t... | instruction | 0 | 2,908 | 6 | 5,816 |
Tags: implementation, strings
Correct Solution:
```
import sys
l = 0;
strs = [];
for s in sys.stdin:
s1 = s.strip()
l = max(l, len(s1))
strs.append(s1)
print('*' * (l + 2))
i = 0
for s in strs:
print('*', end='')
a = 0; b = 0;
val = l - len(s)
if(val % 2 == 0):
a = val // 2
... | output | 1 | 2,908 | 6 | 5,817 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release of the product.
You are to implement t... | instruction | 0 | 2,909 | 6 | 5,818 |
Tags: implementation, strings
Correct Solution:
```
lista=[]
while True:
try:
palabra=input()
lista.append(palabra)
except EOFError:
break
larga=0
lado="der"
for i in lista:
if len(i)>larga:
larga=len(i)
print("*"*(larga+2))
for i in lista:
palabra="*"
diferencia=la... | output | 1 | 2,909 | 6 | 5,819 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release of the product.
You are to implement t... | instruction | 0 | 2,910 | 6 | 5,820 |
Tags: implementation, strings
Correct Solution:
```
import sys
maxlen = 0
ls = []
for line in sys.stdin:
maxlen = max(maxlen, len(line))
ls.append(line.replace('\n', ''))
ind = 0
maxlen -= 1
print('*' * (maxlen+2))
for p in ls:
res = maxlen - len(p)
left = ''
right = ''
if res % 2 == 1:
... | output | 1 | 2,910 | 6 | 5,821 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release of the product.
You are to implement t... | instruction | 0 | 2,911 | 6 | 5,822 |
Tags: implementation, strings
Correct Solution:
```
import sys
def main():
strings = [x.strip() for x in sys.stdin]
solver(strings)
def solver(strings):
maxLength = 0
for s in strings:
if len(s) > maxLength:
maxLength = len(s)
print("*" * (maxLength + 2))
leftBound = True
for s in strings:
spaces = max... | output | 1 | 2,911 | 6 | 5,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth ... | instruction | 0 | 2,912 | 6 | 5,824 |
Yes | output | 1 | 2,912 | 6 | 5,825 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth ... | instruction | 0 | 2,916 | 6 | 5,832 |
No | output | 1 | 2,916 | 6 | 5,833 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth ... | instruction | 0 | 2,918 | 6 | 5,836 |
No | output | 1 | 2,918 | 6 | 5,837 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth ... | instruction | 0 | 2,919 | 6 | 5,838 |
No | output | 1 | 2,919 | 6 | 5,839 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.
He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', ... | instruction | 0 | 3,006 | 6 | 6,012 |
Tags: constructive algorithms
Correct Solution:
```
def three_palindrome(length):
quotient = length // 4
reminder = length % 4
return "aabb" * quotient + "aabb"[:reminder]
def solver():
length = int(input())
print(three_palindrome(length))
if __name__ == "__main__":
solver()
``` | output | 1 | 3,006 | 6 | 6,013 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.
He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', ... | instruction | 0 | 3,007 | 6 | 6,014 |
Tags: constructive algorithms
Correct Solution:
```
def Main():
n = int(input())
k = n-1
s = ('b')*k + 'a'
rez = ""
if n < 4:
print(s)
else:
flag = True
cnt = 0
if n%2 == 0 or n%2 == 1:
for i in range(n):
if flag == True:
rez += 'b'
cnt += 1
if cnt % 2 == 0:
cnt = 0
fl... | output | 1 | 3,007 | 6 | 6,015 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.
He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', ... | instruction | 0 | 3,008 | 6 | 6,016 |
Tags: constructive algorithms
Correct Solution:
```
#3-palindrome
n=int(input())
s='aabb'*10000000
print(s[0:n])
``` | output | 1 | 3,008 | 6 | 6,017 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.
He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', ... | instruction | 0 | 3,009 | 6 | 6,018 |
Tags: constructive algorithms
Correct Solution:
```
n=int(input())
print('aabb'*(n//4),end='')
if(n%4==1 or n%4==2):
print('a'*(n%4))
elif n%4==3:
print('aab')
``` | output | 1 | 3,009 | 6 | 6,019 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.
He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', ... | instruction | 0 | 3,010 | 6 | 6,020 |
Tags: constructive algorithms
Correct Solution:
```
n = int(input())
ans = ""
ans += "aabb"*(n//4)
if n%4==1:
ans+="a"
elif n%4==2:
ans += "aa"
elif n%4==3:
ans+="aab"
elif n%4==4:
ans+="aabb"
print(ans)
``` | output | 1 | 3,010 | 6 | 6,021 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.
He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', ... | instruction | 0 | 3,011 | 6 | 6,022 |
Tags: constructive algorithms
Correct Solution:
```
n = int(input())
s = "aabb" * n
print((s)[:n])
``` | output | 1 | 3,011 | 6 | 6,023 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest.
To obfuscate the ... | instruction | 0 | 3,831 | 6 | 7,662 |
Tags: greedy, implementation, strings
Correct Solution:
```
alphabet = [chr(i) for i in range(97, 123)]
line = input()
obfuscated_array = []
for el in line:
obfuscated_array.append(el)
point = 0
while len(obfuscated_array) != 0:
if obfuscated_array[0] == alphabet[0]:
for _ in range(obfuscated_array.cou... | output | 1 | 3,831 | 6 | 7,663 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest.
To obfuscate the ... | instruction | 0 | 3,832 | 6 | 7,664 |
Tags: greedy, implementation, strings
Correct Solution:
```
s = input()
length = len(s)
a = ord('a')
i = 0
for c in s:
if (a + i < ord(c)):
print("NO")
break
if (a + i == ord(c)):
i += 1
else:
print("YES")
``` | output | 1 | 3,832 | 6 | 7,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest.
To obfuscate the ... | instruction | 0 | 3,833 | 6 | 7,666 |
Tags: greedy, implementation, strings
Correct Solution:
```
##n = int(input())
##a = list(map(int, input().split()))
##print(' '.join(map(str, res)))
s = list(input())
n = len(s)
flag = True
last = ord(s[0])
if last != ord('a'):
flag = False
else:
for i in range(1, n):
cur = ord(s[i])
if cur-l... | output | 1 | 3,833 | 6 | 7,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest.
To obfuscate the ... | instruction | 0 | 3,834 | 6 | 7,668 |
Tags: greedy, implementation, strings
Correct Solution:
```
n=input()
k=96
for i in n:
if(ord(i)-k>1):
k=0
break
elif(ord(i)-k==1):
k+=1
if(k):
print("YES")
else:
print("NO")
``` | output | 1 | 3,834 | 6 | 7,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest.
To obfuscate the ... | instruction | 0 | 3,835 | 6 | 7,670 |
Tags: greedy, implementation, strings
Correct Solution:
```
a=list(input())
b=[]
for i in a:
if i not in b:
b.append(i)
for i in range(len(b)):
if (ord(b[i])-ord('a'))!=i:
exit(print('NO'))
print('YES')
``` | output | 1 | 3,835 | 6 | 7,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest.
To obfuscate the ... | instruction | 0 | 3,836 | 6 | 7,672 |
Tags: greedy, implementation, strings
Correct Solution:
```
a=input()
x=96
b=''
c=[]
for i in set(a):
if x<ord(i):
x=ord(i)
for i in range(97,x+1):
if chr(i) in a:
b+=(chr(i))
else:
print("NO")
exit(0)
for i in b:
c.append(a.index(i))
d=sorted(c)
if d==c:
print("YES"... | output | 1 | 3,836 | 6 | 7,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest.
To obfuscate the ... | instruction | 0 | 3,837 | 6 | 7,674 |
Tags: greedy, implementation, strings
Correct Solution:
```
def Main():
inp = list(input())
found = 0
error = False
for c in inp:
p = ord(c) - ord('a') + 1
if p == found + 1:
found += 1
elif p > found:
error = True
break
if error == False:
print("YES")
else:
print("NO")
if __name__ == "__m... | output | 1 | 3,837 | 6 | 7,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest.
To obfuscate the ... | instruction | 0 | 3,838 | 6 | 7,676 |
Tags: greedy, implementation, strings
Correct Solution:
```
import sys
s = input()
expected = ord('a')
for i in s :
if ord(i) > expected:
print('NO')
sys.exit()
elif ord(i) == expected:
expected +=1
print('YES')
``` | output | 1 | 3,838 | 6 | 7,677 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that n⋅ m = k and when the word is written by using n rows and... | instruction | 0 | 4,223 | 6 | 8,446 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
import math
import sys
k=int(input())
t=int(math.sqrt(k))
n=m=0
s=""
vow="aeiou"
for i in range(5,t+1):
if k%i==0:
n=i
m=k//i
if n==0:
print(-1)
sys.exit(0)
for i in range(n):
for j in range(m):
s+=vow[(i... | output | 1 | 4,223 | 6 | 8,447 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that n⋅ m = k and when the word is written by using n rows and... | instruction | 0 | 4,224 | 6 | 8,448 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
# import random
def is_prime(n):
if n == 2 or n == 3: return True
if n < 2 or n%2 == 0: return False
if n < 9: return True
if n%3 == 0: return False
r = int(n**0.5)
f = 5
while f <= r:
# print (" ",f)
if n%f == 0: return Fals... | output | 1 | 4,224 | 6 | 8,449 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that n⋅ m = k and when the word is written by using n rows and... | instruction | 0 | 4,225 | 6 | 8,450 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
k = int(input())
if k < 25:
print(-1)
else:
a = 'aeiou'
max1 = min1 = 0
for q in range(round(k**(1/2))+1, 0, -1):
if k % q == 0:
max1, min1 = k//q, q
break
if min1 < 5:
print(-1)
else... | output | 1 | 4,225 | 6 | 8,451 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that n⋅ m = k and when the word is written by using n rows and... | instruction | 0 | 4,226 | 6 | 8,452 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
k=int(input())
v='aeiou'*k
n=5
while n*n<k and k%n:n+=1
print(((''.join(v[i:i+n]for i in range(n))*k)[:k],-1)[n*n>k])
``` | output | 1 | 4,226 | 6 | 8,453 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that n⋅ m = k and when the word is written by using n rows and... | instruction | 0 | 4,227 | 6 | 8,454 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
num = int(input())
ans = "-1"
v = "aeiou"
for i in range(5, int(num**0.5)+1):
if num % i == 0:
ans = ""
for j in range(num//i):
ind = j % 5
for k in range(i):
ans += v[ind]
... | output | 1 | 4,227 | 6 | 8,455 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that n⋅ m = k and when the word is written by using n rows and... | instruction | 0 | 4,228 | 6 | 8,456 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
string = [
"aeiou",
"eioua",
"iouae",
"ouaei",
"uaeio"
]
def find_n(fact, MAX):
n = MAX
size = len(fact)
break_now = False
for i in range(0, size):
if fact[i]>=5:
break_now, n = True, fact[i... | output | 1 | 4,228 | 6 | 8,457 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that n⋅ m = k and when the word is written by using n rows and... | instruction | 0 | 4,229 | 6 | 8,458 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
n = int(input())
i = 5
if n < 25:
print(-1)
exit()
while n % i != 0:
i += 1
if i == n or n//i < 5:
print(-1)
exit()
vowel = 'aeiou'
final = ''
for j in range(n//i):
temp = vowel*(i//5) + vowel[:i%5]
vowel = vowel[1:] + ... | output | 1 | 4,229 | 6 | 8,459 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that n⋅ m = k and when the word is written by using n rows and... | instruction | 0 | 4,230 | 6 | 8,460 |
Tags: constructive algorithms, math, number theory
Correct Solution:
```
k=int(input())
for i in range(5,k):
if k%i==0 and k//i>=5:
tot=''
pre='a'
for lit in range(k//i):
if pre=='a':
prev='e'
elif pre=='e':
prev='i'
elif pr... | output | 1 | 4,230 | 6 | 8,461 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that n⋅ m = k a... | instruction | 0 | 4,232 | 6 | 8,464 |
Yes | output | 1 | 4,232 | 6 | 8,465 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Kefa found n baloons. For convenience, we denote color of i-th baloon as si — lowercase letter of the Latin alphabet. Also Kefa has k friends. Friend will be upset, If he get two baloons of the same color. Kefa want to give out all b... | instruction | 0 | 4,716 | 6 | 9,432 |
Tags: brute force, implementation
Correct Solution:
```
#-------------Program--------------
#----Kuzlyaev-Nikita-Codeforces----
#-------------Training-------------
#----------------------------------
n,k=map(int,input().split())
s=list(str(input()))
p=list(set(s))
m=0
for i in range(len(p)):
if s.count(p[i])>k:
... | output | 1 | 4,716 | 6 | 9,433 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Kefa found n baloons. For convenience, we denote color of i-th baloon as si — lowercase letter of the Latin alphabet. Also Kefa has k friends. Friend will be upset, If he get two baloons of the same color. Kefa want to give out all b... | instruction | 0 | 4,717 | 6 | 9,434 |
Tags: brute force, implementation
Correct Solution:
```
'''input
4 2
aabb
'''
n, k = map(int, input().split())
s = input()
print("NO" if any(s.count(l) > k for l in set(s)) else "YES")
``` | output | 1 | 4,717 | 6 | 9,435 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.