Problem:


Score : 200 points

Problem Statement

Takahashi has N blue cards and M red cards.
A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i.

Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will earn 1 yen (the currency of Japan); each time he finds a red card with that string, he will lose 1 yen.

Here, we only consider the case where the string announced by Takahashi and the string on the card are exactly the same. For example, if he announces atcoder, he will not earn money even if there are blue cards with atcoderr, atcode, btcoder, and so on. (On the other hand, he will not lose money even if there are red cards with such strings, either.)

At most how much can he earn on balance?

Note that the same string may be written on multiple cards.

Constraints

N and M are integers.

1 \leq N, M \leq 100

s_1, s_2, ..., s_N, t_1, t_2, ..., t_M are all strings of lengths between 1 and 10 (inclusive) consisting of lowercase English letters.

Input

Input is given from Standard Input in the following format:

N
s_1
s_2
:
s_N
M
t_1
t_2
:
t_M

Output

If Takahashi can earn at most X yen on balance, print X.

Sample Input 1

3
apple
orange
apple
1
grape

Sample Output 1

2

He can earn 2 yen by announcing apple.

Sample Input 2

3
apple
orange
apple
5
apple
apple
apple
apple
apple

Sample Output 2

1

If he announces apple, he will lose 3 yen. If he announces orange, he can earn 1 yen.

Sample Input 3

1
voldemort
10
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort

Sample Output 3

0

If he announces voldemort, he will lose 9 yen. If he announces orange, for example, he can avoid losing a yen.

Sample Input 4

6
red
red
blue
yellow
yellow
red
5
red
red
yellow
green
blue

Sample Output 4

1



Sample input:
3
apple
orange
apple
1
grape


Sample output:
2

Submission status: Wrong Answer

Solution code:
n = int(input())

arr1 = [input() for _ in range(n)]

m = int(input())

arr2 = [input() for _ in range(m)]
# print(arr1, arr2)

for i, j in zip(arr1, arr2):
    try:
        arr1.remove(j)
    except:
        pass
# print(arr1, arr2)

d = {}
for i in set(arr1):
    d[i] = arr1.count(i)
try:
    print(max(d.items(), key=lambda x:x[1])[0])
except:
    print("0")

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
plus = Counter([input() for _ in range(N)])
M = int(input())
minus = Counter([input() for _ in range(M)])

ans = 1
for k, v in dict(plus).items():
    if minus[k]:
        ans = max(ans, v - minus[k])
    else:
        ans = max(ans, v)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
s = []
for _ in range(N):
    s.append(input())
M = int(input())
t = []
for _ in range(M):
    t.append(input())
set_s = list(set(s))
max_yen = -9999
for x in range(len(set_s)):
    yen = s.count(set_s[x]) - t.count(set_s[x])
    if yen > max_yen:
        max_yen = yen
print(max_yen)

Submission status: Wrong Answer

Solution code:
from collections import Counter

arr_b = []
N = int(input())
for i in range(N):
    arr_b.append(str(input()))
arr_r = []
N = int(input())
for i in range(N):
    arr_r.append(str(input()))

c_b = Counter(arr_b)
c_r = Counter(arr_r)

res = 0

for k_b in c_b.keys():
    if k_b in c_r :
        if res < c_b[k_b] - c_r[k_b]:
            res = c_b[k_b] - c_r[k_b]
        else:
            if res < c_b[k_b]:
                res = c_b[k_b]

print(res)

Submission status: Wrong Answer

Solution code:
from collections import Counter

arr_b = []
N = int(input())
for i in range(N):
    arr_b.append(str(input()))
arr_r = []
N = int(input())
for i in range(N):
    arr_r.append(str(input()))

c_b = Counter(arr_b)
c_r = Counter(arr_r)

res = 0
print(c_b)
print(c_r)

for k_b in c_b.keys():
    if k_b in c_r :
        if res < c_b[k_b] - c_r[k_b]:
            res = c_b[k_b] - c_r[k_b]
        else:
            if res < c_b[k_b]:
                res = c_b[k_b]

print(res)

Submission status: Wrong Answer

Solution code:
from collections import Counter

