Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = input()

if 'N' in s:
    if 'S' in s:
        ans = 'Yes'
    else:
        ans = 'No'
        print(ans)
        exit()
if 'W' in s:
    if 'E' in s:
        ans = 'Yes'
    else:
        ans = 'No'
        print(ans)
        exit()

print(ans)


Fixed submission:
s = input()

if ('N' in s and 'S' in s) or ('N' not in s and 'S' not in s):
    if ('W' in s and 'E' in s) or ('W' not in s and 'E' not in s):
        print('Yes')
        exit()

print('No')

Buggy python submission (verdict: Runtime Error):
s = input()

if 'N' in s:
    if 'S' in s:
        ans = 'Yes'
    else:
        ans = 'No'
        print(ans)
        exit()
if 'W' in s:
    if 'E' in s:
        ans = 'Yes'
    else:
        ans = 'No'
        print(ans)
        exit()

print(ans)


Fixed submission:
s = input()

if ('N' in s and 'S' in s) or ('N' not in s and 'S' not in s):
    if ('W' in s and 'E' in s) or ('W' not in s and 'E' not in s):
        print('Yes')
        exit()

print('No')
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
num = 1
for i in range(a, b+1):
    num *= i

if num == 0:
    print('Zero')
elif num < 0:
    print('Negative')
else:
    print('Positive')

Fixed submission:
a, b = map(int, input().split())

if a <= 0 and b >= 0:
    print('Zero')
elif a < 0 and b < 0 and (b-a)%2 == 0:
    print('Negative')
else:
    print('Positive')
Buggy python submission (verdict: Runtime Error):
A,B,H,M = map(int,input().split(' '))
# 30: 12h/360° 6:  60min/360°
theta = abs((30 * H + 30 * M / 60)- 6 * M)
if(theta > 180):
    theta -= 180
elif(theta == 180):
    print(A + B)
    return
print(math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(math.radians(theta))))


Fixed submission:
from math import (pi,cos,sqrt,radians)

def main():
    A,B,H,M = map(int, input().split())

    # 長針、短針の0時0分からの角度を求める
    HTheta = H/12 * 360 + 1/12 * (M/60) *  360
    MTheta = M/60 * 360
    # |長針-短針|で角度θを求める
    Theta = abs(HTheta - MTheta) 
    # θ=180ならA+Bを出力して終了
    if Theta == 180:
        print(A + B)
        return
    # 予言定理を求める
    print(sqrt(A*A + B*B - 2*A*B*cos(radians(Theta))))

main()

Buggy python submission (verdict: Runtime Error):
A,B,H,M = map(int,input().split(' '))
# 30: 12h/360° 6:  60min/360°
theta = abs((30 * H + 30 * M / 60)- 6 * M)
if(theta > 180):
theta -= 180
elif(theta == 180):
print(A + B)
return
print(math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(math.radians(theta))))


Fixed submission:
from math import (pi,cos,sqrt,radians)

def main():
    A,B,H,M = map(int, input().split())

    # 長針、短針の0時0分からの角度を求める
    HTheta = H/12 * 360 + 1/12 * (M/60) *  360
    MTheta = M/60 * 360
    # |長針-短針|で角度θを求める
    Theta = abs(HTheta - MTheta) 
    # θ=180ならA+Bを出力して終了
    if Theta == 180:
        print(A + B)
        return
    # 予言定理を求める
    print(sqrt(A*A + B*B - 2*A*B*cos(radians(Theta))))

main()
Buggy python submission (verdict: Runtime Error):
def get_int():
	return int(input())

def get_ints():
	return list(map(int, input().split()))

def choose2(n):
    return n*(n-1)/2
# インプット
N = get_int()
An = get_ints()
""" 全ての要素から2つのボールを選ぶ通り数を求める """
uni = [0] * (N)
# ユニーク数の配列を求める
for i in range(N):
    uni[An[i]] += 1
