ZhenlongDai/ACPR huggingface dataset:
Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = list(map(int, input().split()))
print(min(a*b,c*d))

Failing test case input:
000 16 2 29

Expected output:
58


Actual output:
0


Fixed submission (verdict: Accepted):
a, b, c, d = list(map(int, input().split()))
print(max(a*b,c*d))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = [int(s) for s in input().split()]

if A * B > C * D:
    print(A * B)
else:
    print(C * B)


Failing test case input:
001 222 109 9

Expected output:
981


Actual output:
24198


Fixed submission (verdict: Accepted):
A, B, C, D = [int(s) for s in input().split()]
 
if A * B > C * D:
    print(A * B)
else:
    print(C * D)

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
if a*b >= c*d:
  print(a*b)
else:
  print(b*c)

Failing test case input:
010 9 3 101

Expected output:
303


Actual output:
27


Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())
if a*b >= c*d:
  print(a*b)
else:
  print(c*d)

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
print(max(a*b,d*d))

Failing test case input:
3 -3 12 -1

Expected output:
-9


Actual output:
1


Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
print(max(a*b,c*d))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
print(a*b,c*d)

Failing test case input:
111 -1 -6 010

Expected output:
-60


Actual output:
-111 -60


Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
print(max(a*b,c*d))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
z=list(map(int,input().split()))
max(z[0]*z[1],z[2]*z[3])

Failing test case input:
011 45 4 000

Expected output:
495


Actual output:

Fixed submission (verdict: Accepted):
z=list(map(int,input().split()))
print(max(z[0]*z[1],z[2]*z[3]))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
print(min(a*b,c*d))

Failing test case input:
000 17 12 17

Expected output:
204


Actual output:
0


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
print(max(a*b,c*d))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = map(int, input().split())

if A * B > C * D:
    print(A * B)
else:
    print(B * C)

Failing test case input:
2 -4 7 -1

Expected output:
-7


Actual output:
-28


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split())

if A * B > C * D:
    print(A * B)
else:
    print(C * D)
Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    s = input()
    l = s.split(" ")
    shape_1 = int(l[0]) * int(l[1])
    shape_2 = int(l[2]) * int(l[3])
    if shape_1 == shape_1:
        print(shape_1)
    elif shape_1 > shape_2:
        print(shape_1)
    elif shape_1 < shape_2:
        print(shape_2)

if __name__ == '__main__':
    main()

Failing test case input:
-2 0 2 15

Expected output:
30


Actual output:
0


Fixed submission (verdict: Accepted):
def main():
    s = input()
    l = s.split(" ")
    shape_1 = int(l[0]) * int(l[1])
    shape_2 = int(l[2]) * int(l[3])
    if shape_1 == shape_2:
        print(shape_1)
    elif shape_1 > shape_2:
        print(shape_1)
    elif shape_1 < shape_2:
        print(shape_2)

if __name__ == '__main__':
    main()

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
max(a*b,c*d)

Failing test case input:
111 4 0 011

Expected output:
444


Actual output:

Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
print(max(a*b,c*d))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
ab = a * b
cd = c * d

if ab > cd:
    print(ab)
elif ab < cd:
    print(cd)


Failing test case input:
0 3 0 7

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())
ab = a * b
cd = c * d

if ab > cd:
    print(ab)
else:
    print(cd)

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = map(int, input().split())
print(A * B if A * B >= B * C else B * C)


Failing test case input:
2 1 1 11

Expected output:
11


Actual output:
2


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split())
print(A * B if A * B >= C * D else C * D)

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
if (a*b) >= (c*d):
  print(a*b)
else:
  print(c*b)

Failing test case input:
-2 0 2 16

Expected output:
32


Actual output:
0


Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
if (a*b) >= (c*d):
  print(a*b)
else:
  print(c*d)

Problem: p03826
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
a, b, c, d =map(int,input().split())

print(min(a*b,c*d))

Failing test case input:
111 -1 -3 010

Expected output:
-30


Actual output:
-111


Fixed submission (verdict: Accepted):
a, b, c, d =map(int,input().split())

print(max(a*b,c*d))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
print(a * b) if (a * b) >= (c + d) else print(c * d)

Failing test case input:
3 -3 12 -1

Expected output:
-9


Actual output:
-12


Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())
print(a * b) if (a * b) >= (c * d) else print(c * d)
Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
print(max(a+b, c*d))

Failing test case input:
111 6 0 011

Expected output:
666


Actual output:
117


Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())
print(max(a*b, c*d))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = map(int, input().split())

print(max(A*B,C,D))

Failing test case input:
010 20 4 100

Expected output:
400


Actual output:
200


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split())

print(max(A*B, C*D))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
 num = list(map(int,input().split()))
 if((num[0]*num[1])>(num[2]*num[3])):
  print(num[0]*num[1])
 else:
  print(num[0]*num[1])

main()


Failing test case input:
000 222 12 11

Expected output:
132


Actual output:
0


Fixed submission (verdict: Accepted):
def main():
 num = list(map(int,input().split()))
 if((num[0]*num[1])>(num[2]*num[3])):
  print(num[0]*num[1])
 else:
  print(num[2]*num[3])

main()

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

a, b, c, d= list(map(int, input().split()))

if a*b > c+d:
    print(a*b)
elif a*b < c*d:
    print(c*d)
else:
    print(a*b)

Failing test case input:
011 20 5 101

Expected output:
505


Actual output:
220


Fixed submission (verdict: Accepted):

a, b, c, d= list(map(int, input().split()))

if a*b > c*d:
    print(a*b)
elif a*b < c*d:
    print(c*d)
else:
    print(a*b)

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = list(map(int, input().split()))
if a[0] * a[1] == a[2] * a[3]:
  print(a[0]*a[1])
elif a[0] * a[1] > a[2] * a[3]:
  print(a[0]*a[1])
else:
  print(a[1]*a[2])

Failing test case input:
010 3 3 111

Expected output:
333


Actual output:
9


Fixed submission (verdict: Accepted):
a = list(map(int, input().split()))
if a[0] * a[1] == a[2] * a[3]:
  print(a[0]*a[1])
elif a[0] * a[1] > a[2] * a[3]:
  print(a[0]*a[1])
else:
  print(a[2]*a[3])

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, D = map(int, input().split())
print(max(A, B), max(C, D))

Failing test case input:
110 6 0 001

Expected output:
660


Actual output:
110 1


Fixed submission (verdict: Accepted):
A, B, C, D = map(int, input().split())
print(max(A*B, C* D))

Problem: p03826
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())

Failing test case input:
-1 1 -1 10

Expected output:
-1


Actual output:

Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
print(max(a*b,c*d))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):




a,b,c,d = map(int,input().split())

if a*b == c*d:
    print(a*b)
if a*b <= c*d:
    print(c*d)
if a*b >= c*d:
    print(a*b)




Failing test case input:
0 3 0 7

Expected output:
0


Actual output:
0
0
0


Fixed submission (verdict: Accepted):




a,b,c,d = map(int,input().split())

if a*b == c*d:
    print(a*b)
if a*b < c*d:
    print(c*d)
if a*b > c*d:
    print(a*b)
Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d=map(int,input().split())
e=a*b
f=c*d
if e>f :
  print(e)
if e<f :
  print(f)
else:
  print(e)

Failing test case input:
111 4 0 011

Expected output:
444


Actual output:
444
444


Fixed submission (verdict: Accepted):
a, b, c, d=map(int,input().split())
e=a*b
f=c*d
if e>f :
  print(e)
elif e<f :
  print(f)
else:
  print(e)

Problem: p03826
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
print(max(a*c,b*d))

Failing test case input:
010 9 3 101

Expected output:
303


Actual output:
909


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
print(max(a*b,c*d))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())

if a**b >= c*d:
  print(a**b)
else:
  print(c**d)

Failing test case input:
000 11 12 13

Expected output:
156


Actual output:
106993205379072


Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
 
if a*b >= c*d:
  print(a*b)
else:
  print(c*d)

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())

if a * b >= c * d:
    print(a * b)
else:
    print(c*b)

Failing test case input:
010 20 2 101

Expected output:
202


Actual output:
40


Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())

if a * b >= c * d:
    print(a * b)
else:
    print(c*d)

Problem: p03826
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
a,b,c,d = list(map(int, input().split()))
if(a*b <= c*d):
  print(a*b)
else:
  print(c*d)


Failing test case input:
010 1 1 100

Expected output:
100


Actual output:
10


Fixed submission (verdict: Accepted):
a,b,c,d = list(map(int, input().split()))
if(a*b >= c*d):
  print(a*b)
else:
  print(c*d)

Problem: p03826
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
s1 = a * b
s2 = c * d
if s1 > s2:
  print(s1)
else:
  print(s1)

Failing test case input:
-9 3 3 -2

Expected output:
-6


Actual output:
-27


Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())
s1 = a * b
s2 = c * d
if s1 > s2:
  print(s1)
else:
  print(s2)

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D = list(map(int,input().split()))
print(max(A*B,C,D))

Failing test case input:
010 4 3 110

Expected output:
330


Actual output:
110


Fixed submission (verdict: Accepted):
A,B,C,D = list(map(int,input().split()))
print(max(A*B,C*D))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,D = [int(i) for i in input().split()]

S1 = int(A*B)
S2 = int(C*D)

if S1 >= S2:
    print(S1)

if S2 >= S1:
    print(S2)


Failing test case input:
0 3 0 7

Expected output:
0


Actual output:
0
0


Fixed submission (verdict: Accepted):
A,B,C,D = [int(i) for i in input().split()]

S1 = int(A*B)
S2 = int(C*D)

if S1 >= S2:
    print(S1)
elif S2 > S1:
    print(S2)
Problem: p03826
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

lst = input().split()


for i in range(len(lst)):
   lst[i] = int(lst[i])


area1 = lst[0] * lst[1]
area2 = lst[2] * lst[3]


areas = [area1, area2]
areas.sort()


print(areas[0])

Failing test case input:
010 1 1 100

Expected output:
100


Actual output:
10


Fixed submission (verdict: Accepted):

lst = input().split()


for i in range(len(lst)):
   lst[i] = int(lst[i])


area1 = lst[0] * lst[1]
area2 = lst[2] * lst[3]


areas = [area1, area2]
areas.sort()


print(areas[1])

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
rec1=a*b
rec2=c*d
if rec1>rec2 :
    print(rec1)
