Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

n = list(map(int,input().split()))
nnn = [pow(2,i) for i in range(45)]
n.sort()
n.reverse()
kkk = len(str(bin(n[0]))) - 2
k = [[0,0] for i in range(kkk)]
nn = 1
co = 0
su = 0
for i in range(kkk):
	for j in range(a):
		if n[j] & nn > 0:
			k[i][1] += 1
		else:
			k[i][0] += 1
	nn *= 2
if nn != 1:
	nn //= 2
for i in range(kkk):
	if k[kkk-1-i][0] => k[kkk-1-i][1]:
		if su + pow(2,kkk-1-i) <= b:
			su += pow(2,kkk-1-i)
if su < b:
	nn *= 2
	while True:
		if su + nn > b:
			break
		else:
			co += nn*a
			nn *= 2
for i in range(a):
	co += su ^ n[i]
print(co)


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

fm = 0
for i in range(40,0,-1):
    x = 2**(i-1)
    p = 0
    q = 0
    for j in a:
        b = x & j
        p += x ^ b
        q += b
    if q >= p:
        fm += q
    else:
        if m >= x:
            fm += p
            m -= x
        else:
            fm += q
print(fm)

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

n = list(map(int,input().split()))
nnn = [pow(2,i) for i in range(45)]
n.sort()
n.reverse()
kkk = len(str(bin(n[0]))) - 2
k = [[0,0] for i in range(kkk)]
nn = 1
co = 0
su = 0
for i in range(kkk):
	for j in range(a):
		if n[j] & nn > 0:
			k[i][1] += 1
		else:
			k[i][0] += 1
	nn *= 2
if nn != 1:
	nn //= 2
for i in range(kkk):
	if k[kkk-1-i][0] => k[kkk-1-i][1]:
		if su + pow(2,kkk-1-i) <= b:
			su += pow(2,kkk-1-i)
if su <= b:
	nn *= 2
	while True:
		if su + nn > b:
			break
		else:
			co += nn*a
			nn *= 2
for i in range(a):
	co += su ^ n[i]
print(co)


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

fm = 0
for i in range(40,0,-1):
    x = 2**(i-1)
    p = 0
    q = 0
    for j in a:
        b = x & j
        p += x ^ b
        q += b
    if q >= p:
        fm += q
    else:
        if m >= x:
            fm += p
            m -= x
        else:
            fm += q
print(fm)

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

n = list(map(int,input().split()))
nnn = [pow(2,i) for i in range(45)]
n.sort()
n.reverse()
kkk = len(str(bin(n[0]))) - 2
k = [[0,0] for i in range(kkk)]
nn = 1
co = 0
su = 0
for i in range(kkk):
	for j in range(a):
		if n[j] & nn > 0:
			k[i][0] += 1
		else:
			k[i][1] += 1
	nn *= 2
if nn != 1:
	nn //= 2
for i in range(kkk):
	if k[44-i][1] > k[44-i][0]:
		if su + pow(2,44-i) <= b:
			su += pow(2,44-i)

for i in range(a):
	co += su ^ n[i]
print(co)


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

fm = 0
for i in range(40,0,-1):
    x = 2**(i-1)
    p = 0
    q = 0
    for j in a:
        b = x & j
        p += x ^ b
        q += b
    if q >= p:
        fm += q
    else:
        if m >= x:
            fm += p
            m -= x
        else:
            fm += q
print(fm)
Buggy python submission (verdict: Runtime Error):
n = int(input())

aa = []
for i in range(n):
	k,l = map(int,input().split())
	aa.append([k,l])
aa.sort(key = lambda x:x[1])
aa.reverse()
co = 0
ma = 0
kkk = 0
for i in range(n):
	if i % 2 == 0:
		ma = max(aa,key = lambda x:x[0])[0]
		for j in range(len(aa)):
			if ma == aa[j][0]:
				co += aa.pop(j)[0]
				break
	else:
		co -= aa.pop(0)[1]

