study/BOJ
import sys 
input=sys.stdin.readline
n = int(input())
li = []

for _ in range(n):
    cmd = input().strip()
    
    if ' ' in cmd:
        cmd, num = cmd.split()
        num = int(num)
    
    if cmd == 'push':
        li.append(num)
    elif cmd == 'pop':
        if not li:
            print(-1)
        else:
            print(li.pop())
    elif cmd == 'size':
        print(len(li))
    elif cmd == 'empty':
        if not li:
            print(1)
        else:
            print(0)
    elif cmd == 'top':
        if not li:
            print(-1)
        else:
            print(li[-1])

뭔가 노가다해서 푼 기분이다..

count=0
while True:
    o, w = map(int, input().split())
    count+=1
    if o == 0:
        break
    
    pet_dead = False 
    
    while True:
        a, b = input().split()
        b = int(b)
        
        if a == '#':
            break
        elif a == 'F':
            if not pet_dead:  
                w += b
        elif a == 'E':
            if not pet_dead: 
                w -= b

        if w <= 0:
            pet_dead = True

    if pet_dead:
        print(count,'RIP')
    elif o / 2 < w < 2 * o:
        print(count,':-)')
    else:
        print(count,':-(')


        
귀엽고 쉬운 문제다.
쉬운거같은데 계속 틀려서 개짱났는데 천재 친구가 바로 오답을 찾아줬따.
그것은 바로  펫이 죽었을떄 더이상 입력을 받지않고 브레이크를 해버렸기때문이였다.
그리고 count도 빼먹었다.아오
근데 이걸 대여섯줄로 숏코딩한사람들이있음..
나도 언젠간 그렇게 될수잇을까?