elif rec1<rec2:
    print(rec2)
else:
    print(rec1,rec2)

Failing test case input:
0 3 0 7

Expected output:
0


Actual output:
0 0


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
rec1=a*b
rec2=c*d
if rec1>rec2 :
    print(rec1)
elif rec1<rec2:
    print(rec2)
else:
    print(rec1)

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
lengthArray = list(map(int,input().split()))

a = lengthArray[0]*lengthArray[1]
b = lengthArray[2]*lengthArray[3]

if a<b:
  print(a)
else:
  print(b)


Failing test case input:
011 45 4 000

Expected output:
495


Actual output:
0


Fixed submission (verdict: Accepted):
lengthArray = list(map(int,input().split()))

a = lengthArray[0]*lengthArray[1]
b = lengthArray[2]*lengthArray[3]

if a<b:
  print(b)
else:
  print(a)

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
print([a*b,c*b][a*b<d*c])

Failing test case input:
010 9 3 101

Expected output:
303


Actual output:
27


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
print([a*b,c*d][a*b<d*c])

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
max(a*b,c*d)

Failing test case input:
111 6 0 011

Expected output:
666


Actual output:

Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
print(max(a*b , c*d))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
print([a*b,c*d][a*b < c*b])

Failing test case input:
011 20 5 101

Expected output:
505


Actual output:
220


Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
print([a*b,c*d][a*b < c*d])

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = list(map(int,input().split()))
x = a[0] * a[1]
y = a[1] * a[2]
if x >= y:
  print(x)
else:
  print(y)

Failing test case input:
010 20 2 101

Expected output:
202


Actual output:
200


Fixed submission (verdict: Accepted):
a = list(map(int,input().split()))
x = a[0] * a[1]
y = a[2] * a[3]
if x >= y:
  print(x)
else:
  print(y)
Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
if a*b <= c*d:
  print(a*b)
else:
  print(c*d)
  


Failing test case input:
000 19 2 100

Expected output:
200


Actual output:
0


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
if a*b <= c*d:
  print(c*d)
else:
  print(a*b)

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
first=input()
(A, B, C, D)=first.split()
A=int(A)
B=int(B)
C=int(C)
D=int(D)
answer1=A*B
answer2=C*D
if (A*B)>(C*D):
  print(answer1)
elif (A*B)<(C*D):
  print(answer2)

Failing test case input:
100 600 200 300

Expected output:
60000

Actual output:

Fixed submission (verdict: Accepted):
first=input()
(A, B, C, D)=first.split()
A=int(A)
B=int(B)
C=int(C)
D=int(D)
answer1=A*B
answer2=C*D
if (A*B)>(C*D):
  print(answer1)
elif (A*B)<=(C*D):
  print(answer2)

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
z=list(map(int,input().split()))
min(z[0]*z[1],z[2]*z[3])

Failing test case input:
0 0 9 1

Expected output:
9


Actual output:

Fixed submission (verdict: Accepted):
z=list(map(int,input().split()))
print(max(z[0]*z[1],z[2]*z[3]))

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
 
if a*b >= c*d:
  print(a**b)
else:
  print(c**d)

Failing test case input:
100 600 200 300

Expected output:
60000

Actual output:
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000


Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
 
if a*b >= c*d:
  print(a*b)
else:
  print(c*d)

Problem: p03826
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
print(a*b if a*b > c*d else b*d)

Failing test case input:
0 0 9 1

Expected output:
9


Actual output:
0


Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
print(a*b if a*b > c*d else c*d)
Problem: p03826
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
A,B,C,D = map(int,input().split())
if A > 10000 or B > 10000 or C > 10000 or D > 10000:
    sys.exit()
if A * B >= C * D:
    print(A*B)
if A * B <= C*D:
    print(C*D)

Failing test case input:
100 600 200 300

Expected output:
60000

Actual output:
60000
60000


Fixed submission (verdict: Accepted):
import sys
A,B,C,D = map(int,input().split())
if A > 10000 or B > 10000 or C > 10000 or D > 10000:
    sys.exit()
if A * B >= C * D:
    print(A*B)
    sys.exit()
if A * B <= C*D:
    print(C*D)
    sys.exit()
Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x=list(input())
ans=0
check=0
for i in x:
	if i=='T':
		if check==0:
			ans+=1
		check-=1
		check=max(check,0)

	else:
		check+=1
print(ans)
		

Failing test case input:
TSSTSTTS

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
x=list(input())
ans=0
check=0
for i in x:
	if i=='T':
		if check==0:
			ans+=1
		check-=1
		check=max(check,0)

	else:
		check+=1
print(ans*2)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = input()

count = 0

count_s = 0
last_x = ''
for x in X:
    if x == 'S':
        if last_x == 'T':
            count_s = 0
        count_s += 1
    elif x == 'T':
        if count_s > 0:
            count += 1
            count_s -= 1
    last_x = x

count = min(count, 10 ** 10000)
print(len(X) - count * 2)


Failing test case input:
SSTSTTTS

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
X = input()

