Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
N = list(map(int,input().split()))
C= 1
if N==0:
    print(0)
    sys.exit()
for i in N:
  C = C*i
  if C > (10 ** 18):
    C=-1
print(C)

Fixed submission:
def mul2():
    n = int(input())
    a = list(map(int, input().split()))
    
    if 0 in a:
        return 0
    ans = 1
    for i in a:
        ans *= i
        if ans > 1000000000000000000:
            return -1
        
    return ans 
print(mul2())

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
N = list(map(int,input().split()))
C= 1
if N==0:
    sys.exit()
for i in N:
  C = C*i
  if C > (10 ** 18):
    C=-1
print(C)

Fixed submission:
def mul2():
    n = int(input())
    a = list(map(int, input().split()))
    
    if 0 in a:
        return 0
    ans = 1
    for i in a:
        ans *= i
        if ans > 1000000000000000000:
            return -1
        
    return ans 
print(mul2())

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A = 1
for i in A:
    A *= i
    if A== 0:
        break
if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
def mul2():
    n = int(input())
    a = list(map(int, input().split()))
    
    if 0 in a:
        return 0
    ans = 1
    for i in a:
        ans *= i
        if ans > 1000000000000000000:
            return -1
        
    return ans 
print(mul2())
Buggy python submission (verdict: Runtime Error):
import os
 
N = int(input())
 
