Problem p03779 (python)

Fixed submission:
if __name__ == '__main__':
    x = abs(int(input()))

    s = 0
    for i in range(0,10 ** 9):
        if s > x: 
            print(i - 1)
            break
        elif s == x:
            print(i - 1)
            break
        s += i

Buggy submission (verdict: Runtime Error):
y = [] 
x = 0

def slv(h, i):
    if x == h or i >= x:
        if x == h:
            y.append(i - 1)
        return
    slv(h+i, i+1)  # jump
    slv(h, i+1)  # stay

if __name__ == '__main__':
    x = abs(int(input()))
    slv(0, 0)

    if len(y) == 0:
        print(2)
    else:
        print(min(y))

Buggy submission (verdict: Runtime Error):
y = []

def slv(x,h,i):
    if x == h or i >= x:
        if x == h:
            y.append(i)
        return
    slv(x,h+i,i+1) # jump
    slv(x,h,i+1) # stay

if __name__ == '__main__':
    x = int(input())
    slv(abs(x),0,0)

    if len(y) == 0:
        print(2)
    else:
        print(min(y) - 1)

Buggy submission (verdict: Runtime Error):
y = []                                                                                                                  
                                                                                                                        
def slv(x,h,i):                                                                                                         
    if x == h or i >= x:                                                                                                
        if x == h:                                                                                                      
            y.append(i)                                                                                                 
        return                                                                                                          
    slv(x,h+i,i+1) # jump                                                                                               
    slv(x,h,i+1) # stay                                                                                                 
                                                                                                                        
if __name__ == '__main__':                                                                                              
    x = int(input())                                                                                                    
    slv(abs(x),0,0)                                                                                                     
                                                                                                                        
    print(y)                                                                                                            
                                                                                                                        
    if len(y) == 0:                                                                                                     
        print(2)                                                                                                        
    else:                                                                                                               
        print(min(y) - 1)