ZhenlongDai/ACPR huggingface dataset:
Problem: p03721
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys












stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    
    n,k = map(int, stdin.readline().rstrip().split())
    
    
    
    
    
    a = [0]*(10**5+1)
    for i in range(n):
        A,B = map(int, stdin.readline().rstrip().split())
        a[A] += B
    j = 0
    for i in range(10**5):
        j += a[i]
        if j >= k:
            print(i)
            exit()



if __name__ == '__main__':
    solve()


Failing test case input:
10 500000
1 100000
1 000000
1 100000
1 100000
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000

Expected output:
100000


Actual output:

Fixed submission (verdict: Accepted):
import sys












stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    
    n,k = map(int, stdin.readline().rstrip().split())
    
    
    
    
    
    a = [0]*(10**5+1)
    m = 0
    for i in range(n):
        A,B = map(int, stdin.readline().rstrip().split())
        a[A] += B
        m = max(m,A)
    j = 0
    for i in range(10**5):
        j += a[i]
        if j >= k:
            print(i)
            exit()
    print(m)



if __name__ == '__main__':
    solve()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def c():
    n, k = map(int, input().split())
    U = {}
    for i in range(n):
        ai, bi = map(int, input().split())
        if ai in U:
            U[ai] += bi
        else:
            U[ai] = bi
    U = list(U.items())
    sorted(U, key=lambda i: i[0])
    
    for j in U:
        k -= j[1]
        if k <= 0:
            print(j[0])
            return
    pass

c()

Failing test case input:
3 4
1 1
4 1
3 2

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
def c():
    n, k = map(int, input().split())
    U = []
    for i in range(n):
        U.append(tuple(map(int, input().split())))
    U = sorted(U, key=lambda i: i[0])
    
    for i in U:
        if k <= i[1]:
            print(i[0])
            break
        k -= i[1]
    else:
        print(U[-1][0])
        
        
        
        

c()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = [int(s) for s in input().split()]

def main():
    k = K
    ans = 0
    for i in range(N):
        n, i = [int(s) for s in input().split()]
        k -= i
        if not ans and k <= 0:
            ans = n
    print(ans)

if __name__ == '__main__':
    main()


Failing test case input:
3 0
2 2
0 0
3 6

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
N, K = [int(s) for s in input().split()]

def main():
    k = K
    a = {}
    for i in range(N):
        n, i = [int(s) for s in input().split()]
        if n not in a:
            a[n] = 0
        a[n] += i
    for n, i in sorted(a.items()):
        k -= i
        if k <= 0:
            ans = n
            break
    print(ans)

if __name__ == '__main__':
    main()
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict as dd
def main():
    N, K = map(int, input().split())

    d = dd(int)
    for n in range(N):
        a,b = map(int, input().split())
        d[a] += b

    count = 0
    for k, v in d.items():
        
        count += v
        if count >= K:
            print(k)
            break

if __name__ == "__main__":
    
    
    main()



Failing test case input:
3 3
2 2
1 1
5 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from collections import defaultdict as dd
def main():
    N, K = map(int, input().split())

    d = dd(int)
    for n in range(N):
        a,b = map(int, input().split())
        d[a] += b

    count = 0
    A = sorted(d.keys())
    for k in A:
        
        count += d[k]
        if count >= K:
            print(k)
            break

if __name__ == "__main__":
    
    
    main()

Problem: p03721
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    for _ in range(n):
        a,b=map(int,input().split())
        k-=b
        if(k<0):
            print(a)
            return
resolve()

Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    AB=[tuple(map(int,input().split())) for _ in range(n)]
    AB.sort()
    for a,b in AB:
        k-=b
        if(k<=0):
            print(a)
            return
resolve()

Problem: p03721
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = map(int,input().split())
lst = [input().split() for _ in range(N)]


lst = sorted(lst,key=lambda lst:lst[0])

i = 0
sm = 0
for i in range(N):
    sm += int(lst[i][1])
    if sm >= K:
        print(lst[i][0])
        break

Failing test case input:
3 5
2 2
1 1
15 3

Expected output:
15


Actual output:
2


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
lst = [list(map(int,input().split())) for _ in range(N)]


lst.sort(key=lambda l:l[0])


sm = 0
for x in lst:
    sm += x[1]
    
    if sm >= K:
        print(x[0])
        break
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

array = {}

for i in range(n):
  a,b = map(int, input().split())
  if a in array: 
    array[a] += b
  else:
    array[a] = b
    

sorted(array.items(), key=lambda x: x[0])

ans = 0
cnt = 0

for key in array.keys():
  cnt += array[key]
    
  if cnt >= k:
    ans = key
    break
print(ans)

Failing test case input:
3 4
2 2
4 5
3 2

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n,k = map(int, input().split())
array = {}

for i in range(n):
  a,b = map(int, input().split())
  if a in array: 
    array[a] += b
  else:
    array[a] = b
    

array_sorted = sorted(array.items())

ans = 0
cnt = 0

for elem in array_sorted:
  cnt += elem[1]
    
  if cnt >= k:
    
    print(elem[0])
    break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = [int(i) for i in input().split()]
s = [[int(i) for i in input().split()] for N in range(N)]
count = K
ans_bool = True

for i in s:
  count = count - i[1]
  
  if count > 0:
    pass
  elif (count <= 0) & ans_bool:
    ans_bool = False
    print(i[0])

