Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    way = [[] for i in range(n)]
    for _ in [0]*(n-1):
        a,b = map(int,ipt().split())
        way[a].append(b)
        way[b].append(a)
    rt = -1
    for i in range(n):
        if len(way[i]) > 2:
            rt = i
            break

    def dp(pp,np):
        sum = 0
        n0 = 0
        for i in way[np]:
            if i == pp:
                continue
            tmp = dp(np,i)
            sum += tmp
            if tmp == 0:
                n0 += 1
        if n0 > 1:
            sum += n0-1
        return sum

    if rt == -1:
        print(1)
        exit()
    else:
        print(dp(-1,rt))

    return

if __name__ == '__main__':
    main()


Fixed submission:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    way = [[] for i in range(n)]
    for _ in [0]*(n-1):
        a,b = map(int,ipt().split())
        way[a].append(b)
        way[b].append(a)
    rt = -1
    for i in range(n):
        if len(way[i]) > 2:
            rt = i
            break

    def dp(pp,np):
        sum = 0
        n0 = 0
        for i in way[np]:
            if i == pp:
                continue
            tmp = dp(np,i)
            sum += tmp
            if tmp == 0:
                n0 += 1
        if n0 > 1:
            sum += n0-1
        return sum

    if rt == -1:
        print(1)
        exit()
    else:
        print(dp(-1,rt))

    return

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int,input().split()))
ans = 0

flag = False
for i in range(n):
    if flag:
        flag = False
        continue
    if p[i] == i+1:
        if i < n+1 and p[i+1] == i+2:
            flag = True
        ans += 1

print(ans)


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

flag = False
for i in range(n):
    if flag:
        flag = False
        continue
    if p[i] == i+1:
        if i < n-1 and p[i+1] == i+2:
            flag = True
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,ma,mb = map(int,ipt().split())
    mds = [list(map(int,ipt().split())) for i in [0]*n]
    fmt = "0"+str(n)+"b"
    mi = 10**18
    for i in range(2**n):
        li = list(map(int,format(i,fmt)))
        sa = 0
        sb = 0
        cst = 0
        for i,lii in enumerate(li):
            if lii == 1:
                sa += mds[i][0]
                sb += mds[i][1]
                cst += mds[i][2]
        if sa*mb == sb*ma > 0 and mi > cst:
            mi = cst

    if mi == 10**18:
        print(-1)
    else:
        print(mi)

    return

if __name__ == '__main__':
    main()