sumWay = 0
# 各数値の2通りの選択通り数を足していく
for i in range(N):
    sumWay += choose2(uni[i])
""" 全ての要素数 - 削除する要素の通り数 + 削除する要素を引いた際の通り数 を求める """
for i in range(N):
    print(sumWay - choose2(uni[An[i]]) + choose2(uni[An[i]]-1)) 
# 4 - 3 + 1


Fixed submission:
""" スニペット """
def get_int():
	return int(input())

def get_ints():
	return list(map(int, input().split()))
""" スニペット """
import math
# 2つ選ぶ通り数を算出 nC2
def choose2(n):
    return math.floor(n*(n-1)/2)

# インプット
N = get_int()
An = get_ints()
""" 全ての要素から2つのボールを選ぶ通り数を求める """
uni = [0] * (N+1)
# ユニーク数の配列を求める
for i in range(N):
    uni[An[i]] += 1
sumWay = 0
# 各数値の2通りの選択通り数を足していく ここのindex=0がいらない
for i in range(N+1):
    sumWay += choose2(uni[i])
""" 全ての要素数 - 削除する要素の通り数 + 削除する要素を引いた際の通り数 を求める """
for i in range(N):
    print(sumWay - choose2(uni[An[i]]) + choose2(uni[An[i]]-1))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
mod = 1000000000+7
T = 0
#print(A[1])
for i in range(N-1):
    for j in range(N-i-1):
        T += A[i]*A[j+i+1]%mod
        #print(T)
T = T%mod
print(T)

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

S = sum(A)
S2 = sum(map(lambda x: x*x,A))

