No Idea!

Sort by

recency

|

1530 Discussions

|

  • + 0 comments

    Python 3

    n,m = tuple(map(int, input().split(" ")))
    n_arr = list(map(int, input().split(" ")))
    m_a_arr = set(map(int, input().split(" ")))
    m_b_arr = set(map(int, input().split(" ")))
    
    happyness = 0
    for i in n_arr:
        happyness+= (i in m_a_arr) - (i in m_b_arr)
    
    print(happyness)
    
  • + 1 comment

    I am not sure why it is in medium level.. I realised it after I got 50 points: I solved it very easily(unsure if i did it correctly as I am new)

    Here is my solution:

    arr=list(map(int, input().split()))
    arr=arr[:n]
    a=set(map(int, input().split()))
    b=set(map(int, input().split()))
    h=0
    for i in arr:
        if(i in a):
            h+=1
        elif(i in b):
            h-=1
    print(h)
        
    

    `

  • + 0 comments

    Enter your code here. Read input from STDIN. Print output to STDOUT

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

    arr = list(map(int, input().split())) a = set(map(int, input().split())) b = set(map(int, input().split())) hap=0 for i in arr : if i in a and i in b: pass elif i not in a and i not in b: pass elif( i in a and i not in b ): hap+=1 else: hap-=1 print (hap)

  • + 0 comments

    For future reference: Do not cast the full main list of objects as a set. Using a list is necessary to maintain the integrity of the count, including duplicates.

    n, l = input(), list(map(int, input().split()))
    a, b = set(map(int, input().split())), set(map(int, input().split()))
    print(len([x for x in l if x in a]) - len([x for x in l if x in b]))
    
  • + 0 comments
    if __name__ == "__main__":
        n = int(input())
        print(len({input().strip() for i in range(n)}))