def main(n, var):
    mylist = []
    dupliN = n
    for i in range(2, int(-(-n**0.5//var))+var):
        if dupliN%i==0:
            cnt=0
            while dupliN%i==0:
                cnt+=var
                dupliN //= i
            mylist.append([i, cnt])
 
    if dupliN!=1:
        mylist.append([dupliN, 1])
    if mylist==[]:
        mylist.append([n, 1])
    return mylist
if N == 1:
    print(0)
    os._exit()
f = main(N, 1)
ansval = 0
for extra, value in f:
    num = 1
    while True:
        value -= num
        if value < 0:
            break
        ansval += 1
        num += 1 
print(ansval)

Fixed submission:
try: 
    N = int(input())
except:
    exit()
def main(n, var):
    mylist = []
    dupliN = n
    for i in range(2, int(-(-n**0.5//var))+var):
        if dupliN%i==0:
            cnt=0
            while dupliN%i==0:
                cnt+=var
                dupliN //= i
            mylist.append([i, cnt])
 
    if dupliN!=1:
        mylist.append([dupliN, 1])
    if mylist==[]:
        mylist.append([n, 1])
    return mylist
if N == 1:
    print(0)
    exit()
f = main(N, 1)
ansval = 0
for extra, value in f:
    num = 1
    while True:
        value -= num
        if value < 0:
            break
        ansval += 1
        num += 1 
print(ansval)

Buggy python submission (verdict: Runtime Error):
import os
 
N = int(input())
 
def main(n, var):
    mylist = []
    dupliN = n
    for i in range(2, int(-(-n**0.5//var))+var):
        if dupliN%i==0:
            cnt=0
            while dupliN%i==0:
                cnt+=var
                dupliN //= i
            mylist.append([i, cnt])
 
    if dupliN!=1:
        mylist.append([dupliN, 1])
    if mylist==[]:
        mylist.append([n, 1])
    return mylist
if N == 1:
    print(0)
    os._exit()
f = main(N, 1)
ansval = 0
for extra, value in f:
    num = 1
    while True:
        value -= num
        if value < 0:
            break
        ansval += 1
        num += 1 
print(ansval)

Fixed submission:
try: 
    N = int(input())
except:
    exit()
def main(n, var):
    mylist = []
    dupliN = n
    for i in range(2, int(-(-n**0.5//var))+var):
        if dupliN%i==0:
            cnt=0
            while dupliN%i==0:
                cnt+=var
                dupliN //= i
            mylist.append([i, cnt])
 
    if dupliN!=1:
        mylist.append([dupliN, 1])
    if mylist==[]:
        mylist.append([n, 1])
    return mylist
if N == 1:
    print(0)
    exit()
f = main(N, 1)
ansval = 0
for extra, value in f:
    num = 1
    while True:
        value -= num
        if value < 0:
            break
        ansval += 1
        num += 1 
print(ansval)
Buggy python submission (verdict: Runtime Error):
import math
ans = False
a, b, c, k = map(int, input().split()
ans += min(k, a)
k -= min(k, a)
k -= min(k, b)
ans -= min(k, c)
print(ans)

Fixed submission:
import math
ans = False
a, b, c, k = map(int, input().split())
ans += min(k, a)
k -= min(k, a)
k -= min(k, b)
ans -= min(k, c)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
list = [0]*N
for _ in range(K):
    d = int(input()) 
    l2= list(map(int, input().split()))
    print(l2)
    for val in l2:
        list[val-1] = 1
print(N-sum(list))

Fixed submission:
N, K = map(int, input().split())
l1 = [0]*N
for _ in range(K):
    d = int(input()) 
    l2= list(map(int, input().split()))
    for val in l2:
        l1[val-1] = 1
print(N-sum(l1))
Buggy python submission (verdict: Runtime Error):
X = int(input())
s = 100
c = 0
while s < X:
	s = s + s  // 100
    c = c + 1
print(c)

Fixed submission:
X = int(input())
s = 100
c = 0
while s < X:
  s = s + s  // 100
  c = c + 1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
y = 0
while 100 < x:
    m = 100*101//100
    y+= 1
print(y)

Fixed submission:
X = int(input())
s = 100
c = 0
while s < X:
  s = s + s  // 100
  c = c + 1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
y = 0
while 100 < x:
    m = 100*101//100
    y+= 1
print(y)

Fixed submission:
X = int(input())
s = 100
c = 0
while s < X:
  s = s + s  // 100
  c = c + 1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
y = 0
while 100 < x:
    m = 100*101//100
    y+= 1
print(y)

Fixed submission:
X = int(input())
s = 100
c = 0
while s < X:
  s = s + s  // 100
  c = c + 1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = []
ans = 0
for i in range(n):
  s = input()
  if s in l:
    continue
  else:
    ans+=1
    l.append(s)
print(ans)

Fixed submission:
n = int(input())
d = {}
ans = 0
for i in range(n):
  s = input()
  if d.get(s, 0)==0:
    d[s]=1
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l=[]
for i in range(n): 
    if ((i%3)!=0)  and ((i%5)!=0):
        l.append(i)
print(sum(l))

Fixed submission:
import sys
X=input()
n=len(X)
if n%2==0:
    print("No")
    sys.exit()
ans="No"
def check(s): 
    return s == s[::-1] 
ans="No"
if check(X):
    if check(X[0:int((n-1)/2)]):
        if check(X[int(((n+3)/2)-1):]):
            ans="Yes"
print(ans)

Buggy python submission (verdict: Runtime Error):
inp=input()
if inp[2]==inp[3] and inp[4]==inp[5]:
  print("Yes")
else:
  print("No")

Fixed submission:
import sys
X=input()
n=len(X)
if n%2==0:
    print("No")
    sys.exit()
ans="No"
def check(s): 
    return s == s[::-1] 
ans="No"
if check(X):
    if check(X[0:int((n-1)/2)]):
        if check(X[int(((n+3)/2)-1):]):
            ans="Yes"
print(ans)
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
x="b"*a+"r"*b
x= x*(10**5)
strx = x[0:n]
def split(w):
    return [all for all in w]
def countX(lst, x): 
    return lst.count(x) 
listx = split(strx)
print(countX(listx, "b"))

Fixed submission:
n,a,b = map(int,input().split())
x = n//(a+b)
if n - x*(a+b) > a:
    Y =a
else:
    Y=n - x*(a+b)
print(a*x+Y)

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
x="b"*a+"r"*b
x= x*(10**5)
strx = x[0:n]
def split(w):
    return [all for all in w]
def countX(lst, x): 
    return lst.count(x) 
listx = split(strx)
print(countX(listx))

Fixed submission:
n,a,b = map(int,input().split())
x = n//(a+b)
if n - x*(a+b) > a:
    Y =a
else:
    Y=n - x*(a+b)
print(a*x+Y)

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
x="b"*a+"r"*b
x= x*(10**100)
strx = x[0:n]
def split(w):
    return [all for all in w]
def countX(lst, x): 
    return lst.count(x) 
listx = split(strx)
print(countX(listx))

Fixed submission:
n,a,b = map(int,input().split())
x = n//(a+b)
if n - x*(a+b) > a:
    Y =a
else:
    Y=n - x*(a+b)
print(a*x+Y)
Buggy python submission (verdict: Runtime Error):
n= int(input)
if n%2==0:
  print(int(n*0.5))
else:
  print(int(0.5*n)+1)

Fixed submission:
n= int(input())
if n%2==0:
  print(int(n*0.5))
else:
  print(int(0.5*n)+1)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input)
if a==b or b==c or c==a:
  print("Yes")
else:
  print("No")

Fixed submission:
a, b, c = map(int, input().split())
if a==b and b==c:
    print("No")
elif a==b or b==c or c==a:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
alpha="abcdefghijklmnomqrstuvwxyz"
inp=input()
def split(w):
    return [all for all in w]
alpha=split(alpha)
x=alpha.index(inp)
try:
    print(alpha[x+1])
except:
    print("a")

Fixed submission:
alpha="abcdefghijklmnopqrstuvwxyz"
inp=input()
def split(w):
    return [all for all in w]
alpha=split(alpha)
x=alpha.index(inp)
try:
    print(alpha[x+1])
except:
    print("a")

Buggy python submission (verdict: Runtime Error):
alpha="abcdefghijklmnomqrstuvwxyz"
inp=input()
def split(w):
    return [all for all in w]
alpha=split(alpha)
x=alpha.index(inp)
print(alpha[x+1])

Fixed submission:
alpha="abcdefghijklmnopqrstuvwxyz"
inp=input()
def split(w):
    return [all for all in w]
alpha=split(alpha)
x=alpha.index(inp)
try:
    print(alpha[x+1])
except:
    print("a")
Buggy python submission (verdict: Runtime Error):
list=list(map(int,input().split()))
print(min(list[1]*N, list[2]*N))

Fixed submission:
N,A,B=map(int,input().split())
A=N*A
if A>=B:
    print(B)
else:
    print(A)
Buggy python submission (verdict: Runtime Error):
def split(word): 
    return [char for char in word]  
inp=input()
list=split(inp)
count=0
x=1
str="Good"
for i in range(len(3):
    if list[count]==list[count+1]:
        str="Bad"
    count=count+1
print(str)

Fixed submission:
def split(word): 
    return [char for char in word]  
inp=input()
list=split(inp)
count=0
x=1
str="Good"
for i in range(3):
    if list[count]==list[count+1]:
        str="Bad"
    count=count+1
print(str)
Buggy python submission (verdict: Runtime Error):
def better(l, i, ready, ans):
    #print(l, i, ready, ans)
    if i==0:
        ready[0]=True
        ans[0]=0
        return l[0], 0
    if i==1:
        ready[1]=True
        ans[1]=abs(l[0]-l[1])
        return l[1], abs(l[0]-l[1])
    else:
        if ready[i]:
            return l[i], ans[i]
        else:
            last, val = better(l, i-1, ready, ans)
            last1, val1 = better(l, i-2, ready, ans)
            #print(last, val, last1, val1)
            xx = min([(abs(last-l[i])+val), (abs(last1-l[i])+val1)])
            ready[i]=True
            ans[i]=xx
            return l[i], xx
n = int(input())
l = list(map(int, input().split()))
if n==0:
    print(0)
    import sys
    sys.exit()
print(better(l, n-1, [False]*n, [0]*n)[1])

Fixed submission:
import math
def better(l, ans):
    for i in range(2, n):
        ans[i] = min(ans[i - 1] + abs(l[i]-l[i - 1]), ans[i - 2] + abs(l[i]-l[i - 2]))
    return ans
n = int(input())
l = list(map(int, input().split()))
ans = [0] * n
ans[1] = abs(l[1]-l[0])
print(better(l, ans)[len(ans)-1])

Buggy python submission (verdict: Runtime Error):
def better(l, i, ready, ans):
    #print(l, i, ready, ans)
    if i==0:
        ready[0]=True
        ans[0]=0
        return l[0], 0
    if i==1:
        ready[1]=True
        ans[1]=abs(l[0]-l[1])
        return l[1], abs(l[0]-l[1])
    else:
        if ready[i]:
            return l[i], ans[i]
        else:
            last, val = better(l, i-1, ready, ans)
            last1, val1 = better(l, i-2, ready, ans)
            #print(last, val, last1, val1)
            xx = min([(abs(last-l[i])+val), (abs(last1-l[i])+val1)])
            ready[i]=True
            ans[i]=xx
            return l[i], xx
n = int(input())
l = list(map(int, input().split()))
print(better(l, n-1, [False]*n, [0]*n)[1])

Fixed submission:
import math
def better(l, ans):
    for i in range(2, n):
        ans[i] = min(ans[i - 1] + abs(l[i]-l[i - 1]), ans[i - 2] + abs(l[i]-l[i - 2]))
    return ans
n = int(input())
l = list(map(int, input().split()))
ans = [0] * n
ans[1] = abs(l[1]-l[0])
print(better(l, ans)[len(ans)-1])

Buggy python submission (verdict: Runtime Error):
inp = int(input())
if inp>=400 and inp<=599:
  ans = 8
elif inp>=600 and inp<=799:
  ans = 7
elif inp>=800 and inp<=999:
  ans = 6
elif inp>=1000 and inp<=1199:
  ans = 5
elif inp>=1200 and inp<=1399:
  ans = 4
elif inp>=1400 and inp<=1599:
  ans = 3
elif inp>=1600 and inp<=1799:
  ans = 2
elif inp>=1800 and inp<=1999:
  ans = 1
print(ans)

Fixed submission:
import math
def better(l, ans):
    for i in range(2, n):
        ans[i] = min(ans[i - 1] + abs(l[i]-l[i - 1]), ans[i - 2] + abs(l[i]-l[i - 2]))
    return ans
n = int(input())
l = list(map(int, input().split()))
ans = [0] * n
ans[1] = abs(l[1]-l[0])
print(better(l, ans)[len(ans)-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = []
for i in range(n):
    x= list(map(int, input().split()))
    l.append(x)
def find(ele, l):
    cc = 0
    ans = []
    for i in l:
        if i==ele:
            ans.append(cc)
        cc+=1
    return ans
c = n-1
for i in l[::-1]:
    if c==n-1:
        m = max(i)
        xxx = i.copy()
        xxx.remove(m)
        m2 = max(xxx)
        if m==m2:
            count = 0
            count2 = 0
            for aa in xxx:
                if aa==m2 and count2==1:
                    ii = count
                    break
                elif aa==m2:
                    count2+=1
                count+=1
            index = [i.index(m), ii]
        else:
            index = [i.index(m), i.index(m2)]
        maxval = [m, m2]
        c-=1
        #print(index, maxval, "m")
        continue
    else:
        m = max(i)
        xxx = i.copy()
        xxx.remove(m)
        m2 = max(xxx)
        count = 0
        count2 = len(maxval)
        #print(maxval)
        found2 =find(m2,i)
        found = find(m,i)
        #print(found, found2, "Found")
        for a in maxval:
            #print(count, count2, i)
            if count==count2:
                break
            if index[count] not in found2 or len(found2)!=1:
                maxval.append(a+m2)
            if index[count] not in found or len(found)!=1:
                maxval[count]+=m
            count+=1
        if m==m2:
            index =[found[0]]*(2*count2)
        else:
            index = [found[0]]*count2+[found2[0]]*count2
        c-=1
        #print(maxval, index, "i")
print(max(maxval))

Fixed submission:
n = int(input())
ans = [[0]*3 for xxx in range(n)]
for i in range(n):
    a,b,c = list(map(int, input().split()))
    if i==0:
        ans[0][0] = a
        ans[0][1] = b
        ans[0][2] = c 
        continue
    ans[i][0] += max(ans[i-1][1], ans[i-1][2]) + a
    ans[i][1] += max(ans[i-1][2], ans[i-1][0]) + b
    ans[i][2] += max(ans[i-1][0], ans[i-1][1]) + c
ans = ans[-1]
print(max(ans))
Buggy python submission (verdict: Runtime Error):
from numpy.random import randint
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range (len(a)-1) :
  try:
    if l[i] == l[i + 1]:
        ans += 1
        l[i + 1] = randint(0, 10000)
  except:
    continue
print(ans)

Fixed submission:
from random import randint
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range (len(l)-1) :
  try:
    if l[i] == l[i + 1]:
        ans += 1
        l[i + 1] = randint(0, 10000)
  except:
    continue
print(ans)

Buggy python submission (verdict: Runtime Error):
from random import randint
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range (len(a)-1) :
  try:
    if l[i] == l[i + 1]:
        ans += 1
        l[i + 1] = randint(0, 10000)
  except:
    continue
print(ans)

Fixed submission:
from random import randint
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range (len(l)-1) :
  try:
    if l[i] == l[i + 1]:
        ans += 1
        l[i + 1] = randint(0, 10000)
  except:
    continue
print(ans)

Buggy python submission (verdict: Runtime Error):
from random import randint
l = list(map(int, input().split()))
ans = 0
for i in range (len(a) - 1) :
  if l[i] == l[i + 1]:
    ans += 1
    l[i + 1] = randint(0, 10000)
print(ans)

Fixed submission:
from random import randint
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range (len(l)-1) :
  try:
    if l[i] == l[i + 1]:
        ans += 1
        l[i + 1] = randint(0, 10000)
  except:
    continue
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
n = input()
intn = int(n)
s = int("1"*len(n))*9
if s==intn:
  print(len(n)*9)
  sys.exit()
ans=int("1"*(len(n)-1))*9
xx = int(n[0])-1
def split(aa):
  return [c for c in aa]
ans=split(str(ans))
c = 0
for i in range(len(ans)):
    ans[c] = int(ans[c])
    c+=1
print(sum(ans)+xx)

Fixed submission:
n = list(map(int, input()))
l = [sum(n)]
for i in range(1, len(n)):
    n[-i] = 9
    n[-i-1] -= 1
    l.append(sum(n)) 
print(max(l))

Buggy python submission (verdict: Runtime Error):
n = input()
intn = int(n)
s = int("1"*len(n))*9
if s==intn:
  print(len(n)*9)
  quit()
ans=int("1"*(len(n)-1))*9
xx = int(n[0])-1
def split(aa):
  return [c for c in aa]
ans=split(str(ans))
c = 0
for i in range(len(ans)):
    ans[c] = int(ans[c])
    c+=1
print(sum(ans)+xx)

Fixed submission:
n = list(map(int, input()))
l = [sum(n)]
for i in range(1, len(n)):
    n[-i] = 9
    n[-i-1] -= 1
    l.append(sum(n)) 
print(max(l))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = list(map(float, input().split()))
m = max(l)
def hcf(x, y): 
    while(y): 
        x, y = y, x % y 
    return x 
num1=l[0] 
num2=l[1] 
gcd=hcf(num1,num2) 
for i in range(2,len(l)): 
    gcd=hcf(gcd,l[i])
if k%gcd == 0 and k<=m:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Fixed submission:
import math
from functools import reduce
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
def hcf(l):
    return reduce(math.gcd, l)
gcd = hcf(A)
m = max(A)
if k%gcd == 0 and k<=m:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = list(map(int, input().split()))
m = max(l)
def hcf(x, y): 
    while(y): 
        x, y = y, x % y 
    return x 
num1=l[0] 
num2=l[1] 
gcd=hcf(num1,num2) 
for i in range(2,len(l)): 
    gcd=hcf(gcd,l[i])
if k%gcd == 0 and k<=m:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Fixed submission:
import math
from functools import reduce
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
def hcf(l):
    return reduce(math.gcd, l)
gcd = hcf(A)
m = max(A)
if k%gcd == 0 and k<=m:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = list(map(int, input().split()))
m = max(a)
def hcf(x, y): 
    while(y): 
        x, y = y, x % y 
    return x 
num1=l[0] 
num2=l[1] 
gcd=hcf(num1,num2) 
for i in range(2,len(l)): 
    gcd=hcf(gcd,l[i])
if k%gcd == 0 and k<=m:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
import math
from functools import reduce
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
def hcf(l):
    return reduce(math.gcd, l)
gcd = hcf(A)
m = max(A)
if k%gcd == 0 and k<=m:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
def anotherpair(x, y):                
    l = []
    c=1
    for i in range(x, y+1):
        if c==0:
            l.append([i, i-1])
        c=0
    return l
n, a, b = map(int, input().split())
if n==1:
    if a==b:
            ans = 1
    else:
        ans = 0
else:
    if a>b:
        ans = 0
    else:
        ans = len(anotherpair((n-2)*a, (n-2)*b))+1
print(ans)

Fixed submission:
n, a, b = map(int, input().split())
if n==1:
    if a==b:
            ans = 1
    else:
        ans = 0
else:
    if a>b:
        ans = 0
    else:
        ans = ((n-2)*b-(n-2)*a)+1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
x=[]
ans, count, q, xx = 0, 1, "<", 0
for i in range(n+1):
    if q=='<':
        if l[count]<=l[count-1]:
            count+=1
            continue
        else:
            if xx==0:
                q=">"
                xx+=1
                continue
            else:
                ans+=1
                q=">"
                continue
    if q=='>':
        if l[count]>=l[count-1]:
            count+=1
            continue
        else:
            ans+=1
            q="<"
            continue
print(ans+1)

Fixed submission:
num = int(input())
l = list(map(int, input().split()))
count = 1
var = var2 = 0
c = l[0]
for i in l[1:]:
    if c < i:
        var = 1
    elif c > i:
        var2 = 1
    if var == 1 and var2 == 1:
        count += 1
        var = var2 = 0
    c = i
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
x = input()
while "ST" in x:
  x=x.replace("ST","")
print(len(x))

Fixed submission:
x = input()
scount, tcount, c = 0, 0, 0
for i in range(len(x)):
  if x[c]=="S":
    scount+=1
  else:
    if scount>0:
      scount-=1
    else:
      tcount+=1
  c+=1
print(tcount*2)

Buggy python submission (verdict: Time Limit Exceeded):
x = input()
while "ST" in x:
  x=x.replace("ST","")
print(len(x))

Fixed submission:
x = input()
scount, tcount, c = 0, 0, 0
for i in range(len(x)):
  if x[c]=="S":
    scount+=1
  else:
    if scount>0:
      scount-=1
    else:
      tcount+=1
  c+=1
print(tcount*2)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import factorial, fabs
a, b = map(int, input().split())
try:
    if factorial(b)/factorial(a)==0:
        print("Zero")
        sys.exit()
except:
    if 0 in range(a, b+1):
        print("Zero")
        sys.exit()       
    c=0
x=True
if (fabs(a)-fabs(b))%2==0 and (b<0):
    x=False
a, b= fabs(a), fabs(b)
fin=int(factorial(b)/factorial(a))
if fin==0 and factorial(b)/factorial(a)!=0:
    fin=int(factorial(a)/factorial(b))
if x==False:
    fin*=-1
if fin==0:
    ans="Zero"
elif fin<0:
    ans="Negative"
else:
    ans="Positive"
print(ans)

Fixed submission:
from math import fabs
a, b = map(int, input().split())
if a <= 0 and 0 <= b:
    print("Zero")
else:
    if a > 0:
        print("Positive")
    else:
        if (fabs(b - a) + 1) % 2 == 0:
            print("Positive")
        else:
            print("Negative")

Buggy python submission (verdict: Time Limit Exceeded):
import numpy
l=[]
a, b = map(int, input().split())
for i in range(a, b+1):
    l.append(i)
a=numpy.prod(l)
if a==0:
    ans="Zero"
elif a<0:
    ans="Negative"
else:
    ans="Positive"
print(ans)

Fixed submission:
from math import fabs
a, b = map(int, input().split())
if a <= 0 and 0 <= b:
    print("Zero")
else:
    if a > 0:
        print("Positive")
    else:
        if (fabs(b - a) + 1) % 2 == 0:
            print("Positive")
        else:
            print("Negative")
Buggy python submission (verdict: Runtime Error):
x,N = list(map(int,input().split(" ")))
try:
  p = list(map(int,input().split(" ")))
  sa = 1
  ans = -100
except EOFError:
  ans = x
    
while True:
  if ans != -100:
    break
  for i in range(N):
    if x-sa == p[i]:
      break
    if i == N-1:
      if x-sa != p[i]:
        ans = x-sa
  if ans != -100:
    break
  for i in range(N):
    if x+sa == p[i]:
      break
    if i == N-1:
      if x+sa != p[i]:
        ans = x+sa
  if ans != -100:
    break
  sa += 1
print(ans)

Fixed submission:
x,N = list(map(int,input().split(" ")))
if N != 0:
  p = list(map(int,input().split(" ")))
  sa = 0
  ans = -100
else:
  ans = x

while True:
  if ans != -100:
    break
  for i in range(N):
    if x-sa == p[i]:
      break
    if i == N-1:
      if x-sa != p[i]:
        ans = x-sa
  if ans != -100:
    break
  for i in range(N):
    if x+sa == p[i]:
      break
    if i == N-1:
      if x+sa != p[i]:
        ans = x+sa
  if ans != -100:
    break
  sa += 1
print(ans)