arr_b = []
N = int(input())
for i in range(N):
    arr_b.append(str(input()))
arr_r = []
N = int(input())
for i in range(N):
    arr_r.append(str(input()))

c_b = Counter(arr_b)
c_r = Counter(arr_r)

res = 0
for k_b in c_b.keys():
    if k_b in c_r:
        if res < c_b[k_b] - c_r[k_b]:
            res = c_b[k_b] - c_r[k_b]

print(res)

Submission status: Wrong Answer

Solution code:
from collections import Counter

arr_b = []
N = int(input())
for i in range(N):
    arr_b.append(str(input()))
arr_r = []
N = int(input())
for i in range(N):
    arr_r.append(str(input()))

c_b = Counter(arr_b)
c_r = Counter(arr_r)
result = max(c_b[x] for x in c_b) - max(c_r[x] for x in c_r)
if result > 0:
    print(result)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())
dict_s = {}
for var in range(N):
    s = input()
    if s in dict_s:
        dict_s[s] = dict_s[s] + 1
    else:
        dict_s[s] = 1

M = int(input())
dict_t = {}
for var in range(M):
    t = input()
    if t in dict_t:
        dict_t[t] = dict_t[t] + 1
    else:
        dict_t[t] = 1

tensu = []
for key in dict_s.keys():
    if key in dict_t:
        tensu.append(dict_s[key] - dict_t[key])
    else:
        tensu.append(dict_s[key])

print(max(tensu))

Submission status: Wrong Answer

Solution code:
N = int(input())
s = [ input() for _ in range(N) ]
M = int(input())
t = [ input() for _ in range(M) ]

max_point = -1000
for string in s:
    point = 0
    for i in s:
        if i == string:
            point += 1
    for j in t:
        if j == string:
            point -= 1
    if point > max_point:
        max_point = point
print(max_point)

Submission status: Wrong Answer

Solution code:
N=int(input())
s=[]
for i in range(N):
    s.append(input())
M=int(input())
t=[]
for i in range(M):
    t.append(input())
res=0
if i in range(N):
    res=max(res, s.count(s[i])-t.count(s[i]))
print(res)

Submission status: Wrong Answer

Solution code:
N=int(input())
s=[]
for i in range(N):
    s.append(input())
M=int(input())
t=[]
for i in range(M):
    t.append(input())
res=0
if i in range(N):
    res=max(0, res, s.count(s[i])-t.count(s[i]))
print(res)

Submission status: Wrong Answer

Solution code:
N=int(input())
s=[]
for i in range(N):
    s.append(input())
M=int(input())
t=[]
for i in range(M):
    t.append(input())
res=0
if i in range(N):
    res=max(0, s.count(s[i])-t.count(s[i]))
print(res)

Submission status: Wrong Answer

Solution code:
d = {}
N = int(input())
for _ in range(N):
  c = input()
  d[c] = d.get(c, 0)+1
M = int(input())
for _ in range(M):
  c = input()
  d[c] = d.get(c, 0)-1
print(max(d.items(), key=lambda x: x[1])[0])

Submission status: Wrong Answer

Solution code:
N=int(input())
res={}
for dummy in range(N):
  s=input()
  if s not in res.keys():
    res[s]=1
  else:
    res[s]+=1
M=int(input())
for dummy in range(M):
  s=input()
  if s not in res.keys():
    res[s]=-1
  else:
    res[s]-=1
print(max(res.values()))

Submission status: Wrong Answer

Solution code:
def function(values, num):
    count = int(input())

    for i in range(count):
        name = input()
        if name in values:
            values[name] += num
        else:
            values[name] = 1
    
if __name__ == '__main__':
	values = {}

	function(values, 1)
	function(values, -1)
	print(max(values.values()))

Submission status: Wrong Answer

Solution code:
def function(values, num):
    count = int(input())

    for i in range(count):
        name = input()
        if name in values:
            values[name] += num
        else:
            values[name] = 1

    
values = {}

function(values, 1)
function(values, -1)
print(max(values.values()))

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
bun = []
for i in range(N):
    bun += input()
M = int(input())
ben = []
for i in range(M):
    ben += input()
