Problem: Fennec is fighting with N monsters.  The _health_ of the i-th monster is H_i.  Fennec can do the following two actions:    * Attack: Fennec chooses one monster. That monster's health will decrease by 1.   * Special Move: Fennec chooses one monster. That monster's health will become 0.  There is no way other than Attack and Special Move to decrease the monsters' health.  Fennec wins when all the monsters' healths become 0 or below.  Find the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most K times.

Submission attempts (in order):
#!/user/bin/env python


# -*- coding: utf-8 -*-


__author_ = 'Maruta Yuzuha'
__version_ = '1.0.0'
__date__ = '2019/12/25'

def main():
    
    s = list(map(int, input().split()))
    t = list(map(int, input().split()))

    a = 0  
    b = s[0]
    d = s[1]
    f = 0
    for j in range(d):  
        c = sum(t)
        if c != 0:
            g = max(t)
            for i in range(b):
                if g == t[i]:
                    t[i] = 0
            t[f] = 0
            f = 0
        else:
            break
    a += sum(t)
    print(a)
    return 0

if __name__ == '__main__':
    
    

    
    
    import doctest
    doctest.testmod()

    
    import sys
    sys.exit(main())

#!/user/bin/env python


# -*- coding: utf-8 -*-


__author_ = 'Maruta Yuzuha'
__version_ = '1.0.0'
__date__ = '2019/12/25'

def main():
    
    s = list(map(int, input().split()))
    t = list(map(int, input().split()))

    a = 0  
    b = s[0]
    d = s[1]
    f = 0
    for j in range(d):  
        c = sum(t)
        if c != 0:
            g = max(t)
            for i in range(b):
                if g == t[i]:
                    t[i] = 0
                    break
            t[f] = 0
            f = 0
        else:
            break
    a += sum(t)
    print(a)
    return 0

if __name__ == '__main__':
    
    

    
    
    import doctest
    doctest.testmod()

    
    import sys
    sys.exit(main())

#!/user/bin/env python


# -*- coding: utf-8 -*-


__author_ = 'Maruta Yuzuha'
__version_ = '1.0.0'
__date__ = '2019/12/25'

def main():
    
    s = list(map(int, input().split()))
    t = list(map(int, input().split()))

    a = 0  
    b = s[0]
    d = s[1]
    f = 0
    for j in range(d):  
        c = sum(t)
        if c != 0:
            g = max(t)
            for i in range(b):
                if g == t[i]:
                    t[i] = 0
            t[f] = 0
            f = 0
        else:
            break
    a += sum(t)
    print(a)
    return 0

if __name__ == '__main__':
    
    

    
    
    import doctest
    doctest.testmod()

    
    import sys
    sys.exit(main())

#!/user/bin/env python

# -*- coding: utf-8 -*-

def main():
    
    s = list(map(int, input().split()))
    t = list(map(int, input().split()))

    a = 0  
    b = s[0]
    d = s[1]
    f = 0
    for j in range(d):  
        c = sum(t)
        if c != 0:
            g = max(t)
            for i in range(b):
                if g == t[i]:
                    t[i] = 0
                    break
            t[f] = 0
            f = 0
        else:
            break
    a += sum(t)
    print(a)
    return 0

if __name__ == '__main__':

    
    import sys
    sys.exit(main())

#!/user/bin/env python


# -*- coding: utf-8 -*-

def main():
    
    s = list(map(int, input().split()))
    t = list(map(int, input().split()))
    t.sort(reverse=True)
    a = 0  
    b = s[0]
    d = s[1]
    f = 0
    c = sum(t)
    for i in range(d):
        if c != 0:
            c -= t[i]
            t[i] = 0
        else:
            break
    a += sum(t)
    print(a)
    return 0

if __name__ == '__main__':

    
    import sys
    sys.exit(main())

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted