ZhenlongDai/ACPR huggingface dataset:
Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,X = map(int, input().split())
L =list(map(int,input().split()))
D = [0] * (N+1)
D[0] = 0
k=0
for i in range(N):
  if D[i] <= X:
    D[i+1] = D[i] + L[i]
    k += 1
print(k)    

Failing test case input:
0 6
51 0 1 6

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N,X = map(int, input().split())
L =list(map(int,input().split()))
D = 0
k = 0
for i in range(N):
  if D <= X:
    D += L[i]
    k += 1
if D <= X:
  k += 1
print(k)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = list(map(int, input().split()))
L = list(map(int, input().split()))

x = 0
ans = 0
for l in L:
    if x <= X:
        ans += 1
    else:
        break
    x += l
print(ans)

Failing test case input:
4 9
4 2 0 3

Expected output:
5


Actual output:
4


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

D = 0
ans = 0

for l in L:
    if D <= X:
        ans += 1
    else:
        break
    D += l
else:
    if D <= X:
        ans += 1
print(ans)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = map(int, input().split())
L = list(map(int, input().split()))

i, Y = 0, 0
while i < N and Y <= X:
    Y += L[i]
    i += 1
print(i)

Failing test case input:
0 10
15 0 2 2

Expected output:
1


Actual output:
0


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

i, Y = 0, 0
while i < N:
    if Y + L[i] <= X:
        Y += L[i]
        i += 1
    else:
        break
print(i + 1)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = map(int, input().split())
L = list(map(int, input().split()))

total = 0
for i, l in enumerate(L):
    total += l
    if total > X:
        break
print(i + 1)

Failing test case input:
4 9
4 2 0 3

Expected output:
5


Actual output:
4


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

total = 0
for i, l in enumerate(L):
    total += l
    if total > X:
        break
else:
    i += 1
print(i + 1)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x = map(int, input().split())
l = list(map(int, input().split()))

ans = 0
cnt = 0
for i in range(n):
  if cnt <= x:
    cnt += l[i]
    ans += 1
  else:
    print(ans)
    exit()
  
  
print(ans)


Failing test case input:
0 10
15 0 2 1

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n, x = map(int, input().split())
l = list(map(int, input().split()))

ans = 1
cnt = 0

for i in range(n):
  cnt += l[i]
  if cnt <= x:
    ans += 1
print(ans)
Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x = map(int,input().split())
l_li = list(map(int,input().split()))

ans = 0
point = 0

for i in range(len(l_li)):
    if i == 0:
        ans += 1
    else:
        point = point + l_li[i-1]
        if point <= x:
            ans += 1
print(ans)

Failing test case input:
4 9
4 0 -1 5

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
n,x = map(int,input().split())
l_li = list(map(int,input().split()))

ans = 0
point = 0

for i in range(len(l_li)+1):
    if i == 0:
        ans += 1
    else:
        point = point + l_li[i-1]
        if point <= x:
            ans += 1
print(ans)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x = map(int,input().split())
l = [int(i) for i in input().split()]
print(l)
d = [0]
count = 1
for i in range(1,n+1):
    d.append(d[i-1]+l[i-1])
    print(d)
    if d[i] <= x:
        count += 1
print(count)

Failing test case input:
4 6
6 3 0 1

Expected output:
2


Actual output:
[6, 3, 0, 1]
[0, 6]
[0, 6, 9]
[0, 6, 9, 9]
[0, 6, 9, 9, 10]
2


Fixed submission (verdict: Accepted):
n,x = map(int,input().split())
l = [int(i) for i in input().split()]
d = [0]
count = 1
for i in range(1,n+1):
    d.append(d[i-1]+l[i-1])
    if d[i] <= x:
        count += 1
print(count)

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

def main():
    n, x = map(int, input().split())

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

    result = 1
    D = 0
    count = 1

    for i in L:
        if count > n + 1:
            break


        newD = D + i
        if newD <= x:
            result = result + 1
            D = newD
        
        count = count + 1
        


    return result

if __name__ == "__main__":
    print(main())

Failing test case input:
4 6
3 6 3 1

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):

def main():
    n, x = map(int, input().split())

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

    result = 1
    D = 0

    for i in range(0, n):
        Dn = D + L[i]

        if Dn <= x:
            result += 1

        D = Dn



    return result



if __name__ == "__main__":
    print(main())

Problem: p03000
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,X = map(int,input().split())
L = list(map(int,input().split()))

D = 0
i = 1
while D<=X:
  if X<D or N<=i:
    break
  D += L[i-1]
  i += 1
print(i)


Failing test case input:
4 9
4 6 2 3

Expected output:
2


Actual output:
3


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

D = 0
i = 0
while D<=X and i<N+1:
  
  if i<N:
	  D += L[i]
  i += 1
print(i)
Problem: p03000
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, x = map(int, input().split())
l = list(map(int, input().split()))
dim1 = 0
for i in range(n):
    dim1 = dim1 + l[i]
    if dim1 > x:
        print(i+1)
        break


Failing test case input:
0 11
38 9 1 17

Expected output:
1


Actual output:

Fixed submission (verdict: Accepted):
n, x = map(int, input().split())
l = list(map(int, input().split()))
dim1 = 0
for i in range(n):
    dim1 = dim1 + l[i]
    if dim1 > x:
        print(i+1)
        exit()
print(n+1)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
_,x=map(int,input().split())
l=list(map(int,input().split()))
tmp=0
for i,j in enumerate(l):
  tmp+=j
  if tmp>x:
    print(i+1)
    exit()
  

Failing test case input:
4 9
4 0 -1 5

Expected output:
5


Actual output:

Fixed submission (verdict: Accepted):
_,x=map(int,input().split())
l=list(map(int,input().split()))
tmp=0
for i,j in enumerate(l):
  tmp+=j
  if tmp>x:
    print(i+1)
    exit()
print(len(l)+1)

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

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


d = 0

count = 0


for i in range(n):
    d += l[i]
    count += 1
    if d > x:
        print(count)
        break

Failing test case input:
4 9
3 2 0 3

Expected output:
5


Actual output:

Fixed submission (verdict: Accepted):
n, x = map(int, input().split())
l = list(map(int, input().split()))
l.insert(0,0)
d = 0
count = 0
for i in range(n+1):
    d += l[i]
    if d <= x:
        count += 1
print(count)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
c = 0

for i in range(n):
    if d <= x:
        c += 1
    d += l[i]

print(c)

Failing test case input:
0 11
51 0 2 17

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
c = 1

for i in range(n):
    d += l[i]
    if d <= x:
        c += 1
   
print(c)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = list(map(int, input().split()))
L = list(map(int, input().split()))

cnt = 0
d = 0
for n in range(N):
    if d <= X:
        cnt += 1
        d += L[n-1]
    else:
        break
print('{}'.format(cnt))


Failing test case input:
1 9
7 10 1 2

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):

N, X = list(map(int, input().split()))
L = list(map(int, input().split()))



cnt = 0
d = 0
curr = [0]
for n in range(N):
    if d <= X:
        cnt += 1
        d += L[n]
        curr.append(d)
    else:
        break
if d <= X:
    cnt += 1
print('{}'.format(cnt))
Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = map(int, input().split())
L = list(map(int, input().split()))
count = 0
p = 0

for i in L:
  if p > X:
    break
  else:
  	count += 1
  	p += i

print(count)

Failing test case input:
4 9
1 2 0 5

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
N, X = map(int, input().split())
L = list(map(int, input().split()))
count = 1
p = 0

for i in L:
  if p + i <= X:
    count += 1
    p += i
  else:
    break
    
print(count)

Problem: p03000
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, x = map(int, input().split())
l = input().split()
for i in range(n):
    l[i] = int(l[i])

cnt = 1
sum = 0
for i in range(n):
    if sum > x:
        break
    sum += l[i]
    cnt += 1
    
print(cnt)


Failing test case input:
4 9
9 5 2 12

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n, x = map(int, input().split())
l = input().split()
for i in range(n):
    l[i] = int(l[i])

cnt = 1
sum = 0
for i in range(n):
    sum += l[i]
    if sum > x:
        break
    cnt += 1
    
print(cnt)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x=map(int,input().split())
l=list(map(int,input().split()))
c=0
for i in range(n):
    s=sum(l[0:i])
    if s<=x:
        c+=1 
print(c)

Failing test case input:
1 9
5 6 2 6

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n,x=map(int,input().split())
l=list(map(int,input().split()))
l.insert(0,0)
c=0
a=0
for i in l:
    c+=i 
    if c<=x:
        a+=1
print(a)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x = map(int, input().split())
l = list(map(int, input().split()))
cnt = 1
d = 0
for i in range(n):
    d += l[i]
    if d >= x:
        break
    cnt += 1
print(cnt)

Failing test case input:
4 6
6 3 0 1

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n, x = map(int, input().split())
l = list(map(int, input().split()))
cnt = 1
d = 0
for i in range(n):
    d += l[i]
    if d > x:
        break
    cnt += 1

print(cnt)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0

cnt = 0
while D <= X and cnt < N:
	D = D + L[cnt]
	cnt += 1

print(cnt)


Failing test case input:
0 12
51 9 1 17

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0

cnt = 0
while D <= X and cnt <= N:
	if cnt == N:
		cnt += 1
		break
	D = D + L[cnt]
	cnt += 1

print(cnt)
Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = [int(i) for i in input().split()]
Ls = [int(l) for l in input().split()]
d = 0
res = 1
for i, Li in enumerate(Ls):
    if d <= X:
        res += 1
        break
    d += Li
print(res)

Failing test case input:
0 10
51 0 1 17

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N, X = [int(i) for i in input().split()]
Ls = [int(l) for l in input().split()]
d = 0
res = 1
for i, Li in enumerate(Ls):
    d += Li
    if d > X:
        break
    res += 1
print(res)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x=map(int,input().split())
a = list(map(int,input().split()))
p = 0
f = 0
for i in a:
    if f <= x:
        f += i
        p += 1
    else:
        break
print(p)

Failing test case input:
4 9
4 0 -1 5

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
n,x=map(int,input().split())
a = list(map(int,input().split()))
p = 1
f = 0
for i in a:
    f += i
    if f <= x:
        p += 1
    else:
        break
print(p)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = map(int, input().split())
L = list(map(int, input().split()))

D = 0
ans = 2
for i in range(N):
  D = D + L[i]
  if D > X:
    ans = i+1
    break
print(ans)

Failing test case input:
0 10
24 0 1 1

Expected output:
1


Actual output:
2


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