Failing test case input:
3 3
2 2
1 1
4 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N,K = [int(i) for i in input().split()]
s = [[int(i) for i in input().split()] for N in range(N)]
s = sorted(s)
ans_bool = True

for i in s:
  K = K - i[1]
  if (K <= 0) and (ans_bool):
    ans_bool = False
    print(i[0])

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())

l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
    
l.sort()

i=n-1
ans=0
while k>0:
    k=k-l[i][1]
    ans=l[i][0]
    i=i-1
print(ans)

Failing test case input:
3 1
1 1
3 1
3 3

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())

l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
    
l.sort()

i=0
ans=0
while k>0:
    k=k-l[i][1]
    ans=l[i][0]
    i=i+1
print(ans)

Problem: p03721
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, k = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]
l = [0] * (10 ** 5 + 1)

for i in ab:
    l[i[0]] += i[1]

s = 0
for i in range(10 ** 5):
    s += l[i]
    if s >= k:
        print(i)
        break


Failing test case input:
10 878093
1 100000
1 110001
1 100000
1 101001
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000

Expected output:
100000


Actual output:

Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]
l = [0] * (10 ** 5 + 1)
for i in ab:
    l[i[0]] += i[1]
s = 0
for i in range(10 ** 5 + 1):
    s += l[i]
    if s >= k:
        print(i)
        break
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
l = [[0, 0]] * n
for i in range(n):
    l[i][0], l[i][1] = map(int, input().split())
l.sort()
c = 0
for i in range(n):
    c += l[i][0]
    if c >= k:
        print(l[i][1])
        break


Failing test case input:
3 2
2 2
1 1
4 3

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
l = [[0, 0] for _ in range(n)]
for i in range(n):
    l[i][0], l[i][1] = map(int, input().split())
l.sort()
c = 0
for i in range(n):
    c += l[i][1]
    if c >= k:
        print(l[i][0])
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int,input().split())
dcic = {}
aa = set([])
for i in range(n):
    a,b = map(int,input().split())
    aa.add(a)
    if a in dcic:
        dcic[a] = dcic[a] + b
    else:
        dcic.update({a:b})
        
bb = list(sorted(list(aa)))
cc = 0
ccc = 0
for i in range(len(bb)):
    if k - dcic[bb[i]] > -1:
        k = k - dcic[bb[i]]
        cc = bb[i]
    else:
        None
        
print(cc)

Failing test case input:
3 4
1 1
2 5
3 2

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n, k = map(int,input().split())
dcic = {}
aa = set([])
for i in range(n):
    a,b = map(int,input().split())
    aa.add(a)
    if a in dcic:
        dcic[a] = dcic[a] + b
    else:
        dcic.update({a:b})
        
bb = list(sorted(list(aa)))
cc = 0
s = 0
for i in range(len(bb)):
    if s < k:
        s = s + dcic[bb[i]]
        cc = bb[i]
    else:
        ccc = bb[i]
print(cc)

Problem: p03721
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

N, K = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

sum = 0
ans = 0

for i in range(N):
    sum += AB[i][1]
    if sum >= K:
        ans = AB[i][0]
        break

print(ans)


Failing test case input:
3 3
2 2
1 1
5 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):

N, K = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB)

for i in range(N):
    K -= AB[i][1]
    if K <= 0:
        print(AB[i][0])
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N , K = map(int,(input().split()))
 
sums = 0
nums = [0] *(10 ** 5 + 1) 
con = 0
ans = 0
 
for i in range(N):
  a,b = map(int,(input().split()))
  nums[a] += b
  
for i in range(N + 1):
  con += nums[i]
  if K <= con:
    ans = i
    break

    
print(ans)

Failing test case input:
3 5
2 2
1 1
15 3

Expected output:
15


Actual output:
0


Fixed submission (verdict: Accepted):
N , K = map(int,(input().split()))
 
sums = 0
nums = [0] * (10 ** 5 + 1) 
con = 0
ans = 0
 
for i in range(N):
  a,b = map(int,(input().split()))
  nums[a] += b
  
for i in range(len(nums)):
  con += nums[i]
  if K > con:
    continue
  elif K <= con:
    ans = i
    break

    
print(ans)
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
N,K=map(int, input().split())
p=[]
for i in range (0,N):
  r=list(map(int, input().split() )) 
  p.append(r)
p.sort()
k=0
for i in range(0,N):
  k+=p[i][1]
  if k>K:
    print(p[i-1][0])
    sys.exit()

Failing test case input:
3 2
2 2
1 1
4 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import sys
N,K=map(int, input().split())
p=[]
for i in range (0,N):
  r=list(map(int, input().split() )) 
  p.append(r)
p.sort()
k=0
for i in range(0,N):
  k+=p[i][1]
  if k>=K:
    print(p[i][0])
    sys.exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
l = []
for a,b in AB:
  ab = [a]*b
  l.extend(ab)
  if len(l) >= K:
    break
l.sort()
print(l[K-1])

Failing test case input:
3 4
2 2
4 5
3 2

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
count = 0
AB.sort()
for a,b in AB:
  count += b
  if count >= K:
    print(a)
    exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n, k = na()
ct = 0
for i in range(n):
    a, b = na()
    ct += b
    if ct >= k:
        ans = a
        break
print(ans)


Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n, k = na()
li = []
for i in range(n):
    a, b = na()
    li.append((a, b))