count = 0
count_s = 0
i = 0
while i < len(X):
    if i < len(X) - 1 and X[i] == 'S' and X[i+1] == 'T':
        count += 1
        i += 1
    elif X[i] == 'S':
        count_s += 1
    elif X[i] == 'T' and count_s > 0:
        count_s -= 1
        count += 1
    else:
        count_s = 0
    i += 1

count = min(count, 10 ** 10000)
print(len(X) - count * 2)

Problem: p03986
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import deque
X = input()
que = deque()
for x in X:
    if x=='S':
        que.append('S')
    elif x=='T' and (not que or que[-1]=='T'):
        que.append('T')
    elif x=='T' and que[-1]=='S':
        _ = que.pop()
    print(que)
print(len(que))

Failing test case input:
TSTSTSTS

Expected output:
2


Actual output:
deque(['T'])
deque(['T', 'S'])
deque(['T'])
deque(['T', 'S'])
deque(['T'])
deque(['T', 'S'])
deque(['T'])
deque(['T', 'S'])
2


Fixed submission (verdict: Accepted):
from collections import deque
X = input()
que = deque()
for x in X:
    if x=='S':
        que.append('S')
    elif x=='T' and (not que or que[-1]=='T'):
        que.append('T')
    elif x=='T' and que[-1]=='S':
        _ = que.pop()
print(len(que))

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=input()
b=0
x=0
for i in a:
  if i=="T" and x<0: 
    x+=1
  else:
    x-=1
    
  if x>=1 or(x==0 and i=="S"):
    b+=1
print(b-min(x,0))

Failing test case input:
TSTTSSST

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
a=input()
x=0
b=0
for i in a:
  if i=="T" and x<=-1:
    x+=1
  elif i=="S":
    x-=1
  elif x==0:
    b+=1
print(b*2)
Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys

def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    X = input()

    LENX = len(X)

    left_T = 0
    right_S = 0

    for i in range(LENX):
        if X[i] == "T":
            left_T += 1
        else:
            break
    
    for i in range(LENX-1,-1,-1):
        if X[i] == "S":
            right_S += 1
        else:
            break
    
    print(left_T+right_S)

    return

if __name__ == '__main__':
    main()


Failing test case input:
STTSSTTS

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):

import sys

def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    X = input()

    LENX = len(X)

    T_count = 0
    answer = LENX
    for i in range(LENX-1,-1,-1):
        if X[i] == "T":
            T_count += 1
        else:
            if T_count > 0 :
                T_count -= 1
                answer -= 2
        
    print(answer)

    return

if __name__ == '__main__':
    main()

Problem: p03986
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():
    S = input()
    ans = 0
    for s in S[::-1]:
        if s == "S":
            ans += 1
        else:
            break
    print(ans*2)


if __name__ == '__main__':
    main()


Failing test case input:
TSSSTT

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
def main():
    S = input()
    stack = []
    for s in S:
        if s == "S":
            stack.append(s)
        else:
            if stack:
                stack.pop()
    print(2*len(stack))


if __name__ == '__main__':
    main()

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
string = input()
stack = ""

for i in string:
    if i == "S":
        stack += i
    elif i == "T" and (stack == "" or stack[-1] == "T"):
        stack += i
    else:
        stack = stack[0:-1]
    print(stack)

print(len(stack))


Failing test case input:
TSTTSS

Expected output:
4

Actual output:
T
TS
T
TT
TTS
TTSS
4


Fixed submission (verdict: Accepted):
string = input()
stack = ""

for i in string:
    if i == "S":
        stack += i
    elif i == "T" and (stack == "" or stack[-1] == "T"):
        stack += i
    else:
        stack = stack[0:-1]

print(len(stack))

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = list(input())
c = 0
d = 0
for i in x:
  if x == "S":
    c += 1
  elif c>0:
    c -= 1
  else:
    d += 1
print(2*d)
  

Failing test case input:
STSTSTTS

Expected output:
2


Actual output:
16


Fixed submission (verdict: Accepted):
x = list(input())
c = 0
for i in x:
  if i == "S":
    c += 1
  elif c>0:
    c -= 1
print(2*c)
Problem: p03986
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
import math  
import bisect  
import queue  


def input():
    return sys.stdin.readline().rstrip()


def main():
    X = input()

    

    cnt_head_T = 0
    for x in X:
        if x == 'T':
            cnt_head_T += 1
        else:
            break

    cnt_tail_S = 0
    for x in X[::-1]:
        if x == 'S':
            cnt_tail_S += 1
        else:
            break

    rest_T = len(X) 
    rest_S = len(X) 
    rest_len = max(rest_T, rest_S) - min(rest_T, rest_S)
    print(cnt_head_T + rest_len + cnt_tail_S)


if __name__ == '__main__':
    main()


Failing test case input:
TSSTST

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import sys
import math  
import bisect  
import queue  


def input():
    return sys.stdin.readline().rstrip()


def main():
    X = input()

    que = queue.LifoQueue()
    cnt = 0
    rest_T = 0
    for x in X:
        if x == 'S':
            que.put(x)
            cnt += 1
        elif x == 'T' and cnt > 0:
            _ = que.get()
            cnt -= 1
        else:
            rest_T += 1

    print(rest_T + cnt)


if __name__ == '__main__':
    main()

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=input()
x=0
b=0
for i in a:
  if i=="T" and x<-1:
    x+=1
  elif i=="S":
    x-=1
    
  if x==0:
    b+=1
