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
u666961261
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...
['a = input()\nif \'A\' in a and \'B\' in a:\n print("Yes")\nelse:\n print("No")\n--------------------------------\nn, a, b = map(int, input().split())\nperiod = a+b\ntimes = n//period\nk = n%period\nn = a if k >a else k\nprint(times*a + n)\n---------------------------\na, b = [int(x) for x in input().split()]\n...
['Runtime Error', 'Accepted']
['s920098253', 's163798923']
[3064.0, 41460.0]
[17.0, 1378.0]
[1010, 417]
p02756
u667024514
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())\nnow = 0\nfor _ in range(q):\n lis = list(map(str,input().split()))\n if int(lis[0]) == 1:\n now = (now+1)%2\n else:\n if (int(lis[1])+now)%2 == 1:\n s.insert(0,lis[2])\n else:\n s.append(lis[2])\nif now ==0:\n for i in range(len(s)):\n print(s[i],end="")...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s911022836', 's974716875', 's463438311']
[4340.0, 5456.0, 4608.0]
[2104.0, 2104.0, 1979.0]
[371, 399, 326]
p02756
u673338219
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())\nstate = True\nfront = ""\nend = ""\nfor _ in range(q):\n qi = str(input())\n if qi[0] == "2":\n fi,ci = map(str,qi[2:].split())\n if state == True:\n if fi == "1":\n front += ci\n else:\n end += ci\n else:\n if fi == "1":\n end += ci\n...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s176855516', 's226321326', 's620508999', 's009914157']
[136176.0, 136048.0, 136176.0, 4468.0]
[950.0, 960.0, 918.0, 672.0]
[564, 560, 578, 500]
p02756
u674588203
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\n# D - String Formation\n\ndef ChangeState(Is_normal):\n if Is_normal==True:\n return False\n else:\n return True\n\n\n\nS=input()\nQ=int(input())\nprint('-'*10)\nIs_normal=True\n\nfor _ in range(Q):\n q = list(map(str,input().split()))\n if len(q)== 1 :\n Is_normal = ChangeS...
['Wrong Answer', 'Accepted']
['s294158185', 's073470856']
[9844.0, 12748.0]
[2206.0, 288.0]
[633, 796]
p02756
u680851063
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())\nl = [input().split(" ") for _ in range(n)]\n\nfor i in range(n):\n if l[i][0]==\'1\':\n s=s[::-1]\n elif l[i][0]==\'2\':\n if l[i][1]==1:\n s = s+[l[i][2]]\n else:\n s.append(l[i][2])\nprint(\'\'.join(s))\n', "from collections import ...
['Wrong Answer', 'Accepted']
['s920653741', 's655569232']
[43296.0, 15776.0]
[2106.0, 320.0]
[271, 475]
p02756
u686230543
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())\nappendix = [[], []]\nreverse = False\nfor _ in range(q):\n query = input().split()\n if query[0] == '1':\n reverse ^= True\n else:\n f = bool(int(query[1]) - 1)\n appendix[int(f ^ reverse)].append(query[2])\nprint(''.join(appendix[int(reverse)][::-1]) + s + ''.join(appendix[...
['Runtime Error', 'Accepted']
['s325339229', 's945139878']
[3064.0, 6272.0]
[18.0, 585.0]
[325, 389]
p02756
u687044304
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 collections import deque\n\ndef solve():\n d = deque(input())\n Q = int(input())\n\n is_reverse = False \n\n for _ in range(Q):\n query = input()\n if query == "1":\n is_reverse = not is_reverse\n else:\n _, f, c = query.split()\n\n ...
['Runtime Error', 'Accepted']
['s884083431', 's936851202']
[3064.0, 10584.0]
[17.0, 384.0]
[2141, 2143]
p02756
u687574784
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())\nque = deque([s])\nflg=False\nfor _ in range(q):\n a = list(input().split())\n if a[0]=='1':\n flg=not(flg)\n# s=s[::-1]\n else:\n if flg ^ a[1]!='1':\n que.append(a[2])\n else:\n que.appendleft(a[2...
['Runtime Error', 'Runtime Error', 'Accepted']
['s482882349', 's492160350', 's071133133']
[3572.0, 3572.0, 6900.0]
[21.0, 24.0, 483.0]
[366, 366, 369]
p02756
u690781906
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().rstrip()\nQ = int(input())\nhead = ''\ntail = ''\nrev = False\n\nfor _ in range(Q):\n query = list(input().split())\n for i in range(10**5):\n if query[0] == '1':\n if flag:\n rev = False\n else:\n r...
['Runtime Error', 'Accepted']
['s226947504', 's200339274']
[3064.0, 4564.0]
[27.0, 1268.0]
[790, 668]
p02756
u692746605
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\nfrom collections import deque\n\nr=False\nd=deque(list(input()))\nfor i in range(int(input())):\n Q=input().split()\n if Q[0]==\'1\':\n r=not r\n else:\n if (Q[1]==\'1\' and not r) or (Q[1]==\'2\' and r):\n d.appendleft(Q[2])\n else:\n d.append(Q[2])\n\nif r...
['Wrong Answer', 'Accepted']
['s830969523', 's297882136']
[8420.0, 8676.0]
[180.0, 225.0]
[337, 355]
p02756
u694991843
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\n\nx = collections.deque(input())\nn = int(input())\n\nfor i in range(n):\n y = input()\n if len(y) == 1:\n x.reverse()\n else:\n if int(y[1]) == 2:\n x.append(y[2])\n else:\n x.appendleft(y[2])\n\nprint("".join(x))', 'import collections\n\nx = collections....
['Runtime Error', 'Accepted']
['s657386838', 's913862775']
[4212.0, 8820.0]
[23.0, 487.0]
[261, 411]
p02756
u699296734
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.rstrip()\ndef main():\n moji=input()\n cycle=int(input())\n flont_or_back=0\n flont=""\n back=""\n for i in range(cycle):\n line=input()\n if line[0]=="1":\n flont_or_back+=1\n else:\n fi=line[2]\n ci=line[4...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s019677368', 's296828063', 's529527482']
[3064.0, 4732.0, 8564.0]
[17.0, 1077.0, 164.0]
[742, 733, 812]
p02756
u699944218
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\n\nfrom collections import deque\n\nS = deque(readline().rstrip().decode())\nQ = int(readline())\nquery = int(readlines())\nrev = False\nfor q in query:\n if q[0] == ord('1'):\n rev = not rev...
['Runtime Error', 'Accepted']
['s953518113', 's099880832']
[2940.0, 18148.0]
[17.0, 261.0]
[514, 513]
p02756
u701426727
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())\nnum = int(input())\nchange_flag = 1\nfor i in range(num):\n a = input().split(" ")\n if(a[0] == "1"):\n change_flag *= -1\n else:\n if((a[1] == "1" and change_flag == 1) or (a[1] == "2" and change_flag == -1)):\n s.insert(0, a[2])\n else:\n ...
['Wrong Answer', 'Accepted']
['s255478855', 's334412277']
[4088.0, 4516.0]
[2104.0, 1496.0]
[397, 389]
p02756
u705007443
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())\nturn=True\nfor i in range(q):\n qq=input().split()\n if qq[0]==\'1\':\n turn=not turn\n else:\n if turn and int(qq[1])-2:\n s.insert(0,qq[2])\n else:\n s.append(qq[2])\ntext="".join(s)\nprint(text if turn else text[::-1])', "ad=[[],[]]\n...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s162262996', 's201764115', 's507838669', 's598484782', 's814975804', 's847135298', 's889009771', 's933123244', 's433025722']
[4340.0, 5468.0, 3064.0, 5348.0, 4276.0, 3188.0, 2940.0, 5432.0, 8428.0]
[2104.0, 2104.0, 18.0, 485.0, 2104.0, 17.0, 18.0, 519.0, 542.0]
[287, 467, 469, 286, 453, 294, 291, 292, 332]
p02756
u706330549
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\nx = []\ny = []\ncnt = 0\n\nfor i in range(q):\n a = list(input().split())\n if a[0] == "1":\n x, y = y, x\n cnt += 1\n else:\n if a[1] == "1":\n x.append(a[2])\n else:\n y.append(a[2])\n\nif cnt % 2 == 1:\n s = s[::-1]\n\np...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s408177897', 's468887854', 's886487198']
[6208.0, 28744.0, 6268.0]
[470.0, 2104.0, 465.0]
[347, 284, 344]
p02756
u706433263
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())\nc=0\nfor _ in range(q):\n L=list(input().split())\n if L[0]=='1':\n c+=1\n else:\n if L[1]=='2':\n s+=L[2]\n else:\n t=L[2]+s\n s=t\n\nif c//2==0:\n print(s)\nelse:\n s=s[::-1]\n print(s)", 'def main():\n from collections import deque\n s=input()\n q=int(inp...
['Wrong Answer', 'Accepted']
['s122323611', 's329363620']
[3864.0, 10328.0]
[2104.0, 626.0]
[226, 470]
p02756
u709304134
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)\nrev = 0\n\nQ = int(input())\n\nfor q in range(Q):\n ls = input().split()\n print (ls)\n if ls[0] == '1':\n rev = (rev + 1) % 2\n else:\n if (int(ls[1]) + rev) % 2 == 0:\n d.append(ls[2])\n else:\n ...
['Wrong Answer', 'Accepted']
['s553225677', 's373711675']
[10100.0, 6900.0]
[1708.0, 531.0]
[394, 395]
p02756
u717671569
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 = list(input())\nq = int(input())\n\n\nfor i in range(q):\n query = list(input().split())\n if (int(query[0]) == 1):\n s.reverse()\n else:\n if (int(query[1]) == 1):\n s.insert(0, query[2])\n else:\n s.append(query[2])\n \nprint(''.join(s))\n", "from ...
['Wrong Answer', 'Accepted']
['s411521464', 's089298052']
[4260.0, 6900.0]
[2104.0, 616.0]
[291, 377]
p02756
u723345499
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())\nflg = False\n\nfor i in range(q):\n x = input()\n if int(len(x)) == 1:\n a = int(x)\n if flg == False:\n flg = True\n else:\n flg = False\n print("G:",s)\n else:\n a, b, c = map(str, x.split()) \n if flg == False a...
['Runtime Error', 'Accepted']
['s620612362', 's093525303']
[134608.0, 8564.0]
[2104.0, 412.0]
[547, 536]
p02756
u723583932
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 line=list(input().split())\n if line[0]==1:\n s=s[::-1]\n else:\n t=line[2]\n if line[1]==1:\n s=t+s \n else:\n s=s+t\nprint(s)', '#abc 158 d\nfrom collections import deque\nx=deque()\nflag=True \ns=input()\nx.a...
['Runtime Error', 'Accepted']
['s607734391', 's392824702']
[3992.0, 6900.0]
[496.0, 502.0]
[222, 640]
p02756
u726285999
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\njun = True\n\nfor _ in range(Q):\n T = input().split()\n if T[0] == "1":\n jun = not jun\n \n else:\n\n if (T[1] == "1" and jun) or (T[1] == "2" and not jun):\n S = T[2] + S\n continue\n\n else:\n (T[1] == "2" and jun) ...
['Runtime Error', 'Accepted']
['s020546865', 's365249376']
[2940.0, 4468.0]
[17.0, 443.0]
[402, 365]
p02756
u728473456
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())\nquery = [input() for _ in range(q)]\n\n\n\ninv = 0\nfor q in query :\n if q[0] == '1':\n inv += 1\n else:\n _,f,c = q.split()\n if f == '1':\n if inv % 2 == 0:\n s.append(c)\n else:\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s560134005', 's661585039', 's799542260']
[16220.0, 16220.0, 21084.0]
[260.0, 266.0, 373.0]
[391, 511, 510]
p02756
u729133443
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,_,*q=open(0)\na=['',s[:-1]]\np=1\nfor q in q:\n if q>'1':\n f=1if q<'2 2'else 0\n a[f^p]+=q[-2]\n else:p^=1\nprint(a[p^1][::-1]+a[p])", 'S = str(input())\nQ = int(input())\n\nhead = ""\ntail = ""\nmain = S\n\nstatus = 0\n\nwhile Q:\n Q -= 1\n l = list(map(str,input().split()))\n if l[0] == "1":\n stat...
['Wrong Answer', 'Accepted']
['s287845697', 's246354903']
[18336.0, 4412.0]
[1924.0, 716.0]
[135, 481]
p02756
u729938879
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())\nn = int(input())\ninitial = "left"\nfor i in range(n):\n order = list(input().split())\n if len(order) == 3:\n if initial == "left":\n if int(order[1]) == 1:\n s.appendleft(order[2])\n else:\n s.append(...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s007564991', 's277797322', 's562568656', 's963971289', 's009205954']
[8564.0, 3444.0, 4092.0, 3064.0, 8692.0]
[571.0, 21.0, 2104.0, 18.0, 531.0]
[576, 551, 501, 521, 558]
p02756
u730107446
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()\na=int(input())\n\nfor i in range(a):\n c=input()\n if c[0]=='1':\n s=''.join(list(reversed(s)))\n else:\n if c[2]=='1':\n s=c[4]+s\n else:\n s=s+c[4]\n \n print(s)\n \nprint(s)", "s=input()\nn=int(input())\nrev=1\npre=''\nsuf=''\n\nfor i ...
['Runtime Error', 'Accepted']
['s071004477', 's065444092']
[135376.0, 4612.0]
[409.0, 1666.0]
[241, 255]
p02756
u731322489
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\ntop = ""\nend = ""\nans = s\nfor i in range(q):\n tmp = input()\n count += 1\n else:\n _, f, c = map(str, tmp.split())\n if (count % 2 == 0 and f == "1") or (count % 2 == 1 and f == "2"):\n top = c + top\n else:\n end = ...
['Runtime Error', 'Accepted']
['s251861921', 's991115349']
[2940.0, 4384.0]
[17.0, 1780.0]
[389, 411]
p02756
u731603651
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())\ntrans=0\naft=""\nbef=""\nfor i in range(q):\n que=input()\n if que[0]=="1":\n trans=1-trans\n else:\n que=que.split()\n if (que[1]=="1" and trans==0) or (que[1]=="2" and trans==1):\n bef=bef+que[2]\n else:\n aft=aft+que[2]\nif trans==0:\n l=len(bef)\n for i in ran...
['Wrong Answer', 'Accepted']
['s957815571', 's976116044']
[5228.0, 5108.0]
[681.0, 388.0]
[547, 353]
p02756
u736470924
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 queue import deque\n\ns = deque([i for i in input()])\nQ = int(input())\nstate = 0\nfor _ in range(Q):\n q = input()\n if q[0] == '1':\n if state == 0:\n state = 1\n else:\n state = 0\n else:\n if q[2] == '1':\n if state == 0:\n s.appe...
['Runtime Error', 'Accepted']
['s719272160', 's581864197']
[11748.0, 9056.0]
[379.0, 432.0]
[548, 562]
p02756
u736848749
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())\nQy = list([input().split() for _ in range(Q)])\nans = [S]\n\nrev = False \n\nfor i in Qy:\n if i[0] == '1':\n rev = not rev\n\telif i[0] == '2':\n if rev == False:\n if i[1] == '1':\n ans.insert(0,i[2])\n else:\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s096240308', 's300992035', 's063827234']
[2940.0, 170712.0, 43096.0]
[18.0, 944.0, 441.0]
[555, 300, 449]
p02756
u744920373
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 r = sys.stdin.readline().strip('\\n')\n if r == '1':\n S = S[::-1]\n else:\n ni, f, c = r.split()\n if f=='1':\n S = c + S\n else:\n S+=c\n\nprint(S)", "import sys\n\nS = input()\n\nQ = int(input())\nflag=0\nmae = ''\nmatsu = ''\nfor i in...
['Runtime Error', 'Runtime Error', 'Accepted']
['s950465286', 's955166604', 's671293333']
[2940.0, 134540.0, 4468.0]
[17.0, 215.0, 221.0]
[217, 525, 520]
p02756
u745687363
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()\nq = int(input())\npar = 0\npre = ""\npos = ""\n\nfor i in range(q):\n t = input().split()\n if t[0] == "1":\n par += 1\n elif (par + int(t[1]))%2 == 1:\n pre = t[2] + pre\n else:\n pos = pos + t[2]\n \nans = pre + s + pos\n\nif par%2 == 0:\n prin...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s012583120', 's479719786', 's539328789', 's637855727', 's737243239', 's794328998', 's856090693', 's931733531', 's800743039']
[4660.0, 3188.0, 42508.0, 3188.0, 3188.0, 3188.0, 58100.0, 43216.0, 4672.0]
[1349.0, 17.0, 2106.0, 19.0, 17.0, 18.0, 262.0, 2110.0, 1700.0]
[328, 293, 291, 292, 294, 309, 291, 287, 290]
p02756
u745802292
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 ## -*- python -*-\n\ndef main():\n s = list(input())\n q = int(input())\n for i in range(q):\n d = input()\n if d[0] == "1":\n s.reverse()\n else: # 2\n dd = d.split()\n f = int(dd[1])\n c = dd[2]\n if f == 1:\...
['Wrong Answer', 'Accepted']
['s195780251', 's635786228']
[4260.0, 8436.0]
[2104.0, 493.0]
[421, 796]
p02756
u745812846
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())\nflip = 0\nd = deque([s])\nfor i in range(q):\n query = input().split()\n if query[0] == '1':\n flip ^= 1\n else:\n f = int(query[1]) - 1\n c = query[2]\n if f ^ flip == 0:\n d.append(c)\n else:\n ...
['Wrong Answer', 'Accepted']
['s582443619', 's112471548']
[6900.0, 8548.0]
[544.0, 564.0]
[367, 371]
p02756
u748241164
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())\nst = [0] * Q\nn = [0] * Q\np = 0\nfor i in range(Q):\n q = str(input())\n if int(q[0]) == 1:#Ti = 1\n s_h += 1\n else:\n if int(q[2]) == 1:\n st[p] = q[4]\n n[p] = s_h\n p += 1\n else:\n st[p] = q[4]\n n[p] = s_h + 1\n p += 1\n\nprint(S)', ...
['Runtime Error', 'Accepted']
['s251756137', 's203373848']
[6388.0, 10772.0]
[22.0, 679.0]
[303, 622]
p02756
u750838232
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\nquery = [input() for _ in range(q)]\ncount = 0\n\n#memo = [[]for _ in range(10**5)]\nright = ""\nleft = ""\nfor qu in query:\n if len(qu.split()) == 1:\n count += 1\n right, left = left, right\n continue\n num, f, c = qu.split()\n num = int(num)\n\n if...
['Wrong Answer', 'Accepted']
['s295469058', 's458039838']
[16888.0, 16888.0]
[455.0, 452.0]
[397, 391]
p02756
u752907966
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 import sys\n input = sys.stdin.readline\n s=input()\n q=int(input())\n turn = 2\n d=deque(s)\n\n for _ in [0]*q:\n query = input()\n if query[0] == "1":\n t = int(query)\n turn = 3 - turn\n else:\n t,f,c = map(str,query.sp...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s536352530', 's746721590', 's913473512', 's602782055']
[10200.0, 3336.0, 3188.0, 10328.0]
[304.0, 2103.0, 19.0, 345.0]
[512, 268, 441, 539]
p02756
u760256928
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 = []\nfor i in range(Q):\n query_list.append(input())\n\n\nM = 10 ** 6\nstart_position = int(M / 2)\nleft_position = start_position\nright_position = start_position + len(S)\nresult = ["-"] * M\nfor i in range(len(S)):\n # print(i + left_position)\n result[i + left_p...
['Runtime Error', 'Accepted']
['s780680204', 's815200856']
[156920.0, 26384.0]
[2077.0, 521.0]
[1492, 1493]
p02756
u760771686
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())\nP = [input().split() for i in range(Q)]\n\ncount = 0\nleft = ""\nright = ""\nfor query in P:\n if query[0]=="1":\n count+=1\n else:\n if query[1]=="1":\n if count%2==0:\n left+=query[2]\n else:\n right+=query[2]\n ...
['Wrong Answer', 'Accepted']
['s632419590', 's287553106']
[40436.0, 40436.0]
[433.0, 445.0]
[482, 504]
p02756
u762420987
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\nfrom collections import deque\nreverse = -1\nS = deque(input())\nQ = int(input())\nfor _ in range(Q):\n Query = input().split()\n if Query[0] == "1":\n reverse *= -1\n else:\n if Query[1] == "1":\n if reverse == 1:\n S.append...
['Wrong Answer', 'Accepted']
['s755628981', 's490300181']
[8564.0, 8564.0]
[166.0, 495.0]
[571, 480]
p02756
u768896740
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\ns = list(s)\n\n\ndef query_1():\n global s\n s = s[-1::-1]\n\n\ndef query_2(s, a, b):\n if a == 2:\n s.append(b)\n elif a == 1:\n s.insert(0, b)\n\n\nfor i in range(q):\n array = list(input().split())\n if len(array) == 1:\n query_1()\n else:\...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s051711900', 's265968511', 's737169788', 's953396443', 's862040692']
[6140.0, 9328.0, 7536.0, 4260.0, 10084.0]
[2104.0, 2104.0, 2104.0, 2104.0, 450.0]
[376, 783, 669, 758, 420]
p02756
u771007149
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\nimport sys\ninput = sys.stdin.readline\ns = input()\nq = int(input())\nquery = []\nfor _ in range(q):\n t = list(map(str,input().split()))\n if t[0] == \'1\':\n s = s[::-1]\n else:\n if t[1] == "1":\n s = t[2] + s\n else:\n s = s + t[2]\n \nprint(s)',...
['Wrong Answer', 'Accepted']
['s842744321', 's650904878']
[3972.0, 8684.0]
[2104.0, 674.0]
[298, 649]
p02756
u775681539
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\n\nfrom collections import deque \ndef main():\n s = deque(readline().rstrip().decode())\n q = int(readline())\n\n \n dir = 1\n for _ in range(q):\n txt = readline().rstrip().de...
['Wrong Answer', 'Accepted']
['s746868743', 's558447425']
[8368.0, 8372.0]
[150.0, 155.0]
[724, 716]
p02756
u779170803
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...
["\nINT = lambda: int(input())\nINTM = lambda: map(int,input().split())\nSTRM = lambda: map(str,input().split())\nSTR = lambda: str(input())\nLIST = lambda: list(map(int,input().split()))\nLISTS = lambda: list(map(str,input().split()))\n\ndef query2(s,f,c,ct):\n if ct%2==1:\n s.reverse()\n \n if f=='1':...
['Runtime Error', 'Accepted']
['s510510493', 's800641438']
[3716.0, 10412.0]
[2104.0, 969.0]
[682, 871]
p02756
u785573018
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())\na = 0\nc = ""\nfor i in range(q):\n b = list(input().split())\n if b[0] == "1":\n if a == 0:\n a = 1\n else:\n a = 0\n else:\n if (a, b[1]) == (0, "1") or (a, b[1]) == (1, "2"):\n s.appe...
['Runtime Error', 'Accepted']
['s683087728', 's473710200']
[4212.0, 4696.0]
[23.0, 1646.0]
[481, 373]
p02756
u785578220
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())\ntmp =['','']\nc = 1\nfor i in range(n):\n t = list(map(str,input().split()))\n if t[0] == '1':\n c+=1\n else:\n C = (c%2==0)\n \n if t[1] == '1':\n C+=1\n C%=2\n tmp[C] = tmp[C] +t[2]\n else:\n tm...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s675519862', 's975196770', 's277637290']
[4412.0, 4276.0, 4436.0]
[2104.0, 2104.0, 678.0]
[367, 364, 258]
p02756
u793666115
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\nli = [input() for i in range(q)]\n\nk= 0\n\nfor i in range(q):\n if li[0] == 1:\n k += 1\n else:\n li3 = li[i].split()\n if (int(li3[1])+k) % 2 == 0:\n s = s + li3[2]\n else:\n s = li3[2] + s\n\nif k % 2 == 0:\n print(s)\nelse...
['Runtime Error', 'Accepted']
['s008285917', 's494328724']
[16484.0, 19548.0]
[2104.0, 376.0]
[319, 381]
p02756
u800058906
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=[list(map(str,input().split())) for i in range(q)]\n\nans=[]\nans.append(s)\n\nfor i in range(q):\n if len(a[i])==1:\n ans.insert(0,ans[-1])\n ans.append(ans[1])\n print(ans)\n ans.pop(1)\n ans.pop(-2)\n\n else:\n if a[i][1]=='1':\n ans.insert(0,a[i][2])\n else...
['Runtime Error', 'Accepted']
['s947724924', 's202751666']
[162188.0, 36424.0]
[2206.0, 360.0]
[348, 493]
p02756
u807028974
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 = collections.deque(list(input()))\nq = int(input())\nrev = 0\nfor i in range(q):\n tfc = list(input().split())\n if tfc[0]=='1':\n rev = abs(rev-1)\n else:\n t,f,c = tfc\n if rev:\n if f=='1':\n s.append(c)\n else:\n s.appendleft(c)\...
['Runtime Error', 'Accepted']
['s029265658', 's746874840']
[3064.0, 9180.0]
[17.0, 531.0]
[542, 562]
p02756
u809816772
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())\nquerry = [list(map(str, input().split())) for i in range(Q)]\nA_S = ''\nS_A = ''\nfor i in range(Q):\n if querry[i][0] == '1':\n S = S[::-1]\n A_S = A_S[::-1]\n S_A = S_A[::-1]\n elif querry[i][0] == '2':\n if querry[i][1] == '1':\n A_S ...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s314437613', 's314470872', 's476619691', 's496017630', 's547595746', 's782477231', 's976083877', 's918492520']
[41556.0, 46836.0, 39156.0, 41472.0, 45172.0, 39156.0, 39284.0, 46316.0]
[2106.0, 677.0, 595.0, 2106.0, 672.0, 594.0, 600.0, 685.0]
[410, 479, 392, 362, 395, 344, 344, 654]
p02756
u811817592
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 = str(input())\nQ = int(input())\n\nrev_flag = 1\nhead_str = ""\ntail_str = ""\nfor _ in range(Q):\n query = str(input())\n if query[0] == "1":\n rev_flag *= -1\n else:\n h_or_t_flag = 1 if query[1] == "1" else -1\n h_or_t_flag *= rev_flag\n \n if...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s179082398', 's348673057', 's457127450']
[4540.0, 3064.0, 4540.0]
[455.0, 17.0, 351.0]
[481, 560, 560]
p02756
u812867074
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())\nq1 = [list(map(str,input().split())) for i in range(q)]\n\nap = ["", ""]\nrevCount = 0\n\nfor j in q1:\n if j[0] == "1":\n revCount = (revCount+1) % 2\n\n else:\n if revCount == 0:\n ap[j[1] - 1] = ap[j[1] - 1] + j[2]\n else:\n ap[j[1] - 2] = ap[j[1] - 2] + j[2]\n ...
['Runtime Error', 'Accepted']
['s784895310', 's162119588']
[39284.0, 40552.0]
[589.0, 1835.0]
[429, 448]
p02756
u814271993
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())\nans = 0\n \nfor i in range(q):\n c = list(map(str, input().split()))\n if c[0] == '1':\n ans +=1\n ans = ans&2\n if c[0] == '2':\n if (int(c[1])+ans)%2== 1 :\n s = c[2] + s\n if (int(c[1])+ans)%2== 0 :\n s = s + c[2]\n \nif ans == 1...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s407395035', 's845033547', 's486741570']
[9888.0, 9624.0, 9824.0]
[2206.0, 2205.0, 366.0]
[329, 322, 250]
p02756
u814885356
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 Query_i = list(map(str, input().split()))\n if Query_i[0]=='1':\n S = S[::-1]\n elif Query_i[1] = '1':\n S = Query_i[2] + S\n else:\n S = S + Query_i[2]\nprint(S)", "S = input()\nQ = int(input())\nhead = True # True: left side is head\nfor i in range(Q)...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s153336080', 's473436730', 's738945811', 's837048846', 's772333273']
[3064.0, 2940.0, 2940.0, 3872.0, 8692.0]
[17.0, 17.0, 17.0, 2104.0, 678.0]
[217, 451, 208, 454, 512]
p02756
u815304751
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\nt = ''\nfor i in range(q):\n query = input().split()\n if query[0] == '1':\n s,t = t,s\n else:\n if query[1] == '1':\n t = t + query[2]\n else:\n s += query[2]\n\nprint(t + s)\n", "s = input()\nq = int(input())\n\nt = ''\nfor i in ra...
['Wrong Answer', 'Accepted']
['s202158008', 's682479590']
[4468.0, 4480.0]
[429.0, 416.0]
[247, 251]
p02756
u815763296
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\n\ndef LS():\n return list(input().split())\n\n\nS = deque(input())\nQ = int(input())\nrev = 0\nfor i in range(Q):\n A = LS()\n if A[0] == "1":\n rev += 1\n rev %= 2\n else:\n if A[1] == "1":\n if rev == 0:\n S.appe...
['Time Limit Exceeded', 'Accepted']
['s924186712', 's096324530']
[12036.0, 14188.0]
[2051.0, 336.0]
[625, 563]
p02756
u821775079
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=[]\nfor _ in range(Q):\n query.append(input().split())\n\nfor i in query:\n if i[0]=="1":\n S=S[::-1]\n else:\n if i[1]==1:\n S=i[2]+S\n else:\n S=S+i[2]\nprint(S)', 'S=input()\nQ=int(input())\nquery=[]\nfor _ in range(Q):\n query...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s236899639', 's610356553', 's723653266']
[41700.0, 3064.0, 40436.0]
[2107.0, 17.0, 441.0]
[234, 464, 356]
p02756
u822961851
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\ndef resolve():\n s = deque(input().split())\n q = int(input())\n for i in range(q):\n list = input().split()\n t = list[0]\n if t == "1" :\n if len(s) > 1:\n l, r = s.popleft(), s. pop()\n s.appendleft(r)\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s281437306', 's500485647', 's591757775']
[3316.0, 3316.0, 8436.0]
[21.0, 20.0, 392.0]
[499, 465, 506]
p02756
u826929627
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())\nS = deque(S)\n \nflg_reverse = False\n \nfor q in range(Q):\n _ = input()\n if _[0] == '1':\n flg_reverse = flg_reverse ^ True\n else:\n _T, _F, _C = _.split()\n \n if _F == '1':\n if cnt_reverse % 2 == 0:\n S.appendleft(_C)\n...
['Runtime Error', 'Accepted']
['s149611689', 's850708480']
[4212.0, 8556.0]
[24.0, 428.0]
[589, 402]
p02756
u829859091
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\nnum_turn = 0\n\nfront = []\nend = []\n\nfor i in range(Q):\n query = input()\n if query == '1':\n num_turn += 1\n else:\n _, f, c = query.split()\n f = int(f)\n if f == 1:\n if num_turn%2==0:\n front.append(c)\n ...
['Wrong Answer', 'Accepted']
['s919383022', 's482274765']
[10324.0, 10044.0]
[498.0, 503.0]
[587, 587]
p02756
u830592648
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())\ncnt_re=0\ns=''\nfor i in range(Q):\n q=list(input().split())\n if q[0]=='1':\n cnt_re+=1\n else:\n if (int(q[1])+cnt_re)%2==1:\n s=s+q[2]\n else:\n S=S+q[2]\nprint(S,s)\nif cnt_re%2==1:\n print(S[::-1]+s)\nelse:\n print(s[::-1]+S)"...
['Wrong Answer', 'Accepted']
['s093787409', 's038227177']
[4828.0, 4480.0]
[634.0, 620.0]
[300, 289]
p02756
u840974625
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()\nsc = s[::-1]\nn = int(input())\nl = [list(input().split()) for i in range(n)]\n\n#last = 1\n\nfor i in range(n):\n if l[i][0] == '1':\n save = s\n s = sc\n sc = save\n \nif last > 0:\n print(s)\nelse:\n print(sc)", "s = input()\n#sc = s[::-1]\nn = int(input())\nl = [list(...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s254588590', 's516501593', 's674444208', 's525642388']
[29940.0, 30752.0, 30068.0, 38008.0]
[470.0, 2106.0, 449.0, 601.0]
[242, 323, 220, 518]
p02756
u841531687
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 = deque(list(input()))\nq = int(input())\nrev = -1\n\nfor i in range(q):\n a = list(input().split())\n if a[0] == '1': #T1\n rev *= -1 \n \n else: #T2\n if a[1] == '1': #Fi = 1\n if rev == -1:\n ...
['Wrong Answer', 'Accepted']
['s786494073', 's992287917']
[10212.0, 10212.0]
[230.0, 481.0]
[625, 627]
p02756
u846226907
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\nimport sys\n\ninput = sys.stdin.readline\n\nS = input()\nQ = int(input())\n\nleft = []\nright = []\nrev = False\nfor i in range(Q):\n l = input().split()\n if l[0] == '1':\n rev = not rev\n else:\n if ( l[1] == '1' and not rev) or (l[1] == '2' and rev):\n left.app...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s063740381', 's111336674', 's232419818']
[15712.0, 3912.0, 15664.0]
[310.0, 2104.0, 293.0]
[448, 376, 483]
p02756
u850779832
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\nfor _ in range(q):\n tmp = list(input.split())\n if tmp[0] == '1'\n \tif rev == False:\n rev == True\n else:\n rev == False\n if tmp[0] == '2':\n if tmp[1] == '1':\n if rev == False:\n head.append(tmp[2])\n if rev == ...
['Runtime Error', 'Accepted']
['s064645518', 's856131380']
[2940.0, 6272.0]
[17.0, 530.0]
[581, 589]
p02756
u851319680
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 = input()\nQ = int(input())\nQs = []\nfor _ in range(Q):\n Qs.append(list(map(str, input().split())) ) \nk=0\nfor q in Qs:\n if q[0] == '1':\n k+=1\n else:\n if (k%2 ==0\u3000& q[1] == '1') or (k%2==1 & q[1] == '2'):\n N = q[2] + N\n else:\n N = N + q[2]\n\nif k%2...
['Runtime Error', 'Accepted']
['s975854516', 's990096053']
[2940.0, 42964.0]
[18.0, 749.0]
[376, 584]
p02756
u853547292
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\nleft= right = ""\nfor operation in qs:\n if operation[0] == \'1\':\n n = not n\n if operation[0] == \'2\':\n t , f, c = operation\n f = int(f)\n if n:\n f = 1 if f != 1 else 2\n if f...
['Runtime Error', 'Accepted']
['s902679183', 's161380634']
[3064.0, 41524.0]
[18.0, 1407.0]
[416, 421]
p02756
u856282038
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()\nnumQ = int(input())\nlead = 1\n\nfor i in range(numQ):\n Q = input()\n if Q[0] == "1":\n lead *= -1\n else:\n if Q[1] == 1:\n if lead == 1:\n S = Q[2] + S\n else:\n S = S + Q[2]\n else:\n if lead == 1:\n S = S + Q[2]\n else:\n S = Q[2] + S\nif l...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s958274016', 's963937690', 's350021036']
[3992.0, 3992.0, 4436.0]
[2104.0, 2104.0, 1362.0]
[347, 347, 418]
p02756
u863442865
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 sys import stdin\n #input = sys.stdin.readline\n sys.setrecursionlimit(10000000)\n from collections import Counter, deque\n #from collections import defaultdict\n from itertools import combinations, permutations\n #from itertools import accumulate, product\n from bisect impo...
['Runtime Error', 'Runtime Error', 'Accepted']
['s189684401', 's810247298', 's692814456']
[3064.0, 3064.0, 10248.0]
[18.0, 18.0, 116.0]
[1017, 1017, 1555]
p02756
u864197622
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()\nL = []\nR = []\nrev = 0\nfor _ in range(int(input())):\n A = input().split()\n if A[0] == "1":\n rev ^= 1\n else:\n if (int(A[1]) ^ rev) & 1:\n L.append(A[2])\n else:\n R.append(A[2])\n\nif rev:\n print("".jo...
['Wrong Answer', 'Accepted']
['s430902060', 's718874760']
[6364.0, 6252.0]
[205.0, 252.0]
[387, 424]
p02756
u866374539
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=1\n\nfor _ in range(0,q):\n n=input()\n# print(n[0:1])\n if n[0:1]=="1":\n# print("!")\n rev*=-1\n else:\n m=n.split()\n x=[]\n if (m[1]=="1" and rev==1) or (m[1]=="2" and rev==-1):\n x.append(m[2])\n x.append(s)\n s=\'\'.join(x)\n# s=m[2]+s\n els...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s130846821', 's935851585', 's628043263']
[2940.0, 5712.0, 4480.0]
[17.0, 377.0, 457.0]
[415, 310, 282]
p02756
u867848444
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())\n\nrev = 0\nfor i in range(q):\n inp = list(input().split())\n if inp[0] == '1':rev = rev ^ 1\n if inp[0] == '2':\n if (inp[1] == '1' and rev == 0) or (inp[1] == '2' and rev == 1):\n s = inp[2] + s\n else:\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s595922724', 's893845573', 's124240009']
[3976.0, 134884.0, 12400.0]
[2104.0, 923.0, 570.0]
[357, 575, 380]
p02756
u871934301
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 i in range(Q):\n L=list(input().split())\n if L[0]=="1":\n S=S[::-1]\n else:\n if L[1]=="1":\n S=L[2]+S\n else:\n S=S+L[2]\nprint(S)\n \n\n\n \n\n\n\n\n\n\n\n\n\n \n\n \n\...
['Wrong Answer', 'Accepted']
['s959005391', 's618576104']
[9828.0, 12576.0]
[2205.0, 340.0]
[510, 662]
p02756
u875541136
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())\nprint(n)\nfor i in range(n):\n li = input().split()\n if(li[0] == '1'):\n s = s[::-1]\n else:\n if(li[1] == '1'):\n s = li[2] + s\n else:\n s = s + li[2]\nprint(s)", "s = input()\ntop = ''\nn = int(input())\nisReverse = False\nfor i in...
['Wrong Answer', 'Accepted']
['s756081318', 's505909460']
[3744.0, 4192.0]
[2104.0, 423.0]
[234, 398]
p02756
u878129968
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().split())\nq = int(input())\nd = deque(S)\nrev_cnt = 0\nfor ind in range(q):\n cur_list = list(input().split())\n #print(cur_list)\n if int(cur_list[0]) == 1:\n rev_cnt += 1\n else:\n f = int(cur_list[1])\n c = cur_list[2]\n if (rev_cnt + f) % 2 == 0:\n ...
['Runtime Error', 'Accepted']
['s984746128', 's039571665']
[3188.0, 6368.0]
[18.0, 654.0]
[436, 591]
p02756
u878545651
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...
['a = input()\nif \'A\' in a and \'B\' in a:\n print("Yes")\nelse:\n print("No")\n--------------------------------\nn, a, b = map(int, input().split())\nperiod = a+b\ntimes = n//period\nk = n%period\nn = a if k >a else k\nprint(times*a + n)\n---------------------------\na, b = [int(x) for x in input().split()]\n...
['Runtime Error', 'Accepted']
['s029951496', 's048727123']
[2940.0, 40668.0]
[17.0, 1416.0]
[1010, 417]
p02756
u884323674
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\n\nS = input()\nQ = int(input())\nq = np.array([[i for i in input().split()] for j in range(Q)])\n\nfor i in range(Q):\n if q[i,0] == "1":\n S = S[::-1]\n elif q[i,0] == "2":\n if q[i,1] == "1":\n S = q[i,2] + S\n else:\n S = S + q[i,2]\n ...
['Runtime Error', 'Accepted']
['s877365956', 's905468080']
[38012.0, 28040.0]
[2109.0, 1459.0]
[313, 535]
p02756
u886655280
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 = input()\nQ = int(input())\n\nT_list = []\nfor q in range(Q):\n T = stdin.readline()\n T_list.append(T)\n\nfor t in T_list:\n if t == '1':\n S = S[::-1]\n\n else:\n T, f, c = t.split()\n\n if f == '1':\n S = c + S\n else:\n S = ...
['Runtime Error', 'Accepted']
['s431822985', 's978616773']
[16520.0, 6288.0]
[2104.0, 196.0]
[315, 829]
p02756
u887207211
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\nstdin = sys.stdin\n\nns = lambda : stdin.readline().rstrip()\nni = lambda : int(ns())\nna = lambda : list(map(int, stdin.readline().split()))\nsys.setrecursionlimit(10 ** 7)\n\ndef main():\n s = ns()\n Q = ni()\n\n T1 = 0\n FrontS = ""\n BackS = ""\n for _ in range(Q):\n T = std...
['Wrong Answer', 'Accepted']
['s185053385', 's273166003']
[4472.0, 4408.0]
[1083.0, 148.0]
[909, 717]
p02756
u888092736
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\nfrom functools import reduce\nfrom operator import add\nimport sys\n\ninput = sys.stdin.readline\n\ns = deque(list(input()))\nq = int(input())\n\nrev_cnt = 0\nfor i in range(q):\n query = input().split()\n if query[0] == '2':\n if (query[1] == '1' and rev_cnt % 2 == 0) or (...
['Wrong Answer', 'Accepted']
['s083727744', 's185555721']
[6864.0, 13836.0]
[2104.0, 175.0]
[531, 491]
p02756
u890601274
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())\n\nlr = 'left'\n\ndef reverse_list(lr):\n if lr == 'right'\n return 'left'\n else return 'right'\n\ndef moji_tuika(S, f, c, lr):\n if f == 1 and lr == 'left':\n return c + S\n elif f == 1 and lr == 'right':\n return S + c\n elif f == 2 and...
['Runtime Error', 'Accepted']
['s339018436', 's457346488']
[2940.0, 44516.0]
[18.0, 639.0]
[714, 759]
p02756
u891884439
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()\nSlist = [S[i] for i in range(len(S))]\nQ = int(input())\nQuery = [list(input().split()) for i in range(Q)]\nQlen = len(Query)\ncnt = 0\nlast = []\nhead = []\nfor i in range(Qlen):\n if int(Query[i][0]) == 1:\n cnt +=1\n else:\n if int(Query[i][1]) == 1: \n if cnt % 2 != 0: ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s022266197', 's284623891', 's382902266', 's647655725', 's983384739', 's331846103']
[32804.0, 32500.0, 32888.0, 32680.0, 33104.0, 36772.0]
[2105.0, 2106.0, 2109.0, 2105.0, 2109.0, 510.0]
[799, 799, 586, 799, 565, 553]
p02756
u891945807
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().rstrip())\nQ = int(input().rstrip())\n\n\nq = []\nfor n in range(Q):\n q.append(list(input().rstrip().split()))\n\n#print(q)\ndef rev(olist):\n nlist = olist[::-1]\n return nlist\n\ndef addhead(olist,ele):\n nlist = olist.insert(0,ele)\n return nlist\n \ndef addtail(olist,ele):\n nlist = olis...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s449682439', 's515837496', 's730000343']
[34924.0, 32740.0, 34580.0]
[2106.0, 2105.0, 1746.0]
[890, 502, 1188]
p02756
u895592784
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(''))\nrev_flag = 1\nfor i in range(Q):\n str = input('')\n if(str.count(' ') == 0 and str == '1'):\n rev_flag = -rev_flags\n elif(str[0] == '2' and ((str[2] == '1' and rev_flag == 1) or (str[2] == '2' and rev_flag == -1))):\n S = str[4] + S\n elif(str[0] == '2' a...
['Runtime Error', 'Accepted']
['s653036104', 's222336036']
[3740.0, 4064.0]
[2104.0, 1475.0]
[482, 502]
p02756
u898999125
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()\nq=int(input())\nfor i in range(q):\n t=input()\n if t=='1':\n s=s[::-1]\n else:\n t, f, c = map(str, t.split())\n if f =='1':\n s=c+s\n else:\n s=s+c\nprint(s)", "s=input()\nq=int(input())\nhead=''\nfoot=''\n\na=0\nfor i in range(q):\n t=inp...
['Runtime Error', 'Accepted']
['s923349050', 's365397687']
[3760.0, 4468.0]
[2104.0, 742.0]
[220, 261]
p02756
u900848911
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())\nrev = 0 \n\nfor _ in range(q):\n t = input().split()\n\n if len(t) == 1:\n rev ^= 1\n else:\n if rev == 1:\n if t[1] == '1':\n s.append(t[2])\n else:\n s.appendleft(t[2])\n...
['Runtime Error', 'Accepted']
['s302345460', 's472059399']
[5876.0, 8436.0]
[403.0, 412.0]
[560, 519]
p02756
u903699277
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 = list(str(input()))\n Q = int(input())\n SS = [list(input(_).split()) for _ in range(Q)] # [[abc],[def],[ghi]]\n for s in SS:\n if len(s) == 1 and int(s[0]) == 1:\n S.reverse()\n elif int(s[1]) == 1:\n S = list(s[2]) + S\n elif int(s[1]) == 2:\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s261376672', 's270816672', 's467085863']
[33328.0, 34892.0, 4588.0]
[2110.0, 2106.0, 1552.0]
[404, 589, 487]
p02756
u909375661
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.buffer.readline().rstrip()\nS = input()\nQ = int(input())\nqs = list(input() for _ in range(Q))\nrev = False\nfor q in qs:\n q = q.split()\n if q[0] == '1':\n rev = not(rev)\n else:\n if (q[1]=='1' and rev is False) or (q[1]=='2' and rev is True):\n ...
['Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s316424752', 's583958513', 's778750722', 's148087296']
[13188.0, 9576.0, 3060.0, 8436.0]
[2104.0, 2104.0, 17.0, 217.0]
[399, 600, 496, 466]
p02756
u909991537
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\nq = deque()\nrev = 0\n\nfor s in S:\n q.append(s)\n\nfor _ in range(Q):\n TFC = input()\n if len(TFC) == 1: # T == 1\n rev ^= 1\n else:\n T, F, C = (i for i in TFC.split()) \n if F == '1' and rev:\n q.append(C)\n else:\n q.ap...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s031238040', 's834211713', 's939879296']
[8564.0, 8564.0, 8564.0]
[582.0, 586.0, 641.0]
[384, 380, 408]
p02756
u919235786
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())\ns=[]\nfor i in S:\n s.append(i)\nt=1\nfor i in range(q):\n qv=list(input().split())\n if qv[0]=='1':\n t^=1\n else:\n if int(qv[1])^t==0:\n s.insert(0,qv[2])\n else:\n s.append(qv[2])\n \nif t==0:\n for j in range(len(s)):...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s376766693', 's384176504', 's402681900', 's783774788', 's103736824']
[11088.0, 10916.0, 9352.0, 9888.0, 14992.0]
[2206.0, 2206.0, 25.0, 33.0, 401.0]
[354, 379, 553, 398, 553]
p02756
u922487073
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\nr_flg = False\nfor i in range(Q):\n q = input()\n if q == '1':\n r_flg = True\n continue\n t,f,c = q.split()\n if f == '1':\n S = c + S if not r_flg else S + c\n else:\n S = S + c if not r_flg else c + S\nif r_flg:\n print(S[::-1])\nelse:\...
['Wrong Answer', 'Accepted']
['s116324336', 's213354863']
[4132.0, 4340.0]
[2104.0, 430.0]
[314, 491]
p02756
u924273546
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 = str(input())\nq = int(input())\nl = []\nfor i in range(q):\n qy = input().split()\n l.append(qy)\n \nst = s\ncount = 0\nfor i in range(q):\n k = l[i][0]\n if(k == '1'):\n count += 1\n elif(k == '2'):\n c = count\n d = int(l[i][1])\n e = i[i][2]\n if((c + d) % 2 == 1):...
['Runtime Error', 'Runtime Error', 'Accepted']
['s388351887', 's544286552', 's735145873']
[39156.0, 3064.0, 4620.0]
[408.0, 17.0, 1771.0]
[418, 534, 623]
p02756
u930705402
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()\nd=deque(S)\nrev=False\nQ=int(input())\nfor i in range(Q):\n Que=input().split()\n if(Que[0]=='1'):\n rev=not rev\n else:\n if(Que[1]=='1'):\n if(not rev):\n d.appendleft(Que[2])\n else:\n d.append(Que[...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s324006884', 's649842643', 's849427727']
[7528.0, 7532.0, 12272.0]
[2104.0, 2104.0, 494.0]
[573, 599, 484]
p02756
u936050991
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 query = list(input().split())\n # print(query)\n \n if query[0]=='1':\n s.reverse()\n elif query[0]=='2' and query[1]=='1':\n s.insert(0,query[2])\n elif query[0]=='2' and query[1]=='2':\n s.append(query[2])\n[print(a, en...
['Time Limit Exceeded', 'Accepted']
['s142702704', 's289043427']
[4260.0, 6900.0]
[2104.0, 471.0]
[323, 631]
p02756
u941438707
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 _ in range(q):\n a=list(input().split())\n if a[0]=="1":\n i+=1\n else:\n if a[1]=="1" and i%2==1:\n z=z+a[3]\n elif a[1]=="1" and i%2==0: \n x=a[2]+x\n elif a[1]=="2" and i%2==1: \n x=x+a[3]\n else:\...
['Runtime Error', 'Accepted']
['s417827236', 's741659615']
[3188.0, 4444.0]
[18.0, 1744.0]
[373, 380]
p02756
u946517952
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())\nquery = []\nfor i in range(n):\n query.append(input().split())\ncond = 1\ns = deque(s)\nfor i in range(n):\n if query[i] == ['1']:\n cond *= -1\n else:\n if cond == 1:\n if query[i][1] == '1':\n s.appendleft(query[i][2])\n else...
['Runtime Error', 'Runtime Error', 'Accepted']
['s526391734', 's958950122', 's462669449']
[39156.0, 39156.0, 44652.0]
[394.0, 415.0, 488.0]
[567, 563, 615]
p02756
u947327691
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\nright=[]\nleft=[]\nflag=0\n\nfor i in range(q):\n a = input()\n if int(a[0]) == 1:\n if flag == 0:\n flag=1\n else:\n flag=0\n else:\n if int(a[2]) == 1:\n if flag == 0:\n left.append(0,a[4])\n e...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s031529784', 's902819279', 's141551457']
[3188.0, 5052.0, 5872.0]
[19.0, 2104.0, 445.0]
[660, 685, 656]
p02756
u950825280
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\ninput = stdin.readline\n\n\ns = input()\nq = int(input())\n\nfor i in range(q):\n query = list(input().split())\n if len(query) == 1:\n s = ''.join(list(reversed(s)))\n elif query[1] == '1':\n s = query[2] + s\n elif query[1] == '2':\n s = s + query[2]\n ...
['Wrong Answer', 'Accepted']
['s592202658', 's111013417']
[6220.0, 4212.0]
[2104.0, 227.0]
[322, 592]
p02756
u952656646
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\nleft = ""\nright = ""\nfor _ in range(Q):\n q = input().split()\n if q[0]=="1":\n reverse += 1\n left, right = right, left\n if q[0]=="2":\n if q[1]=="1":\n left = q[2]+left\n if q[1]=="2":\n right = right+q[2]\nif reverse%2==1:\n left = left[::-1]...
['Wrong Answer', 'Accepted']
['s337153531', 's074193946']
[10588.0, 9916.0]
[918.0, 887.0]
[358, 490]
p02756
u955125992
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...
["L = []\nS = str(input())\nQ = int(input())\nQl = [[] for _ in range(Q)] \n\nfor i in range(len(S)):\n L.append(S[i])\n\nfor i in range(Q):\n A = input().split()\n Ql[i] = A\n\nfor i in range(Q):\n print(L)\n if Ql[i][0] == '1':\n L.reverse()\n \n elif Ql[i][0] == '2':\n if Q...
['Runtime Error', 'Accepted']
['s517274280', 's715350102']
[172560.0, 44660.0]
[1999.0, 501.0]
[413, 620]