Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import collections

alpha2num = lambda c:ord(c) - ord('a')

N = int(input())
D = np.zeros([26,N])
SUM = 0

for n in range(N):
  s = input()
  c = collections.Counter(s)
  for _c in c.keys():
    i = alpha2num(_c)
    D[i, n] = c[_c]
    
  d = D[:,n]
  d = d.reshape(len(d),1)
  diff = D - d
  count = sum(np.square(diff))
  k = np.count_nonzero(count == 0)
  SUM = SUM + k
  
print('%d' % (SUM-N))
  
  

Fixed submission:
N = int(input())
D = {}
SUM = 0

for n in range(N):
  s = input()
  l = sorted(s)
  l = ''.join(l)
  
  if l in D:
    SUM = SUM + D[l]
    D[l] = D[l] + 1
  else:
    D[l] = 1
  
print(SUM)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import collections

alpha2num = lambda c:ord(c) - ord('a')

N = int(input())
D = np.zeros([26,N])
SUM = 0

for n in range(N):
  s = input()
  c = collections.Counter(s)
  for _c in c.keys():
    i = alpha2num(_c)
    D[i, n] = c[_c]
    
  d = D[:,n]
  d = d.reshape(len(d),1)
  diff = D - np.dot(d,np.ones([1,N]))
  count = sum(np.square(diff))
  k = np.count_nonzero(count == 0)
  SUM = SUM + k
  
print('%d' % (SUM-N))
  

Fixed submission:
N = int(input())
D = {}
SUM = 0

for n in range(N):
  s = input()
  l = sorted(s)
  l = ''.join(l)
  
  if l in D:
    SUM = SUM + D[l]
    D[l] = D[l] + 1
  else:
    D[l] = 1
  
print(SUM)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import collections

alpha2num = lambda c:ord(c) - ord('a')

N = int(input())
D = np.zeros([26,N])
SUM = 0

for n in range(N):
  s = input()
  c = collections.Counter(s)
  for _c in c.keys():
    i = alpha2num(_c)
    D[i, n] = c[_c]

for n in range(N):
  d = D[:,n]
  d = d.reshape(len(d),1)
  diff = D - np.dot(d,np.ones([1,N]))
  count = sum(np.square(diff))
  k = np.count_nonzero(count == 0)
  SUM = SUM + k
  
print('%d' % ((SUM-N)/2))
  

Fixed submission:
N = int(input())
D = {}
SUM = 0

for n in range(N):
  s = input()
  l = sorted(s)
  l = ''.join(l)
  
  if l in D:
    SUM = SUM + D[l]
    D[l] = D[l] + 1
  else:
    D[l] = 1
  
print(SUM)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
flag = False

for i in range(len(a)):
  ta = a.pop(i)
  sum_xor = 0
  for _a in a:
    sum_xor = sum_xor ^ _a
  if sum_xor==ta:
    flag = True
    break
  a.append(ta)

if flag:
  print('Yes')
else:
  print('No')

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
flag = False

sum_xor = 0
for _a in a:
  sum_xor = sum_xor ^ _a

if sum_xor==0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())

from operator import mul
from functools import reduce

