Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s=input()
cnt=0
l=[i for i in i%2019==0]
print(s.count(l))

Fixed submission:
s=input()[::-1]
mod=[0]*2019
mod[0]=1
x=1
num=0
ans=0

for t in s:
    num += int(t) * x
    num %= 2019
    x *= 10
    x %= 2019
    mod[num] +=1

for u in mod:
    ans += u*(u-1)//2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
cnt=0
le=len(s)
for i in range(1,le-2):
    for j in range(i+3,le+1):
        number=s[i-1:j]
        if int(number)%2019==0:
            cnt+=1
            break
    else: continue
print(cnt)

Fixed submission:
s=input()[::-1]
mod=[0]*2019
mod[0]=1
x=1
num=0
ans=0

for t in s:
    num += int(t) * x
    num %= 2019
    x *= 10
    x %= 2019
    mod[num] +=1

for u in mod:
    ans += u*(u-1)//2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
cnt=0
le=len(s)
for i in range(1,le-2):
    for j in range(i+3,le+1):
        number=s[i-1:j]
        if int(number)%2019==0:
            cnt+=1
print(cnt)

Fixed submission:
s=input()[::-1]
mod=[0]*2019
mod[0]=1
x=1
num=0
ans=0

for t in s:
    num += int(t) * x
    num %= 2019
    x *= 10
    x %= 2019
    mod[num] +=1

for u in mod:
    ans += u*(u-1)//2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
cnt=0
le=len(s)
for i in range(1,le-3):
    for j in range(i+3,le+1):
        number=s[i-1:j]
        if int(number)%2019==0:
            cnt+=1
print(cnt)

Fixed submission:
s=input()[::-1]
mod=[0]*2019
mod[0]=1
x=1
num=0
ans=0

for t in s:
    num += int(t) * x
    num %= 2019
    x *= 10
    x %= 2019
    mod[num] +=1

for u in mod:
    ans += u*(u-1)//2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
cnt=0
for i in range(1,len(s)):
    for j in range(i+1,len(s)+1):
        number=s[i-1:j]
        if int(number)%2019==0:
            cnt+=1
print(cnt)

Fixed submission:
s=input()[::-1]
mod=[0]*2019
mod[0]=1
x=1
num=0
ans=0

for t in s:
    num += int(t) * x
    num %= 2019
    x *= 10
    x %= 2019
    mod[num] +=1

for u in mod:
    ans += u*(u-1)//2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=input().split()
li=[int(i) for i in l]
for m in range(1,n+1):
    print(li.count(m))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in a:
    ans[i-1]+=1
for i in range(n):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))
for m in range(1,n+1):
    print(l.count(m))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in a:
    ans[i-1]+=1
for i in range(n):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
while n-k>=0:
    n-=k
if n==0: print(0)
else: print(min(n,k-n))

Fixed submission:
n,k=map(int,input().split())
mod=n%k
print(min(mod,k-mod))
Buggy python submission (verdict: Time Limit Exceeded):
k,n=map(int,input().split())
a=list(map(int,input().split()))
m=0
for i in range(n):
    for j in range(i+1,n):
        l=min(a[j]-a[i],k-a[j]+a[i])
        m=max(m,l)
print(k-m)

Fixed submission:
k,n=map(int,input().split())
a=list(map(int,input().split()))
m=0
for i in range(n-1):
    m=max(m,a[i+1]-a[i])
m=max(m,k-a[n-1]+a[0])
print(k-m)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
l=set(a)
s=0

for i in l:
    cnt_i=a.count(i)
    s+=cnt_i*(cnt_i -1)/2

for i in a:
    cnt=a.count(i)
    print(int(s-cnt+1))

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))

c=collections.Counter(a)
s=0
for i in c.values():
    s+=i*(i-1)//2

for i in a:
    cnt=c[i]
    print(int(s-cnt+1))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
l=set(a)
li=[]

for i in l:
    cnt_i=a.count(i)
    li.append(cnt_i*(cnt_i -1)/2)
s=sum(li)

for i in a:
    cnt=a.count(i)
    print(int(s-cnt+1))

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))

c=collections.Counter(a)
s=0
for i in c.values():
    s+=i*(i-1)//2

for i in a:
    cnt=c[i]
    print(int(s-cnt+1))
Buggy python submission (verdict: Runtime Error):
ans=-1
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
for k in range(10**(n-1)-1,10**n):
    for i in range(m):
        if str(k)[l[i][0]-1]!=str(l[i][1]) or len(str(k))!=n:
            break
    else:
        ans=k
        break
print(ans)

