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
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates ...
instruction
0
28,758
6
57,516
Yes
output
1
28,758
6
57,517
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates ...
instruction
0
28,759
6
57,518
Yes
output
1
28,759
6
57,519
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates ...
instruction
0
28,760
6
57,520
Yes
output
1
28,760
6
57,521
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates ...
instruction
0
28,761
6
57,522
No
output
1
28,761
6
57,523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates ...
instruction
0
28,762
6
57,524
No
output
1
28,762
6
57,525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates ...
instruction
0
28,763
6
57,526
No
output
1
28,763
6
57,527
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates ...
instruction
0
28,764
6
57,528
No
output
1
28,764
6
57,529
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case do...
instruction
0
29,167
6
58,334
Tags: implementation, strings Correct Solution: ``` # -*- coding: utf-8 -*- """ Created on Sun Oct 28 13:18:36 2018 @author: Lenovo """ w1=input().lower() w2=input().lower() if w1<w2: print(-1) elif w1==w2: print(0) else: print(1) ```
output
1
29,167
6
58,335
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case do...
instruction
0
29,168
6
58,336
Tags: implementation, strings Correct Solution: ``` import sys #sys.stdin = open("input.txt") string1 = sys.stdin.readline().rstrip("\n") string1 = string1.lower().replace(" ","") string2 = sys.stdin.readline().rstrip("\n") string2 = string2.lower().replace(" ","") for i in range(len(string1)): symbol1 = ord(stri...
output
1
29,168
6
58,337
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case do...
instruction
0
29,169
6
58,338
Tags: implementation, strings Correct Solution: ``` x=input() y=input() x=x.lower() y=y.lower() if(x<y): print(-1) elif(x==y): print(0) else: print(1) ```
output
1
29,169
6
58,339
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case do...
instruction
0
29,170
6
58,340
Tags: implementation, strings Correct Solution: ``` str1 = input().lower() str2 = input().lower() result = {True: {False: 0}, False: {True: 1, False: -1}} print(result[str1 == str2][str1 > str2]) ```
output
1
29,170
6
58,341
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case do...
instruction
0
29,171
6
58,342
Tags: implementation, strings Correct Solution: ``` a = input() b = input() if a.lower() > b.lower(): print(1) elif a.lower() == b.lower(): print(0) elif a.lower() < b.lower(): print(-1) ```
output
1
29,171
6
58,343
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case do...
instruction
0
29,172
6
58,344
Tags: implementation, strings Correct Solution: ``` a = list(input().lower()) b = list(input().lower()) for i in range(0,len(a)): if a[i] == b[i]: i += 1 if i == len(a): print("0") continue elif a[i] > b[i]: print("1") break else: print('-1') ...
output
1
29,172
6
58,345
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case do...
instruction
0
29,173
6
58,346
Tags: implementation, strings Correct Solution: ``` a=input() b=input() a=a.lower() b=b.lower() #a=sorted(a) #b=sorted(b) #print(a,b) n=len(a) for i in range(n): if(ord(a[i])>ord(b[i])): print(1) break if(ord(a[i])<ord(b[i])): print(-1) break else: print(0) ```
output
1
29,173
6
58,347
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case do...
instruction
0
29,174
6
58,348
Tags: implementation, strings Correct Solution: ``` a = input().lower() b = input().lower() x = 0 if a < b: x = -1 elif a > b: x = 1 print (x) ```
output
1
29,174
6
58,349
Provide tags and a correct Python 3 solution for this coding contest problem. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little later they found a string s, carved on a rock below...
instruction
0
29,219
6
58,438
Tags: binary search, dp, hashing, string suffix structures, strings Correct Solution: ``` s = input() k = -1 l = [-1] for c in s: #print(k) #print(s[k]) while(k!=-1)and(s[k]!=c): k=l[k] k+=1 l.append(k) #print(l) le=l[-1] #print(le) if l.count(le)<2: le=l[le] print(s[:le] if le>0 els...
output
1
29,219
6
58,439
Provide tags and a correct Python 3 solution for this coding contest problem. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little later they found a string s, carved on a rock below...
instruction
0
29,221
6
58,442
Tags: binary search, dp, hashing, string suffix structures, strings Correct Solution: ``` def kmp_preprocess(s, kmp): kmp[0] = 0 i = 1 j = 0 while i < len(s): if s[i] == s[j]: j += 1 kmp[i] = j i += 1 else: if j != 0: j = kmp[j - 1] else: kmp[i] = 0 ...
output
1
29,221
6
58,443
Provide tags and a correct Python 3 solution for this coding contest problem. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little later they found a string s, carved on a rock below...
instruction
0
29,224
6
58,448
Tags: binary search, dp, hashing, string suffix structures, strings Correct Solution: ``` def pre(s): n = len(s) l = 0 lps = [0]*(n) for i in range(1,n): j = lps[i-1] while j>0 and s[i]!=s[j]: j = lps[j-1] if s[i] == s[j]: j+=1 lps[i] = j ...
output
1
29,224
6
58,449
Provide tags and a correct Python 3 solution for this coding contest problem. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little later they found a string s, carved on a rock below...
instruction
0
29,225
6
58,450
Tags: binary search, dp, hashing, string suffix structures, strings Correct Solution: ``` def kmpTable(s, n): res = [0]*n check_idx = 0 for i in range(1, n): while check_idx > 0 and s[check_idx] != s[i]: check_idx = res[check_idx-1] if s[check_idx] == s[i]: check_idx ...
output
1
29,225
6
58,451
Provide tags and a correct Python 3 solution for this coding contest problem. Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them. A little later they found a string s, carved on a rock below...
instruction
0
29,226
6
58,452
Tags: binary search, dp, hashing, string suffix structures, strings Correct Solution: ``` s = input() n = len(s) if n==1 or n==2: print("Just a legend") else: lista = [] for i in range(n): lista.append(0) l = 0 lista[0] = 0 i = 1 while i < n: if s[i]==s[l]: l+=1 lista[i] = l i += 1 else: if l...
output
1
29,226
6
58,453
Provide tags and a correct Python 3 solution for this coding contest problem. Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that ...
instruction
0
29,405
6
58,810
Tags: brute force, implementation, strings Correct Solution: ``` name = input() genderset = set(name) size_set = len(genderset) if size_set % 2 == 0: print('CHAT WITH HER!') else: print('IGNORE HIM!') ```
output
1
29,405
6
58,811
Provide tags and a correct Python 3 solution for this coding contest problem. Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that ...
instruction
0
29,406
6
58,812
Tags: brute force, implementation, strings Correct Solution: ``` x=input() l=[] for i in x: if i not in l: l.append(i) if len(l)%2==0: print("CHAT WITH HER!") else: print("IGNORE HIM!") ```
output
1
29,406
6
58,813
Provide tags and a correct Python 3 solution for this coding contest problem. Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that ...
instruction
0
29,407
6
58,814
Tags: brute force, implementation, strings Correct Solution: ``` a=input() b="" for k in range(len(a)): if a[k] not in b: b = b+ a[k] if len(b)% 2== 0: print("CHAT WITH HER!") else: print("IGNORE HIM!") ```
output
1
29,407
6
58,815
Provide tags and a correct Python 3 solution for this coding contest problem. Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that ...
instruction
0
29,408
6
58,816
Tags: brute force, implementation, strings Correct Solution: ``` s=input() i=0 l=[] while i<len(s): m=s[i] if m in l: i=i+1 continue else: l.append(s[i]) i=i+1 z=len(l) if z%2==0: print("CHAT WITH HER!") else: print("IGNORE HIM!") ```
output
1
29,408
6
58,817
Provide tags and a correct Python 3 solution for this coding contest problem. Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that ...
instruction
0
29,409
6
58,818
Tags: brute force, implementation, strings Correct Solution: ``` s = input() s = len(set(s)) if s % 2 == 0: print('CHAT WITH HER!') else: print('IGNORE HIM!') ```
output
1
29,409
6
58,819
Provide tags and a correct Python 3 solution for this coding contest problem. Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that ...
instruction
0
29,410
6
58,820
Tags: brute force, implementation, strings Correct Solution: ``` str = input() str = (set(str)) if len(str) & 1: print("IGNORE HIM!") else: print("CHAT WITH HER!") ```
output
1
29,410
6
58,821
Provide tags and a correct Python 3 solution for this coding contest problem. Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that ...
instruction
0
29,411
6
58,822
Tags: brute force, implementation, strings Correct Solution: ``` ''' Author: AsilenceBTF Blog: asilencebtf.top Date: 2020-05-28 13:02:12 LastEditTime: 2020-08-12 18:45:32 ''' s = input() t = set(s) print(['CHAT WITH HER!','IGNORE HIM!'][len(t)&1]) ```
output
1
29,411
6
58,823
Provide tags and a correct Python 3 solution for this coding contest problem. Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that ...
instruction
0
29,412
6
58,824
Tags: brute force, implementation, strings Correct Solution: ``` name = input() counter = 0 znach = [] counter = 0 for i in range(26): znach.append(0) for i in range(len(name)): znach[ord(name[i]) - ord('a')] += 1 for i in range(26): if znach[i] > 0: counter += 1 if counter % 2 == 0: print('CHAT WITH ...
output
1
29,412
6
58,825
Provide tags and a correct Python 2 solution for this coding contest problem. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right ...
instruction
0
29,474
6
58,948
Tags: hashing, implementation, strings Correct Solution: ``` #!/usr/bin/env pypy3 """ Python 3 compatibility tools. """ from __future__ import division, print_function import itertools import sys if sys.version_info[0] < 3: input = raw_input range = xrange filter = itertools.ifilter map = itertools....
output
1
29,474
6
58,949
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right ...
instruction
0
29,475
6
58,950
Tags: hashing, implementation, strings Correct Solution: ``` s = input() t = input() def solve(s, t): n = len(t) i = 0 while i < n: if s[i] != t[i]: if s[:i] + s[i+1:] == t: indices = [] j = i while s[j] == s[i]: indice...
output
1
29,475
6
58,951
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right ...
instruction
0
29,476
6
58,952
Tags: hashing, implementation, strings Correct Solution: ``` s1=input() s2=input() raz=len(s1)-1 for i in range(len(s2)): if s1[i]!=s2[i]: raz=i;break for i in range(raz+1, len(s1)): if s1[i]!=s2[i-1]: print(0);exit() i=raz while i>0 and s1[raz]==s1[i-1]: i-=1 print(raz-i+1) print(' '.join(map(str, range(i+1,ra...
output
1
29,476
6
58,953
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right ...
instruction
0
29,477
6
58,954
Tags: hashing, implementation, strings Correct Solution: ``` s1 = input() s2 = input() l=j= len(s2) for i in range(l): if s1[i] != s2[i]: j = i break if s1[j+1:] != s2[j:]: print(0) else: k = j while k > 0 and s1[k-1] == s1[j]: k -= 1 print(j-k+1) print(*range(k+1,j+2)) ...
output
1
29,477
6
58,955
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right ...
instruction
0
29,478
6
58,956
Tags: hashing, implementation, strings Correct Solution: ``` def get_words(): word_one = input("").strip() word_two = input("").strip() return word_one, word_two def prefix_length(long_word, short_word): idx = 0 while idx < len(short_word): if short_word[idx] != long_word[idx]: ...
output
1
29,478
6
58,957
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right ...
instruction
0
29,479
6
58,958
Tags: hashing, implementation, strings Correct Solution: ``` s = input().strip() t = input().strip() diff = len(s) - 1 for i in range(len(t)): if s[i] != t[i]: diff = i break for i in range(diff + 1, len(s)): if s[i] != t[i - 1]: print(0) import sys; sys.exit() start = diff while start != 0 and s[st...
output
1
29,479
6
58,959
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right ...
instruction
0
29,480
6
58,960
Tags: hashing, implementation, strings Correct Solution: ``` s, t = input(), input() n = j = len(t) for i in range(n): if s[i] != t[i]: j = i break if s[j+1:] != t[j:]: print(0) else: i = j while i > 0 and s[i - 1] == s[j]: i -= 1 print(j - i + 1) print(*range(i + 1, j ...
output
1
29,480
6
58,961
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right ...
instruction
0
29,481
6
58,962
Tags: hashing, implementation, strings Correct Solution: ``` # region fastio import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mo...
output
1
29,481
6
58,963
Provide tags and a correct Python 3 solution for this coding contest problem. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right ...
instruction
0
29,482
6
58,964
Tags: hashing, implementation, strings Correct Solution: ``` s1 = input() s2 = input() k = len(s2) l = -1 m = 0 for i in range(k): if s2[i] != s1[i]: l = i break for i in range(k - 1, l - 1, -1): if s2[i] != s1[i + 1]: m = 1 break if m and l != -1: print(0) else: if l == ...
output
1
29,482
6
58,965
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and h...
instruction
0
29,483
6
58,966
Yes
output
1
29,483
6
58,967
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and h...
instruction
0
29,484
6
58,968
Yes
output
1
29,484
6
58,969
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and h...
instruction
0
29,485
6
58,970
Yes
output
1
29,485
6
58,971
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and h...
instruction
0
29,486
6
58,972
Yes
output
1
29,486
6
58,973
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and h...
instruction
0
29,487
6
58,974
No
output
1
29,487
6
58,975
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and h...
instruction
0
29,488
6
58,976
No
output
1
29,488
6
58,977
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and h...
instruction
0
29,489
6
58,978
No
output
1
29,489
6
58,979
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and h...
instruction
0
29,490
6
58,980
No
output
1
29,490
6
58,981
Provide a correct Python 3 solution for this coding contest problem. Broken crypto generator JAG (Japanese Alumni Group) is a mysterious organization composed of many programmers, and in order to enter the building where the headquarters of this organization is located, it is necessary to solve the ciphertext generat...
instruction
0
29,987
6
59,974
"Correct Solution: ``` while True: s = input() if s == '.':break while True: if s.find('+') == -1 and s.find('-') == -1: index = s.rfind('[') if index == -1: break e = s[index:].find(']') s = s[:index] + s[index + 1:index + e][::-1] + s...
output
1
29,987
6
59,975
Provide a correct Python 3 solution for this coding contest problem. Broken crypto generator JAG (Japanese Alumni Group) is a mysterious organization composed of many programmers, and in order to enter the building where the headquarters of this organization is located, it is necessary to solve the ciphertext generat...
instruction
0
29,988
6
59,976
"Correct Solution: ``` def pm_to_chr(s): s=s.group() if s[-1]=='?': return 'A' ans=chr((((ord(s[-1])+s.count('+')-s.count('-'))-ord('A'))%26)+ord('A')) return ans def reverse(s): s=s.group() s=s[1:-1] ans=''.join(reversed(s)) return ans import re s=input() while s!='.': s=...
output
1
29,988
6
59,977
Provide a correct Python 3 solution for this coding contest problem. Broken crypto generator JAG (Japanese Alumni Group) is a mysterious organization composed of many programmers, and in order to enter the building where the headquarters of this organization is located, it is necessary to solve the ciphertext generat...
instruction
0
29,989
6
59,978
"Correct Solution: ``` import sys from itertools import product from collections import deque read = sys.stdin.read def enc(S:str, p:int): return chr((ord(S) + p - ord("A")) % 26 + ord("A")) def f(S:str): res = [] plus_minus = 0 # q = deque() stack = [] for s in S: if("A" <= s <= "Z"):...
output
1
29,989
6
59,979
Provide a correct Python 3 solution for this coding contest problem. Broken crypto generator JAG (Japanese Alumni Group) is a mysterious organization composed of many programmers, and in order to enter the building where the headquarters of this organization is located, it is necessary to solve the ciphertext generat...
instruction
0
29,990
6
59,980
"Correct Solution: ``` import re bra_re = re.compile(r'\[([-+\w?]+)\]') let_re = re.compile(r'[-+]*[\w?]') def rep(m): s = m.group(0) if s[-1] == '?': return 'A' d = 0 d += s.count('+') d -= s.count('-') d %= 26 d += ord(s[-1]) if d < ord('A'): d += 26 if d > ord('Z'): d -= 26 ...
output
1
29,990
6
59,981
Provide a correct Python 3 solution for this coding contest problem. Broken crypto generator JAG (Japanese Alumni Group) is a mysterious organization composed of many programmers, and in order to enter the building where the headquarters of this organization is located, it is necessary to solve the ciphertext generat...
instruction
0
29,991
6
59,982
"Correct Solution: ``` alps = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def reverse(data): ret = "" while(True): if data[0] == "[" and (not ("[" in data[1:]) or data.index("[") > data.index("]")): tmp = data[1:data.index("]")][::-1] ret += tmp ret += data[data.index("]")+1:] ...
output
1
29,991
6
59,983