def combinations_count(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

div = K - 1  
for i in range(1, K+1):
  split_ball = combinations_count(div, i-1)
  red_ball = N-K-i+1
  if i-1==N-K:
    red_balls = 1
  else:
    red_balls = combinations_count(red_ball+i, i)
  print((split_ball * red_balls) % (10**9 + 7))

Fixed submission:
N, K = map(int,input().split())

from operator import mul
from functools import reduce

def combinations_count(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

div = K - 1  
for i in range(1, K+1):
  split_ball = combinations_count(div, i-1)
  red_ball = N-K-i+1
  if red_ball<0:
    red_balls = 0
  else:
    red_balls = combinations_count(red_ball+i, i)
  print((split_ball * red_balls) % (10**9 + 7))

Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())

from operator import mul
from functools import reduce

def combinations_count(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

div = K - 1  
for i in range(1, K+1):
  split_ball = combinations_count(div, i-1)
  red_ball = N-K-i+1
  red_balls = combinations_count(red_ball+i, i)
  print((split_ball * red_balls) % (10**9 + 7))

Fixed submission:
N, K = map(int,input().split())

from operator import mul
from functools import reduce

def combinations_count(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

div = K - 1  
for i in range(1, K+1):
  split_ball = combinations_count(div, i-1)
  red_ball = N-K-i+1
  if red_ball<0:
    red_balls = 0
  else:
    red_balls = combinations_count(red_ball+i, i)
  print((split_ball * red_balls) % (10**9 + 7))

Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())

from math import factorial

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

div = K - 1  
for i in range(1, K+1):
  split_ball = combinations_count(div, i-1)
  red_ball = N-K-i+1
  red_balls = combinations_count(red_ball+i, i)
  print((split_ball * red_balls) % (10**9 + 7))

Fixed submission:
N, K = map(int,input().split())

from operator import mul
from functools import reduce

def combinations_count(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

div = K - 1  
for i in range(1, K+1):
  split_ball = combinations_count(div, i-1)
  red_ball = N-K-i+1
  if red_ball<0:
    red_balls = 0
  else:
    red_balls = combinations_count(red_ball+i, i)
  print((split_ball * red_balls) % (10**9 + 7))
Buggy python submission (verdict: Runtime Error):
L, R = [[], []]
N, M = map(int, input().split())
for i in range(M):
  l, r = map(int, input().split())
  L.append(l)
  R.append(r)

minR = min(R)
maxL = max(L)
if minR <= maxL:
  count = 0
else:
  count = minR - maxL + 1
      
print('%d' % count)

Fixed submission:
A, B = map(int, input().split())
if A>=13:
  cost = B
elif A>=6 and A<=12:
  cost = B/2
else:
  cost = 0
print('%d' % cost)

Buggy python submission (verdict: Runtime Error):
L, R = [[], []]
N, M = map(int, input().split())
for i in range(M):
  l, r = map(int, input().split())
  L.append(l)
  R.append(r)

minR = min(R)
maxL = max(L)
if minR <= maxL:
  count = 0
else:
  count = minR - maxL + 1
      
print('%d' % count)

Fixed submission:
A, B = map(int, input().split())
if A>=13:
  cost = B
elif A>=6 and A<=12:
  cost = B/2
else:
  cost = 0
print('%d' % cost)
Buggy python submission (verdict: Time Limit Exceeded):
L, R = [[], []]
N, M = map(int, input().split())
for i in range(M):
  l, r = map(int, input().split())
  L.append(l)
  R.append(r)

count = 0
for i in range(1,N+1):
  count = min(R)-max(L)+1
  
print('%d' % count)

Fixed submission:
L, R = [[], []]
N, M = map(int, input().split())
for i in range(M):
  l, r = map(int, input().split())
  L.append(l)
  R.append(r)

count = 0
minR = min(R)
maxL = max(L)
if minR < maxL:
  count = 0
else:
  for i in range(maxL, minR+1):
    if i <= N:
      count = count + 1
      
print('%d' % count)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = [[], []]
N, M = map(int, input().split())
for i in range(M):
  l, r = map(int, input().split())
  L.append(l)
  R.append(r)

count = 0
for i in range(1,N+1):
  s = True
  for j in range(M):
    if L[j]>i or i>R[j]:
      s = False
      break
  if s:
    count = count + 1

print('%d' % count)

Fixed submission:
L, R = [[], []]
N, M = map(int, input().split())
for i in range(M):
  l, r = map(int, input().split())
  L.append(l)
  R.append(r)

count = 0
minR = min(R)
maxL = max(L)
if minR < maxL:
  count = 0
else:
  for i in range(maxL, minR+1):
    if i <= N:
      count = count + 1
      
print('%d' % count)
Buggy python submission (verdict: Time Limit Exceeded):
B, C = [[], []]
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(M):
  b, c = map(int, input().split())
  B.append(b)
  C.append(c)

for i in range(len(B)):
  count = 0
  sortA = A
  sortA.sort()
  
  for j in range(len(sortA)):
    if count < B[i]:
      if sortA[j] < C[i]:
        sortA[j] = C[i]
        count = count + 1
      else:
        break
    else:
      break
      
  A = sortA

s = 0  
for _a in A:
  s = s + float(_a)
  
print('%d' % s)

Fixed submission:
from collections import defaultdict

N, M = map(int, input().split())
A = list(map(int, input().split()))
D = defaultdict(int)
for i in range(M):
  b, c = map(int, input().split())
  D[c] += b
  
idx = 0
ans = 0

A.sort()

for c,b in sorted(D.items(), key=lambda x: x[0], reverse=True):
  for _ in range(b):
    if idx >= len(A):
      keep = False
      break
    if A[idx] < c:
      ans += c
      keep = True
    else:
      keep = False
      break
    idx += 1
  if keep:
    continue
  else:
    break
    
for i in range(idx, len(A)):
  ans += A[i]
  
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input(),split())
print("{}".format(a-b+1))

Fixed submission:
a,b = map(int, input().split())
print("{}".format(a-b+1))
Buggy python submission (verdict: Runtime Error):
d = input()

for i in list(range(0,3)):
  if d[i]=='1':
    c = c + 1
    
print("{}".format(c))

Fixed submission:
a, b = map(int, input().split())
c = a * b
if c%2:
  print("Odd")
else:
  print("Even")
Buggy python submission (verdict: Runtime Error):
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
b = [[0]*2 for i in range(0,m)]
for i in range(0,m):
    b[i][1],b[i][0] = list(map(int,input().split()))

a.sort()
b.sort(reverse = True)

now = 0

for i in range(0,m):
    if now >n:
        break
    for j in range(0,b[i][1]):
        if now > n:
            break
        if a[now] < b[i][0]:
            a[now] = b[i][0]
            now += 1
        else:
            break

print(sum(a))

Fixed submission:
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
b = [[0]*2 for i in range(0,m)]
for i in range(0,m):
    b[i][1],b[i][0] = list(map(int,input().split()))

a.sort()
b.sort(reverse = True)

now = 0
end = False

for i in range(0,m):
    if now >= n or end == True:
        break
    for j in range(0,b[i][1]):
        if now >= n:
            break
        if a[now] < b[i][0]:
            a[now] = b[i][0]
            now += 1
        else:
            end = True
            break

print(sum(a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
r = s.count("R")
if s-r < r:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
s = list(input())
r = s.count("R")
if n-r < r:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

dp = [1 for i in range(0,n+1)]
c = list()
c.append(-1)
for i in range(1,n+1):
    c.append(int(input()))

for i in range(2,n+1):
    for j in reversed(range(1,i)):
        if c[i-1] != c[i] == c[j] != c[j-1]:
            dp[i] = dp[i-1]+dp[j]
            break
    else:
        dp[i] = dp[i-1]
print(dp[-1])

Fixed submission:
n = int(input())

dp = [1 for i in range(0,n+1)]
c = list()
c.append(-1)
d = {}
for i in range(1,n+1):
    c.append(int(input()))

for i in range(1,n+1):
    if c[i] in d:
        j = d[c[i]]
        d[c[i]] = i
        if c[i-1] != c[i]:
            dp[i] = dp[i-1]+dp[j]
            continue
    else:
        d[c[i]] = i
    dp[i] = dp[i-1]
print(dp[-1]%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
a,b = list(map(int,input().split()))
ansa = a
m = 2
sp = False
while 2**(m+1) <= b:
    if (a<2**m) and (2**(m+1)<=b):
        sp = True
        break
    else:
        m +=1

if sp == True:
    ansb = 2**(m+1)
    for i in range(a+1,2**m):
        ansa = ansa^i
    for i in range(2**(m+1)+1,b+1):
        ansb = ansb^i
    print(ansa^ansb)
else:
    for i in range(a+1,b+1):
        ansa = ansa^i
    print(ansa)

Fixed submission:
a,b = list(map(int,input().split()))
def func(num):
    m = 0
    if num%2 == 0:
        if num%4 == 0:
            m = 1
        return num^m
    else:
        if (num-1)%4 == 0:
            m = 1
        return m^1
print(func(a-1)^func(b))
Buggy python submission (verdict: Runtime Error):
import math
a,b,k = list(map(int,input().split()))
c = math.gcd(a,b)
d = list()
e = 0
for i in range(1,(c//2)+1):
    if c%i == 0:
        e +=1
        if e == k:
            print(int(c/i))

Fixed submission:
a,b,k = list(map(int,input().split()))
c= 1
d=0
if b < a:
    a,b=b,a
while True:
    d = b%a
    if d == 0:
        c=a
        break
    else:
        b = a
        a = d
e = 0
for i in range(1,c+1):
    if c%i == 0:
        e +=1
        if e == k:
            print(int(c/i))
            break

Buggy python submission (verdict: Runtime Error):
import math
a,b,k = list(map(int,input().split()))
c = math.gcd(a,b)
d = list()
for i in range(1,(c//2)+1):
    if c%i == 0:
        d.append(i)
d.append(c)
print(d[-k])

Fixed submission:
a,b,k = list(map(int,input().split()))
c= 1
d=0
if b < a:
    a,b=b,a
while True:
    d = b%a
    if d == 0:
        c=a
        break
    else:
        b = a
        a = d
e = 0
for i in range(1,c+1):
    if c%i == 0:
        e +=1
        if e == k:
            print(int(c/i))
            break
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
count = 0
while True:
    if len(s) <=1:
        break
    for i in range(0,len(s)-1):
        if s[i] != s[i+1]:
            count += 2
            del s[i]
            del s[i]
            break
    else:
        break
print(count)

Fixed submission:
s = list(input())
zero = s.count("0")
ans = min(len(s)-zero,zero)
print(ans*2)

Buggy python submission (verdict: Runtime Error):
s = list(input())
count = 0
find = False
while True:
    if len(s) <=2:
        break
    for i in range(0,len(s)-1):
        if s[i] != s[i+1]:
            count += 2
            del s[i]
            del s[i+1]
            break
    else:
        break
    
print(count)

Fixed submission:
s = list(input())
zero = s.count("0")
ans = min(len(s)-zero,zero)
print(ans*2)
Buggy python submission (verdict: Runtime Error):
import fraction
n = int(input())
a = list(map(int,input().split()))
ans = a[0]

for i in range(1,len(a)):
  ans =fraction.gcd(ans,a[i])
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = a[0]

def gcd(x,y):
    d = 0
    if max(x,y) == x:
        x,y = y,x
    while True:
        if y%x == 0:
            return x
        else:
            d = y%x
            y,x = x,d

for i in range(1,len(a)):
  ans = gcd(ans,a[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
cost = [0,2,5,5,4,5,6,3,7,6] # cost[a[i]] = a[i]のコスト
dp = [-1]*(n+1)
dp[0] = 0

for i in range(2,n+1):
    for j in range(0,m):
        if dp[i-cost[a[j]]] == -1:
            continue
        else:
            dp[i] = max(dp[i],dp[i-cost[a[j]]]+1)

ans = list()
read = n
a.sort()
a.reverse()

while read > 0:
    for i in range(0,m):
        if read -cost[a[i]] < 0:
            continue
        if dp[read-cost[a[i]]] == dp[read]-1:
            ans.append(str(a[i]))
            read -= cost[a[i]]
            break
    
print("".join(ans))

Fixed submission:
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
cost = [0,2,5,5,4,5,6,3,7,6] 
dp = [-1]*(n+1)
dp[0] = 0

for i in range(2,n+1):
    for j in range(0,m):
        if i-cost[a[j]] <0:
            continue
        if dp[i-cost[a[j]]] == -1:
            continue
        else:
            dp[i] = max(dp[i],dp[i-cost[a[j]]]+1)

ans = list()
read = n
a.sort()
a.reverse()

while read > 0:
    for i in range(0,m):
        if read < cost[a[i]]:
            continue
        if dp[read-cost[a[i]]] == dp[read]-1:
            ans.append(str(a[i]))
            read -= cost[a[i]]
            break
    
print("".join(ans))

Buggy python submission (verdict: Runtime Error):
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
cost = [0,2,5,5,4,5,6,3,7,6] # cost[a[i]] = a[i]のコスト
dp = [-1]*(n+1)
dp[0] = 0

for i in range(2,n+1):
    for j in range(0,m):
        if dp[i-cost[a[j]]] == -1:
            continue
        else:
            dp[i] = max(dp[i],dp[i-cost[a[j]]]+1)

ans = list()
read = n
for i in reversed(range(0,n-1)):
    if dp[i]+1 == dp[read]:
        if read-i in [2,3,4,7]:
            ans.append(str(cost.index(read-i)))
        elif read-i == 6:
            if 9 in a:
                ans.append(str(9))
            else:
                ans.append(str(6))
        elif read -i == 5:
            if 5 in a:
                ans.append(str(5))
            elif 3 in a:
                ans.append(str(3))
            else:
                ans.append(str(2))
        read = i
ans.sort()
print("".join(reversed(ans)))

Fixed submission:
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
cost = [0,2,5,5,4,5,6,3,7,6] 
dp = [-1]*(n+1)
dp[0] = 0

for i in range(2,n+1):
    for j in range(0,m):
        if i-cost[a[j]] <0:
            continue
        if dp[i-cost[a[j]]] == -1:
            continue
        else:
            dp[i] = max(dp[i],dp[i-cost[a[j]]]+1)

ans = list()
read = n
a.sort()
a.reverse()

while read > 0:
    for i in range(0,m):
        if read < cost[a[i]]:
            continue
        if dp[read-cost[a[i]]] == dp[read]-1:
            ans.append(str(a[i]))
            read -= cost[a[i]]
            break
    
print("".join(ans))
Buggy python submission (verdict: Runtime Error):
x,y = list(map(input().split()))
print(x+y//2)

Fixed submission:
x,y = list(map(int,input().split()))
print(x+y//2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
s.sort()
sum = 0

for i in range(0,2n,2):
  sum += s[i]
print(sum)

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
s.sort()
sum = 0

for i in range(0,2*n,2):
  sum += s[i]
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = int(input())

cnt_dic = defaultdict(lambda: 0)

for _ in range(n):
    s = list(input())
    s.sort()
    cnt_dic[str(s)] +=1


ans = 0
for i in cnt_dic.values():
    if 1 < i:
        ans += combinations_count(i,2)

print(ans)


Fixed submission:
from collections import defaultdict
from collections import Counter
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = int(input())

cnt_dic = defaultdict(lambda: 0)

for _ in range(n):
    s = list(input())
    cnt_s = [0] * 52
    for c in s:
        cnt_s[ord(c)- ord('a')] += 1
    cnt_dic[tuple(cnt_s)] +=1

ans = 0
for i in cnt_dic.values():
    if 1 < i:
        ans += combinations_count(i,2)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
s_len = len(s)

to_l = [0] * s_len
to_r = [0] * s_len
ans = [0] * s_len
cnt = 0
for i, c in enumerate(s):
    if c == 'R':
        cnt = 0
    else:
        cnt += 1
    to_r[i] = cnt

cnt = 0
for i,c in enumerate(reversed(s)):
    if c == 'L':
        cnt = 0
    else:
        cnt += 1
    to_l[s_len-i-1] = cnt

for i in range(s_len):
    c = s[i]
    if c == 'R':
        d = to_l[i]
    else:
        d = to_r[i]

    if d % 2 == 0:
        to_d = d
    else:
        to_d = d - 1

    if c == 'R':
        to_i = i + to_d
    else:
        to_i = i - to_d
    
    if to_i < 0 or s_len <= to_i:
        pass
    else:
        ans[to_i] += 1

ans_s = str(ans[0])
for cnt in ans[1:]:
    ans_s += (" " + str(cnt))
print(ans_s)


Fixed submission:
s = input()
s_len = len(s)

to_l = [0] * s_len
to_r = [0] * s_len
ans = [0] * s_len
cnt = 0
for i, c in enumerate(s):
    if c == 'R':
        cnt = 0
    else:
        cnt += 1
    to_r[i] = cnt

cnt = 0
for i,c in enumerate(reversed(s)):
    if c == 'L':
        cnt = 0
    else:
        cnt += 1
    to_l[s_len-i-1] = cnt

for i in range(s_len):
    c = s[i]
    if c == 'R':
        d = to_l[i]
    else:
        d = to_r[i]

    if d % 2 == 0:
        to_d = d
    else:
        to_d = d - 1

    if c == 'R':
        to_i = i + to_d
    else:
        to_i = i - to_d
    
    if to_i < 0 or s_len <= to_i:
        pass
    else:
        ans[to_i] += 1

#ans_s = str(ans[0])
#for cnt in ans[1:]:
#    ans_s += (" " + str(cnt))
#print(ans_s)
for i in ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
s_len = len(s)

to_l = [0] * s_len
to_r = [0] * s_len
ans = [0] * s_len
cnt = 0
for i, c in enumerate(s):
    if c == 'R':
        cnt = 0
    else:
        cnt += 1
    to_r[i] = cnt

cnt = 0
for i,c in enumerate(reversed(s)):
    if c == 'L':
        cnt = 0
    else:
        cnt += 1
    to_l[s_len-i-1] = cnt

for i in range(s_len):
    c = s[i]
    if c == 'R':
        d = to_l[i]
    else:
        d = to_r[i]

    if d % 2 == 0:
        to_d = d
    else:
        to_d = d - 1

    if c == 'R':
        to_i = i + to_d
    else:
        to_i = i - to_d
    
    if to_i < 0 or s_len <= to_i:
        pass
    else:
        ans[to_i] += 1

ans_s = str(ans[0])
for cnt in ans[1:]:
    ans_s += (" " + str(cnt))
print(ans_s)


Fixed submission:
s = input()
s_len = len(s)

to_l = [0] * s_len
to_r = [0] * s_len
ans = [0] * s_len
cnt = 0
for i, c in enumerate(s):
    if c == 'R':
        cnt = 0
    else:
        cnt += 1
    to_r[i] = cnt

cnt = 0
for i,c in enumerate(reversed(s)):
    if c == 'L':
        cnt = 0
    else:
        cnt += 1
    to_l[s_len-i-1] = cnt

for i in range(s_len):
    c = s[i]
    if c == 'R':
        d = to_l[i]
    else:
        d = to_r[i]

    if d % 2 == 0:
        to_d = d
    else:
        to_d = d - 1

    if c == 'R':
        to_i = i + to_d
    else:
        to_i = i - to_d
    
    if to_i < 0 or s_len <= to_i:
        pass
    else:
        ans[to_i] += 1

#ans_s = str(ans[0])
#for cnt in ans[1:]:
#    ans_s += (" " + str(cnt))
#print(ans_s)
for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
r = int(input())80

a = r
ans = 3 * a * a
print(ans)

Fixed submission:
r = int(input())

a = r
ans = 3 * a * a
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())

ans = 0

c_n_min = math.ceil(A / C)
c_n_max = math.floor(B / C)
c_n = c_n_max - c_n_min + 1

d_n_min = math.ceil(A / D)
d_n_max = math.floor(B / D)
d_n = d_n_max - d_n_min + 1

cd = C * D /math.gcd(C,D)
cd_n_min = math.ceil(A / cd)
cd_n_max = math.floor(B / cd)
cd_n = cd_n_max - cd_n_min + 1

ans = (B - A + 1) - (c_n + d_n - cd_n)
print(ans)


Fixed submission:
import math
import fractions
A, B, C, D = map(int, input().split())

ans = 0


c_n = (B // C) - ((A - 1) // C)
d_n = (B // D) - ((A - 1) // D)
cd = C * D // fractions.gcd(C,D)
cd_n = (B // cd) - ((A - 1) // cd)

ans = (B - A + 1) - (c_n + d_n - cd_n)
print(ans)
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split(' '))

a_x = min(x, W - x)
a_y = min(y, H - y)

if ((W == H) and (x == y or x == H - y)):
    ans = W * H / 2.0
    if (x == W - x and y == H -y):
        multi_ans = 1
    else:
        multi_ans = 0

if (W < H):
    l = H
    m = a_x
else:
    l = W
    m = a_y
ans = l * m
if (x == W/2 and y == H/2):
    multi_ans = 1
elif (W == H and (x != 0 and y != 0)):
    multi_ans = 1
else:
    multi_ans = 0

# 対角線
if (((W % x == 0) and (H % y ==0)) and (x == y or x == H - y)):
    ans = W * H / 2.0
    if (x == W - x and y == H -y):
        multi_ans = 1
    else:
        multi_ans = 0

# 4点
if ((x == 0 and y == 0) or (x == 0 and y == H) or (y == 0 and x == W) or (y == H and x == W)):
    multi_ans = 0
    ans = W * H / 2.0

print("{} {}".format(ans, multi_ans))



Fixed submission:
W, H, x, y = map(int, input().split(' '))


multi_ans = 0

if ((x == 0 and y == 0) or (x == 0 and y == H) or (y == 0 and x == W) or (y == H and x == W)):
    multi_ans = 0
elif (W==H and not((x == W - x or y == H - y))):
    multi_ans == 1
elif (x != 0 and y != 0):
    if (W / x == H / y):
        if (x == W - x and y == H -y):
            multi_ans = 1
        else:
            multi_ans = 0

ans = W * H /2.0
print("{} {}".format(ans, multi_ans))