Fixed submission:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,ma,mb = map(int,ipt().split())
    dp = [[10**18]*(n*10+1) for _ in [0]*(n*10+1)]
    dp[0][0] = 0
    for _ in range(n):
        a,b,c = map(int,ipt().split())
        for i in range(n*10+1-a):
            dpi = dp[n*10-i-a]
            dpni = dp[n*10-i]
            for j in range(n*10+1-b):
                if dpni[n*10-j] > dpi[n*10-j-b]+c:
                    dpni[n*10-j] = dpi[n*10-j-b]+c
    mi = 10**18
    for i in range(1,n*10//max(ma,mb)+1):
        m = dp[ma*i][mb*i]
        if m < mi:
            mi = m
    if mi == 10**18:
        print(-1)
    else:
        print(mi)
    return

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
#    n = 10**5
    ls_by = [[] for i in range(n+1)]
    for i in range(2,n+1):
        a = int(ipt())
        ls_by[a].append(i)
    def dpt(k):
        st = []
        for i in ls_by[k]:
            st.append(dpt(i)+1)
        st.sort(reverse=True)
        ma = 0
        for i,si in enumerate(st):
            if si+i > ma:
                ma = si+i
        return ma

    print(dpt(1))


    return None

if __name__ == '__main__':
    main()


Fixed submission:
import sys
import resource
n = int(input())
sys.setrecursionlimit(10**5)

wl = [[] for i in range(n+1)]

for i in range(2,n+1):
    ai = int(input())
    wl[ai].append(i)

dp = [-1 for i in range(n+1)]

def calc_dp(a):
    if len(wl[a]) == 0:
        return 0
    else:
        dps = []
        for i in wl[a]:
            dps.append(calc_dp(i))
        dps.sort(reverse=True)
        ma = 0
        for i,dpi in enumerate(dps):
            if ma < dpi+i:
                ma = dpi+i
        return ma+1

print(calc_dp(1))

Buggy python submission (verdict: Runtime Error):
import queue
n = int(input())

wl = [[] for i in range(n+1)]

for i in range(2,n+1):
    ai = int(input())
    wl[ai].append(i)

dp = [-1 for i in range(n+1)]

def calc_dp(a):
    if len(wl[a]) == 0:
        return 0
    else:
        dps = []
        for i in wl[a]:
            dps.append(calc_dp(i))
        dps.sort(reverse=True)
        ma = 0
        for i,dpi in enumerate(dps):
            if ma < dpi+i:
                ma = dpi+i
        return ma+1

print(calc_dp(1))


Fixed submission:
import sys
import resource
n = int(input())
sys.setrecursionlimit(10**5)

wl = [[] for i in range(n+1)]

for i in range(2,n+1):
    ai = int(input())
    wl[ai].append(i)

dp = [-1 for i in range(n+1)]

def calc_dp(a):
    if len(wl[a]) == 0:
        return 0
    else:
        dps = []
        for i in wl[a]:
            dps.append(calc_dp(i))
        dps.sort(reverse=True)
        ma = 0
        for i,dpi in enumerate(dps):
            if ma < dpi+i:
                ma = dpi+i
        return ma+1

print(calc_dp(1))
Buggy python submission (verdict: Runtime Error):
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,m = map(int,ipt().split())
    cos = []
    row = []
    col = []
    for _ in range(m):
        a,b,c = map(int,ipt().split())
        row.append(a-1)
        col.append(b-1)
        cos.append(c)
        cos.append(c)
    csr = csr_matrix((cos,(row,col)),shape=(n,n))
    d = dijkstra(csr,directed=False)
    ans = 0
    for i in range(m):
        csr = csr_matrix((cos[:i:]+cos[i+1::],(row[:i:]+row[i+1::],col[:i:]+col[i+1::])),shape=(n,n))
        di = dijkstra(csr)
        if (di == d).all():
            ans += 1
    print(ans)
    return

if __name__ == '__main__':
    main()


Fixed submission:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,m = map(int,ipt().split())
    cos = []
    row = []
    col = []
    for _ in range(m):
        a,b,c = map(int,ipt().split())
        row.append(a-1)
        col.append(b-1)
        cos.append(c)
    csr = csr_matrix((cos,(row,col)),shape=(n,n))
    d = dijkstra(csr,directed=False)
    ans = 0
    for i in range(m):
        rwi = row[i]
        cli = col[i]
        csi = cos[i]
        dri = d[rwi]
        dci = d[cli]
        for j in range(n):
            if dri[j] + csi == dci[j]:
                break
            if j == n-1:
                ans += 1
    print(ans)
    return

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7 #998244353
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n,t = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    d = []
    u = []
    pv = 1000000
    for i in range(n-1):
        if pv > a[i] < a[i+1]:
            d.append(a[i])
        elif pv < a[i] > a[i+1]:
            u.append(a[i])
        if a[i] != a[i+1]:
            pv = a[i]

    if pv < a[-1]:
        u.append(a[-1])

    ds = []
    if len(u) != len(d):
        print(asdasd)
    for ui,di in zip(u,d):
        ds.append(ui-di)
    dma = max(ds)
    cnt = 0
    for i in ds:
        if dma == i:
            cnt += 1
    print(cnt)
    return None

if __name__ == '__main__':
    main()


Fixed submission:
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7 #998244353
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n,t = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    bs = []
    mi = a[0]
    for i in a[1::]:
        if mi < i:
            bs.append(i-mi)
        else:
            mi = i
    ma = max(bs)
    cnt = 0
    for i in bs:
        if i == ma:
            cnt += 1

    print(cnt)
    return None

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
print(input().strip()+('es' if s[-1] == 's' else 's'))


Fixed submission:
s = input()
print(s+('es' if s[-1] == 's' else 's'))

Buggy python submission (verdict: Runtime Error):
print(input()+('es' if s[-1] == 's' else 's'))

Fixed submission:
s = input()
print(s+('es' if s[-1] == 's' else 's'))
Buggy python submission (verdict: Time Limit Exceeded):

def resolve():
    INF = 10 ** 18
    N, K = map(int, input().split())
    P = list(map(lambda x: int(x) - 1, input().split()))
    C = list(map(int, input().split()))

    visited = [0] * N
    cycles = []

    for i in range(N):
        if visited[i]:
            continue
        score = []
        v = i
        visited[v] = True
        score.append(C[v])
        while not visited[P[v]]:
            v = P[v]
            visited[v] = True
            score.append(C[v])
        cycles.append(score)

    ans = -INF
    for cy in cycles:
        length = len(cy)
        c_num = max(0, (K - 1) // length - 1)
        total = max(0, sum(cy) * c_num)
        rest = K - (c_num * length)
        l_cy = cy + cy + cy
        for l in range(length):
            total_rest = 0
            for diff in range(rest):
                total_rest += l_cy[l + diff]
                ans = max(ans, total + total_rest)

    print(ans)


if __name__ == "__main__":
    resolve()

Fixed submission:

def resolve():
    INF = 10 ** 18
    N, K = map(int, input().split())
    P = list(map(lambda x: int(x) - 1, input().split()))
    C = list(map(int, input().split()))

    visited = [0] * N
    cycles = []

    for i in range(N):
        if visited[i]:
            continue
        score = []
        v = i
        visited[v] = True
        score.append(C[v])
        while not visited[P[v]]:
            v = P[v]
            visited[v] = True
            score.append(C[v])
        cycles.append(score)

    ans = -INF
    for cy in cycles:
        length = len(cy)
        c_num = max(0, (K - 1) // length - 1)
        total = max(0, sum(cy) * c_num)
        rest = K - (c_num * length)
        l_cy = cy + cy + cy
        for l in range(length):
            total_rest = 0
            for diff in range(rest):
                total_rest += l_cy[l + diff]
                ans = max(ans, total + total_rest)

    print(ans)


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):

def resolve():
    K = int(input())
    if K%2==0:
        return print(-1)
    seven = 0
    ans = 0
    while True:
        seven = (seven * 10 + 7) % K
        ans += 1
        if seven == 0:
            break
    print(ans)


if __name__ == "__main__":
    resolve()


Fixed submission:

def resolve():
    K = int(input())
    if K%2==0:
        return print(-1)
    
    seven = 7
    for i in range(1, K+10):
        if seven%K==0:
            return print(i)
        seven = (seven*10+7)%K

    print(-1)


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):

def resolve():
    X, N = map(int, input().split())
    if N == 0:
        print(X)
        return
    A = set(map(int, input().split()))
    dic = {}
    for i in range(1, 101):
        if i not in A:
            dic[i] = abs(X-i)

    sorted_A = sorted(dic.items(), key=lambda x:x[1])
    print(sorted_A[0][0])

if __name__ == "__main__":
    resolve()


Fixed submission:

def resolve():
    X, N = map(int, input().split())
    if N == 0:
        print(X)
        return
    A = set(map(int, input().split()))
    dic = {}
    for i in range(-10, 110):
        if i not in A:
            dic[i] = abs(X-i)

    sorted_A = sorted(dic.items(), key=lambda x:(x[1], x[0]))
    print(sorted_A[0][0])

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
inp = sys.stdin.buffer.readline
def inpS(): return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines 
MOD = 10**9+7
INF = 1<<60

from operator import mul
from functools import reduce
def resolve():
    N = int(inp())
    A = list(map(int, inp().split()))
    limit = 10**18
 
    _prod = reduce(mul, A)
    if _prod <= limit:
        print(_prod)
    else:
        print(-1)
        
if __name__ == "__main__":
    resolve()

Fixed submission:

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    limit = 10**18

    if 0 in A:
        print(0)
        return

    _mul = 1
    for a in A:
        _mul *= a
        if _mul > limit:
            print(-1)
            return

    print(_mul)

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):

