Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def main():
    x, k, d = map(int, input().split())
    x = abs(x)
    count_p = abs(x // d) 
    count_m = abs(x // d) + 1
    if abs(x - (count_p*d)) <= abs((x - count_m*d)):
        small_count = count_p
    else:
        small_count = count_m
    if small_count > k:
        print(abs(x - (k * d)))
    else:
        if x - (small_count*d) != 0:
            if (k % small_count) % 2 == 0:
                print(abs(x - (small_count*d)))
            else:
                print(abs(x - (small_count*(d+1))))
        else:
            if (k % small_count) % 2 == 0:
                print(d)
            else:
                print(0)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    x, k, d = map(int, input().split())
    x = abs(x)
    count = x // d
    if count > k:
        ans = x - (k*d)
    else:
        if k % 2 == count % 2:
            ans = x - (count*d)
        else:
            ans = x - (count+1) * d
    print(abs(ans))
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    money = 1000
    kabu_c = 0
    l = list()
    for i in range(n-1):
        if A[i+1] - A[i] > 0:
            l.append(1)
        else:
            l.append(0)
    for idx, i in enumerate(l):
        if i == 1:
            while  money - A[idx] >= 0:
                money = money - A[idx]
                kabu_c += 1
        if i == 0:
            money = money + (kabu_c * A[idx])
            kabu_c = 0
    if kabu_c > 0:
        money = money + (kabu_c * A[n-1])
    print(money)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    money = 1000
    kabu_c = 0
    l = list()
    for i in range(n-1):
        if A[i+1] - A[i] > 0:
            l.append(1)
        else:
            l.append(0)
    for idx, i in enumerate(l):
        if i == 1 and money - A[idx] >= 0:
            kabu_c = money // A[idx]
            money = money - (kabu_c * A[idx])
        if i == 0:
            money = money + (kabu_c * A[idx])
            kabu_c = 0
    if kabu_c > 0:
        money = money + (kabu_c * A[n-1])
    print(money)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = [0] * (n+1)
 
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if n <= N:
                ans[n] += 1
print(*ans[1:], sep='\n')

Fixed submission:
from itertools import product 
from collections import Counter
def main():
    N = int(input())
    pattern = list(product(list(range(1, 100)),repeat=3))
    l = list()
    for i in pattern:
        x, y, z = i
        n = x**2 + y**2 + z**2 + x*y + y*z + z*x
        l.append(n)
    ans = Counter(l)
    for i in range(1, N+1):
        if ans.get(i) == None:
            print(0)
        else:
            print(ans.get(i))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
for v in ['AC', 'WA', 'TLE', 'RE']:
    print(v, 'x',  a.count(v))

Fixed submission:
from collections import Counter

def main():
    n = int(input())
    s = [input() for i in range(n)]
    ac = 0    
    wa = 0
    tle = 0
    re = 0
    for i in s:
        if i == 'AC':
            ac += 1
        elif i == 'WA':
            wa += 1
        elif i == 'TLE':
            tle += 1
        elif i == 'RE':
            re += 1
    print('AC x ', ac, sep='')
    print('WA x ', wa, sep='')
    print('TLE x ', tle, sep='')
    print('RE x ', re, sep='')

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n, m, k = map(int, input().split())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]

    maxv = 0
    acum = [0] * (n + 1)
    bcum = [0] * (m + 1)
    for i in range(n):
        acum[i + 1] = acum[i] + a[i]
    for i in range(m):
        bcum[i + 1] = bcum[i] + b[i]

    for i in range(n + 1):
        if acum[i] > k:
            continue
        maxv = max(maxv, i + bisect_right(bcum, k - acum[i]) - 1)
    print(maxv)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n, m, k = map(int, input().split())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]

    acum = [0] * (n + 1)
    bcum = [0] * (m + 1)
    for i in range(n):
        acum[i + 1] = acum[i] + a[i]
    for i in range(m):
        bcum[i + 1] = bcum[i] + b[i]
        
    j = m
    maxv = 0
    for i in range(n+1):
        if acum[i] > k:
            break
        while acum[i] + bcum[j] > k:
            j -= 1
        maxv = max(maxv, i + j)
    print(maxv)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
