Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
k=int(input)
print((k//2)**2 if k%2==0 else ((k+1)//2**2)-k)

Fixed submission:
n=int(input())
print((n//2)**2 if n%2==0 else (n//2)*(n//2+1))

Buggy python submission (verdict: Runtime Error):
n=input()
if n%2==0:
  print((n//2)**2)
else:
  print((n//2)*((n//)2+1))

Fixed submission:
n=int(input())
print((n//2)**2 if n%2==0 else (n//2)*(n//2+1))

Buggy python submission (verdict: Runtime Error):
n=input()
if n%2==0:
  print((n//2)**2)
else:
  print(n//2*(n//2+1))

Fixed submission:
n=int(input())
print((n//2)**2 if n%2==0 else (n//2)*(n//2+1))
Buggy python submission (verdict: Runtime Error):
s=input()
if s[0]!="A" and s[2:-1].count("C")!=1:
      print("WA")
      exit()

s=list(s)
s[0]="a"
s.remove("C")
if "".join(s).islower():
      print('AC')
else:
      print("WA")

Fixed submission:
s=input()
if s[0]!="A":
      print("WA")
      exit()
if s[2:-1].count("C")!=1:
      print("WA")
      exit()

s=list(s)
s[0]="a"
s.remove("C")
if "".join(s).islower():
      print('AC')
else:
      print("WA")

Buggy python submission (verdict: Runtime Error):
s=input()
ss=s[1:-1]

if s[0]=="A" and  ss.count("C")==1:
      s[0]="a"
      s=list(s)
      s.remove("C")
      if ''.join(s).islower():
            print("AC")
else:
      print("WA")


Fixed submission:
s=input()
if s[0]!="A":
      print("WA")
      exit()
if s[2:-1].count("C")!=1:
      print("WA")
      exit()

s=list(s)
s[0]="a"
s.remove("C")
if "".join(s).islower():
      print('AC')
else:
      print("WA")
Buggy python submission (verdict: Runtime Error):
L=map(int,input().split())
L.sort()
s=0
for i in range(1,3):
  s+=L[i]-L[i-1]
print(s)

Fixed submission:
a,b,c=map(int,input().split())
d,e,f=abs(a-b),abs(a-c),abs(b-c)
print(d+e+f-max(d,e,f))

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
d,e,f=map(abs,a-b,a-c,b-c)
print(d+e+f-min(d,e,f))

Fixed submission:
a,b,c=map(int,input().split())
d,e,f=abs(a-b),abs(a-c),abs(b-c)
print(d+e+f-max(d,e,f))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate

n=int(input())
*a,=map(int,input().split())
 
b=[0]+a
b=list(accumulate(b))

L={}
for i in range(n+1):
      if b[i] in b:
            if b[i] in L:
                  L[b[i]]+=1
            else:
                  L[b[i]]=1
ans=0
for i in L.values():
      if i>1:
            ans+=i*(i-1)//2
print(ans)     


Fixed submission:
import collections

n=int(input())
*a,=map(int,input().split())
 
b=[0]
 
for i in range(n):
  b.append(a[i]+b[i])
 
L=collections.Counter(b)

ans=0
for i in L.values():
      if i>1:
            ans+=i*(i-1)//2
print(ans)

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

b=[0]

for i in range(n):
  b.append(a[i]+b[i])

L={}
for i in range(n+1):
      if b[i] in b:
            if b[i] in L:
                  L[b[i]]+=1
            else:
                  L[b[i]]=1
ans=0
for i in L.values():
      if i>1:
            ans+=i*(i-1)//2
print(ans)         

Fixed submission:
import collections

n=int(input())
*a,=map(int,input().split())
 
b=[0]
 
for i in range(n):
  b.append(a[i]+b[i])
 
L=collections.Counter(b)

ans=0
for i in L.values():
      if i>1:
            ans+=i*(i-1)//2
print(ans)

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

b=[0]

for i in range(n):
  b.append(a[i]+b[i])

L={}
for i in range(n+1):
      if b[i] in b:
            if b[i] in L:
                  L[b[i]]+=1
            else:
                  L[b[i]]=1
ans=0
for i in L.values():
      if i>1:
            ans+=i*(i-1)//2
print(ans)         

Fixed submission:
import collections

n=int(input())
*a,=map(int,input().split())
 
b=[0]
 
for i in range(n):
  b.append(a[i]+b[i])
 
L=collections.Counter(b)

ans=0
for i in L.values():
      if i>1:
            ans+=i*(i-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
a,x,x=input().split()
x,b,x=input().split()
x,x,c=input().split()
print(a+b+c)


Fixed submission:
a=input()[0]
b=input()[1]
c=input()[2]
print(a+b+c)
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
print("=" if a==b elif a>b ">" else "<")

Fixed submission:
a,b=input().split()
print("=" if a==b else "<" if a<b else ">")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(input().split())

if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')


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

if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
a=list(input())
b=list(input())

L=[0]*(len(a)*2)
for i in range(len(a)-1):
  L[i*2]=a[i]
  L[i*2+1]=b[i]
L[len(a)*2]=a[-1]

if len(a)>len(b):
  del L[len(a)*2+1]
else:
  L[-1]=b[-1]

print("".join(L))
    
    

Fixed submission:
a=list(input())
b=list(input())

L=[0]*(len(a)*2)

if len(a)==len(b):
    for i in range(len(a)):
        L[i*2]=a[i]
        L[i*2+1]=b[i]
else:
  for i in range(len(a)-1):
    L[i*2]=a[i]
    L[i*2+1]=b[i]
  L[-2]=a[-1]
  del L[-1]
 
print("".join(L))
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, inpot().split()))
for d in range(x + 1):
    for s in [-1, +1]:
        a = x + s * d
        if p.count(a) == 0:
            print(a)
            exit(0)

Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))
for d in range(x + 1):
    for s in [-1, +1]:
        a = x + s * d
        if p.count(a) == 0:
            print(a)
            exit(0)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
if h==1||w==1:
  print(1)
  
else:
  print((h*w+1)//2)

Fixed submission:
h,w=map(int,input().split())
if h==1 or w==1:
  print(1)
  
else:
  print((h*w+1)//2)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if c-a-b>0 and (c-a-b)**2>4*a*b:
  print("Yes")
else:
  print("No')

Fixed submission:
a,b,c=map(int,input().split())
if c-a-b>0 and (c-a-b)**2>4*a*b:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
for _ in range(q):
    a=[x for x in input().split()]
    if len(a)==1:
        s=s[::-1]
    else:
        if a[1]=='1':
            s=a[2]+s
        else:
            s+=a[2]

print(s)


Fixed submission:
from collections import deque
que=deque(input())
rev=False
for _ in range(int(input())):
    t=input()
    if t=='1':
        rev=not rev
    else:
        tt,f,c=t.split()
        if (f=='1' and rev==False)  or (f=='2' and rev):
            que.appendleft(c)
        else:
            que.append(c)
if rev:
    que.reverse()

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

Fixed submission:
import collections

n=int(input())
l=list(map(int,input().split()))
c=collections.Counter(l)
for i in range(1,n+1):
    print(c[i])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(map(int,input().split()))
s.sort()

cnt=0
for i in range(n-1):
    for j in range(i+1,n):
        if s[i]==s[j]:
            print('NO')
            exit()
        else:
            cnt+=1
if cnt==n*(n-1)//2:            
    print('YES')
        

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

cnt=0
for i in range(n-1):
    if s[i]==s[i+1]:
        print('NO')
        exit()
    else:
        cnt+=1
if cnt==n-1:            
    print('YES')
Buggy python submission (verdict: Runtime Error):
x=input('')
k=input('')
if k*500>=x:
    print ("Yes")
else:
    print ("No")

Fixed submission:
k,x=map(int,input().split())
if k*500>=x:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
print("{}{}".format(t,s))

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

print(c+b)

Buggy python submission (verdict: Runtime Error):
s=str(input())
t=str(input())

print("{}{}".format(t,s))

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

print(c+b)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

import math

def lcm(x,y):
    return (x*y)//math.gcd(x,y)

print(lcm(n,m))


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

for a in range(1,m+1):
    if (n*a)%m==0:
        print(n*a)
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
#print('l1',l)

for i in range(n):
    print(max(l[1:]))
    l.append(l[0])
    l.pop(0)
    #print('l2',l)



Fixed submission:
n=int(input())
l=[]
import copy
h=[]
for i in range(n):
    l.append(int(input()))
l_max=max(l)
#print(l_max)
h=copy.copy(l)
h.sort()
l_second=h[-2]
#print(l_second)

for i in range(n):
    if l[i] != l_max:
        print(l_max)
    else:
        print(l_second)
Buggy python submission (verdict: Runtime Error):

n=int(input())
l=[]
for i in range(5):
    l.append(int(input()))
#print(l)
m=min(l)
"print(m)

print(-(-n//int(m))+4)




Fixed submission:

n=int(input())
l=[]
for i in range(5):
    l.append(int(input()))

m=min(l)

print(-(-n//int(m))+4)
Buggy python submission (verdict: Runtime Error):

x=int(input())
a=[]
ans=0

for i in range(1,32):
            for j in range(2,10):
                        ans=i**j
                        if ans<x:
                                    a.append(ans)   
                                    i+=1
                        else:
                                    break
                        
            #print(a)
print(max(a))
"""
while ans<x:
"""
            
         
                   



Fixed submission:

x=int(input())
a=[]
ans=0

for i in range(1,32):
            for j in range(2,10):
                        ans=i**j
                        if ans<=x:
                                    a.append(ans)   
                                    #i+=1
                        else:
                                    break
                        
            #print(a)
print(max(a))
"""
while ans<x:
"""
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
"""
if b-a+1<=2*k:
            for i in range(a,b+1):
                        print(i)
else:
            for i in range(a,a+k):
                        print(i)
            for i in range(b-k+1,b+1):
                        print(i)

"""
for i in range(a,b+1):
            #print("i",i)
            if i<a+k:
                        print(i)
            elif b-k<i:
                        print(i)
"""                    
            
                        


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

if b-a+1<=2*k:
            for i in range(a,b+1):
                        print(i)
else:
            for i in range(a,a+k):
                        print(i)
            for i in range(b-k+1,b+1):
                        print(i)

"""
for i in range(a,b+1):
            #print("i",i)
            if i<a+k:
                        print(i)
            elif b-k<i:
                        print(i)
"""
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
cnt=0
for l in range(a,b+1):
            l_i=list(str())
            if l_i[0]==l_i[-1] and l_i[1]=l_i[-2]:
                        cnt+=1
print(cnt)                        


Fixed submission:
s=list(input())
t=list(input())
v=list(input())
print(s[0]+t[1]+v[2])
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
cnt=0
for l in range(a,b+1):
            l_i=list(str())
            if l_i[0]==l_i[-1] and l_i[1]=l_i[-2]:
                        cnt+=1
print(cnt)                        


Fixed submission:
a,b=map(int,input().split())
cnt=0
for l in range(a,b+1):
            l_i=list(str(l))
            if l_i[0]==l_i[-1] and l_i[1]==l_i[-2]:
                        cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
cnt=0
for l in range(a,b+1):
            l_i=list(str())
            if l_i[0]==l_i[-1] and l_i[1]=l_i[-2]:
                        cnt+=1
print(cnt)                        


Fixed submission:
a,b=map(int,input().split())
cnt=0
for l in range(a,b+1):
            l_i=list(str(l))
            if l_i[0]==l_i[-1] and l_i[1]==l_i[-2]:
                        cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n=input()
a=input()
if n%500 <=a:
    print('Yes')
else:
    print('No')    

Fixed submission:

n=int(input())
a=int(input())
if n%500<=a:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n=input()
a=input()
if n%500 <=a:
    print('Yes')
else:
    print('No')    

Fixed submission:

n=int(input())
a=int(input())
if n%500<=a:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=0
l=[]
for a in range(1,n+1):
            for i in range(1,n):
                        if a==i**2:
                                    #print(a,i)
                                    l.append(a)
                               
print(max(l))                        


Fixed submission:
n = int(input())
m = 1
for i in range(1, n):
    if i ** 2 > n:
        break
    m = i ** 2
print(m)
Buggy python submission (verdict: Runtime Error):
alp=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
s=list(input())
s_ = list(set(s))
#print(s)
#print(s_)
s.sort()
s_.sort()
#print(s)
#print(s_)
        
l=[]
cnt=0
for i in range(len(alp)):
            if s.count(alp[i]):a
                        pass
            else:
                        l.append(alp[i])
                        cnt+=1
#print(l)
if cnt==0:
            print('None')
else:
            print(min(l))
exit()


Fixed submission:
alp=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
s=list(input())
s_ = list(set(s))
#print(s)
#print(s_)
s.sort()
s_.sort()
#print(s)
#print(s_)
        
l=[]
cnt=0
for i in range(len(alp)):
            if s.count(alp[i]):
                        pass
            else:
                        l.append(alp[i])
                        cnt+=1
#print(l)
if cnt==0:
            print('None')
else:
            print(min(l))
exit()
Buggy python submission (verdict: Runtime Error):
o=list(input())
m=list(input())
ans=' '
for i in range(len(o)):
            
                        ans +=o[i]
                        ans +=m[i]
                        
print(ans)         





Fixed submission:
o=list(input())
m=list(input())

ans=[]
for i in range(len(o)-1):
            ans.append(o[i])
            ans.append(m[i])
ans.append(o[-1])
if len(o)==len(m):
            ans.append(m[-1])
print("".join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
ans=0
for x in range(0,k+1):
            for y in range(0,k+1):
                        for z in range(0,k+1):
                                    if  x+y+z==s:
                                                #print('1','x',x,'y',y,'z',z)
                                                ans+=1
                                                
print(ans)


Fixed submission:
k,s=map(int,input().split())
ans=0
for x in range(0,k+1):
            for y in range(0,k+1):
                        z=s-x-y
                        if 0<=z<=k:
                                    ans+=1
                                                
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M, X = map(int,input().split())

C = list()
A = list()
for i in range(N):
	temp = list(map(int,input().split()))
	C.append(temp[0])
	A.append(temp[1:])	


MAX = 100000000000	

def func(cost,a,i):
	if min(a) >= X:
		return cost
	elif i == N:
		return MAX
	total_A = [x+y for (x,y) in zip(a,A[i])]
    
	return min(func(cost + C[i],total_A,i+1),func(cost,a,i+1))
	
ans = func(0,[0]*M,0)

if ans == MAX:
	print(-1)
else:
	print(ans)


Fixed submission:
prev = input()
prev_l = list(prev)

now = input()
now_l = list(now)
n = len(now_l)

if now_l[:n-1] == prev_l:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n,m,r = map(int, input().split())
dn = [[0] * m for _ in range(n)]

for i in range(n):
  dn[i][:] = map(int, input().split())

  dn = np.array(dn)
  cost = []
  sh = 0
  inf = 10e8
  cost = inf
  k = np.zeros(m+1)

  def secom(j,k,cost):
    if j == n:

      if np.all(k>=r):
        print(k)
        cost = min(cost,k[0])
        return cost
      else:
        return cost

      cost1 = secom(j+1,k,cost)
      k += dn[j]
      cost2 = secom(j+1,k,cost)
      k -= dn[j]

      return min(cost1,cost2)


    cost = secom(0,k,cost)
    if cost == inf:
      print(-1)
      else:
        print(int(cost))


Fixed submission:
prev = input()
prev_l = list(prev)

now = input()
now_l = list(now)
n = len(now_l)

if now_l[:n-1] == prev_l:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
def main():
    n,m,r = map(int, input().split())
    dn = [[0] * m for _ in range(n)]
    
    for i in range(n):
        dn[i][:] = map(int, input().split())

    dn = np.array(dn)
    cost = []
    sh = 0
    inf = 10e8
    cost = inf
    k = np.zeros(m+1)
    
    def secom(j,k,cost):
        if j == n:
            
            if np.all(k>=r):
                print(k)
                cost = min(cost,k[0])
                return cost
            else:
                return cost
        
        cost1 = secom(j+1,k,cost)
        k += dn[j]
        cost2 = secom(j+1,k,cost)
        k -= dn[j]
        
        return min(cost1,cost2)
    
    
    cost = secom(0,k,cost)
    if cost == inf:
        print(-1)
    else:
        print(int(cost))
        
        

if __name__ == "__main__":
    main()


Fixed submission:
N, M, X = map(int,input().split())

C = list()
A = list()
for i in range(N):
	temp = list(map(int,input().split()))
	C.append(temp[0])
	A.append(temp[1:])	


MAX = 100000000000	

def func(cost,a,i):
	if min(a) >= X:
		return cost
	elif i == N:
		return MAX
	total_A = [x+y for (x,y) in zip(a,A[i])]
    
	return min(func(cost + C[i],total_A,i+1),func(cost,a,i+1))
	
ans = func(0,[0]*M,0)

if ans == MAX:
	print(-1)
else:
	print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    a,b,n = map(int, input().split())
    
    ans = 0
    if n < b:
        ans = a*(n/b)
    
    else:
        for i in range(1,int(n//b+1)):
            x = b*i-1
            ans = max(ans, a*((x-(i-1)*b)/b))
    
    print(int(ans//1))

if __name__ == "__main__":
    main()


Fixed submission:
def main():
    a,b,n = map(int, input().split())
    
    ans = 0
    if n < b:
        ans = a*(n/b)
    
    else:
        for i in range(1,int(n//b+1)):
            x = b*i-1
            ans = max(ans, a*((x-(i-1)*b)/b))
            break
    
    print(int(ans//1))

if __name__ == "__main__":
    main()

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

ans = 0
if n < b:
    ans = a*(n/b)

else:
    for i in range(1,int(n//b+1)):
        x = b*i-1
        ans = max(ans, a*((x-(i-1)*b)/b))

print(int(ans//1))
    

Fixed submission:
def main():
    a,b,n = map(int, input().split())
    
    ans = 0
    if n < b:
        ans = a*(n/b)
    
    else:
        for i in range(1,int(n//b+1)):
            x = b*i-1
            ans = max(ans, a*((x-(i-1)*b)/b))
            break
    
    print(int(ans//1))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
from collections import deque

n,x,y = map(int,input().split())
graph=[[] for _ in range(n)]

for i in range(1,n+1):
    if i!=x:
        if i == 1:
            graph[i-1].append(i+1)
        elif i == n:
            graph[i-1].append(i-1)
        else:
            graph[i-1].append(i-1)
            graph[i-1].append(i+1)
    else:
        graph[i-1].append(y)
        if i == 1:
            graph[i-1].append(i+1)
        elif i == n:
            graph[i-1].append(i-1)
        else:
            graph[i-1].append(i-1)
            graph[i-1].append(i+1)
k_dic=defaultdict(int)

for i in range(1,n):
    q = deque([[i]])
    prev = [0]*n
    prev[i-1] = 1
    dic=defaultdict(int)
    while q:
        now_l = q.popleft()
        tu = []
        for now in now_l:
            nex = graph[now-1]
            
            for ne in nex:
                if prev[ne-1] == 0:
                
                    tu.append(ne)
                    q.append(tu)
                    prev[ne-1] = 1
                    dic[ne] = dic[now]+1
                    if ne > i:
                        k_dic[dic[ne]] += 1

for i in range(1,n):
    print(k_dic[i])




Fixed submission:
from collections import defaultdict
from collections import deque

n,x,y = map(int,input().split())
graph=[[] for _ in range(n)]

for i in range(1,n+1):
    if i!=x:
        if i == 1:
            graph[i-1].append(i+1)
        elif i == n:
            graph[i-1].append(i-1)
        else:
            graph[i-1].append(i-1)
            graph[i-1].append(i+1)
    else:
        graph[i-1].append(y)
        if i == 1:
            graph[i-1].append(i+1)
        elif i == n:
            graph[i-1].append(i-1)
        else:
            graph[i-1].append(i-1)
            graph[i-1].append(i+1)
k_dic=defaultdict(int)

for i in range(1,n):
    q = deque([[i]])
    prev = [0]*n
    prev[i-1] = 1
    dic=defaultdict(int)
    while q:
        now_l = q.popleft()
        tu = []
        for now in now_l:
            nex = graph[now-1]
            
            for ne in nex:
                if prev[ne-1] == 0:
                
                    tu.append(ne)
                    q.append(tu)
                    prev[ne-1] = 1
                    dic[ne] = dic[now]+1
                    if ne > i:
                        k_dic[dic[ne]] += 1

for i in range(1,n):
    print(k_dic[i])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def main():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    count1 = 0
    count2 = 0
    d = []
    l = {}
    
    for i in range(N):
        a,b = map(int, input().split())
        if not a in d:
            d.append(a)
            l[a] = b
        else:
            l[a] += b
        count1 += b

    d.sort()
    for i in d:
        count2 += l[i]
        if count2 >= K:
            print(i)
            break
        

        

if __name__ == "__main__":
    main()


Fixed submission:
import sys
from collections import defaultdict
def main():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    count1 = 0
    count2 = 0
    d = []
    l = defaultdict(int)
    
    for i in range(N):
        a,b = map(int, input().split())
        l[a] += b


    for i, j in sorted(l.items()):
        count2 += j
        if count2 >= K:
            print(i)
            break
        

        

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def main():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    count1 = 0
    count2 = 0
    d = []
    l = {}
    
    for i in range(N):
        a,b = map(int, input().split())
        if not a in d:
            d.append(a)
            l[a] = b
        else:
            l[a] += b
        count1 += b

    d.sort()
    for i in d:
        count2 += l[i]
        if count2 >= K:
            print(i)
            break
        

        

if __name__ == "__main__":
    main()


Fixed submission:
import sys
from collections import defaultdict
def main():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    count1 = 0
    count2 = 0
    d = []
    l = defaultdict(int)
    
    for i in range(N):
        a,b = map(int, input().split())
        l[a] += b


    for i, j in sorted(l.items()):
        count2 += j
        if count2 >= K:
            print(i)
            break
        

        

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
3 3
1
3
1
3
1
3

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