print(co)


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

aa = min(b,c)

bb = b+c - a

if bb >= 0:
	print(aa,bb)
else:
	print(aa,0)
Buggy python submission (verdict: Runtime Error):
import heapq as hp
n,m = map(int,input().split())
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
a.sort(reverse = True)
d = {}
cd = {}
dp = 0
x = 0

for i in range(m):
    z,c = a[i]
    dp += z
    if c in d:
        hp.heappush(cd,z)
    else:
        d[c] = z
        x += 1
ans = dp + x**2
c = ans

for i in range(m,n):
    if len(cd) == 0:
        break
    z,v = a[i]
    if v in d:
        continue
    d[v] = z
    x += 1
    c = c - hp.heappop(cd)+d+2*x-1
    if c > ans:
        ans = c
print(ans)

Fixed submission:
n,m = map(int,input().split())
a = []
for i in range(n):
    r,t = map(int,input().split())
    a.append((t,r))
a.sort(reverse = True)
d = {}
cd = []
dp = 0
x = 0

for i in range(m):
    z,c = a[i]
    dp += z
    if c in d:
        cd.append(z)
    else:
        d[c] = z
        x += 1
cd.sort(reverse = True)
ans = dp + x**2
c = ans

for i in range(m,n):
    if len(cd) == 0:
        break
    z,v = a[i]
    if v in d:
        continue
    d[v] = z
    x += 1
    c = c - cd.pop()+z+2*x-1
    if c > ans:
        ans = c
print(ans)
Buggy python submission (verdict: Runtime Error):
a = "keyence"

b = input()

k = len(b)
j = 0
jj = 0
kk = [0 for i in range(8)]
if k == 7:
	if a == b:
		print("YES")
	else:
		print("NO")
elif k >= 8:
	for i in range(k):
		if j == -1:
			print("NO")
			break
		if b[i] == a[j]:
			j += 1
			if jj == 1:
				jj = 2
		elif jj == 0:
			jj = 1
		elif jj == 2:
			jj = 3
		if j == 7 and (jj == 0 or jj == 1 or jj == 2):
			j = -1
		if j == -1 and i == k-1:
			print("YES")
			break
	if j != -1:
		print("NO")

else:
	print("NO")


Fixed submission:
a = "keyence"

b = input()
o = 0
k = len(b)
j = 0
jj = 0
kk = [0 for i in range(8)]
al = 0
if k == 7:
	if a == b:
		print("YES")
	else:
		print("NO")
elif k >= 8:
	for i in range(k):
		if j == 7:
			al = 1
			print("YES")
			break
		if b[i] == a[j] and jj == 0:
			j += 1
		else:
			jj = 1
			o = j
		if jj == 1 and o == 0:
			if b[-7:] == a:
				print("YES")
				break
			else:
				print("NO")
				break
		elif jj == 1:
			if b[-(7-o):] == a[o:]:
				print("YES")
				break
			else:
				print("NO")
				break
else:
	print("NO")

Buggy python submission (verdict: Runtime Error):
a = "keyence"

b = input()

k = len(b)
j = 0
jj = 0
kk = [0 for i in range(8)]
if k == 7:
	if a == b:
		print("YES")
	else:
		print("NO")
elif k >= 8:
	for i in range(k):
		if b[i] == a[j]:
			j += 1
			if jj == 1:
				jj = 2
		elif jj == 0:
			jj = 1
		elif jj == 2:
			jj = 3
	if j == 7 and (jj == 0 or jj == 1 or jj == 2):
		j = -1
	if j == -1:
		print("YES")
	else:
		print("NO")

else:
	print("NO")


Fixed submission:
a = "keyence"

b = input()
o = 0
k = len(b)
j = 0
jj = 0
kk = [0 for i in range(8)]
al = 0
if k == 7:
	if a == b:
		print("YES")
	else:
		print("NO")