counterA = Counter(bun)
counterB = Counter(ben)
counterA.subtract(counterB)
ans = counterA.most_common(1)[0][1]
if ans >= 0:
    print(ans)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
bun = []
for i in range(N):
    bun += input()
M = int(input())
ben = []
for i in range(M):
    ben += input()
counterA = Counter(bun)
counterB = Counter(ben)
counterA.subtract(counterB)
ans = counterA.most_common(1)[0][1]
if ans >= 0:
    print(ans)
else:
    print('maybe_not_being_answer')

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
bun = []
for i in range(N):
    bun += input()
M = int(input())
ben = []
for i in range(M):
    ben += input()
counterA = Counter(bun)
counterB = Counter(ben)
counterA.subtract(counterB)
print(counterA.most_common(1)[0][1])

Submission status: Wrong Answer

Solution code:
dic={}
for i in range(int(input())):
    s=input()
    if s in dic:
        dic[s]+=1
    else:
        dic[s]=1
for i in range(int(input())):
    s=input()
    if s in dic:
        dic[s]-=1
    else:
        dic[s]=-1
print(min(sorted(dic.values())[-1],0))

Submission status: Wrong Answer

Solution code:
n = int(input())

dic = {}

for i in range(n):
    word = input()

    if word in dic:
        dic[word] += 1
    else:
        dic[word] = 1

m = int(input())

for j in range(m):
    word = input()

    if word in dic:
        dic[word] -= 1
    else:
        dic[word] = -1


print(max(dic[x] for x in dic))

Submission status: Wrong Answer

Solution code:
n = int(input())

dic = {}

for i in range(n):
    word = input()

    if word in dic:
        dic[word] += 1
    else:
        dic[word] = 1

m = int(input())

for j in range(m):
    word = input()

    if word in dic:
        dic[word] -= 1
    else:
        dic[word] = -1


total = 0
for i,j in dic.items():
    if j > 0:
        total += j



print(total)

Submission status: Wrong Answer

Solution code:
incomeNum = int(input())

income = []
for i in range(incomeNum):
    income.append(input())
   
outgoNum = int(input())
 
outgo = []
for i in range(outgoNum):
    outgo.append(input())
    
money = 0
for c in income:
    if c in outgo:
        inum = income.count(c)
        onum = outgo.count(c)
        if  inum > onum:
            if inum > money:
                money = inum - onum
    else:
        inum = income.count(c)
        if inum > money:
            money = inum
        
        
print(money)

Submission status: Wrong Answer

Solution code:
blue = []
red = []
count=countb=countr=x=maxi=0
nblue = int(input())
for c in range(1, nblue+1):
  blue+=[input()]
nred = int(input())
for c in range(1, nred + 1):
  red+=[input()]
for c in range (0, len(blue)): 
  countb=blue.count(blue[c])
  countr=red.count(blue[c])
  if countr>=1:
    countr=red.count(blue[c])
    countb=countr
  if countb>maxi:
    maxi=countb
    x=c
print(maxi)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list()
for i in range(0,N):
	x=input()
	a.append(x)
M=int(input())
b=list()
for i in range(0,M):
	x=input()
	b.append(x)
A=dict()
B=dict()
for i in a:
	x=a.count(i)
	A[i]=x
for i in b:
	x=b.count(i)
	B[i]=x
res=list()
for i in A:
	if i in B:
		A[i]-=B[i]
m=0
print(A)
print(B)
for i in A:
	if A[i]>m:
		m=A[i]
print(A)
print(m)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list()
for i in range(0,N):
	x=input()
	a.append(x)
M=int(input())
b=list()
for i in range(0,M):
	x=input()
	b.append(x)
A=dict()
B=dict()
for i in a:
	x=a.count(i)
	A[i]=x
for i in b:
	x=a.count(i)
	B[i]=x
res=list()
for i in A:
	if i in B:
		A[i]-=B[i]
m=0
for i in A:
	if A[i]>m:
		m=A[i]
print(m)

Submission status: Wrong Answer

Solution code:
blue=[]
red=[]
count=countb=countr=x=maxi=0
nblue=int(input())
for c in range(1,nblue+1):
  blue+=[input()]