Fixed submission:
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]

for x in range(1000):
    if len(str(x))==n:
        for i in range(m):
            if str(x)[sc[i][0]-1]==str(sc[i][1]):
                continue
            else:
                break
        else:
            print(x)
            break
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
ans=-1
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
for k in range(10**n):
    for i in range(m):
        if str(k)[l[i][0]-1]!=str(l[i][1]) or len(str(k))!=n:
            break
    else:
        ans=k
        break
print(ans)

Fixed submission:
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]

for x in range(1000):
    if len(str(x))==n:
        for i in range(m):
            if str(x)[sc[i][0]-1]==str(sc[i][1]):
                continue
            else:
                break
        else:
            print(x)
            break
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
ans=-1
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
for k in range(10**(n-1),10**n):
    for i in range(m):
        if str(k)[l[i][0]-1]!=str(l[i][1]):
            break
    else: 
        ans=k
        print(ans) 
        break
if ans==-1: print(-1)
if n==1 and l[0][0]==0: print(0)

Fixed submission:
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]

for x in range(1000):
    if len(str(x))==n:
        for i in range(m):
            if str(x)[sc[i][0]-1]==str(sc[i][1]):
                continue
            else:
                break
        else:
            print(x)
            break
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
x=list(map(int,input().split()))
ans=0
average=sum(x)//n

for i in x:
    ans+=(i=average)**2

print(ans)

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
x.sort()
ans=10**9

for i in range(x[0],x[-1]+1):
    temp=0
    for j in x:
        temp+=(j-i)**2
    ans=min(ans,temp)

print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
x=list(map(int,input().split()))
ans=[0]*(x[n-1]-x[0]+1)
for i in range(x[n-1]-x[0]+1):
    for j in x:
        ans[i]+=(j-i)**2
print(min(ans))

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
x.sort()
ans=10**9

for i in range(x[0],x[-1]+1):
    temp=0
    for j in x:
        temp+=(j-i)**2
    ans=min(ans,temp)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def is_ok(arg):
    if tmp - l[arg] < 0:
        return True
    return False

def meguru_binary_search(ng, ok):
    while abs(ng - ok) > 1:
        mid = (ng + ok) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

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

l.sort(reverse=True)
l += [0]

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        tmp = l[i] - l[j]
        c = meguru_binary_search(n, j)
        if c == j:
            break
        ans += c-j

print(ans)


Fixed submission:
from bisect import bisect_left

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

l.sort()

ans = 0

for i in range(n):
    for j in range(i+1, n):
        tmp = bisect_left(l, l[i]+l[j]) - 1
        ans += tmp - j

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def is_ok(arg):
    if l[arg] < tmp_sum:
        return True
    return False

def meguru_binary_search(ng, ok):
    while abs(ng - ok) > 1:
        mid = (ng + ok) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

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

l.sort()
l += [1001001001]

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        tmp_sum = l[i] + l[j]
        c = meguru_binary_search(n, j)
        ans += c-j

print(ans)


Fixed submission:
from bisect import bisect_left

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

l.sort()

ans = 0

for i in range(n):
    for j in range(i+1, n):
        tmp = bisect_left(l, l[i]+l[j]) - 1
        ans += tmp - j

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

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

comb = combinations(l, 3)
ans = 0

for a, b, c in comb:
    if a < b+c and b < c+a and c < a+b:
        ans += 1

print(ans)


Fixed submission:
from bisect import bisect_left

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

l.sort()

ans = 0

for i in range(n):
    for j in range(i+1, n):
        tmp = bisect_left(l, l[i]+l[j]) - 1
        ans += tmp - j

print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print(1+math,ceil((b-a)/(a-1)))