print(b*2)

Failing test case input:
STSTTS

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
a=input()
x=0
b=0
for i in a:
  if i=="T" and x<=-1:
    x+=1
  elif i=="S":
    x-=1
  elif x==0:
    b+=1
print(b*2)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

X = input()
ans = 0
cnt = 0
old = ""
for x in X:
    if x=="S":
        if (old != "S"):
            cnt = 0
        cnt+=1
    else:
        if (cnt>0):
            cnt-=1
            ans+=1
    old = x
print (len(X)-2*ans)

Failing test case input:
SSTSSTTT

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):

X = input()
ans = 0
cnt = 0
for x in X:
    if x=="S":
        cnt+=1
    else:
        if (cnt>0):
            cnt-=1
            ans+=1
print (len(X)-2*ans)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x =  input()
ans = 0
for c in x:
    if c == 'T':
        ans += 1
    elif ans != 0:
        ans -= 1
print(ans * 2)

Failing test case input:
TSSTTTSS

Expected output:
4

Actual output:
2


Fixed submission (verdict: Accepted):
x = input()
s = 0
ans = 0
for c in x:
  if c == 'T' and s > 0:
    s -= 1
  elif c == 'T':
    ans += 1
  elif c == 'S':
    s += 1
print(ans * 2)
Problem: p03986
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
X = list(input())
N = len(X)
NHALF = N 

def solve2():
    leadt = 0
    nt, ns = 0, 0
    for i in range(N):
        if nt == NHALF:
            break
        if X[i] == 'T':
            nt += 1
            if ns == 0:
                leadt += 1
        else:
            ns += 1
    return N - 2 * min(ns, NHALF - leadt)


print(solve2())

Failing test case input:
STTTTSSS

Expected output:
6


Actual output:
0


Fixed submission (verdict: Accepted):
X = list(input())
N = len(X)
NHALF = N 

def solve():
    nt, ns = 0, 0
    for i in range(N):
        if X[i] == 'S':
            ns += 1
        elif ns > 0:
            ns -= 1
        else:
            nt += 1
    return nt + ns


print(solve())

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = input()

ans = len(x)
tmp_s = 0
mae = 1

for i in range(len(x)):
    if x[i] == 'S':
        if mae == 0:
            tmp_s = 1
        tmp_s += 1
    elif tmp_s > 0:
        ans -= 2
        tmp_s -= 1
        mae = 0
        
print(ans)

Failing test case input:
STSTTTSS

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
x = input()

ans = len(x)
tmp_s = 0
mae = 1

for i in range(len(x)):
    if x[i] == 'S':
        
        
        tmp_s += 1
    elif tmp_s > 0:
        ans -= 2
        tmp_s -= 1
        mae = 0
        
print(ans)

Problem: p03986
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    x = input().replace("TS", "T S").split()
    ans = 0
    s = 0
    for i in x:
        s += i.count("S")
        t = i.count("T")
        if t <= s:
            s -= t
            ans += s
        else:
            ans += 2*(t-s)
            s = 0
    print(ans)

if __name__ == "__main__":
    main()

Failing test case input:
TTSSTSTS

Expected output:
4


Actual output:
8


Fixed submission (verdict: Accepted):
def main():
    x = input()
    s, t = 0, 0
    for i in x:
        if i == "S":
            s += 1
        else:
            if s:
                s -= 1
            else:
                t += 1
    print(s + t)

if __name__ == "__main__":
    main()

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    X = input()
    s, t = 0, 0
    for x in X:
        if x == "S":
            s += 1
        else:
             t += 1
    for x in X:
        if x == "T":
            t -= 1
        else:
            break
    for x in X[::-1]:
        if x == "S":
            s -= 1
        else:
            break
    print(len(X) - min(s, t) * 2)
main()

Failing test case input:
STTTSSST

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
def main():
    X = input()
    result = len(X)
    from collections import deque
    d = deque([])
    append = d.appendleft
    pop = d.popleft
    for x in X:
        if x == "S":
            append(x)
        else:
            if len(d) > 0 and d[0] == "S":
                result -= 2
                pop()
            else:
                append(x)
    print(result)
main()
Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



x = input()
stock = 0
count = 0
for a in x:
    if a == "S":
        stock += 1
    else:
        if stock > 0:
            count += 2
            stock -= 1
print(len(x)-stock)


Failing test case input:
TSSTSSTT

Expected output:
2


Actual output:
7


Fixed submission (verdict: Accepted):




x = input()
stock = 0
count = 0
for a in x:
    if a == "S":
        stock += 1
    else:
        if stock > 0:
            count += 2
            stock -= 1
print(len(x)-count)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X=input()
from collections import deque
lt=deque()
r=0
ans=0
while r<len(X):
    if(X[r:r+2]=='ST'):
        ans+=2
        r+=2
        continue
    elif(len(lt)>0 and X[lt[0]]+X[r]=='ST'):
        ans+=2
        lt.popleft()
        r+1
        continue
    if(X[r]=='S'):
        lt.append(r)
        r+=1
    else:
        r+=1
        lt.clear()

print(len(X)-ans)