ct = 0
for a, b in sorted(li, key=itemgetter(0)):
    ct += b
    if ct >= k:
        ans = a
        break
print(ans)

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split(" "))

for i in range(n):
  a, b = map(int, input().split(" "))
  if k - b > 0:
    k = k - b
    continue
  else:
    ans = a
    break
    
print(a)

Failing test case input:
3 4
1 1
4 1
3 2

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
n, k = map(int, input().split(" "))
l = []
a_l = []
for i in range(n):
  a, b = map(int, input().split(" "))
  l.append((a, b))
  
l = sorted(l)
for n in l:
  if k > n[1]:
    k = k - n[1]
    continue
  else:
    ans = n[0]
    break
    
print(ans)
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split(' '))
tmp = [list(map(int, input().split(' '))) for _ in range(N)]
cumB = []
for i in range(N):
    if i == 0:
        cumB.append(tmp[0][1])
    else:
        cumB.append(cumB[i-1]+tmp[i][1])

A = [tmp[i][0] for i in range(N)]

for i in range(N):
    if K <= cumB[i]:
        print(A[i])
        break

Failing test case input:
3 4
2 2
4 5
3 2

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
N, K = map(int, input().split(' '))
tmp = [list(map(int, input().split(' '))) for _ in range(N)]
tmp.sort()
cumB = []
for i in range(N):
    if i == 0:
        cumB.append(tmp[0][1])
    else:
        cumB.append(cumB[i-1]+tmp[i][1])

A = [tmp[i][0] for i in range(N)]

for i in range(N):
    if K <= cumB[i]:
        print(A[i])
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N , K = map(int,(input().split()))

sums = 0

nums = []

for i in range(N):
  a,b = map(int,(input().split()))
  sums = b + sums
  nums.append([sums,a])
  
print(nums)

for i in range(len(nums)):
  if nums[i][0] >= K:
    print(nums[i][1])
    break

Failing test case input:
10 1626
1 100000
1 100000
1 100000
1 100000
1 100001
100000 100000
100000 101000
100000 100000
100000 100000
100000 100000

Expected output:
1


Actual output:
[[100000, 1], [200000, 1], [300000, 1], [400000, 1], [500001, 1], [600001, 100000], [701001, 100000], [801001, 100000], [901001, 100000], [1001001, 100000]]
1


Fixed submission (verdict: Accepted):
N , K = map(int,(input().split()))
 
sums = 0
nums = [0] * (10 ** 5 + 1) 
con = 0
ans = 0
 
for i in range(N):
  a,b = map(int,(input().split()))
  nums[a] += b
  
for i in range(len(nums)):
  con += nums[i]
  if K > con:
    continue
  elif K <= con:
    ans = i
    break

    
print(ans)

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

d = {}
for i in range(N):
    if A[i] in d:
        d[A[i]] = d[A[i]] + B[i]
    else:
        d[A[i]] = B[i]

list = sorted(d.items(), key=lambda x:x[0])

for a, b in list:
    if M - b <= 0:
        print(a)
    M -= b


Failing test case input:
3 3
1 2
1 2
3 3

Expected output:
1


Actual output:
1
3


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

d = {}
for i in range(N):
    if A[i] in d:
        d[A[i]] = d[A[i]] + B[i]
    else:
        d[A[i]] = B[i]

list = sorted(d.items(), key=lambda x:x[0])

for a, b in list:
    if M - b <= 0:
        print(a)
        break
    M -= b
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



N, K = map(int, input().split())
li = [list(map(int, input().split())) for i in range(N)]
arr = [[li[i][0] for j in range(li[i][1])] for i in range(N)]
arr = sum(arr, [])
print(arr[K - 1])

Failing test case input:
3 4
1 0
8 2
3 3

Expected output:
8


Actual output:
3


Fixed submission (verdict: Accepted):



N, K = map(int, input().split())
li = sorted([list(map(int, input().split())) for i in range(N)])
total = 0

for i in range(N):
    total += li[i][1]
    if total >= K:
        print(li[i][0])
        exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=[int(i) for i in input().split()]
count=0
for i in range(n):
    a,b=[int(i) for i in input().split()]
    count+=b
    if(count>=k):
        print(a)
        exit()


Failing test case input:
3 0
2 2
0 0
3 6

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n,k=[int(i) for i in input().split()]
count=0
lst=[]
for i in range(n):
    lst.append([int(i) for i in input().split()])
lst.sort()
for i in range(n):
    a,b=lst[i]
    count+=b
    if(count>=k):
        print(a)
        exit()

Problem: p03721
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())
temp={}
a=[0]*n
for i in range(n):
  at,bt=map(int,input().split())
  temp[at]=bt
  a[i]=at
a.sort()
cnt=0
for i in range(n):
  cnt=cnt+temp[a[i]]
  if cnt>=k:
    print(a[i])
    break
  

Failing test case input:
10 500000
1 100000
1 000000
1 100000
1 100000
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000

Expected output:
100000


Actual output:
1


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
temp={}
a=[0]*n
for i in range(n):
  at,bt=map(int,input().split())
  a[i]=at
  temp[at]=temp.get(at, 0)+bt
a=list(set(a))
a.sort()
cnt=0
for i in range(n):
  cnt=cnt+temp[a[i]]
  if cnt>=k:
    print(a[i])
    break

Problem: p03721
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import itertools

