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.
A widely known among some people Belarusian sport programmer Lesha decided to make some money to buy a one square meter larger flat. To do this, he wants to make and carry out a Super Rated Match (SRM) on the site Torcoder.com. But there's a... | instruction | 0 | 52,491 | 6 | 104,982 |
Tags: brute force
Correct Solution:
```
import itertools
def count_inversions(enumerate_seq):
tmp = list(enumerate_seq[:])
result = 0
for i in range(len(tmp)):
for j in range(len(tmp) - 1):
if tmp[j][0] > tmp[j + 1][0]:
result += 1
tmp[j], tmp[j + 1] = t... | output | 1 | 52,491 | 6 | 104,983 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A widely known among some people Belarusian sport programmer Lesha decided to make some money to buy a one square meter larger flat. To do this, he wants to make and carry out a Super Rated Match (SRM) on the site Torcoder.com. But there's a... | instruction | 0 | 52,492 | 6 | 104,984 |
Tags: brute force
Correct Solution:
```
import itertools
def check(curr_words, line):
if curr_words == []:
return True
for i in range(len(line)):
if line[i] == curr_words[0]:
return check(curr_words[1:], line[i+1:])
return False
n = int(input())
words = input().split()
m = int... | output | 1 | 52,492 | 6 | 104,985 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. ... | instruction | 0 | 52,773 | 6 | 105,546 |
Tags: implementation
Correct Solution:
```
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
t = sum(a)
if t >= x and n != 1:
print('NO')
else:
if x - n < t and x - t == n - 1:
print('YES')
else:
print('NO')
``` | output | 1 | 52,773 | 6 | 105,547 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. ... | instruction | 0 | 52,774 | 6 | 105,548 |
Tags: implementation
Correct Solution:
```
import sys
n, m = map(int, sys.stdin.readline().split())
arr = list(map(int, sys.stdin.readline().split()))
val = sum(arr)
temp = m - val
if temp == n - 1:
print('YES')
else:
print('NO')
``` | output | 1 | 52,774 | 6 | 105,549 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. ... | instruction | 0 | 52,775 | 6 | 105,550 |
Tags: implementation
Correct Solution:
```
import math
for m in range(1,2 ):
#n = int(input())
n, x= list(map(int, input().split()))
a = list(map(int, input().split()))
sum1=sum(a)
if (sum1==x and a[0]==x):
print("YES")
elif sum1==x:
print("NO")
else:
zero = len(a)-1
... | output | 1 | 52,775 | 6 | 105,551 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. ... | instruction | 0 | 52,776 | 6 | 105,552 |
Tags: implementation
Correct Solution:
```
n=list(map(int,input().split()))
a=list(map(int,input().split()))
x=n[1]
if x==sum(a)+(len(a)-1):
print('YES')
else:
print('NO')
``` | output | 1 | 52,776 | 6 | 105,553 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. ... | instruction | 0 | 52,777 | 6 | 105,554 |
Tags: implementation
Correct Solution:
```
"""
Author : co_devil Chirag Garg
Institute : JIIT
"""
from __future__ import division, print_function
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil,floor,log,sqrt,factorial,pow,pi
#... | output | 1 | 52,777 | 6 | 105,555 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. ... | instruction | 0 | 52,778 | 6 | 105,556 |
Tags: implementation
Correct Solution:
```
n, x = map(int, input().split())
a = list(map(int, input().split()))
s = 0
for i in range(n):
s = s + a[i] + 1
if s-1 == x:
print('YES')
else:
print('NO')
``` | output | 1 | 52,778 | 6 | 105,557 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. ... | instruction | 0 | 52,779 | 6 | 105,558 |
Tags: implementation
Correct Solution:
```
n , t = map(int, input().split())
a = list(map(int, input().split()))
ln = n-1
for i in a:
ln += i
if ln == t:
print("YES")
else :
print("NO")
``` | output | 1 | 52,779 | 6 | 105,559 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. ... | instruction | 0 | 52,780 | 6 | 105,560 |
Tags: implementation
Correct Solution:
```
n,x=map(int,input().split())
a=[int(i) for i in input().split()]
print(['NO','YES'][sum(a)+n-1==x])
``` | output | 1 | 52,780 | 6 | 105,561 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A newspaper is published in Walrusland. Its heading is s1, it consists of lowercase Latin letters. Fangy the little walrus wants to buy several such newspapers, cut out their headings, glue them one to another in order to get one big string.... | instruction | 0 | 52,799 | 6 | 105,598 |
Tags: greedy, strings
Correct Solution:
```
import bisect
s1,s2,d=input(),input(),{}
for c in set(s1):
d[c]=[]
for i,x in enumerate(s1):
if x==c: d[c].append(i)
try:
ind,ans=-1,1
for c in s2:
ind = bisect.bisect_left(d[c], ind)
if ind >= len(d[c]):
ind, ans = 0, ans... | output | 1 | 52,799 | 6 | 105,599 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A newspaper is published in Walrusland. Its heading is s1, it consists of lowercase Latin letters. Fangy the little walrus wants to buy several such newspapers, cut out their headings, glue them one to another in order to get one big string.... | instruction | 0 | 52,800 | 6 | 105,600 |
Tags: greedy, strings
Correct Solution:
```
import sys
from array import array # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
s = [ord(c) - 97 for c in input().rstrip()]
t = [ord(c) - 97 for c in input().rstrip()]
n, m = len(s), len(t)
next_c = [[-1] * 26 for _ in range(n)]
for ... | output | 1 | 52,800 | 6 | 105,601 |
Provide tags and a correct Python 3 solution for this coding contest problem.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It is no surprise Fischl speaks with a strange choi... | instruction | 0 | 53,319 | 6 | 106,638 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
from string import ascii_lowercase as AL
f = list(AL)
for i in range(26):
for j in range(26): f.append(AL[i]+AL[j])
for p in range(26):
for q in range(26):
for r in range(26): f.append(AL[p]+AL[q]+AL[r])
for _ in range(int(input()... | output | 1 | 53,319 | 6 | 106,639 |
Provide tags and a correct Python 3 solution for this coding contest problem.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It is no surprise Fischl speaks with a strange choi... | instruction | 0 | 53,320 | 6 | 106,640 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
import string
from itertools import count, product
def words(chars=string.ascii_letters + string.digits):
for n in count(1):
yield from map(''.join, product(chars, repeat=n))
alpha = [chr(i) for i in range(97, 123)]
n = int(input(... | output | 1 | 53,320 | 6 | 106,641 |
Provide tags and a correct Python 3 solution for this coding contest problem.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It is no surprise Fischl speaks with a strange choi... | instruction | 0 | 53,321 | 6 | 106,642 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
# Legends Always Come Up with Solution
# Author: Manvir Singh
import os
import sys
from io import BytesIO, IOBase
def main():
a=[chr(i) for i in range(97,123)]
for i in range(97,123):
for j in range(97,123):
a.append... | output | 1 | 53,321 | 6 | 106,643 |
Provide tags and a correct Python 3 solution for this coding contest problem.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It is no surprise Fischl speaks with a strange choi... | instruction | 0 | 53,322 | 6 | 106,644 |
Tags: brute force, constructive algorithms, strings
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 impor... | output | 1 | 53,322 | 6 | 106,645 |
Provide tags and a correct Python 3 solution for this coding contest problem.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It is no surprise Fischl speaks with a strange choi... | instruction | 0 | 53,323 | 6 | 106,646 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
import sys
input = sys.stdin.readline
def solve():
n = int(input())
a = input().strip()
for i in range(26):
f = a.find(chr(ord('a')+i))
if f < 0:
print(chr(ord('a')+i))
return
for i in range(26):
for j in range(26):
v = chr(o... | output | 1 | 53,323 | 6 | 106,647 |
Provide tags and a correct Python 3 solution for this coding contest problem.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It is no surprise Fischl speaks with a strange choi... | instruction | 0 | 53,324 | 6 | 106,648 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
import string
alphabets = string.ascii_lowercase
def solve():
n = int(input())
s = input()
l = []
for i in alphabets:
l.append(i)
for i in alphabets:
for j in alphabets:
l.append(i + j)
for i i... | output | 1 | 53,324 | 6 | 106,649 |
Provide tags and a correct Python 3 solution for this coding contest problem.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It is no surprise Fischl speaks with a strange choi... | instruction | 0 | 53,325 | 6 | 106,650 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
def find_pref(s):
alph = ' abcdefghijklmnopqrstuvwxyz'
for l1 in alph:
for l2 in alph:
for l3 in alph:
pref = ''
if l1 != ' ':
pref = l1
if l2 != ' ':... | output | 1 | 53,325 | 6 | 106,651 |
Provide tags and a correct Python 3 solution for this coding contest problem.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It is no surprise Fischl speaks with a strange choi... | instruction | 0 | 53,326 | 6 | 106,652 |
Tags: brute force, constructive algorithms, strings
Correct Solution:
```
from itertools import *
from string import ascii_lowercase
for _ in range(int(input())):
input()
S = input()
N = len(S)
se = set()
for i in range(N):
cur = ''
for j in range(i, N):
cur += S[j]
se.add(cur)
for i in ... | output | 1 | 53,326 | 6 | 106,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It i... | instruction | 0 | 53,327 | 6 | 106,654 |
Yes | output | 1 | 53,327 | 6 | 106,655 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It i... | instruction | 0 | 53,328 | 6 | 106,656 |
Yes | output | 1 | 53,328 | 6 | 106,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It i... | instruction | 0 | 53,329 | 6 | 106,658 |
Yes | output | 1 | 53,329 | 6 | 106,659 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It i... | instruction | 0 | 53,330 | 6 | 106,660 |
Yes | output | 1 | 53,330 | 6 | 106,661 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It i... | instruction | 0 | 53,331 | 6 | 106,662 |
No | output | 1 | 53,331 | 6 | 106,663 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It i... | instruction | 0 | 53,332 | 6 | 106,664 |
No | output | 1 | 53,332 | 6 | 106,665 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It i... | instruction | 0 | 53,333 | 6 | 106,666 |
No | output | 1 | 53,333 | 6 | 106,667 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.
It i... | instruction | 0 | 53,334 | 6 | 106,668 |
No | output | 1 | 53,334 | 6 | 106,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s.
<image>
He is not sure if this is h... | instruction | 0 | 55,174 | 6 | 110,348 |
Tags: brute force, implementation, strings
Correct Solution:
```
from sys import*
def pol(s):
n = len(s)
for i in range(n // 2 + 1):
if s[i] != s[-1 - i]:
return False
return True
s = input()
k = int(input())
if len(s) % k == 0:
n = len(s) // k
for i in range(k):
#print(s... | output | 1 | 55,174 | 6 | 110,349 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s.
<image>
He is not sure if this is h... | instruction | 0 | 55,175 | 6 | 110,350 |
Tags: brute force, implementation, strings
Correct Solution:
```
s = input()
k = int(input())
n = len(s)
if (n % k):
print("NO")
else:
le = n // k
ok = 1
for i in range(0, n, le):
for j in range(le):
if(s[i + j] != s[i + le - 1 - j]):
ok = 0
print("YES" if ok else "NO")
``` | output | 1 | 55,175 | 6 | 110,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s.
<image>
He is not sure if this is h... | instruction | 0 | 55,176 | 6 | 110,352 |
Tags: brute force, implementation, strings
Correct Solution:
```
s = input()
n = int(input())
cnt = 0
if len(s)%n!=0 or len(s)<n:
print("NO")
else:
for i in range(0,len(s),len(s)//n):
if s[i:i+len(s)//n] == s[i:i+len(s)//n][::-1]:
cnt+=1
if cnt==n:
print("YES")
else:
print("NO")
``` | output | 1 | 55,176 | 6 | 110,353 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s.
<image>
He is not sure if this is h... | instruction | 0 | 55,177 | 6 | 110,354 |
Tags: brute force, implementation, strings
Correct Solution:
```
s = input()
n = int(input())
msg=len(s)//n
if(len(s)//n == len(s)/n):
l1 = []
for i in range(0, len(s), msg):
l1.append(s[i:i + msg])
count = 0
#print(l1)
for i in l1:
if (i == i[::-1]):
#print(i[::-1])
... | output | 1 | 55,177 | 6 | 110,355 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s.
<image>
He is not sure if this is h... | instruction | 0 | 55,178 | 6 | 110,356 |
Tags: brute force, implementation, strings
Correct Solution:
```
'''input
saba
2
'''
s, k = input(), int(input())
if len(s) % k != 0:
print("NO")
else:
if all(i == i[::-1] for i in [s[x:x+len(s)//k] for x in range(0,len(s),len(s)//k)]):
print("YES")
else:
print("NO")
``` | output | 1 | 55,178 | 6 | 110,357 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s.
<image>
He is not sure if this is h... | instruction | 0 | 55,179 | 6 | 110,358 |
Tags: brute force, implementation, strings
Correct Solution:
```
s = input()
n = int(input())
#a = [int(c) for c in input().split()]
wordlength = len(s)//n
if wordlength*n != len(s):
print("NO")
else:
current = wordlength
word = 0
yes = True
for i in range(n):
if not yes:
break
... | output | 1 | 55,179 | 6 | 110,359 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s.
<image>
He is not sure if this is h... | instruction | 0 | 55,180 | 6 | 110,360 |
Tags: brute force, implementation, strings
Correct Solution:
```
s = input()
k = int(input())
ans = 'YES'
if len(s)%k ==0:
r = len(s)//k
for i in range(0, len(s), r):
p = s[i:i+r]
if p != p[::-1]:
ans='NO'
else:
ans = 'NO'
print(ans)
``` | output | 1 | 55,180 | 6 | 110,361 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s.
<image>
He is not sure if this is h... | instruction | 0 | 55,181 | 6 | 110,362 |
Tags: brute force, implementation, strings
Correct Solution:
```
s = str(input())
n = int(input())
l = []
if(len(s) % n != 0):
print("NO")
exit()
for i in range(0,len(s),(len(s) // n)):
t = s[i:i+(len(s) // n):]
for j in range(len(t)):
if t[::] != t[::-1]:
print("NO")
exit()
print("YES")
`... | output | 1 | 55,181 | 6 | 110,363 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 55,340 | 6 | 110,680 |
Tags: binary search, dfs and similar
Correct Solution:
```
s = "What are you doing at the end of the world? Are you busy? Will you save us?"
s1 = 'What are you doing while sending "'
s2 = '"? Are you busy? Will you send "'
s3 = '"?'
l1,l2,l3=len(s1),len(s2),len(s3)
def count(n):
if n>=60:return 10**20
return (1... | output | 1 | 55,340 | 6 | 110,681 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 55,341 | 6 | 110,682 |
Tags: binary search, dfs and similar
Correct Solution:
```
f0 = "What are you doing at the end of the world? Are you busy? Will you save us?"
f1 = "What are you doing while sending \"{0}\"? Are you busy? Will you send \"{0}\"?"
a = list(f1.split("{0}"))
b = list(map(len, a))
q = int(input())
f = lambda n: 143 * 2**min(... | output | 1 | 55,341 | 6 | 110,683 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 55,342 | 6 | 110,684 |
Tags: binary search, dfs and similar
Correct Solution:
```
s0 = 'What are you doing at the end of the world? Are you busy? Will you save us?'
s1 = 'What are you doing while sending "'
s2 = '"? Are you busy? Will you send "'
l0 = len(s0)
l1 = len(s1)
l2 = len(s2)
def get(h):
if h > 55:
return int(1e20)
... | output | 1 | 55,342 | 6 | 110,685 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 55,343 | 6 | 110,686 |
Tags: binary search, dfs and similar
Correct Solution:
```
f0 = 'What are you doing at the end of the world? Are you busy? Will you save us?'
ft1, ft2, ft3 = 'What are you doing while sending "', '"? Are you busy? Will you send "', '"?'
flen = [2 * 10 ** 18] * (10 ** 5 + 1)
flen[0] = len(f0)
for i in range(1, 56):
... | output | 1 | 55,343 | 6 | 110,687 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 55,344 | 6 | 110,688 |
Tags: binary search, dfs and similar
Correct Solution:
```
f0 = "What are you doing at the end of the world? Are you busy? Will you save us?"
first_part = 'What are you doing while sending "'
between1 = '"? Are you busy? Will you send "'
f_lengths = [0 for i in range(64)]
f_lengths[0] = len(f0)
for i in range(1, 64):... | output | 1 | 55,344 | 6 | 110,689 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 55,345 | 6 | 110,690 |
Tags: binary search, dfs and similar
Correct Solution:
```
f0 = "What are you doing at the end of the world? Are you busy? Will you save us?"
f1 = "What are you doing while sending \"{0}\"? Are you busy? Will you send \"{0}\"?"
a = list(f1.split("{0}"))
b = list(map(len, a))
q = int(input())
f = lambda n: 143 * 2*... | output | 1 | 55,345 | 6 | 110,691 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 55,346 | 6 | 110,692 |
Tags: binary search, dfs and similar
Correct Solution:
```
from sys import setrecursionlimit
setrecursionlimit(100000000)
def get_int(string, n):
i = j = k = 0
for s in string:
k += 1
for s in string:
if i == n - 1:
break
if s == ' ':
i += 1
j += 1
i = 0
while j < k:
if string[j] == ' ':
break
... | output | 1 | 55,346 | 6 | 110,693 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 55,347 | 6 | 110,694 |
Tags: binary search, dfs and similar
Correct Solution:
```
from functools import lru_cache
import sys
f0 = "What are you doing at the end of the world? Are you busy? Will you save us?"
fnext = ['What are you doing while sending "', '"? Are you busy? Will you send "', '"?']
BIG = 10**20
@lru_cache(maxsize=None)
def fl... | output | 1 | 55,347 | 6 | 110,695 |
Provide a correct Python 3 solution for this coding contest problem.
Fukushima Prefecture is also famous for producing fruits, and among them, peaches and apples boast one of the highest production volumes in Japan. By the way, when I made a print manuscript of an English pamphlet for sale, I mistakenly wrote the desc... | instruction | 0 | 55,520 | 6 | 111,040 |
"Correct Solution:
```
print(input().replace("peach","asdf:*O`P*P+").replace("apple","peach").replace("asdf:*O`P*P+","apple"))
``` | output | 1 | 55,520 | 6 | 111,041 |
Provide a correct Python 3 solution for this coding contest problem.
Fukushima Prefecture is also famous for producing fruits, and among them, peaches and apples boast one of the highest production volumes in Japan. By the way, when I made a print manuscript of an English pamphlet for sale, I mistakenly wrote the desc... | instruction | 0 | 55,521 | 6 | 111,042 |
"Correct Solution:
```
print(input().replace('apple', '???').replace('peach', 'apple').replace('???', 'peach'))
``` | output | 1 | 55,521 | 6 | 111,043 |
Provide a correct Python 3 solution for this coding contest problem.
Fukushima Prefecture is also famous for producing fruits, and among them, peaches and apples boast one of the highest production volumes in Japan. By the way, when I made a print manuscript of an English pamphlet for sale, I mistakenly wrote the desc... | instruction | 0 | 55,523 | 6 | 111,046 |
"Correct Solution:
```
def change_apple_peach(sentence):
sentence = sentence.replace('apple','aaa')
sentence = sentence.replace('peach','apple')
sentence = sentence.replace('aaa','peach')
print(sentence)
def main():
str = input()
change_apple_peach(str)
if __name__ == '__main__':
main()
`... | output | 1 | 55,523 | 6 | 111,047 |
Provide a correct Python 3 solution for this coding contest problem.
Fukushima Prefecture is also famous for producing fruits, and among them, peaches and apples boast one of the highest production volumes in Japan. By the way, when I made a print manuscript of an English pamphlet for sale, I mistakenly wrote the desc... | instruction | 0 | 55,525 | 6 | 111,050 |
"Correct Solution:
```
print(input().replace("apple","_").replace("peach","apple").replace("_","peach"))
``` | output | 1 | 55,525 | 6 | 111,051 |
Provide a correct Python 3 solution for this coding contest problem.
We, the researchers who discovered and investigated the ancient nation Iwashiro, finally discovered the temple in the center of Iwashiro. A lithograph dedicated to the god of Iwashiro was stored in the temple. On the lithograph, two strings were writ... | instruction | 0 | 55,544 | 6 | 111,088 |
"Correct Solution:
```
MOD = 1000000007
t = input()
b = input()
lent = len(t)
lenb = len(b)
dp = [0] * (lenb + 1)
dp[0] = 1
for x in range(1, lent + 1):
ct = t[x - 1]
for y in range(lenb, 0, -1):
if ct == b[y - 1]:
dp[y] += dp[y - 1]
dp[y] %= MOD
print(dp[lenb])
``` | output | 1 | 55,544 | 6 | 111,089 |
Provide a correct Python 3 solution for this coding contest problem.
We, the researchers who discovered and investigated the ancient nation Iwashiro, finally discovered the temple in the center of Iwashiro. A lithograph dedicated to the god of Iwashiro was stored in the temple. On the lithograph, two strings were writ... | instruction | 0 | 55,545 | 6 | 111,090 |
"Correct Solution:
```
"""
dp[x][y] ... tのx文字目までで, y文字一致した場合の数
dp[x][y] = dp[x - 1][y] + dp[x - 1][y - 1] * (t[x] == b[y])
"""
MOD = 1000000007
t = input()
b = input()
lent = len(t)
lenb = len(b)
dp = [[0] * (lenb + 1) for _ in range(lent + 1)]
for i in range(lent + 1):
dp[i][0] = 1
for x in range(1, lent + 1):
fo... | output | 1 | 55,545 | 6 | 111,091 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.