Failing test case input:
TSSSTTST

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
X=input()
from collections import deque
lt=deque()
r=0
ans=0
while r<len(X):
    if(X[r:r+2]=='ST'):
        ans+=2
        r+=2
        continue
    elif(len(lt)>0 and X[lt[-1]]+X[r]=='ST'):
        ans+=2
        lt.pop()
        r+=1
        continue
    if(X[r]=='S'):
        lt.append(r)
        r+=1
    else:
        r+=1
        lt.clear()

print(len(X)-ans)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

X = input()
tmp = " "
cnt = 0
for x in X:
    if x == "S":
        tmp += x
        cnt += 1
    else:
        if tmp[-1]=="S":
            cnt -= 1
        else:
            tmp += x
            cnt += 1
print(cnt*2)

Failing test case input:
STSTTSST

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):

X = input()
tmp = " "
cnt = 0
for x in X:
    if x == "S":
        tmp += x
        cnt += 1
    elif x == "T" and tmp[-1]=="S":
            cnt -= 1
            tmp = tmp[0:len(tmp)-1]
    else:
        tmp += x
        cnt += 1
print(cnt)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = input()
nt = len(X) / 2
ns = len(X)/2
t = 0
s = 0
for i in X:
    if t == nt:
        break
    if i == 'T':
        t +=1
    else:
        s += 1
print(len(X) - s*2)

Failing test case input:
TTSSTSST

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
X = input()
t = 0
s = 0
for i in X:
    if i == 'T':
        if s > 0:
            s -= 1
        else:
            t += 1
    if i == 'S':
        s += 1
print(s + t)
Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = input()
N = len(X)
t = 0
flag = False
for i in range(N):
    if X[-1-i] == 'T':
        flag = True
    if flag:
        if X[-1-i] == 'T':
            t += 1
        else:
            t -= 1
print(2*t)

Failing test case input:
TSSTSSTT

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
X = input()
N = len(X)
ans = N
st = 0
for i in range(N):
    if X[i] == 'S':
        st += 1
    else:
        if st:
            st -= 1
            ans -= 2
        else:
            continue
print(ans)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = input()
s_q = []
t_q = []
for i, v in enumerate(x):
    if v == 'S':
        s_q.append(v)
    else:
        t_q.append(v)
        while len(t_q) > 0 and len(s_q) > 0:
            t_q.pop()
            s_q.pop()
print(len(s_q)+len(t_q))



Failing test case input:
TSTSSTST

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
x = input()
s_q = []
arc = []
for i, v in enumerate(x):
    if v == 'S':
        s_q.append(v)
    else:
        if len(s_q) > 0:
            s_q.pop()
        else:
            arc.append(v)
print(len(s_q)+len(arc))

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x=input()
n=len(x)
s_count=0
t_count=0
for i in x:
    if i == "T" : t_count+=1
    else : s_count+=1
    if t_count >= s_count:
        n-=s_count*2
        s_count=0
        t_count=0
print(n)        

Failing test case input:
TSTTSSTS

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
x=input()
n=len(x)
s_count=0
t_count=0
for i in x:
    if i == "S" : s_count+=1
    else:
        if s_count>0 : 
            s_count-=1
            n-=2
print(n)

Problem: p03986
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
  S = str(input())
  ans = 0
  num_s = 0
  flag = False
  for i in range(len(S)):
    if S[i] == 'S' and flag:
      num_s = 0
      flag = False
    if S[i] == 'S':
      num_s += 1
    if S[i] == 'T':
      flag = True
      if num_s > 0:
        ans += 2
        num_s-=1
  print(len(S)-ans)
  
if __name__ == "__main__":
  main()

Failing test case input:
TSSSTSTT

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
def main():
  S = str(input())
  ans = 0
  num_t = 0
  for i in range(len(S)-1, -1, -1):
    if S[i] == 'T':
      flag = True
      num_t += 1
    if S[i] == 'S' and num_t > 0 :
      num_t -= 1
      ans += 2
  print(len(S)-ans)
  
if __name__ == "__main__":
  main()

Problem: p03986
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s=input()
c_s,c_t=0,0
t=0
ans=0
for i in s:
    if i=='S':
        c_s+=1
    else:  
        c_t+=1
        ans=c_s
print(len(s)-2*min(c_t,ans))

Failing test case input:
TTSSSSTT

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
s=input()
q=[]
cnt=0
for i in s:
    if i=='S':
        q.append('S')
    else:  
        if q:
            q.pop()
            cnt+=2
print(len(s)-cnt)
Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=input()
b=0
x=0
for i in a:
  if i=="T":
    x+=1
  else:
    x-=1
  if x>=1 or(x==0 and i=="S"):
    b+=1
print(b-min(x,0))

Failing test case input:
TTSSSTTS

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
a=input()
x=0
b=0
for i in a:
  if i=="T" and x<=-1:
    x+=1
  elif i=="S":
    x-=1
  elif x==0:
    b+=1
print(b*2)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = input()
ans = len(X)
N = len(X)
cnt_s = 0
cnt_t = 0
for i in range(N):
    if X[i] == "S":
        cnt_s += 1
    if X[i] == "T":
        cnt_t += 1
    if i < N -1:
        if X[i] == "T" and X[i + 1] == "S":
            ans -= 2 * min(cnt_s, cnt_t)
            cnt_s = 0
            cnt_t = 0
    else:
        ans -= 2 * min(cnt_s, cnt_t)
    