from operator import mul
from functools import reduce
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    limit = 10**18

    _prod = reduce(mul, A)
    if _prod <= limit:
        print(_prod)
    else:
        print(-1)

if __name__ == "__main__":
    resolve()

Fixed submission:

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    limit = 10**18

    if 0 in A:
        print(0)
        return

    _mul = 1
    for a in A:
        _mul *= a
        if _mul > limit:
            print(-1)
            return

    print(_mul)

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    limit = 10**18
    _sum = 1
    for a in A:
        _sum *= a
    if _sum <= limit:
        print(_sum)
    else:
        print(-1)

if __name__ == "__main__":
    resolve()

Fixed submission:

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    limit = 10**18

    if 0 in A:
        print(0)
        return

    _mul = 1
    for a in A:
        _mul *= a
        if _mul > limit:
            print(-1)
            return

    print(_mul)

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    limit = 10**18
    _sum = 1
    for a in A:
        _sum *= a
    if _sum <= limit:
        print(_sum)
    else:
        print(-1)

if __name__ == "__main__":
    resolve()

Fixed submission:

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    limit = 10**18

    if 0 in A:
        print(0)
        return

    _mul = 1
    for a in A:
        _mul *= a
        if _mul > limit:
            print(-1)
            return

    print(_mul)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):