D = 0
ans = 1
for i in range(N):
  D = D + L[i]
  if D <= X:
    ans += 1
print(ans)

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

A=list(map(int, input().split()))
L=list(map(int, input().split()))
D=0
C=1
for i in L:
    D+=i
    if D<=A[1]:
        C+=1
    else:
        print(C)
        break
else:
    print(A[0])

Failing test case input:
4 9
1 2 0 5

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):

A=list(map(int, input().split()))
L=list(map(int, input().split()))
D=0
C=1
for i in L:
    D+=i
    if D<=A[1]:
        C+=1
    else:
        print(C)
        break
else:
    print(A[0]+1)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x = input().strip().split()
n = int(n)
x = int(x)
l = input().strip().split()
l = list(map(int, l))
now = 0
for i in range(n):
  now += l[i]
  if now > x:
    print(i+1)
    exit()

Failing test case input:
1 9
5 10 1 2

Expected output:
2


Actual output:

Fixed submission (verdict: Accepted):
n, x = input().strip().split()
n = int(n)
x = int(x)
l = input().strip().split()
l = list(map(int, l))
now = 0
for i in range(n):
  now += l[i]
  if now > x:
    print(i+1)
    exit()
print(n+1)
Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,X=map(int,input().split())
L=list(map(int,input().split()))
L.insert(0,0)
long=0
for i in range(N+1):
    long=long+L[i]
    if long>X:
        break
print(i)

Failing test case input:
0 10
24 0 1 1

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N,X=map(int,input().split())
L=list(map(int,input().split()))
L.insert(0,0)
long=0
count=0
for i in range(N+1):
    count=i+1
    long=long+L[i]
    if long>X:
        count=count-1
        break
print(count)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
def print_ans(N, X, lr):
    
    counter = 1
    ans_sum = 0
    for l in lr:
        if ans_sum > X:
            break
        counter += 1
        ans_sum += l
    print(counter)

if __name__ == '__main__':
    N, X = map(int, input().rstrip().split())
    lr = list(map(int, input().rstrip().split()))
    print_ans(N, X, lr)




Failing test case input:
4 9
4 6 1 3

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
def print_ans(N, X, lr):
    
    counter = 1
    ans_sum = 0
    for l in lr:
        ans_sum += l
        if ans_sum > X:
            break
        else:
            counter += 1
    print(counter)

if __name__ == '__main__':
    N, X = map(int, input().rstrip().split())
    lr = list(map(int, input().rstrip().split()))
    print_ans(N, X, lr)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x=map(int,input().split())
l=list(map(int,input().split()))
count=0
s=0
for i in range(n):
    if s<=x:
        count+=1
    else:
        break
    s+=l[i]
print(count)

Failing test case input:
1 9
5 10 1 2

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n,x=map(int,input().split())
l=list(map(int,input().split()))
count=1
s=0
for i in range(n):
    s+=l[i]
    if s<=x:
        count+=1
    else:
        break
    
print(count)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x = map(int, input().split())
l = list(map(int, input().split()))

ans = 0
cnt = 0
for i in range(n):
  cnt += l[i]
  ans += 1 

  if cnt > x:
    print(ans)
    exit


Failing test case input:
1 14
13 17 1 1

Expected output:
2


Actual output:

Fixed submission (verdict: Accepted):
n, x = map(int, input().split())
l = list(map(int, input().split()))

ans = 1
cnt = 0

for i in range(n):
  cnt += l[i]
  if cnt <= x:
    ans += 1
print(ans)

Problem: p03000
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = [0]*(n+1)
for i in range(n):
  d[i+1] = d[i] + l[i]
  if d[i+1] > x:
    print(i+1)
    break
if d[n] == x:
  print(n+1)

Failing test case input:
0 10
15 0 2 2

Expected output:
1


Actual output:

Fixed submission (verdict: Accepted):
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = [0]*(n+1)
for i in range(n):
  d[i+1] = d[i] + l[i]
  if d[i+1] > x:
    print(i+1)
    d[n] = x + 1
    break
if d[n] <= x:
  print(n+1)
Problem: p03000
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
count = 0
for lx in l:
    if d <= x:
        count += 1
    else:
        break
    d = d + lx
print(count)

Failing test case input:
4 9
3 2 0 3

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
count = 0
flg = True
for lx in l:
    if d <= x:
        count += 1
        d = d + lx
    else:
        flg = False
        break
if d <= x:
    count +=1
print(count)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def intMap(): return map(int,input().split())
def intList(): return list(map(int, input().split()))

n,x = intMap()
l = intList()

d = 0
i = 0

while d <= x:
    d = d + l[i]
    i += 1
    if i >= n: break


print(i)


Failing test case input:
1 9
4 10 2 10

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
def intMap(): return map(int,input().split())
def intList(): return list(map(int, input().split()))

n,x = intMap()
l = intList()

ans = 1
d = 0

for i in range(n):
    d += l[i]
    if d > x: break
    ans += 1

print(ans)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = map(int, input().split())
L = list(map(int, input().split()))

D = 0
cnt = 0
for i in range(N):
  if D <= X:
    cnt += 1
  else:
    break
  D += L[i]
print(cnt)

Failing test case input:
0 6
51 0 1 6

Expected output:
1


Actual output:
0


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