elif k >= 8:
	for i in range(k):
		if j == 7:
			al = 1
			print("YES")
			break
		if b[i] == a[j] and jj == 0:
			j += 1
		else:
			jj = 1
			o = j
		if jj == 1 and o == 0:
			if b[-7:] == a:
				print("YES")
				break
			else:
				print("NO")
				break
		elif jj == 1:
			if b[-(7-o):] == a[o:]:
				print("YES")
				break
			else:
				print("NO")
				break
else:
	print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = list(map(int,input().split()))
c = list(map(int,input().split()))
d = []
su  = 0
for i in range(a):
	d.append(b[i]-c[i])
	if b[i]-c[i] < 0:
		su += b[i]-c[i]

d.sort()
k = 0
j = 1
for i in range(a):
	if d[i] > 0:
		su += d[i]
		while d[i]:
			if abs(d[-j]) < d[i]:
				d[i] +=  d[-j]
				j += 1
				k += 1
			else:
				d[-j] += d[i]
		k += 1

if su < 0:
	print(-1)
else:
	print(k)



Fixed submission:
a = int(input())
b = list(map(int,input().split()))
c = list(map(int,input().split()))
d = []
su  = 0
kk = 0
for i in range(a):
	d.append(b[i]-c[i])
	if b[i]-c[i] < 0:
		su += b[i]-c[i]
		kk += 1

d.sort()
d.reverse()
k = 0

j = 1

for i in range(a):
	if d[i] > 0:
		su += d[i]
		while kk:
			if d[-j] < 0:
				if abs(d[-j]) <= d[i]:
					d[i] +=  d[-j]
					d[-j] = 0
					j += 1
					k += 1
					kk -= 1
					if d[i] == 0 or d[-j] > 0:
						k += 1
						break
					if i == a - j:
						k += 1
						break
				else:
					d[-j] += d[i]
					d[i] = 0
					k += 1
					break
			else:
				break
	if su >= 0:
		break

if su < 0:
	print(-1)
else:
	print(k)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

a,aa = map(int,input().split())

b = [10**10 for i in range(a)]

c = list(map(int,input().split()))
b[0] = 0
for i in range(1,a):
	k = min(i,aa)
	for j in range(1,k+1):
		ma = min(b[i],b[i-j] + abs(c[i]-c[i-j]))
		b[i] = ma
print(b[-1])


Fixed submission:
import sys

a,aa = map(int,input().split())

b = [sys.maxsize for i in range(a)]

c = list(map(int,input().split()))
b[0] = 0
for i in range(1,a):
	k = min(i,aa)
	for j in range(1,k+1):
		ma = min(b[i],b[i-j] + abs(c[i]-c[i-j]))
		b[i] = ma
