Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02842 (python)

Fixed submission:
N= int(input())
X1 = N / 1.08
X = int(X1)
N_calc = int(X*1.08)
N_calc2 = int((X+1)*1.08)
if N_calc == N :
    print(X)
elif N_calc2==N:
    print(X+1)
else :
    print(":(")

Buggy submission (verdict: Runtime Error):

N= int(input())
X1 = N / 1.08
X = int(X1)
N_calc = int(X*1.08)
N_calc2 = int((X+1)*1.08)
if N_calc == N :
    print(X)
elif: N_calc2==N:
    print(X+1)
else :
    print(":(")
Problem p02924 (python)

Fixed submission:
N = int(input())
if N%2==0:
  N_=int(N/2)
  print(N_*(N-1))
else:
  N_=int((N-1)/2)
  print(N_*N)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N%2==0:
  N_=int(N/2)
  print(N_*(N-1))
else N%2!=0:
  N_=int((N-1)/2)
  print(N_*N)
Problem p03062 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
if 0 in A:
  A = list(map(abs,A))
  print(sum(A))
else:
  count=0
  min_A =100000000000000000
  for i in range(N):
    if A[i]<0:
      count=count+1
    if abs(A[i])<min_A:
      min_A = abs(A[i])
  A = list(map(abs,A))
  if count%2==0:
    print(sum(A))
  else:
    print(sum(A)-min_A*2)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int,input().split())
if 0 in A:
  print(sum(A))
else:
  count=0
  min_A =100000000000000000
  for i in range(N):
    if A[i]<0:
      count=count+1
    if abs(A[i])<min_A:
      min_A = abs(A[i])
  print(sum(A)-min_A)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int,input())
if 0 in A:
  print(sum(A))
else:
  count=0
  min_A =100000000000000000
  for i in range(N):
    if A[i]<0:
      count=count+1
    if abs(A[i])<min_A:
      min_A = abs(A[i])
  print(sum(A)-min_A)
Problem p02936 (python)

Fixed submission:
from collections import deque