D = 0
cnt = 1
for i in range(N):
  D += L[i]
  if D <= X:
    cnt += 1
  else:
    break

print(cnt)

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







n, x = map(int, input().split())
d = list(map(int, input().split()))
r = s = 0

for i, p in enumerate(d):
    if s > x:
        exit(print(i))
        break
    else:
        s += p
print(n)



Failing test case input:
4 9
4 0 -1 5

Expected output:
5


Actual output:
4


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







n, x = map(int, input().split())
d = list(map(int, input().split()))
r = s = 0

for i, p in enumerate(d):
    s += p
    if s > x:
        exit(print(i+1))
print(n+1)

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

l = [int(i) for i in input().split()]

d = 0

cnt = 0

for i in range(n):
	if d > x:
		break
	else:
		d += l[i]
		cnt += 1

print(cnt)

Failing test case input:
1 9
4 10 2 6

Expected output:
2


Actual output:
1


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

l = [int(i) for i in input().split()]

d = 0

cnt = 1

for i in range(n):
	d += l[i]
	if d > x:
		break
	else:
		cnt += 1

print(cnt)
Problem: p03000
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,X = map(int,input().split())
l = list(map(int,input().split()))

sum=0
for i in range(N):
    if sum>X:
        print(i)
        exit()
    sum += l[i]


Failing test case input:
4 7
4 2 1 5

Expected output:
4


Actual output:

Fixed submission (verdict: Accepted):
N,X = map(int,input().split())
l=[0]
l += list(map(int,input().split()))
sum=0
for i in range(N+1):
    sum += l[i]
    if sum>X:
        print(i)
        exit()
print(N+1)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,X=map(int,input().split())
N=list(map(int,input().split()))
ans=1
h=0
for i in range(len(N)):
  h+=N[i]
  if h <= X:
    ans+=1
  else:
    print(ans)
    quit()

Failing test case input:
4 9
4 2 0 3

Expected output:
5


Actual output:

Fixed submission (verdict: Accepted):
N,X=map(int,input().split())
N=list(map(int,input().split()))
ans=1
h=0
for i in range(len(N)):
  h+=N[i]
  if h <= X:
    ans+=1
  else:
    pass
print(ans)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x = map(int,input().split())
l = list(map(int,input().split()))
i=0
suml=0
if sum(l)<=x:
    print(len(l))
else:
    while suml<=x:
        suml=suml+l[i]
        i=i+1
    print(i)

Failing test case input:
4 9
3 2 0 3

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
n,x = map(int,input().split())
l = list(map(int,input().split()))
i=0
suml=0
if sum(l)<=x:
    print(len(l)+1)
else:
    while suml<=x:
        suml=suml+l[i]
        i=i+1
    print(i)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x = map(int,input().split(" "))
l = [int(i) for i in input().split(" ")]
ans = 0
t = 0

for j in l:
    if t <= x:
        ans += 1
    t += j

print(ans)


Failing test case input:
4 9
1 2 0 5

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
n,x = map(int,input().split(" "))
l = [int(i) for i in input().split(" ")]
ans = 0
t = 0

for j in l:
    if t <= x:
        ans += 1
    t += j

if t <= x:
    ans += 1

print(ans)

Problem: p03000
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,X = map(int,input().split())
l = list(map(int,input().split()))
p = 0
count = 0

for i in range(N):
    p += l[i]
    count += 1
    if p > X:
        print(count)
        break

Failing test case input:
0 11
51 0 2 17

Expected output:
1


Actual output:

Fixed submission (verdict: Accepted):
N,X = map(int,input().split())
l = list(map(int,input().split()))
p = 0
count = 1

for i in l:
    p += i
    count += 1
    if p > X:
        count -= 1
        break
print(count)
Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
ans=0
i=0
for i in range(n):
  if d<=x:
    d+=l[i]
    ans+=1
    
  else:
    break
  
print(ans)




Failing test case input:
4 9
3 2 0 3

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
ans=1
i=0
for i in range(n):
  d+=l[i]
  if d<=x:
    
    ans+=1
    
  else:
    break
  
print(ans)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = map(int, input().split())
L = list(map(int, input().split()))

d = 0
count = 0
while d <= X and len(L) > 0:
    count += 1
    d += L.pop()

print(count)







Failing test case input:
0 10
15 0 4 1

Expected output:
1


Actual output:
4


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

D = 0
count = 1
for i in range(len(L)):
    D += L[i]
    if D <= X:
        count += 1
    else:
        break

print(count)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x = map(int, input().split())
l = list(map(int, input().split()))
a = 0
for i in range(n):
    a += l[i]
    if a > x:
        print(i+1)
        exit()
    else:
        print(n+1)

Failing test case input:
3 9
9 4 2 12

Expected output:
2


Actual output:
4
2


Fixed submission (verdict: Accepted):
n, x = map(int, input().split())
l = list(map(int, input().split()))
a = 0
d = 1
for i in range(n):
    a += l[i]
    if a <= x:
        d += 1
    else:
        break
print(d)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,X = map(int,input().split())
L = list(map(int,input().split()))

ans = 1 
p = 0 
for i in range(N):
    p += L[i]
    if p <= X:
         ans += 1
    else:
        print(ans)
        break



Failing test case input:
1 9
4 10 2 2

Expected output:
2


Actual output:

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

ans = 1 
p = 0 
for i in range(N):
    p += L[i]
    if p <= X:
         ans += 1
    else:
        break