print(b[-1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys

a,aa = map(int,input().split())

b = [sys.maxsize for i in range(a)]

c = list(map(int,input().split()))
b[0] = 0
for i in range(1,a):
	k = min(i,aa)
	for j in range(1,k+1):
		ma = min(b[i],b[i-j] + abs(c[i]-c[i-j]))
		b[i] = ma
print(b[-1])

Fixed submission:
import sys

a,aa = map(int,input().split())

b = [sys.maxsize for i in range(a)]

c = list(map(int,input().split()))
b[0] = 0
for i in range(1,a):
	k = min(i,aa)
	for j in range(1,k+1):
		ma = min(b[i],b[i-j] + abs(c[i]-c[i-j]))
		b[i] = ma
print(b[-1])
Buggy python submission (verdict: Runtime Error):
a = int(input())

b = []
m = 0
for i in range(a):
	b.append(list(map(int,input().split())))

c = [[0,0,0] in i for range(a+1)]

for i in range(a):
	for j in range(3):
		for k in range(3):
			if j == k:
				continue
			else:
				c[i+1][k] = max(c[i+1][k],c[i][k] + b[i][j])

print(max(c[-1]))

Fixed submission:
a = int(input())

b = []
m = 0
for i in range(a):
	b.append(list(map(int,input().split())))

c = [[0,0,0] for i in range(a+1)]

for i in range(a):
	for j in range(3):
		for k in range(3):
			if j == k:
				continue
			else:
				c[i+1][k] = max(c[i+1][k],c[i][j] + b[i][k])

print(max(c[-1]))
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())

dp = [0 for i in range(b+1)]

for i in range(a):
	w,h = map(int,input().split())
	for j in range(b,w-1,-1):
		dp[j] = max(dp[j],dp[j-w] + h)

print(max(dp))

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

dp = [0 for i in range(b+1)]

for i in range(a):
	w,h = map(int,input().split())
	for j in range(b,w-1,-1):
		dp[j] = max(dp[j],dp[j-w] + h)

print(max(dp))

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

dp = [0 for i in range(b+10**6)]

for i in range(a):
	w,h = map(int,input().split())
	for j in range(b+10**6-1,w-1,-1):
		dp[j] = max(dp[j],dp[j-w] + h)

print(max(dp[:b+1]))

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

dp = [0 for i in range(b+1)]

for i in range(a):
	w,h = map(int,input().split())
	for j in range(b,w-1,-1):
		dp[j] = max(dp[j],dp[j-w] + h)

print(max(dp))
Buggy python submission (verdict: Runtime Error):
a,b= map(int,input().split())

l = 1

c = [1]
d = [1]

for i in range(50):
	c.append(2*c[-1]+3)
	d.append(2*d[-1]+1)
k = 0
while True:
	if b == 1 && a == 0:
		k += 1
		break
	elif b==1:
		break
	elif c[a] // 2 == b:
		k += d[a-1]
		break
	elif c[a] // 2 > b:
		a -= 1
		b -= 1
	elif c[a] // 2 + 1 == b:
		a -= 1
		k += 1 + d[a]
		break
	elif c[a] == b:
		k = d[a]
		break
	elif a == 0:
		k += 1
		break
	else:
		a -= 1
		k += d[a]+1
		b -= c[a] + 2


print(k)

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

l = 1

c = [1]
d = [1]

for i in range(50):
	c.append(2*c[-1]+3)
	d.append(2*d[-1]+1)
k = 0
while True:
	if a == 0:
		k += 1
		break
	elif b==1:
		break
	elif c[a] // 2 == b:
		k += d[a-1]
		break
	elif c[a] // 2 > b:
		a -= 1
		b -= 1
	elif c[a] // 2 + 1 == b:
		k += 1 + d[a-1]
		break
	elif c[a] // 2 + 1 < b and c[a] != b:
		a -= 1
		k += d[a]+1
		b -= c[a]+2
	else:
		k += d[a]
		break


print(k)
Buggy python submission (verdict: Runtime Error):
from scipy.special import perm, comb

a = int(input())

b = [0 for i in range(15)]
j = 0
c = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
d = [0 for i in range(101)]
p = 0
pp = 0
co = 0
for i in range(1,101):
  k = i
  while True:
    if k % c[j] == 0 and k >= c[j]:
      b[j] += 1
      k //= c[j]
    else:
      j += 1
      if j == 15:
        j = 0
        break
  for k in range(15):
    if b[k] >= 4:
      p += 1
    elif b[k] >= 2:
      pp += 1
  if i >= 10:
    d[i] = comb(p, 2,exact=True)*comb(pp, 1,exact=True) + comb(p, 3,exact=True)
  p = 0
  pp = 0
print(d[a])

Fixed submission:
k = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 8, 8, 11, 11, 11, 11, 14, 14, 32, 32, 35, 35, 35, 35, 42, 42, 42, 42, 49, 49, 49, 49, 49, 49, 75, 75, 86, 86, 86, 86, 86, 86, 123, 123, 131, 131, 131, 131, 148, 148, 153, 153, 170, 170, 170, 170, 170, 170, 227, 227, 227, 227, 227, 227, 250, 250, 323, 323, 324, 324, 324, 324, 354, 354, 354, 354, 384, 384, 384, 384, 384, 391, 491, 491, 529, 529, 529, 529, 529, 529, 543]
a = int(input())
print(k[a])
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
aa = []
d = []
for i in range(b):
    k,kk = map(int,input().split())
    d.append([k, kk,i+1])

