No Idea!

  • + 4 comments

    this is basically the same solution I came up with but still getting an error(p.s I know I could be more efficient)

    ch = list(map(int, input().split()))
    
    arr = list(map(int, input().split()))
    
    A = set(map(int, input().split()))
    B = set(map(int, input().split()))
    
    happiness = 0
    
    
    for i in arr:
        count = 0
        if i in A:
            count +=1
            happiness = happiness + count
    
        elif i in B:
            count -=1
            happiness = happiness + count
    
        else:
            count=0
    return (happiness)