print(ans)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
cnt=0
for i in range(n):
  if x<d:
    break
  cnt+=1
  d+=l[i]
print(cnt)

Failing test case input:
0 10
24 0 1 1

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[0]*(n+1)
ans=0
for i in range(n):
  d[i+1]=d[i]+l[i]
for i in range(n+1):
  if d[i]<=x:
    ans+=1
print(ans)
Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x=(int(x) for x in input().split())
list = input().split()
list = [int(s) for s in list]
list.insert(0,0)
z = 0
count = 0

for i in range(n+1):
    if z > x:
        break
    else:
        count = count + 1
        z = z + list[i]
        
print(count)


Failing test case input:
4 9
4 2 -1 5

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
n,x=(int(x) for x in input().split())
list = input().split()
list = [int(s) for s in list]
list.append(0)
d = 0
count = 0

for i in range(n+1):
    if d > x:
        break
    else:
        count = count + 1
        d = d + list[i]

print(count)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x=map(int,input().split())
a=list(map(int,input().split()))
now=0
cnt=0
for i in a:
  now+=i
  cnt+=1
  if x<now:
    break
print(cnt)

Failing test case input:
4 9
4 2 0 3

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
n,x=map(int,input().split())
a=list(map(int,input().split()))
now=0
cnt=1
for i in a:
  now+=i
  if x<now:
    break
  cnt+=1
print(cnt)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
bnd = 1
for i in range(n):
  if d > x:
    exit()
  else:
    d += l[i]
    bnd += 1
    print(d)

print(bnd-1)

Failing test case input:
0 11
38 9 1 17

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
bnd = 1
for i in range(n):
    d += l[i]
    if d > x:
        break
    else:
        bnd +=1
print(bnd)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x = map(int, input().split(' '))
ls = [i for i in map(int, input().split(' '))]
sum = 0
for i in range(0, n):
    sum += ls[i]
    if sum >= x:
        print(i + 1)
        break


Failing test case input:
0 11
51 0 1 17

Expected output:
1


Actual output:

Fixed submission (verdict: Accepted):
n, x = map(int, input().split(' '))
ls = [i for i in map(int, input().split(' '))]
sum, bound = 0, 1
for i in range(0, n):
    sum += ls[i]
    if sum > x:
        break
    else:
        bound += 1
print(bound)

Problem: p03000
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, x = map(int,input().split())
l = list(map(int, input().split()))
s, count = 0, 0
for i in l:
    if s>x:
        break
    else:
        s += i
        count += 1
print(count)

Failing test case input:
4 9
3 2 0 3

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
n, x = map(int,input().split())
l = list(map(int, input().split()))
s = 0
count = 1
for i in l:
    s += i
    if s > x:
        break
    count += 1
print(count)
Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
cnt = 0
for i in range(n):
	cnt += 1
	d += l[i]
	if x < d:
		print(cnt)
		exit()
exit()

Failing test case input:
1 14
13 18 1 1

Expected output:
2


Actual output:

Fixed submission (verdict: Accepted):
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = [0]

for i in range(n):
	d.append(d[i] + l[i])

ans  = 0
for i in range(n+1):
	if d[i] <= x:
		ans += 1

print(ans)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X = map(int, str(input()).split())
L = list(map(int, input().split()))

count = 1
length = 0
for i in range(N):
    if length > X:
        print(count)
        exit()
    length += L[i]
    count += 1

print(count)


Failing test case input:
4 6
3 6 3 1

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
N, X = map(int, str(input()).split())
L = list(map(int, input().split()))

count = 1
length = 0
for i in range(N):
    length += L[i]
    if length > X:
        print(count)
        exit()
    count += 1

print(count)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
cnt = 0
for i in range(n):
    if d <= x:
        cnt += 1
    d = d + l[i]
print(cnt)

Failing test case input:
0 11
51 9 1 17

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n, x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
cnt = 1
for i in range(n):
    d = d + l[i]
    if d <= x:
        cnt += 1
print(cnt)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,X = list(map(int,input().split(' ')))
L = list(map(int,input().split(' ')))[:N]

count = 0
d = 0

for l in L:

    if (d <= X):
        count += 1

print(count)


Failing test case input:
4 6
6 3 0 1

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
N,X = list(map(int,input().split(' ')))
L = list(map(int,input().split(' ')))[:N]



p = 0
count = 1

for i in range(0,N):
    p += L[i]
    if p <= X:
        count += 1

print(count)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

n,x = map(int,input().split())
l_list = list(map(int,input().split()))

for i in range(n):
    if sum(l_list[:i+1]) > x:
        print(i+1)
        sys.exit()

Failing test case input:
0 6
51 0 1 6

Expected output:
1


Actual output:

Fixed submission (verdict: Accepted):
import sys

n,x = map(int,input().split())
l_list = list(map(int,input().split()))

for i in range(n):
    if sum(l_list[:i+1]) > x:
        print(i+1)
        sys.exit()

print(n+1)
Problem: p03000
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
d=0
e=0
for i in range(a):
  while d<b:
    d=d+c[i]
    e=e+1
  print(e+1)
  break

Failing test case input:
1 14
9 17 1 1

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
d=0
e=0
for i in range(a):
  if d+c[i]<=b:
    d=d+c[i]
    e=e+1
  else:
    break