nred=int(input())
for c in range(1,nred+1):
  red+=[input()]
for c in range(0,len(blue)):
  countb=blue.count(blue[c])
  countr=red.count(blue[c])
  if countr>1:
    countr=red.count(blue[c])
    countb-=countr
  if countb>maxi:
    maxi=countb
    x=c
print(maxi)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N=int(input())
s=[input() for i in range(N)]
M=int(input())
t=[input() for i in range(M)]

dict={}
wordlist=list(set(s+t))
ss=Counter(s)
tt=Counter(t)
for i in wordlist:
    cnt=0
    cnt=ss[i]
    cnt=cnt-tt[i]
    dict[i]=cnt

print(max(dict.values()))

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
a = []
for i in range(N):
    a.append(str(input()))
word_counts_red = {}
counter = Counter(a)
for word, cnt in counter.most_common():
    word_counts_red[word] =cnt
M = int(input())
b = []
for i in range(M):
    b.append(str(input()))

word_counts_blue = {}
counter = Counter(b)
for word, cnt in counter.most_common():
    word_counts_blue[word] =cnt

point_counter = []
for w in word_counts_red.keys():
    if w in word_counts_blue:
        point_counter.append(word_counts_red[w]-word_counts_blue[w])
if not point_counter: 
    print(str(0))
elif max(point_counter) < 0:
    print(str(0))
else:
    print(str(max(point_counter)))

Submission status: Wrong Answer

Solution code:
N=int(input())
Blue=[]
for I in range(N):
	Blue.append(input())
M=int(input())
Red=[]
for J in range(M):
	Red.append(input())
W=[]
Max=-101
for K in Blue:
	if K not in W:
		W.append(K)
		R=Blue.count(K)-Red.count(K)
		if R>Max:
			Max=R
if Max==-101:
	print(0)
else:
	print(Max)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
a = []
for i in range(N):
    a.append(str(input()))
word_counts_red = {}
counter = Counter(a)
for word, cnt in counter.most_common():
    word_counts_red[word] =cnt
M = int(input())
b = []
for i in range(M):
    b.append(str(input()))

word_counts_blue = {}
counter = Counter(b)
for word, cnt in counter.most_common():
    word_counts_blue[word] =cnt

point_counter = []
for w in word_counts_red.keys():
    if w in word_counts_blue:
       point_counter.append(word_counts_red[w]-word_counts_blue[w])
if not point_counter: 
    print(str(0))
elif max(point_counter) < 0:
    print(str(0))
else:
    print(str(max(point_counter)))

Submission status: Wrong Answer

Solution code:
N=int(input())
Blue=[]
for I in range(N):
	Blue.append(input())
M=int(input())
Red=[]
for J in range(M):
	Red.append(input())
W=[]
Max=-101
for K in Blue:
	if K not in W:
		W.append(K)
		R=Blue.count(K)-Red.count(K)
		if R>Max:
			Max=R
print(Max)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
a = []
for i in range(N):
    a.append(str(input()))
word_counts_red = {}
counter = Counter(a)
for word, cnt in counter.most_common():
    word_counts_red[word] =cnt
M = int(input())
b = []
for i in range(M):
    b.append(str(input()))

word_counts_blue = {}
counter = Counter(b)
for word, cnt in counter.most_common():
    word_counts_blue[word] =cnt

point_counter = []
for w in word_counts_red.keys():
    if w in word_counts_blue:
       point_counter.append(word_counts_red[w]-word_counts_blue[w])
if not point_counter: 
    print(str(0))
else:
    print(str(max(point_counter)))

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
a = []
for i in range(N):
    a.append(str(input()))
word_counts_red = {}
counter = Counter(a)
for word, cnt in counter.most_common():
    word_counts_red[word] =cnt
M = int(input())
b = []
for i in range(M):
    b.append(str(input()))

word_counts_blue = {}
counter = Counter(b)
for word, cnt in counter.most_common():
    word_counts_blue[word] =cnt

point_counter = []
for w in word_counts_red.keys():
    if w in word_counts_blue:
       point_counter.append(word_counts_red[w]-word_counts_blue[w])
if not point_counter: 
    print(0)