n, q = map(int, input().split())
ab = [[] for _ in range(n)]
px = [0 for _ in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    ab[a - 1].append(b - 1)
    ab[b - 1].append(a - 1)
for i in range(q):
    p, x = map(int, input().split())
    px[p - 1] += x

ans = px
queue = deque([(0, 0)])
while len(queue) > 0:
    prev, a = queue.pop()
    for c in ab[a]:
        if c != prev:
            ans[c] += ans[a]
            queue.append((a, c))

print(*ans)

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
ab = [[] for _ in range(n)]
px = [0 for _ in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    ab[a - 1].append(b - 1)
    ab[b - 1].append(a - 1)
for i in range(q):
    p, x = map(int, input().split())
    px[p - 1] += x

visited = [False for _ in range(n)]


def dfs(current):
    for c in ab[current]:
        if visited[c]:
            continue
        ans[c] += ans[current]
        visited[c] = True
        dfs(c)


ans = px
visited[0] = True
dfs(0)
print(*ans)

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
ab = [[] for _ in range(n)]
px = [0 for _ in range(n)]
ans = [0 for _ in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    ab[a - 1].append(b - 1)
for i in range(q):
    p, x = map(int, input().split())
    px[p - 1] += x


def dfs(current, v):
    vv = v + px[current]
    ans[current] = vv
    for c in ab[current]:
        dfs(c, vv)


dfs(0, 0)
print(' '.join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
ab = [[] for _ in range(n)]
pq = [0 for _ in range(n)]
ans = [0 for _ in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    ab[a - 1].append(b - 1)
for i in range(q):
    p, q = map(int, input().split())
    pq[p - 1] += q


def dfs(parent, v):
    vv = v + pq[parent]
    ans[parent] = vv
    for c in ab[parent]:
        dfs(c, vv)


dfs(0, 0)
for a in ans:
    print(a)
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
ls = list(map(int, input().split()))

d = 0
count = 1
for a in ls:
    d += a
    if d <= x:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
ls = list(map(int, input().split()))

d = 0
count = 0
while d <= x:
    d += ls[count]
    count += 1

print(count)
Problem p03061 (python)

Fixed submission:
n = int(input())
aa = list(map(int, input().split()))

import fractions

head = {}
head[0] = aa[0]
for i in range(1, n):
    head[i] = fractions.gcd(head[i - 1], aa[i])

tail = {}
tail[n - 1] = aa[-1]
for i in range(n - 2, -1, -1):
    tail[i] = fractions.gcd(tail[i + 1], aa[i])

candidate = 1
for i in range(0, n):
    if i == 0:
        gcd2 = tail[i + 1]
        candidate = max(gcd2, candidate)
    elif i == n - 1:
        gcd1 = head[i - 1]
        candidate = max(gcd1, candidate)
    else:
        gcd1 = head[i - 1]
        gcd2 = tail[i + 1]
        candidate = max(fractions.gcd(gcd1, gcd2), candidate)

print(candidate)

Buggy submission (verdict: Runtime Error):
n = int(input())
aa = list(map(int, input().split()))

import math

table = {}  ## (start, end) => gcd

for i in range(0, n):
    if i > 0:
        gcd = aa[0]
        for j in range(0, i):
            gcd = math.gcd(gcd, aa[j])
        table[(0, i)] = gcd

    if i < n - 1:
        gcd = aa[i + 1]
        for j in range(i + 1, n):
            gcd = math.gcd(gcd, aa[j])

        table[(i + 1, n)] = gcd

candidate = 1
for i in range(0, n):
    if i == 0:
        gcd2 = table[(i + 1, n)]
        candidate = max(gcd2, candidate)
    elif i == n - 1:
        gcd1 = table[(0, i)]
        candidate = max(gcd1, candidate)
    else:
        gcd1 = table[(0, i)]
        gcd2 = table[(i + 1, n)]
        candidate = max(math.gcd(gcd1, gcd2), candidate)

print(candidate)
Problem p03063 (python)

Fixed submission:
n = int(input())
s = input()

a = [(0, 0) for _ in range(len(s) + 1)]

i = 0
while i < len(s):
    bs, ws = a[i + 1]
    b0, w0 = a[i]

    if s[i] == '#':
        bs += 1
    else:
        ws += 1

    a[i + 1] = (bs + b0, ws + w0)
    i += 1


i = 0
can = len(s)
while i < len(a):
    can = min(can, a[i][0] + a[-1][1] - a[i][1])
    i += 1

print(can)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()

def trim(n, s):
    i = 0
    while i < n and s[i] == '.':
        i += 1
    start = i

    i = n
    while i > 0 and s[i - 1] == '#':
        i -= 1
    end = i

    return s[start:end]


def f(n, s):
    bs = 0
    ws = 0

    for c in s:
        if c == '#':
            bs += 1
        else:
            ws += 1
    return min(ws, bs)


def g(n, s):
    bs = 0
    ws = 0
    i = 0
    while i < n:
        if s[i] == '#':
            bs += 1
        else:
            break
        i += 1

    i = len(s)
    while i > 0:
        if s[i - 1] == '.':
            ws += 1
        else:
            break
        i -= 1

    return bs + ws

s = trim(n, s)
print(min(f(n, s), g(n, s)))
Problem p02641 (python)

Fixed submission:
[X, N] = list(map(int, input().split()))
A = []
try:
  P = list(map(int, input().split()))
  list_int = [x for x in range(0, 102)]
  list_int_d = list(set(list_int) - set(P))
  list_int_d.sort()
  for i in list_int_d:
    A.append(abs(X - i))
  if 0 in A:
    print(X)
  else:
    Index = A.index(min(A))
    print(list_int_d[Index])
except EOFError:
  print(X)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
try:
  list_P = [int(p) for p in input().split()]
  list_not_P = [x for x in range(min(list_P)-1, max(list_P)+2) if not x in list_P]
  list_abs = [abs(x - i) for i in list_not_P]
  Index = list_abs.index(min(list_abs))
  print(list_not_P[Index])
except EOFError:
  print(x)
Problem p03644 (python)

Fixed submission:
N = int(input())
if N == 1:
  print(1)
elif 2 <= N <= 3:
  print(2)
elif 4 <= N <= 7:
  print(4)
elif 8 <= N <= 15:
  print(8)
elif 16 <= N <= 31:
  print(16)
elif 32 <= N <= 63:
  print(32)
elif 64 <= N <= 100:
  print(64)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N = 1:
  print(1)
elif 2 <= N <= 3:
  print(2)
elif 4 <= N <= 7:
  print(4)
elif 8 <= N <= 15:
  print(8)
elif 16 <= N <= 31:
  print(16)
elif 32 <= N <= 63:
  print(32)
elif 64 <= N <= 100:
  print(64)
Problem p02690 (python)

Fixed submission:
import sys

X = int(input())
for i in range(-118, 120):
    for j in range(-119, 119):
        if i ** 5 - j ** 5 == X:
            print(i, j)
            sys.exit(0)

Buggy submission (verdict: Runtime Error):
X = int(input())

b = 0
while 1:
    a = (X + b ** 5) ** (1/5)
    if a.is_integer() == True:
        break
    b = -b
    a = (X + b ** 5) ** (1/5)
    if a.is_integer() == True:
        break
    b = -b
    b += 1
print(int(a), b)

Buggy submission (verdict: Runtime Error):
X = int(input())

b = 0
while 1:
    a = (X + b ** 5) ** (1/5)
    if a.is_integer() == True:
        break
    b = -b
    a = (X + (b) ** 5) ** (1/5)
    if a.is_integer() == True:
        break
    b = -b
    b += 1
print(int(a), b)
Problem p02714 (python)

Fixed submission:
N = int(input())
S = input()

RN = S.count('R')
GN = S.count('G')
BN = S.count('B')

ans = RN * GN * BN

for i in range(N):
    for d in range(N):
        j = i + d
        k = i + 2 * d
        if k >= N:
            break
        if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            ans -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

RN = S.count('R')
GN = S.sount('G')
BN = S.count('B')

ans = RN * GN * BN

for i in range(N):
    for d in range(N):
        j = i + d
        k = i + 2 * d
        if k >= N:
            break
        if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            ans -= 1

print(ans)
Problem p02924 (python)

Fixed submission:
import numpy as np

n=int(input())
print(int((n-1)*n//2))
"""
if n==1:
    print(0)
else:
    plist=list(range(1,n+1))
    qlist=list(range(2,n+1))
    qlist.append(1)
    parray=np.array(plist)
    qarray=np.array(qlist)
    rarray=parray%qarray
    sm=rarray.sum()
    print(sm)
"""

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

n=int(input())
if n==1:
    print(0)
else:
    plist=list(range(1,n+1))
    qlist=list(range(2,n+1))
    qlist.append(1)
    parray=np.array(plist)
    qarray=np.array(qlist)
    rarray=parray%qarray
    sm=rarray.sum()
    print(sm)

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

n=int(input())
plist=list(range(1,n+1))
qlist=list(range(2,n+1))
qlist.append(1)
parray=np.array(plist)
qarray=np.array(qlist)
rarray=parray%qarray
sm=rarray.sum()
print(sm)
Problem p03160 (python)

Fixed submission:
n = int(input())
H = list(map(int,input().split()))

Dp = [0] * n

Dp[1] = abs(H[1] - H[0])     

for i in range(2, n):
    Dp[i] = min(Dp[i-1] + abs(H[i] - H[i-1]), Dp[i-2] + abs(H[i] - H[i-2]))
    
print(Dp[-1])

Buggy submission (verdict: Runtime Error):
INF = 10 ** 4 + 10

n = int(input())
H = list(map(int, input().split()))
DP = [INF] * n

def rec(i):
    if DP[i] < INF:
        return DP[i]

    if i == 0:
        return 0
    
    res = INF
    res = min(res, rec(i-1) + abs(H[i] - H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    DP[i] = res
    return res

print(rec(n-1))
Problem p02646 (python)

Fixed submission:
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

dist = abs(B-A)
r_vel = V - W

if r_vel * T >=dist:
  print("YES")
 
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if A < B and V <= W:
  print("NO")
elif B < A and W <= V:
  print("NO")
else:
  if A+V*i >= 0:
    if A+V*i >= B+W*i:
      print("YES")
    else:
      print("NO")
  elif A+V*i < 0:
    if abs(A+V*i) <= abs(B+W*i):
      print("YES")
    else:
      print("NO")

Buggy submission (verdict: Runtime Error):
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
flag = False
if A < B and V <= W:
  print("NO")
elif B < A and W <= V:
  print("NO")
else:
  if A+V*i > 0:
    if A+V*i >= B+W*i:
      print("YES")
    else:
      print("NO")
  elif A+V*i < 0:
    if abs(A+V*i) <= abs(B+W*i):
      print("YES")
    else:
      print("NO")
Problem p02681 (python)

Fixed submission:
S = input()
T = input()
flag = False
for i in "abcdefghijklmnopqrstuvwxyz":
  if T==S+i:
    print("Yes")
    flag = True
    break
if flag == False:
  print("No")

Buggy submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())
res = 0
if A>=K:
  res= 1*A
else:
  for b in range(K-A,B+1):
    c = K-A-b
    ans = 1*A + 0*b + (-1)*c
    res = max(res,ans)
print(res)
Problem p03061 (python)

Fixed submission:
import fractions
from functools import reduce
N = int(input())
A = list(map(int,input().split()))
#累積GCD
left = [0]*(N+1)
right = [0]*(N+1)
for i in range(N):
  left[i+1] = (fractions.gcd(left[i],A[i]))
  right[N-i-1] = (fractions.gcd(right[N-i],A[N-1-i]))

ans = 0
for i in range(N):
  ans = max(ans,fractions.gcd(left[i],right[i + 1]))
print(ans)

Buggy submission (verdict: Runtime Error):
import functools
import math
N = int(input())
A = list(map(int,input().split()))
result = [0]*N
tmp = 0
for i in range(N):
  tmp = A.pop(i)
  result[i] = functools.reduce(math.gcd, A)
  A.insert(i,tmp)

print(max(result))

Buggy submission (verdict: Runtime Error):
import functools
import math
N = int(input())
A = list(map(int,input().split()))
result = [0]*N
tmp = 0
for i in range(N):
  tmp = A.pop(i)
  result[i] = functools.reduce(math.gcd, A)
  A.insert(i,tmp)

print(max(result))
Problem p02882 (python)

Fixed submission:
import math 

arr = input().split()
a = int(arr[0])
b = int(arr[1])
x = int(arr[2])
if b*a*a > x:
    ans1 = 90-math.atan(a*a*a/(2.0*(b*a*a-x)))/math.acos(-1)*180
else:
    ans1 = 0.0
ans2 = math.atan(a*b*b/2/x)/math.acos(-1)*180

if a*a*b/2 <= x:
    print (ans1)
else:
    print (ans2)

Buggy submission (verdict: Runtime Error):
import math 

arr = input().split()
a = int(arr[0])
b = int(arr[1])
x = int(arr[2])
if b*a*a >= x:
    ans1 = 90-math.atan(a*a*a/(2.0*(b*a*a-x)))/math.acos(-1)*180
else:
    ans1 =0
ans2 = math.atan(a*b*b/2/x)/math.acos(-1)*180

if ans1 <= 45.0:
    print (ans1)
else:
    print (ans2)

Buggy submission (verdict: Runtime Error):
import math 

arr = input().split()
a = int(arr[0])
b = int(arr[1])
x = int(arr[2])
ans1 = 90-math.atan(a*a*a/(2.0*(b*a*a-x)))/math.acos(-1)*180
ans2 = math.atan(a*b*b/2/x)/math.acos(-1)*180

if ans1 <= 45.0:
    print (ans1)
else:
    print (ans2)
Problem p02609 (python)

Fixed submission:
n = int(input())
x = input()
num = 0
count = 0
for i in range(n):
    if x[-(i+1)] == "1":
        num += 2**i
        count += 1

mod = [[0, 0] for _ in range(n)]
mod[0][0] = 1%(count-1) if count!=1 else 0
mod[0][1] = 1%(count+1)
for i in range(1, n):
    if mod[i-1][0] != 0:
        mod[i][0] = (mod[i-1][0]*2)%(count-1)
    if mod[i-1][1] != 0:
        mod[i][1] = (mod[i-1][1]*2)%(count+1)
mod1 = num%(count-1) if count!=1 else 0
mod2 = num%(count+1)

table = [0]*(2*10**5+10)
for i in range(2*10**5+10):
    _num = i
    while True:
        _count = 0
        for c in bin(_num):
            if c == "1":
                _count += 1
        if _num == 0:
            break
        _num %= _count
        table[i] += 1

ans = [0]*n
for i in range(n):
    if x[-(i+1)] == "1":
        _num = num-2**i
        if _num == 0:
            continue
        _num = (mod1-mod[i][0])%(count-1)
    else:
        _num = num+2**i
        _num = (mod2+mod[i][1])%(count+1)
    ans[i] = 1+table[_num]
for i in range(n):
    print(ans[-(i+1)])

Buggy submission (verdict: Runtime Error):
n = int(input())
x = input()
num = 0
count = 0
for i in range(n):
    if x[-(i+1)] == "1":
        num += 2**i
        count += 1

mod = [0]*n
for i in range(n):
    mod[i] = (2**i%(count-1), 2**i%(count+1))
mod1 = num%(count-1)
mod2 = num%(count+1)

ans = [0]*n
for i in range(n):
    if x[-(i+1)] == "1":
        _num = num-2**i
        if _num == 0:
            continue
        _num = (mod1-mod[i][0])%(count-1)
    else:
        _num = num+2**i
        _num = (mod1-mod[i][1])%(count+1)
    ans[i] += 1
    _count = 0
    for c in bin(_num):
        if c == "1":
            _count += 1
    while True:
        if _num == 0:
            break
        _num %= _count
        _count = 0
        for c in bin(_num):
            if c == "1":
                _count += 1
        ans[i] += 1
for i in range(n):
    print(ans[-(i+1)])
Problem p02641 (python)

Fixed submission:
x,n = map(int,input().split())
P = list(map(int,input().split()))


all_l = [i for i in range(0,101)]
for p in P:
    all_l.remove(p)

kouho = x
for i in range(200):
    kouho1 = x-i
    kouho2 = x+i
    if kouho1 not in P:
        print(x-i)
        break
    elif kouho2 not in P:
        print(x+i)
        break

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
P = list(map(int,input().split()))


all_l = [i for i in range(1,101)]
for p in P:
    all_l.remove(p)

ans = []
c = 0
dic = {}
for a in all_l:
    if c == 0:
        diff = abs(x-a)
    c+=1
    diff_now = abs(x-a)
    diff = min(diff,diff_now)
    memo = diff_now
    if memo == diff:
        dic['{}'.format(str(a))] = diff
        
l = []
for k,v in  dic.items():
    l.append(v)
m = min(l)
k_list = []
for k,v in dic.items():
    if v==m:
        k_list.append(k)
print(int(max(k_list)))

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
P = list(map(int,input().split()))


all_l = [i for i in range(1,101)]
for p in P:
    all_l.remove(p)

ans = []
c = 0
dic = {}
for a in all_l:
    if c == 0:
        diff = abs(x-a)
    c+=1
    diff_now = abs(x-a)
    diff = min(diff,diff_now)
    #print(diff,diff_now)
    memo = diff_now
    #print('memo:',memo,'diff:',diff)
    if memo == diff:
        dic['{}'.format(str(a))] = diff
        
        
l = []
for k,v in  dic.items():
    l.append(v)
m = min(l)
k_list = []
for k,v in dic.items():
    if v==m:
        k_list.append(k)
#print(k_list)
int(max(k_list))

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
P = list(map(int,input().split()))


all_l = [i for i in range(1,101)]
for p in P:
    all_l.remove(p)

ans = []
c = 0
dic = {}
for a in all_l:
    if c == 0:
        diff = abs(x-a)
    c+=1
    diff_now = abs(x-a)
    diff = min(diff,diff_now)
    #print(diff,diff_now)
    memo = diff_now
    #print('memo:',memo,'diff:',diff)
    if memo == diff:
        dic['{}'.format(str(a))] = diff
        
        
l = []
for k,v in  dic.items():
    l.append(v)
m = min(l)
k_list = []
for k,v in dic.items():
    if v==m:
        k_list.append(k)
#print(k_list)
max(k_list)
Problem p02690 (python)

Fixed submission:
#166d
x = int(input())
for i in range(-120,120):
    for j in range(-120,120):
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Buggy submission (verdict: Runtime Error):
#166d
x = int(input())
for i in range(-118,119):
    for j in range(-118,119):
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Buggy submission (verdict: Runtime Error):
#166d
x = int(input())
for i in range(-118,119):
    for j in range(-118,119):
        print(i,j)
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Buggy submission (verdict: Runtime Error):
#166d
x = int(input())
for i in range(-73,73):
    for j in range(-73,73):
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Buggy submission (verdict: Runtime Error):
#166d
x = int(input())
for i in range(-73,73):
    for j in range(-73,73):
        print(i,j)
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)
Problem p02714 (python)

Fixed submission:
n = int(input())
s = input()

R=[]
G=[]
B=[]

for i in range(n):
    if s[i] == "R":
        R.append(i)
    elif s[i] == "G":
        G.append(i)
    else:
        B.append(i)

ans = len(R)*len(G)*len(B)
for i in range(n-2):
    for j in range(i+1,n-1):
        k  = 2*j-i
        if k<n:
            if (s[i]!=s[j]) and (s[i]!=s[k]) and (s[j]!=s[k]):
                ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()

R=[]
G=[]
B=[]

for i in range(n):
    if s[i] == "R":
        R.append(i)
    elif s[i] == "G":
        G.append(i)
    else:
        B.append(i)

ans = len(R)*len(G)*len(B)
for i in range(n-2):
    for j in range(i+1,n-1):
        k  = 2*j-i
        if k<n:
            if (s[i]=s[j]) and (s[i]=s[k]) and (s[j]=s[k]):
                ans-=1
print(ans)
Problem p02732 (python)

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

from collections import Counter
count = Counter(A)
 
s = 0
for c in list(count.values()):
    s += c*(c-1)/2

ans = 0
for a in A:
    n = count[a]
    ans = s - n*(n-1)/2 + (n-1)*(n-2)/2
    print(int(ans))

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10**6)

n = int(input())
a_l = list(map(int, input().split()))

cnt = [0 for i in range(n)]

for i in range(n):
    cnt[a_l[i]]+=1
ans = 0

for a in cnt:
    ans += a*(a-1)/2
for i in range(n):
    print(int(ans - (cnt[a_l[i]]-1)))

Buggy submission (verdict: Runtime Error):
n = int(input())
a_l = list(map(int, input().split()))

cnt = [0 for i in range(n)]

for i in range(n):
    cnt[a_l[i]]+=1
ans = 0

for a in cnt:
    ans += a*(a-1)/2
for i in range(n):
    print(int(ans - (cnt[a_l[i]]-1)))

Buggy submission (verdict: Runtime Error):
n = int(input())
a_l = list(map(int, input().split()))

cnt = [0 for i in range(n)]

for i in range(n):
    cnt[a_l[i]]+=1
ans = 0

for a in cnt:
    ans += a*(a-1)/2
for i in range(n):
    print(ans - (cnt[a_l[i]]-1))
Problem p02844 (python)

Fixed submission:
n = int(input())
s = input()
cnt = 0
for i in range(1000):
    p = '{:03}'.format(i)
    s2 = s
    for j in range(3):#indexのループ
        if s2.find(p[j]) == -1:
            break
        s2 = s2[s2.find(p[j]) +1:]
    else:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
pin_li = []
for i in range(len(s)):
    if len(set(pin_li)) >1000:
        break
    for j in range(i+1,len(s)):
        for k in range(j+1,len(s)):
            pin_li.append(s[i]+s[j]+s[k])
            if len(set(pin_li)) > 1000:
                break
print(len(set(pin_li
Problem p02922 (python)

Fixed submission:
import math
A, B = map(int, input().split())
print(math.ceil((B-1)/(A-1)))

Buggy submission (verdict: Runtime Error):
A, B = map(input, int().split())
print((B-1)//(A-1))
Problem p03280 (python)

Fixed submission:
a, b = map(int,input().split())
print((a-1)*(b-1))

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().sprit())
print((a-1)*(b-1))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print((a-1)*(b-1))
Problem p03282 (python)

Fixed submission:
s = list(input())
k = input()

if k == '1':
    print(s[0])
else:
    n = min(int(k), len(s))
    f = True
    for i in range(n):
        if s[i] != '1':
            print(s[i])
            f = False
            break
    if f:
        print(1)

Buggy submission (verdict: Runtime Error):
s = list(input())
k = input()

if k == '1':
    print(s[0])
else:
    n = int(k)-1
    f = True
    for i in range(n):
        if s[i] != '1':
            print(s[i])
            f = False
    if f:
        print(s[n])

Buggy submission (verdict: Runtime Error):
s = list(input())
k = int(input())

if k == '1':
    print(s[0])
else:
    if s[0] == '1':
        print(s[1])
    else:
        print(s[0])