print(e+1)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x = map(int, input().split())
L = [int(i) for i in input().rstrip().split()]
jmp = 0
cnt = 0

for j in range(0, n):
    if jmp <= x:
        cnt += 1
    jmp = jmp + L[j]
    
print(cnt)


Failing test case input:
1 14
9 17 1 1

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n, x = map(int, input().split())
L = [int(i) for i in input().rstrip().split()]
jmp = 0
cnt = 1

for j in range(0, n):
    if jmp+L[j] <= x:
        cnt += 1
    jmp = jmp + L[j]
    
print(cnt)

Problem: p03000
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x=map(int,input().split())
a=list(map(int,input().split()))
cnt=0
total=0
for i in a:
    if total>x:
        break
    else:
        total+=i
        cnt+=1
print(cnt)

Failing test case input:
4 9
4 0 -1 5

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
n,x=map(int,input().split())
a=list(map(int,input().split()))
cnt=0
total=0
for i in a:
    total+=i
    if total<=x:
        cnt+=1
print(cnt+1)
Problem: p03459
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



def f(poss):
    lastPos = (0, 0, 0)

    for pos in poss:
        t = pos[0] - lastPos[0]
        d = abs(pos[1] - lastPos[1]) + abs(pos[2] - lastPos[2])
        lastPos = pos

        if t < d or (t-d)%2 != 0:
            return False

    return True



def main():
    n = int(input())
    poss = [tuple(map(int, input().split())) for i in range(n)]

    print('YES' if f(poss) else 'NO')


if __name__ == '__main__':
    main()


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

Expected output:
Yes

Actual output:
YES


Fixed submission (verdict: Accepted):



def f(poss):
    lastPos = (0, 0, 0)

    for pos in poss:
        t = pos[0] - lastPos[0]
        d = abs(pos[1] - lastPos[1]) + abs(pos[2] - lastPos[2])
        lastPos = pos

        if t < d or (t-d)%2 != 0:
            return False

    return True



def main():
    n = int(input())
    poss = [tuple(map(int, input().split())) for i in range(n)]

    print('Yes' if f(poss) else 'No')


if __name__ == '__main__':
    main()

Problem: p03459
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=[list(map(int,input().split()))for i in range(n)]
s.insert(0,[0,0,0])
p=0
for i in range(n):
    c=s[i+1][0]-s[i][0]
    d=abs(s[i+1][1]-s[i][1])+abs(s[i+1][2]-s[i][2])
    if c<=d or (c-d)%2==1:
        p=1
        break
print("No" if p==1 else "Yes")

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

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
n=int(input())
s=[list(map(int,input().split()))for i in range(n)]
s.insert(0,[0,0,0])
p=0
for i in range(n):
    c=s[i+1][0]-s[i][0]
    d=abs(s[i+1][1]-s[i][1])+abs(s[i+1][2]-s[i][2])
    if c<d or (c-d)%2==1:
        p=1
        break
print("No" if p==1 else "Yes")

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

import sys

n = int(input())
tprev = 0
tdiff = 0
pos = [0, 0]
for i in range(n):
    t, x, y = list(map(int,input().split()))
    tdiff = t - tprev
    print(pos,tdiff,abs(x-pos[0])+abs(y-pos[1]))
    if(tdiff>=abs(x-pos[0])+abs(y-pos[1])):
        if((tdiff-(abs(x-pos[0])+abs(y-pos[1])))%2 == 0):
            tprev = t
            pos = [x, y]
        else:
            print('No')
            sys.exit()
    else:
        print('No')
        sys.exit()
else:
    print('Yes')
        

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

Expected output:
Yes

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


Fixed submission (verdict: Accepted):

import sys

n = int(input())
tprev = 0
tdiff = 0
pos = [0, 0]
for i in range(n):
    t, x, y = list(map(int,input().split()))
    tdiff = t - tprev
    if(tdiff>=abs(x-pos[0])+abs(y-pos[1])):
        if((tdiff-(abs(x-pos[0])+abs(y-pos[1])))%2 == 0):
            tprev = t
            pos = [x, y]
        else:
            print('No')
            sys.exit()
    else:
        print('No')
        sys.exit()
else:
    print('Yes')
Problem: p03459
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



def f(poss):
    lastPos = (0, 0, 0)

    for pos in poss:
        t = pos[0] - lastPos[0]
        d = abs(pos[1] - lastPos[1]) + abs(pos[2] - lastPos[2])

        if t < d or (t-d)%2 != 0:
            return False

    return True



def main():
    n = int(input())
    poss = [tuple(map(int, input().split())) for i in range(n)]

    print('YES' if f(poss) else 'NO')


if __name__ == '__main__':
    main()


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

Expected output:
Yes

Actual output:
YES


Fixed submission (verdict: Accepted):



def f(poss):
    lastPos = (0, 0, 0)

    for pos in poss:
        t = pos[0] - lastPos[0]
        d = abs(pos[1] - lastPos[1]) + abs(pos[2] - lastPos[2])
        lastPos = pos

        if t < d or (t-d)%2 != 0:
            return False

    return True



def main():
    n = int(input())
    poss = [tuple(map(int, input().split())) for i in range(n)]

    print('Yes' if f(poss) else 'No')


if __name__ == '__main__':
    main()
Problem: p04030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7