else:
    print(max(point_counter))

Submission status: Wrong Answer

Solution code:

from collections import Counter
N = int(input())
s = []
for i in range(N):
    s.append(input())
s.sort()
M = int(input())
t = []
for i in range(M):
    t.append(input())
t.sort()
s_counter = Counter(s).most_common()
t_counter = Counter(t).most_common()
if(len(s_counter) != 1):
    if(s_counter[0][0] != t_counter[0][0]):
        print(s_counter[0][1])
        
    elif(s_counter[0][1] > t_counter[0][1]):
        print(s_counter[0][1] - t_counter[0][1])
        
    else:
        print(s_counter[1][1])
else:
    if(s_counter[0][0] != t_counter[0][0]):
        print(s_counter)
    elif(s_counter[0][1] > t_counter[0][1]):
        print(s_counter[0][1] - t_counter[0][1])
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
a = []
for i in range(N):
    a.append(str(input()))
    
word_counts_red = {}
counter = Counter(a)
for word, cnt in counter.most_common():
    word_counts_red[word] =cnt

M = int(input())
b = []
for i in range(M):
    b.append(str(input()))
print (b) 

word_counts_blue = {}
counter = Counter(b)
for word, cnt in counter.most_common():
    word_counts_blue[word] =cnt
point_counter = []
for w in word_counts_red.keys():
    if w in word_counts_blue:
       point_counter.append(word_counts_red[w]-word_counts_blue[w])
if not point_counter: 
    print(0)
else:
    print(max(point_counter))

Submission status: Wrong Answer

Solution code:
N=int(input())
s=[input() for i in range(N)]
M=int(input())
t=[input() for i in range(M)]

dict={}
wordlist=list(set(s+t))
for i in wordlist:
    cnt=0
    if i in s:
        cnt=cnt+1
    if i in t:
        cnt=cnt-1
    dict[i]=cnt

print(max(dict.values()))

Submission status: Wrong Answer

Solution code:
s=[]
t=[]

y=0
n=input()
for i in range(int(n)):
  a=input()
  s.append(a)
m=input()
for j in range(int(m)):
  b=input()
  t.append(b)
for k in range(len(s)):
  cs=0
  for l in range(len(s)-k):
    if s[k]==s[l]:
      cs+=1
  for x in range(len(t)):
    if s[k]==t[x]:
      cs-=1
  if y < cs:
    y=cs
if y>=0:
  print(str(y))
else:
 print('0')

Submission status: Wrong Answer

Solution code:
from collections import Counter, defaultdict
n = int(input())
s= []
t = defaultdict(int)
for _ in range(n):
    s.append(input())
u = Counter(s)
m = int(input())
for _ in range(m):
    word = input()
    t[word] -= 1
    if word in u.keys():
        u[word] -= 1

ans = u.most_common(1)[0][1]
t = sorted(t.items(), key=lambda x:x[1], reverse=True)[0][1]
print(max(ans, t))

Submission status: Wrong Answer

Solution code:
#coding:utf-8
n = int(input())
blue = []
plus = [0]*n
for i in range(n):
    s = input()
    if s in blue:
        plus[blue.index(s)] += 1
    else:
        blue.append(s)
        plus[blue.index(s)] += 1
m = int(input())
for i in range(m):
    s = input()
    if s in blue:
        plus[blue.index(s)] -= 1
print(max(plus))

Submission status: Wrong Answer

Solution code:
#coding:utf-8
n = int(input())
blue = []
plus = [0]*n
for i in range(n):
    s = input()
    if s in blue:
        plus[blue.index(s)] += 1
    else:
        blue.append(s)
        plus[i] += 1
m = int(input())
for i in range(m):
    s = input()
    if s in blue:
        plus[blue.index(s)] -= 1
print(max(plus))

Submission status: Wrong Answer

Solution code:
#coding:utf-8
n = int(input())
blue = []
plus = [0]*n
for i in range(n):
    s = input()
    if s in blue:
        plus[blue.index(s)] += 1
    else:
        blue.append(s)
m = int(input())
for i in range(m):
    s = input()
    if s in blue:
        plus[blue.index(s)] -= 1
