No Idea!

Sort by

recency

|

1477 Discussions

|

  • + 0 comments

    Simple Python Solution (using counter):

    from collections import Counter
    n, m = map(int, input().split())
    arr = list(map(int, input().split()))
    A = list(set(map(int, input().split())))
    B = list(set(map(int, input().split())))
    
    counter = Counter(arr)
    ans = sum(counter[i] for i in A if i in counter) - sum(counter[i] for i in B if i in counter)
    print(ans)
    
  • + 0 comments

    n,m =map(int,input().split()) my_array =map(int,input().split()) my_a=set(map(int,input().split())) my_b=set(map(int,input().split()))

    def happiness_1(n,m,my_array,my_a,my_b): happiness=0 for num in my_array: if num in my_a: happiness += 1 elif num in my_b: happiness -= 1 return happiness

    print(happiness_1(n,m,my_array,my_a,my_b))

  • + 0 comments

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

    Read a single line of input for n and m

    nm = input() # Example input: "3 2"

    Split the input line into parts and convert each to an integer

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

    array = list(map(int, input().split()))

    2sets: A: set, B:set each containing m integers

    A = set(map(int, input().split())) B = set(map(int, input().split()))

    happiness = 0

    for i in array: if i in A: happiness+=1 elif i in B: happiness -=1 else: happiness +=0 print(happiness)

  • + 0 comments

    if name == 'main': sizeArray, sizesAB = input().split() my_array = input().split() setA= set(input().split()) setB = set(input().split()) print(len([char for char in my_array if char in setA])-len([char for char in my_array if char in setB]))

  • + 0 comments
    f_line = input().split()
    n = f_line[0]
    m = f_line[1]
    integers = input().split()
    A = set(input().split())
    B = set(input().split())
    
    h = 0
    for i in integers:
        if i in A:
            h += 1
        elif i in B:
            h -= 1
    print(h)