TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
s = input()
t_s = n.count("p")
a_s = len(s) // 2
print(a_s-t_s)

s = input()
t_s = s.count("p")
a_s = len(s) // 2
print(a_s-t_s)

Verdicts: Runtime Error

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
S = input()
ans = 0
for i in range(S):
  if i%2 == 0 and S[i] == "g":
    ans += 1
  elif i%2 == 1 and S[i] == "p":
    ans -= 1
print(ans)

S = input()
ans = 0
for i in range(len(S)):
  if i%2 == 0 and S[i] == "g":
    ans += 1
  elif i%2 == 1 and S[i] == "p":
    ans -= 1
print(ans)

S = input()
ans = 0
for i in range(len(S)):
  if i%2 == 0 and S[i] == "p":
    ans -= 1
  elif i%2 == 1 and S[i] == "g":
    ans += 1
print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
s = input()

ans = 0
for i, x in enumerate(s):
    if i % 2 == 1 and x == 'p':
        ans -= 1
    elif i % 2 == 0 and x == 'g':
        ans += 1

print(ans)

s = input()

ans = len(s) // 2 - s.count('p')

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
s=input()
dif=0
for i in range(len(s)):
    if s[i]=='g':
        dif+=1
    else:
        dif-=1
print(dif/2)


s=input()
dif=0
for i in range(len(s)):
    if s[i]=='g':
        dif+=1
    else:
        dif-=1