print(max(plus)+1)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s= []
for _ in range(n):
    s.append(input())
u = Counter(s)
m = int(input())
for _ in range(m):
    word = input()
    if word in u.keys():
        u[word] -= 1

ans = u.most_common(1)[0][1]
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
import numpy as np

a = int(input())
a_list = []
b_list = []

for i in range(a):
  a_list.append(input())
a_list.append('lalalala')

b = int(input())

for i in range(b):
  b_list.append(input())
a_count = Counter(a_list)
b_count = Counter(b_list)
a_list_no_overlap = set(a_list)

point = []
for i in a_list_no_overlap:
    point.append(a_count[i]-b_count[i])

point_max = max(point)
print(point_max)

Submission status: Wrong Answer

Solution code:
from collections import Counter
import numpy as np

a = int(input())
a_list = []
b_list = []

for i in range(a):
  a_list.append(input())
a_list.append('')

b = int(input())

for i in range(b):
  b_list.append(input())
a_count = Counter(a_list)
b_count = Counter(b_list)
a_list_no_overlap = set(a_list)
print(a_count)
print(b_count)

point = []
for i in a_list_no_overlap:
    point.append(a_count[i]-b_count[i])
    
print(point)

point_max = max(point)
print(point_max)

Submission status: Wrong Answer

Solution code:
from collections import Counter
import numpy as np

a = int(input())
a_list = []
b_list = []

for i in range(a):
  a_list.append(input())
a_list.append('null')

b = int(input())

for i in range(b):
  b_list.append(input())
a_count = Counter(a_list)
b_count = Counter(b_list)
a_list_no_overlap = set(a_list)

point = []
for i in a_list_no_overlap:
    point.append(a_count[i]-b_count[i])

point_max = max(point)
print(point_max)

Submission status: Wrong Answer

Solution code:
s=[]
t=[]

y=0
n=input()
for i in range(int(n)):
  a=input()
  s.append(a)
m=input()
for j in range(int(m)):
  b=input()
  t.append(b)
for k in range(len(s)):
  cs=0
  for l in range(len(s)-k):
    if s[k]==s[l]:
      cs+=1
  for x in range(len(t)):
    if s[k]==t[x]:
      cs-=1
  if y < cs:
    y=cs
print(str(y))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = []
t = []

for i in range(0,n):
    s.append(input())
m = int(input())
for i in range(0,m):
    t.append(input())


answer = s.count(s[0]) - t.count(s[0])
for i in range(1,n):
    if s.count(s[i]) - t.count(s[i]) >= answer:
        answer = s.count(s[i]) - t.count(s[i])

print(answer)

Submission status: Wrong Answer

Solution code:
a = int(input())
blue = []
count = []
for i in range(a):
    x = input()
    if x in blue:
        count[blue.index(x)] += 1
    else:
        blue.append(x)
        count.append(1)
b = int(input())
for i in range(b):
    x = input()
    if x in blue:
        count[blue.index(x)] -= 1
    else:
        blue.append(x)
        count.append(-1)

count.sort()
count.reverse()
print (count[0])

Submission status: Wrong Answer

Solution code:
from collections import Counter
import numpy as np

a = int(input())
a_list = []
b_list = []

for i in range(a):
  a_list.append(input())
a_list.append('null')

b = int(input())

for i in range(b):
  b_list.append(input())
a_count = Counter(a_list)
b_count = Counter(b_list)
a_list_no_overlap = set(a_list)
print(a_count)

point = []
for i in a_list_no_overlap:
    point.append(a_count[i]-b_count[i])

point_max = np.argmax(point)
print(point_max)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import numpy as np
count=0

N= int(input())
s=np.empty(N,dtype=str)
for i in range(N):
    s[i]=input()
M=int( input())


t=np.empty(M,dtype=str)
for i in range(M):
    t[i]=input()

xx=np.empty(N)

for i in range(N):
    X=(np.sum(s==s[i]))
    Y=(np.sum(t==s[i]))
    xx[i]=X-Y

num=int(max(xx))    
if num<0:
    print(0)
else: 
    print(num)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Spyderエディタ