da = sorted(d)

kkk = da[0][0]
ll = 0
for i in range(b):
    kkkk = da[i][0]
    if kkk == kkkk:
        ll += 1
    else:
        kkk = kkkk
        ll = 1
    aa.append([da[i][2],da[i][0],ll])
aa.sort()

for i in aa:
    m = str(i[1])
    n = str(i[2])
    m = "0"*(6-len(m))+m
    n = "0"*(6-len(n))+n
    print(m+n)


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

print(a+(b//2))
Buggy python submission (verdict: Runtime Error):
import sys,collections as cl
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

h,w,k = m()

a = [1,1,2,3,5,8,13]

l = [[0 for i in range(w+2)] for j in range(h+1)]
l[0][1] = 1

for i in range(h):
	for j in range(w):
		l[i+1][j+1] = (l[i][j]*(a[max(0,j-1)] * a[w - 1 - j]) +l[i][j+1]*(a[j] * a[w - 1 - j]) + l[i][j+2]*(a[j] * a[max(0,w - 2 - j)]))%(10**9+7)
print(l[h][k])

Fixed submission:
import sys,collections as cl
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

h,w,k = m()

a = [1,1]

for i in range(98):
	a.append(a[-1] + a[-2])

l = [[0 for i in range(w+2)] for j in range(h+1)]
l[0][1] = 1

for i in range(h):
	for j in range(w):
		l[i+1][j+1] = (l[i][j]*(a[max(0,j-1)] * a[w - 1 - j]) +l[i][j+1]*(a[j] * a[w - 1 - j]) + l[i][j+2]*(a[j] * a[max(0,w - 2 - j)]))%(10**9+7)
print(l[h][k])

Buggy python submission (verdict: Runtime Error):
import sys,collections as cl
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

h,w,k = m()

a = [1,1,2,3,5,8,13]

l = [[0 for i in range(w+2)] for j in range(h+1)]
l[0][1] = 1

for i in range(h):
	for j in range(w):
		l[i+1][j+1] = l[i][j]*(a[max(0,j-1)] * a[w - 1 - j]) +l[i][j+1]*(a[j] * a[w - 1 - j]) + l[i][j+2]*(a[j] * a[max(0,w - 2 - j)])
print(l[h][k])

Fixed submission:
import sys,collections as cl
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

h,w,k = m()

a = [1,1]

for i in range(98):
	a.append(a[-1] + a[-2])

l = [[0 for i in range(w+2)] for j in range(h+1)]
l[0][1] = 1

for i in range(h):
	for j in range(w):
		l[i+1][j+1] = (l[i][j]*(a[max(0,j-1)] * a[w - 1 - j]) +l[i][j+1]*(a[j] * a[w - 1 - j]) + l[i][j+2]*(a[j] * a[max(0,w - 2 - j)]))%(10**9+7)
print(l[h][k])
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))

if a == 1:
    print("Hello World")
else:
    b = int(input())
    c = int(input())
    print(b+c)

Fixed submission:
a = int(input())

if a == 1:
    print("Hello World")
else:
    b = int(input())
    c = int(input())
    print(b+c)
Buggy python submission (verdict: Runtime Error):
import math;a = list(map(int,input().split()));b = a[1]//a[0];c = [];for i in range(1,int(math.sqrt(a[1]))+1):if a[1]%i==0 and i<=b:if a[1] // i <= b:c.append(a[1]//i);else:c.append(i);c.sort(reverse=True);print(c[0])

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

b = a[1]//a[0]

c = []

