# The Food Inspector

Easy
0/40
Average time to solve is 20m
Contributed by
1 upvote

## Problem statement

Malay is the food inspector of the Surat district. There are two main shops in the district of Surat namely shop ‘A’ and shop ‘B’, having ‘N’ and ‘M’ number of food products denoted by array ‘ARR1’ and ‘ARR2’ respectively. He has been assigned the task to find the number of edible products with the same name but have different prices in those two main shops of the district based on which he can decide the inflation rate of food products in Surat.

But because there is another big food industry inspection, he doesn’t have time to manually check the prices of every product in both shops, so being his friend he asked you to help him find the count of products with the same name but different prices in both shops.

EXAMPLE :
``````Input: ‘N’ = 2, ‘M' = 2, ‘ARR1’ = [{“bread”, 10}, {“rice”, 20}], ‘ARR2’ = [{“milk”, 25}, {“rice”, 20}]

Output: 0
In this case, here the only same product in both shops is “rice” and the price is the same in both shops (i.e. 20). Thus there is no product with the same name but at different prices.
``````
Detailed explanation ( Input/output format, Notes, Images )
Constraints :
``````1 <= ‘T’ <= 10
1 <= ‘N’ <= 10^4
1 <= ‘M’ <= 10^4
It is guaranteed that ‘foodItem’ consists of only lower-case English letters.
It is guaranteed that the length of ‘foodItem’ is less than ‘10’.
It is guaranteed that the name (i.e. ‘foodItem’) of every product in a single shop is distinct.
0 <= ‘P’ <= 10^9
It is guaranteed that sum of the lengths of ‘foodItem’ is <= 10^5.
It is guaranteed that sum of ‘N’ over all test cases is <= 10^4
It is guaranteed that sum of ‘M’ over all test cases is <= 10^4
Time Limit: 1 sec
``````
##### Sample Input 1 :
``````2
3 2
wheat 10
potato 20
tomato 17
wheat 15
tomato 17
1 1
onion 1
onion 80000
``````
##### Sample Output 1 :
``````1
1
``````
##### Explanation Of Sample Input 1 :
``````For the first test case, “wheat” has a price of ‘10’ in shop ‘A’ and ‘15’ in shop ‘B’, other products have the same price.

Hence, the output will be: 1

For the second test case, “onion” has a price of ‘1’ in shop ‘A’ and ‘80000’ in shop ‘B’.

Hence, the output will be: 1
``````
##### Sample Input 2 :
``````2
5 3
abcd 3
zyxw 7
corn 13
coffee 49
tea 69
dcba 8
wxyz 4
chilli 10
2 2
milk 30
chocolate 5
milk 30
chocolate 5
``````
##### Sample Output 2 :
``````0
0
``````
Console