print((S*S - S2) // 2 % 1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
mod = 1000000000+7
T = 0
#print(A[1])
for i in range(N-1):
    for j in range(N-i-1):
        T += A[i]*A[j+i+1]
        #print(T)
T = T%mod
print(T)

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

S = sum(A)
S2 = sum(map(lambda x: x*x,A))

print((S*S - S2) // 2 % 1000000007)
Buggy python submission (verdict: Runtime Error):
import numpy as np
A = np.asarray(input().split()).astype(np.int)
 
ans = 0
mod = 10**9 + 7
for i in range(N):
    pA = (A[i] % mod) * (A[i+1:].sum() % mod)
    ans += pA
 
print(int(ans % mod))

Fixed submission:
D, T, S = map(int, input().split())

t = D / S

if t <= T:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import numpy as np
A = np.asarray(input().split()).astype(np.int)
 
ans = 0
mod = 10**9 + 7
for i in range(N):
    pA = (A[i] % mod) * (A[i+1:].sum() % mod)
    ans += pA
 
print(int(ans % mod))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
D = 1000000007


ans = 0
B = [0] * (N + 1)

for i in range(N-1, -1, -1):
    B[i] = (B[i+1] + A[i]) % D

for i in range(0, N-1):
    ans += (A[i] * B[i+1]) % D

print(int(ans % D))

Buggy python submission (verdict: Runtime Error):
A = np.asarray(input().split()).astype(np.int)
 
ans = 0
mod = 10**9 + 7
for i in range(N):
    pA = (A[i] % mod) * (A[i+1:].sum() % mod)
    ans += pA
 
print(int(ans % mod))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
D = 1000000007


ans = 0
B = [0] * (N + 1)

for i in range(N-1, -1, -1):
    B[i] = (B[i+1] + A[i]) % D

for i in range(0, N-1):
    ans += (A[i] * B[i+1]) % D

print(int(ans % D))

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = np.asarray(input().split()).astype(np.int)
'''
ans = 0
for i in range(N):
    pA = A[i] * A[i+1:]
    ans += pA.sum()

print(int(ans % (1e9+7)))
'''
a = np.tile(A,(N, 1))
a = a * a.T

a_diag = np.diag(a).sum()
a = ((a.sum()-a_diag)/2)
#print(a/10e9+7)
print(int(np.mod(a, 10**9+7)))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
D = 1000000007


ans = 0
B = [0] * (N + 1)

for i in range(N-1, -1, -1):
    B[i] = (B[i+1] + A[i]) % D

for i in range(0, N-1):
    ans += (A[i] * B[i+1]) % D

print(int(ans % D))
Buggy python submission (verdict: Runtime Error):
S = input()
if S == 'RSR':
    renzoku = 2
else:
    for si in S:
        if si == 'R':
            renzoku += 1

print(renzoku)

Fixed submission:
S = input()
if S == 'RSR':
    renzoku = 1
else:
    renzoku = 0
    for si in S:
        if si == 'R':
            renzoku += 1

print(renzoku)
Buggy python submission (verdict: Time Limit Exceeded):
import math
X, K, L = map(int, input().split())
min_dist = math.inf
for p_num in range(K+1):
    dist = abs(X + L*p_num + (-1)*L*(K-p_num))
    if dist < min_dist:
        min_dist = dist

print(min_dist)


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

X = abs(X)

n = X // D
m = K - n

A1 = abs(X - n*D)
A2 = abs(X - (n+1)*D)

Ans = A2

if m > 1:
    if A1 <= A2:
        if m % 2 == 0:
            Ans = A1
    else:
        if m % 2 == 0:
            Ans = A1
else:
    Ans = abs(X - K*D)

print(Ans)

Buggy python submission (verdict: Runtime Error):
X, K, L = map(int, input().split())
min_dist = inf
for p_num in range(K+1):
    dist = L*p_num + (-1)*L*(K-p_num)
    if dist < min_dist:
        min_dist = dist
print(min_dist)


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

X = abs(X)

n = X // D
m = K - n

A1 = abs(X - n*D)
A2 = abs(X - (n+1)*D)

Ans = A2

if m > 1:
    if A1 <= A2:
        if m % 2 == 0:
            Ans = A1
    else:
        if m % 2 == 0:
            Ans = A1
else:
    Ans = abs(X - K*D)

print(Ans)

Buggy python submission (verdict: Time Limit Exceeded):
X, K, L = map(int, input().split())
Distance = []
for p_num in range(K+1):
    dist = L*p_num + (-1)*L*(K-p_num)
    Distance.append(abs(X + dist))


print(min(Distance))


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

X = abs(X)

n = X // D
m = K - n

A1 = abs(X - n*D)
A2 = abs(X - (n+1)*D)

Ans = A2

if m > 1:
    if A1 <= A2:
        if m % 2 == 0:
            Ans = A1
    else:
        if m % 2 == 0:
            Ans = A1
else:
    Ans = abs(X - K*D)

print(Ans)
Buggy python submission (verdict: Runtime Error):
n = input()
s = ''
for i in range(n):
  s += 'ACL'
print(s)

Fixed submission:
n = int(input())
s = ''
for i in range(n):
  s += 'ACL'
print(s)
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
b = list(map(int, input().split()))
t = int(input())
aw = a[0]+a[1]*t
bw = b[0]+b[1]*t
diff = a[1]-b[1] # 1秒ごとに縮まる
adiff = b[0] - a[0] # 元々の差
count = 0
if int(adiff/diff) <= t:
  print('YES')
else:
  print('NO')

Fixed submission:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
t = int(input())
diff = (a[1]-b[1])*t # 1秒ごとに縮まる
adiff = abs(a[0]-b[0]) # 元々の差
if diff >= adiff:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
count = 1
for i in a:
  count *= i
if count > 1000000000000000000:
  print(-1)
else:
  print(count)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
count = 1
l = 0
if (0 in a) == True:
  print(0)
else:
  for i in a:
    count *= i
    if count > 1000000000000000000:
      l = -1
      break
  if l == 0:
    print(count)
  else:
    print(l)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
count = 1
for i in a:
  count *= i
if count > 1000000000000000000:
  print(-1)
else:
  print(count)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
count = 1
l = 0
if (0 in a) == True:
  print(0)
else:
  for i in a:
    count *= i
    if count > 1000000000000000000:
      l = -1
      break
  if l == 0:
    print(count)
  else:
    print(l)
Buggy python submission (verdict: Runtime Error):
a

Fixed submission:
s = input()
t = input()
if t[:len(s)] == s:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
r = int(input())
e = r * math.pi * 2
print(e)

Fixed submission:
import math
r = int(input())
x = r * math.pi * 2
n = 10
y = math.floor(x * 10 ** n) / (10 ** n)
print(y)
Buggy python submission (verdict: Time Limit Exceeded):
x = input().split()
n = int(x[0])
a = int(x[1])
b = int(x[2])
l = ''
boll_a = ''
boll_b = ''
for j in range(0, a):
  boll_a += 'b'
for k in range(0, b):
  boll_b += 'r'
while n >= len(l):
  l += boll_a
  l += boll_b

print(l[:n].count('b'))

Fixed submission:
import math
x = input().split()
n = int(x[0])
a = int(x[1])
b = int(x[2])
z = 0
z = math.floor(n / (a+b)) * a
amari = math.floor(n % (a+b))
if amari == 0:
  pass
elif amari <= a:
  z += amari
else:
  z += a
print(z)

Buggy python submission (verdict: Time Limit Exceeded):
x = input().split()
n = int(x[0])
a = int(x[1])
b = int(x[2])
boll_a = ''
boll_b = ''
count = ''
for j in range(0, a):
  boll_a += 'b'
for k in range(0, b):
  boll_b += 'r'
for i in range(0, n):
  count += boll_a
  count += boll_b
  if len(count) >= n: break
c = 0
for i in count[:n]:
  if i == 'b':
    c += 1
print(c)

Fixed submission:
import math
x = input().split()
n = int(x[0])
a = int(x[1])
b = int(x[2])
z = 0
z = math.floor(n / (a+b)) * a
amari = math.floor(n % (a+b))
if amari == 0:
  pass
elif amari <= a:
  z += amari
else:
  z += a
print(z)

Buggy python submission (verdict: Time Limit Exceeded):
x = input().split()
n = int(x[0])
a = int(x[1])
b = int(x[2])
count = ''
for i in range(0, n):
  for j in range(0, a):
    count += 'b'
  for k in range(0, b):
    count += 'r'
  if len(count) >= n: break
c = 0
for i in count[:n]:
  if i == 'b':
    c += 1
print(c)

Fixed submission:
import math
x = input().split()
n = int(x[0])
a = int(x[1])
b = int(x[2])
z = 0
z = math.floor(n / (a+b)) * a
amari = math.floor(n % (a+b))
if amari == 0:
  pass
elif amari <= a:
  z += amari
else:
  z += a
print(z)
Buggy python submission (verdict: Runtime Error):
x = input()
youbi = {
  'SUN': 7
  , 'MON': 6
  , 'TUE': 5
  , 'WED': 4
  , 'THU': 3
  , 'TRI': 2
  , 'SAT': 1
}
print(youbi[x])

Fixed submission:
x = input()
youbi = {
  'SUN': 7
  , 'MON': 6
  , 'TUE': 5
  , 'WED': 4
  , 'THU': 3
  , 'FRI': 2
  , 'SAT': 1
}
print(youbi[x])
Buggy python submission (verdict: Runtime Error):
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
start = time.time()
y = 0
for i in range(2 ** n):
  v_total = 0
  c_total = 0
  for j in range(n):  # このループが一番のポイント
    if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
      v_total += v[j]
      c_total += c[j]
  if (v_total-c_total) > y:
    y = v_total-c_total
print(y)

Fixed submission:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
y = 0
for i in range(2 ** n):
  v_total = 0
  c_total = 0
  for j in range(n):  # このループが一番のポイント
    if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
      v_total += v[j]
      c_total += c[j]
  if (v_total-c_total) > y:
    y = v_total-c_total
print(y)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
y = 0
for i in range(2 ** n):
  v_total = 0
  c_total = 0
  for j in range(n):  # このループが一番のポイント
    if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
      v_total += v[j]
      c_total += c[j]
  if (v_total-c_total) > y:
    y = v_total-c_total
print(y)

Fixed submission:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
y = 0
for i in range(2 ** n):
  v_total = 0
  c_total = 0
  for j in range(n):  # このループが一番のポイント
    if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
      v_total += v[j]
      c_total += c[j]
  if (v_total-c_total) > y:
    y = v_total-c_total
print(y)
Buggy python submission (verdict: Runtime Error):
import math
a = input()
b = input()
c = input()
d = input()
e = input()
l = []
if a[-1] != '0': l.append(a[-1])
if b[-1] != '0': l.append(b[-1])
if c[-1] != '0': l.append(c[-1])
if d[-1] != '0': l.append(d[-1])
if e[-1] != '0': l.append(e[-1])
min_l = min(l)
p = [ a,b,c,d,e ]
o = []
len_p = len(p)
tmp_p = ''
for i in range(0, len_p):
  if p[i][-1] == min_l:
    tmp_p = int(p.pop(i))
    break
new_p = 0
for i in p:
  new_p += math.ceil(int(i)/10)*10
print(new_p+tmp_p)

Fixed submission:
import math
a = input()
b = input()
c = input()
d = input()
e = input()
l = []
if a[-1] != '0': l.append(a[-1])
if b[-1] != '0': l.append(b[-1])
if c[-1] != '0': l.append(c[-1])
if d[-1] != '0': l.append(d[-1])
if e[-1] != '0': l.append(e[-1])
if l == []:
  print(int(a)+int(b)+int(c)+int(d)+int(e))
else:
  min_l = min(l)
  p = [ a,b,c,d,e ]
  o = []
  len_p = len(p)
  tmp_p = ''
  for i in range(0, len_p):
    if p[i][-1] == min_l:
      tmp_p = int(p.pop(i))
      break
  new_p = 0
  for i in p:
    new_p += math.ceil(int(i)/10)*10
  print(new_p+tmp_p)

Buggy python submission (verdict: Runtime Error):
import math
a = input()
b = input()
c = input()
d = input()
e = input()
min_l = min(l)
p = [ a,b,c,d,e ]
o = []
len_p = len(p)
tmp_p = ''
for i in range(0, len_p):
  if p[i][-1] == min_l:
    tmp_p = int(p.pop(i))
    print(i)
    break
new_p = 0
for i in p:
  new_p += math.ceil(int(i)/10)*10
print(new_p+tmp_p)

Fixed submission:
import math
a = input()
b = input()
c = input()
d = input()
e = input()
l = []
if a[-1] != '0': l.append(a[-1])
if b[-1] != '0': l.append(b[-1])
if c[-1] != '0': l.append(c[-1])
if d[-1] != '0': l.append(d[-1])
if e[-1] != '0': l.append(e[-1])
if l == []:
  print(int(a)+int(b)+int(c)+int(d)+int(e))
else:
  min_l = min(l)
  p = [ a,b,c,d,e ]
  o = []
  len_p = len(p)
  tmp_p = ''
  for i in range(0, len_p):
    if p[i][-1] == min_l:
      tmp_p = int(p.pop(i))
      break
  new_p = 0
  for i in p:
    new_p += math.ceil(int(i)/10)*10
  print(new_p+tmp_p)
Buggy python submission (verdict: Runtime Error):
import sympy
n = int(input())
cnt = 0
for i in range(1, n+1):
  l = sympy.divisors(i)
  if (i % 2 != 0) and (len(l) == 8):
    cnt += 1
print(cnt)

Fixed submission:
n = int(input())
cnt = 0
def sympy(num):
  l = []
  for i in range(1, num+1):
    for j in range(1, num+1):
      if (i % 2 != 0) and (i*j == num):
        l.append(i)
  return l
for i in range(1, n+1):
  l = sympy(i)
  if (i % 2 != 0) and (len(l) == 8):
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
c = int(a) * int(b)
d = c % 2
if d == 0:
  print('Even')
else:
  print('Odd')

Fixed submission:
x = input().split()
a = x[0]
b = x[1]
c = int(a) * int(b)
d = c % 2
if d == 0:
  print('Even')
else:
  print('Odd')

Buggy python submission (verdict: Runtime Error):
c = a * b
d = c % 2
if d == 0:
  print('Even')
else:
  print('Odd')

Fixed submission:
x = input().split()
a = x[0]
b = x[1]
c = int(a) * int(b)
d = c % 2
if d == 0:
  print('Even')
else:
  print('Odd')
Buggy python submission (verdict: Time Limit Exceeded):
x = list(map(int, input().split()))
cnt = 0
for i in range(x[0]+1):
  for j in range(x[0]+1):
    for k in range(x[0]+1):
      p = i+j+k
      if p == x[1]:
        cnt += 1
print(cnt)


Fixed submission:
x = list(map(int, input().split()))
cnt = 0
for i in range(x[0]+1):
  for j in range(x[0]+1):
    p = i+j
    if (p <= x[1]) and (x[0]+p) >= x[1]:
      cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
x = list(map(int, input().split()))
cnt = 0
for i in range(x[0]+1):
  for j in range(x[0]+1):
    for k in range(x[0]+1):
      p = i+j+k
      if p == x[1]:
        cnt += 1
print(cnt)

Fixed submission:
x = list(map(int, input().split()))
cnt = 0
for i in range(x[0]+1):
  for j in range(x[0]+1):
    p = i+j
    if (p <= x[1]) and (x[0]+p) >= x[1]:
      cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
  ans *= a[i]
if(ans > 1000000000000000000):
  print(-1)
else:
  print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
if(0 in a):
  print(0)
  exit()
  
for i in range(1, n):
  ans *= a[i]
  if(ans > 1000000000000000000):
    print(-1)
    exit()
  
print(ans)
Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input().split())
for i in range(a, b+1):
  if(i%k == 0):
    print("OK")
    exsi()
print("NG")

Fixed submission:
k = int(input())
a, b = map(int, input().split())
for i in range(a, b+1):
  if(i%k == 0):
    print("OK")
    exit()
print("NG")
Buggy python submission (verdict: Time Limit Exceeded):
def search(list, item):
  low = 0
  high = len(list) - 1
  while(low <= high):
    mid = (low + high) // 2
    guess = list[mid]
    if(guess == item):
      return mid
    if(guess > item):
      high = mid - 1
    else:
      low = mid + 1
  list.insert(low, item)
  return None

n = int(input())
item = []
for i in range(n):
  s = input()
  search(item, s)
print(len(item))
  



Fixed submission:
n = int(input())
item = set()
for i in range(n):
  s = input()
  item.add(s)
print(len(item))

Buggy python submission (verdict: Runtime Error):
def search(list, item):
  low = 0
  high = len(list) - 1
  while(low <= high):
    mid = (low + high) // 2
    guess = list[mid]
    if(guess == item):
      return mid
    if(guess > item):
      high = mid - 1
    else:
      low = mid + 1
  list.insert(low, item)
  print(list)
  return None

n = int(input())
item = []
for i in range(n):
  s = input()
  search(item, s)
print(len(item))
  



Fixed submission:
n = int(input())
item = set()
for i in range(n):
  s = input()
  item.add(s)
print(len(item))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
item = []
for i in range(n):
  s = input()
  if(s not in item):
    item.append(s)
print(len(item))

Fixed submission:
n = int(input())
item = set()
for i in range(n):
  s = input()
  item.add(s)
print(len(item))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
d = n-sum(a)
if(a<0):
  d = -1
pritn(d)

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
d = n-sum(a)
if(d<0):
  d = -1
print(d)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
c = [a.count(i) for i in range(1, n+1)]
for i in range(n):
  print(c[i])

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
c = [0 for _ in range(n)]
for i in range(n-1):
  c[a[i]-1] += 1
for i in range(n):
  print(c[i])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
sum = s.count("R") * s.count("G") * s.count("B")
for i in range(1, n-1):
  for j in range(i+1, n):
    if(2*j-i-1 <n):
      if(len({s[i-1], s[j-1], s[2*j-i-1]}) == 3):
        sum -= 1
print(sum)

Fixed submission:
n = int(input())
s = input()
sum = s.count("R") * s.count("G") * s.count("B")
for i in range(1, n-1):
  for j in range(i+1, n):
    k = 2*j-i-1
    if(k >= n):
      break
    if(len({s[i-1], s[j-1], s[k]}) == 3):
        sum -= 1
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
sum = s.count("R") * s.count("G") * s.count("B")
for i in range(1, n-1):
  for j in range(i+1, n):
    if(s[i-1] == s[j-1] or 2*j-i-1 >= n):
      continue
    k = {"R", "G", "B"} - {s[i-1], s[j-1]}
    k = k.pop()
    if(s[2*j-i-1] == k):
      sum -= 1
print(sum)

Fixed submission:
n = int(input())
s = input()
sum = s.count("R") * s.count("G") * s.count("B")
for i in range(1, n-1):
  for j in range(i+1, n):
    k = 2*j-i-1
    if(k >= n):
      break
    if(len({s[i-1], s[j-1], s[k]}) == 3):
        sum -= 1
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
sum = 0
for i in range(1, n-1):
  h = {"R", "G", "B"} - {s[i-1]}
  sum += s[i:].count(h.pop()) * s[i:].count(h.pop())
  for j in range(i+1, n):
    if(s[i-1] == s[j-1]):
      continue
    k = {"R", "G", "B"} - {s[i-1], s[j-1]}
    k = k.pop()
    if(2*j-i-1 < n):
      if(s[2*j-i-1] == k):
        sum -= 1
print(sum)

Fixed submission:
n = int(input())
s = input()
sum = s.count("R") * s.count("G") * s.count("B")
for i in range(1, n-1):
  for j in range(i+1, n):
    k = 2*j-i-1
    if(k >= n):
      break
    if(len({s[i-1], s[j-1], s[k]}) == 3):
        sum -= 1
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
sum = 0
for i in range(1, n-1):
  for j in range(i+1, n):
    if(s[i-1] == s[j-1]):
      continue
    k = {"R", "G", "B"} - {s[i-1], s[j-1]}
    k = k.pop()
    sum += s[j:].count(k)
    if(2*j-i-1 < n):
      if(s[2*j-i-1] == k):
        sum -= 1
print(sum)

Fixed submission:
n = int(input())
s = input()
sum = s.count("R") * s.count("G") * s.count("B")
for i in range(1, n-1):
  for j in range(i+1, n):
    k = 2*j-i-1
    if(k >= n):
      break
    if(len({s[i-1], s[j-1], s[k]}) == 3):
        sum -= 1
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
count = 0
for i in range(k+1):
  if(i>s):
    break
  for j in range(k+1):
    if(i+j>s):
      break
    for c in range(k+1):
      if(i + j + c == s):
        count += 1
print(count)

Fixed submission:
k, s = map(int, input().split())
count = 0
for i in range(k+1):
  for j in range(k+1):
    if(0 <= s-i-j and s-i-j <= k):
      count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
count = 0
for i in range(k+1):
  for j in range(k+1):
    for c in range(k+1):
      if(i + j + c == s):
        count += 1
print(count)

Fixed submission:
k, s = map(int, input().split())
count = 0
for i in range(k+1):
  for j in range(k+1):
    if(0 <= s-i-j and s-i-j <= k):
      count += 1
print(count)