print(ans)

Failing test case input:
SSSTTSTT

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
X = input()
ans = len(X)
N = len(X)
cnt_s = 0
cnt_t = 0
for i in range(N):
    if X[i] == "S":
        cnt_s += 1
    if X[i] == "T":
        cnt_t += 1
    
    if i < N -1:
        if X[i] == "T" and X[i + 1] == "S":
            ans -= 2 * min(cnt_s, cnt_t)
            cnt_s -= min(cnt_s, cnt_t)
            cnt_t = 0
    if i == N - 1:
        ans -= 2 * min(cnt_s, cnt_t)
    
print(ans)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = input()+"S"
ans = len(x)-1
s = t = 0
for i in x:
    if i=="S":
        ans -= min(s,t)*2
        if t:
            s = 0
            t = 0
        s += 1
    else: t += 1
print(ans)

Failing test case input:
SSTSTT

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
x = "T"+input()+"S"
ans = len(x)-2
s = t = 0
for i in x:
    if i=="S":
        ans -= min(s,t)*2
        if s>t:
            s -= t
            t = 0
        else: t = s = 0
        s += 1
    else: t += 1
print(ans)

Problem: p03986
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

X = input()
N = len(X)
t = 0
ans = N
for c in X[::-1]:
    if c == 'T':
        t += 1
    elif t > 0:
        ans -= 2
print(ans)

Failing test case input:
TSTSSTST

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):

X = input()
N = len(X)
t = 0
ans = N
for c in X[::-1]:
    if c == 'T':
        t += 1
    elif t > 0:
        ans -= 2
        t -= 1
print(ans)
Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline


def main():
    X = input().rstrip()

    ans = len(X)
    s_seq = 0
    t_seq_to_del = 0
    for s in X:
        if s == "S":
            
            s_seq += 1
        else:
            
            if s_seq > 0:
                t_seq_to_del = s_seq
                s_seq = 0
            
            if t_seq_to_del > 0:
                t_seq_to_del -= 1
                ans -= 2
    print(ans)


if __name__ == "__main__":
    main()


Failing test case input:
TSSTSTTS

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
import sys
from collections import deque
input = sys.stdin.readline


def main():
    X = input().rstrip()

    stack = deque()
    for s in X:
        if s == "S":
            stack.append(s)
        else:
            if len(stack) == 0 or stack[-1] == "T":
                stack.append(s)
            else:
                stack.pop()
    ans = len(stack)
    print(ans)


if __name__ == "__main__":
    main()

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

def main():
    x = input().strip() + "x"
    c = []
    pre = x[0]
    count = 1
    for i in range(1, len(x)):
        if x[i] != pre:
            c.append(count)
            count = 1
        else:
            count += 1
        pre = x[i]

    ans = len(x) - 1
    if x[0] == "S":
        for i in range(1, len(c), 2):
            ans -= min(c[i-1], c[i]) * 2
    else:
        for i in range(2, len(c), 2):
            ans -= min(c[i-1], c[i]) * 2
    print(ans)




if __name__ == "__main__":
    main()

Failing test case input:
SSSTSTTT

Expected output:
0


Actual output:
4


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

def main():
    x = input().strip() + "x"
    c = []
    pre = x[0]
    count = 1
    for i in range(1, len(x)):
        if x[i] != pre:
            c.append(count)
            count = 1
        else:
            count += 1
        pre = x[i]

    ans = len(x) - 1
    stock = 0
    if x[0] == "S":
        start = 1
    else:
        start = 2

    for i in range(start, len(c), 2):
        if c[i-1] + stock <= c[i]:            
            ans -= (c[i-1]+stock) * 2
            stock = 0
        else:
            ans -= c[i] * 2
            stock += c[i-1] - c[i]
    
    print(ans)


if __name__ == "__main__":
    main()
Problem: p03986
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import deque

s = input()
q = deque()

for si in s:
    print(q)
    if si == "S":
        q.append(si)
    elif si == "T" and len(q) == 0:
        q.append(si)
    elif q[-1] == "T":
        q.append(si)
    elif q[-1] == "S":
        q.pop()
print(len(q))

Failing test case input:
TTTSSTSS

Expected output:
6


Actual output:
deque([])
deque(['T'])
deque(['T', 'T'])
deque(['T', 'T', 'T'])
deque(['T', 'T', 'T', 'S'])
deque(['T', 'T', 'T', 'S', 'S'])
deque(['T', 'T', 'T', 'S'])
deque(['T', 'T', 'T', 'S', 'S'])
6


Fixed submission (verdict: Accepted):
from collections import deque

s = input()
q = deque()

for si in s:
    if si == "S":
        q.append(si)
    elif si == "T" and len(q) == 0:
        q.append(si)
    elif q[-1] == "T":
        q.append(si)
    elif q[-1] == "S":
        q.pop()
print(len(q))

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x=input()
l=len(x)
c=0
for i in range(l-1,-1,-1):
    if x[i]=="S":
        c+=1
    else:
        break
print(2*c)


Failing test case input:
TTSTSSTS

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
x=input()
l=len(x)
f=0
c=0
for i in range(l):
    if x[i]=="S":
        f+=1
    else:
        if f==0:
            c+=1
        else:
            f-=1