n, k = list(map(int, input().split()))
ab = [[] for _ in range(n)]
for i in range(n):
    ab[i] = list(map(int, input().split()))
az, bz = list(zip(*ab))

accb = list(itertools.accumulate(bz))
idx = 0
for j, v in enumerate(accb):
    if k <= v:
        idx = j
        break
print(az[idx])


Failing test case input:
3 3
2 2
1 1
8 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import itertools

n, k = list(map(int, input().split()))
ab = [[] for _ in range(n)]
for i in range(n):
    ab[i] = list(map(int, input().split()))
ab.sort(key=lambda x: x[0])
az, bz = list(zip(*ab))

accb = list(itertools.accumulate(bz))
idx = 0
for j, v in enumerate(accb):
    if k <= v:
        idx = j
        break
print(az[idx])
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
total=0
ans=[]
for i in range(n):
    a,b=map(int,input().split())
    total+=b
    if k<=total:
        print(a)
        break


Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
num=[list(map(int,input().split()))for _ in range(n)]
p=0
num.sort()
for i in range(n):
    p+=num[i][1]
    if k<=p:
        ans=num[i][0]
        break
print(ans)

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = [int(x) for x in input().split()]
ab = [[int(x) for x in input().split()]for _ in range(N)]
cand = {}
sums = 0
ans = 0
for i in ab:
    if(i[0] in cand):
        cand[i[0]] += i[1]
    else:
        cand[i[0]] = i[1]

for i in cand:
    sums+=cand[i]
    if(sums>=K):
        ans = i
        break
print(ans)


Failing test case input:
3 3
2 2
1 1
8 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N,K = [int(x) for x in input().split()]
ab = [[int(x) for x in input().split()]for _ in range(N)]

cand = {}
sums = 0
ans = 0
for i in ab:
    if(i[0] in cand):
        cand[i[0]] += i[1]
    else:
        cand[i[0]] = i[1]

cand = sorted(cand.items(), key=lambda x:x[0])
for i in cand:
    sums+=i[1]
    if(sums>=K):
        ans = i[0]
        break
print(ans)

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
s = [list(map(int,input().split())) for i in range(n)]
t = [s[i][0] for i in range(len(s))]
r = [s[i][1] for i in range(len(s))]
t.sort()
r.sort()
x = 0

for i in range(len(r)):
    x = x + r[i]
    if x >= k:
        print(t[i])
        break

Failing test case input:
3 4
1 1
8 2
3 3

Expected output:
3


Actual output:
8


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
s = [list(map(int,input().split())) for i in range(n)]
s.sort()

x = 0

for i in range(len(s)):
    x = x + s[i][1]
    if x >= k:
        print(s[i][0])
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

count = 0
ans = set()
for a, b in ab:
    ans.add(a)
    count += b
    if count >= k:
        break

print(list(ans)[-1])


Failing test case input:
3 5
4 0
4 1
3 5

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
ab = sorted(list(map(int, input().split())) for _ in range(n))

count = 0
for a, b in ab:
    count += b
    if count >= k:
        print(a)
        break
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N, K = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
num = 0
for i in range(N): 
    num += ab[i][1]
    if num >= K:
        ab.sort()
        print(ab[i][0])
        break

Failing test case input:
3 5
4 0
4 1
3 5

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):

import sys
N, K = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
now = 0
ab.sort()
for a, b in ab:
    now += b
    if now >= K:
            print(a)
            sys.exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K=map(int,input().split())
li=[]
for i in range(N):
  a,b=map(int,input().split())
  K-=b
  li.append(a)
  if K<=0:
    print(li[-1])
    exit()

Failing test case input:
3 0
2 2
0 0
3 6

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
li=sorted([list(map(int,input().split())) for _ in range(N)])
for l in li:
  K-=l[1]
  if K<=0:
    print(l[0])
    exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
cnt = 0
for i in range(N):
    a, b = map(int, input().split())
    cnt += b
    if cnt >= K:
        print(a)
        break


Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
l = [tuple(map(int, input().split())) for _ in range(N)]
l.sort(key=lambda x: x[0])
cnt = 0
for i in range(N):
    a = l[i][0]
    b = l[i][1]
    cnt += b
    if cnt >= K:
        print(a)
        break

Problem: p03721
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n,k=map(int,input().split())

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

for i in x:
  k-=i[1]
  if k<=0:
    print(i[0])
    exit()

Failing test case input:
3 4
2 2
4 5
3 2

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())

x=[list(map(int,input().split())) for i in range(n)]
x.sort(key=lambda x:x[0])

for i in x:
  k-=i[1]
  if k<=0:
    print(i[0])
    exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
from collections import defaultdict

N, K = map(int, input().split())
d = defaultdict(int)

for i in range(N):
    a, b = map(int, input().split())
    d[a] += b
ans = sorted(d.items(), key=lambda x: x[1])
cnt = 0
for i in range(len(ans)):
    cnt += ans[i][1]
    if cnt >= K:
        print(ans[i][0])
        sys.exit()



Failing test case input:
10 500000
1 100000
1 100000
1 100000
1 100000
1 110000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000

Expected output:
1


Actual output:
100000


Fixed submission (verdict: Accepted):
import sys
from collections import defaultdict

N, K = map(int, input().split())
ans = [0] * ((10 ** 5) + 1)

for i in range(N):
    a, b = map(int, input().split())
    ans[a] += b