s = input()
stack = list()
for c in s:
    if c == 'B' and len(stack) > 0:
        stack.pop()
    else:
        stack.append(c)
print(''.join(stack))


Failing test case input:
B2B1

Expected output:
1


Actual output:
B1


Fixed submission (verdict: Accepted):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7


s = input()
stack = list()
for c in s:
    if c == 'B':
        if len(stack) > 0:
            stack.pop()
    else:
        stack.append(c)
print(''.join(stack))

Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()

ans=""
for i in range(len(s)):
    if s[i]=="B":
        if len(ans)==0:
            continue
        t=ans[len(ans)-1]
        ans=ans.rstrip(t)
    else:
        ans+=s[i]
print(ans)


Failing test case input:
00B0

Expected output:
00


Actual output:
0


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

ans=""
for i in range(len(s)):
    if s[i]=="B":
        if len(ans)==0:
            continue
        ans=ans[:-1]
    else:
        ans+=s[i]
print(ans)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
answer = []

for i in s:
        if  i == "B":
            try:
                answer.pop()
            except IndexError:
                pass
        else:
            answer.append(i)

print(" ".join(answer))

Failing test case input:
.B00

Expected output:
00


Actual output:
0 0


Fixed submission (verdict: Accepted):
s = list(input())
answer = []

for i in s:
        if  i == "B":
            try:
                answer.pop()
            except IndexError:
                pass
        else:
            answer.append(i)

print("".join(answer))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
res = ""
for i in range(len(s)):
  if s[i] == "B":
    if res != "":
      res = res[:len(s)-1]
  else:
    res += s[i]
print(res)

Failing test case input:
B1B0

Expected output:
0


Actual output:
10


Fixed submission (verdict: Accepted):
s = input()
res = ""
for i in range(len(s)):
  if s[i] == "B":
    if res != "":
      res = res[:len(res)-1]
  else:
    res += s[i]
print(res)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A =input()
B=""
for i in range(len(A)):
    if i==0:
        if A[i]!="B":
            B= B+A[i]
    else:
        if A[i] !="B":
            B=B+A[i]
        else:
            B = B[:i-2]
print(B)


            


Failing test case input:
11B0

Expected output:
10


Actual output:
0


Fixed submission (verdict: Accepted):
A =input()
B=""
for i in range(len(A)):
    if i==0:
        if A[i]!="B":
            B= B+A[i]
    else:
        if A[i] !="B":
            B=B+A[i]
        else:
            B = B[:(len(B)-1)]
print(B)
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
a = []

for _ in s:
    if _ == 'B':
        a = a[:-1]
    else:
        a += _

print(a)

Failing test case input:
0B-0

Expected output:
-0


Actual output:
-, 0

Fixed submission (verdict: Accepted):
s = input()
a = ''

for _ in s:
    if _ == 'B':
        a = a[:-1]
    else:
        a += _

print(a)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
ss=input().split()
r=''
for s in ss:
  if s=='B' and len(r)>0:
    r=r[:-1]
  else:
    r+=s
print(r)

Failing test case input:
B01B

Expected output:
0


Actual output:
B01B


Fixed submission (verdict: Accepted):
ss=list(input())
r=''
for i, s in enumerate(ss):
  if s != 'B':
    r+=s
  elif len(r)>0:
    r=r[:-1]
print(r)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def solve():
    s = list(input())

    if s[0] == 'B':
        s[0] == ''

    for i in range(1, len(s)):
        if s[i] == 'B':
            s[i-1], s[i] ='', ''


    return ''.join(s)

    
print(solve())


Failing test case input:
B3B1

Expected output:
1


Actual output:
B1


Fixed submission (verdict: Accepted):
def solve():
    s = list(input())

    ans = []
    for i in range(len(s)):
        if s[i] != 'B':
            ans.append(s[i])
        elif s[i] == 'B' and ans:
            ans.pop(len(ans)-1)

    return ''.join(ans)

    
print(solve())

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=input()
ans=[]
for i in N:
    if i=='B' and not ans==[]:
        ans.pop()
    else:
        ans.append(i)
print(''.join(ans))

Failing test case input:
B2B1

Expected output:
1


Actual output:
B1


Fixed submission (verdict: Accepted):
N=input()
ans=[]
for i in N:
    if i=='B':
        if not ans==[]:
            ans.pop()
    else:
        ans.append(i)
print(''.join(ans))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=str(input())
while(s.count("B")!=0):
  i=s.find("B")
  print(i)
  if i!=0:
    s=s[:i-1]+s[i+1:]
  else:
    s=s[1:]
print(s)

Failing test case input:
0AB0

Expected output:
00


Actual output:
2
00


Fixed submission (verdict: Accepted):
s=str(input())
while(s.count("B")!=0):
  i=s.find("B")
  if i!=0:
    s=s[:i-1]+s[i+1:]
  else:
    s=s[1:]
print(s)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
size = len(s)
ans = []
for i in range(size) :
    if s[i] ==  "B" and len(ans) >= 1:
        ans.pop(-1)
    else: ans.append(s[i])

b = "".join(ans)
print(b)

Failing test case input:
B000

Expected output:
000


Actual output:
B000


Fixed submission (verdict: Accepted):
s = list(input())
size = len(s)
ans = []
for i in range(size) :
    if len(ans) >= 1 :
        if s[i] ==  "B" :
            ans.pop(-1)
        else : ans.append(s[i])

    elif s[i] != "B" : ans.append(s[i])

