problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02756
u160169132
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['#158_D\ns = input()\nq = int(input())\n\nfrom collections import deque\n\ns = deque(s)\n\nrev = 1\nfor _ in range(q):\n Q = list(input().split())\n if Q[0] == "1":\n rev *= -1\n elif Q[0] == "2":\n if (Q[1]=="1" and rev==1) or (Q[1]=="2" and rev==-1):\n s.append(Q[2])\n elif (...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s517600751', 's530486594', 's034246711']
[14308.0, 14156.0, 14012.0]
[344.0, 340.0, 334.0]
[463, 469, 463]
p02756
u164029270
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['B = input()\norder = True\nF = ""\nfor q in range(int(input())):\n T = input().rstrip().split()\n if T[0] == "1":\n order ^= True\n else:\n f,c = T[1],T[2]\n if not((f == "1") ^ order):\n F += c\n else:\n B += c\n print(F,B)\nF = F[::-1]+B\nif not order:\n...
['Runtime Error', 'Accepted']
['s629800066', 's919040342']
[134532.0, 4304.0]
[182.0, 487.0]
[326, 327]
p02756
u166621202
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['import collections\nN = int(input())\nA = list(map(int,input().split()))\nC = collections.Counter(A)\n\nans = 0\nfor i in C.values():\n ans += int(0.5* i * (i-1))\nfor j in A:\n print(ans-C[j]+1)\n', 'from collections import deque\nS = str(input())\nQ = int(input())\nquery = [ input().split() for _ in range(Q) ...
['Runtime Error', 'Accepted']
['s349322423', 's960184720']
[3444.0, 42996.0]
[21.0, 548.0]
[193, 684]
p02756
u167681750
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from collections import deque\n\ns = deque(input())\nq = int(input())\nflag = 1\nfor _ in range(q):\n tfc = input().split()\n print(tfc)\n if tfc[0] == "1":\n flag *= -1\n\n elif tfc[0] == "2":\n if (tfc[1] == "1" and flag == 1) or (tfc[1] == "2" and flag == -1):\n s.appendleft(tf...
['Wrong Answer', 'Accepted']
['s030860451', 's319731835']
[13044.0, 10100.0]
[1615.0, 431.0]
[496, 475]
p02756
u169138653
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["import sys\ndef main():\n input=sys.stdin.readline\n s=input()\n q=int(input())\n ok=1\n for i in range(q):\n query=list(input().split())\n if query[0]=='1':\n ok=(ok+1)%2\n else:\n f,c=query[1],query[2]\n if ok:\n if f=='1':\n s=c+s\n else:\n s+=c\n e...
['Wrong Answer', 'Accepted']
['s019575210', 's583745501']
[4144.0, 8548.0]
[2103.0, 451.0]
[453, 521]
p02756
u169350228
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['import numpy as np\ns = input()\nq = int(input())\nrbef = []\naft = []\nsgn = 1\nfor i in range(q):\n qi = np.array(input().split(),dtype=str)\n if qi[0] == "1":\n sgn *= -1\n else:\n if (qi[1] == "1" or sgn == -1) and (qi[1] == "2" or sgn == 1):\n rbef.append(qi[2])\n else:\n...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s189263146', 's556331409', 's649205737', 's911111074', 's964444957']
[36420.0, 14636.0, 34580.0, 14920.0, 36068.0]
[1629.0, 2108.0, 1634.0, 2108.0, 1669.0]
[507, 401, 486, 482, 497]
p02756
u170410075
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["s=input()\nn=int(input())\nr=-1\nf=[]\nb=[]\nfor i in range(n):\n q=input().split()\n if q[0]=='1':\n r*=-1\n else:\n t=int(q[1])\n if t*r==-1 or t*r==2 :\n f.append(q[2])\n else:\n b.append(q[2])\ns=f[::-1]+s+b\nif r==1:\n s=s[::-1]\nprint(s)\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s222623010', 's524839773', 's556859886']
[6088.0, 4068.0, 4936.0]
[498.0, 2104.0, 488.0]
[301, 261, 327]
p02756
u173148629
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from collections import deque\nS=input()\nQ=int(input())\n\nX=deque(list(S))\nf=1\nfor _ in range(Q):\n t,ff,c=input().split()\n if t=="1":\n f*=-1\n else:\n if ff=="1":\n if f==1:\n X.appendleft(c)\n else:\n X.append(c)\n else:\n ...
['Runtime Error', 'Accepted']
['s369383937', 's685032535']
[8548.0, 8548.0]
[394.0, 484.0]
[440, 458]
p02756
u175590965
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['s = inmput()\nq = int(ionput())\nh,t = [],[]\np = 0\n\nfor i in range(q):\n c = input().split()\n if c[0] ==\'1\':\n h,t = t,h\n p = 1-p\n else:\n if c[1] ==\'1\':\n h.append(c[2])\n else:\n t.append(c[2])\nif p ==1:\n s = s[::-1]\nprint("".join(h[::-1])+s...
['Runtime Error', 'Runtime Error', 'Accepted']
['s119546188', 's271550142', 's902783533']
[9008.0, 8996.0, 12144.0]
[31.0, 28.0, 283.0]
[309, 308, 307]
p02756
u185405877
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['s=input()\nn=int(input())\ndef asd(s,m):\n if len(m)==1:\n return s[::-1]\n else:\n if m[1]=="2":\n return s+m[2]\n else:\n return m[2]+s\nfor i in range(n):\n k= input().split()\n asd(s,k)\nprint(s)', 's=input()\nn=int(input())\nfor i in range(n):\n k= input(...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s748801880', 's760269778', 's527286178']
[3316.0, 3852.0, 4616.0]
[2104.0, 2103.0, 1672.0]
[241, 199, 390]
p02756
u185424824
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["def toku()\n S = input()\n Q = int(input())\n s = [S[0]]\n A = []\n count = 0\n for i in range(Q):\n A += [input().split()]\n for i in range(Q):\n if int(A[i][0]) == 2:\n if count % 2 == 1:\n s = s[::-1]\n count = 0\n if int(A[i][1]) == 1:\n s = [A[i][2]] + s\n else:\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s304538782', 's422050341', 's404441217']
[2940.0, 2940.0, 8436.0]
[17.0, 18.0, 539.0]
[468, 461, 331]
p02756
u188827677
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from collections import deque\ns = input()\nq = int(input())\n\ns = deque(s)\nt = 0\nfor _ in range(q):\n query = list(map(str, input().split()))\n if query[0] == "1": t = 1 - t\n else:\n if t == 0:\n if query[1] == "1": s.appendleft(query[2])\n elif query[1] == "2": s.append(query[2])\n elif t == ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s040364921', 's717571165', 's047602646']
[14360.0, 16640.0, 16688.0]
[414.0, 460.0, 452.0]
[470, 415, 409]
p02756
u189023301
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from collections import deque\nimport sys\nsys.setrecursionlimit(10 ** 7)\nreadline = sys.stdin.readline\n\n\ndef main():\n a = input()\n d = deque(a)\n n = int(input())\n for i in range(n):\n j = list(readline().split())\n if len(j) == 3 and j[1] == "1":\n d.appendleft(j[2])\n ...
['Wrong Answer', 'Accepted']
['s694595978', 's773929928']
[3316.0, 8564.0]
[22.0, 215.0]
[490, 481]
p02756
u189485655
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['import sys\n\ns=list(input())\nq=int(input())\n\nre=False\nfor i in range(1,q+1):\n q_i=sys.stdin.readline().rstrip().split()\n if q_i[0]=="1":\n ~re\n else:\n if q_i[1]=="1" and re==True:\n s=[q_i[2]]+s\n elif q_i[1]=="2" and re==False:\n s=[q_i[2]]+s\n else...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s129047907', 's701851807', 's948367259', 's476120133']
[5588.0, 7496.0, 7496.0, 10084.0]
[2108.0, 2104.0, 2104.0, 403.0]
[380, 387, 384, 426]
p02756
u189487046
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["s = input()\nq = int(input())\n\nsl = ['']*(q*4)\nprint(sl)\nsl[q*2] = s\nm = q*2-1\nu = q*2+1\nrev = False\nfor _ in range(q):\n query = input().split()\n\n if query[0] == '1' and not(rev):\n rev = True\n elif query[0] == '1' and rev:\n rev = False\n\n elif query[0] == '2' and query[1] == '...
['Wrong Answer', 'Accepted']
['s088560742', 's261854160']
[18928.0, 7284.0]
[510.0, 454.0]
[870, 732]
p02756
u190873802
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['# coding: utf-8\n# Your code here!\nS = input()\nQ = int(input())\nQlist = [list(input().split()) for _ in range(Q)]\n\n#print(S)\nRcount="NO"\ni=0\nwhile i<Q:\n if Qlist[i][0]=="1":\n #S=S[::-1]\n Rcount="YES"\n else:\n check=Qlist[i][2]\n if Qlist[i][1]=="1" and Rcount=="NO":\n ...
['Wrong Answer', 'Accepted']
['s207321833', 's767248985']
[31940.0, 33028.0]
[2106.0, 578.0]
[597, 800]
p02756
u196746947
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['def main():\n s=input()\n q=int(input())\n queryy=[]\n sent="a"\n back="a"\n for i in range(q):\n queryy.append(tuple(input().split()))\n check=-1\n for query in queryy:\n # print(query)\n if query[0]=="1":\n check*=-1\n else:\n if query[1]=="1":...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s180207022', 's452881166', 's855711400']
[20180.0, 3064.0, 20156.0]
[459.0, 18.0, 450.0]
[1093, 1030, 1048]
p02756
u198905553
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["from collections import deque\n \nS = deque(input())\nQ = int(input())\n \nQ_list = [list(map(str, input().split())) for i in range(Q)]\n \nfor i in range(Q): \n if int(Q_list[i][0]) == 1:\n if len(S) >= 2:\n S = S[::-1]\n \n else:\n F = Q_list[i][1]\n C = Q_list[i][2]\n \n if in...
['Runtime Error', 'Accepted']
['s823504305', 's185970832']
[44788.0, 44660.0]
[716.0, 746.0]
[387, 581]
p02756
u199830845
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['N, A, B = map(int, input().split())\n\ndivision = N // (A + B)\ncount = division * A\n\ncount += N - division * (A + B) if A > N - division * (A + B) else A\nprint(count)', "import sys\nfrom collections import deque\nS = deque(input())\nQ = int(input())\n\n\nreverse = 0\n\nfor query in sys.stdin:\n if query[0] == ...
['Runtime Error', 'Accepted']
['s351443749', 's106193551']
[3188.0, 8436.0]
[18.0, 247.0]
[164, 692]
p02756
u201986772
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["from collections import deque\n\ns=deque(list(input()))\nflag=True\nfor i in range(int(input())):\n dir=input().split()\n if int(dir[0])==1:flag=False\n else:\n if int(dir[1])==1:\n if flag:s.appendleft(dir[2])\n else:s.append(dir[2])\n else:\n if flag:s.append(dir[2])\n else:s.appendleft...
['Wrong Answer', 'Accepted']
['s003511513', 's274137078']
[16468.0, 16320.0]
[396.0, 397.0]
[367, 369]
p02756
u203383537
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["from collections import deque\n\ns=input()\nn=int(input())\nq=deque()\nq.append(s)\nf=0\nfor i in range(n):\n t=list(input().split())\n if int(t[0])==1:\n f+=1\n else:\n if f%2==0:\n if t[1]=='1' :\n q.appendleft(t[2])\n else:\n q.append(t[2])...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s196267021', 's960664591', 's118756189']
[6900.0, 6516.0, 11644.0]
[572.0, 2104.0, 338.0]
[490, 285, 545]
p02756
u203669169
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['#! /usr/bin/env python3\n\nfrom fractions import gcd\nfrom collections import Counter, deque, defaultdict\nfrom heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge\nfrom bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort\nfrom itertools import accumulate, product, ...
['Time Limit Exceeded', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s005091847', 's492235709', 's702199240', 's743609472', 's122885890']
[7736.0, 4068.0, 3828.0, 3832.0, 4596.0]
[2104.0, 2108.0, 2104.0, 2104.0, 591.0]
[950, 296, 322, 322, 540]
p02756
u207137484
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from collections import deque\n\ndeq=deque()\ndeq.append(input())\nq=int(input())\nx=True\nfor i in range(q):\n\ta=input()\n\tif a[0]=="1":\n\t\tx = not x\n\t\tprint(x)\n\telif a[2]=="1":\n\t\tif x%2!=0:\n\t\t\tdeq.appendleft(a[4])\n\t\telse:\n\t\t\tdeq.append(a[4])\n\telse:\n\t\tif x%2!=0:\n\t\t\tdeq.append(a[4])\n\...
['Wrong Answer', 'Accepted']
['s255995896', 's109912360']
[6900.0, 8820.0]
[669.0, 355.0]
[381, 406]
p02756
u207464563
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['S = input()\nQ = int(input())\n\nforward = [] \nbackend = [] \nreverse = 0 \n\nfor i in range(Q):\n \n s = input()\n if s.count(" ") == 0:\n reverse += 1\n else:\n s2 = s.split(" ")\n if s2[1] == \'1\':\n if reverse % 2 == 0:\n ...
['Wrong Answer', 'Accepted']
['s365687606', 's975398716']
[7628.0, 7832.0]
[643.0, 698.0]
[1035, 861]
p02756
u210543511
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["s = input()\nq = int(input())\n\ncnt_reverse = 0\nfor i in range(q):\n query = input()\n \n if query[0] == '1':\n cnt_reverse += 1\n elif (query[2] == '1' and cnt_reverse % 2==0) or (query[2] == '1' and cnt_reverse % 2==1):\n s = query[4] + s\n else:\n s = s + query[4]\nif cnt_reverse%2==1:\n s = s[::...
['Wrong Answer', 'Accepted']
['s426234157', 's813655760']
[4000.0, 4192.0]
[2104.0, 358.0]
[316, 355]
p02756
u213497190
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from sys import stdin\n \ndef main():\n S = list(stdin.readline().rstrip())\n Q = int(input())\n rev = 0\n head = []\n tail = []\n \n for _ in range(Q):\n q = stdin.readline()\n if q[0] == "1":\n rev = (rev+1)%2\n else:\n if q[2] == "1":\n if...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s341981356', 's495283307', 's022997936']
[3064.0, 5740.0, 5672.0]
[18.0, 326.0, 342.0]
[700, 693, 749]
p02756
u215286521
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from collections import deque\n\nS = str(input())\nQ = int(input())\n\nqs = [list(map(str, input().split())) for _ in range(Q)]\n\nd = deque([S])\n\ndef changeVector(vector):\n if vector:\n return False\n return True\n\ndef addLeft(vector, char):\n if vector:\n d.appendleft(char)\n retur...
['Wrong Answer', 'Accepted']
['s163382943', 's786118868']
[42988.0, 44532.0]
[677.0, 661.0]
[716, 526]
p02756
u221149873
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['s = input()\nN = int(input())\nS = []\nfor _ in range(N):\n S.append(input().split())\n\norder = 1\nfor res in S:\n print(res)\n print(order)\n if res[0] == "1":\n order = order * - 1\n elif res[1] == "1":\n if order == 1:\n s = res[2]+s\n else:\n s = s+res[2]...
['Wrong Answer', 'Accepted']
['s872139345', 's616793181']
[43420.0, 6900.0]
[2106.0, 404.0]
[454, 546]
p02756
u223663729
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\ninput = sys.stdin.readline\nS = input()\ninput()\nrev = 0\nfor line in readlines():\n q, *query, = line.split()\n if q == '1':\n rev ^= 1\n else:\n f, c = query\n if f == '1':\n if not rev:\n S ...
['Wrong Answer', 'Accepted']
['s569762141', 's560141152']
[23900.0, 25888.0]
[2056.0, 142.0]
[489, 589]
p02756
u225627575
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["S = input()\nQ = int(input())\nSwitch = False\nQuery = []\n\nimport collections\ndq = collections.deque(S)\n\nfor i in range(Q):\n s = input()\n if s[0] == '1':\n if Switch:\n Switch = False\n else:\n Switch = True\n if s[0] == '2':\n if s[2] == '1' and Switch==Fals...
['Runtime Error', 'Accepted']
['s892307245', 's534392059']
[8180.0, 8564.0]
[375.0, 369.0]
[702, 702]
p02756
u228636605
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['S = input()\nQ = int(input())\nque2 = []\nque2.append(S)\nrv_flag= 0\nfor _ in range(Q):\n que = list(map(str, input().split()))\n if que[0] == "1":\n rv_flag = rv_flag + 1\n elif que[1] == "1":\n que2.insert(0,que[2])\n elif que[1] == "2":\n que2.append(que[2])\nif rv_flag % 2 == 1:\...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s196376685', 's237458047', 's358313413', 's372383326', 's413257057', 's722919897', 's751709343', 's910480936', 's493950294']
[4208.0, 3572.0, 4208.0, 4212.0, 4092.0, 3064.0, 8820.0, 3188.0, 8692.0]
[2104.0, 22.0, 2104.0, 23.0, 2104.0, 17.0, 676.0, 18.0, 668.0]
[354, 588, 354, 368, 320, 379, 368, 277, 371]
p02756
u230117534
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['S = [input()]\nq = int(input().strip())\n\nfor i in range(q):\n query = input()\n if query[0] == "1":\n S.reverse()\n elif query[0] == "2":\n query = query.strip().split(" ")\n if query[1] == "1":\n S.insert(query[2])\n else:\n S.append(query[2])\n\nprint("".join(S))', 'from collections impor...
['Runtime Error', 'Accepted']
['s534503482', 's988040216']
[3188.0, 8692.0]
[17.0, 495.0]
[278, 515]
p02756
u232873434
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["from collections import deque\nS = deque([input()])\n\ndic = 1\nQ = int(input())\nfor i in range(0,Q):\n Query = input()\n if Query == '1':\n dic = 1*(-1)\n else:\n T, F, C = Query.split()\n if (F*dic == 2) or (F*dic == -1):\n S.append(C)\n else:\n S.appendle...
['Wrong Answer', 'Accepted']
['s995526891', 's532948857']
[8172.0, 10724.0]
[455.0, 544.0]
[340, 366]
p02756
u235598818
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['def main():\n from collections import deque\n S=input()\n Q=int(input())\n A=[input().split() for _ in range(Q)]\n d=deque(S)\n for x in A:\n if x[0]=="1":\n d.reverse()\n else:\n if x[1]=="1":\n d.appendleft(x[2])\n else:\n ...
['Wrong Answer', 'Accepted']
['s988411574', 's561883609']
[44660.0, 44652.0]
[2106.0, 226.0]
[407, 594]
p02756
u235783479
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
[' S = input()\n Q = int(input())\n \n # print(S, Q)\n \n queries = []\n for i in range(Q):\n query = input()\n queries.append(query)\n \n from collections import deque\n slist = deque()\n\tslist.append(S)\n for query in queries:\n if query == "1":\n i...
['Runtime Error', 'Runtime Error', 'Accepted']
['s468488581', 's796473230', 's158674027']
[2940.0, 2940.0, 21224.0]
[17.0, 17.0, 368.0]
[754, 643, 637]
p02756
u236823931
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['if __name__ == \'__main__\':\n d = input()\n n = int(input())\n for _ in range(n):\n q = input()\n d = d[::-1] if q[0] == (\'1\') else d = q[-1]+d if q[:3] == ("2 1") else d=d+q[-1] \n print(d)', 'if __name__ == \'__main__\':\n d = input()\n n = int(input())\n qs = [input() for...
['Runtime Error', 'Accepted']
['s391016814', 's478228265']
[3056.0, 18952.0]
[17.0, 338.0]
[214, 448]
p02756
u238504302
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['S = input()\nQ = int(input())\nQuery = list(input().split() for _ in range(Q))\n\ncount = 0\nL, R = "", ""\n\nfor i in range(Q):\n if Query[i][0] == "1": count += 1\n else:\n if Query[i][1] == "1":\n if count % 2 == 0: L = Query[i][2] + L\n else: R += Query[i][2]\n else:\n if count % 2 == 0: R ...
['Runtime Error', 'Accepted']
['s510518693', 's013691154']
[171376.0, 45844.0]
[589.0, 376.0]
[447, 513]
p02756
u239917977
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['def main():\n from collections import deque\n S = deque(input().split())\n Q = int(input())\n\n q_list = [input().split() for _ in range(Q)]\n\n flag = True\n for q in q_list:\n if len(q) == 1:\n t = q[0]\n else:\n t, f, c = q\n\n if t == \'1\':\n ...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s619210115', 's758921782', 's800169696', 's462975308']
[43116.0, 42328.0, 44268.0, 44532.0]
[404.0, 2106.0, 393.0, 420.0]
[554, 653, 517, 533]
p02756
u241159583
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['S = list(input())\nprint(S)\nQ = int(input())\n\nfor _ in range(Q):\n q = list(input())\n if len(q) == 1:\n r = S[0]\n l = S[-1]\n S[0] = l\n S[-1] = r\n else:\n if q[2] == "1": S.insert(0, q[4])\n else: S.append(q[4])\n\nprint("".join(S)) ', 'from collections import deque\nS = deque(input())\nQ ...
['Wrong Answer', 'Accepted']
['s697522557', 's902024903']
[5616.0, 49060.0]
[2104.0, 357.0]
[246, 454]
p02756
u243714267
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['s = input()\nq = int(input())\n\nflag_swap = False\nfor i in range(q):\n query = list(input().split())\n if query[0] == "1":\n flag_swap = not flag_swap\n else:\n if (query[1] == "1" and not flag_swap) or (query[1] == "2" and flag_swap):\n s = query[2] + s\n else:\n s += query[2]\n\nidx = range(...
['Time Limit Exceeded', 'Accepted']
['s404659593', 's808637764']
[4952.0, 4468.0]
[2104.0, 507.0]
[400, 414]
p02756
u244416763
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['s = str(input())\nq = int(input())\nquery = [0 for _ in range(q)]\nw = True\nfor i in range(q):\n query[i] = list(map(str,input().split()))\nfor i in range(q):\n if(query[i][0] == "1"):\n w = not(w)\n else:\n mem = query[i][2]\n if(query[i][1] == "1"):\n if(w):\n ...
['Wrong Answer', 'Accepted']
['s067452904', 's293737051']
[40108.0, 8692.0]
[2106.0, 647.0]
[480, 553]
p02756
u250583425
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['import sys\ndef input(): return sys.stdin.readline().rstrip()\n\ndef main():\n S = input()\n Q = int(input())\n\n reverse = False\n header = []\n footer = []\n for _ in range(Q):\n query = input()\n if query[0] == \'1\':\n reverse = not reverse\n else:\n _,...
['Wrong Answer', 'Accepted']
['s725060845', 's673221866']
[5220.0, 12600.0]
[2104.0, 180.0]
[798, 713]
p02756
u250828304
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from collections import deque\n\ns = input()\nd1 = deque()\nd2 = deque()\nd3 = deque()\nnum = 0\nfor i in s:\n d2.append(i)\nq = int(input())\nfor i in range(q):\n data = input().split()\n if len(data) == 1:\n if len(d2) != 1:\n num += 1\n else:\n f = int(d...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s039879922', 's264546020', 's402330228', 's578981346', 's739032336', 's785965265', 's626890049']
[7516.0, 8692.0, 6900.0, 8556.0, 8564.0, 4980.0, 8564.0]
[499.0, 2104.0, 507.0, 506.0, 511.0, 378.0, 499.0]
[611, 493, 537, 552, 472, 477, 650]
p02756
u252828980
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['s = list(input())\nn = int(input())\nimport numpy as np\n\ns = np.array(s)\n\nL = []\nfor i in range(n):\n flag = False\n L = (list(map(str,input())))\n #print(L)\n if len(L) >1:\n if int(L[2]) == 1:\n if flag:\n s = np.append(s,L[4])\n else:\n s ...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s024109647', 's027495773', 's759245024', 's366833893']
[18904.0, 2940.0, 14044.0, 8436.0]
[2108.0, 17.0, 2108.0, 412.0]
[554, 573, 388, 428]
p02756
u254221913
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["s = input()\nq = int(input())\nque = [0] * q\nt = []\nf = []\nc = []\nfor i in range(q):\n que[i] = list(map(str,input().split()))\n if(len(que[i])==3):\n t.append(que[i][0])\n f.append(que[i][1])\n c.append(que[i][2])\n else:\n t.append(que[i][0])\ncount = 0\nfor i in range(q):\n...
['Wrong Answer', 'Accepted']
['s275184555', 's358044443']
[45344.0, 44652.0]
[2106.0, 758.0]
[525, 654]
p02756
u255821449
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['# -*- coding: utf-8 -*-\nfrom collenctions import deque\n\nS = input()\nQ = int(input())\n\nquerys = []\nop1_cnt = 0\nop2_cnt = 0\nprefix = deque()\nsuffix = deque()\nfor i in range(Q):\n query = input()\n if len(query) == 1:\n op1_cnt += 1\n\n if op2_cnt != 0:\n prefix.extend(S)\n ...
['Runtime Error', 'Accepted']
['s506408334', 's385470942']
[3064.0, 9284.0]
[17.0, 413.0]
[814, 608]
p02756
u257265865
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['S=input()\nQ=int(input())\nl=list(input().split() for i in range(Q))\nfor j in l:\n if j[0]=="1":\n S=S[::-1]\n else:\n if j[1]=="1":\n S=S+j[2]\n else:\n S=j[2]+S\n\nprint(S)\n ', 'from collections import deque\nS=deque(list(input()))\nQ=int(input())\nl=list(input().split() for i in range(Q...
['Wrong Answer', 'Accepted']
['s092530313', 's663560682']
[41684.0, 44516.0]
[2107.0, 467.0]
[191, 465]
p02756
u260216890
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["def solve2(s):\n ans = 0\n for i, c in enumerate(s): \n if c in '02468':\n ans += i + 1 \n \n \n \n return ans\n\n\ndef solve5(s): \n ans = 0\n for i, c in enumerate(s):\n if c in '05':\n ans += i +...
['Runtime Error', 'Accepted']
['s122476251', 's277206760']
[3316.0, 8676.0]
[19.0, 440.0]
[1368, 580]
p02756
u266113953
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['S = input()\nQ = int(input())\nreverse = False\nfront = ""\nend = ""\n\nfor i in range(Q):\n inp = input()\n if inp[0] == "1":\n reverse = ~reverse\n else:\n _, F, C = inp.split()\n if (F == "1" and reverse == False) or (F == "2" and reverse == True):\n front = front+C\n ...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s209027871', 's312068290', 's442599945', 's983354352']
[4396.0, 2940.0, 134524.0, 4468.0]
[466.0, 17.0, 363.0, 469.0]
[419, 453, 454, 378]
p02756
u268554510
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['def main():\n S = input()\n Q = int(input())\n import sys\n que = [list(sys.stdin.readline().split()) for _ in range(Q)]\n judge = False\n for l in que:\n if int(l[0])==1:\n if judge:\n judge = False\n else:\n judge = True\n\n elif int(l[0])==2:\n f,c = int(l[1]),l[2]\n if ju...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s456131753', 's707122144', 's870016742', 's636434030']
[29940.0, 30068.0, 31992.0, 32196.0]
[304.0, 304.0, 1405.0, 1451.0]
[343, 422, 465, 573]
p02756
u274635633
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["s=input()\nn=int(input())\nq=[list(map(int,input().split())) for i in range(n)]\natama=0\nx=0\nfor i in range(n):\n if q[i][0]==2:\n x+=1\n\noshiri=len(s)+x-1\nans=[None]*(s+x)\nx=0\nfor i in range(n)[::-1]:\n if q[i][0]==1:\n x+=1\n else:\n if (q[i][1]+x)%2==0:\n ans[oshiri]=q[i][2]\n oshiri-=1...
['Runtime Error', 'Accepted']
['s953746633', 's185472224']
[3316.0, 42544.0]
[18.0, 874.0]
[438, 545]
p02756
u276894499
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['import math\nS = input()\nQ = int(input())\nfor n in range(Q):\n T,F,C = input()\n if T == "1":\n S = S[::-1]\n else:\n if F == "1":\n S = C + S\n else:\n S = S + C\nprint(S)\n', 'from collections import deque\n\nS = deque(input())\nQ = int(input())\nflg = True\nfor...
['Runtime Error', 'Accepted']
['s695087167', 's796898868']
[3188.0, 8820.0]
[18.0, 414.0]
[215, 373]
p02756
u279266699
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['import sys\nfrom collections import deque\n\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\ns = readline().rstrip()\nq = readline()\nqueries = readlines()\ns = deque(s)\ntot_1 = 0\nfor i in queries:\n if i[0] == \'1\':\n tot_1 += 1\n continue\n c = i[4]\n if (tot_1 + int(i[2]...
['Runtime Error', 'Runtime Error', 'Accepted']
['s300356530', 's814364089', 's458896075']
[18408.0, 18344.0, 13896.0]
[159.0, 1996.0, 318.0]
[446, 346, 623]
p02756
u281610856
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["from collections import deque\nimport sys\ninput = sys.stdin.readline\n\ns = list(input())\nq = int(input())\nans = deque(s)\nfor i in range(q):\n arr = list(map(str, input().split()))\n if arr[0] == '1':\n ans.reverse()\n else:\n if arr[1] == '1':\n ans.appendleft(arr[2])\n e...
['Wrong Answer', 'Accepted']
['s939146532', 's925910379']
[13160.0, 13168.0]
[2104.0, 737.0]
[360, 456]
p02756
u281796054
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['s=input()\nn=int(input())\nfront=""\nback=""\nreverse=False\n\nfor i in range(n):\n t=input().split()\n if t[0]=="1":\n reverse=not reverse\n else:\n if (t[1]=="1")and not reverse:\n front=front+t[2]\n elif (t[1]=="2")and reverse:\n else:\n back=back+t[2]\nif reverse:\n print(back[::-1]+s+fr...
['Runtime Error', 'Accepted']
['s177260097', 's941958706']
[2940.0, 4596.0]
[17.0, 450.0]
[340, 295]
p02756
u282265659
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["from collections import deque\n \ns = input()\nq = int(input())\nans = deque(s)\ncnt = 0\nfor i in range(q):\n f = [i for i in input().split()]\n if f[0] == '1':\n cnt += 1\n else:\n if f[1] == '1':\n if cnt % 2 == 0:\n ans.appendleft(f[2])\n else:", "from c...
['Runtime Error', 'Accepted']
['s653217070', 's224684459']
[2940.0, 8688.0]
[17.0, 554.0]
[294, 522]
p02756
u283929013
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['S = input()\nQ = int(input())\n\ndef rev(s):\n re = ""\n for k in range(len(s)):\n re = re + s[len(s) - 1 - k]\n return re\n\nflag = False\ncount = 0\n\nfor i in range(Q):\n k = input()\n if k == "1":\n if i == Q -1:\n if count % 2 == 0:\n print(count)\n ...
['Wrong Answer', 'Accepted']
['s955258036', 's422105426']
[3856.0, 26448.0]
[2103.0, 1528.0]
[608, 925]
p02756
u287182213
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["#for _ in range(int(input())):\ns = input()\nq = int(input())\nb=0\nfor _ in range(q):\n qi = input().split(' ')\n print(len(qi))\n if(len(qi)==1):\n b=b^1\n else:\n fi = int(qi[1])\n if(fi==1):\n if(b==0):\n s=qi[2]+s\n else:\n s=s+...
['Wrong Answer', 'Accepted']
['s945984790', 's490913752']
[4104.0, 4468.0]
[2108.0, 528.0]
[483, 510]
p02756
u290187182
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["if __name__ == '__main__':\n s = input()\n q = int(input())\n ans = s\n rev_count = 0\n leftList = []\n rightList =[]\n alist =[]\n\n for i in range(q):\n a = [i for i in input().split()]\n alist.append(a)\n if len(a) == 1:\n rev_count = rev_count +1\n\n if r...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s114260194', 's908935351', 's978918918', 's865384967']
[29316.0, 29684.0, 26740.0, 30068.0]
[627.0, 2105.0, 540.0, 639.0]
[852, 820, 846, 897]
p02756
u296150111
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from collections import deque\nimport sys\ninput=sys.stdin.readline\nmoji=deque([])\ns=input().rstrip()\nfor i in range(len(s)):\n\tmoji.append(ord(s[i]))\nq=int(input())\nrev=0\nfor _ in range(q):\n\tqw=input().split()\n\tif qw[0]=="1":\n\t\trev+=1\n\telse:\n\t\tf=qw[1]\n\t\tc=qw[2]\n\t\tif f=="1":\n\t\t\tif rev%2==...
['Wrong Answer', 'Accepted']
['s163411054', 's587293379']
[5876.0, 6184.0]
[197.0, 205.0]
[579, 426]
p02756
u299791633
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['s = input()\nq = int(input())\nquery = []\nlead = \'\'\nend = \'\'\ninversion_flg = False\n\nfor j in range(q):\n i = input().split()\n if i[0] == "1":\n if inversion_flg:\n inversion_flg = False \n else:\n inversion_flg = True\n else:\n \n if inversion_flg:\...
['Wrong Answer', 'Accepted']
['s581914472', 's145879874']
[4340.0, 4388.0]
[477.0, 466.0]
[597, 505]
p02756
u301624971
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['\nS=input()\nQ=int(input())\nlis=[]\nfor _ in range(Q):\n lis.append(input().split())\nans=S\ncnt=0\nli=[[\'2\',\'1\',"a"] for i in range(2*100000)]\nfor i in li:\n if(int(i[0]) == 1):\n cnt= (cnt+1) % 2\n elif((cnt== 0 and i[1]==\'1\') or (cnt == 1 and i[1]==\'2\')):\n ans= i[2] + ans\n els...
['Wrong Answer', 'Accepted']
['s574299087', 's001174249']
[62148.0, 44660.0]
[2107.0, 698.0]
[369, 662]
p02756
u305366205
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["n = int(input())\n\nif n == 1:\n print('a')\n exit()\n\nans = []\n\n\ndef dfs(s, c):\n for i in range(ord('a'), ord(c) + 2):\n now = s + chr(i)\n if len(now) == n:\n ans.append(now)\n elif i > ord(c):\n dfs(now, chr(i))\n else:\n dfs(now, c)\n\n\nd...
['Runtime Error', 'Accepted']
['s983466349', 's156592973']
[3188.0, 12256.0]
[18.0, 530.0]
[339, 401]
p02756
u306516971
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['S = input()\nQ = int(input())\n\na = 0\nfor i in range(Q):\n t = input()\n if t == "1":\n if a == 0:\n a = 1\n else:\n a = 0\n else:\n t,f,c = t.split()\n if f == "1":\n if a == 0:\n S = c + S\n else\n S = S...
['Runtime Error', 'Runtime Error', 'Accepted']
['s027611476', 's911185878', 's263803819']
[2940.0, 2940.0, 8436.0]
[18.0, 17.0, 395.0]
[466, 466, 539]
p02756
u307622233
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["from collections import deque\n\ns = deque(list(input()))\nq = int(input())\n\nrev = True\n\nfor i in range(q):\n q = list(input().split())\n if(int(q[0]) == 1):\n rev = rev ^ True\n else:\n n = int(q[1])\n if((n == 1 and rev) or (n == 2 and not rev)):\n s.appendleft(0, q[2])\...
['Runtime Error', 'Accepted']
['s722945639', 's128842165']
[4852.0, 8420.0]
[24.0, 615.0]
[393, 445]
p02756
u308919961
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["#ABC158 D - String Formation\n\nS = str(input())\nQ = int(input())\nprint(S)\nfor i in range(Q):\n q = input().split(' ')\n if(q[0] == '1'):\n S = S[::-1]\n\n else:\n if(q[1] == '1'):\n temp = [q[2]]\n S = q[2] + S\n else:\n S = S + q[2]\n\nprint(S)\n", '...
['Wrong Answer', 'Accepted']
['s231078641', 's442186322']
[3828.0, 40528.0]
[2107.0, 1855.0]
[296, 581]
p02756
u312907447
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["S = str(input())\nQ = int(input())\n\nqs = [input().split() for i in range(Q)]\n\ni = 0\nwhile i < len(qs):\n q = qs[i]\n if q[0] == '1':\n if qs[i+1][0] == '1':\n i += 2\n else:\n S = S[::-1]\n i += 1\n else:\n if q[1] == '1':\n S = q[2] + S\n...
['Runtime Error', 'Accepted']
['s910523914', 's440109913']
[41696.0, 8540.0]
[2106.0, 459.0]
[366, 603]
p02756
u317423698
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["import sys\nimport collections\nimport itertools\n\n\ndef resolve(in_):\n one = ord(b'1')\n two = ord(b'2')\n # print(f'{one=} {two=}')\n\n S = in_.readline().strip()\n q = collections.deque(S)\n # print(f'{S=} {q=}')\n\n reverse_flag = False\n Q = int(in_.readline())\n for query in itertoo...
['Wrong Answer', 'Accepted']
['s201672184', 's992732281']
[12064.0, 12064.0]
[80.0, 78.0]
[800, 804]
p02756
u323045245
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['s = input()\nn = int(input())\nQ = [list(map(str, input().split())) for i in range(n)]\n\nfor i in range(n):\n op = Q[i]\n if len(op) == 1:\n s = s[::-1]\n elif op[1] == 1:\n s = op[2] + s\n else:\n s = s + op[2]\nprint(s)\n', "import collections\n\ns = collections.deque(list(input())...
['Wrong Answer', 'Accepted']
['s953287156', 's931502872']
[41520.0, 9180.0]
[2106.0, 527.0]
[244, 733]
p02756
u327078256
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["S=input()\nQ=int(input())\nQuery=[[j for j in input().split()] for i in range(Q)]\n\nc=0\nS0=list(S)\n\nfor i in range(Q):\n if Query[i][0]=='1':\n c=c+1\n else:\n if ((Query[i][1]=='1')and(c%2==0)) or ((Query[i][1]=='2')and(c%2==1)):\n S0.appendleft(Query[i][2])\n else:\n ...
['Runtime Error', 'Accepted']
['s622423507', 's644000890']
[27508.0, 32116.0]
[463.0, 550.0]
[405, 437]
p02756
u328364772
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["for i in range(q):\n tfc = input()\n if len(tfc) == 1:\n if rev:\n rev = False\n else:\n rev = True\n else:\n t, f, c = tfc.split()\n if f == '1':\n if rev:\n back += c\n else:\n forward += c\n else:\...
['Runtime Error', 'Accepted']
['s982754057', 's430747428']
[3060.0, 4284.0]
[18.0, 455.0]
[461, 528]
p02756
u329049771
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["import sys\n\ns = input()\nq = int(input())\n\nfor query in sys.stdin:\n if query == '1':\n s = s[::-1]\n else:\n t,f,c = query.split()\n if f == '1':\n s = c + s\n elif f == '2':\n s = s + c\nprint(s)", "import sys\nfrom collections import deque\n\n\n\n\ns = de...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s383867058', 's581477686', 's869376503', 's459726452']
[3772.0, 9172.0, 12496.0, 8548.0]
[2104.0, 168.0, 187.0, 155.0]
[243, 741, 750, 732]
p02756
u329799519
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["S = input()\nQ = int(input())\n\n\ndef formation():\n global S, Q\n\n ls = list(S)\n do_rev = False\n for _ in range(Q):\n t_str = input()\n\n if t_str[0] == '1':\n do_rev = not do_rev\n else:\n splited = t_str.split(' ')\n f = splited[1]\n ...
['Runtime Error', 'Accepted']
['s614167425', 's465219533']
[136008.0, 54652.0]
[1665.0, 1573.0]
[695, 2300]
p02756
u334904929
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["S = input()\nQ = int(input())\n\nflag = 1\ns1 = ''\ns2 = ''\n\nfor i in range(Q):\n\tq = input()\n\tif len(q) == 1:\n\t\tflag = flag * (-1)\n\telse:\n\t\tT,F,C = q.split(' ')\n\t\tif flag == 1:\n\t\t\tif int(F) == 1:\n\t\t\t\ts1 = s1 + C\n\t\t\telse:\n\t\t\t\ts2 = C + s2\n\t\telse:\n\t\t\tif int(F) == 1:\n\t\t\t\ts2 ...
['Wrong Answer', 'Accepted']
['s092332781', 's210595507']
[4356.0, 4480.0]
[830.0, 523.0]
[361, 216]
p02756
u335950809
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["def sr(x):\n y = ''\n for i in range(len(x)-1,-1,-1):\n y = '%s%s' %(y,x[i])\n print(y)\n print(y) \n return y\n\ns = input()\nq = int(input())\n\nfor i in range(q):\n x = input().split()\n \n if (x[0] == '1'):\n #s = s[::-1]\n s = sr(s)\n else:\n s = '%s%...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s029923932', 's421284566', 's715224487', 's574512268']
[134516.0, 6072.0, 3064.0, 12272.0]
[2104.0, 2108.0, 17.0, 734.0]
[360, 383, 424, 478]
p02756
u337751290
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["def main():\n S = input()\n Q = int(input())\n queries = [input() for _ in range(Q)]\n\n reverse = False\n\n for e in queries:\n if e[0] == '1':\n reverse = not reverse\n else:\n T, F, C = e.split()\n if F == '2': F = True\n else: F = False\n\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s134389514', 's630995597', 's883968350']
[15992.0, 16120.0, 16960.0]
[319.0, 325.0, 347.0]
[630, 603, 721]
p02756
u343823529
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['import copy\nimport itertools\n\ns = input()\nq = int(input())\n#s= list(input())\n\nct = 0\nls = []\nrs = []\nfor i in range(q):\n qtmp = input().split()\n "qtmp = [2,1,\'c\']\n t = int(qtmp[0])\n if(t == 1):\n ct += 1\n ct = ct % 2\n else:\n f = int(qtmp[1])\n if(ct == f):...
['Runtime Error', 'Accepted']
['s506639041', 's028740663']
[3064.0, 6916.0]
[18.0, 748.0]
[563, 581]
p02756
u344030307
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["from collections import deque\n\ns = deque(input())\nq = int(input())\n\nqq = [list(input().split()) for i in range(q)]\nqq.append([0, 0, 0])\n\norder = 0\ncnt = 0\nf = []\n\nfor i in qq:\n if i[0] != order:\n if order == 1:\n if cnt%2 == 1:\n s.reverse()\n cnt = 0\n elif order == 21:\n ...
['Wrong Answer', 'Accepted']
['s986629010', 's847527991']
[37380.0, 36460.0]
[2206.0, 360.0]
[561, 552]
p02756
u349444371
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from collections import deque\nS=input()\ns=deque(S)\nQ=int(input())\nQue=[list(map(str, input().split())) for _ in range(Q)]\n#print(Que)\nfor i in range(Q):\n if Que[i][0]=="1":\n s=s[::-1]\n elif Que[i][0]=="2":\n if Que[i][1]=="2":\n s.append(Que[i][2])\n elif Que[i][1]=="1":...
['Runtime Error', 'Accepted']
['s354566105', 's299886346']
[44660.0, 46196.0]
[672.0, 702.0]
[369, 592]
p02756
u350093546
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["from collections import deque\n\nz=list(input())\nQ=deque()\nQ.append((z))\nq=int(input())\n\ncnt=0\n\nfor i in range(q):\n x=input()\n if x[0]=='1':\n cnt+=1\n cnt%=2\n \n elif x[0]=='2':\n if x[2]=='1':\n if cnt%2==0:\n Q.appendleft(x[4])\n else:\n Q.append(x[4])\n...
['Runtime Error', 'Runtime Error', 'Accepted']
['s945211626', 's992936688', 's676578981']
[13204.0, 13032.0, 15008.0]
[291.0, 288.0, 304.0]
[454, 452, 466]
p02756
u353919145
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["def string():\n s = input()\n q = int(input())\n l = ''\n r = ''\n re = False\n while q > 0:\n t = list(input().strip().split())\n if t[0] == 1:\n re = not re\n else:\n if re:\n if t[1] == 2:\n l = t[2] + l\n ...
['Runtime Error', 'Accepted']
['s802785729', 's541228387']
[4212.0, 12024.0]
[480.0, 357.0]
[565, 369]
p02756
u357949405
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from collections import deque\n\nS = input()\nq = int(input())\n\nis_s0_head = True\ntail = len(S)-1\n\nqueue = deque(S)\n\nfor _ in range(q):\n # print(S)\n Q = list(input().split())\n if Q[0] == "1":\n is_s0_head = not is_s0_head\n else:\n if Q[1] == "1":\n if is_s0_head:\n ...
['Wrong Answer', 'Accepted']
['s822345184', 's484874104']
[7284.0, 10100.0]
[465.0, 498.0]
[604, 616]
p02756
u360061665
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['\nS = input()\nQ = int(input())\nf = True\nhead = []\ntail = []\nfor i in range(Q):\n query = input().split(\' \')\n if len(query) == 1:\n f = not f\n else:\n if (query[1] == \'1\' and f) or (query[1] == \'0\' and not f):\n head.append(query[2])\n else:\n tail.appen...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s590092362', 's703179461', 's366967416']
[5640.0, 4064.0, 5720.0]
[419.0, 2104.0, 413.0]
[511, 417, 517]
p02756
u360515075
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from collections import deque\nS = deque(list(input()))\nQ = int(input())\nf = 0\nfor _ in range(Q):\n a, *b = input().split()\n f += int(a)\n if a == "2":\n if (int(b[0]) + f) % 2 == 0 :\n S.append(b[1])\n else:\n S.appendleft(b[1])\nfor i in range(len(S)):\n if f % 2 == 1:\n print (S[-i-1], e...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s061110874', 's242338928', 's574023764', 's806231408', 's875949953', 's535759174']
[17288.0, 6768.0, 9584.0, 9584.0, 9452.0, 10340.0]
[2108.0, 1902.0, 1890.0, 1849.0, 1592.0, 678.0]
[342, 345, 353, 339, 336, 308]
p02756
u361381049
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["from collections import deque\ns = list(input())\ns = deque(s)\nn = int(input())\ncnt = 0\nfor i in range(n):\n q = list(map(str,input().split()))\n if q[0] == '1':\n cnt += 1\n else:\n if cnt % 2 == 0:\n if q[1] == '1':\n s.appendleft(q[2])\n else:\n ...
['Wrong Answer', 'Accepted']
['s340317716', 's682656440']
[11748.0, 8676.0]
[1952.0, 680.0]
[524, 524]
p02756
u363421241
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["s = [input()]\nq = int(input())\n\ncnt = 0\nfor _ in range(q):\n i = input().split()\n t = int(i[0])\n\n if t == 1:\n cnt += 1\n else:\n f = int(i[1])\n c = i[2]\n if (cnt % 2 == 0 and f == 1) or (cnt % 2 == 1 and f == 2):\n # s.insert(0, i[2])\n s.append(...
['Wrong Answer', 'Accepted']
['s323882187', 's841363184']
[12144.0, 14168.0]
[369.0, 384.0]
[405, 408]
p02756
u364318561
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["def main(s,end,start,perse):\n start.reverse()\n start.append(''.join(s))\n start.append(''.join(end))\n print(start)\n print(''.join(start))\ndef conv(s):\n a = []\n for i in range(len(s)):\n a.append(s[i])\n return a\nperse = 1\nstart = []\nend = []\n \ns = input()\nq = int(input())\...
['Wrong Answer', 'Accepted']
['s294768270', 's644242557']
[8432.0, 6516.0]
[594.0, 600.0]
[697, 704]
p02756
u367965715
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["s = input()\nq = int(input())\nfor _ in range(q):\n query = input().split()\n if query[0] == '1':\n s = s[::-1]\n else:\n if query[1] == '1':\n s = query[2] + s\n else:\n s = s + query[2]\n print(s)\n", "from collections import deque\n\nis_reverse = False\ns = de...
['Runtime Error', 'Accepted']
['s545324865', 's766831821']
[134352.0, 8436.0]
[151.0, 400.0]
[243, 429]
p02756
u369752439
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['def do(s, query, isReverse):\n if(query[0] == "1"):\n return s, isReverse * -1\n else:\n if(query[1] == "1"):\n if(isReverse == 1):\n return "".join([s, query[2]]), isReverse\n else:\n return "".join([query[2], s]), isReverse\n else:\n ...
['Wrong Answer', 'Accepted']
['s019312769', 's819948572']
[3316.0, 7180.0]
[308.0, 425.0]
[662, 762]
p02756
u370721525
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['import sys\ns = str(input())\nQ = int(input())\nq = sys.stdin.readlines()\nfor i in q:\n if i[0] == 1:\n s = alpha[::-1]\n elif i[1] == 1:\n s.appendleft(i[2])\n else:\n s.append(i[2])\nprint(s)', 'from collections import deque\nimport sys\ns = deque(list(input()))\nQ = int(input())\ncnt = 0\n\nfor i in r...
['Runtime Error', 'Accepted']
['s916550181', 's244178973']
[15872.0, 8804.0]
[40.0, 486.0]
[195, 398]
p02756
u371385198
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["import sys\ninput = sys.stdin.readline\n\nS = input().strip()\nQ = int(input())\n\nfor i in range(Q):\n q = input().split()\n if q[0] == '1':\n S.reverse()\n elif q[0] == '2':\n if q[1] == '1':\n S = '{}{}'.format(q[2], S)\n elif q[1] == '2':\n S = '{}{}'.format(S, ...
['Runtime Error', 'Accepted']
['s721153554', 's026215047']
[3700.0, 8436.0]
[2104.0, 180.0]
[320, 484]
p02756
u373047809
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['s = input()\nq = int(input())\nfor _ in range(q):\n l = input()\n if ipt == "1":\n s = s[::-1]\n else:\n t, f, c = l.split()\n if f == "1":\n st = c + st\n else:\n st += c\nprint(st)', 'def input(): return sys.stdin.readline().strip()\nst = input()\nq = int(i...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s053298058', 's360803206', 's923435242', 's973982174']
[3188.0, 2940.0, 3188.0, 16160.0]
[18.0, 18.0, 18.0, 152.0]
[229, 294, 169, 221]
p02756
u375616706
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['S=input()\nQ=int(input())\nhead=""\ntail=""\nrev=False\n\nfor _ in range(Q):\n q = input().split()\n if len(q)==1:\n rev != rev\n else:\n if rev ^ (q[1]=="1"):\n head+=q[2]\n else:\n tail+=q[2]\nif rev:\n print(tail[::-1]+S[::-1]+head)\nelse:\n print(head[::-1...
['Wrong Answer', 'Accepted']
['s708018400', 's134061281']
[4340.0, 4340.0]
[460.0, 478.0]
[310, 313]
p02756
u375695365
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from collections import deque\ns=str(input())\nc=0\nn=1\nq=int(input())\nfor i in range(q):\n a=input().strip()\n a=list(a)\n #print(a)\n if int(a[0])==1:\n #print("DFGHJ")\n c=+1\n n+=1\n if c%2==1:\n if int(a[0])==2:\n #print(a[2])\n s=list(s)\n ...
['Wrong Answer', 'Accepted']
['s566118508', 's776057871']
[5860.0, 4864.0]
[2104.0, 1607.0]
[1173, 878]
p02756
u378234362
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["string = input()\nnum = int(input())\ndata = [input().split(' ') for i in range(kai)]\n\nfor i in range(num):\n if(data[i][0] == '1'):\n if(len(string) == 2):\n string = string[1] + string[0]\n elif(len(string) >= 3):\n string = string[-1] + string[1:-1] + string[0]\n \n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s434457707', 's861809354', 's104460564']
[3188.0, 41760.0, 42396.0]
[17.0, 2106.0, 518.0]
[458, 342, 446]
p02756
u380524497
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["import sys\nfrom collections import deque\ninput = sys.stdin.readline\n\nreverse = 0\nS = deque(list(input()))\nq = int(input())\n\nfor _ in range(q):\n query = input()\n if query[0] == '1':\n reverse = 1 - reverse\n continue\n\n _, f, c = query.split()\n f = int(f)\n action = (reverse + ...
['Wrong Answer', 'Accepted']
['s423842308', 's501444587']
[8548.0, 8420.0]
[266.0, 242.0]
[430, 384]
p02756
u380791283
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['str = input()\ntimes = int(input())\nrevers = 0\nhead = ""\ntail = ""\nfor i in range(times):\n com = input().split()\n if com[0] == "1":\n if revers == 0:\n revers = 1:\n else :\n revers = 0\n \n else :\n if com[1] == "1":\n if revers == 0:\n ...
['Runtime Error', 'Accepted']
['s499128043', 's593952413']
[2940.0, 4428.0]
[18.0, 1483.0]
[620, 619]
p02756
u384793271
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["S = input()\nQ = int(input())\n\nrev = False\n\nfor i in range(Q):\n \n query = input().split()\n \n if query[0] == '1':\n if rev:\n rev = False\n else:\n rev = True\n else:\n \n F = query[1]\n \n if F == '1':\n \n if...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s012917426', 's242117973', 's699457710', 's122674057']
[3840.0, 3836.0, 41676.0, 44788.0]
[2104.0, 2104.0, 2106.0, 429.0]
[966, 994, 909, 500]
p02756
u395816772
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
["import numpy as np\nS = input()\n\nQ = int(input())\n\nA = [S]\n\nfor i in range(Q):\n s = input().split()\n if len(s) == 1:\n A = A[::-1]\n else:\n if s[1] == '1':\n A.insert(0,s[2])\n else:\n A.insert(-1,s[2])\n\nprint('%s' % ''.join(A))\n\n", "Sr = list(input())\...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s674310071', 's738432239', 's762757163', 's819055078', 's564076000']
[15616.0, 4764.0, 15796.0, 6296.0, 6292.0]
[2112.0, 2104.0, 2108.0, 497.0, 468.0]
[276, 287, 276, 285, 273]
p02756
u396210538
2,000
1,048,576
Takahashi has a string S consisting of lowercase English letters. Starting with this string, he will produce a new one in the procedure given as follows. The procedure consists of Q operations. In Operation i (1 \leq i \leq Q), an integer T_i is provided, which means the following: * If T_i = 1: reverse the string...
['from sys import stdin\nfrom collections import deque\n\nd = deque()\n\nS = stdin.readline().rstrip().split()\nQ = [int(x) for x in stdin.readline().rstrip().split()]\n\nd.append(S[0])\n# print(d)\nflag = 0b0\n\nfor i in range(Q[0]):\n s = input().split()\n\n if len(s) == 1:\n # print(len(d[0]))\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s158760440', 's207889676', 's511263401', 's818377861']
[16552.0, 4928.0, 6900.0, 11756.0]
[551.0, 2104.0, 2104.0, 528.0]
[1130, 358, 549, 1295]