cnt = 0
for i in range(10 ** 5 + 1):
    cnt += ans[i]
    if K <= cnt:
        print(i)
        sys.exit()
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int,input().split())
ans = [int(0)]*(10**5+1)

for _ in range(n):
  a, b = map(int,input().split())
  ans[a] += b

for j in range(1, 10^5+1):
  if k<=ans[j]:
    print(j)
    break
  k-= ans[j]


Failing test case input:
3 0
2 2
0 0
3 6

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n, k = map(int,input().split())
num = [list(map(int, input().split())) for i in range(n)]
num.sort()
sum_a = 0

for i in range(10**5+1):
  sum_a += num[i][1]
  ans = num[i][0]
  if sum_a >= k:
    print(ans)
    break
Problem: p02852
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from bisect import bisect_right
N, M = map(int, input().split())
S = input()

A = [i for i, s in enumerate(S) if s == '0']
now = 0
ans = []

while True:
    right = bisect_right(A, now + M) - 1
    new = A[right]
    ans.append(new - now)
    if new == N:
        break
    if new == now:
        print(-1)
        exit()
    now = new
print(*ans)

Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
2 3 3 1


Fixed submission (verdict: Accepted):
from bisect import bisect_right
N, M = map(int, input().split())
S = input()

A = [i for i, s in enumerate(S) if s == '0']
now = N
ans = []

while True:
    left = bisect_right(A, now - M - 1)
    new = A[left]
    ans.append(now - new)
    if new == 0:
        break
    if new == now:
        print(-1)
        exit()
    now = new

print(*ans[:: -1])

Problem: p02852
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
s=input()
x=n
a=0
while x!=0:
  for i in range(min(m,x),0,-1):
    if s[x-i]=="0":
      x-=i
      a=a*10+i
      break
    if i==min(m,x):print(-1);exit()
print(*list(str(a)))

Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
-1


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
s=input()
x=n
a=[]
while x!=0:
  for i in range(min(m,x),0,-1):
    if s[x-i]=="0":
      x-=i
      a.append(i)
      break
    if i==1:print(-1);exit()
print(*a[::-1])

Problem: p02852
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def p_f_2():
    n, m = map(int, input().split())
    *s, = map(int, input())
    i = 0
    ans = []
    while i + m < n:
        for j in reversed(range(i + 1, i + m + 1)):
            if s[j] == 0:
                ans.append(j - i)
                i = j
                break
        else:
            print(-1)
            exit()
    ans.append(n-i)
    print(*ans)

if __name__ == '__main__':
    p_f_2()


Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
2 3 3 1


Fixed submission (verdict: Accepted):
def p_f_2():
    n, m = map(int, input().split())
    *s, = map(int, input())
    s.reverse()
    i = 0
    ans = []
    while i + m < n:
        for j in reversed(range(i + 1, i + m + 1)):
            if s[j] == 0:
                ans.append(j - i)
                i = j
                break
        else:
            print(-1)
            exit()
    ans.append(n-i)
    print(*reversed(ans))

if __name__ == '__main__':
    p_f_2()
Problem: p02852
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():    
    N, M = map(int, input().split())
    S = input()
    p = N
    a = []
    while p > 0:
        for i in range(min(M, p), 0, -1):
            if S[p - i] == '0':
                p = p - i
                a.append(str(i))
                break
        else:
            return -1
    return ''.join(i for i in reversed(a))
print(main())


Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
1323


Fixed submission (verdict: Accepted):
def main():    
    N, M = map(int, input().split())
    S = input()
    p = N
    a = []
    while p > 0:
        for i in range(min(M, p), 0, -1):
            if S[p - i] == '0':
                p = p - i
                a.append(str(i))
                break
        else:
            return -1
    return ' '.join(i for i in reversed(a))
print(main())

Problem: p02852
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())
S=input()
L=[]
P=0

import sys
while P<N:
    k=0
    for i in range(1,M+1):
        if P+i>N:
            break
        if S[P+i]=='0':
            k=i
    if k==0:
        print(-1)
        sys.exit()
    L.append(k)
    P+=k
    
print(*L)

Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
2 3 3 1


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
S=input()[::-1]
L=[]
P=0

import sys
while P<N:
    k=0
    for i in range(1,M+1):
        if P+i>N:
            break
        if S[P+i]=='0':
            k=i
    if k==0:
        print(-1)
        sys.exit()
    L.append(k)
    P+=k

L=L[::-1]
print(*L)

Problem: p02852
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, M = map(int,input().split())
S = input()
p = 0
ans = []
while p != N:
    hoge = 0
    for i in range(min(M,N-p),0,-1):
        if S[p + i] == '0':
            hoge = i
            break
    p += hoge
    if hoge == 0:
        print(-1)
        exit()
    ans.append(hoge)
print(*ans)

Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
2 3 3 1


Fixed submission (verdict: Accepted):
N, M = map(int,input().split())
S = list(input())
S.reverse()
p = 0
ans = []
while p != N:
    hoge = 0
    for i in range(min(M,N-p),0,-1):
        if S[p + i] == '0':
            hoge = i
            break
    p += hoge
    if hoge == 0:
        print(-1)
        exit()
    ans.append(hoge)
print(*reversed(ans))

Problem: p02852
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
s=input()
x=n
a=0
while x!=0:
  for i in range(min(m,x),0,-1):
    if s[x-i]=="0":
      x-=i
      a=a*10+i
      break
    if i==1:print(-1);exit()