from collections import deque
from heapq import heapify, heappush, heappop
def main():
    n, m, k = map(int, input().split())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]
    a_q = deque(a)
    b_q = deque(b)
    i = 0
    l = []
    heapify(l)
    point = 0
    cnt = 0
    aq = a_q.popleft()
    bq = b_q.popleft()
    heappush(l, aq)
    heappush(l, bq)
    if sum(a) + sum(b) <= k:
        print(len(a) + len(b))
    else:
        while point <= k:
            min_l = heappop(l)
            if point + min_l > k:
                print(cnt)
                exit()
            else:
                point += min_l
                cnt += 1
            if min_l == aq:
                if len(a_q) != 0:
                    aq = a_q.popleft()
                    heappush(l, aq)
            else:
                if len(b_q) != 0:
                    bq = b_q.popleft()
                    heappush(l, bq)
        print(cnt)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n, m, k = map(int, input().split())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]

    acum = [0] * (n + 1)
    bcum = [0] * (m + 1)
    for i in range(n):
        acum[i + 1] = acum[i] + a[i]
    for i in range(m):
        bcum[i + 1] = bcum[i] + b[i]
        
    j = m
    maxv = 0
    for i in range(n+1):
        if acum[i] > k:
            break
        while acum[i] + bcum[j] > k:
            j -= 1
        maxv = max(maxv, i + j)
    print(maxv)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        for N in range(i, n+1, i):
            ans += N
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        # y = n // i
        # y = (y+1)*y*i//2
        ans += ((n//i)+1) * (n//i) * i // 2
    print(ans)
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    ans = []
    A = [26, 702, 18278, 475254, 12356630, 321272406, 8353082582, 217180147158, 5646683826134, 146813779479510]
    for i in range(9, 0, -1):
        if n > A[i-1]:
            a = n // 26**i
            if a <= 26:
                ans.append(chr(96+a))
                n = n - (26**i*a)
            else:
                a = 26
                ans.append(chr(96+a))
                n = n - (26**i*a)
    ans.append(chr(96+n))
    print(*ans, sep='')
 
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    ans = []
    for i in range(1, 12):
        if n <= 26**i:
            n -= 1
            for j in range(i):
                a = n % 26
                ans.append(chr(97+a))
                n = n // 26
            break
        else:
            n -= 26**i
    print(*ans[::-1], sep='')
 
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    ans = []
    A = [26, 702, 18278, 475254, 12356630, 321272406, 8353082582, 217180147158, 5646683826134, 146813779479510]
    for i in range(9, 0, -1):
        if n > A[i-1]:
            a = n // 26**i
            if a <= 26:
                ans.append(chr(96+a))
                n = n - (26**i*a)
            else:
                a = 26
                ans.append(chr(96+a))
                n = n - (26**i*a)
    ans.append(chr(96+n))
    print(*ans, sep='')

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    ans = []
    for i in range(1, 12):
        if n <= 26**i:
            n -= 1
            for j in range(i):
                a = n % 26
                ans.append(chr(97+a))
                n = n // 26
            break
        else:
            n -= 26**i
    print(*ans[::-1], sep='')
 
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    ans = []
    A = [3817158266467286,  146813779479510, 5646683826134, 217180147158, 8353082582, 321272406, 12356630, 475254,  18278, 702, 26]
    for i in range(11, 0, -1):
        if n > A[11-i]:
            a = n // 26**i
            if a == 27:
                a = 26
                print('i',i,  'a',a)
                ans.append(chr(96+a))
                n = n - (26**i*a)
    ans.append(chr(96+n))
    print(*ans, sep='')

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    ans = []
    for i in range(1, 12):
        if n <= 26**i:
            n -= 1
            for j in range(i):
                a = n % 26
                ans.append(chr(97+a))
                n = n // 26
            break
        else:
            n -= 26**i
    print(*ans[::-1], sep='')
 
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    ans = sum(a)
    q = int(input())
    d = dict((x,a.count(x)) for x in set(a))
    # Counterを敢えて使わないでやってみる
    # d = Counter(a)
    for _ in range(q):
        b, c = map(int, input().split())
        # cの値がない場合の対処
        d.setdefault(c, 0)
        # bの値がない場合の対処
        d[c] = d.get(c) + d.get(b, 0)
        # 差分はbの個数 * (c-b) 
        diff = d.get(b, 0) * (c-b)
        d[b] = 0
        ans += diff
        print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
from collections import Counter

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    ans = sum(a)
    q = int(input())
    #d = dict((x,a.count(x)) for x in set(a))
    d = Counter(a)
    for _ in range(q):
        b, c = map(int, input().split())
        # cの値がない場合の対処
        d.setdefault(c, 0)
        # bの値がない場合の対処
        d[c] = d.get(c) + d.get(b, 0)
        # 差分はbの個数 * (c-b) 
        diff = d.get(b, 0) * (c-b)
        d[b] = 0
        ans += diff
        print(ans)
        
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    q = int(input())
    for i in range(q):
        b, c = map(int, input().split())
        a = [c if i == b else i for i in a]
        ans = sum(a)
        print(ans)
        
if __name__ == '__main__':
    main()

Fixed submission:
from collections import Counter

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    ans = sum(a)
    q = int(input())
    #d = dict((x,a.count(x)) for x in set(a))
    d = Counter(a)
    for _ in range(q):
        b, c = map(int, input().split())
        # cの値がない場合の対処
        d.setdefault(c, 0)
        # bの値がない場合の対処
        d[c] = d.get(c) + d.get(b, 0)
        # 差分はbの個数 * (c-b) 
        diff = d.get(b, 0) * (c-b)
        d[b] = 0
        ans += diff
        print(ans)
        
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a_s = sorted(a)
    a_set = set(a_s)
    maxv = max(a)
    res = [0] * maxv
    rep = 0
    for i in a_s:
        if res[i-1] == 0:
            for j in range(i, maxv+1, i):
                res[j-1] += 1
        else:
            res[i-1] +=1
    cnt = 0
    for i in range(n):
        if res[a[i]-1] == 1:
            cnt += res[a[i]-1]
    print(cnt)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    x = list(map(int, input().split()))
    ans = x.index(0) + 1
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    x = int(input())
    y = int(input())
    l = list()
    l.append(2*x)
    for i in range(1, x+1):
        l.append(2*x + i*2)
    if y in l:
        print('Yes')
    else:
        print('No')
        
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    x, y = map(int, input().split())
    l = list()
    l.append(2*x)
    for i in range(1, x+1):
        l.append(2*x + i*2)
    if y in l:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    for i in a:
        cnt = 0
        for j in range(n):
            if i % a[j] == 0:
                cnt += 1
        if cnt == 1:
            ans += 1
    print(ans)
    
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a_s = sorted(a)
    a_set = set(a_s)
    maxv = max(a)
    res = [0] * maxv
    rep = 0
    for i in a_s:
        if i in a_set:
            if res[i-1] == 0:
                for j in range(i, maxv+1, i):
                    res[j-1] += 1
            else:
                res[i-1] +=1
    cnt = 0
    for i in range(n):
        if res[a[i]-1] == 1:
            cnt += res[a[i]-1]
    print(cnt)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    if n % 2 == 1:
        a1 = a[:int((n-1)/2)]
        a2 = a[int((n-1)/2):]
    else:
        a1 = a[:int(n/2)]
        a2 = a[int(n/2):]
    res1 = 1
    res2 = 1
    for i in a1:
        res1 *= i
    for i in a2:
        res2 *= i
    res = res1 * res2
    if res <= 10 ** 18:
        print(res)
    else:
        print(-1)
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a_s = sorted(a)
    res = 1
    for i in a_s:
        res *= i
        if res == 0:
            print(0)
            break
        if res > 10 ** 18:
            print(-1)
            break
    if res > 0 and res <= 10 ** 18:
        print(res)
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    res = 1
    for i in a:
        res *= i
    if res <= 10 ** 18:
        print(res)
    else:
        print(-1)
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a_s = sorted(a)
    res = 1
    for i in a_s:
        res *= i
        if res == 0:
            print(0)
            break
        if res > 10 ** 18:
            print(-1)
            break
    if res > 0 and res <= 10 ** 18:
        print(res)
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
  
    a, b = map(str, input().split())
    res = int(a) * ((int(b)+0.001) * 100) // 100
    print(int(res))
 
if __name__ == '__main__':
    main()

Fixed submission:
from decimal import *
def main():
    a, b = map(str, input().split())
    res = int(a) * Decimal(b)
    print(int(res))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
  
    a, b = map(int, input().split())
    res = a * ((b+0.001) * 100) // 100
    print(int(res))
 
if __name__ == '__main__':
    main()

Fixed submission:
from decimal import *
def main():
    a, b = map(str, input().split())
    res = int(a) * Decimal(b)
    print(int(res))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    a, b, c, k = map(int, input().split())
    res = 0
    for i in range(a):
        res += 1
    # if k-a > 0:
    #     for i in range(k-a):
    #         res += 0
    if k-a-b > 0:
        for i in range(k-a-b):
            res += -1
    print(res)
                
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    a, b, c, k = map(int, input().split())
    res = 0
    if k-a >= 0:
        res += a
    else:
        res += k
    # if k-a-b >= 0:
    #     res += 0
    if k-a-b > 0:
        res += (k-a-b)*-1
    print(res)
                
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from copy import deepcopy

def main():
    n, k = map(int, input().split())
    a = [int(x)-1 for x in input().split()]
    cnt = 0
    next_posi = 0
    # 何回できたことのあるところにいくか
    visited = set()
    visited.add(0)
    for _ in range(n):
        next_posi = a[next_posi]
        cnt += 1
        if next_posi not in visited:
            visited.add(next_posi)
        else:
            break
    # print('cnt', cnt)
    cnt2 = 0
    visited_posi = deepcopy(next_posi)
    for _ in range(k-cnt):
        next_posi = a[next_posi]
        cnt2 += 1
        if next_posi == visited_posi:
            break
    # print('cnt2', cnt2)
    mod = (k-cnt) % cnt2
    # print('mod', mod)
    for _ in range(mod):
        next_posi = a[next_posi]
    print(next_posi+1)

if __name__ == '__main__':
    main()

Fixed submission:
from copy import deepcopy

def main():
    n, k = map(int, input().split())
    a = [int(x)-1 for x in input().split()]
    visited = set()
    i = 0
    cnt = 0
    # 途中で前に行ったところに行ったら終わり
    # kが小さくてcnt == kになってもおわり
    while True:
        if i in visited:
            break
        visited.add(i)
        cnt += 1
        i = a[i]
        if cnt == k:
            print(i+1)
            exit()
    k -= cnt
    period = list()
    period.append(i)
    i = a[i]
    # 何回で同じ場所に戻るか
    while True:
        if i == period[0]:
            break
        period.append(i)
        i = a[i]
    # 余り
    mod = k % len(period)
    ans = period[mod]
    print(ans+1)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    s = input()
    if s == 'ABC':
        print('ARC')
    else:
        print('ABC')
if __name__ == '__main__':
    main(

Fixed submission:
def main():
    s = input()
    if s == 'ABC':
        print('ARC')
    else:
        print('ABC')
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):


def main():
    mod = 10 ** 9 + 7
    cnt = 0
    for i in range(k, n+2):
        l = (i-1)*i//2
        h = (n+n-i+1)*i//2
        cnt += h - l + 1
    print(cnt % mod)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n, k = map(int, input().split())
    mod = 10 ** 9 + 7
    cnt = 0
    for i in range(k, n+2):
        l = (i-1)*i//2
        h = (n+n-i+1)*i//2
        cnt += h - l + 1
    print(cnt % mod)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n, k = map(int, input().split())
    minv = n
    for _ in range(100000000):
        if abs(minv - k) < abs(minv):
            minv = abs(minv - k)
        else:
            print(minv)
            exit()

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n, k = map(int, input().split())
    if n - k > k:
        n_k = (n-k) // k
        minv = n - k * n_k
    else:
        minv = n

    def min_x(x):
        minv = x
        for _ in range(3):
            if abs(minv - k) < abs(minv):
                minv = abs(minv - k)
            else:
                print(minv)
                exit()
        print(minv)
        
    min_x(minv)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
def main():
    n = int(input())
    s = [input() for _ in range(n)]
    s_c = Counter(s)
    # keys = [k for k, v in s_c.items() if v == max(s_c.values())]
    # keys_s = sorted(keys)
    keys =[k for k, v in s_c.items() if v == s_c.most_common()[0][1]]
    keys_s = sorted(keys)
    print(*keys_s, sep='\n')

if __name__ == '__main__':
    main()

Fixed submission:
from collections import Counter
def main():
    n = int(input())
    s = [input() for _ in range(n)]
    s_c = Counter(s)
    s_c_max = s_c.most_common()[0][1]
    keys =[k for k, v in s_c.items() if v == s_c_max]
    keys_s = sorted(keys)
    print(*keys_s, sep='\n')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
def main():
    n = int(input())
    s = [input() for _ in range(n)]
    s_c = Counter(s)
    keys = [k for k, v in s_c.items() if v == max(s_c.values())]
    keys_s = sorted(keys)
    print(*keys_s, sep='\n')

if __name__ == '__main__':
    main()

Fixed submission:
from collections import Counter
def main():
    n = int(input())
    s = [input() for _ in range(n)]
    s_c = Counter(s)
    s_c_max = s_c.most_common()[0][1]
    keys =[k for k, v in s_c.items() if v == s_c_max]
    keys_s = sorted(keys)
    print(*keys_s, sep='\n')

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    h = [int(x) for x in input().split()]
    h_s = sorted(h)
    if len(h_s) <= k:
        ans = 0
    else:
        for _ in range(k):
            h_s.pop()
        ans = sum(h_s)
    print(ans)

if __name__ == '__main__':
    main(

Fixed submission:
def main():
    n, k = map(int, input().split())
    h = [int(x) for x in input().split()]
    h_s = sorted(h)
    if len(h_s) <= k:
        ans = 0
    else:
        for _ in range(k):
            h_s.pop()
        ans = sum(h_s)
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n, m = map(int, input().split())
    p = [0] * m
    S = [0] * m
    for i in range(m):
        p[i], S[i] = map(str , input().split())
        p = [int(s) for s in p]
    # 問題によってカウントしたい
    WA = [0] * (n+1)
    # 全体として何個かがわかればいい
    AC = [False] * (n+1)
    for i in range(m):
        # AC出ててなくて、WAでたらカウント、AC出たらフラグ変更        
        if not AC[p[i]]:
            if S[i] == 'WA':
                WA[p[i]] += 1
            else:
                AC[p[i]] = True
        # AC出てるから次へ
        else:
            continue
    wa = sum(WA)
    ac = sum(AC)
    print(ac, wa)
        
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n, m = map(int, input().split())
    P = [0] * m
    S = [0] * m
    for i in range(m):
        P[i], S[i] = map(str , input().split())
    # p = [int(s) for s in p]
    # 問題によってカウントしたい
    WA = [0] * (n+1)
    # 全体として何個かがわかればいい
    AC = [False] * (n+1)
    cnt = 0
    for i in range(m):
        p = int(P[i])
        if AC[p]:
            continue
        else:
            if S[i] == 'WA':
                WA[p] += 1
            else:
                AC[p] = True
                cnt += WA[p]
    # wa = sum(WA)
    ac = sum(AC)
    print(ac, cnt)
        
if __name__ == '__main__':
    main()