Fixed submission:
import math
a,b=map(int,input().split())
print(1+math.ceil((b-a)/(a-1)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(sorted(input()) for _ in range(n))

ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        if s[i] == s[j]:
            ans += 1

print(ans)


Fixed submission:
import collections

n = int(input())
s = list(sorted(input()) for _ in range(n))

l = []
for li in s:
    st = ''
    for x in li:
        st += x
    l.append(st)

c = collections.Counter(l)

ans = 0
for x in c.values():
    ans += x * (x - 1) // 2

print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

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

c = Counter(a)
s = set(a)
l = len(s)

if l == 1 and a[0] == 0:
    print('Yes')
elif len(a) % 3 == 0:
    if l == 2 and c[0] == n // 3:
        print('Yes')
    elif l == 3:
        if s[0] ^ s[1] ^ s[2] == 0:
            tmp = c[a[0]]
            if all(x == tmp for x in c.values()):
                print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')


Fixed submission:
from collections import Counter

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

c = Counter(a)
s = list(set(a))
l = len(s)

if l == 1 and a[0] == 0:
    print('Yes')
    exit()
if len(a) % 3 == 0:
    if l == 2 and c[0] == n // 3:
        print('Yes')
        exit()
    if l == 3 and s[0] ^ s[1] ^ s[2] == 0:
        tmp = n//3
        if all(x == tmp for x in c.values()):
            print('Yes')
            exit()

print('No')

Buggy python submission (verdict: Runtime Error):
from collections import Counter

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

c = Counter(a)
s = set(a)
l = len(s)

if l == 1 and a[0] == 0:
    print('Yes')
elif len(a) % 3 == 0:
    if l == 2 and c[0] == n // 3:
        print('Yes')
    elif l == 3:
        if s[0] ^ s[1] ^ s[2] == 0:
            tmp = c[a[0]]
            if all(x == tmp for x in c.values()):
                print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')


Fixed submission:
from collections import Counter

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

c = Counter(a)
s = list(set(a))
l = len(s)

if l == 1 and a[0] == 0:
    print('Yes')
    exit()
if len(a) % 3 == 0:
    if l == 2 and c[0] == n // 3:
        print('Yes')
        exit()
    if l == 3 and s[0] ^ s[1] ^ s[2] == 0:
        tmp = n//3
        if all(x == tmp for x in c.values()):
            print('Yes')
            exit()

print('No')
Buggy python submission (verdict: Runtime Error):
l,r=map(int,input().split())
if r-l>=2019: print(0)
else:
    ans=2018
    mod_l=l%2019
    mod_r=r%2019
    for i in range(min(mod_l,mod_r),max(mod_l,mod_r)+1):
        for j in range(i+1,max(mod_l,mod_r)+1):
            mod=(i*j)%2019
            if mod<ans: ans=mod
            else: ans=ans
print(ans)


Fixed submission:
l,r=map(int,input().split())
if r-l>=2019: print(0)
else:
    ans=2018
    mod_l=l%2019
    mod_r=r%2019
    for i in range(min(mod_l,mod_r),max(mod_l,mod_r)+1):
        for j in range(i+1,max(mod_l,mod_r)+1):
            mod=(i*j)%2019
            if mod<ans: ans=mod
    print(ans)

Buggy python submission (verdict: Runtime Error):
l,r=map(int,input().split())
if r-l>=2019: print(0)
else:
    ans=2018
    mod_l=l%2019
    mod_r=r%2019
    for i in range(min(mod_l,mod_r),max(mod_l,mod_r)+1):
        for j in range(i+1,max(mod_l,mod_r)+1):
            mod=(i*j)%2019
            if mod<ans: ans=mod
            else: continue
print(ans)

Fixed submission:
l,r=map(int,input().split())
if r-l>=2019: print(0)
else:
    ans=2018
    mod_l=l%2019
    mod_r=r%2019
    for i in range(min(mod_l,mod_r),max(mod_l,mod_r)+1):
        for j in range(i+1,max(mod_l,mod_r)+1):
            mod=(i*j)%2019
            if mod<ans: ans=mod
    print(ans)

Buggy python submission (verdict: Runtime Error):
l,r=map(int,input().split())
if r-l>=2019: print(0)
else:
    ans=2018
    mod_l=l%2019
    mod_r=r%2019
    for i in range(min(mod_l,mod_r),max(mod_l,mod_r)+1):
        for j in range(i+1,max(mod_l,mod_r)+1):
            mod=(i*j)%2019
            if mod<ans: ans=mod
print(ans)

Fixed submission:
l,r=map(int,input().split())
if r-l>=2019: print(0)
else:
    ans=2018
    mod_l=l%2019
    mod_r=r%2019
    for i in range(min(mod_l,mod_r),max(mod_l,mod_r)+1):
        for j in range(i+1,max(mod_l,mod_r)+1):
            mod=(i*j)%2019
            if mod<ans: ans=mod
    print(ans)
Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]

ac_list = [0]*n

for i in range(n):
    if s[i] == 'A' and s[i+1] == 'C':
        ac_list[i] = 1

for l, r in lr:
    l -= 1
    r -= 1
    print(ac_list[l:r].count(1))


Fixed submission:
from itertools import accumulate

n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]

ac_list = [0]*n

for i in range(n-1):
    if s[i] == 'A' and s[i+1] == 'C':
        ac_list[i] = 1

ac_sum = list(accumulate(ac_list))