これは一時的なスクリプトファイルです
"""

N = int(raw_input())

blue = {}
for i in range(N):
    s = raw_input()
    if s not in blue.keys():
        blue[s]  = 1
    else:
        blue[s]+=1
    
M = int(raw_input())

red = {}
for i in range(M):
    s = raw_input()
    if s not in blue.keys():
        blue[s]  = 1
    else:
        blue[s]+=1

allfluit = blue
for k in red.keys():
    if k in allfluit:
        allfluit[k] -= red[k]
    else:
        allfluit[k] = (-1) * red[k]
        
maxs = -9999
for k in allfluit.keys():
    maxs = max(allfluit[k] ,maxs)
    
print maxs

Submission status: Wrong Answer

Solution code:
#coding:utf-8
n = int(input())
blue = []
plus = [0]*n
for i in range(n):
    s = input()
    if s in blue:
        plus[blue.index(s)] += 1
    else:
        blue.append(s)
m = int(input())
for i in range(m):
    s = input()
    if s in blue:
        plus[blue.index(s)] -= 1
print(max(plus))

Submission status: Wrong Answer

Solution code:
N = int(input())
s = []
s_ = set([])
for i in range(N):
    tmp = input()
    s.append(tmp)
    s_.add(tmp)

M = int(input())
t = []
t_ = set([])
for j in range(M):
    tmp = input()
    t.append(tmp)
    t_.add(tmp)

u = s_.union(t_)

counter = []
for factor in u:
    counter.append(s.count(factor) - t.count(factor))

print(max(counter))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import numpy as np
count=0

N= int(input())
s=np.empty(N,dtype=str)
for i in range(N):
    s[i]=input()
M=int( input())


t=np.empty(M,dtype=str)
for i in range(M):
    t[i]=input()

xx=np.empty(N)

for i in range(N):
    X=(np.sum(s==s[i]))
    Y=(np.sum(t==s[i]))
    xx[i]=X-Y
print(int(max(xx)))

Submission status: Wrong Answer

Solution code:
# coding: utf-8

b = []
r = []

# input
N = int(input())
for i in range(N):
    arg = input()
    b.append(arg)

M = int(input())
for i in range(M):
    arg = input()
    r.append(arg)

# solve
br = b + r
for i in range(len(br)):
    # initialize
    count_b = 0
    count_r = 0
    # target string
    s = br[i]
    # check blue cards
    for j in range(len(b)):
        if (b[j] == s):
            count_b += 1
    # check red cards
    for j in range(len(r)):
        if (r[j] == s):
            count_r += 1
    # check difference
    diff = count_b - count_r
    if (i == 0):
        X = diff
    elif (diff > X):
        X = diff
if (X < 0):
    X = 0

print("---")
print(X)

Submission status: Wrong Answer

Solution code:
all_cards = []

N = int(raw_input())
blue_cards = []

for index in range(N):
	blue_card = raw_input()

	blue_cards.append(blue_card)
	all_cards.append(blue_card)

M = int(raw_input())
red_cards = []

for index in range(M):
	red_card = raw_input()

	red_cards.append(red_card)
	all_cards.append(red_card)

# make it unique
unique_all_cards = list(set(all_cards))

yens = []

for unique_all_card in unique_all_cards:
	counter = 0

	for blue_card in blue_cards:
		if unique_all_card == blue_card:
			counter = counter + 1

	for red_card in red_cards:
		if unique_all_card == red_card:
			counter = counter - 1

	yens.append(counter)

if len(yens) == 1 and yens[0] < 0:
	print '0'
else:
	print max(yens)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
s = [input() for _ in range(N)]
M = int(input())
t = [input() for _ in range(M)]

s_count = Counter(s)
t_count = Counter(t)

s_count.subtract(t_count)

res = list(s_count.values())[0]

if res > 0:
    print(res)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
B = int(input())
b = {}
for i in range(B):
    a = input()
    if a in b:
        b[a] += 1
    else:
        b[a] = 1

R = int(input())
for i in range(R):
    a = input()
    if a in b:
        b[a] -= 1
    else:
        b[a] = -1
print(max(b.values()))

Submission status: Wrong Answer

Solution code:
n = int(input())
d = {}
for i in range(n):
    a=input()
    if a in d:
        d[a]+=1
    else:
        d[a]=1
m = int(input())
for i in range(m):
    a=input()
    if a in d:
        d[a]-=1
    else:
        d[a]=-1
print(max(d.values()))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = []
for _ in range(n):
  s.append(input())
  
m = int(input())
t = []
for _ in range(m):
  t.append(input())

#ichiran = list(set(s + t))
maxval = -100
for a in set(s + t):
  value = 0
  for b in s:
    if (a == b):
      value += 1
  for b in t:
    if (a == b):
      value -= 1
  if maxval < value:
    maxval = value

print(maxval)

Submission status: Wrong Answer

Solution code:
N = int(input())
s_list = []
for i in range(N):
    p = input()
    s_list.append(p)
M = int(input())
t_list = []
for i in range(M):
    p2 = input()
    t_list.append(p2)
s_count_list = [0 for i in range(N)]
#s_listの中身を１つずつ計算しますよ…
for i in range(N):
    name = s_list[i]
    count = 0
    #このnameと同じものを探しカウントする
    for k in range(N):
        if s_list[k] == name:
            count += 1
    for t in range(M):
        if t_list[t] == name:
            count -= 1
    s_count_list[i] = count
max_c = max(s_count_list)
print(max_c)

Submission status: Wrong Answer

Solution code:
GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS())

from collections import Counter
def main():
  ss = Counter(input() for _ in range(GI()))
  ts = Counter(input() for _ in range(GI()))

  for k in ss:
    if k in ts:
      ss[k] -= ts[k]

  print(max(ss.values()))

main()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = ["0"]*n
dict = {}
for i in range(n):
    s[i] = input()
    if s[i] in dict:
        dict[s[i]] += 1
    else:
        dict[s[i]] = 1

m = int(input())
t = ["0"]*m
for i in range(m):
    t[i] = input()
    if t[i] in dict:
         dict[t[i]] -= 1
    else:
         dict[t[i]] = -1
print(max(dict.values()))

Submission status: Wrong Answer

Solution code:
import collections
c=collections.Counter()
n=int(input())
for _ in range(n):
    c[input()] +=1
m=int(input())
for _ in range(m):
    c[input()] -=1
print(c.most_common(1)[0][1])

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n = int(input())
rec = defaultdict(int)
for i in range(n):
    a = input()
    rec[a] += 1
m = int(input())
for i in range(m):
    a = input()
    rec[a] -= 1

q = -100000
for k, v in rec.items():
    if q <= v:
        q = v

print(q)

Submission status: Wrong Answer

Solution code:

n = int(input())
blue =[input() for i in range(n)]
m = int(input())
red = [input() for i in range(m)]

maxyen = -99999999
for i in blue:
  bc  = blue.count(i)
  rc = red.count(i)
  if bc-rc>maxyen:
    maxyen = bc-rc

print(maxyen)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[0]
cnt=[0]
ans=True
for i in range(n):
    s=input()
    for j in range(len(a)):
        if a[j]==s:
            cnt[j]+=1
            ans=False
        if ans:
            cnt.append(1)
            a.append(s)
    ans=True
m=int(input())
for i in range(m):
    s=input()
    for j in range(len(a)):
        if a[j]==s:
            cnt[j]-=1
print(max(cnt))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
a=[0]
cnt=[0]
ans=True
for i in range(n):
    s=input()
    for j in range(len(a)):
        if a[j]==s:
            cnt[j]+=1
            ans=False
        if ans:
            cnt.append(1)
            a.append(s)
    ans=True
n=int(input())
for i in range(n):
    s=input()
    for j in range(len(a)):
        if a[j]==s:
            cnt[j]-=1

print(max(cnt))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
a=[0]
cnt=[0]
ans=True
for i in range(n):
    s=input()
    for j in range(len(a)):
        if a[j]==s:
            cnt[j]+=1
            ans=False
        if ans:
            cnt.append(1)
            a.append(s)
    ans=True
n=int(input())
for i in range(n):
    s=input()
    for j in range(len(a)):
        if a[j]==s:
            cnt[j]-=1

print(max(cnt))