print(*list(str(a)))

Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
3 2 3 1


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
s=input()
x=n
a=[]
while x!=0:
  for i in range(min(m,x),0,-1):
    if s[x-i]=="0":
      x-=i
      a.append(i)
      break
    if i==1:print(-1);exit()
print(*a[::-1])
Problem: p02852
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import deque
N,M=map(int,input().split())
S=input()
j=N
ans=deque()
while j>0:
    for i in range(M,0,-1):

        if j-i==0:
            ans.appendleft(i)
            print(*ans)

        elif j-i<0:
            continue
        if S[j-i]=="0":
            ans.appendleft(i)
            j-=i

        if i==1 and S[j-i]=="1":
            print(-1)
            exit()


Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
-1


Fixed submission (verdict: Accepted):
from collections import deque
N,M=map(int,input().split())
S=input()
j=N
ans=deque()
while j>0:
    for i in range(M,0,-1):

        if j-i==0:
            ans.appendleft(i)
            print(*ans)

        elif j-i<0:
            continue
        if S[j-i]=="0":
            ans.appendleft(i)
            j-=i
            break
        if i==1 and S[j-i]=="1":
            print(-1)
            exit()

Problem: p02852
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = list(map(int, input().split()))
S = list(input())

D = []
t = N
while t > 0:
  print(t)
  if t - M <= 0:
    D.append(t)
    break
  for i in range(M, 0, -1):
    if S[t - i] == "0":
      D.append(i)
      t -= i
      break
  else:
    print(-1)
    exit()

for i in range(len(D) -1, -1, -1):
  print(D[i],end = " ")

Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
9
6
4
1
1 3 2 3 

Fixed submission (verdict: Accepted):
N, M = list(map(int, input().split()))
S = list(input())

D = []
t = N
while t > 0:
  if t - M <= 0:
    D.append(t)
    break
  for i in range(M, 0, -1):
    if S[t - i] == "0":
      D.append(i)
      t -= i
      break
  else:
    print(-1)
    exit()

for i in range(len(D) -1, -1, -1):
  print(D[i],end = " ")

Problem: p02852
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from bisect import *
n,m = map(int,input().split())
S = input()
ok = []
for i,s in enumerate(S):
    if s == '0':
        ok.append(i)

now = 0
ans = []
while now != n:
    nxt = ok[bisect_right(ok, now + m) - 1]
    if nxt == now:
        ans = [str(-1)]
        break
    else:
        ans.append(str(nxt - now))
        now = nxt
print(' '.join(ans))


Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
2 3 3 1


Fixed submission (verdict: Accepted):
from bisect import *
n,m = map(int,input().split())
S = input()
ok = []
for i,s in enumerate(S[::-1]):
    if s == '0':
        ok.append(i)

now = 0
ans = []
while now != n:
    nxt = ok[bisect_right(ok, now + m) - 1]
    if nxt == now:
        ans = [str(-1)]
        break
    else:
        ans.append(str(nxt - now))
        now = nxt
print(' '.join(ans[::-1]))
Problem: p02852
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
n, m = [int(i) for i in sys.stdin.readline().split()]
s = input()
ind = n
ls = []
while ind > 0:
    for i in range(min(m, ind), 0, -1):
        if s[ind - i] == "0":
            ind -= i
            break
        i = -1
        ind = 0
        break
    ls.append(str(i))
print(" ".join(ls[::-1]))

Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
-1 3


Fixed submission (verdict: Accepted):
import sys
n, m = [int(i) for i in sys.stdin.readline().split()]
s = input()
ind = n
ls = []
while ind > 0:
    flg = False
    for i in range(min(m, ind), 0, -1):
        if s[ind - i] == "0":
            ind -= i
            flg = True
            break
    if not flg:
        ls = []
        i = -1
        ind = 0
    ls.append(str(i))
print(" ".join(ls[::-1]))

Problem: p02852
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import deque
N,M=map(int,input().split())
S=input()
j=N
ans=deque()
while j>0:
    for i in range(M,0,-1):

        if j-i==0:
            ans.appendleft(i)
            print(*ans)

        elif j-i<0:
            continue
        if S[j-i]=="0":
            ans.append(i)
            j-=i

        if i==1 and S[j-i]=="1":
            print(-1)
            exit()


Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
-1


Fixed submission (verdict: Accepted):
from collections import deque
N,M=map(int,input().split())
S=input()
j=N
ans=deque()
while j>0:
    for i in range(M,0,-1):

        if j-i==0:
            ans.appendleft(i)
            print(*ans)

        elif j-i<0:
            continue
        if S[j-i]=="0":
            ans.appendleft(i)
            j-=i
            break
        if i==1 and S[j-i]=="1":
            print(-1)
            exit()

Problem: p02852
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
s=input()
x=n
a=0
while x!=0:
  for i in range(1,min(m,x)+1):
    if s[x-i]=="0":
      x-=i
      a=a*10+i
      break
    if i==min(m,x):print(-1);exit()
print(*list(str(a))[::-1])

Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
1 1 2 1 1 2 1


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
s=input()
x=n
a=[]
while x!=0:
  for i in range(min(m,x),0,-1):
    if s[x-i]=="0":
      x-=i
      a.append(i)
      break
    if i==1:print(-1);exit()
print(*a[::-1])

