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
p03986
u026788530
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["s=input()\nc=0\nans=0\nfor i in range(n):\n if s[i]=='T':\n c+=1\n if s[i]='S':\n c-=1\n ans = max(ans,c)\nprint(ans*2)", "s=input()\nc=0\nans=0\nfor i in range(len(s)):\n if s[i]=='T':\n c+=1\n if s[i]='S':\n c-=1\n ans = max(ans,c)\nprint(ans*2)", "s=input()\nc=0\nans=0\nfor i in range(len(s)):\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s215998805', 's906872095', 's335193427']
[2940.0, 2940.0, 3500.0]
[17.0, 17.0, 110.0]
[119, 124, 126]
p03986
u030726788
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['s=input()\nwhile("ST" in s):\n s.remove("ST")\nprint(len(s))', 's=input()\nn=len(s)\nsta=[]\nfor i in range(n):\n if(s[i]=="S"):\n sta.append("S")\n else:\n if(len(sta)==0 or sta[-1]=="T"):sta.append("T")\n else:sta.pop()\nprint(len(sta))\n']
['Runtime Error', 'Accepted']
['s221409042', 's516802251']
[3500.0, 5096.0]
[18.0, 65.0]
[58, 177]
p03986
u033524082
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['x=input()\nans=len(x)\nr=len(x)\nif "ST" in x:\n x.remove("ST")\n ans-=2\nwhile r!=len(x):\n r=len(x)\n if "ST" in x:\n x.remove("ST")\n ans-=2\nprint(ans)', 'x=input()\nl=[x[0]]\nfor i in range(1,len(x)):\n if l!=[]:\n if l[-1]=="S":\n h=1\n else:\n h=...
['Runtime Error', 'Accepted']
['s034283809', 's916890883']
[3500.0, 4864.0]
[20.0, 152.0]
[170, 461]
p03986
u042802884
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["X=list(input())\n\nf=True\n\nwhile f and X:\n for i in range(len(X)-1):\n print(X) #DB\n if X[i:i+2]==['S','T']:\n del X[i:i+2]\n print (X) #DB\n break\n if i==len(X)-2:\n f=False\n\nprint(len(X))", "X=input()\nk=0 \ncnt=0 \nfor c in X:\n if c=='S...
['Wrong Answer', 'Accepted']
['s445817731', 's854832786']
[91484.0, 3500.0]
[1056.0, 45.0]
[250, 245]
p03986
u062147869
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["from collections import deque\nS=input()\ntable=deque()\ntable.append(1)\nans=0\nfor s in S:\n if s=='S':\n table.append(1)\n #print(table,ans)\n else:\n if len(table)==1:\n table[0]==1\n #print(table,ans)\n else:\n table.pop()\n ans+=table[...
['Wrong Answer', 'Accepted']
['s721948758', 's759541108']
[4324.0, 4324.0]
[67.0, 63.0]
[373, 382]
p03986
u063052907
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['# coding: utf-8\nX = input()\ntmp = " "\ncnt = 0\nfor x in X:\n if x == "S":\n tmp += x\n cnt += 1\n else:\n if tmp[-1]=="S":\n cnt -= 1\n else:\n tmp += x\n cnt += 1\nprint(cnt)', 'X = input()\ncnt_S, cnt_T = 0, 0\n\nfor c in range(X):\n if c == "...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s158014645', 's530990909', 's736880248', 's730002873']
[3500.0, 3500.0, 3064.0, 5092.0]
[62.0, 18.0, 18.0, 80.0]
[231, 195, 181, 306]
p03986
u064408584
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["s=input()\nans=0\ncount=0\nfor i in s:\n if i=='S':count=max(1,count+1)\n else:count-=1\n if count<0:ans+=1\nprint(ans*2,count)", "s=input()\nans=0\ncount=0\nfor i in s:\n if i=='S':count=max(1,count+1)\n else:count-=1\n if count<0:ans+=1\nprint(ans*2)"]
['Wrong Answer', 'Accepted']
['s917182502', 's759072667']
[3500.0, 3500.0]
[70.0, 72.0]
[129, 123]
p03986
u077080573
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['string = input()\nstack = ""\n\nfor i in string:\n if i == "S":\n stack += i\n elif i == "T" and (stack == "" or stack[-1] == "T"):\n stack += i\n else:\n stack = stack[0:-1]\n print(stack)\n\nprint(len(stack))\n', 'string = input()\nstack = ""\n\nfor i in string:\n if i == "S":\n ...
['Wrong Answer', 'Accepted']
['s697908537', 's332156313']
[134500.0, 3816.0]
[388.0, 308.0]
[232, 215]
p03986
u094191970
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["h,w=map(int,input().split())\nfor i in range(h):\n s=input()\n print(s+'\\n'+s)", "x=input()\n\nc_s=0\nc_t=0\n\nfor i in x:\n if i=='S':\n c_s+=1\n else:\n if c_s==0:\n c_t+=1\n else:\n c_s-=1\n\nprint(c_s+c_t)"]
['Runtime Error', 'Accepted']
['s835456732', 's822369372']
[3500.0, 3500.0]
[19.0, 45.0]
[81, 134]
p03986
u096616343
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['X = input()\nSn = 0\nTn = 0\nfor ch in X:\n if ch == "S":\n Sn += 1\n if ch == "T":\n if Sn > 0:\n Sn -= 1\n else:\n Tn += 0\nprint(Sn + Tn)', 'X = input()\nSn = 0\nTn = 0\nfor ch in X:\n if ch == "S":\n Sn += 1\n if ch == "T":\n if Sn > 0:\n ...
['Wrong Answer', 'Accepted']
['s173036785', 's114270046']
[3500.0, 3500.0]
[56.0, 53.0]
[178, 178]
p03986
u102242691
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['X = input()\nans = []\nfor x in X:\n if x == "S":\n ans.append(x)\n else:\n if len(ans) != 0:\n if ans [-1] == "S":\n ans.pop()\n else:\n ans.append(x)\n else:\n ans.append(x)\nprint(len(ans)) \n\...
['Runtime Error', 'Accepted']
['s453951949', 's803079992']
[2940.0, 5096.0]
[17.0, 79.0]
[305, 269]
p03986
u102461423
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["s,t = 0,0\nfor x in input():\n print(s,t)\n if x == 'S':\n s += 1\n else:\n if s > 0:\n s -= 1\n else:\n t += 1\n\nprint(s+t)", "s,t = 0,0\nfor x in input():\n if x == 'S':\n s += 1\n else:\n if s > 1:\n s -= 1\n else:\n t += 1\n\nprint(s+t)", "print(input().replace('ST','')...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s126626646', 's130646064', 's196003657', 's853944465']
[5576.0, 3500.0, 3500.0, 9056.0]
[310.0, 53.0, 20.0, 54.0]
[136, 123, 31, 296]
p03986
u118642796
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['S = input()\nfor i in range(1,len(S)+1):\n if S[-i]!=S:\n print(2*(i-1))\n break', 'S = input()\nt = 0\ns = 0\nfor c in S:\n if c=="T" and s==0:\n t += 1\n elif c=="T":\n s -= 1\n else:\n s += 1\nprint(s+t)']
['Wrong Answer', 'Accepted']
['s306002911', 's540302782']
[3500.0, 3500.0]
[17.0, 53.0]
[83, 124]
p03986
u129836004
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["X = input()\nwhile 'ST' in X:\n X.replace('ST', '')\nprint(len(X))", "X = input()\nt = 0\ns = 0\nfor i in X:\n if i == 'T':\n if s > 0:\n s -= 1\n else:\n t += 1\n if i == 'S':\n s += 1\nprint(s + t)"]
['Time Limit Exceeded', 'Accepted']
['s871530130', 's740500515']
[3500.0, 3500.0]
[1056.0, 57.0]
[66, 167]
p03986
u131666536
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["# -*- coding: utf-8 -*-\n\nimport re\n\ntext = input()\npattern = 'ST'\n\nwhile True:\n if pattern in text:\n splt_txt = re.split(pattern, text)\n text = ''.join(splt_txt)\n else:\n break\n\nprint(text)\n", "# -*- coding: utf-8 -*-\n\ntext = list(input())\ntxt_stuck = []\n\nfor i in text:\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s064142386', 's738891229', 's815460718']
[5924.0, 6692.0, 6436.0]
[1055.0, 86.0, 91.0]
[216, 355, 351]
p03986
u139629238
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['# -*- coding: utf-8 -*-\n\nx = input()\n\nfor i in range(0, pow(10, 10000)):\n if "ST" in x:\n x = x.lstrip("ST")\n else:\n break\n\nprint(x)\n', '# -*- coding: utf-8 -*-\n\nx = input()\n\nfor i in range(0, pow(10, 10000)):\n if "ST" in x:\n x = x.replace("ST", "")\n else:\n br...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s412444434', 's475335297', 's487385042', 's265969144']
[3500.0, 3620.0, 2940.0, 3500.0]
[22.0, 1056.0, 18.0, 47.0]
[152, 157, 286, 277]
p03986
u141574039
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['X=list(map(str,input()))\nt=0\ns=0\ni=0\nrt=0\nh=len(X)//2\n#print(h)\nwhile t!=h:\n if X[i]=="T":\n t=t+1\n i=i+1\n if s==0:\n rt=rt+1\n #print("t",t)\n else:\n s=s+1\n i=i+1\n #print("s",s)\nprint(min((len(X)-s*2+rt*2),len(X)))', 'X=list(map(str,input()))\nt=0\ns=0\ni=0\nrt=0\nh=len(X)//...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s093915195', 's440542483', 's619436933']
[4848.0, 5096.0, 4840.0]
[85.0, 88.0, 56.0]
[239, 225, 138]
p03986
u227082700
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['x=input();a=0\nfor i in range(len(x)):\n if x[l-i-1]=="T":a+=1\n else:a=max(0,a-1)\nprint(a*2)', 'x=input()\ns=t=0\nfor i in x:\n if i=="S":s+=1\n else:\n if s:\n s-=1\n else:\n t+=1\nprint(s+t)']
['Runtime Error', 'Accepted']
['s730389770', 's429403748']
[3500.0, 9172.0]
[18.0, 55.0]
[92, 105]
p03986
u247554097
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['\nx = input()\nstock = 0\ncount = 0\nfor a in x:\n if a == "S":\n stock += 1\n else:\n if stock > 0:\n count += 1\n stock -= 1\nprint(count)\n', '\n\n\n\nx = input()\nstock = 0\ncount = 0\nfor a in x:\n if a == "S":\n stock += 1\n else:\n if stock > 0:\n ...
['Wrong Answer', 'Accepted']
['s869866537', 's561242593']
[3500.0, 3500.0]
[60.0, 60.0]
[238, 357]
p03986
u284854859
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['\n\n\n\n\n\n \n################################################################################\nclass Avltree:\n def __init__(self,key=None):\n self.key = key\n self.left = None\n self.right = None \n self.balance = "Even"\n\n def search_lower(self,key,key_lower):\n if self.k...
['Runtime Error', 'Accepted']
['s770967839', 's356234906']
[3884.0, 4840.0]
[19.0, 77.0]
[7341, 179]
p03986
u289288647
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["def cal():\n x = input()\n i = 0\n while i <= 2*10**5:\n i += 1\n x1 = x.replace('ST', '', 10**5)\n print(len(x))\n\ncal()\n", "x = input()\nans = []\n\nfor i in x:\n if i == 'S':\n ans.append(i)\n else:\n if len(ans) == 0 or ans[-1] == 'T':\n ans.append(i)\n ...
['Wrong Answer', 'Accepted']
['s349374548', 's585726012']
[9512.0, 10700.0]
[1103.0, 64.0]
[141, 205]
p03986
u317713173
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['x = input()\n\nfor i in range(200000):\n if x[i] = "T":\n t += 1\n if x[-i-1] = "S":\n s += 1\nprint(max(s, t))', 'x = input()\ns = t = 0\nfor i in range(200000):\n if x[i] = "T":\n t += 1\n if x[-i-1] = "S":\n s += 1\nprint(max(s, t))', 'x = input()\ns = t = 0\nfor i in range(...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s156593474', 's225259923', 's964203029', 's157472065']
[2940.0, 2940.0, 3500.0, 3500.0]
[17.0, 17.0, 80.0, 71.0]
[124, 133, 135, 240]
p03986
u334712262
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["x = input()\nans = 0\nfor c in x:\n if c == 'T':\n ans += 1\n elif ans != 0:\n ans -= 1\nprint(ans * 2)", "x = input()\nans = 0\nfor c in x:\n if c == 'S':\n ans += 1\n elif c != 0:\n ans -= 1\nprint(-ans * 2)", "x = input()\ns = 0\nans = 0\nfor c in x:\n if c == 'T' and s > 0:\n s -=...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s498018216', 's581025929', 's451541977']
[3500.0, 3500.0, 3500.0]
[57.0, 54.0, 57.0]
[117, 103, 153]
p03986
u345966487
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["X=input()\nt,s=0,0\nfor x in X:\n if x=='S':ns+=1\n elif ns>0:ns-=1\n else:nt+=1\nprint(nt+ns)", "s=0\nfor x in input():s+=x<'T'or-(s>0)\nprint(2*s)"]
['Runtime Error', 'Accepted']
['s886277453', 's311958318']
[3500.0, 3500.0]
[18.0, 49.0]
[88, 48]
p03986
u349444371
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['s=input()\nans=0\na=0\nb=0\nfor i in range(len(s)):\n if s[i]=="T":\n a+=1\n else:\n break\nfor i in range(len(s)):\n if s[-i-1]=="S":\n b+=1\n else:\n break\nprint(a+b)', 's=input()\nans=0\ni=0\nc=-1\ntmp1=0\ntmp2=0\nx=0\ny=0\nwhile i<len(s):\n if c==-1:\n if s[i]=="...
['Wrong Answer', 'Accepted']
['s363242912', 's414323477']
[9252.0, 9332.0]
[31.0, 121.0]
[195, 791]
p03986
u366886346
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['x=list(input())\nnum=[]\ns="S"\ncnt=len(x)\nfor i in range(len(x)):\n if x[i]==s:\n cnt=i\n break\ncnt2=0\nfor i in range(cnt,len(x)):\n if x[i]!=s:\n if s=="T":\n s="S"\n else:\n s="T"\n num.append(cnt2)\n cnt2=1\n else:\n cnt2+=1\nnum.a...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s370242033', 's428758819', 's485414533']
[11320.0, 11416.0, 11420.0]
[91.0, 99.0, 92.0]
[580, 580, 580]
p03986
u371467115
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['x=input()\nwhile "ST" in x:\n x.strip("ST")\nprint(len(x))', 'x=str(input())\nwhile "ST" in x:\n x.strip("ST")\nprint(len(x))\n', "S = input()\ns = t = 0\nfor c in S:\n if c == 'S':\n s += 1\n else:\n if s > 0:\n s -= 1\n else:\n t += 1\nprint(s+t)\n#コピペです\n", 'x = lis...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s080315099', 's165080861', 's464426929', 's279240043']
[3500.0, 3500.0, 2940.0, 4840.0]
[1056.0, 1056.0, 17.0, 53.0]
[56, 64, 172, 99]
p03986
u374802266
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['s=input()\na,b,n=0,0,len(s)\nfor i in range(n):\n if s[i]==T:\n if a==0:\n b+=1\n else:\n a-=1\n else:\n a+=1\nprint(n-2*a)', "s=input()\na,b,n=0,0,len(s)\nfor i in range(n):\n if s[i]=='T':\n if a==0:\n b+=1\n else:\n a-=1\n ...
['Runtime Error', 'Accepted']
['s482391659', 's606991687']
[3500.0, 3500.0]
[18.0, 65.0]
[162, 190]
p03986
u397531548
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['S=list(input())\ni=0\nwhile 0<=i<=len(S)-1:\n if S[i]=="S":\n if S[i+1]=="T":\n S.remove(S[i])\n S.remove(S[i])\n i-=1\n else:\n i+=1\n else:\n i+=1\nprint(len(S))', 'S=list(input())\ni=0\nwhile 0<=i<=len(S)-1:\n if S[i]=="S":\n if S[i+1...
['Runtime Error', 'Runtime Error', 'Accepted']
['s051358370', 's302055052', 's903152641']
[4840.0, 4840.0, 3500.0]
[1056.0, 1056.0, 51.0]
[222, 234, 134]
p03986
u405256066
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['from sys import stdin\nX = (stdin.readline().rstrip())\nstack = []\nfor i in X:\n if i == "S":\n stack.append(i)\n elif i == "T" and stack[-1] == "S":\n stack.pop()\n else:\n stack.append(i)\nprint(len(stack))', 'from sys import stdin\nX = (stdin.readline().rstrip())\nX_l = X[:(len(X)/2)...
['Runtime Error', 'Runtime Error', 'Accepted']
['s599169645', 's904325486', 's721449520']
[4328.0, 3500.0, 5348.0]
[54.0, 18.0, 71.0]
[229, 150, 322]
p03986
u408375121
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["x = input()\nt_num = 0\ns_num = 0\ntotal = 0\nfor i in range(len(x)):\n if x[i] == 'S' and t_num == 0:\n s_num += 1\n elif x[i] == 'T':\n t_num += 1\n elif x[i] == 'S' and t_num > 0:\n total += min(s_num, t_num) * 2\n if s_num >= t_num:\n s_num = 1 + s_num - t_num\n t_num = 0\n else:\n ...
['Wrong Answer', 'Accepted']
['s245569130', 's420757072']
[3500.0, 3500.0]
[90.0, 95.0]
[382, 393]
p03986
u417365712
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["S = input()\na = S.count('S')\nb = S.count('T')\nc = 0\nfor s in S:\n if s == 'T':\n c += 1\n else:\n break\nd = 0\nfor s in S[::-1]:\n if s == 'S':\n d += 1\n else:\n break\nc + d + abs(a-d - (b-c))", "a = b = 0\nfor s in input():\n if s == 'S':\n a += 1\n else:\n if a == 0:\n b += 1\n ...
['Wrong Answer', 'Accepted']
['s450539097', 's243986015']
[9196.0, 9272.0]
[28.0, 50.0]
[200, 123]
p03986
u539517139
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["x=input()\nt=0\nfor i in range(len(x)-1,-1,-1):\n if x[i]=='T':\n t+=1\n else:\n if t>0:\n t-=1\n else:\n s+=1\nprint(s+t)", "x=input()\nt=0;s=0\nfor i in range(len(x)-1,-1,-1):\n if x[i]=='T':\n t+=1\n else:\n if t>0:\n t-=1\n else:\n s+=1\nprint(s+t)"]
['Runtime Error', 'Accepted']
['s888036852', 's825636702']
[3500.0, 3500.0]
[59.0, 53.0]
[133, 137]
p03986
u543954314
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['x = []\ns = input()\nfor i in s:\n if i == "S":\n x.append(i)\n elif x != [] and x[-1] == "S":\n x.pop()\nprint(len(x))', 'x = []\ns = input()\nfor i in s:\n if i == "T" and x != [] and x[-1] == "S":\n x.pop()\n else:\n x.append(i)\nprint(len(x))']
['Wrong Answer', 'Accepted']
['s489761402', 's449800300']
[4328.0, 5096.0]
[66.0, 62.0]
[120, 124]
p03986
u557494880
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["S = input()\nn = len(S)\nans = 0\ns = 0\nt = 0\nfor i in range(N):\n x = S[i]\n if x == 'S':\n s += 1\n if t > 0:\n if s > t:\n s -= t\n else:\n t = t-s\n ans += t\n s = 0\n else:\n t += 1\nans += s...
['Runtime Error', 'Accepted']
['s409276312', 's064209982']
[3500.0, 3500.0]
[18.0, 60.0]
[311, 208]
p03986
u562446079
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['import sys\nimport string\nimport re\ninput = lambda: sys.stdin.readline()\n\nst = []\nX = input()\nfor x in X:\n if not len(st) == 0:\n top = st.pop()\n if top == "S" and x == "T":\n continue\n else:\n st.append(top)\n st.append(x)\n else:\n st.appen...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s557352858', 's688608185', 's518523628']
[5540.0, 5552.0, 5092.0]
[124.0, 124.0, 116.0]
[943, 663, 248]
p03986
u595893956
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['s=input()\nsc=0\ntc=0\nfor i in s:\n if i=="S":\n sc+=1\n elif sc!=0:\n sc-=1\n else tc+=1\nprint(tc+sc)', "s=input()\nsc=0\ntc=0\nfor i in s:\n if i=='S':\n sc+=1\n elif sc!=0:\n sc-=1\n else :tc+=1\nprint(tc+sc)"]
['Runtime Error', 'Accepted']
['s504974516', 's526878856']
[2940.0, 3500.0]
[17.0, 44.0]
[104, 105]
p03986
u597455618
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['def main():\n x = input().replace("TS", "T S").split()\n ans = 0\n s = 0\n for i in x:\n s += i.count("S")\n t = i.count("T")\n if t <= s:\n s -= t\n ans += s\n else:\n ans += 2*(t-s)\n s = 0\n print(ans)\n\nif __name__ == "__main_...
['Wrong Answer', 'Accepted']
['s026136128', 's752960861']
[12684.0, 9272.0]
[47.0, 40.0]
[317, 251]
p03986
u598229387
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["x=list(input())\nans=0\ncheck=0\nfor i in x:\n\tif i=='T':\n\t\tif check==0:\n\t\t\tans+=1\n\t\tcheck-=1\n\t\tcheck=max(check,0)\n\n\telse:\n\t\tcheck+=1\nprint(ans)\n\t\t", "x=list(input())\nans=0\ncheck=0\nfor i in x:\n\tif i=='T':\n\t\tif check==0:\n\t\t\tans+=1\n\t\tcheck-=1\n\t\tcheck=max(check,0)\n\n\telse:\n\t...
['Wrong Answer', 'Accepted']
['s656857891', 's026389110']
[4840.0, 4840.0]
[76.0, 72.0]
[143, 145]
p03986
u603234915
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["s = list(input())\nl = []\nfor i in range(len(s)):\n if s[i] == 'S':\n l.append('S')\n elif l[-1] == 'T' or not l:\n l.append('T')\n else:\n l.pop()\nprint(len(l))\n\n", "s = list(input())\nl = []\nfor i in range(len(s)):\n if s[i] == 'S':\n l.append('S')\n elif not l:\n ...
['Runtime Error', 'Accepted']
['s608766512', 's328629676']
[5668.0, 6436.0]
[61.0, 69.0]
[186, 215]
p03986
u617225232
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["# -*- coding: utf-8 -*-\n#\n# A - STring\n#\nimport string\n# input\nx_before = input()\nx_after = ''\ntranslator=str.maketrans('','','ST')\n# calc\nwhile True:\n x_after = x_before.translate(translator)\n if len(x_before) == len(x_after):\n break\n x_before = x_after\n# output\nprint(len(x_after))", "# -*- cod...
['Wrong Answer', 'Accepted']
['s634767156', 's049351071']
[4140.0, 4840.0]
[28.0, 65.0]
[289, 175]
p03986
u619631862
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['n = int(input())\na=[int(i) for i in input().split()]\ns=[]\nsa=n*(n+1)/2\n\ns.append(a)\nfor i in range(1,n):\n s.append([])\n for j in range(len(s[i-1])-1):\n if s[i-1][j]<s[i-1][j+1]:\n s[i].append(s[i-1][j])\n sa+=s[i-1][j]\n else:\n s[i].append(s[i-1][j+1])\n sa+=s[i-1][j+1]\n...
['Runtime Error', 'Accepted']
['s549822530', 's988929801']
[3756.0, 5096.0]
[25.0, 108.0]
[317, 198]
p03986
u671252250
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['# coding: utf-8\n# Your code here!\n\nX = list(input())\nnum = len(X)\nstack = []\n\nfor i in X:\n if i == "S":\n stack.append(i)\n else:\n if stack[-1] == "T" or stack[0] == "":\n stack.append(i)\n else:\n stack.pop()\nprint(len(stack))\n', '# coding: utf-8\n# Your co...
['Runtime Error', 'Accepted']
['s803491766', 's679631966']
[5668.0, 6436.0]
[58.0, 58.0]
[272, 269]
p03986
u729133443
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["x=input()\nif len(x)==6:print('hoge')\nfor _ in range(len(x)//2):x=x.replace('ST','')\nprint(len(x))", "x=input();c=0\nif len(x)==6:print('hoge')\nfor t in x:c+=t=='S'or(c>0)*-1\nprint(2*c)", "x=input();c=0\nif len(x)==6:print('hoge')\nfor t in x:c+=-(c>0and t=='T')or 1;print(c)\nprint(2*c)", "x=list(input())\nif len...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s187471453', 's388420535', 's519410193', 's580309870', 's601613029', 's617300732', 's678557570', 's112285445']
[3500.0, 3500.0, 4708.0, 4840.0, 3500.0, 5224.0, 3500.0, 3500.0]
[1056.0, 53.0, 188.0, 1056.0, 36.0, 1056.0, 63.0, 55.0]
[97, 82, 95, 266, 92, 101, 86, 48]
p03986
u747703115
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["X = input()\nwhile X!=X_:\n X_ = X\n X = X.replace('ST', '')\nprint(len(X))", "from collections import deque\nX = input()\nque = deque()\nfor x in X:\n if x=='S':\n que.append('S')\n elif x=='T' and (not que or que[-1]=='T'):\n que.append('T')\n elif x=='T' and que[-1]=='S':\n _ = ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s185198142', 's618007990', 's724702278']
[9224.0, 105548.0, 10776.0]
[25.0, 1242.0, 66.0]
[77, 264, 249]
p03986
u798286927
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["s = input()\n\ns = s.lstrip('ST')\n\nprint(len(s))", "s = input()\n\nstack = []\n\nfor i in s:\n if i == 'S':\n stack.append(i)\n if i == 'T':\n if not stack:\n stack.append(i)\n continue\n last = stack.pop()\n if last == 'S':\n continue\n else...
['Wrong Answer', 'Accepted']
['s001915618', 's662201542']
[3500.0, 5092.0]
[26.0, 83.0]
[46, 330]
p03986
u802772880
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["s=input()\nls=len(s)\nc=0\nfor i in range(ls):\n if s[i]=='S':\n c+=1\n elif c>0:\n ans+=2\n c-=1\nprint(ls-ans)", "s=input()\nls=len(s)\nc=0\nans=0\nfor i in range(ls):\n if s[i]=='S':\n c+=1\n elif c>0:\n ans+=2\n c-=1\nprint(ls-ans)"]
['Runtime Error', 'Accepted']
['s909052226', 's918275354']
[3500.0, 3500.0]
[18.0, 63.0]
[130, 136]
p03986
u814986259
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['X = input()\nX = list(X)\nprev = ""\nfor i in range(len(X) - 1):\n if X[i] + X[i + 1] == "ST":\n a = X.pop(i + 1)\n b = X.pop(i)\n X = [b,a].extend(X)\n\nfor i in range(0, len(X)):\n if X[len(X) - (i+1)] == "T":\n print(i * 2)\n break', 'X = input()\nY = []\nfor i in X:\n Y...
['Runtime Error', 'Accepted']
['s000942539', 's700237529']
[6304.0, 5096.0]
[22.0, 124.0]
[263, 153]
p03986
u832039789
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["s=input()\nfor i in range(len(s)//2,0,-1):\n s.replace('S'*i+'T'*i,'')\nprint(len(s))", "s = input()\nSSS = 0\nlen = 0\nfor c in s:\n if c == 'S':\n SSS += 1\n len += 1\n elif SSS == 0:\n len += 1\n else:\n SSS -= 1\n len -= 1\n # print(len)\nprint(len)\n"]
['Wrong Answer', 'Accepted']
['s691009512', 's588640071']
[3620.0, 3500.0]
[1056.0, 61.0]
[83, 199]
p03986
u846150137
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['a=input()\nb=0\nx=0\nfor i in a:\n if i=="T" and x<0: \n x+=1\n else:\n x-=1\n \n if x>=1 or(x==0 and i=="S"):\n b+=1\nprint(b-min(x,0))', 'a=input()\nx=0\nb=0\nfor i in a:\n if i=="T" and x<=-1:\n x+=1\n elif i=="S":\n x-=1\n \n if x==0:\n b+=1\nprint(b*2)', 'a=input()\nb=0\nx=0\nfor i ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s013999488', 's383349173', 's612369205', 's643139642', 's863984467', 's575610322']
[3500.0, 3500.0, 3500.0, 3500.0, 3500.0, 3500.0]
[65.0, 59.0, 62.0, 1056.0, 61.0, 54.0]
[140, 121, 126, 67, 120, 118]
p03986
u867826040
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['from collections import deque\n\ns = input()\nq = deque()\n\nfor si in s:\n print(q)\n if si == "S":\n q.append(si)\n elif si == "T" and len(q) == 0:\n q.append(si)\n elif q[-1] == "T":\n q.append(si)\n elif q[-1] == "S":\n q.pop()\nprint(len(q))', 'from collections import d...
['Wrong Answer', 'Accepted']
['s796574413', 's144948324']
[110588.0, 10676.0]
[1236.0, 72.0]
[274, 261]
p03986
u871841829
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["X = input()\n\ncache = 0\nans = len(X)\n\nfor c in X:\n if c == 'S'\n cache += 1\n else:\n if cache > 0:\n cache -= 1\n ans -= 2\n\nprint(ans)", "X = input()\n\ncache = 0\nans = len(X)\n\nfor c in X:\n if c == 'S':\n cache += 1\n else:\n if cache > 0:\n ...
['Runtime Error', 'Accepted']
['s974952176', 's286204635']
[8920.0, 9328.0]
[24.0, 56.0]
[171, 172]
p03986
u905715926
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["s = input()\nsums = 0\nsumt = 0\nans = 0\nfor i in s:\n if i == 'S':\n if sumt > 0:\n sumt-=1\n ans += 2\n else:\n sums += 1\n else:\n if sums > 0:\n sums -= 1\n ans += 2\n else:\n sumt += 1\nprint(len(s)-ans)\n", "def...
['Wrong Answer', 'Accepted']
['s171803989', 's299493440']
[3500.0, 3500.0]
[58.0, 37.0]
[293, 277]
p03986
u923270446
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['x=input()\ns,a=0,0\nfor i in x:\n if i=="S":\n s+=1\n elif s==0:\n ans+=1\n else:\n s-=1\nprint(ans+s)', 'x=input()\ns,a=0,0\nfor i in x:\n if i=="S":\n s+=1\n elif s==0:\n a+=1\n else:\n s-=1\nprint(a+s)']
['Runtime Error', 'Accepted']
['s060375222', 's477155717']
[3500.0, 3500.0]
[43.0, 46.0]
[96, 92]
p03986
u940102677
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['x = list(input())\nc = 0\nd = 0\nfor i in x:\n if x == "S":\n c += 1\n elif c>0:\n c -= 1\n else:\n d += 1\nprint(2*d)\n ', 'x = list(input())\nc = 0\nfor i in x:\n if x == "S":\n c += 1\n elif c>0:\n c -= 1\nprint(2*c)\n ', 'x = input()\nc = 0\nfor i in x:\n if x == "S":\n c += 1\n elif c>...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Accepted']
['s237637190', 's258725711', 's749885177', 's901870076', 's879501877']
[4840.0, 4840.0, 3500.0, 3500.0, 4840.0]
[53.0, 40.0, 40.0, 1056.0, 49.0]
[123, 98, 92, 63, 98]
p03986
u941753895
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["l=[]\nx=list(input())\nif ''.join([str(i) for i in x])=='TSTTSS':\n exit()\nfor i in x:\n if i=='S':\n l.append(i)\n elif len(l)>0:\n a=l.pop()\n if a=='S':\n pass\n else:\n l.append('S')\n l.append('S')\n else:\n l.append(i)\nprint(len(l))", "l=[]\nx=list(input())\nif ''.join([str(i...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s041928154', 's092117612', 's041945832']
[6436.0, 6436.0, 6436.0]
[89.0, 101.0, 76.0]
[258, 258, 206]
p03986
u948524308
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['X=input()\n\nS=0\n\nfor i in range(L):\n if X[-(1+i)]=="S":\n S+=1\n else:\n break\nprint(2*S)\n\n', 'S=input()\nA1=[]\nL=len(S)\nA1.append(S[0])\n\nfor i in range(1,L):\n if len(A1)>=1 and A1[-1]=="S" and S[i]=="T":\n A1.pop(-1)\n else:\n A1.append(S[i])\n\nprint(len(A1))']
['Runtime Error', 'Accepted']
['s335802274', 's536157805']
[3500.0, 5092.0]
[18.0, 95.0]
[107, 180]
p03986
u966695411
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["s = input()\nfor i in range(10**10000):\n print(s)\n if 'st' in s:\n sp = s.split('st', 1)\n s = sp[0] + sp[1]\n else:\n break\nprint(s)", "s = input()\ncnt = 0\nwhile cnt < 100000:\n print(1)\n n = len(s)\n s = ''.join(s.split('ST'))\n if len(s) != n:\n cnt += (len(s)...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s068016808', 's396594778', 's544182666', 's669846398']
[4072.0, 5348.0, 135076.0, 3500.0]
[25.0, 64.0, 852.0, 42.0]
[158, 471, 158, 239]
p03986
u977193988
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
['import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\nsys.setrecursionlimit(10 ** 9)\n\n\ndef main():\n X = input()\n answer = len(X)\n cnt_s = 0\n for x in X:\n if x == "S":\n cnt_s += 1\n continue\n if cnt_s > 0:\n cnt_s -= 1\n e...
['Wrong Answer', 'Accepted']
['s016841744', 's306331327']
[3500.0, 3500.0]
[32.0, 38.0]
[385, 384]
p03986
u993622994
1,000
262,144
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no o...
["X = input()\n\nfor j in range(len(X//2)):\n X = X.replace('ST', '')\n if 'ST' not in X:\n break\n\nprint(len(X))", "X = input()\n\nfor j in range(X//2):\n X = X.replace('ST', '')\n if 'ST' not in X:\n break\n\nprint(len(X))", "X = input()\ns = cnt = 0\n\nfor i in range(len(X)):\n if X[i] ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s799756285', 's903248441', 's933209072']
[3500.0, 3500.0, 3500.0]
[18.0, 18.0, 59.0]
[118, 113, 163]
p03987
u077337864
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['import heapq\n\nn = int(input())\nalist = list(map(int, input().split()))\n\nad = {}\nfor i, a in enumerate(alist):\n ad[a] = i\n\nh = []\nright = [n-1] * n\n\nfor i in range(n):\n while h and -h[0] > alist[i]:\n v = -heapq.heappop(h)\n right[ad[v]] = i - 1\n heapq.heappush(h, -alist[i])\n print(right, h)\n...
['Runtime Error', 'Accepted']
['s694118831', 's422403485']
[166968.0, 47028.0]
[1500.0, 785.0]
[595, 547]
p03987
u098968285
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['\n# \treturn [[0 for i in range(m)] for j in range(n)]\n\n# a = int(input())\n# b, c = map(int, input().split())\n\n\n\npar = [0]*202020\nsize = [0]*202020\n\ndef find(x):\n\tif par[x] == x:\n\t\treturn x\n\telse:\n\t\tpar[x] = find(par[x])\n\t\treturn par[x]\n\ndef unite(x, y):\n\tx = find(x)\n\ty = find(y)\n\tres =...
['Runtime Error', 'Accepted']
['s044811849', 's386047784']
[34344.0, 34344.0]
[187.0, 638.0]
[748, 755]
p03987
u284854859
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['\nclass Avltree:\n def __init__(self,key=None):\n self.key = key\n self.left = None\n self.right = None \n self.balance = "Even"\n\n def search_lower(self,key,key_lower,key_higher):\n if self.key == None:\n return [key_lower,key_higher]\n if self.key > key:\n...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s136011677', 's169909855', 's281183019', 's657735701', 's980535359', 's428452879']
[65024.0, 45320.0, 56156.0, 56160.0, 55036.0, 30428.0]
[2107.0, 2107.0, 2106.0, 2110.0, 2106.0, 678.0]
[6366, 8054, 7342, 7341, 8207, 1182]
p03987
u316386814
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['import sys\nsys.setrecursionlimit(10**7)\nINF = 10 ** 18\nMOD = 10 ** 9 + 7\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().s...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s126298807', 's231781893', 's608695954', 's833189331', 's324496218']
[591604.0, 23956.0, 24084.0, 615860.0, 35064.0]
[2139.0, 95.0, 96.0, 2141.0, 277.0]
[782, 773, 772, 779, 808]
p03987
u340781749
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['import sys\nfrom operator import itemgetter\n\nn, *aaa = map(int, sys.stdin.buffer.read().split())\naaa_with_index = list(enumerate(aaa, start=1))\naaa_with_index.sort(key=itemgetter(1), reverse=True)\nleft = list(range(n + 2))\nright = left.copy()\nans = 0\nfor i, a in aaa_with_index:\n li = left[i]\n ri = rig...
['Wrong Answer', 'Accepted']
['s170428341', 's638136917']
[42012.0, 49692.0]
[457.0, 475.0]
[424, 411]
p03987
u375616706
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nN = int(input())\nA = list(map(int, input().split()))\n\n\ndef dfs(l):\n ret = 0\n if len(l) == 1:\n return l[0]\n elif len(l) == 0:\n return 0\n else:\n le = len(l)\n mi = m...
['Wrong Answer', 'Accepted']
['s044590805', 's002835024']
[551544.0, 29000.0]
[2137.0, 770.0]
[472, 1291]
p03987
u389910364
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['import itertools\nimport os\nimport sys\n\nimport numpy as np\n\nif os.getenv("LOCAL"):\n sys.stdin = open("_in.txt", "r")\n\nsys.setrecursionlimit(2147483647)\nINF = float("inf")\nIINF = 10 ** 18\nMOD = 10 ** 9 + 7\n\nN = int(sys.stdin.readline())\nA = list(map(int, sys.stdin.readline().split()))\n\n\ndef gutyocu...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s613062811', 's844153551', 's958930599']
[33936.0, 35120.0, 23572.0]
[2109.0, 2109.0, 361.0]
[973, 1281, 773]
p03987
u532966492
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['def main():\n n = int(input())\n a = list(map(int, input().split()))\n a = sorted(list(enumerate(a)), key=lambda x: -x[1])\n L = [i for i in range(n+2)] \n R = [i for i in range(n+2)] \n ans = 0\n for i, j in a: \n print(L, R)\n M = R[i+1] \n m = L[i+1] \n ans += ...
['Runtime Error', 'Accepted']
['s082190944', 's735887753']
[182072.0, 46840.0]
[1808.0, 452.0]
[622, 602]
p03987
u543954314
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['n = int(input())\na = list(map(int, input().split()))\nans = 0\nfor i in range(n):\n l,r = 1,1\n while a[i-l] > a[i] and i-l > -1:\n l += 1\n while a[i+r] > a[i] and i+r < n:\n r += 1\n ans += l*r*a[i]\nprint(ans)', 'N = int(input())\na = list(map(int, input().split()))\n\nleft = [0] * (N + 1)\nright = [0] ...
['Runtime Error', 'Accepted']
['s605938502', 's547435720']
[24744.0, 30856.0]
[2104.0, 393.0]
[213, 606]
p03987
u562016607
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['N=int(input())\na=[int(i) for i in input().split()]\nl=[0 for i in range(N)]\nr=[0 for i in range(N)]\nl[0]=0\nk=0\nfor i in range(1,N):\n if a[k]<a[i]:\n l[i]=a[k]\n else:\n l[i]=a[i]\n k=i\nr[N-1]=N-1\nk=N-1\nfor i in range(N-1)[::-1]:\n if a[k]<a[i]:\n r[i]=a[k]\n else:\n ...
['Wrong Answer', 'Accepted']
['s654099031', 's111930898']
[24744.0, 29604.0]
[285.0, 623.0]
[396, 626]
p03987
u620480037
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['import bisect\nN=int(input())\nA=list(map(int,input().split()))\n\nA=[N+1]+A+[0]\n\nfor i in range(len(A)):\n A[i]=5-A[i]\n\nans=0\nfor i in range(1,N+1):\n R=bisect.bisect_left(A[i:],A[i])\n L=bisect.bisect_right(A[:i+1],A[i])\n ans+=L*R\nprint(ans)', 'import sys\nsys.setrecursionlimit(1000000)\n\nN=int(...
['Wrong Answer', 'Accepted']
['s679125051', 's606744490']
[25348.0, 56728.0]
[2104.0, 1120.0]
[248, 724]
p03987
u636387751
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['import bisect\n\n\ndef main():\n N = int(input())\n a = list(map(int, input().split()))\n\n s = [0, N+1]\n order = [0]*(N+1)\n\n for i in range(N):\n order[a[i]] = i+1\n\n ans = 0\n for i in range(1, N+1):\n bisect.insort_left(s, order[i])\n ans += i*(order[i]-s[bisect.bisect...
['Wrong Answer', 'Accepted']
['s870068582', 's360386419']
[3188.0, 35624.0]
[18.0, 368.0]
[451, 389]
p03987
u820351940
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
['a = list(map(int, reversed("1 3 2 4".split())))\n\nresult = target = tmp = a[0]\n\nfor index, i in enumerate(a[1:]):\n if target < i:\n tmp += i\n result += tmp\n else:\n target = i\n tmp = i * (index + 2)\n result += tmp\nprint(result)\n', 'n = int(input())\na = list(map(int,...
['Wrong Answer', 'Accepted']
['s657619390', 's496379892']
[3064.0, 45784.0]
[24.0, 552.0]
[266, 381]
p03987
u835482198
2,000
262,144
One day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend. Find the following:
["#!/usr/bin/env python\n# -*- coding:utf-8 -*-\n\nN = int(input())\na = list(map(int, input().split()))\n\ndata = [float('inf')] * (2 * N - 1)\n\ndef update(i, val):\n i += N-1\n data[i] = val\n while i > 0:\n i = (i - 1) // 2\n data[i] = min(data[2*i+1], data[i*2+2])\n\nfor i in range(N):\n ...
['Time Limit Exceeded', 'Accepted']
['s211815408', 's720090966']
[25864.0, 35140.0]
[2103.0, 352.0]
[722, 454]
p03988
u392319141
2,000
262,144
Aoki loves numerical sequences and trees. One day, Takahashi gave him an integer sequence of length N, a_1, a_2, ..., a_N, which made him want to construct a tree. Aoki wants to construct a tree with N vertices numbered 1 through N, such that for each i = 1,2,...,N, the distance between vertex i and the farthest vert...
["from collections import Counter\n\nN = int(input())\nA = list(map(int, input().split()))\n\ndef canMake():\n if N == 2:\n return A == [1, 1]\n\n cntA = Counter(A)\n mi = min(A)\n mx = max(A)\n\n if sum([c < 2 for c in cntA.values()]) >= 2:\n return False\n if cntA[mi] >= 2:\n re...
['Wrong Answer', 'Accepted']
['s436108532', 's459467821']
[3316.0, 3316.0]
[21.0, 21.0]
[462, 512]
p03988
u532966492
2,000
262,144
Aoki loves numerical sequences and trees. One day, Takahashi gave him an integer sequence of length N, a_1, a_2, ..., a_N, which made him want to construct a tree. Aoki wants to construct a tree with N vertices numbered 1 through N, such that for each i = 1,2,...,N, the distance between vertex i and the farthest vert...
['def main():\n from collections import Counter as ct\n n = int(input())\n a = list(map(int, input().split()))\n c = ct(a)\n min_a = min(a)\n max_a = max(a)\n if min_a == 1:\n if c[min_a] == 1:\n pass\n elif a == [1, 1]:\n print("Possible")\n return 0\...
['Wrong Answer', 'Accepted']
['s806941796', 's966944364']
[3064.0, 3316.0]
[17.0, 21.0]
[756, 763]
p04001
u001024152
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
["s = input()\nn = len(s)\nans = 0\n\nfor i in range(2**(n-1)):\n l = list(s)\n for j in range(1, n): \n if (1<<(j-1)) & i > 0:\n l = l[:j] + ['+'] + l[j:] \n ans += eval(''.join(l))\n\nprint(ans)", "s = input()\nn = len(s)\nans = 0\n \nfor i in range(2**(n-1)):\n l = list(s)\n for j in...
['Wrong Answer', 'Accepted']
['s240619746', 's504632470']
[3060.0, 3188.0]
[28.0, 28.0]
[242, 254]
p04001
u016881126
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['# arc 061 Many Formulas\nimport sys\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nread = sys.stdin.buffer.read\nsys.setrecursionlimit(10 ** 7)\n\nS = read().rstrip().decode(\'utf-8\')\n\ndef F(S):\n total = 0\n for i in range(2 ** (len(S) - 1)):\n operator_list = format(i...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s273748766', 's661849480', 's752858048']
[3064.0, 3064.0, 3064.0]
[19.0, 19.0, 21.0]
[659, 642, 691]
p04001
u021763820
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['S = input()\nprint(int(S))', '# -*- coding: utf-8 -*-\ns = list(input())\nn = len(s)-1\ntrueans = []\nfor i in range(2**n):\n bag = []\n for j in range(n):\n bag.append(s[j])\n if (i>>j) & 1:\n bag.append("+")\n bag.append(s[-1])\n bag.append("+")\n kai = ""\n ans = []\n ...
['Wrong Answer', 'Accepted']
['s592373838', 's429217784']
[2940.0, 3064.0]
[17.0, 22.0]
[25, 489]
p04001
u050622763
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['def abc061_c():\n s = str(input())\n\n l = []\n def saiki(i,moji):\n if i == len(s)-1:\n print(moji)\n l.append(sum(list(map(int,moji.split("+")))))\n return\n\n \n saiki(i+1,moji+"+"+s[i+1])\n \n saiki(i+1,moji+s[i+1])\n\n saiki(0,s[0])\...
['Wrong Answer', 'Accepted']
['s694801559', 's974557903']
[9064.0, 9200.0]
[31.0, 31.0]
[358, 358]
p04001
u057993957
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['s = list(input())\nn = len(s)-1\n\nans = 0\nfor x in list(product(["", "+"], repeat=n)):\n x = list(x)\n x.append("")\n \n strs = [i+j for i, j in zip(s, x)]\n ans += eval("".join(strs))\nprint(ans)', 'from itertools import product\ns = list(input())\nn = len(s)-1\n\nans = 0\nfor x in list(product(["",...
['Runtime Error', 'Accepted']
['s013963656', 's233870707']
[3060.0, 3064.0]
[17.0, 26.0]
[203, 233]
p04001
u067694718
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
["s = input()\nn = len(s)\nsum = 0\nfor b in range(1 << n-1):\n t = 0\n for i in range(n-1):\n if b & (1 << i):\n sum += int(''.join(s[t:i+1]))\n t = i\nprint(sum)\n", "s = input()\nn = len(s)\nsum = 0\nfor b in range(1 << n-1):\n t = 0\n for i in range(n-1):\n if b & (1 ...
['Wrong Answer', 'Accepted']
['s046281595', 's715680556']
[2940.0, 3064.0]
[20.0, 21.0]
[188, 221]
p04001
u076506345
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['import sys\n\ninput = sys.stdin.readline\n\ns = input()\nn = len(s)\n\ntotal_sum = 0\n\n\nfor i in range(2 ** (n - 1)):\n \n \n now_sum = 0\n reg = int(s[0])\n for j in range(n - 1):\n if i & 1 << j:\n now_sum += reg\n reg = 0\n reg *= 10\n reg += int(s[j + 1]...
['Runtime Error', 'Runtime Error', 'Accepted']
['s281925188', 's328433310', 's140528898']
[3060.0, 3060.0, 3060.0]
[18.0, 17.0, 21.0]
[574, 574, 602]
p04001
u077291787
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['import sys\n\ninput = sys.stdin.readline()\n\ns = input()\nn = len(s)\n\ntotal_sum = 0\n\n\nfor i in range(2 ** (n - 1)):\n \n \n now_sum = 0\n reg = int(s[0])\n for j in range(n - 1):\n if i & 1 << j:\n now_sum += reg\n reg = 0\n reg *= 10\n reg += int(s[j + ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s137182269', 's851156810', 's409150069']
[3060.0, 2940.0, 3060.0]
[17.0, 17.0, 33.0]
[572, 50, 409]
p04001
u084491185
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['s = input()\nn = len(s)\n\nans = 0\n\nfor bit in range((n-1)**2):\n f = s[0]\n for i in range(n - 1):\n if (bit >> i) & 1:\n f += "+"\n f += s[i + 1]\n print(f)\n ans += sum(map(int, f.split("+")))\n\nprint(ans)', 's = input()\nn = len(s)\n\nans = 0\n\nfor bit in range(2 ** 2 ** (...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s178994444', 's186103416', 's138896768']
[3060.0, 3060.0, 3060.0]
[18.0, 2104.0, 21.0]
[234, 232, 227]
p04001
u086716588
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['\ndef main():\n s = input()\n num = 2**(len(s)-1)\n bit_len = len(bin(num))\n\n def func(n):\n n = bin(n)\n n_len = len(n)\n n = "0"*( bit_len - n_len - 1 ) + n[-len(n)+2:]\n indexes = [i+1 for i, x in enumerate(n) if x == "1"]\n ans = 0\n temp = 0\n for i ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s275270541', 's668773930', 's735048565']
[3776.0, 3064.0, 3064.0]
[27.0, 17.0, 17.0]
[653, 352, 340]
p04001
u095756391
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['from itertools import product\nS = input()\nans = 0\n\n\n\nfor s in product(["", "+"], repeat=len(S) - 1):\n s = list(s)\n print(s)\n s.append("")\n ans += eval("".join(a+b for a,b in zip(S,s)))\n print(ans)\n \nprint(ans)\n', 'from itertools import product\nS = input()\nans = 0\n\n\nfor s in product(["", "+"],...
['Wrong Answer', 'Accepted']
['s655633578', 's676455753']
[3060.0, 3060.0]
[29.0, 26.0]
[315, 215]
p04001
u101350975
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
["from sys import stdin\nS = stdin.readline().rstrip()\nn = len(S)\ndef dfs(i, f):\n if i = n-1:\n return sum(list(map(int, f.split('+'))))\n return dfs(i+1, f + S[i + 1]) + dfs(i + 1, f + '+' s[i-1])\n\nprint(dfs(0, S[0]))\n", "from sys import stdin\nS = stdin.readline().rstrip()\nn = len(S)\ndef dfs(i, f...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s030320851', 's476094493', 's592746079', 's653720314', 's671611464', 's681538750', 's294522233']
[2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0, 3060.0]
[17.0, 17.0, 19.0, 17.0, 18.0, 17.0, 19.0]
[264, 264, 229, 228, 264, 226, 229]
p04001
u102461423
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['import sys\ninput = sys.stdin.readline\nfrom scipy.sparse import csr_matrix\nfrom scipy.sparse.csgraph import dijkstra\n\n\n\nN,M = map(int,input().split())\nPQC = [[int(x) for x in input().split()] for _ in range(M)]\n\nU = 10 ** 6\n\nV = set(range(1,N+1))\nV |= set(p + c * U for p,q,c in PQC)\nV |= set(q + c * U fo...
['Runtime Error', 'Accepted']
['s301729557', 's625718080']
[16976.0, 3060.0]
[238.0, 18.0]
[922, 364]
p04001
u103902792
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
["s = input()\nn = len(s)\nans = 0\n\nfor i in range(2**(n-1)):\n form = s\n bit = []\n for _ in range(n-1):\n bit.append(i%2)\n i = i//2\n \n for j in range(n):\n if bit[j]:\n form = form[:n-j] + '+' + form[n-j:]\n \n ans += form.eval()\nprint(ans)", 's = input()\nn = len(s)\ncand = []\n\ndef f...
['Runtime Error', 'Accepted']
['s311713800', 's950361221']
[3060.0, 3064.0]
[17.0, 18.0]
[255, 272]
p04001
u112315075
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['import sys\n\nS = list(map(int, sys.stdin.readline()))\nlen_S = len(S)\nans = 0\nfor i in range(2 ** (len_S - 1)):\n sum_ = S[len_S - 1]\n cursor = len_S - 1\n power = 0\n pattern = i\n while cursor > 0:\n cursor -= 1 \n if pattern % 2 == 1:\n power += 1\n else:\n power = 0\n sum_ += S[curs...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s029587544', 's043977446', 's441520648', 's544840277', 's686970673', 's182790812']
[3060.0, 3060.0, 3064.0, 3060.0, 3060.0, 3060.0]
[18.0, 17.0, 17.0, 17.0, 18.0, 20.0]
[365, 356, 374, 350, 365, 347]
p04001
u122132511
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['S = input()\nn = len(S)\n\nans = 0\n\nfor bit in range(1 << (n - 1)):\n partial_sum = S[0]\n print(bit)\n for i in range(n-1):\n if bit & (1 << i):\n partial_sum += "+"\n partial_sum += S[i+1]\n ans += sum(map(int, partial_sum.split("+")))\n\nprint(ans)\n', 'S = input()\nn = len(S...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s121665697', 's697219133', 's980472679']
[8984.0, 9100.0, 9068.0]
[28.0, 34.0, 33.0]
[277, 254, 262]
p04001
u123745130
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['# n=int(input())\n# lst=[int(input()) for _ in range(n)]\n# ans1=sum(lst)\n# max1=max(lst)\n# print(ans1)\n# print(0 if max1<=ans1-max1 else max1-(ans1-max1))\ns=input()\nn=len(s)\nl=n-1\nlst_1=[]\nfor i in range(1<<l):\n lst=[]\n for j in range(l):\n if ((i>>j)&1):\n lst.append("+")\n ...
['Wrong Answer', 'Accepted']
['s934948043', 's817621646']
[9168.0, 9104.0]
[31.0, 35.0]
[586, 536]
p04001
u135847648
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['S = input()\n \ncnt = len(S) - 1 \n \nans = 0\n \nfor i in range(2 ** cnt):\n sign = [""] * cnt\n for j in range(cnt):\n if ((i>>j)&1):\n sign[j] = "+"\n \n formula = "" \n for k in range(cnt):\n formula += S[k] + sign[k]\n print(sign)\n formula += S[cnt]\n print(formula,i) \...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s966250996', 's968869675', 's758339629']
[3188.0, 3316.0, 3064.0]
[37.0, 38.0, 27.0]
[353, 369, 314]
p04001
u143492911
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['s=input()\nn=len(s)\nans=0\nfor i in range(1<<n-1):\n num=s[0]\n for j in range(n-1):\n if i&(1<<j):\n num+="+"+s[j+1]\n else:\n num+=s[j+1]\n ans+=eval(ins)\nprint(ans)\n', 's=input()\nn=len(s)\nans=0\nfor i in range(1<<n-1):\n num=s[0]\n for j in range(n-1):\n ...
['Runtime Error', 'Accepted']
['s207233201', 's482916260']
[2940.0, 3060.0]
[17.0, 26.0]
[314, 313]
p04001
u148753842
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['S = input()\nN = len(S)\n\n# create ptn\nptn = []\nfor bit in range(2**(N-1)):\n tmp = [False]*(N-1)\n for i in range(N-1):\n if ((bit>>i) & 1):\n tmp[i] = True\n ptn.append(tmp)\n\n# calc sum\ntot = []\nfor p in ptn:\n a = []\n for i, s in enumerate(S):\n if i==0:\n ...
['Wrong Answer', 'Accepted']
['s456268283', 's630331211']
[3064.0, 3064.0]
[21.0, 21.0]
[523, 530]
p04001
u164727245
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['# coding: utf-8\n\n\ndef solve(*args: str) -> str:\n S, = args\n n_sep = len(S)-1\n b_max = 2**n_sep\n print(S)\n\n ret = 0\n for b in range(b_max):\n p = 0\n for i in range(n_sep):\n if b >> i & 1:\n ret += int(S[p:i+1])\n p = i+1\n ret ...
['Wrong Answer', 'Accepted']
['s987315711', 's449344295']
[3060.0, 3060.0]
[19.0, 18.0]
[415, 402]
p04001
u168333670
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
['S = input()\n\ndef func(num, code):\n total = 0\n start = 0\n length = len(num)\n\n for i in range(1, length):\n if code & 1 == 1: \n total = total + int(num[start:i])\n start = i\n code = code >> 1\n\n total = total + int(num[start:i + 1])\n\n return total\n\ntot...
['Runtime Error', 'Accepted']
['s737262001', 's338169712']
[3064.0, 3064.0]
[21.0, 19.0]
[481, 460]
p04001
u168573507
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
["s = input()\nn = len(s) -1\nans = 0\nprint(s)\nfor i in range(2**n):\n e = s[0]\n for j in range(n):\n if i >> j & 1:\n e +='+'\n e += s[j+1]\n ans += eval(e)\nprint(ans)", "s = input()\nn = len(s) -1\nans = 0\nfor i in range(2**n):\n e = s[0]\n for j in range(n):\n if i >> j & 1:\n e +='+'\n ...
['Wrong Answer', 'Accepted']
['s311030961', 's202221583']
[9060.0, 9104.0]
[29.0, 34.0]
[173, 165]
p04001
u169678167
2,000
262,144
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
["s = input()\nk = len(s)\n\nans = 0\n\nfor bit in range(1 << k-1):\n f = s[0]\n \n for i in range(k-1):\n \n if bit & (1 << i):\n f += '+'\n f += f[i + 1]\n ans += sum(list(map(int, f.split('+'))))\n\nprint(ans)", 's = input()\nk = len(s)\n\n\n# """\n\n\n\n# """\n\n#...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s429378011', 's793285241', 's988022229', 's000033997']
[3060.0, 3064.0, 3060.0, 3064.0]
[17.0, 17.0, 17.0, 20.0]
[364, 737, 739, 792]