def resolve():
    MOD = 998244353
    N, S = map(int, input().split())
    A = list(map(int, input().split()))

    dp = [[0] * (S + 1) for _ in range(N + 1)]
    dp[0][0] = 1
    for i in range(N):
        for j in range(S + 1):
            dp[i + 1][j] += 2 * dp[i][j]
            dp[i + 1][j] %= MOD
            if j + A[i] <= S:
                dp[i + 1][j + A[i]] += dp[i][j]
                dp[i + 1][j + A[i]] %= MOD
    print(dp[N][S])


if __name__ == "__main__":
    resolve()

Fixed submission:

def resolve():
    MOD = 998244353
    N, S = map(int, input().split())
    A = list(map(int, input().split()))

    dp = [[0] * (S + 1) for _ in range(N + 1)]
    dp[0][0] = 1
    for i in range(N):
        for j in range(S + 1):
            dp[i + 1][j] += 2 * dp[i][j]
            dp[i + 1][j] %= MOD
            if j + A[i] <= S:
                dp[i + 1][j + A[i]] += dp[i][j]
                dp[i + 1][j + A[i]] %= MOD
    print(dp[N][S])


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):

def resolve():
    a, b,c,k = map(int, input().split())

    ans = 0
    used = min(k,a)
    ans += used * 1
    k -= used
    used = min(k, b)
    k -= used
    ans += k*(-1)
    print(ans)

if __name__ == "__main__":
    unittest.main()

Fixed submission:

def resolve():
    A, B, C, K = map(int, input().split())

    ans = 0
    cnt = min(K, A)
    ans += cnt * 1
    K -= cnt
    if K < 1:
        return print(ans)

    cnt = min(K, B)
    ans += cnt * 0
    K -= cnt
    if K < 1:
        return print(ans)

    ans += K * -1

    print(ans)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):