for i in range(1,int(math.sqrt(a[1]))+1):
    if a[1] % i == 0 and i <= b:
        if a[1] // i <= b:
            c.append(a[1] // i)
        else:
            c.append(i)
c.sort()
c.reverse()
print(c[0])

Buggy python submission (verdict: Runtime Error):
¥import math
a = list(map(int,input().split()))
b = a[1]//a[0]
c = []
for i in range(1,int(math.sqrt(a[1]))+1):
    if a[1]%i==0 and i<=b:
        if a[1] // i <= b:
            c.append(a[1]//i)
        else:
            c.append(i)
c.sort(reverse=True)
print(c[0])

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

b = a[1]//a[0]

c = []

for i in range(1,int(math.sqrt(a[1]))+1):
    if a[1] % i == 0 and i <= b:
        if a[1] // i <= b:
            c.append(a[1] // i)
        else:
            c.append(i)
c.sort()
c.reverse()
print(c[0])

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

b = a[1]//a[0]

for i in range(b,-1,-1):
    if a[1] % i == 0:
        print(i)
        break

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

b = a[1]//a[0]

c = []

for i in range(1,int(math.sqrt(a[1]))+1):
    if a[1] % i == 0 and i <= b:
        if a[1] // i <= b:
            c.append(a[1] // i)
        else:
            c.append(i)
c.sort()
c.reverse()
print(c[0])
Buggy python submission (verdict: Runtime Error):
a = int(input())

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,6)+1)]
cc = [0 for i in range(pow(10,6)+1)]
for i in range(len(b)):
    if i % 2 == 0:
        cc[b[i]-1] += 1
    else:
        c[b[i]-1] += 1

one = 0
onee = 0
two = 0
twoo = 0
k = 0
kk = 0
for i in range(len(c)):
    if one <= c[i]:
        onee = one
        one = c[i]
        k = i
    if two <= cc[i]:
        twoo = two
        two = cc[i]
        kk = i

t = max(one+twoo,onee+two)

if k != kk:
    print(a-one-two)
else:
    print(a-t)


Fixed submission:
a = list(input())
for i in range(3):
	a[i] = int(a[i])
	if a[i] ==1:
		a[i] = 9
	else:
		a[i] = 1
print(a[0]*100+a[1]*10+a[2])

Buggy python submission (verdict: Runtime Error):
a = int(input())

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,5)+100)]
cc = [0 for i in range(pow(10,5)+100)]
for i in range(a):
    if i % 2 == 0:
        c[b[i]] += 1
    else:
        cc[b[i]] += 1

one = 0
onee = 0
two = 0
twoo = 0
k = 0
kk = 0
for i in range(len(c)):
    if one <= c[i]:
        onee = one
        one = c[i]
        k = i
    if two <= cc[i]:
        twoo = two
        two = cc[i]
        kk = i

t = max(one+twoo,onee+two)

print(a-one-two)



Fixed submission:
a = list(input())
for i in range(3):
	a[i] = int(a[i])
	if a[i] ==1:
		a[i] = 9
	else:
		a[i] = 1
print(a[0]*100+a[1]*10+a[2])
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