b = "".join(ans)
print(b)
Problem: p04030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
string = str(input())

str_len = len(string)

out_string = ""

for num in range(str_len):

    if string[num] == "B":
        if len(out_string) != 0:
            out_string = out_string[:num-1]

    else:
        out_string += string[num]


print(out_string)

Failing test case input:
B/B1

Expected output:
1


Actual output:
/1


Fixed submission (verdict: Accepted):
string = str(input())

str_len = len(string)

out_string = ""

for num in range(str_len):

    if string[num] == "B":
        if len(out_string) != 0:
            out_string = out_string[:-1]

    else:

        out_string += string[num]


print(out_string)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
inst = input()
buf = []
for s in inst:
  if s == "B" and len(buf) != 0:
    buf.pop()
  else:
    buf.append(s)
print(buf)

Failing test case input:
1B.0

Expected output:
.0


Actual output:
., 0

Fixed submission (verdict: Accepted):
inst = input()
buf = []
for s in inst:
  if s == "B":
    if len(buf) != 0:
      del buf[-1]
  else:
    buf.append(s)
print("".join(buf))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=input()
ans=[]
for i in N:
    if i=='B' and not ans==[]:
        ans[-1]=''
    else:
        ans.append(i)
print(''.join(ans))

Failing test case input:
B/B1

Expected output:
1


Actual output:
B1


Fixed submission (verdict: Accepted):
N=input()
ans=[]
for i in N:
    if i=='B':
        if not ans==[]:
            ans.pop()
    else:
        ans.append(i)
print(''.join(ans))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=list(input())

ans=[]
for i in range(len(s)):
    if s[i]=='B' and len(ans)>0:
        ans.pop(-1)
    else:
        ans.append(s[i])
print(''.join(ans))

Failing test case input:
3BB0

Expected output:
0


Actual output:
B0


Fixed submission (verdict: Accepted):
s=list(input())

ans=[]
for i in range(len(s)):
    if s[i]=='B' and len(ans)>0:
        ans.pop(-1)
     
    elif s[i]!='B':
        ans.append(s[i])
print(''.join(ans))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=list(input())
res=[]
for i in s:
    if i=="b":
        res=res[:-1]
    else:
        res.append(i)
print("".join(res))

Failing test case input:
001B

Expected output:
00


Actual output:
001B


Fixed submission (verdict: Accepted):
s=list(input())
res=[]
for i in s:
    if i=="B":
        res=res[:-1]
    else:
        res.append(i)
print("".join(res))

Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def bs(s):
  if s == "":
    return s
  else:
    return s[:-1]

s = input()
ans = ""
for c in s:
  if c == "b":
    ans = bs(ans)
  else:
    ans += c
print(ans)
    
    




Failing test case input:
011B

Expected output:
01


Actual output:
011B


Fixed submission (verdict: Accepted):
def bs(s):
  if s == "":
    return s
  else:
    return s[:-1]
 
s = input()
ans = ""
for c in s:
  if c == "B":
    ans = bs(ans)
  else:
    ans += c
print(ans)
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

S = input()
ans = [''] * len(S)
cur = 0
for s in S:
    if s == 'B':
        ans[cur] = ''
        cur -= 1
    else:
        ans[cur] = s
        cur += 1

print("".join(ans))

Failing test case input:
011B

Expected output:
01


Actual output:
011


Fixed submission (verdict: Accepted):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

S = input()
ans = [''] * len(S)
cur = 0
for s in S:
    if s == 'B':
        cur -= 1
        ans[cur] = ''
        cur = max(0, cur)
    else:
        ans[cur] = s
        cur += 1

print("".join(ans))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
p = ''
for i in range(len(s)):
    if s[i] == 'B':
        if len(p) > 0:
            print(p[:-1])
            p = p[:-1]
    else:
        p += s[i]
print(p)

Failing test case input:
0@B0

Expected output:
00


Actual output:
0
00


Fixed submission (verdict: Accepted):
s = input()
p = ''
for i in range(len(s)):
    if s[i] == 'B':
        if 1 <= len(p):
            p = p[:-1]
    else:
        p += s[i]
print(p)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
nyu=input()
shutu=[]
for i in nyu:
	if i=="0" or "1":
		shutu.append(i)
	else:
		if len(shutu)!=0:
			shutu.pop(-1)
kekka="".join(shutu)
print(kekka)

Failing test case input:
0CB1

Expected output:
01


Actual output:
0CB1


Fixed submission (verdict: Accepted):
nyu=input()
shutu=[]
for i in nyu:
	if i=="B":
		if len(shutu)!=0:
			shutu.pop(-1)
	else:
		shutu.append(i)
kekka="".join(shutu)
print(kekka)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
ans = [""] * 10
index = 0
for ss in s:
    if ss != "B":
        ans[index] = ss
        index += 1
    else:
        index = max(0, index - 1)
        
print("".join(ans))


Failing test case input:
101B

Expected output:
10


Actual output:
101


Fixed submission (verdict: Accepted):
s = list(input())
ans = [""] * 10
index = 0
for ss in s:
    if ss != "B":
        ans[index] = ss
        index += 1
    else:
        ans[index] = ""
        index = max(0, index - 1)
        ans[index] = ""

print("".join(ans))