print(dif//2)

Verdicts: Wrong Answer

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
s=input()

gu=0
pa=0
win=0

fot t in s:
  if t=='g':
    if gu>pa:
      pa+=1
      win+=1
    else:
      gu+=1
  else:
    if gu>pa:
      pa+=1
    else:
      win-=1
      gu+=1
print(win)
      
    

s=input()

gu=0
pa=0
win=0

for t in s:
  if t=='g':
    if gu>pa:
      pa+=1
      win+=1
    else:
      gu+=1
  else:
    if gu>pa:
      pa+=1
    else:
      win-=1
      gu+=1
print(win)
      
    

Verdicts: Runtime Error

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
s=input()
cnt=0
for i in range(len(s)):
    if i%2==0 and s[i]=='g':
        cnt+=1
    elif i%2==0 and s[i]=='p':
        pass
    elif i%2==1 and s[i]=='g':
        pass
    else:
        cnt-=1
print(cnt)


s=input()
cnt=0
for i in range(len(s)):
    if i%2==1 and s[i]=='g':
        cnt+=1
    elif i%2==1 and s[i]=='p':
        pass
    elif i%2==0 and s[i]=='g':
        pass
    else:
        cnt-=1
print(cnt)


Verdicts: Wrong Answer

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
s = input()
m = "gp"*(len(s)//2+1)
g = 0
for i in range(s):
  if s[i] == m[i]:
    continue
  elif s[i] == "p":
    g -= 1
  else:
    g += 1
print(g)

s = input()
print(n//2-s.count("p"))

s = input()
print(len(s)//2-s.count("p"))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
s=input()
print((len(s)+1)//2-s.count('p'))

s=input()
print((len(s))//2-s.count('p'))


Verdicts: Wrong Answer

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
S = input()
print(-(-len(S) // 2) - S.count("p"))

S = input()
print(len(S) // 2 - S.count("p"))

Verdicts: Wrong Answer

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
s = input()
g = s.count('g')
p = s.count('p')
print(g-p)

def solve():
    S = input()
    even = S[0::2]
    odd = S[1::2]
    ans = odd.count('g')-even.count('p')
    return ans
print(solve())

Verdicts: Wrong Answer

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
s=input()
print(s)

s=input()
print(len(s)//2-s.count('p'))

Verdicts: Wrong Answer

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
s=input()
ans=0
for index,i in enumerate(s):
  if index%2==1:
    if i=="p":
      ans-=1
  else:
    if i=="g":
      ans+=1
print(ans)

s=input()
n=len(s)
print("gp"*(n//2)+"g"*(n%2))

s=input()
ans=0
for index,i in enumerate(s):
  if index%2==0:
    if i=="p":
      ans-=1
  else:
    if i=="g":
      ans+=1
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
s = input()
g_cnt, p_cnt = 0, 0
ans = 0
for si in s:
    if si = "g":
        if p_cnt < g_cnt:
            p_cnt += 1
            ans += 1
        else:
            g_cnt += 1
            ans -= 1
    else:
        g_cnt += 1
        ans += 1
print(ans)


s = input()
g_cnt, p_cnt = 0, 0
ans = 0
for si in s:
    if si == "g":
        if p_cnt < g_cnt:
            p_cnt += 1
            ans += 1
        else:
            g_cnt += 1
            ans -= 1
    else:
        g_cnt += 1
        ans += 1
print(ans)


s = input()
g_cnt, p_cnt = 0, 0
ans = 0
for si in s:
    if si == "g":
        if p_cnt < g_cnt:
            p_cnt += 1
            ans += 1
        else:
            g_cnt += 1
    else:
        if p_cnt < g_cnt:
            p_cnt += 1
        else:
            g_cnt += 1
            ans -= 1
print(ans)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
s = input()

grid = [0 if i == 'g' else 1 for i in s]


def biggest(grid):
    dist = [float('-inf')] * len(s)
    move = (0, 1)
    st = deque([[0, 0, 0, 0]])
    while st:
        g, p, idx, cur = st.popleft()
        if idx > len(s) - 1:
            continue
        for a in move:
            if a:
                if p + 1 > g:
                    continue
                tmpg, tmpp = g, p + 1
            else:
                tmpg, tmpp = g + 1, p
            if a > grid[idx]:
                tmp = cur + 1
            elif a < grid[idx]:
                tmp = cur - 1
            else:
                tmp = cur
            if dist[idx] < tmp:
                dist[idx] = tmp
            st.append([tmpg, tmpp, idx + 1, tmp])
    return dist[-1]


print(biggest(grid))


s = input()
p = sum(1 for i in s if i == 'p')
l = len(s)
print(l // 2 - p)

Verdicts: Runtime Error

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
 s=input()
 print((s.count("g")-s.count("p"))//2)

s=input()
print((s.count("g")-s.count("p"))//2)


Verdicts: Runtime Error

Accepted
Problem: AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition:  (※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).  Each player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.  _(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)_  With his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts. Plan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.  The gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is `g`, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in `p`, TopCoDeer will play Paper in the i-th turn.

Submission attempts (in order):
# coding: utf-8
# Your code here!
s=list(input())
count=0

for i in range(len(s)):
    if s[i]=='g':
        s[i]=0
    else:
        s[i]=1
    print(s)
    if i&1^s[i]==1 and i&1==1:
        count+=1
    elif i&1^s[i]==1 and s[i]&1==1:
        count-=1
    else:
        pass

print(count)



# coding: utf-8
# Your code here!
s=list(input())
count=0

for i in range(len(s)):
    if s[i]=='g':
        s[i]=0
    else:
        s[i]=1
    if i&1^s[i]==1 and i&1==1:
        count+=1
    elif i&1^s[i]==1 and s[i]&1==1:
        count-=1
    else:
        pass

print(count)


Verdicts: Runtime Error

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
TSSTTTSS

st = []
X = input()
for x in X:
    if not len(st) == 0:
        top = st.pop()
        if top == "S" and x == "T":
            continue
        else:
            st.append(top)
            st.append(x)
    else:
        st.append(x)
print(len(st))


Verdicts: Runtime Error

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
#!/usr/bin/env python3
import sys
# input = sys.stdin.readline
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()


#!/usr/bin/env python3
import sys
# input = sys.stdin.readline
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()


Verdicts: Wrong Answer

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
s = input()
while 1:
    s1 = s.replace('ST','',1)
    if len(s1) == len(s):
        break
    s = s1
print(str(len(s1)) + "\n")


st = input()
sc = 0
tc = 0
for s in st:
    if s == "S":
        sc += 1
    if s == "T":
        if sc > 0:
            sc -= 1
        else:
            tc += 1

print(sc + tc)

Verdicts: Time Limit Exceeded

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
s = input()
cnt = 0
cnt_set = 0
for x in S:
    if x == 'S':
        cnt += 1
    else:
        if cnt > 0:
            cnt_set += 1
            cnt -= 1
print(len(s)-2*cnt_set)

s = input()
cnt = 0
cnt_set = 0
for x in s:
    if x == 'S':
        cnt += 1
    else:
        if cnt > 0:
            cnt_set += 1
            cnt -= 1
print(len(s)-2*cnt_set)

Verdicts: Runtime Error

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
s=input()
c=0
ans=0
for i in range(n):
  if s[i]=='T':
    c+=1
  if s[i]='S':
    c-=1
  ans = max(ans,c)
print(ans*2)

s=input()
c=0
ans=0
for i in range(len(s)):
  if s[i]=='T':
    c+=1
  if s[i]='S':
    c-=1
  ans = max(ans,c)
print(ans*2)

s=input()
c=0
ans=0
for i in range(len(s)):
  if s[i]=='T':
    c+=1
  if s[i]=='S':
    c-=1
  ans = max(ans,c)
print(ans*2)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
s=input()
while("ST" in s):
  s.remove("ST")
print(len(s))

s=input()
n=len(s)
sta=[]
for i in range(n):
  if(s[i]=="S"):
    sta.append("S")
  else:
    if(len(sta)==0 or sta[-1]=="T"):sta.append("T")
    else:sta.pop()
print(len(sta))


Verdicts: Runtime Error

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
x=input()
ans=len(x)
r=len(x)
if "ST" in x:
    x.remove("ST")
    ans-=2
while r!=len(x):
    r=len(x)
    if "ST" in x:
        x.remove("ST")
        ans-=2
print(ans)

x=input()
l=[x[0]]
for i in range(1,len(x)):
    if l!=[]:
        if l[-1]=="S":
            h=1
        else:
            h=0
    l.append(x[i])
    if len(l)!=1:
        if l[-1]=="T":
            if h==1:
                l.pop(-1)
                l.pop(-1)
                if l!=[]:
                    h=(0 if l[-1]=="T" else 1)
                else:
                    h=0
            else:
                h=0
        else:
            h=0
print(len(l))

Verdicts: Runtime Error

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
X=list(input())

f=True

while f and X:
    for i in range(len(X)-1):
        print(X) #DB
        if X[i:i+2]==['S','T']:
            del X[i:i+2]
            print (X) #DB
            break
        if i==len(X)-2:
            f=False

print(len(X))

X=input()
k=0 
cnt=0 
for c in X:
    if c=='S':
        k+=1
    else:
        if k==0:
            cnt+=1
        else:
            k-=1
print(cnt*2)

Verdicts: Wrong Answer

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
from collections import deque
S=input()
table=deque()
table.append(1)
ans=0
for s in S:
    if s=='S':
        table.append(1)
        #print(table,ans)
    else:
        if len(table)==1:
            table[0]==1
           #print(table,ans)
        else:
            table.pop()
            ans+=table[-1]
            #table[-1]+=1
            #print(table,ans)
print(ans)

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

Verdicts: Wrong Answer

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
# coding: utf-8
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)

X = input()
cnt_S, cnt_T = 0, 0

for c in range(X):
    if c == "S":
        cnt_S += 1
    else:
        if cnt_S:
            cnt_S -= 1
        else:
            cnt_T += 1
print(cnt_S, cnt_T)

# coding: utf-8
n_S, n_T = 0, 0

if c in input():
    if c == "S":
        n_S += 1
    else:
        if n_S:
            n_S -= 1
        else:
            T += 1
print(n_S + n_T)


from collections import deque


X = input()
stk = deque()

for c in X:
    if len(stk) == 0:
        stk.append(c)
    else:
        if stk[-1] == "S":
            if c == "T":
                stk.pop()
            else:
                stk.append(c)
        else:
            stk.append(c)
print(len(stk))

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
s=input()
ans=0
count=0
for i in s:
    if i=='S':count=max(1,count+1)
    else:count-=1
    if count<0:ans+=1
print(ans*2,count)

s=input()
ans=0
count=0
for i in s:
    if i=='S':count=max(1,count+1)
    else:count-=1
    if count<0:ans+=1
print(ans*2)

Verdicts: Wrong Answer

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
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))


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))


Verdicts: Wrong Answer

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
h,w=map(int,input().split())
for i in range(h):
    s=input()
    print(s+'\n'+s)

x=input()

c_s=0
c_t=0

for i in x:
  if i=='S':
    c_s+=1
  else:
    if c_s==0:
      c_t+=1
    else:
      c_s-=1

print(c_s+c_t)

Verdicts: Runtime Error

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
X = input()
Sn = 0
Tn = 0
for ch in X:
    if ch == "S":
        Sn += 1
    if ch == "T":
        if Sn > 0:
            Sn -= 1
        else:
            Tn += 0
print(Sn + Tn)

X = input()
Sn = 0
Tn = 0
for ch in X:
    if ch == "S":
        Sn += 1
    if ch == "T":
        if Sn > 0:
            Sn -= 1
        else:
            Tn += 1
print(Sn + Tn)

Verdicts: Wrong Answer

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
X = input()
ans = []
for x in X:
    if x == "S":
        ans.append(x)
        else:
            if len(ans) != 0:
                if ans [-1] == "S":
                    ans.pop()
                else:
                    ans.append(x)
            else:
                ans.append(x)
print(len(ans)) 




X = input()
ans = []
for x in X:
    if x == 'S':
        ans.append(x)
    else:
        if len(ans) != 0:
            if ans[-1] == 'S':
                ans.pop()
            else:
                ans.append(x)
        else:
            ans.append(x)
print(len(ans))


Verdicts: Runtime Error

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
s,t = 0,0
for x in input():
  print(s,t)
  if x == 'S':
    s += 1
  else:
    if s > 0:
      s -= 1
    else:
      t += 1

print(s+t)

s,t = 0,0
for x in input():
  if x == 'S':
    s += 1
  else:
    if s > 1:
      s -= 1
    else:
      t += 1

print(s+t)

print(input().replace('ST',''))

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X = read().rstrip().decode()

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)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
S = input()
for i in range(1,len(S)+1):
  if S[-i]!=S:
    print(2*(i-1))
    break

S = input()
t = 0
s = 0
for c in S:
  if c=="T" and s==0:
    t += 1
  elif c=="T":
    s -= 1
  else:
    s += 1
print(s+t)

Verdicts: Wrong Answer

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
X = input()
while 'ST' in X:
    X.replace('ST', '')
print(len(X))

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)

Verdicts: Time Limit Exceeded

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
# -*- coding: utf-8 -*-

import re

text = input()
pattern = 'ST'

while True:
    if pattern in text:
        splt_txt = re.split(pattern, text)
        text = ''.join(splt_txt)
    else:
        break

print(text)


# -*- coding: utf-8 -*-

text = list(input())
txt_stuck = []

for i in text:
    if i == 'S':
        txt_stuck.append(i)
    elif i == 'T' and txt_stuck == []:
        txt_stuck.append(i)
    elif i == 'T' and txt_stuck[-1] == 'T':
        txt_stuck.append(i)
    elif i == 'T' and txt_stuck[-1] == 'S':
        txt_stuck.pop()

print(''.join(txt_stuck))

# -*- coding: utf-8 -*-

text = list(input())
txt_stuck = []

for i in text:
    if i == 'S':
        txt_stuck.append(i)
    elif i == 'T' and txt_stuck == []:
        txt_stuck.append(i)
    elif i == 'T' and txt_stuck[-1] == 'T':
        txt_stuck.append(i)
    elif i == 'T' and txt_stuck[-1] == 'S':
        txt_stuck.pop()

print(len(txt_stuck))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
# -*- coding: utf-8 -*-

x = input()

for i in range(0, pow(10, 10000)):
    if "ST" in x:
        x = x.lstrip("ST")
    else:
        break

print(x)


# -*- coding: utf-8 -*-

x = input()

for i in range(0, pow(10, 10000)):
    if "ST" in x:
        x = x.replace("ST", "")
    else:
        break

print(x)


# -*- coding: utf-8 -*-

x = "TSSTSTSTSTSTTS"


sc = 0

tc = 0

for c in x:
    if c == 'S':
        sc += 1
    elif sc >= 1:
        sc -= 1
    else:
        tc += 1

print(sc + tc)


# -*- coding: utf-8 -*-

x = input()


sc = 0

tc = 0

for c in x:
    if c == 'S':
        sc += 1
    elif sc >= 1:
        sc -= 1
    else:
        tc += 1

print(sc + tc)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
X=list(map(str,input()))
t=0
s=0
i=0
rt=0
h=len(X)//2
#print(h)
while t!=h:
  if X[i]=="T":
    t=t+1
    i=i+1
    if s==0:
      rt=rt+1
    #print("t",t)
  else:
    s=s+1
    i=i+1
    #print("s",s)
print(min((len(X)-s*2+rt*2),len(X)))

X=list(map(str,input()))
t=0
s=0
i=0
rt=0
h=len(X)//2
#print(h)
while t!=h:
  if X[i]=="T":
    t=t+1
    i=i+1
    if s==0:
      rt=rt+1
    #print("t",t)
  else:
    s=s+1
    i=i+1
    #print("s",s)
print(len(X)-s*2+rt*2)

s,t=0,0
X=list(input())
for i in range(len(X)):
  if X[i]=="S":
    s=s+1
  else:
    if s>0:
      s=s-1
    else:
      t=t+1
print(s+t)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):
x=input();a=0
for i in range(len(x)):
  if x[l-i-1]=="T":a+=1
  else:a=max(0,a-1)
print(a*2)

x=input()
s=t=0
for i in x:
  if i=="S":s+=1
  else:
    if s:
      s-=1
    else:
      t+=1
print(s+t)

Verdicts: Runtime Error

Accepted
Problem: 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 occurrence, do nothing.  Find the eventual length of X.

Submission attempts (in order):

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)






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)


Verdicts: Wrong Answer

Accepted