if b%2 != 0:
  print(pow(a//b,3))
else:
  print(pow(a//b,3)+pow(((a+b//2)//a),3)


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

if b%2 != 0:
  print(pow(a//b,3))
else:
  print(pow(a//b,3)+pow(((a+b//2)//b),3))

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = a//b-1
d = a//(b//2)
if b % 2 == 0:
	print(c**3+d**3)
else:
	print(c**3)

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

if b%2 != 0:
  print(pow(a//b,3))
else:
  print(pow(a//b,3)+pow(((a+b//2)//b),3))

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = a//b
d = a//(b//2)
if b % 2 == 0:
	print(d**3)
else:
	print(c**3)

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

if b%2 != 0:
  print(pow(a//b,3))
else:
  print(pow(a//b,3)+pow(((a+b//2)//b),3))

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = a//b
d = a//(b//2)
if b % 2 == 0:
	print(c**3 + d**3)
else:
	print(c**3)

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

if b%2 != 0:
  print(pow(a//b,3))
else:
  print(pow(a//b,3)+pow(((a+b//2)//b),3))
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())

c = list(map(int,input().split()))
for i in range(len(c)-b+1):
    k = c[i:i+b]
    if k[0] * k[-1] < 0:
        if i == 0:
            m = abs(k[0]) + k[-1] +abs(min(k[0],k[-1]))
        else:
            m = min(m,abs(k[0]) + k[-1] +abs(min(k[0],k[-1])))
    else:
        if i == 0:
            m = max(abs(k[0]),abs(k[-1]))
        else:
            m = min(m,max(abs(k[0]),abs(k[-1])))

print(m)

Fixed submission:
a,b = map(int,input().split())
m = 0
c = list(map(int,input().split()))
for i in range(len(c)-b+1):
    if c[i] * c[i+b-1] < 0:
        if i == 0:
            m = abs(c[i]) + c[i+b-1] +abs(min(abs(c[i]),c[i+b-1]))
        else:
            m = min(m,abs(c[i]) + c[i+b-1] +abs(min(abs(c[i]),c[i+b-1])))
    else:
        if i == 0:
            m = max(abs(c[i]),abs(c[i+b-1]))
        else:
            m = min(m,max(abs(c[i]),abs(c[i+b-1])))

print(m)

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

c = list(map(int,input().split()))
for i in range(len(c)-b+1):
    k = c[i:i+b]
    if k[0] * k[-1] < 0:
        if i == 0:
            m = abs(k[0]) + k[-1] +abs(min(k[0],k[-1]))
        else:
            m = min(m,abs(k[0]) + k[-1] +abs(min(k[0],k[-1])))
    else:
        if i == 0:
            m = max(abs(k[0]),abs(k[-1]))
        else:
            m = min(m,max(abs(k[0]),abs(k[-1])))

print(m)

Fixed submission:
a,b = map(int,input().split())
m = 0
c = list(map(int,input().split()))
for i in range(len(c)-b+1):
    if c[i] * c[i+b-1] < 0:
        if i == 0:
            m = abs(c[i]) + c[i+b-1] +abs(min(abs(c[i]),c[i+b-1]))
        else:
            m = min(m,abs(c[i]) + c[i+b-1] +abs(min(abs(c[i]),c[i+b-1])))
    else:
        if i == 0:
            m = max(abs(c[i]),abs(c[i+b-1]))
        else:
            m = min(m,max(abs(c[i]),abs(c[i+b-1])))

print(m)
Buggy python submission (verdict: Runtime Error):
n = int(input())

s = ""

while n != 0:
	s = str(n%2) + s
	s = -(s//2)

print(s if s != "" else 0)

Fixed submission:
n = int(input())

s = ""

while n != 0:
	s = str(n%2) + s
	n = -(n//2)

print(s if s != "" else 0)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

c = list(map(int,input().split()))

su = 0
for i in range(len(c)):
	if i == 0:
		c[i] %= 0
	else:
		c[i] += c[i-1]
		c[i] %= b

for i in range(a):
	for j in range(a-i):
		d = sum(c[i:i+j])
		if d < 0:
			d += b+d
		if d % b == 0:
			su += 1

print(su)



Fixed submission:
import sys,collections as cl
import collections
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

n,m = m()

a = l()

aa = [a[0]]
aaa = []
for i in range(n-1):
	aa.append(aa[-1]+a[i+1])

for i in range(n):
	aaa.append(aa[i]%m)

k = collections.Counter()

for i in aaa:
	k[i] += 1

ans = 0
for i in range(n):
	if aaa[i] != 0:
		ans += max(k[aaa[i]]-1,0)
		k[aaa[i]] = k[aaa[i]]-1
	else:
		ans += k[aaa[i]]
		k[aaa[i]] -= 1
print(ans)