Problem: p02852
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
s=input()
x=n
a=[]
while x!=0:
  for i in range(min(m,x),0,-1):
    if s[x-i]=="0":
      x-=i
      a.append(i)
      break
    if i==1:print(-1);exit()
print(a[::-1])

Failing test case input:
9 3
0001000100

Expected output:
1 3 2 3

Actual output:
[1, 3, 2, 3]


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
s=input()
x=n
a=[]
while x!=0:
  for i in range(min(m,x),0,-1):
    if s[x-i]=="0":
      x-=i
      a.append(i)
      break
    if i==1:print(-1);exit()
print(*a[::-1])
Problem: p03268
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import math
import sys


def parse(file):
    n, k = map(int, file.readline().split())
    return n, k


def main(n, k):
    if n % 2 == 1:
        return math.floor(n / k) ** 3
    else:
        return math.floor(n/k) ** 3 + math.floor(n * 3 / 2 / k) ** 3


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))

Failing test case input:
53556 145

Expected output:
50243409


Actual output:
220274873


Fixed submission (verdict: Accepted):
import math
import sys


def parse(file):
    n, k = map(int, file.readline().split())
    return n, k


def main(n, k):
    if k % 2 == 1:
        return math.floor(n / k) ** 3
    else:
        return math.floor(n / k) ** 3 + math.floor((n + k/2) / k) ** 3


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))

Problem: p03268
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import math

n, k = map(int, input().split())
c = 0
if (n < k)&(k!=2):
    print(c)
    
elif k%2==0:
    if math.floor(2*n/k)%2==0:
        d=math.floor(2*n/k)
        c=2*d*d*d
    else:
        d=(math.floor(2*n/k)+1)/2
        c=d*d*d+(d-1)*(d-1)*(d-1)
    print(int(c))
else:
    d=math.floor(n/k)
    c=d*d*d
    print(int(c))



Failing test case input:
592 2

Expected output:
51868672


Actual output:
414949376


Fixed submission (verdict: Accepted):

import math
 
n, k = map(int, input().split())
c = 0
 
if k%2==0:
    if math.floor(2*n/k)%2==0:
        d=math.floor(2*n/k)/2
        c=2*d*d*d
    else:
        d=(math.floor(2*n/k)+1)/2
        c=d*d*d+(d-1)*(d-1)*(d-1)
    print(int(c))
else:
    d=math.floor(n/k)
    c=d*d*d
    print(int(c))

Problem: p03268
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

n, k = map(int, input().split())
c = 0

if k%2==0:
    if math.floor(2*n/k)%2==0:
        d=math.floor(2*n/k)
        c=2*d*d*d
    else:
        d=(math.floor(2*n/k)+1)/2
        c=d*d*d+(d-1)*(d-1)*(d-1)
    print(int(c))
else:
    d=math.floor(n/k)
    c=d*d*d
    print(int(c))

Failing test case input:
7672 162

Expected output:
207646


Actual output:
1661168


Fixed submission (verdict: Accepted):

import math
 
n, k = map(int, input().split())
c = 0
 
if k%2==0:
    if math.floor(2*n/k)%2==0:
        d=math.floor(2*n/k)/2
        c=2*d*d*d
    else:
        d=(math.floor(2*n/k)+1)/2
        c=d*d*d+(d-1)*(d-1)*(d-1)
    print(int(c))
else:
    d=math.floor(n/k)
    c=d*d*d
    print(int(c))

Problem: p03268
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b=map(int,input().split())
c=a
print((c**3)+(c+1)**3*((b+1)%2))

Failing test case input:
320 19

Expected output:
4096


Actual output:
32768000