def resolve():
    N, A, B, C = map(int, input().split())
    S = [input() for _ in range(N)]

    ans = []
    def dfs(now, a, b, c):
        if now == N:
            return True
        if S[now] == "AB":
            if a == 0 and b == 0:
                return False
            if 0 < a and dfs(now+1, a-1, b+1, c):
                ans.append("B")
                return True
            if 0 < b and dfs(now+1, a+1, b-1, c):
                ans.append("A")
                return True
            return False
        if S[now] == "AC":
            if a == 0 and c == 0:
                return False
            if 0 < a and dfs(now+1, a-1, b, c+1):
                ans.append("C")
                return True
            if 0 < c and dfs(now+1, a+1, b, c-1):
                ans.append("A")
                return True
            return False
        if S[now] == "BC":
            if c == 0 and b == 0:
                return False
            if 0 < b and dfs(now+1, a, b-1, c+1):
                ans.append("C")
                return True
            if 0 < c and dfs(now+1, a, b+1, c-1):
                ans.append("B")
                return True
            return False

    dfs(0, A, B, C)
    if len(ans) == 0:
        print("No")
        return
    else:
        print("Yes")
        [print(a) for a in ans[::-1]]


if __name__ == "__main__":
    resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
inp = sys.stdin.buffer.readline
def inpS(): return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines 
 

def resolve():
    N, A, B, C = map(int, inp().split())
    S = [inpS() for _ in range(N)]
 
    ans = []
    def dfs(now, a, b, c):
        if now == N:
            return True
        if S[now] == "AB":
            if a == 0 and b == 0:
                return False
            if 0 < a and dfs(now+1, a-1, b+1, c):
                ans.append("B")
                return True
            if 0 < b and dfs(now+1, a+1, b-1, c):
                ans.append("A")
                return True
            return False
        if S[now] == "AC":
            if a == 0 and c == 0:
                return False
            if 0 < a and dfs(now+1, a-1, b, c+1):
                ans.append("C")
                return True
            if 0 < c and dfs(now+1, a+1, b, c-1):
                ans.append("A")
                return True
            return False
        if S[now] == "BC":
            if c == 0 and b == 0:
                return False
            if 0 < b and dfs(now+1, a, b-1, c+1):
                ans.append("C")
                return True
            if 0 < c and dfs(now+1, a, b+1, c-1):
                ans.append("B")
                return True
            return False
 
    dfs(0, A, B, C)
    if len(ans) == 0:
        print("No")
        return
    else:
        print("Yes")
        [print(a) for a in ans[::-1]]
 
 
if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):

def resolve():
    def f(x):
        res = (A*x)//B - A*(x//B)
        return res

    A, B, N = map(int, input().split())
    x = min(B-1, N)
    print(f(x))

if __name__ == "__main__":
    resolve():

Fixed submission:

def resolve():
    def f(x):
        res = (A*x)//B - A*(x//B)
        return res

    A, B, N = map(int, input().split())
    x = min(B-1, N)
    print(f(x))

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):

from collections import Counter
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    C = Counter(A)

    for i in range(1, N+1):
        print(C[i])

if __name__ == "__main__":
    unittest.main()

Fixed submission:

from collections import Counter
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    C = Counter(A)

    for i in range(1, N+1):
        print(C[i])

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

def resolve():
    N, X, Y = map(int, input().split())
    graph = np.zeros((N + 1, N + 1), dtype=np.int64)

    for i in range(1, N):
        graph[i, i+1] += 1
        graph[i+1, i] += 1
    graph[X, Y] = 1
    graph[Y, X] = 1

    dist = dijkstra(csgraph=csr_matrix(graph)).astype(np.int64)
    dist_U = np.triu(dist[1:, 1:])
    ans = []
    for i in range(1, N):
        cnt = sum(np.where(dist_U==i))
        ans.append(len(cnt))

    for a in ans:
        print(a)
        
if __name__ == "__main__":
    resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
inp = sys.stdin.buffer.readline
def inpS(): return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7

import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra


def resolve():
    N, X, Y = map(int, input().split())
    graph = np.zeros((N + 1, N + 1), dtype=np.int64)

    for i in range(1, N):
        graph[i, i + 1] += 1
        graph[i + 1, i] += 1
    graph[X, Y] = 1
    graph[Y, X] = 1

    dist = dijkstra(csgraph=csr_matrix(graph)).astype(np.int64)
    ans = np.bincount(dist[1:, 1:].ravel(), minlength=N) // 2
    return print(*ans[1:], sep='\n')


if __name__ == "__main__":
    resolve()