Constraints


Input Format
The first line contains integers  and  separated by a space.
The second line contains  integers, the elements of the array.
The third and fourth lines contain  integers,  and , respectively.
Output Format
Output a single integer, your total happiness.

Hackerrank no idea problem solution in python programming language

Problem solution in Python 3 programming language.

# Enter your code here. Read input from STDIN. Print output to STDOUT
n, m = input().split()
sc_ar = input().split()
A = set(input().split())
B = set(input().split())
print(sum([(i in A) - (i in B) for i in sc_ar]))

Problem solution in Python 2 programming language.

# Enter your code here. Read input from STDIN. Print output to STDOUT
n, m = raw_input().split()
sc_ar = raw_input().split()
A = set(raw_input().split())
B = set(raw_input().split())
print sum([(i in A) - (i in B) for i in sc_ar])