Fixed submission (verdict: Accepted):
a,b=map(int,input().split())
c=a
print((c**3)+((a-b
Problem: p03268
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K=[int(x) for x in input().split()]
if K%2:
  mod0=N
  print(mod0**3)
else:
  mod0,MODN=divmod(N,K)
  if K>=N/2:
    print(mod0**3+(mod0+1)**3)
  else:
    print(mod0**3+(mod0+1)**3)

Failing test case input:
136 2

Expected output:
628864


Actual output:
642941


Fixed submission (verdict: Accepted):
N,K=[int(x) for x in input().split()]
if K%2:
  mod0=N
  print(mod0**3)
else:
  mod0,MODN=divmod(N,K)
  if MODN>=K
    print(mod0**3+(mod0+1)**3)
  else:
    print((mod0**3)*2)

Problem: p03268
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K=[int(x) for x in input().split()]
if K%2:
  mod0=N
  print(mod0**3)
else:
  mod0,MODN=divmod(N,K)
  if MODN>=K/2:
    print(mod0**3+(mod0+1)**3)
  else:
    print(mod0**3+(mod0+1)**3)

Failing test case input:
37826 236

Expected output:
8192000


Actual output:
8269281


Fixed submission (verdict: Accepted):
N,K=[int(x) for x in input().split()]
if K%2:
  mod0=N
  print(mod0**3)
else:
  mod0,MODN=divmod(N,K)
  if MODN>=K
    print(mod0**3+(mod0+1)**3)
  else:
    print((mod0**3)*2)

Problem: p03268
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():
    N, K = (int(i) for i in input().split())
    if K == 2:
        odd = 0--N
        even = N - odd
        print(odd**3+even**3)
        return
    cnt = 0
    for i in range(1, 2*10**5+1):
        if K*i <= N:
            cnt += 1
        else:
            break
    ans = cnt**3
    print(ans)


if __name__ == '__main__':
    main()


Failing test case input:
35897 286

Expected output:
3953501


Actual output:
1953125


Fixed submission (verdict: Accepted):
def main():
    N, K = (int(i) for i in input().split())
    cnt = 0
    for i in range(1, 2*10**5+1):
        if K*i <= N:
            cnt += 1
        else:
            break
    addcnt = 0
    if K % 2 == 0:
        for i in range(1, 2*10**5+1, 2):
            if (K
                addcnt += 1
            else:
                break
    ans = cnt**3 + addcnt**3
    print(ans)


if __name__ == '__main__':
    main()

Problem: p03268
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import math
 
n, k = map(int, input().split())
c = 0
 
if k%2==0:
    if math.floor(2*n/k)%2==0:
        d=math.floor(2*n/k)
        c=2*d*d*d
    else:
        d=(math.floor(2*n/k)+1)
        c=d*d*d+(d-1)*(d-1)*(d-1)
    print(int(c))
else:
    d=math.floor(n/k)
    c=d*d*d
    print(int(c))


Failing test case input:
312 4

Expected output:
949104


Actual output:
7592832


Fixed submission (verdict: Accepted):

import math
 
n, k = map(int, input().split())
c = 0
 
if k%2==0:
    if math.floor(2*n/k)%2==0:
        d=math.floor(2*n/k)/2
        c=2*d*d*d
    else:
        d=(math.floor(2*n/k)+1)/2
        c=d*d*d+(d-1)*(d-1)*(d-1)
    print(int(c))
else:
    d=math.floor(n/k)
    c=d*d*d
    print(int(c))
Problem: p03268
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
if (k%2==1):
    print(int(n/k)**3)
else :
    print(int(int(n/k)**3+(int((n-(k/2))/k)+1)**3))

Failing test case input:
2970 12506

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
if (2*n<k):
    print(0)
elif (k%2==1):
    print(int(n/k)**3)
else :
    print(int(int(n/k)**3+(int((n-(k/2))/k)+1)**3))

Problem: p03268
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M=input().split()
N=int(N)
M=int(M)
if M%2==0:
  print((N/M)**3+((N+M/2)/M)**3)
else:
  print((N/M)**3)

Failing test case input:
312 2

Expected output:
7592832


Actual output:
7629453.125


Fixed submission (verdict: Accepted):
N,M=input().split()
N=int(N)
M=int(M)
if M%2==0:
  print(int(N/M)**3+int((N+M/2)/M)**3)
else:
  print(int(N/M)**3)
Problem: p02558
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
p=[-1]*8**6
for q in[open(0)][1:]:
 q,*x=map(int,q.split());a,b=sorted(map(f:=lambda x:f(p[x])if~p[x]<0else x,x))
 if q:print(+(a==b))
 elif a<b:p[b]=a

Failing test case input:
4 7
1 0 1
-1 0 1
0 2 3
1 0 2
1 0 2
0 0 2
0 1 3

Expected output:
0
0
0
0


Actual output:

Fixed submission (verdict: Accepted):
p=[-1]*8**6
for q in[*open(0)][1:]:
 q,*x=map(int,q.split());a,b=sorted(map(f:=lambda x:f(p[x])if~p[x]<0else x,x))
 if q:print(+(a==b))
 elif a<b:p[b]=a
Problem: p03687
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter

S = input()

cnt = Counter(S).most_common()



cand = []
for t in cnt:
    k, v = t
    if v != cnt[0][1]:
        break
    cand.append(k)

anss = float('inf')
for c in cand:
    alp = c
    ans = 0
    tmp = 0
    for s in S:
        if s == alp:
            ans = max(ans, tmp)
            tmp = 0
        else:
            tmp += 1
    if tmp:
        ans = max(ans, tmp)
    anss = min(anss, ans)
print(anss)

Failing test case input:
clkjaa

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
from collections import Counter

S = input()

cnt = Counter(S).most_common()



cand = [chr(i) for i in range(97, 97+26)]

anss = float('inf')
for c in cand:
    alp = c
    ans = 0
    tmp = 0
    for s in S:
        if s == alp:
            ans = max(ans, tmp)
            tmp = 0
        else:
            tmp += 1
    if tmp:
        ans = max(ans, tmp)
    anss = min(anss, ans)
print(anss)

Problem: p03687
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()

ans = float('inf')
for goal in S:
    dist = [float('inf')] * len(S)
    right = float('inf')
    for i in range(len(S))[:: -1]:
        s = S[i]
        if s == goal:
            right = i
        dist[i] = min(dist[i], abs(i - right))

    cost = float('inf')
    for i in range(1, len(S) + 1):
        lMax = max(dist[:i])
        if lMax == float('inf'):
            continue
        cost = min(cost, max(lMax, max(dist[:len(S) - lMax + 1])))
    ans = min(ans, cost)

print(ans)

Failing test case input:
mtvvea

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
S = input()

ans = float('inf')
for goal in S:
    dist = [float('inf')] * len(S)
    right = float('inf')
    for i in range(len(S))[:: -1]:
        if S[i] == goal:
            right = i
        dist[i] = min(dist[i], abs(i - right))

    cost = float('inf')
    for i in range(len(S)):
        cost = min(cost, max(i, max(dist[:len(S) - i])))
    ans = min(ans, cost)

print(ans)