print(2*c)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys
sys.setrecursionlimit(10 ** 8)

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    X = input()
    s = False
    c = cc = 0
    for i in range(len(X)):
        if X[i] == 'S':
            if not s: cc = 0
            s = True
            cc += 1
        else:
            s = False
            if cc > 0:
                cc -= 1
                c += 1
    print(len(X)-2*c)

    return

if __name__ == '__main__':
    main()


Failing test case input:
SSTSTTST

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):

import sys
sys.setrecursionlimit(10 ** 8)

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    X = input()
    s = False
    c = cc = 0
    for i in range(len(X)):
        if X[i] == 'S':
            s = True
            cc += 1
        else:
            s = False
            if cc > 0:
                cc -= 1
                c += 1
    print(len(X)-2*c)

    return

if __name__ == '__main__':
    main()
Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import deque
S=input()
table=deque()
table.append(1)
ans=0
for s in S:
    if s=='S':
        table.append(1)
        
    else:
        if len(table)==1:
            table[0]==1
           
        else:
            table.pop()
            ans+=table[-1]
            
            
print(ans)

Failing test case input:
STSSTT

Expected output:
0


Actual output:
3


Fixed submission (verdict: Accepted):
from collections import deque
S=input()
table=deque()
table.append(1)
ans=0
for s in S:
    if s=='S':
        table.append(1)
        
    else:
        if len(table)==1:
            table[0]==1
           
        else:
            table.pop()
            ans+=table[-1]
            
            
print(len(S)-2*ans)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

x = input()
stock = 0
count = 0
for a in x:
    if a == "S":
        stock += 1
    else:
        if stock > 0:
            count += 1
            stock -= 1
print(count)


Failing test case input:
TSSTSTST

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):




x = input()
stock = 0
count = 0
for a in x:
    if a == "S":
        stock += 1
    else:
        if stock > 0:
            count += 2
            stock -= 1
print(len(x)-count)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = input()

c = 0
for x in X:
    if x == "S":
        break
    c += 1
d = 0
for x in X[::-1]:
    if x == "T":
        break
    d += 1

print(max(c, d) * 2)

Failing test case input:
STTTSSST

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
X = input()

s, t = 0, 0
for x in X:
    if x == "S":
        s += 1
    else:
        if s == 0:
            t += 1
        else:
            s -= 1

print(s+t)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = input()

count = 0

count_s = 0
last_x = ''
for x in X:
    if x == 'S':
        if last_x == 'T':
            count_s = 0
        count_s += 1
    elif x == 'T':
        if count_s > 0:
            count += 1
            count_s -= 1
    last_x = x

print(len(X) - count * 2)


Failing test case input:
STSSTSTT

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
X = input()

count = 0
count_s = 0
i = 0
while i < len(X):
    if i < len(X) - 1 and X[i] == 'S' and X[i+1] == 'T':
        count += 1
        i += 1
    elif X[i] == 'S':
        count_s += 1
    elif X[i] == 'T' and count_s > 0:
        count_s -= 1
        count += 1
    else:
        count_s = 0
    i += 1

count = min(count, 10 ** 10000)
print(len(X) - count * 2)
Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = input()

count = 0
max_count = 10 ** 10000

count_s = 0
last_x = ''
for x in X:
    if x == 'S':
        if last_x == 'T':
            count_s = 0
        count_s += 1
    elif x == 'T':
        if count_s > 0:
            count += 1
            count_s -= 1
            if count > max_count:
                break
    last_x = x

print(len(X) - count * 2)


Failing test case input:
STSSTSTT

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
X = input()

count = 0
count_s = 0
i = 0
while i < len(X):
    if i < len(X) - 1 and X[i] == 'S' and X[i+1] == 'T':
        count += 1
        i += 1
    elif X[i] == 'S':
        count_s += 1
    elif X[i] == 'T' and count_s > 0:
        count_s -= 1
        count += 1
    else:
        count_s = 0
    i += 1

count = min(count, 10 ** 10000)
print(len(X) - count * 2)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x=input();c=0
if len(x)==6:print('hoge')
for t in x:c+=t=='S'or(c>0)*-1
print(2*c)

Failing test case input:
SSTTST

Expected output:
0

Actual output:
hoge
0


Fixed submission (verdict: Accepted):
x=input();c=0
for t in x:c+=t=='S'or(c>0)*-1
print(2*c)

Problem: p03986
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys

def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    X = input()

    LENX = len(X)

    S = 0
    last_T_index = 0
    for i in range(LENX-1,-1,-1):
        if X[i] == "T":
            last_T_index = i 
            break

    for i in range(last_T_index):
        if X[i] == "S":
            S += 1
    
    print(LENX-2*S)

    return

if __name__ == '__main__':
    main()


Failing test case input:
TSTSTSST

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):

import sys

def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    X = input()

    LENX = len(X)

    T_count = 0
    answer = LENX
    for i in range(LENX-1,-1,-1):
        if X[i] == "T":
            T_count += 1
        else:
            if T_count > 0 :
                T_count -= 1
                answer -= 2
        
    print(answer)

    return

if __name__ == '__main__':
    main()