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
u399973890
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())\nQ = int(input())\nquery = [input().split() for i in range(Q)]\nprint(query)\nfor i in query:\n if i[0] == '1':\n S = list(reversed(S))\n elif i[0]=='2' and i[1]=='1':\n S.insert(0, i[2])\n elif i[0]=='2' and i[1]=='2':\n S.append(i[2])\nprint(''.join(S))\n", "S = list(...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s090347910', 's984282010', 's577024058']
[49904.0, 172920.0, 44516.0]
[2106.0, 2106.0, 435.0]
[293, 368, 380]
p02756
u401487574
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\ns = input()\nq = int(input())\ninv = 1\nsfb = [0,"",""]\nfor i in range(q):\n ls = list(input().split())\n if ls[0] == "1":\n inv *=-1\n else:\n f,c = ls[1:]\n if f == "1":\n sfb[inv] +=c\n else:\n sfb[-inv] +=c\n\nan...
['Wrong Answer', 'Accepted']
['s677352983', 's008299629']
[4584.0, 4636.0]
[1397.0, 1894.0]
[350, 426]
p02756
u403331159
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()\nN=int(input())\nQ=[input() for i in range(N)]\nT=deque(S)\nfor i in range(N):\n if Q[i][0]=="2":\n if Q[i][2]=="1":\n T.appendleft(Q[i][4])\n S=list(T)\n if Q[i][2]=="2":\n T.append(Q[i][4])\n S=list(T)\n if Q[i]...
['Wrong Answer', 'Accepted']
['s584484202', 's007438730']
[21632.0, 21212.0]
[2105.0, 386.0]
[383, 547]
p02756
u408148811
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]*(q+5)\narr=[]\nl=0\nr=0\n\nfor i in range(q):\n t=input().split()\n if t[0]==\'1\':\n r+=1\n cnt[0]+=1 \n cnt[l]-=1 \n else:\n arr.append([t[2],int(t[1])])\n l+=1 \nif r%2==1:\n s=s[::-1]\nsm=0\nfor i in range(len(arr)):\n sm+=c...
['Wrong Answer', 'Accepted']
['s422666330', 's090421905']
[26480.0, 26316.0]
[684.0, 694.0]
[571, 577]
p02756
u408677243
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\ndef main():\n readline = stdin.readline\n S=readline()\n Q=int(readline())\n Queries=[readline().split() for i in range(Q)]\n\n for i in Queries:\n if i[0]=='1':\n S=S[::-1]\n else:\n if i[1]=='1':\n S=i[2]+S\n else:\n...
['Wrong Answer', 'Accepted']
['s046429192', 's250872737']
[42992.0, 44700.0]
[2207.0, 364.0]
[348, 420]
p02756
u411858517
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())\nQ = [list(map(str, input().split())) for i in range(q)]\n\nans = ['' for in range(10 ** 5 * 3 + 2)]\n\nfor i in range(len(s)):\n ans[10 ** 5 + i + 1] = s[i]\n\nreverse_num = 0\ntmp1 = 0\ntmp2 = 0\nfor i in range(q):\n if int(Q[i][0]) == 1:\n reverse_num += 1\n else:\n if int(Q[...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s635790984', 's668416300', 's671544676']
[3064.0, 46356.0, 42380.0]
[17.0, 890.0, 784.0]
[748, 750, 633]
p02756
u415888833
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...
["mport sys\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nfrom collections import deque\ndef resolve():\n S = deque(list(sr().split()), maxlen=1000000)\n Q = ir()\n rev = 1\n for i in range(Q):\n T = list(sr().split())\n if int(...
['Runtime Error', 'Accepted']
['s046730086', 's820785298']
[3064.0, 12264.0]
[17.0, 377.0]
[732, 703]
p02756
u419963262
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\nguuki=0\nANS=S\nANS_front=""\nANS_back=""\nfor i in range(Q):\n A=list(input().split())\n if A[0]=="1":\n guuki+=1\n elif int(A[1])*guuki%2==1 or (A[1]=="2" and guuki%2==0):\n ANS_back+=A[2]\n else:\n ANS_front=A[2]+ANS_front\nif guuki%2==1:\n ANS=ANS[:...
['Wrong Answer', 'Accepted']
['s477154864', 's014920199']
[4448.0, 4412.0]
[1811.0, 649.0]
[384, 375]
p02756
u424467986
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 StrConv(S, T, F, C):\n ans = ''\n if T == '1':\n pass\n \n else:\n if F == '1':\n ans = C + S\n else:\n ans = S + C\n return ans\n \n\nS = input()\nQ = int(input())\ndumy = '|' \ncnt = 0 \n\n\nfor i in range(Q):\n tmp = str(input())\n \n if tmp[0] == '1':\n T = tmp[0]\n F = '...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s169103912', 's742563948', 's998871510', 's046299326']
[3756.0, 4452.0, 2940.0, 4396.0]
[2104.0, 1662.0, 18.0, 1614.0]
[766, 660, 757, 661]
p02756
u437215432
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 i in range(2, q):\n txt3 = input().split()\n if txt3[0] == '1':\n s = s[::-1]\n else:\n if txt3[1] == '1':\n s = txt3[2] + s\n else:\n s = s + txt3[2]\nprint(s)\n", 'def ABC158D(txt):\n txt2 = txt.split("\\n")\n s = txt2[0]\n...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s356198294', 's414942209', 's449190614', 's495016909', 's536186832', 's593564438', 's809696258', 's768998811']
[3732.0, 2940.0, 3064.0, 3824.0, 2940.0, 3056.0, 3060.0, 10036.0]
[2104.0, 17.0, 19.0, 2107.0, 17.0, 17.0, 17.0, 851.0]
[237, 368, 343, 313, 8, 362, 399, 372]
p02756
u437351386
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())\nq=int(input())\nrev=0\nfor i in range(q):\n t=list(input().split())\n if t[0]=="1":\n rev=rev+1\n else:\n if t[1]=="1":\n if rev%2==0:\n s.appendleft(t[2])\n else:\n s.append(t[2])\n else:\n if rev%2==0:\n ...
['Runtime Error', 'Accepted']
['s165273673', 's180371066']
[3956.0, 8676.0]
[19.0, 505.0]
[464, 422]
p02756
u440161695
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())\nQ=int(input())\nfor i in range(Q):\n N=list(input().split())\n if N[0]=="1":\n S.reverse()\n elif N[1]="1":\n S.appendleft(N[2])\n else:\n S.append(N[2])\nprint(S)', '\nrL=list(input())\nlL=[]\nQ=int(input())\nfor i in range(Q):\n N=list(input().split())\...
['Runtime Error', 'Accepted']
['s346668626', 's510174567']
[2940.0, 6292.0]
[17.0, 460.0]
[226, 453]
p02756
u441254033
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\nfrom collections import deque\n\nss = deque(s)\nflg = True\n\nfor i in range(q):\n t = input().split()\n if t[0] == \'1\':\n flg = !flg\n else:\n if t[1] == \'2\':\n ss.append(t[2]) if flg else ss.appendleft(t[2])\n else:\n ss.append(t[2]) if flg != True else...
['Runtime Error', 'Runtime Error', 'Accepted']
['s511503739', 's705306983', 's138247352']
[2940.0, 2940.0, 10100.0]
[17.0, 17.0, 408.0]
[379, 219, 391]
p02756
u441599836
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(str(input()))\nq = int(input())\nhanten = 0\n\nfor i in range(q):\n x = input().split()\n if len(x) == 1:\n t = x[0]\n if t == "1" and hanten == 0:\n hanten = 1\n elif t == "1" and hanten == 1:\n hanten = 0\n\n else:\n f = int(x[1])\n c = str(...
['Time Limit Exceeded', 'Accepted']
['s597684459', 's565346235']
[4260.0, 8436.0]
[2104.0, 526.0]
[734, 660]
p02756
u442855260
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\nflip=0\nfr=''\nba=''\nfor i in range(Q):\n Qq=input()\n \n if(Qq.count(' ')>0):\n ti,fi,ci=Qq.split()\n if( flip%2==0 ):\n if(fi=='1'):\n fr=str(ci)+fr\n else:\n ba=ba+str(ci)\n else:\n if(fi=='...
['Wrong Answer', 'Accepted']
['s735036402', 's924997566']
[4372.0, 4420.0]
[1695.0, 1684.0]
[568, 486]
p02756
u442877951
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(map(str,input().split()))\nQ = int(input())\nQuery = [list(map(str,input().split())) for _ in range(Q)]\nd = deque(S)\nfor i in range(Q):\n if Query[i][0] == "1":\n d = d.rotate()\n elif Query[i][0] == "2":\n if Query[i][1] == "1":\n d.append(Query[i][2])\n elif...
['Runtime Error', 'Runtime Error', 'Accepted']
['s128735525', 's806212969', 's976077404']
[42996.0, 43124.0, 8820.0]
[671.0, 708.0, 535.0]
[387, 403, 519]
p02756
u447679353
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\n\nS=input()\nQ=int(input())\nQuery=[]\ntemp=[]\n\nrevflag=0\nsbef=[]\nsaft=[]\n\nfor i in range(Q):\n temp=input().split()\n if len(temp) ==1:\n revflag += 1\n else:\n if (revflag + int(temp[1])-1 )%2 == 0:\n sbef.append(temp[2])\n else:\n saft.append(t...
['Wrong Answer', 'Accepted']
['s183172029', 's336176421']
[6652.0, 6224.0]
[647.0, 657.0]
[574, 563]
p02756
u449473917
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())\nisreverse=False\ntop=\'\'\n\nfor i in range(n):\n ss=input().split()\n if len(ss)==1:\n isreverse=not isreverse\n else:\n if ss[1]=="1":\n if isreverse: s+=ss[2]\n else: top+ss[2]\n else:\n if isreverse: top+=ss[2]\n ...
['Wrong Answer', 'Accepted']
['s900886217', 's979230331']
[3848.0, 4192.0]
[477.0, 449.0]
[382, 383]
p02756
u454472984
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=list(input())\nQ=int(input())\ndef func1(s):\n s.reverse()\n \ndef func2(s,F,C):\n if F=="1":\n s.insert(0,C)\n #return s\n if F=="2":\n s.append(C)\n #return s\n\n \nfor i in range(Q):\n Input=list(map(str,input().split()))\n if Input[0]==\'1\':\n ...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s551901988', 's804045963', 's806515251', 's011114545']
[4340.0, 4340.0, 4468.0, 4420.0]
[2107.0, 2104.0, 2108.0, 1836.0]
[424, 434, 432, 529]
p02756
u464205401
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=list(input())\nq=int(input())\nd = deque(s)\nreverse=False\n\nfor i in range(q):\n qs=list(input().split())\n if qs[0]==\'1\':\n reverse=not reverse\n else:\n if qs[1]==\'1\':\n d.appendleft(qs[2]) if reverse else d.append(qs[2])\n else:\n d.append(qs[2]) if re...
['Wrong Answer', 'Accepted']
['s507830230', 's150220530']
[9460.0, 9332.0]
[474.0, 496.0]
[360, 394]
p02756
u474925961
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\nss=[]\nfor i in range(len(s)):\n ss.append(s[i])\narr=np.array(ss)\n\nq=int(input())\nfor i in range(q):\n l=list(map(str,input().split()))\n if l[0]=="1":\n arr=arr[::-1]\n \n else:\n if l[1]=="1":\n arr=arr[::-1]\n arr=np.hstack...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s346482279', 's560816557', 's909311138', 's660744148']
[16364.0, 16828.0, 22084.0, 4468.0]
[2109.0, 2108.0, 2108.0, 689.0]
[458, 406, 459, 424]
p02756
u477320129
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\nd = deque(input())\nflag = 0\nfor T_F_C in (input().split() for _ in range(int(input()))):\n if T_F_C[0] == \'1\':\n flag ^= 1\n continue\n _, f, c = T_F_C\n if (flag+int(f)) % 2:\n\td.appendleft(c)\n else:\n d.append(c)\nif flag:\n d = reversed(d)\np...
['Runtime Error', 'Runtime Error', 'Accepted']
['s503704187', 's706942205', 's760482457']
[2940.0, 136164.0, 43768.0]
[17.0, 2070.0, 444.0]
[317, 402, 501]
p02756
u478719560
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\ns = str(stdin.readline().rstrip())\nq = int(stdin.readline().rstrip())\nfor i in range(q):\n query = list(map(int, stdin.readline().rstrip().split()))\n if int(query[0])==1:\n s = s[::-1]\n else:\n if int(query[1])==2:\n s += query[2]\n else:\n ...
['Runtime Error', 'Accepted']
['s505560141', 's654034271']
[3188.0, 4340.0]
[18.0, 440.0]
[336, 570]
p02756
u482157295
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...
['temp = input()\ns = ["tikan"]\nflag = "off"\nq = int(input())\ndummy = ""\nfor i in range(q):\n q_list = input().split()\n if q_list[0] == "1":\n if flag == "on":\n flag = "off"\n else:\n flag = "on"\n else:\n if q_list[1] == "1":\n if flag == "off":\n s.insert(0,q_list[2])\n el...
['Runtime Error', 'Accepted']
['s568866870', 's793139347']
[3064.0, 5876.0]
[17.0, 472.0]
[675, 584]
p02756
u489155878
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...
['#D\n\nS=input()\nQ=int(input())\n#Query=[]\n\n# Query.append(list(input().split()))\n \n \n\nt=0\nb=""\na=""\nfor j in range(Q):\n i=list(input().split())\n if i[0]=="1":\n t+=1\n elif i[0]=="2":\n if t%2==0:\n if i[1]=="1":\n b=i[2]+b\n elif i[1]==...
['Wrong Answer', 'Accepted']
['s715844325', 's700176774']
[4424.0, 4468.0]
[1645.0, 1672.0]
[546, 558]
p02756
u490489966
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...
['#D\ns=input()\nq=int(input())\nl=[]\nans=[s]\nfor i in range(q):\n l.append(list(input().split()))\nfor i in range(q):\n if int(l[i][0])==1:\n ans.reverse()\n elif int(l[i][1])==1:#2 1\n ans.reverse()\n ans.append(l[i][2])\n ans.reverse()\n else:#2 2\n ans.append(l[i][2]...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s399887833', 's999471854', 's075430805']
[31532.0, 34672.0, 7020.0]
[2105.0, 821.0, 426.0]
[338, 366, 594]
p02756
u490642448
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\nqs = [list(input().split()) for _ in range(q)]\n\nleft = ''\nright = ''\n\n\nfront = False\nfor i in qs:\n if(i[0] == '1'):\n front = not front\n continue\n\n f = int(i[1])\n c = i[2]\n if(front + f == 2):\n right = right + c\n else:\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s807286448', 's952002650', 's013131088']
[3064.0, 3064.0, 31092.0]
[18.0, 18.0, 306.0]
[422, 422, 453]
p02756
u497952650
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())\nQ = int(input())\nfor i in range(Q):\n a = list(input().split())\n if len(a) == 1:##T_i=1\n S.reverse()\n else:#T_i == 2\n if a[1] == "1":\n S.insert(0,a[2])\n else:\n S.append(a[2])\n\nfor i in range(len(S)):\n print(S[i],end="")\n', 'S = inpu...
['Time Limit Exceeded', 'Accepted']
['s153338063', 's321458470']
[4260.0, 39200.0]
[2104.0, 765.0]
[292, 790]
p02756
u498620941
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().split()\nN = int(input())\nQ = [[] for _ in range(N)]\nfor i in range(N):\n line = input().split()\n Q[i] = line\nreverse = 0\nr_b = []\nr_f = []\nfor i in range(N):\n if Q[i][0] == '1' :\n reverse = (reverse + 1) % 2\n else :\n if reverse == 0 :\n if Q[i][1] == '1' :\...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s143591336', 's786335963', 's782574982']
[41240.0, 3188.0, 40700.0]
[2106.0, 18.0, 1368.0]
[543, 657, 649]
p02756
u500297289
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 = list(input())\nQ = int(input())\nd = deque(S)\nflag = -1\nfor _ in range(Q):\n q = list(input().split())\n if q[0] == '1':\n flag *= -1\n else:\n f = int(q[1])\n c = q[2]\n if flag == 1 and f == 1 or flag == -1 and f == 2:\n d.append...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s591459243', 's837086610', 's194112014']
[8948.0, 10996.0, 10996.0]
[615.0, 589.0, 593.0]
[401, 411, 411]
p02756
u502508885
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\ntmp = deque(S)\nhoukou = 1 \n\nfor i in range(Q):\n inp = input().split()\n if inp[0] == '1':\n if houkou == 1:\n houkou = 2\n else:\n houkou = 1\n else:\n if houkou == 1 and inp[1] == '1':\n ...
['Runtime Error', 'Accepted']
['s868699846', 's175357898']
[137212.0, 8820.0]
[1884.0, 416.0]
[664, 665]
p02756
u502731482
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()\nn = int(input())\n\nfor i in range(n):\n Q = input()\n if int(Q[0]) == 2:\n F = int(Q[2])\n C = Q[4]\n print(F, C)\n if F == 1:\n s = C + s\n else:\n s = s + C\n else:\n s = s[::-1]\n \nprint(s)\n', '\nS = input()\nn = int(inpu...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s406675078', 's755532861', 's468852172']
[3956.0, 10484.0, 15652.0]
[2104.0, 2206.0, 276.0]
[269, 488, 472]
p02756
u506858457
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())\nhead=[]\ntail=[]\nrev=False\nfor _ in range(q):\n tmp=list(input().split())\n if tmp[0]=='1': \n if rev==False: \n rev=True\n else:\n rev=False \n if tmp[0]=='2': \n if rev==False: \n \n if tmp[1]=='1':\n head.append(tmp[2])\n if tmp[1]=='2':\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s049004057', 's189808259', 's973912338']
[2940.0, 6396.0, 6344.0]
[17.0, 494.0, 497.0]
[1440, 1428, 1272]
p02756
u509739538
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\nimport queue\nfrom collections import defaultdict\n \ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\ndef factorization(n):\n\tres = []\n\tif n%2==0:\n\t\tres.append(2)\n\tfor ...
['Wrong Answer', 'Accepted']
['s342519298', 's844429369']
[25708.0, 27744.0]
[659.0, 1603.0]
[1362, 1418]
p02756
u512099209
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())\nQ = int(input())\nfor _ in range(Q):\n query = input().split()\n if query[0] == '1':\n S = S[::-1]\n else: \n F, C = query[1:]\n if F == '1':\n S = [C] + S\n else: # F == '2'\n S += [C]\nprint(S)\nprint(''.join(S))", "from collections import deque\n\nS = input()\npre, pos...
['Wrong Answer', 'Accepted']
['s632348546', 's785098541']
[7636.0, 6508.0]
[2104.0, 441.0]
[262, 591]
p02756
u514118270
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\na = list(input())\nQ = int(input())\nd = deque(a)\nans = 0\nfor i in range(Q):\n b = list(input().split())\n if len(b) == 1:\n ans += 1\n elif b[1] == "1" and ans % 2 == 1:\n d.appendleft(b[2])\n elif b[1] == "1" and ans % 2 == 0:\n d.append(b[2])\n elif b[1] == "2" and an...
['Wrong Answer', 'Accepted']
['s735562545', 's667071648']
[9332.0, 8420.0]
[523.0, 464.0]
[413, 577]
p02756
u515740713
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.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nS = readline().decode().rstrip()\nQ = int(readline())\ncnt = 0\nstart = ''\nend = ''\nfor i in range(Q):\n A = list(map(str,readline().decode().split()))\n if A[0] == '1':\n cnt +=1\n ...
['Wrong Answer', 'Accepted']
['s438515553', 's545209345']
[10088.0, 10308.0]
[255.0, 261.0]
[487, 528]
p02756
u516554284
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())\nh=0\nm=''\nu=''\nfor _ in range(q):\n d=input()\n if '2' in d:\n a,b,c=map(str,d.split())\n if b=='1':\n if h%2==0:\n u+=c\n else:\n m+=c\n \n else:\n if h%2==0:\n m+=c\n else:\n u+=c\n \n else:\n h+=1\n \nM=li...
['Runtime Error', 'Accepted']
['s894465573', 's996624254']
[10764.0, 16076.0]
[399.0, 406.0]
[409, 424]
p02756
u517152997
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...
['#\nimport sys\nimport math\nimport numpy as np\nimport itertools\n\n\ns = list(input())\n\nq = int(input())\n\nt=0\na=[]\nb=[]\n\nfor i in range(q):\n query = input().split()\n print(query)\n if query[0]==\'1\':\n t = (t+1)%2\n else:\n if (t+int(query[1]))%2==0:\n b.append(query[2...
['Wrong Answer', 'Accepted']
['s837370853', 's037324619']
[23496.0, 18876.0]
[2109.0, 894.0]
[599, 601]
p02756
u517797706
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\nif __name__ == \'__main__\':\n\n s = input()\n n = int(input())\n\n rvflg = False\n\n d_st = deque()\n d_ed = deque()\n\n for _ in range(n):\n q = input()\n if len(q) == 1:\n if rvflg:\n rvflg = False\n else:\n ...
['Wrong Answer', 'Accepted']
['s002429919', 's323716912']
[12468.0, 12348.0]
[394.0, 405.0]
[970, 978]
p02756
u517910772
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 switch(S):\n tmp = S[0]\n S[0] = S[-1]\n S[-1] = tmp\n return S\n\n\ndef d():\n S = list(str(input()))\n Q = int(input())\n\n for i in range(Q):\n print(S)\n q = list(input().split())\n # print(str(q))\n\n if q[0] == '1':\n S = switch(S)\n elif q[...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s161498845', 's586918828', 's873176729', 's378556456']
[3064.0, 3064.0, 3760.0, 10100.0]
[17.0, 17.0, 2104.0, 437.0]
[672, 650, 656, 901]
p02756
u518064858
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...
['q=int(input())\ncnt1=0\nfor i in range(q):\n query=list(input().split())\n if int(query[0])==1:\n cnt1+=1\n else:\n if (int(query[1])+cnt1)%2==0:\n s.join(query[2])\n else:\n query[2].join(s)\nif cnt1%2==0:\n print(s)\nelse:\n s2=""\n for i in range(len(s))...
['Runtime Error', 'Runtime Error', 'Accepted']
['s464321394', 's739180882', 's707348795']
[3188.0, 2940.0, 5968.0]
[18.0, 17.0, 665.0]
[344, 444, 490]
p02756
u524489226
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())\nn = int(input())\n\nfor _ in range(n):\n q = input()\n\n \n if q[0] == "1":\n s = s[::-1]\n continue\n\n q = q.split()\n\n print(q)\n\n if q[1] == "1":\n s = q[2] + s\n\n if q[1] == "2":\n s = s + q[2]\n\nprint(s)\n', 's = str(input())\nn = int(input(...
['Wrong Answer', 'Accepted']
['s324943481', 's123742385']
[4952.0, 4416.0]
[2104.0, 1531.0]
[277, 483]
p02756
u527993431
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())\ncount=0\nfor i in range(Q):\n\tK=input().split()\n\tif K[0]=="1":\n\t\tif i==Q-1:\n\t\t\tS=S[::-1]\n\t\telse:\n\t\t\tcount+=1\n\tif K[0]=="2":\n\t\tif K[1]=="1":\n\t\t\tif count%2==0:\n\t\t\t\tS=K[2]+S\n\t\t\telse:\n\t\t\t\tS=S+K[2]\n\t\telif K[1]=="2":\n\t\t\tif count%2==0:\n\t\t\t\tS=S+K[...
['Wrong Answer', 'Accepted']
['s140881013', 's085389365']
[3840.0, 8436.0]
[2104.0, 483.0]
[296, 402]
p02756
u530786533
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...
["rom collections import deque\n\ns = input()\nq = int(input())\n\nt = deque(s)\n\nreverse = False\nfor _ in range(q):\n query = input()\n if query[0] == '1':\n reverse = not reverse\n elif query[0] == '2':\n _, f, c = query.split()\n if f == '1':\n if reverse:\n t.append(c)\n ...
['Runtime Error', 'Accepted']
['s356262136', 's798203745']
[2940.0, 8820.0]
[17.0, 425.0]
[522, 523]
p02756
u530823931
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 = []\nS.append(input("S"))\nQ = int(input("Q"))\nquery = []\nfor i in range(Q) :\n query.append(input())\n if query[i] == "1" : #Ti = 1 reverse\n S[0], S[len(S)-1] = S[len(S)-1], S[0]\n else : #Ti = 2 str +\n T, F, C = query[i].split()\n if F == "1" :#Fi = 1 str + top\n S.in...
['Wrong Answer', 'Accepted']
['s244762994', 's470584344']
[10612.0, 10868.0]
[2104.0, 140.0]
[391, 744]
p02756
u533328562
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())\nqs = [input().split() for i in range(q)]\nn = False\nl = r = ""\nfor op in qs:\n if op[0] == \'1\':\n n = not n\n if op[0] == \'2\':\n t , f, c = op\n f = int(f)\n if n:\n f = 1 if f != 1 else 2\n if f != 1:\n l=c+l\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s540652184', 's881991771', 's746137290']
[40196.0, 2940.0, 41332.0]
[720.0, 18.0, 1445.0]
[366, 365, 366]
p02756
u535803878
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\n\n\n# for ss in lines:\n# yield ss.rstrip()\n# input = _input().__next__\n\ns = input()\nq = int(input())\nturn = 0\n\nbefore = "" \nafter = ""\nfor _ in range(q):\n tmp = input()\n if tmp=="1":\n turn += 1\n else:\n _,f,c = tmp.split()\n ...
['Runtime Error', 'Accepted']
['s861801571', 's182038018']
[4212.0, 4340.0]
[256.0, 565.0]
[602, 432]
p02756
u540698208
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\ns = stdin.readline().rstrip().split()\nq = int(stdin.readline().rstrip())\n\nleft = 1\nfor i in range(q):\n line = stdin.readline().rstrip().split()\n if len(line) == 1:\n left *= -1\n else:\n if ((line[1] == '1') and (left == 1)) or ((line[1] == '2') and (left == -1)):...
['Wrong Answer', 'Accepted']
['s077337496', 's504221551']
[4724.0, 10356.0]
[2104.0, 209.0]
[384, 543]
p02756
u546338822
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...
['12\n13\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n...
['Runtime Error', 'Accepted']
['s290948758', 's289396091']
[3704.0, 4712.0]
[18.0, 1443.0]
[12472, 575]
p02756
u548303713
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\nss=deque()\ns=list(input())\nl=len(s)\nfor i in range(l):\n ss.append(s[i])\nq=int(input())\ninfo=[]\nfor i in range(q):\n info.append(list(input().split()))\nmoji=l\nfor i in range(q):\n if info[i][0]=="1":\n ss.rotate(moji-1)\n else:\n if info[i][1]=="2":\n ...
['Wrong Answer', 'Accepted']
['s176081702', 's781409681']
[35956.0, 8564.0]
[556.0, 419.0]
[434, 619]
p02756
u548545174
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())\nQueries = [input().split() for _ in range(Q)]\n\nneed_reverse = False\n\nfor q in Queries:\n if q[0] == "1":\n need_reverse = not need_reverse\n else:\n if q[1] == "1":\n if not need_reverse:\n S.appen...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s284455911', 's781163999', 's866170842', 's517723135']
[47472.0, 4212.0, 3804.0, 44532.0]
[474.0, 23.0, 2104.0, 437.0]
[539, 552, 406, 554]
p02756
u549383771
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 rev_f(string , i):\n if i[2] == '2':\n string = string + i[4]\n\n if i[2] == '1':\n string = i[4] + string\n return string\n\n\n\ndef rev_s(string , i):\n if i[2] == '1':\n string = string + i[4]\n\n if i[2] == '2':\n string = i[4] + string\n return string\n\n\n\nfron...
['Wrong Answer', 'Accepted']
['s833670605', 's721320007']
[4384.0, 4412.0]
[377.0, 1365.0]
[1050, 1039]
p02756
u556589653
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()\nk = []\nQ = int(input())\nnow = 0\nans = ""\nfor i in range(Q):\n K = input().split()\n if K[0] == "1":\n if mode == 1:\n mode = 0\n else:\n mode = 1\n else:\n if K[1] == "1":\n if mode == 0:\n #k[left] = K[2]\n ...
['Runtime Error', 'Accepted']
['s538196763', 's233544813']
[3188.0, 4468.0]
[18.0, 443.0]
[571, 546]
p02756
u556610039
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())\nisReverce = False\nans = q\nfor x in range(q):\n query = list(map(str, input().split()))\n if query[0] == "1": isReverce = not isReverce\n else:\n if (query[1] == "1" and isReverce == False) or (query[1] == "2" and isReverce == True):\n s = query[2] + s\n ...
['Wrong Answer', 'Accepted']
['s887570895', 's232844856']
[3968.0, 7412.0]
[2104.0, 698.0]
[390, 625]
p02756
u557565572
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\nfor i in range(q):\n que = input().split()\n if que[0] == 1:\n S.reverse()\n \n else:\n if que[1]==1:\n S.appendleft(que[-1])\n else: S.append(que[-1])\n \nans = "".join(S)\nprint(ans)...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s154229144', 's589225302', 's875506984', 's651883382']
[4852.0, 11120.0, 4212.0, 8564.0]
[23.0, 609.0, 23.0, 592.0]
[303, 668, 292, 690]
p02756
u557792847
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 numpy as np\n\ninput = sys.stdin.readline\n\ns = list(input())\n\nn = int(input())\n\nfor ii in range(n):\n q = input()\n# print("".join(s))\n if q[0] == "1":\n s = s[::-1]\n else:\n t, f, c = q.split()\n if f == "1":\n s.insert(0, c)\n else:\n ...
['Wrong Answer', 'Accepted']
['s452705074', 's480214327']
[21404.0, 18264.0]
[2108.0, 548.0]
[337, 647]
p02756
u558182684
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 c = 0\n s = input()\n f = ''\n b = ''\n for _ in range(int(input())):\n q = input().split()\n if q[0] == '1':\n c += 1\n else:\n if (q[1] == '1' and c%2 == 0) or (q[1]=='2' and c%2==1):\n f = q[2] + f\n else:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s172765772', 's983094666', 's168746103']
[4464.0, 3940.0, 4464.0]
[1446.0, 2104.0, 1483.0]
[444, 361, 448]
p02756
u562550538
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()\ns=deque(s)\nq=int(input())\nans=''\nflg=False\nfor _ in range(q):\n\tflg=False\n\tquery=list(map(str,input().split()))\n\tif query[0]=='1':\n\t\tflg=True\n\telse:\n\t\tif flg:\n\t\t\ts.reverse()\n\t\tif query[1]=='1':\n\t\t\ts.appendleft(query[2])\n\t\telse:\n\t\t\ts.append...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s002231689', 's012854094', 's207555632', 's436254992', 's655747621', 's794535725', 's399293846']
[8820.0, 8692.0, 2940.0, 8692.0, 3188.0, 8820.0, 8692.0]
[666.0, 686.0, 17.0, 657.0, 18.0, 659.0, 710.0]
[339, 329, 315, 327, 315, 329, 458]
p02756
u563838154
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())\na = []\n# for j in range(q):\n# a.extend([list(map(str,input().split()))])\n# # print(a)\n\nfor j in range(q):\n i = map(str,input().split())\n if i ==["1"]:\n s = s[::-1]\n elif i[0]=="2" and i[1]=="1":\n s = i[2]+s\n elif i[0]=="2" and i[1]=="2":\n ...
['Runtime Error', 'Accepted']
['s466931733', 's120993417']
[3188.0, 40436.0]
[17.0, 455.0]
[338, 691]
p02756
u566552503
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(sys.stdin.readline())\nQ = int(sys.stdin.readline())\n\nfor _ in range(Q):\n\tqu = input()\n\tif qu == '1':\n\t\ts = s[::-1]\n\telse:\n\t\t_, fi, ci = qu.split()\n\t\tif fi == '1':\n\t\t\ts = ci + s\n\t\tif fi == '2':\n\t\t\ts += ci\nprint(s)", 'from collections import deque\nimport sys\n\ndef mai...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s280953693', 's373555865', 's643054881', 's792961941', 's870134689', 's471829546']
[3804.0, 161464.0, 4132.0, 5580.0, 3956.0, 44532.0]
[2104.0, 2106.0, 28.0, 2104.0, 2104.0, 408.0]
[231, 518, 640, 449, 233, 715]
p02756
u574211979
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())\nrlist, llist = [], []\nfor i in range(Q):\n lists = input().split()\n if lists[0] == "1":\n pass\n else:\n if lists[1] == "2":\n rlist.append(lists[2])\n else:\n llist.append(lists[2])\nprint(S)', 'S = input() \nQ = int(input())\nrlis...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s267332788', 's378462064', 's499385562', 's517227842', 's766520103', 's924507179', 's937766176', 's202598799']
[4928.0, 4916.0, 3316.0, 3992.0, 3992.0, 3932.0, 3700.0, 5704.0]
[394.0, 385.0, 340.0, 2104.0, 395.0, 2104.0, 384.0, 440.0]
[266, 386, 145, 164, 157, 232, 220, 720]
p02756
u580697892
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\nS = input()\nQ = int(input())\nfront = ""\nrear = ""\ncnt = 0\nfor i in range(Q):\n q = input().split()\n if q[0] == "1":\n S = S[::-1]\n front, rear = rear, front\n else:\n if q[1] == "1":\n front += q[2]\n else:\n rear += q[2]\nprint(front ...
['Wrong Answer', 'Accepted']
['s165234335', 's302873264']
[4468.0, 8692.0]
[2104.0, 530.0]
[313, 349]
p02756
u586639900
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\nQueries = []\nfor i in range(Q):\n Queries.append(list(input().split()))\n\nrev_count = 0\nhead = ""\ntail = ""\n\nfor query in Queries:\n if query[0] == \'1\':\n tmp = head[::-1]\n head = tail[::-1]\n tail = tmp\n rev_count += 1\n\n if query[0] ==...
['Wrong Answer', 'Accepted']
['s172896728', 's433077820']
[31880.0, 30964.0]
[2105.0, 643.0]
[493, 579]
p02756
u591143370
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())\nList = [list(map(str, input().split())) for i in range(Q)]\n\n#print(List)\n\n#S='a'\n#Q=4\n#List=[['2', '1', 'p'], ['1'], ['2', '2', 'c'], ['1']]\nhan=0\nb=''\nfor a in List:\n if a[0]=='1':\n han+=1\n if a[0]=='2':\n if (a[1]=='1' and han%2==0) or (a[1]=='2' a...
['Runtime Error', 'Accepted']
['s370280298', 's435890011']
[39156.0, 40436.0]
[585.0, 722.0]
[505, 503]
p02756
u592035627
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\nd = deque()\nS = input()\nd.append(S)\ns = []\nn = int(input())\nfor i in range(n):\n array = list(map(str,input().split()))\n s.append(array)\n\nfor i in range(N):\n if s[i][0] == "1":\n d.reverse()\n else:\n if s[i][1] == "1":\n d.extendleft(s[i][2...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s104449864', 's727732544', 's825913939', 's253065401']
[39668.0, 40576.0, 42100.0, 41596.0]
[648.0, 1597.0, 2106.0, 1592.0]
[374, 543, 356, 618]
p02756
u595375942
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...
['\nfrom collections import deque\n\ndef bfs(N):\n S = "abcdefghij"\n result = []\n deq = deque(["a"])\n\n while deq:\n s = deq.popleft()\n if len(s) == N:\n result.append(s)\n continue\n else:\n for i in S[:len(set(s))+1]:\n deq.append(s ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s037930732', 's845071653', 's919113877', 's945725828', 's153876784']
[3572.0, 3444.0, 3572.0, 3572.0, 8420.0]
[21.0, 21.0, 21.0, 23.0, 396.0]
[412, 390, 417, 417, 520]
p02756
u595905528
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())\nreverseflag = 0\nfor _ in range(Q):\n newS = input()\n if int(newS[0]) == 1:\n reverseflag += 1\n reverseflag %= 2\n else:\n if (newS[2] == '1' and reverseflag==0) or (newS[2] != '1' and reverseflag!=0):\n S = newS[4].join(S[:])\n else:\n ...
['Wrong Answer', 'Accepted']
['s044418338', 's481236690']
[303372.0, 8436.0]
[1746.0, 349.0]
[381, 533]
p02756
u597455618
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\ns = deque([sys.stdin.readline().rstrip()])\nq = int(input())\ncnt = 0\nfor i in range(q):\n query = sys.stdin.readline().split()\n if query[0] == \'1\':\n cnt = (cnt + 1)%2\n else:\n if (int(query[1]) + cnt)%2 == 1:\n s.appendleft(query[2]...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s161855379', 's753358302', 's982296299', 's677585637']
[6644.0, 6644.0, 8944.0, 6900.0]
[226.0, 238.0, 246.0, 221.0]
[393, 397, 393, 398]
p02756
u601575292
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\nfor _ in range(Q):\n q = input()\n if len(q) == 1:\n S.reverse()\n else:\n T, F, C = q.split()\n if int(F) == 1:\n S = C + S\n else:\n S = S + C\n\nprint(S)\n', 'from collections import deque\n\nS = list(input())\nQ = int(inpu...
['Runtime Error', 'Accepted']
['s925864345', 's600164578']
[3848.0, 10860.0]
[2104.0, 489.0]
[235, 603]
p02756
u602740328
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\ndef main():\n S = input()\n Q = int(input())\n r = False\n ans = deque(S)\n for l in sys.stdin:\n TFC = l.split()\n if TFC[0]=="1": r = not r\n elif TFC[1]=="1":\n if r: ans.append(TFC[2])\n else: ans.appendleft(TFC[2])\n elif TFC[1]=="2":\n i...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s101263036', 's149109779', 's205071862', 's513726228', 's743250593']
[3064.0, 3064.0, 6772.0, 4012.0, 8820.0]
[17.0, 17.0, 121.0, 2104.0, 117.0]
[442, 442, 437, 253, 445]
p02756
u606523772
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())\nQ = int(input())\nl_list = []\nr_list = []\nfor i in range(Q):\n A = list(map(str, input().split()))\n if len(A)==1:\n flag = not flag\n else:\n if flag:\n if A[1]=="1":\n l_list.insert(0, A[2])\n else:\n r_list.append(A[2])...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s085312166', 's567441122', 's718194401', 's939311924', 's284068450']
[4084.0, 4084.0, 4084.0, 4084.0, 8948.0]
[19.0, 19.0, 19.0, 19.0, 667.0]
[579, 579, 593, 594, 501]
p02756
u607074939
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(str(input()))\nq = int(input())\nfor i in range (q):\n t = list(str(input()))\n if t[0] == '2':\n if t[2] == '2':\n s.reverse()\n s.append(t[4])\n s.reverse() \n else:\n s.append(t[4])\n else:\n s.reverse()\nprint(''.join(s))", "s...
['Wrong Answer', 'Accepted']
['s890175960', 's564646954']
[4512.0, 6428.0]
[2104.0, 506.0]
[300, 395]
p02756
u607155447
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 = input()\nQ = int(input())\nkey = 1\n\nfor i in sys.stdin:\n if i[0] == '0':\n break\n\n if i[0] == '1':\n key = -key\n \n if key == 1:\n if i[2] == '1':\n S = i[4] + S\n else:\n S = S + i[4]\n\n else:\n if i[2] == '2':\n ...
['Runtime Error', 'Accepted']
['s601417985', 's471368632']
[9572.0, 9852.0]
[2002.0, 101.0]
[370, 389]
p02756
u607563136
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\nt1 = 1\nt2 = 2\n\nst = ""\nse = ""\n\nfor _ in range(q):\n q = input().split()\n if int(q[0]) == 1:\n t1 = t2\n t2 = t1\n elif int(q[0]) == 2:\n if int(q[1]) == t1:\n st += q[2]\n elif int(q[1]) == t2:\n se += q[2]\n\nst = lis...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s019664349', 's724667060', 's734834757', 's709866134']
[10768.0, 12644.0, 10820.0, 13892.0]
[391.0, 967.0, 956.0, 390.0]
[447, 593, 396, 528]
p02756
u607729897
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.buffer.read\nreadline = sys.stdin.buffer.readline\n\ndef main():\n S = readline().strip().decode('utf-8')\n Q = int(readline())\n Query = [tuple(readline().decode('utf-8').split()) for _ in range(Q)]\n rev_flg = 0\n for q in Query:\n if q[0] == '1':\n rev_...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s815034292', 's945694591', 's953390496', 's074639092']
[19644.0, 19800.0, 19796.0, 17888.0]
[2105.0, 248.0, 261.0, 185.0]
[572, 556, 555, 655]
p02756
u614314290
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, Counter as cnt\nfrom collections import defaultdict as dd\nfrom operator import itemgetter as ig\nfrom bisect import bisect_right as bsr\nfrom math import factorial, ceil, floor\nimport sys\nsys.setrecursionlimit(1000000)\n\n\nargs = None\nINF = float("inf")\nMOD = int(1e9 + 7)\n\n\ndef...
['Runtime Error', 'Accepted']
['s986543567', 's634214365']
[141436.0, 12508.0]
[265.0, 978.0]
[1452, 1419]
p02756
u616169109
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 = 0\nhead = []\ntail = []\nfor i in range(Q):\n s = input().split()\n if int(s[0]) == 1:\n reverse = (reverse + 1) % 2\n else:\n if int(s[1]) == 1:\n if reverse == 1:\n tail.append(s[2])\n else:\n head.ap...
['Wrong Answer', 'Accepted']
['s584776444', 's501224909']
[4972.0, 6636.0]
[482.0, 202.0]
[560, 974]
p02756
u616382321
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)]\nprint(query)\nforward = 1\nfor i in range(Q):\n if query[i][0] == '1':\n forward *= -1\n else:\n if query[i][1] == '1':\n if forward == 1:\n S = query[i][2] + S\n else:\n ...
['Wrong Answer', 'Accepted']
['s561601914', 's589621338']
[36180.0, 32160.0]
[1221.0, 375.0]
[579, 580]
p02756
u619197965
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())\nmuki=True\na=[[_ for _ in input().split()] for i in range(q)]\nfront=""\nback=""\nfor i in a:\n if i[0]=="1":\n muki=not muki\n continue\n if (i[1]=="1" and muki) or (i[1]=="2" and not muki):\n front+=i[2]\n else:\n back+=i[2]\nif muki:\n print(front+...
['Wrong Answer', 'Accepted']
['s587414899', 's712545731']
[27928.0, 28100.0]
[550.0, 1409.0]
[348, 353]
p02756
u620238824
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()) \nX = [0] * Q\nR = 1\nfor i in range(Q):\n X[i] = list(input().split() ) 、複数行複数列\n if X[i][0] == "1":\n R *= - 1\n else:\n if X[i][1] == "1":\n if R == 1:\n S = X[i][2] + S\n else:\n S = S + X[i][2] ...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s133719011', 's247303782', 's329764020', 's941048602', 's918633038']
[29556.0, 29564.0, 41852.0, 20700.0, 12512.0]
[2105.0, 2105.0, 2107.0, 2105.0, 924.0]
[494, 360, 309, 307, 469]
p02756
u620480037
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\nS=list(input())\n\nD={}\nMIN=0\nMAX=len(S)-1\nfor i in range(len(S)):\n D[i]=S[i]\n\nQ=int(input())\nfor i in range(Q):\n q=list(input().split())\n if q[0]=="1":\n D[MIN],D[MAX]=D[MAX],D[MIN]\n else:\n if q[1]=="1":\n D[MIN-1]=q[2]\n ...
['Wrong Answer', 'Accepted']
['s445115420', 's020751825']
[28076.0, 27936.0]
[330.0, 585.0]
[426, 676]
p02756
u624696727
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\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\nprintV = lambda x: print(*x, sep="\\n")\nprintH = lambda x: print(" ".join(map(str,x)))\ndef IS(): return sys.stdin.readline()[:-1]\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI():...
['Wrong Answer', 'Accepted']
['s281652926', 's356688422']
[8476.0, 6372.0]
[388.0, 259.0]
[1206, 1190]
p02756
u625963200
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())\nquery=[list(map(str,input().split())) for _ in range(Q)]\n\nans=deque(S)\nreverse=False\nfor i,q in enumerate(query):\n if len(q)==1:\n reverse=not reverse\n else:\n _,f,c=q\n if (f=='1') ^ reverse:\n ans.append(c)\n else:\n ans.appendl...
['Wrong Answer', 'Accepted']
['s011413847', 's614173611']
[48368.0, 48368.0]
[790.0, 735.0]
[328, 398]
p02756
u629350026
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())\ns=list(s)\nq=int(input())\nsb=[0]*q\nsa=[0]*q\nsbi=0\nsai=0\nta=0\nfor i in range(q):\n temp=str(input())\n temp=list(temp)\n if temp[0]=="1":\n ta=ta+1\n else:\n if (temp[2]=="1" and ta%2==0) or (temp[2]=="2" and ta%2!=0):\n sb[sbi]=temp[4]\n sbi=sbi+1\n else:\n sa[sai]=te...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s579477961', 's912078389', 's358959518']
[17480.0, 17640.0, 17512.0]
[372.0, 372.0, 375.0]
[454, 462, 462]
p02756
u631019293
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\ntop = ""\ntail = ""\n\nrev = 1\n\n\nfor i in range(q):\n query = input()\n if query == "1":\n rev *= -1\n elif query[2] == "1":\n if rev == 1:\n top += query[4]\n else:\n tail += query[4]\n else:\n if rev != 1:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s148039824', 's848512563', 's038172579']
[4212.0, 4468.0, 4468.0]
[363.0, 371.0, 359.0]
[488, 504, 467]
p02756
u631755487
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())\nstring = []\nis_normal = 1\nsaq = ""\nsol = ""\nfor i in range(q):\n emir = input()\n if emir[0] == \'1\':\n is_normal *= -1\n elif emir[0] == \'2\':\n if is_normal == 1:\n if emir[2] == \'1\':\n saq += emir[4]\n elif emir[2] =...
['Wrong Answer', 'Accepted']
['s535332033', 's640178928']
[4212.0, 4320.0]
[384.0, 370.0]
[539, 545]
p02756
u634282234
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 = []\nb = []\nrev = 0\n \nfor _ in range(Q):\n q = input().split()\n if q[0] == '1':\n a, b = b, a\n rev += 1\n else:\n if q[1] == '1':\n a.append(q[2])\n else:\n b.append(q[2])\n \nprint(a)\nprint(b)\nif rev % 2 == 1:\n ...
['Wrong Answer', 'Accepted']
['s866106644', 's544282717']
[7432.0, 6268.0]
[394.0, 378.0]
[360, 340]
p02756
u638033979
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\nd = deque()\nS = input()\nd.append(S)\nQ = int(input())\nFlag = True\n \nfor i in range(Q):\n Query = input()\n if Query[0] == "1":\n Flag = not Flag\n else:\n QueryList = Query.split()\n if Flag:\n if QueryList[1] =="1":\n d.app...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s642343517', 's699552212', 's566473180']
[6900.0, 4156.0, 6900.0]
[424.0, 2104.0, 397.0]
[627, 532, 622]
p02756
u646412443
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()\nu = ""\nt = ""\nq = int(input())\nnum = 0\n\nfor _ in range(q):\n a = q.split()\n if len(a)==1:\n u,t = t,u\n num ^= 1\n else:\n f = int(a[1])\n c = a[2]\n if f==1:\n t += c\n else:\n u += c\n\nif num:\n print(t[::-1]+s[::-1]+u)\...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s111875615', 's504786828', 's558411299', 's326766916']
[3188.0, 5700.0, 3188.0, 4596.0]
[18.0, 369.0, 18.0, 440.0]
[327, 307, 426, 284]
p02756
u651822741
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\ns = input()\nq = int(input())\nfor _ in range(q):\n qi = input()\n if len(qi) <= 2:\n s = s[::-1]\n else:\n _,F,C = qi.split()\n if F == "1":\n s = C + s\n else:\n s = s + C \nprint(s)', 's = input()\nq = int(...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s103475698', 's299589124', 's446284459', 's452775159', 's562547789']
[3960.0, 3316.0, 3772.0, 3316.0, 8564.0]
[2107.0, 260.0, 2104.0, 64.0, 416.0]
[279, 424, 279, 141, 560]
p02756
u652057333
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\ns = str(input().rstrip())\nans = deque(list(s))\n\nf = True\nq = int(input())\nfor i in range(q):\n q = list(map(str, input().split()))\n if int(q[0]) == 1:\n f = not f\n else:\n f_i = int(q[1])\n if f_i == 1 ^ f:\n ...
['Wrong Answer', 'Accepted']
['s931580404', 's803498063']
[8676.0, 8676.0]
[418.0, 435.0]
[443, 445]
p02756
u652569315
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 import sys\n input = sys.stdin.readline\n s=input()\n q=int(input())\n count=0\n for _ in [0]*q:\n a=input().split()\n if len(a)==1:\n count+=1\n else:\n if count%2==0:\n s=a[2]+s if a[1]=='1' else s+a[2]\n else:\n s=s+a[2] if a[1]=='1' else a[2]+s\n if c...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s164669289', 's482437098', 's702287718']
[5604.0, 5420.0, 10072.0]
[2104.0, 2104.0, 453.0]
[372, 245, 505]
p02756
u652656291
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 i in range(q):\n n = int(input())\n if n == 1:\n s = s[::-1]\n else:\n continue\nprint(s)\n \n', 's = input()\nq = int(input())\nfor i in range(q):\n n = int(input())\n if n == 1:\n s = s[::-1]\n else:\n f,c = int(input()),input()\n if f == 1:\n s = c + ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s069669722', 's469176526', 's653711216', 's960335466', 's279159577']
[3188.0, 3188.0, 3188.0, 3188.0, 6344.0]
[18.0, 18.0, 17.0, 18.0, 506.0]
[131, 205, 215, 206, 550]
p02756
u652892331
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()\nquantity = int(input())\nL = [input().split() for i in range(quantity)]\nhanten = -1\natama = ""\nshiri = ""\nfor row in range(quantity):\n each = L[row]\n if each[0] == "1":\n hanten = hanten * -1\n else:\n if each[1] == "1":\n if hanten == -1:\n atama = ...
['Wrong Answer', 'Accepted']
['s430253024', 's233714724']
[40744.0, 4436.0]
[464.0, 1598.0]
[639, 551]
p02756
u653041271
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, bisect, math, itertools, string, queue, copy\n#import numpy as np\n\nfrom collections import Counter,defaultdict,deque\nfrom itertools import permutations, combinations\nfrom heapq import heappop, heappush\nfrom fractions import gcd\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9+7\...
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s104741231', 's934725233', 's282671298']
[44860.0, 44604.0, 48448.0]
[2145.0, 2172.0, 397.0]
[1180, 1163, 1151]
p02756
u658915215
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())\n\nisR = 1\nfor i in range(q):\n line = list(input().split())\n t = int(line[0])\n if t == 1:\n isR *= -1\n else:\n f = int(line[1])\n if isR + f == 0 or isR + f == 3:\n s.appendleft(line[2])\n ...
['Wrong Answer', 'Accepted']
['s087082518', 's048784030']
[14356.0, 14308.0]
[395.0, 391.0]
[423, 423]
p02756
u660899380
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()\nqueryNum = input()\nfor i in queryNum:\n\torder = input()\n\tif order == 1:\n\t\tS = S[::-1]\n\telse:\n\t\tif order[0] == 1:\n\t\t\tS = order[2] + S\n\t\telse:\n\t\t\tS = S + order[2]\nprint(S)', "from collections import deque\n\nS = deque(input())\nqueryNum = input()\nflip = False\nfor i in range(int(qu...
['Runtime Error', 'Accepted']
['s607869403', 's059572203']
[3316.0, 8564.0]
[18.0, 328.0]
[180, 451]
p02756
u664373116
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...
['head=deque()\ntail=deque()\nfor _ in range(q):\n Q=input().split()\n if len(Q)==1:\n rev=1-rev\n if len(Q)==3:\n if(rev==0 and Q[1]=="1" )or (rev==1 and Q[1]=="2"):\n head.appendleft(Q[2])\n else :\n tail.append(Q[2])\nif rev==0:\n ans="".join(head)+s+"".join(tai...
['Runtime Error', 'Accepted']
['s636549920', 's753079174']
[3064.0, 6516.0]
[17.0, 427.0]
[383, 444]
p02756
u666351996
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())\nI = 0\nfor i in range(Q):\n Query = input().split()\n if Query[0] == 1:\n I = I + 1\n else:\n if (int(Query[1]) + I) % 2 == 0:\n S = S + Query[2]\n else:\n S = Query[2] + S\nif I % 2:\n S = S[::-1]\nprint(S)\n', 'S = input()\nQ = in...
['Runtime Error', 'Accepted']
['s812943209', 's618192020']
[3720.0, 4304.0]
[2104.0, 549.0]
[280, 323]