for l, r in lr:
    l -= 1
    r -= 1
    if l == 0:
        print(ac_sum[r-1])
        continue
    print(ac_sum[r-1] - ac_sum[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
def eratosthenes(n):
    prime = [2]
    limit = int(n**0.5)
    prime_list = [i + 1 for i in range(2, n, 2)]
    while True:
        p = prime_list[0]
        if limit <= p:
            return prime + prime_list
        prime.append(p)
        prime_list = [e for e in prime_list if e % p != 0]

def prime_factorize(n):
    prime_list = eratosthenes(n)
    arr = []

    for p in prime_list:
        if n % p == 0:
            cnt = 0
            while n % p == 0:
                n //= p
                cnt += 1
            arr.append([p, cnt])

    return arr



n, p = map(int, input().split())

ans = 1

if p == 1:
    print(1)
    exit()

pr_list = prime_factorize(p)

for a, b in pr_list:
    if b >= n:
        ans *= a ** (b // n)

print(ans)


Fixed submission:
def prime_factorize(n):
    arr = []
    if n % 2 == 0:
        cnt = 0
        while n % 2 == 0:
            cnt += 1
            n //= 2
        arr.append([2, cnt])

    p = 3
    while p * p <= n:
        if n % p == 0:
            cnt = 0
            while n % p == 0:
                n //= p
                cnt += 1
            arr.append([p, cnt])
            p += 2
        else:
            p += 2
            continue

    if n != 1:
        arr.append([n, 1])

    return arr



n, p = map(int, input().split())

ans = 1

if p == 1:
    print(1)
    exit()

pr_list = prime_factorize(p)

for a, b in pr_list:
    if b >= n:
        ans *= a ** (b // n)

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
l = []
for i in range(len(s)-1, -1, -1):
    if s[i] == 'B':
        l.append(0)
    else:
        l.append(1)
cnt = 0

for j in range(len(s)**0.5):
    for i in range(j, len(s) - 1, 2):
        if l[i] == 1 and l[i+1] == 0:
            l[i] = 0
            l[i+1] = 1
            cnt += 1

print(cnt)


Fixed submission:
s = input()

left = 0
ans = 0

for x in s:
    if x == 'B':
        left += 1
        continue
    ans += left

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
l = []
for i in range(len(s)-1, -1, -1):
    if s[i] == 'B':
        l.append(0)
    else:
        l.append(1)
cnt = 0

for j in range(len(s)):
    for i in range(j, len(s) - 1, 2):
        if l[i] == 1 and l[i+1] == 0:
            l[i] = 0
            l[i+1] = 1
            cnt += 1

print(cnt)


Fixed submission:
s = input()

left = 0
ans = 0

for x in s:
    if x == 'B':
        left += 1
        continue
    ans += left

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
l = []
for i in range(len(s)-1, -1, -1):
    if s[i] == 'B':
        l.append(0)
    else:
        l.append(1)
cnt = 0

for j in range(len(s)):
    for i in range(j, len(s) - 1, 2):
        if l[i] == 1 and l[i+1] == 0:
            l[i] = 0
            l[i+1] = 1
            cnt += 1

print(cnt)


Fixed submission:
s = input()

left = 0
ans = 0

for x in s:
    if x == 'B':
        left += 1
        continue
    ans += left

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
row = [1 for i in range(m)]
field = [row for i in range(n)]

dc = [-1, 0, 1, -1, 0, 1, -1, 0, 1]
dr = [-1, -1, -1, 0, 0, 0, 1, 1, 1]

for i in range(n):
    for j in range(m):
        for k in range(9):
            r = i + dr[k]
            c = j + dc[k]

            if r < 0 or r > n-1 or c < 0 or c > m-1:
                continue

            field[r][c] *= -1

ans = 0
for x in field:
    for y in x:
        if y == -1:
            ans += 1

print(ans)


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

n -= 2
m -= 2

ans = 0

if n == 0 or m == 0:
    ans = 0

elif n == -1 and m == -1:
    ans = 1

elif n == -1 or m == -1:
    ans = max(n, m)

else:
    ans = n * m

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

s = set(a)

ans = 0

for x in s:
    c = a.count(x)
    if c > x:
        ans += c - x
    if c < x:
        ans += c

print(ans)


Fixed submission:
import collections

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

c = collections.Counter(a)
ans = 0

for k, v in c.items():
    if k > v:
        ans += v
    if k < v:
        ans += v - k
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

s = set(a)

ans = 0

for x in s:
    c = a.count(x)
    if c > x:
        ans += c - x
    if c < x:
        ans += c

print(ans)


Fixed submission:
import collections

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

c = collections.Counter(a)
ans = 0

for k, v in c.items():
    if k > v:
        ans += v
    if k < v:
        ans += v - k
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(int(input()) for i in range(n))

ans = 0
for bit in range(2 ** n):
    tmp = 0
    for i in range(n):
        if (bit >> i) & 1:
            tmp += s[i]
    
    if tmp % 10 != 0 and tmp > ans:
        ans = tmp

print(ans)


Fixed submission:
n = int(input())
s = list(int(input()) for i in range(n))

s.sort()

ans = sum(s)

if ans % 10 != 0:
    print(ans)
    exit()
else:
    for x in s:
        if x % 10 != 0:
            ans -= x
            print(ans)
            exit()
print(0)
Buggy python submission (verdict: Runtime Error):
import time
start = time.time()
a, b, c = map(int, input().split())

cnt = 0
a_list = [0]*(1001001)
b_list = [0]*(1001001)
c_list = [0]*(1001001)
a_list[0] = a
b_list[0] = b
c_list[0] = c

for i in range(1, 10**9):
    a_list[i] = (b_list[i-1] + c_list[i-1]) // 2
    b_list[i] = (c_list[i-1] + a_list[i-1]) // 2
    c_list[i] = (a_list[i-1] + b_list[i-1]) // 2
    cnt += 1
    if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:
        break
    if time.time() - start >= 1.5:
        cnt = -1
        break

print(cnt)


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

if any(i % 2 != 0 for i in [a, b, c]):
    print(0)
    exit()

if a == b and b == c:
    print(-1)
    exit()

cnt = 0
a_list = [0]*(1001001)
b_list = [0]*(1001001)
c_list = [0]*(1001001)
a_list[0] = a
b_list[0] = b
c_list[0] = c

for i in range(1, 1001001):
    a_list[i] = (b_list[i-1] + c_list[i-1]) // 2
    b_list[i] = (c_list[i-1] + a_list[i-1]) // 2
    c_list[i] = (a_list[i-1] + b_list[i-1]) // 2
    cnt += 1
    if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:
        break

print(cnt)

Buggy python submission (verdict: Runtime Error):
import time
start = time.time()
a, b, c = map(int, input().split())

cnt = 0
a_list = [0]*(1001001)
b_list = [0]*(1001001)
c_list = [0]*(1001001)
a_list[0] = a
b_list[0] = b
c_list[0] = c

for i in range(1, 10**9):
    a_list[i] = (b_list[i-1] + c_list[i-1]) // 2
    b_list[i] = (c_list[i-1] + a_list[i-1]) // 2
    c_list[i] = (a_list[i-1] + b_list[i-1]) // 2
    cnt += 1
    if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:
        break
    if time.time() - start >= 1:
        cnt = -1
        break

print(cnt)


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

if any(i % 2 != 0 for i in [a, b, c]):
    print(0)
    exit()

if a == b and b == c:
    print(-1)
    exit()

cnt = 0
a_list = [0]*(1001001)
b_list = [0]*(1001001)
c_list = [0]*(1001001)
a_list[0] = a
b_list[0] = b
c_list[0] = c

for i in range(1, 1001001):
    a_list[i] = (b_list[i-1] + c_list[i-1]) // 2
    b_list[i] = (c_list[i-1] + a_list[i-1]) // 2
    c_list[i] = (a_list[i-1] + b_list[i-1]) // 2
    cnt += 1
    if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:
        break

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
b = []
for _ in range(n):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)

ans = 0
for i in range(n-1, -1, -1):
    a[i] += ans
    while a[i] % b[i] != 0:
        ans += 1
        a[i] += 1

print(ans)


Fixed submission:
n = int(input())
a = []
b = []
for _ in range(n):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)

ans = 0
for i in range(n-1, -1, -1):
    a[i] += ans
    mod = a[i] % b[i]
    if mod != 0:
        if a[i] > b[i]:
            ans += b[i] - mod
        else:
            ans += b[i] - a[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
n=input()
s=(n*(n+1))/2
print(s)

Fixed submission:
n=int(input())
print(int(n*(n+1)/2))
Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
if count(l,5)==2 and count(l,7)==1:
  print('YES')
else:
  print('NO')

Fixed submission:
l=map(int,input().split())
if sorted(l)==[5,5,7]:
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Runtime Error):
list=map(int,input().split())
li=sortrd(list)
if li=[5,5,7]:
  print('YES')
else:
  print('NO')

Fixed submission:
l=map(int,input().split())
if sorted(l)==[5,5,7]:
  print('YES')
else:
  print('NO')