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.
Constanze is the smartest girl in her village but she has bad eyesight.
One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce '... | instruction | 0 | 103,010 | 6 | 206,020 |
Tags: dp
Correct Solution:
```
m=1000000007
s=input()
if(s.count('w') or s.count('m')):
print(0)
else:
dp=[1,1]
n=len(s)
for i in range(1,n):
if(s[i]==s[i-1] and (s[i]=='u' or s[i]=='n')):
dp.append((dp[i]+dp[i-1])%m)
else:
dp.append(dp[i]%m)
#print(dp)
pr... | output | 1 | 103,010 | 6 | 206,021 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Constanze is the smartest girl in her village but she has bad eyesight.
One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce '... | instruction | 0 | 103,011 | 6 | 206,022 |
Tags: dp
Correct Solution:
```
f = [1, 2]
const = 10 ** 9 + 1
s = input()
if "m" in s or "w" in s:
print(0)
else:
ans = 1
const = 10 ** 9 + 7
check = False
count = 0
if s[0] == "u" or s[0] == "n":
check = True
count = 1
for i in range(1, len(s)):
f.append((f[-1] + f[-... | output | 1 | 103,011 | 6 | 206,023 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Constanze is the smartest girl in her village but she has bad eyesight.
One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce '... | instruction | 0 | 103,012 | 6 | 206,024 |
Tags: dp
Correct Solution:
```
# import sys
# input = sys.stdin.readline
s = input()
n = len(s)
A = []
mod = 10**9+7
L = [0,1,2]
for i in range(10**5+3):
L.append((L[-1]+L[-2]) % mod)
nn=0
uu=0
for i in range(n):
if s[i] == "n":
if nn == 0:
nn = 1
A.append(1)
else:
... | output | 1 | 103,012 | 6 | 206,025 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Constanze is the smartest girl in her village but she has bad eyesight.
One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce '... | instruction | 0 | 103,013 | 6 | 206,026 |
Tags: dp
Correct Solution:
```
mod = 10**9+7
def cmb(n, r, mod=mod):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
return g1[n] * g2[r] * g2[n-r] % mod
NN = 10**5 # 使うデータによって変える
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, NN + 1 ):
g1.append( ( g1[... | output | 1 | 103,013 | 6 | 206,027 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Constanze is the smartest girl in her village but she has bad eyesight.
One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce '... | instruction | 0 | 103,014 | 6 | 206,028 |
Tags: dp
Correct Solution:
```
s = input()
s_ct = 0
n_ct = 0
ans = []
dp = [0 for _ in range(len(s)+5)]
dp[0] = 1
dp[1] = 1
dp[2] = 2
a = 1
for i in range(3,len(dp)):
dp[i] = (dp[i-1]+dp[i-2])%(10**9+7 )
for i in range(len(s)):
if(s[i]=='m'):
a = 0
if(s[i]=='w'):
a=0
if(s[i]=='u'):
... | output | 1 | 103,014 | 6 | 206,029 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Constanze is the smartest girl in her village but she has bad eyesight.
One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce '... | instruction | 0 | 103,015 | 6 | 206,030 |
Tags: dp
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
def main():
import bisect
import math
# import itertools
# import heapq
# from queue import PriorityQueue, LifoQueue, SimpleQueue
# import sys.stdout.flush() use for interactive problems
alpha = 'abcdefghij... | output | 1 | 103,015 | 6 | 206,031 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Constanze is the smartest girl in her village but she has bad eyesight.
One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce '... | instruction | 0 | 103,016 | 6 | 206,032 |
Tags: dp
Correct Solution:
```
s = input()
L = [0] * (len(s) + 1)
inf = 1000000007
L[0] = 1
L[1] = 1
for i in range(1, len(s)):
if s[i] == 'm' or s[i] == 'w':
break
if s[i] == 'u':
if s[i - 1] == 'u':
L[i + 1] = (L[i] + L[i - 1]) % inf
else:
L[i + 1] = L[i]
el... | output | 1 | 103,016 | 6 | 206,033 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Constanze is the smartest girl in her village but she has bad eyesight.
One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce '... | instruction | 0 | 103,017 | 6 | 206,034 |
Tags: dp
Correct Solution:
```
import sys
# def recur(pre,p,pos,maxx,temp):
# if pos == len(pre):
# maxx[0] = max(maxx[0],temp)
# return
# for i in range(0,p+1):
# if i < len(pre[pos]) :
# temp = temp + pre[pos][i]
# recur(pre,p-i,pos+1,maxx,temp)
# ... | output | 1 | 103,017 | 6 | 206,035 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Yaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such that si > wi and sj < wj. Here sign si represents the i-th digit of string s, simila... | instruction | 0 | 103,966 | 6 | 207,932 |
Tags: combinatorics, dp
Correct Solution:
```
from functools import reduce
n = int(input())
s1, s2 = str(input()), str(input())
print((10 ** sum([(s1[i] == '?') + (s2[i] == '?') for i in range(n)]) - (not reduce(lambda x, y: x or y, [s1[i] != '?' and s2[i] != '?' and ord(s1[i]) > ord(s2[i]) for i in range(n)], False)) ... | output | 1 | 103,966 | 6 | 207,933 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Yaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such that si > wi and sj < wj. Here sign si represents the i-th digit of string s, simila... | instruction | 0 | 103,967 | 6 | 207,934 |
Tags: combinatorics, dp
Correct Solution:
```
n = int(input())
C = 10**9+7
a = input()
s = input()
d = [[0, 0, 0, 1]]
for q in range(n):
d.append(d[-1][::])
if a[q] != '?' and s[q] != '?':
if int(a[q]) < int(s[q]):
d[-1][1] = d[-1][3] = 0
d[-1][0] += d[-2][3]
d[-1][2]... | output | 1 | 103,967 | 6 | 207,935 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Yaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such that si > wi and sj < wj. Here sign si represents the i-th digit of string s, simila... | instruction | 0 | 103,968 | 6 | 207,936 |
Tags: combinatorics, dp
Correct Solution:
```
from functools import reduce
n = int(input())
s1, s2 = str(input()), str(input())
b1 = reduce(lambda x, y: x or y, [s1[i] != '?' and s2[i] != '?' and ord(s1[i]) < ord(s2[i]) for i in range(n)], False)
b2 = reduce(lambda x, y: x or y, [s1[i] != '?' and s2[i] != '?' and o... | output | 1 | 103,968 | 6 | 207,937 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Yaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such that si > wi and sj < wj. Here sign si represents the i-th digit of string s, simila... | instruction | 0 | 103,969 | 6 | 207,938 |
Tags: combinatorics, dp
Correct Solution:
```
#!/usr/bin/python3
def build(n, s, t):
ans = 1
for i in range(n):
if s[i] == '?' and t[i] == '?':
ans = (55 * ans) % (10 ** 9 + 7)
elif s[i] == '?':
ans = ((ord(t[i]) - ord('0') + 1) * ans) % (10 ** 9 + 7)
elif t[i] =... | output | 1 | 103,969 | 6 | 207,939 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Yaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such that si > wi and sj < wj. Here sign si represents the i-th digit of string s, simila... | instruction | 0 | 103,970 | 6 | 207,940 |
Tags: combinatorics, dp
Correct Solution:
```
import sys
mod = 1000000007
n = int(input())
s1 = input()
s2 = input()
flag1 = 0
flag2 = 0
for i in range(n):
if s1[i] != "?" and s2[i] != "?" and s1[i] > s2[i]:
flag1 = 1
if s1[i] != "?" and s2[i] != "?" and s1[i] < s2[i]:
flag2 = 1
if flag1 and flag2:
ans = 1
for ... | output | 1 | 103,970 | 6 | 207,941 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Yaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such that si > wi and sj < wj. Here sign si represents the i-th digit of string s, simila... | instruction | 0 | 103,971 | 6 | 207,942 |
Tags: combinatorics, dp
Correct Solution:
```
from functools import reduce
n = int(input())
s1, s2 = str(input()), str(input())
b1 = reduce(lambda x, y: x or y, [s1[i] != '?' and s2[i] != '?' and ord(s1[i]) < ord(s2[i]) for i in range(n)], False)
b2 = reduce(lambda x, y: x or y, [s1[i] != '?' and s2[i] != '?' and ord(s... | output | 1 | 103,971 | 6 | 207,943 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Yaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such that si > wi and sj < wj. Here sign si represents the i-th digit of string s, simila... | instruction | 0 | 103,972 | 6 | 207,944 |
Tags: combinatorics, dp
Correct Solution:
```
from functools import reduce
n, s1, s2, f1, f2 = int(input()), str(input()), str(input()), lambda x: reduce((lambda a, b: (a * b) % 1000000007), x, 1), lambda x: reduce((lambda a, b: a or b), x, False)
print((10 ** sum([(s1[i] == '?') + (s2[i] == '?') for i in range(n)]) - ... | output | 1 | 103,972 | 6 | 207,945 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Yaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such that si > wi and sj < wj. Here sign si represents the i-th digit of string s, simila... | instruction | 0 | 103,973 | 6 | 207,946 |
Tags: combinatorics, dp
Correct Solution:
```
n = int(input())
a = input()
b = input()
mod = int(1e9+7)
x, y, z = 1, 1, 1
for i in range(n):
if a[i] == '?' and b[i] == '?':
x = (x * 55) % mod
y = (y * 55) % mod
z = (z * 10) % mod
elif a[i] == '?':
x = (x * (10 - int(b[i]))) % mod... | output | 1 | 103,973 | 6 | 207,947 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either on... | instruction | 0 | 105,704 | 6 | 211,408 |
Tags: implementation, strings
Correct Solution:
```
s = str(input())
ll = sum(map(str.islower, s))
ul = sum(map(str.isupper, s))
if ul > ll:
print(s.upper())
else:
print(s.lower())
``` | output | 1 | 105,704 | 6 | 211,409 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either on... | instruction | 0 | 105,705 | 6 | 211,410 |
Tags: implementation, strings
Correct Solution:
```
a = input()
l = len(a)
count = 0
for i in a:
if i.isupper():
count += 1
if count <= int(l/2):
print(a.lower())
else:
print(a.upper())
``` | output | 1 | 105,705 | 6 | 211,411 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either on... | instruction | 0 | 105,706 | 6 | 211,412 |
Tags: implementation, strings
Correct Solution:
```
s=list(input())
p=""
l=[]
x=[]
for i in range(len(s)):
if s[i]==s[i].upper():
l.append(s[i])
elif s[i]==s[i].lower():
x.append(s[i])
if len(l)>len(x):
print(p.join(s).upper())
else:
print(p.join(s).lower())
``` | output | 1 | 105,706 | 6 | 211,413 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either on... | instruction | 0 | 105,707 | 6 | 211,414 |
Tags: implementation, strings
Correct Solution:
```
word = input()
uppercases = 0
lowercases = 0
for letter in word:
if letter.upper() == letter:
uppercases += 1
else:
lowercases += 1
if uppercases > lowercases:
print(word.upper())
else:
print(word.lower())
``` | output | 1 | 105,707 | 6 | 211,415 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either on... | instruction | 0 | 105,708 | 6 | 211,416 |
Tags: implementation, strings
Correct Solution:
```
s=input();print(s.upper() if sum(1 for c in s if c.isupper())>sum(1 for c in s if c.islower())else s.lower())
``` | output | 1 | 105,708 | 6 | 211,417 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either on... | instruction | 0 | 105,709 | 6 | 211,418 |
Tags: implementation, strings
Correct Solution:
```
w = input()
upp = 0
low = 0
for i in w:
if i.isupper() == True:
upp += 1
else:
low += 1
if upp <= low:
print(w.lower())
else:
print(w.upper())
``` | output | 1 | 105,709 | 6 | 211,419 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either on... | instruction | 0 | 105,710 | 6 | 211,420 |
Tags: implementation, strings
Correct Solution:
```
n=input()
l=0
u=0
for i in range(len(n)):
if n[i].islower():
l+=1
elif n[i].isupper():
u+=1
if l>u:
print(n.lower())
elif l<u:
print(n.upper())
else:
print(n.lower())
``` | output | 1 | 105,710 | 6 | 211,421 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either on... | instruction | 0 | 105,711 | 6 | 211,422 |
Tags: implementation, strings
Correct Solution:
```
word = str(input())
sumUppercaseLetters = 0
sumLowercaseLetters = 0
for i in word:
if i.isupper():
sumUppercaseLetters += 1
elif i.islower():
sumLowercaseLetters += 1
if sumUppercaseLetters > sumLowercaseLetters:
print(word.upper())
eli... | output | 1 | 105,711 | 6 | 211,423 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to transform it into a proper email address (vasya@gma... | instruction | 0 | 106,508 | 6 | 213,016 |
Tags: expression parsing, implementation
Correct Solution:
```
s = input()
i = s[1:].find('at') + 1
s = s[:i] + '@' + s[i+2:]
while True:
i = s[1:].find('dot')
if i == -1:
break
i += 1
if i+3 == len(s):
break
s = s[:i] + '.' + s[i+3:]
print(s)
``` | output | 1 | 106,508 | 6 | 213,017 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to transform it into a proper email address (vasya@gma... | instruction | 0 | 106,509 | 6 | 213,018 |
Tags: expression parsing, implementation
Correct Solution:
```
s=input()
at=s.find('at',1)
s=s[:at]+'@'+s[at+2:]
pos=1
while 1:
ns=''
dot=s.find('dot',pos,-1)
if dot==-1:
break
ns+=s[:dot]
ns+='.'
pos=dot+1
ns+=s[dot+3:]
s=ns
print(s)
``` | output | 1 | 106,509 | 6 | 213,019 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to transform it into a proper email address (vasya@gma... | instruction | 0 | 106,510 | 6 | 213,020 |
Tags: expression parsing, implementation
Correct Solution:
```
s=input()
if s[:3]=="dot" or s[:2]=="at" or s[len(s)-2:]=="at" or s[len(s)-3:]=="dot":
if s[:3]=="dot":
t=s[3:]
a=t.split('dot')
l=".".join(a)
b=l.find("at")
o=l[:b]+"@"+l[b+2:]
q="dot"+o
if q[-1]=... | output | 1 | 106,510 | 6 | 213,021 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to transform it into a proper email address (vasya@gma... | instruction | 0 | 106,511 | 6 | 213,022 |
Tags: expression parsing, implementation
Correct Solution:
```
from sys import stdin
input=stdin.readline
voiceEmail = input()
dotReplaced = voiceEmail[1:len(voiceEmail) - 2].replace('dot', '.')
voiceEmail = voiceEmail[0] + dotReplaced + voiceEmail[len(voiceEmail) - 2:]
atReplaced = voiceEmail[1:len(voiceEmail) - 2].re... | output | 1 | 106,511 | 6 | 213,023 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to transform it into a proper email address (vasya@gma... | instruction | 0 | 106,512 | 6 | 213,024 |
Tags: expression parsing, implementation
Correct Solution:
```
import sys
from array import array # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
s = input().rstrip()
ans = s[0]
suf = s[-1]
s = s[1:-1]
at_flag = 0
while s:
if s[:3] == 'dot':
ans += '.'
s =... | output | 1 | 106,512 | 6 | 213,025 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to transform it into a proper email address (vasya@gma... | instruction | 0 | 106,513 | 6 | 213,026 |
Tags: expression parsing, implementation
Correct Solution:
```
import re
import sys
exit=sys.exit
from bisect import bisect_left as bsl,bisect_right as bsr
from collections import Counter,defaultdict as ddict,deque
from functools import lru_cache
cache=lru_cache(None)
from heapq import *
from itertools import *
from ma... | output | 1 | 106,513 | 6 | 213,027 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to transform it into a proper email address (vasya@gma... | instruction | 0 | 106,514 | 6 | 213,028 |
Tags: expression parsing, implementation
Correct Solution:
```
def main():
desc = input()
chunk = desc[1:-1]
chunk = chunk.replace("at", "@", 1)
chunk = chunk.replace("dot", ".")
print(desc[0] + chunk + desc[-1])
main()
``` | output | 1 | 106,514 | 6 | 213,029 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to transform it into a proper email address (vasya@gma... | instruction | 0 | 106,515 | 6 | 213,030 |
Tags: expression parsing, implementation
Correct Solution:
```
#!/bin/python
email = input()
m = {'@' : 'at', '.' : 'dot'}
replaced = ''
addAtLast = False
sep = []
def removeFirstLast(ch):
global replaced, addAtLast,sep, email
if m[ch] in email:
if sep[0] == '':
del sep[0]
repla... | output | 1 | 106,515 | 6 | 213,031 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to tran... | instruction | 0 | 106,516 | 6 | 213,032 |
Yes | output | 1 | 106,516 | 6 | 213,033 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to tran... | instruction | 0 | 106,517 | 6 | 213,034 |
Yes | output | 1 | 106,517 | 6 | 213,035 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to tran... | instruction | 0 | 106,518 | 6 | 213,036 |
Yes | output | 1 | 106,518 | 6 | 213,037 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to tran... | instruction | 0 | 106,520 | 6 | 213,040 |
No | output | 1 | 106,520 | 6 | 213,041 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to tran... | instruction | 0 | 106,521 | 6 | 213,042 |
No | output | 1 | 106,521 | 6 | 213,043 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to tran... | instruction | 0 | 106,522 | 6 | 213,044 |
No | output | 1 | 106,522 | 6 | 213,045 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to tran... | instruction | 0 | 106,523 | 6 | 213,046 |
No | output | 1 | 106,523 | 6 | 213,047 |
Provide tags and a correct Python 3 solution for this coding contest problem.
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.... | instruction | 0 | 107,153 | 6 | 214,306 |
Tags: implementation, strings
Correct Solution:
```
s=str(input())
if (s[0] == s[0].lower() and s[1:] == s[1:].upper()):
print(s[0].upper()+s[1:].lower())
elif (s == s.upper()):
print(s.lower())
else:
print(s)
``` | output | 1 | 107,153 | 6 | 214,307 |
Provide tags and a correct Python 3 solution for this coding contest problem.
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.... | instruction | 0 | 107,154 | 6 | 214,308 |
Tags: implementation, strings
Correct Solution:
```
a = input()
if a.isupper() or a[1:].isupper() or (len(a)==1 and a.islower()):
a = list(a)
for i in range(len(a)):
if a[i].isupper():
a[i] = a[i].lower()
else:
a[i] = a[i].upper()
print("".join(a))
``` | output | 1 | 107,154 | 6 | 214,309 |
Provide tags and a correct Python 3 solution for this coding contest problem.
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.... | instruction | 0 | 107,155 | 6 | 214,310 |
Tags: implementation, strings
Correct Solution:
```
s=input().strip()
a=s
if len(s)==1:
if a.upper()==s:
print(a.lower())
else:
print(a.upper())
else:
if a.upper()==s:
print(a.lower())
else:
x=a[0].lower()
y=a[1:].upper()
if x==s[0] and y==s[1:]:
x=a[0].upper()
y=a[1:].lower(... | output | 1 | 107,155 | 6 | 214,311 |
Provide tags and a correct Python 3 solution for this coding contest problem.
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.... | instruction | 0 | 107,156 | 6 | 214,312 |
Tags: implementation, strings
Correct Solution:
```
s=input()
if s.upper()==s:
print(s.lower())
else:
q=s[0]
i=s[1:]
if s[0]==q.lower() and i.upper()==i:
print(q.upper()+i.lower())
else:
print(s)
``` | output | 1 | 107,156 | 6 | 214,313 |
Provide tags and a correct Python 3 solution for this coding contest problem.
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.... | instruction | 0 | 107,157 | 6 | 214,314 |
Tags: implementation, strings
Correct Solution:
```
s = input()
if len(s)==1:
if( s.islower() ):
#if it is 'z' make it 'Z'
s = s.upper()
else:
#if it is 'Z' make it 'z':
s = s.lower()
elif s[0].islower() and s[1:].isupper():
# hELLO to Hello
s = s.capitalize()
elif s.isu... | output | 1 | 107,157 | 6 | 214,315 |
Provide tags and a correct Python 3 solution for this coding contest problem.
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.... | instruction | 0 | 107,158 | 6 | 214,316 |
Tags: implementation, strings
Correct Solution:
```
word = input()
if len(word)==1 and word.isupper():
print(word.lower())
elif len(word) ==1 and word.islower():
print(word.upper())
else:
if word[1:].isupper() and word[0].islower():
print(word.capitalize())
elif word.isupper():
print(wo... | output | 1 | 107,158 | 6 | 214,317 |
Provide tags and a correct Python 3 solution for this coding contest problem.
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.... | instruction | 0 | 107,159 | 6 | 214,318 |
Tags: implementation, strings
Correct Solution:
```
n=input()
c=0
if n[0].islower()==True:
c+=1
for i in range(0,len(n)):
if n[i].isupper()==True:
c+=1
r=""
if len(n)==c:
for i in n:
if i.isupper()==True:
r+=i.lower()
else:
r+=i.upper()
print(r)
else:
... | output | 1 | 107,159 | 6 | 214,319 |
Provide tags and a correct Python 3 solution for this coding contest problem.
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.... | instruction | 0 | 107,160 | 6 | 214,320 |
Tags: implementation, strings
Correct Solution:
```
#! /usr/bin/env python3
word = input()
if (word.isupper()) or (word[1:].isupper()) or len(word) == 1:
word = word.swapcase()
print(word)
else:
print(word)
``` | output | 1 | 107,160 | 6 | 214,321 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little penguin Polo adores strings. But most of all he adores strings of length n.
One day he wanted to find a string that meets the following conditions:
1. The string consists of n lowercase English letters (that is, the string's lengt... | instruction | 0 | 107,308 | 6 | 214,616 |
Tags: greedy
Correct Solution:
```
n, k = map(int, input().split())
if k > n or k == 1 and n > 1:
print(-1)
elif k == 1 and n == 1:
print('a')
else:
print(('ab' * (n // 2 + 1))[: (n - (k - 2))] + 'cdefghijklmnopqrstuvwxyz'[:k - 2])
``` | output | 1 | 107,308 | 6 | 214,617 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little penguin Polo adores strings. But most of all he adores strings of length n.
One day he wanted to find a string that meets the following conditions:
1. The string consists of n lowercase English letters (that is, the string's lengt... | instruction | 0 | 107,310 | 6 | 214,620 |
Tags: greedy
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
def main():
n, t = map(int, input().split())
alphas = "abcdefghijklmnopqrstuvwxyz"
if t > n:
print(-1)
elif n > 1 and t == 1:
print(-1)
elif n == 1 and t == 1:
print("a")
elif t == n:... | output | 1 | 107,310 | 6 | 214,621 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little penguin Polo adores strings. But most of all he adores strings of length n.
One day he wanted to find a string that meets the following conditions:
1. The string consists of n lowercase English letters (that is, the string's lengt... | instruction | 0 | 107,312 | 6 | 214,624 |
Tags: greedy
Correct Solution:
```
n, k = map(int, input().split())
if n < k or k > 26: print(-1)
elif k == 1: print('a' if n == 1 else -1)
else: print(('ab' * (n // 2 + 1))[: n - k + 2] + 'cdefghijklmnopqrstuvwxyz'[: k - 2])
# Made By Mostafa_Khaled
``` | output | 1 | 107,312 | 6 | 214,625 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.