Please Login in order to post a comment
n,m=input().split()
arr=list(map(int, input().split()))
a1=list(map(int, input().split()))
a=set(a1)
b1=list(map(int, input().split()))
b=set(b1)
happiness=0
for i in range(int(n)):
if arr[i] in a: happiness=happiness+1
if arr[i] in b: happiness=happiness-1
print(happiness)
why is everyone converting input to integer when string will also do the same
input() a = input().split() h = set(input().split()) s = set(input().split()) print(sum(1 if x in h else -1 if x in s else 0 for x in a))
n, m = map(int, input().split()) array = list(map(int, input().split())) A = set(map(int, input().split())) B = set(map(int, input().split()))
happiness = 0 for num in array: if num in A: happiness += 1 elif num in B: happiness -= 1
input() nums = {} for num in input().split(): nums[num] = nums.get(num, 0) + 1 current_mood = 0 for n in input().split(): current_mood += nums.get(n, 0) for n in input().split(): current_mood -= nums.get(n, 0) print(current_mood)
Seems like cookies are disabled on this browser, please enable them to open this website
n,m=input().split()
arr=list(map(int, input().split()))
a1=list(map(int, input().split()))
a=set(a1)
b1=list(map(int, input().split()))
b=set(b1)
happiness=0
for i in range(int(n)):
for i in range(int(n)):
print(happiness)
why is everyone converting input to integer when string will also do the same
n, m = map(int, input().split())
array = list(map(int, input().split()))
A = set(map(int, input().split()))
B = set(map(int, input().split()))
happiness = 0 for num in array: if num in A:
happiness += 1 elif num in B:
happiness -= 1
print(happiness)