Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def isValidNumOfBill(x, y, z, N):
    return x + y + z == N

def isValidSumOfMoney(x, y, z, Y):
    return 10000 * x + 5000 * y + 1000 * z == Y

def outputResult(x, y, z):
    print('{x:d} {y:d} {z:d}'.format(x=x, y=y, z=z))

def outputFailure():
    print('-1 -1 -1')

def searchA(N, Y):
    # define range
    xlim = range(0, Y // 10000 + 1)
    ylim = range(0, Y // 5000 + 1)
    zlim = range(0, Y // 1000 + 1)

    for x in xlim:
        for y in ylim:
            for z in zlim:
                # print(x, y, z)
                if not isValidNumOfBill(x, y, z, N):
                    continue
                if isValidSumOfMoney(x, y, z, Y):
                    return (x, y, z)

def searchB(N, Y):
    # 最初に金額を合わせる
    x = Y // 10000
    y = (Y - 10000 * x) // 5000
    z = (Y - 10000 * x - 5000 * y) // 1000

    while x >= 0:
        while y >= 0:
            y -= 1
            z += 5
        x -= 1
        y += 2


def main():
    # read 'N Y'
    args = input().split(" ")
    N = int(args[0])
    Y = int(args[1]) 

    # search for 10000x + 5000y + 1000z = Y
    result = searchA(N, Y)
    if result is not None:
        x, y, z = result
        outputResult(x, y, z)
    else:
        outputFailure()

if __name__ == '__main__':
    main()


Fixed submission:
def isValidNumOfBill(x, y, z, N):
    return x + y + z == N

def isValidSumOfMoney(x, y, z, Y):
    return 10000 * x + 5000 * y + 1000 * z == Y

def outputResult(x, y, z):
    print('{x:d} {y:d} {z:d}'.format(x=x, y=y, z=z))

def outputFailure():
    print('-1 -1 -1')

def searchA(N, Y):
    # define range
    xlim = range(0, Y // 10000 + 1)
    ylim = range(0, Y // 5000 + 1)
    zlim = range(0, Y // 1000 + 1)

    for x in xlim:
        for y in ylim:
            for z in zlim:
                # print(x, y, z)
                if not isValidNumOfBill(x, y, z, N):
                    continue
                if isValidSumOfMoney(x, y, z, Y):
                    return (x, y, z)

def searchB(N, Y):
    # 最初に金額を合わせる
    calcX = lambda Y: Y // 10000
    calcY = lambda x, Y: (Y - 10000 * x) // 5000
    calcZ = lambda x, y, Y: (Y - 10000 * x - 5000 * y) // 1000
    x = calcX(Y)
    y = calcY(x, Y)
    z = calcZ(x, y, Y)

    while x >= 0:
        while y >= 0:
            # print(x, y, z)
            if sum((x, y, z)) == N:
                return (x, y, z)
            y -= 1
            z = calcZ(x, y, Y)
        x -= 1
        y = calcY(x, Y)
        z = calcZ(x, y, Y)

def main():
    # read 'N Y'
    args = input().split(" ")
    N = int(args[0])
    Y = int(args[1]) 

    # search for 10000x + 5000y + 1000z = Y
    # result = searchA(N, Y)
    result = searchB(N, Y)
    if result is not None:
        x, y, z = result
        outputResult(x, y, z)
    else:
        outputFailure()

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

# 入力から変数を初期化
N, H = map(int, input().split())
a = []
b = []
for i in range(N):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)
ans = H

# 振る刀の最大値
amax = max(a)

# 投げる刀を降順でソートしておく
b.sort(reverse=True)

# 攻撃力の高い刀から順にk本投げ、残りの体力をamaxを使って削る
for k in range(N+1):
    damage_throw = 0 + sum(b[0:k])
    H_minus_throw = H - damage_throw
    if H_minus_throw <= 0:
        tmp_ans = k
    else:
        num_swing = -(-H_minus_throw // amax)
        tmp_ans = k + num_swing
    ans = min(tmp_ans, ans)

print(ans)


Fixed submission:
# -*- coding: utf-8 -*-

# 入力から変数を初期化
N, H = map(int, input().split())
a = []
b = []
for i in range(N):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)
ans = H

# 振る刀の最大値
amax = max(a)

# 投げる刀を降順でソートしておく
b.sort(reverse=True)

# 攻撃力の高い刀から順にk本投げ、残りの体力をamaxを使って削る
damage_throw = 0
for k in range(N+1):
    damage_throw += 0 if k == 0 else b[k-1]
    H_minus_throw = H - damage_throw
    if H_minus_throw <= 0:
        tmp_ans = k
    else:
        num_swing = -(-H_minus_throw // amax)
        tmp_ans = k + num_swing
    ans = min(tmp_ans, ans)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
ans=0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k==S:
                ans+=1
print(ans)

Fixed submission:
K,S=map(int,input().split())
ans=0
for i in range(K+1):
    for j in range(K+1):
        if S-i-j<=K and S-i-j>=0:
            ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
ans=0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k==S:
                ans+=1
print(ans)

Fixed submission:
K,S=map(int,input().split())
ans=0
for i in range(K+1):
    for j in range(K+1):
        if S-i-j<=K and S-i-j>=0:
            ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
numOfStation = int(input())
array = [0] * (numOfStation -1)

for i in range(numOfStation -1):
    array[i] = input().split()

for i in range(numOfStation - 1):
    time = 0
    for j in range(i, numOfStation - 1):
        nextTrain = int(array[j][1])
        #check the next train
        while time > nextTrain:
            #Additional time to catch the next one
            nextTrain += int(array[j][2])

        time += (nextTrain-time) + int(array[j][0]) #Time arrived at the next station

    print(time)

print(0)

Fixed submission:
import math
numOfStation = int(input())
array = [0] * (numOfStation - 1)

for i in range(numOfStation - 1):
    array[i] = input().split()

for i in range(numOfStation - 1):
    time = 0
    for j in range(i, numOfStation - 1):
        nextTrain = int(array[j][1])
        # check the next train
        if time > nextTrain:
            # Additional time to catch the next one
            nextTrain += math.ceil((time - nextTrain)/int(array[j][2]))*int(array[j][2])

        time += (nextTrain - time) + int(array[j][0])  # Time arrived at the next station

    print(time)

print(0)
Buggy python submission (verdict: Runtime Error):
s = list(input())
s.sort()

t = list(input())
t.sort(reverse=True)

if s == t:
    print('No')
else:
    j = 0
    for i in s:
        if i < t[j]:
            print('Yes')
            break

        if i > t[j]:
            print('No')
            break
        j += 1



Fixed submission:
s = list(input())
s.sort()

t = list(input())
t.sort(reverse=True)

if s < t:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
 a, b = input().split()


if a > b:
    print('>')
elif a < b:
    print('<')
else: print('=')

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

if a > b:
    print('>')
elif a < b:
    print('<')
else:
    print('=')
Buggy python submission (verdict: Runtime Error):
# using sort

n = int(input())
count = 0
a = [[0 for i in range(n)] for i in range(3)]

for i in range(3):
    a[i] = [int(x) for x in input().split()]
    a[i].sort()

# Brute force
for i in a[0]:
    for j in a[1]:
        if i < j:
            index = 0
            for k in a[2]:
                if j < k:
                    count += n - index
                    break
                else:
                    index += 1

print(count)

Fixed submission:
a = [0,0]
temp = [0,0]

for k in range(2):
    temp[k] = input()
    a[1-k] = temp[k][::-1]

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

Buggy python submission (verdict: Runtime Error):
# using sort

n = int(input())
count = 0
a = [[0 for i in range(n)] for i in range(3)]

for i in range(3):
    a[i] = [int(x) for x in input().split()]
    a[i].sort()

# Brute force

index = 0

for i in a[0]:
    for j in a[1]:
        if i < j:
            for k in a[2]:
                if j < k:
                    count += n - index
                    break
                else:
                    index += 1

print(count)

Fixed submission:
a = [0,0]
temp = [0,0]

for k in range(2):
    temp[k] = input()
    a[1-k] = temp[k][::-1]

if (temp[0] == a[0]) and (temp[1] == a[1]):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
n = input()
print(input[:4] + "8" + [5:])

Fixed submission:
str = input()
print(str[:3] + "8" + str[4:])

Buggy python submission (verdict: Runtime Error):
n = input()
print n[0:4]

Fixed submission:
str = input()
print(str[:3] + "8" + str[4:])

Buggy python submission (verdict: Runtime Error):

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

y = y // 1000
print(n, y)


def find_by_for(v, n):
    """
        the tuple by example
        ((0, 0, 0), (10, 5, 1), 100, 10)
    """
    queue = []
    queue.append(((0, 0, 0), (1, 5, 10), v, n))
    while queue:
        xs, fv, v, n = queue.pop()
        if v == 0 and n == 0:
            return "%d %d %d"%(xs[2], xs[1], xs[0])
        elif not fv or v <= 0 or n <= 0:
            pass
        else:
            queue.append((xs, fv[:-1], v, n))
            z = list(xs) 
            idx = len(fv) -1
            z[idx] +=1
            queue.append((tuple(z), fv, v - fv[idx], n -1))
    return "-1 -1 -1"

print(find_by_for(y, n))
    


Fixed submission:


import re 

print(re.sub("2017/01", "2018/01", input()))

Buggy python submission (verdict: Runtime Error):

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

y = y // 1000
print(n, y)


def find_by_for(v, n):
    """
        the tuple by example
        ((0, 0, 0), (10, 5, 1), 100, 10)
    """
    queue = []
    queue.append(((0, 0, 0), (1, 5, 10), v, n))
    while queue:
        xs, fv, v, n = queue.pop()
        if v == 0 and n == 0:
            return "%d %d %d\n"%(xs[2], xs[1], xs[0])
        elif not fv or v <= 0 or n <= 0:
            pass
        else:
            queue.append((xs, fv[:-1], v, n))
            z = list(xs) 
            idx = len(fv) -1
            z[idx] +=1
            queue.append((tuple(z), fv, v - fv[idx], n -1))
    return "-1 -1 -1\n"

print(find_by_for(y, n))
    


Fixed submission:


import re 

print(re.sub("2017/01", "2018/01", input()))
Buggy python submission (verdict: Time Limit Exceeded):

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

y = y // 1000

def find_by_for(v, n):
    """
        the tuple by example
        ((0, 0, 0), (10, 5, 1), 100, 10)
    """
    queue = []
    queue.append(((0, 0, 0), (1, 5, 10), v, n))
    while queue:
        xs, fv, v, n = queue.pop()
        if v == 0 and n == 0:
            return "%d %d %d"%(xs[2], xs[1], xs[0])
        elif not fv or v <= 0 or n <= 0:
            pass
        else:
            queue.append((xs, fv[:-1], v, n))
            z = list(xs) 
            idx = len(fv) -1
            z[idx] +=1
            queue.append((tuple(z), fv, v - fv[idx], n -1))
    return "-1 -1 -1"

print(find_by_for(y, n))
    


Fixed submission:
def find_min(v):
    x = v % 10
    return (x % 5, x//5, v // 10)

def find_max(v):
    return (v, 0, 0)


def conv10to5(xs):
    return (xs[0], xs[1] +2, xs[2] - 1)

def undoconv10to5(xs):
    return (xs[0], xs[1] -2, xs[2] + 1)


def conv5to1(xs):
    return (xs[0]+5, xs[1] -1, xs[2])


def next(xs):
    if xs[2] == 0:
        if xs[1] == 0:
            return None
        else:
            return conv5to1(xs)
    else:
        if xs[1] < 7:
            return conv10to5(xs)
        else:
            return conv5to1(undoconv10to5(undoconv10to5(undoconv10to5(xs))))


def find(v, n):
    xs = find_min(v)
    m = sum(xs)
    if m > n or n > v:
        return (-1, -1, -1)

    while xs:
        if sum(xs) == n:
            return xs
        xs = next(xs)
    return (-1, -1, -1)



if __name__ == "__main__":
    n, y = map(int, input().split())
    y = y // 1000
    print("{2} {1} {0}".format(*find(y, n)))
Buggy python submission (verdict: Runtime Error):
def getter(starts, ends):
    while starts:
        if starts[-1][0] < ends[-1][1]:
            yield (starts.pop(), True)
        else:
            yield (ends.pop(), False)


def foo(targets):
    starts = sorted(targets, key=lambda x:x[0], reverse=True)
    ends = sorted(targets, key=lambda x: x[1], reverse=True)

    result = 0
    active = set()
    for x, p in getter(starts, ends):
        if p:
            active.add(x[2])
        else:
            active.remove(x[2])
        result = max(result, len(active))
    return result


if __name__ == "__main__":
    n,c  = map(int, input().split())

    targets = []
    for i in range(n):
        s, t, c = list(map(int, input().split()))
        targets.append((s-1, t, c))
    print(foo(targets))



Fixed submission:
def getter(starts, ends):
    while starts:
        if starts[-1][0] < ends[-1][1]:
            yield (starts.pop(), True)
        else:
            yield (ends.pop(), False)


def foo(C, targets):
    starts = sorted(targets, key=lambda x:x[0], reverse=True)
    ends = sorted(targets, key=lambda x: x[1], reverse=True)

    result = 0
    active = [0]*(C+1)
    for x, p in getter(starts, ends):
        if p:
            active[x[2]] += 1
        else:
            active[x[2]] -= 1
        result = max(result, sum(map(lambda x: 1 if x > 0 else 0 ,active)))
    return result


if __name__ == "__main__":
    n, C  = map(int, input().split())

    targets = []
    for i in range(n):
        s, t, c = list(map(int, input().split()))
        targets.append((s-1, t, c))
    print(foo(C, targets))

Buggy python submission (verdict: Time Limit Exceeded):

if __name__ == "__main__":
    n,c  = map(int, input().split())

    timeline = {}
    for i in range(n):
        s, t, c = list(map(int, input().split()))
        for i in range(s-1, t):
            xs = timeline.get(i, None)
            if xs is None:
                xs = set()
            xs.add(c)
            timeline[i] = xs
    print(max([len(v) for k, v in timeline.items()]))


Fixed submission:
def getter(starts, ends):
    while starts:
        if starts[-1][0] < ends[-1][1]:
            yield (starts.pop(), True)
        else:
            yield (ends.pop(), False)


def foo(C, targets):
    starts = sorted(targets, key=lambda x:x[0], reverse=True)
    ends = sorted(targets, key=lambda x: x[1], reverse=True)

    result = 0
    active = [0]*(C+1)
    for x, p in getter(starts, ends):
        if p:
            active[x[2]] += 1
        else:
            active[x[2]] -= 1
        result = max(result, sum(map(lambda x: 1 if x > 0 else 0 ,active)))
    return result


if __name__ == "__main__":
    n, C  = map(int, input().split())

    targets = []
    for i in range(n):
        s, t, c = list(map(int, input().split()))
        targets.append((s-1, t, c))
    print(foo(C, targets))
Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())

xs = sorted(map(int, input().split()))
ys = sorted(map(int, input().split()))
zs = sorted(map(int, input().split()))

bs = [0] * n
for i in range(n):
    for j in range(n):
        if xs[j] < ys[i]:
            bs[i] += 1
        else:
            break

cs = [0] * n
for i in range(n):
    for j in range(n):
        if ys[j] < zs[i]:
            cs[i] += bs[j]
        else:
            break

print(sum(cs))


Fixed submission:

n = int(input())

xs = sorted(map(int, input().split()))
ys = sorted(map(int, input().split()))
zs = sorted(map(int, input().split()))

bs = [0] * n
j = 0
for i in range(n):
    while j < n and xs[j] < ys[i]:
        j += 1
    bs[i] = j

cs = [0] * n
j = 0
k = 0
for i in range(n):
    while j < n and ys[j] < zs[i]:
        k += bs[j]
        j += 1
    cs[i] = k

print(sum(cs))

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())

xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
zs = list(map(int, input().split()))

bs = [0] * n
for i in range(n):
    bs[i] = sum(map(lambda x:  1 if x < ys[i] else 0,  xs))


cs = [0] * n
for i in range(n):
    cs[i] = sum(map(lambda y:  bs[y[0]]  if y[1] < zs[i] else 0,  enumerate(ys)))

print(sum(cs))


Fixed submission:

n = int(input())

xs = sorted(map(int, input().split()))
ys = sorted(map(int, input().split()))
zs = sorted(map(int, input().split()))

bs = [0] * n
j = 0
for i in range(n):
    while j < n and xs[j] < ys[i]:
        j += 1
    bs[i] = j

cs = [0] * n
j = 0
k = 0
for i in range(n):
    while j < n and ys[j] < zs[i]:
        k += bs[j]
        j += 1
    cs[i] = k

print(sum(cs))
Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))

xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

MODULO = 10**9 +7

def MSum(x, y):
    return (x + y) % MODULO

def MPro(x, y):
    return (x * y) % MODULO

def foo(zs, k):
    s = 0
    for i in range(k):
       s = MSum(s, MPro(MPro(zs[i], k-i), i+1))
    return s

def diff(zs, k):
    previous = None
    rs = [0] * (k-1)
    for i, z in enumerate(zs):
        if i == 0:
            previous = z
            continue
        rs[i-1] = z - previous
        previous = z
    return rs

dx = diff(xs, n)
dy = diff(ys, n)

print(MPro(foo(dx, n-1), foo(dy, m-1)))



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

xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

MODULO = 10**9 +7

def MSum(x, y):
    return (x + y) % MODULO

def MPro(x, y):
    return (x * y) % MODULO

def foo(zs, k):
    s = 0
    for i in range(k):
       s = MSum(s, MPro(MPro(zs[i], k-i), i+1))
    return s

def diff(zs, k):
    previous = None
    rs = [0] * (k-1)
    for i, z in enumerate(zs):
        if i == 0:
            previous = z
            continue
        rs[i-1] = z - previous
        previous = z
    return rs

dx = diff(xs, n)
dy = diff(ys, m)

print(MPro(foo(dx, n-1), foo(dy, m-1)))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N, Y = map(int, input().split())

a = 0
for x in range(N+1): 
    for y in range(N-x+1):
        if (10000*x + 5000*y + 1000*(N-x-y)) == Y:
            print(str(x)+" "+str(y)+" "+str(N-x-y))
            a = 1
            break
        if a == 1:
            break
    if a == 1:
        break

if a != 1:
    print("-1 -1 -1")

Fixed submission:
a = input()
b = a.split("/")
b[0] = "2018"

c = ""
c = "/".join(b)
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
C = []
S = []
F = []
for i in range(N-1):
    x, y, z = map(int, input().split(" "))
    C.append(x)
    S.append(y)
    F.append(z)

ans = []
for j in range(N-1):
    temp = S[j]+C[j]
    temp2 = 0
    k = j
    while k < (N-1-1):
        if temp < S[k+1]:
            temp = S[k+1]
        else:
            temp2 = S[k+1]
            while temp2 < temp:
                temp2 += F[k+1]
            temp = temp2
        temp += C[k+1]
        k += 1
    ans.append(temp)

for l in range(N-1):
    print(ans[l])
    
print("0")

Fixed submission:
N = int(input())
C = []
S = []
F = []
for i in range(N-1):
    x, y, z = map(int, input().split(" "))
    C.append(x)
    S.append(y)
    F.append(z)

for j in range(N-1):
    ans = 0
    for k in range(j, N-1):
        if ans < S[k]:
            ans = S[k]
        if ans%F[k] != 0:
            ans += F[k]-ans%F[k]
        ans += C[k]
    print(ans)
print(0)
Buggy python submission (verdict: Runtime Error):
S = int(input())

S_re = S.replace('2017', '2018')

print(S_re)

Fixed submission:
S = input()

print(S.replace('2017', '2018'))

Buggy python submission (verdict: Runtime Error):
count=0
N=int(input())
d=[]
d=[int(input()) for i in range(N)]
for k in range (N-1):
    for j in range(k+1,N-1):
         dd1=d[k]
         dd2=d[j]
         if dd1==dd2 :break
    else:count+=1
print(count)

Fixed submission:
S=input().split("/")
print("2018/"+S[1]+"/"+S[2])

Buggy python submission (verdict: Runtime Error):
count=0
N=int(input())
d=[]
d=[int(input()) for i in range(N)]
for k in range (N-1):
    for j in range(k+1,N-1):
         dd1=d[k]
         dd2=d[j]
         if dd1==dd2 :break
    else:count+=1
print(count)

Fixed submission:
S=input().split("/")
print("2018/"+S[1]+"/"+S[2])

Buggy python submission (verdict: Runtime Error):
count=0
N=input()
d=[]
d=[int(input()) for i in range(int(N))]
for k in range (int(N)-1):
    dd1=d[k]
    dd2=d[k+1]
    if not dd1==dd2 :count+=1
print(count+1)

Fixed submission:
S=input().split("/")
print("2018/"+S[1]+"/"+S[2])
Buggy python submission (verdict: Runtime Error):
import numpy as np
import pdb

'''
From first element, look through the sequence
until you encounter first element that is smaller than
its predecessor.

Take the difference, and find the minimum number that can
one can add to make the sequence appropriate.

I was shooting for
O(N**2), nut no, not with this.

This probably works only if all elements are positive...


There is much easier way to go.
One can make everything positive by adding max to all
the numbers,
and accumulate the entries.

However, why is this minimal...?  Well, there is no gurantee.
The problem is asking for 'one' solution with number of steps being less than
or equal to 2N. Oh No....
'''


def main():
    N = int(raw_input())
    As = np.array(raw_input().split(' ')).astype(int)
    procedure = process2(As)
    #As = test(As, procedure)
    printprocedure(procedure)


def process2(As):
    oldmaxAs = np.max(As)
    oldminAs = np.min(As)
    procedure = []


    #Uniformization
    if oldmaxAs > 0 and oldminAs < 0:
        if np.abs(oldmaxAs) < np.abs(oldminAs):
            helper = np.where(As == oldminAs)[0][0]
            for k in range(len(As)):
                procedure += [[helper, k]]
            maxAs = oldmaxAs + oldminAs
            minAs = oldminAs + oldminAs
        else:
            helper =  np.where(As == oldmaxAs)[0][0]
            for k in range(len(As)):
                procedure += [[helper, k]]
            maxAs = oldmaxAs + oldmaxAs
            minAs = oldminAs + oldmaxAs
    else:
        maxAs = oldmaxAs
        minAs = oldminAs

    pdb.set_trace()
    #After uniformization
    #negative mode
    if maxAs < 0:
        for k in range(0, len(As) - 1):
            procedure += [[len(As)-1-k, len(As)-1-k-1]]

    #positive mode
    if minAs >= 0:
        for k in range(1, len(As)):
            procedure += [[k-1, k]]

    return procedure


def test(As, procedure):
    for k in range(len(procedure)):
        As[procedure[k][1]] += As[procedure[k][0]]
    return As


def process(As):
    procedure = []
    for k in range(1, len(As)):
        delta = As[k] - As[k - 1]
        while(delta < 0):
            problematic = k
            require = -delta
            candidate = 0
            candidatevalue = -np.inf
            missing = require - As

            if np.min(missing) > 0:
                candidate = np.where(missing == np.min(missing))[0][0]
            else:
                for i in range(len(As)):
                    if missing[i] <= 0 and candidatevalue < missing[i]:
                        candidate = i
                        candidatevalue = missing[candidate]

            procedure += [[candidate, k]]
            As[k] = As[k] + As[candidate]
            delta = As[k] - As[k - 1]

    return procedure


def printprocedure(procedure):
    for k in range(len(procedure)):
        print '%s %s'%(procedure[k][0] +1 ,procedure[k][1] + 1)





if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np
import pdb

def main():
    string = np.array(list(raw_input()))
    num1 = len(np.where(string == '1')[0])
    print num1

if __name__ == '__main__':
    main()