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: Runtime Error

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

Submission status: Runtime Error

Solution code:
a = [input() for _ in range(int(input()))]
b = [input() for _ in range(int(input()))]
print(max(0, max([ a.count(i) - b.count(i) for i in set(a.extend(b))])))

Submission status: Runtime Error

Solution code:
N=int(input())
n=[str(input()) for i in range(N)]
M=int(input())
m=[str(input()) for i in range(M)]
for i in range(N):
  print(max(0, max(n.count(n[i])-m.count(n[i]))))

Submission status: Runtime Error

Solution code:
N=int(input())
n=[str(input()) for i in range(N)]
M=int(input())
m=[str(input()) for i in range(M)]
for i in range(N):
  print(max(0, max(n.count(n[i-1])-m.count(n[i-1]))))

Submission status: Runtime Error

Solution code:
N=int(input())
n=[str(input()) for i in range(N)]
M=int(input())
m=[str(input()) for i in range(M)]
for i in range(N):
  result=n.count(n[i-1])-m.count(n[i-1]) 
If result>=0:
  print(result)
else:
  print(0)

Submission status: Runtime Error

Solution code:
import collections

n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

S = collections.Counter(s)
T = collections.Counter(t)

ans = [0]
for key, cont in S:
    if cont > T[key]:
        ans.append(cont - T[key])
print(max(ans))

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
s = []
for _ in range(N):
    s.append(input().rstrip())
M = int(input())
t = []
for _ in range(M):
    t.append(input().rstrip())
from collections import Counter
cs = Counter(s)
ct = Counter(t)
ans = {}
for i in cs.keys():
    ans[i] = cs[i] - ct[i]
print(max(ans.values(), 0))

Submission status: Runtime Error

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

l = []
for i in range(n):
  S = s.count(s[i])
  T = t.count(t[i])
  l.append(S - T)
  
if max(l) < 0:
  print("0")
else:
  print(max(l))

Submission status: Runtime Error

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

l = []
for i in range(n):
  S = s.count(i)
  T = t.count(i)
  l.append(S - T)
  
if max(l) < 0:
  print("0")
else:
  print(max(l))

Submission status: Runtime Error

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

l = list(set(s)) 

for k in range(len(l)):
    cnt = max(cnt, s.count(l[k]) - t.count(l[k]))

print(cnt)

Submission status: Runtime Error

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

from collections import Counter

cou_S = Counter(S)
cou_T = Counter(T)

ans = [0]
for key in cou_S:
    ans.append(cou_S[key] - cou_T.get(i, 0))
print(max(ans))

Submission status: Runtime Error

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

ans = 0
for i in a:
  ans = max(ans, s.count(i) - t.count(i))

print(ans)

Submission status: Runtime Error

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

l = list(set(s))
a = max (n.count(l[i]) - m.count(l[i]) for i in range(len(l)))

print(a if a > 0 else 0)

Submission status: Runtime Error

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

l = list(s)
a = max (n.count(l[i]) - m.count(l[i]) for i in range(len(l)))

print(a)

Submission status: Runtime Error

Solution code:
a

Submission status: Runtime Error

Solution code:
n=int(input())
lblue=[input() for i in range(n)]
m=int(input())
lred=[input() for i in range(m)]
lword=set(lblue)
ans=[]
for i in range(len(lword)):
    ans=ans.append(lblue.count(lword[i])-lred.count(lword[i]))
print(max(ans))

Submission status: Runtime Error

Solution code:
from collections import Counter
n=int(input())
a=[input() for i in range(n)]
m=int(input())
b=[input() for i in range(m)]
ca = Counter(a)
cb = Counter(b)
ans = 0
for s,n in ca.items():
  ans.append(n-cb[s])
print(max(ans))

Submission status: Runtime Error

Solution code:
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for j in range(m)]
l=list(set(s))

esult=max(0,max(s.count(i)-t.count(i) for i in l))
print(result)

Submission status: Runtime Error

Solution code:
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(N))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))

Submission status: Runtime Error

Solution code:
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(N))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l))))

Submission status: Runtime Error

Solution code:
N=int(input())
s=[int(input()) for _ in range(N)]
M=int(input())
t=[int(input()) for _ in range(M)]
l=list(set(N))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l))))

Submission status: Runtime Error

Solution code:
N=int(input())
s=[int(input()) for _ in range(N)]
M=int(input())
t=[int(input()) for _ in range(M)]
l=list(set(N))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))

Submission status: Runtime Error

Solution code:
N=int(input())
s=[int(input()) for _ in range(N)]
M=int(input())
t=[int(input()) for _ in range(M)]
l=list(set(N))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range len(l))))

Submission status: Runtime Error

Solution code:
dict_ = dict()
[exec("dict_['{0}'] = dict_.get('{0}', 0) + 1".format(input())) for _ in range(int(input()))]
[exec("dict_['{0}'] = dict_.get('{0}', 0) - 1".format(input())) for _ in range(int(input()))]
print(max(*dict_.values(), 0))

Submission status: Runtime Error

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

ans = 0
for i in S:
    ans = max(ans, S.count(i) - T.count(i))

print(ans)

Submission status: Runtime Error

Solution code:
dicN={}
for i in range(int(input())):
  x=input()
  if x in dicN:
    dicN[x]+=1
  else:
    dicN[x]=1
dicM={}
for i in range(int(input())):
  x=input()
  if x in dicM:
    dicM[x]+=1
  else:
    dicM[x]=1
print(max([dicN[e]-dicM[e] for e in dicN.keys()]+[0]))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = [input() for i in range(n+1)]
m = int(input())
b = [input() for i in range(m+1)]
min = 0
for i in range(n+1):
    max = a.count(a[i])-b.count(a[i])
    if max >= min:
        min = max
    else:
        pass
print(max)

Submission status: Runtime Error

Solution code:
n = int(input())
a = [input() for i in range(n)]
m = int(input())
b = [input() for i in range(m)]
min = 0
for i in range(n+1):
    max = a.count(a[i])-b.count(a[i])
    if max >= min:
        min = max
    else:
        pass
print(max)

Submission status: Runtime Error

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

sCount = {}
for s in S:
    sCount[s] = S.count(s)

tCount = {}
for t in T:
    tCount[t] = T.count(t)

union = sCount.keys() & tCount.keys()
ans = sCount;
for i in union:
    ans[i] = sCount[i] - tCount[i]
    
print(max(ans.values()))

Submission status: Runtime Error

Solution code:
b = [input() for i in range(int(input()))]
r = [input() for i in range(int(input()))]
k = 0
for w in list(set(b)):
  k = max(o, b.count(w) - r.count(w))
print(k)

Submission status: Runtime Error

Solution code:
import collections

def insert_card(card_number, card_list):
    i = 0
    while i < card_number:
        card_list.append(input())
        i += 1


blue_card_number = int(input())
blue_card_list = []
insert_card(blue_card_number, blue_card_list)

red_card_number = int(input())
red_card_list = []
insert_card(red_card_number, red_card_list)

blue_card_collection = collections.Counter(blue_card_list)
red_card_collection = collections.Counter(red_card_list)

result_card_collection = blue_card_collection - red_card_collection

answer_collection = sorted(result_card_collection.items(), key=lambda x:x[1], reverse=True)
print(answer_collection[0][1])

Submission status: Runtime Error

Solution code:
import collections

def insert_card(card_number, card_list):
    i = 0
    while i < card_number:
        card_list.append(input())
        i += 1


blue_card_number = int(input())
blue_card_list = []
insert_card(blue_card_number, blue_card_list)

red_card_number = int(input())
red_card_list = []
insert_card(red_card_number, red_card_list)

blue_card_collection = collections.Counter(blue_card_list)
red_card_collection = collections.Counter(red_card_list)

result_card_collection = blue_card_collection - red_card_collection

answer_collection = sorted(result_card_collection.items(), key=lambda x:x[1], reverse=True)
print(answer_collection[0][0])

Submission status: Runtime Error

Solution code:
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]
for i in set(s):
    result=s.count(i)-t.count(i)
print(max(o,result))

Submission status: Runtime Error

Solution code:
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]
for i in range(n):
    result=s.count(s[i])-t.count(s[i])
print(max(o,result))

Submission status: Runtime Error

Solution code:
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for j in range(m)]
for i in range(n):
    result=s.count(s[i])-t.count(s[i])
print(max(o,result))

Submission status: Runtime Error

Solution code:
n=int(input())
for i in range(n):
    s=list(input())
m=int(input())
for j in range(m):
    t=list(input())

result=0
for i in range(n):
    result=s.count(s[i])-t.count(s[i])

print(max(o,result))

Submission status: Runtime Error

Solution code:
n=int(input())
s=list(input() for i in range(n))
m=int(input())
t=list(input() for j in range(m))

for i in range(n):
    result=s.count(s[i])-t.count(s[i])

print(max(o,result))

Submission status: Runtime Error

Solution code:
n=int(input())
for i in range(n):
    s=list(input())
m=int(input())
for j in range(m):
    t=list(input())

for i in range(n):
    result=s.count(s[i])-t.count(s[i])

print(max(o,result))

Submission status: Runtime Error

Solution code:
n=int(input())
for i in range(n):
    s=list(str(input()))
m=int(input())
for j in range(m):
    t=list(str(input()))

for i in range(n):
    result=s.count(s[i])-t.count(s[i])

print(max(o,result))

Submission status: Runtime Error

Solution code:
import collections

n=int(input())
for i in range(n):
    s=list(input())
m=int(input())
for j in range(m):
    t=list(input())

cs=collections.Counter(s)
ct=collections.Counter(t)

cst=cs-ct

print(max(cst))

Submission status: Runtime Error

Solution code:
import collections

n=int(input())
for i in range(n):
    s=list(map(str,input()))
m=int(input())
for j in range(m):
    t=list(map(str,input()))

cs=collections.Counter(s)
ct=collections.Counter(t)

cst=cs-ct

print(max(cst))

Submission status: Runtime Error

Solution code:
import collections

n=int(input())
for i in range(n):
    s=list(map(str,input().split()))
m=int(input())
for j in range(m):
    t=list(map(str,input().split()))

cs=collections.Counter(s)
ct=collections.Counter(t)

cst=cs-ct

print(max(cst))

Submission status: Runtime Error

Solution code:
import collections

n=int(input())
for i in range(n):
    s=list(str(input()))
m=int(input())
for j in range(m):
    t=list(str(input()))

cs=collections.Counter(s)
ct=collections.Counter(t)

cst=cs-ct

print(max(cst))

Submission status: Runtime Error

Solution code:
#                         author:  kagemeka 
#                         created: 2019-11-06 22:04:18(JST)
import sys
import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator

def main():
    l = sys.stdin.read().split()
    n = int(l[0])
    m = int(l[n+1])
    a = collections.Counter(l[1:n+1])
    b = collections.Counter(l[n+2:n+m+2])
    for s, c in b.items():
        a.update({s: a.get(s, 0) - c})

    ma = max(a.values(), 0)
    print(ma)
        

if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
s_list = [input() for i in range(n)]
m = int(input())
t_list = [input() for j in range(m)]


def list_diff(list1, list2):
    result = list1.copy()
    for val in list2:
        if val in result:
            result.remove(val)
    return result


def count_max(diff_list):
    cnt_list = [diff_list.count(ele) for ele in set(diff_list)]
    return max(cnt_list)


lst = list_diff(s_list, t_list)
print(count_max(lst))

Submission status: Runtime Error

Solution code:
s=[input() for _ in range(int(input()))]
t=[input() for _ in range(int(input()))]
cnt=[0]*(len(s)+1)
for i in range(len(s)):
    cnt[i]=s.count(s[i])-t.count(t[i])
print(max(cnt))

Submission status: Runtime Error

Solution code:
n = int(input())
sn = [input() for _ in range(n)]
m = int(input())
sm = [input() for _ in range(m)]

List = []
for i in range(len(list(set(n)))):
    List.append(n.count(list(set(n))[i]) - m.count(list(set(n))[i]))
    
print(max(List))

Submission status: Runtime Error

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

table=collections.defaultdict(int)
for x in s:
  table[x]+=1
for x in t:
  table[x]-=1
table=table.values()
table=[x for x in table if x >= 0]
print(max(table))

Submission status: Runtime Error

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

table=collections.defaultdict(int)
for x in s:
  table[x]+=1
for x in t:
  table[t]+=1
table=table.values()
table=[x for x in table if x >= 0]
print(sum(table))

Submission status: Runtime Error

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

table=collections.defaultdict(int)
for x in s:
  table[x]+=1
for x in t:
  table[t]+=1
table=table.values()
table=[x for x in table if x >= 0]
print(sum(table))

Submission status: Runtime Error

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

table=collections.defaultdict(int)
for x in s:
  table[x]+=1
for x in t:
  table[t]+=1
table=table.values()
table=[x for x in table if x >= 0]
print(sum(table))

Submission status: Runtime Error

Solution code:
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i])) for i in range(len(l))))

Submission status: Runtime Error

Solution code:
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max([0,n.count(l[i])-m.count(l[i]) for i in range(len(l))]))

Submission status: Runtime Error

Solution code:
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,n.count(l[i])-m.count(l[i]) for i in range(len(l))))

Submission status: Runtime Error

Solution code:
from collections import defaultdict
N = int(input())
bd = defaultdict(lambda: 0)
for i in range(N):
  bd[input()] += 1
N = int(input())
for i in range(N):
  bd[input()] -= 1

print(max([max(bd.values()), 0])

Submission status: Runtime Error

Solution code:
n = int(input())
sn = list(input() for i in range(n))
m = int(input())
mn = list(input() for i in range(m))

for i in range(len(sn)):
  ss.append(sn.count(sn[i])-mn.count(sn[i]))

print (max(ss),0)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n,m;
  vector<string> s(n),t(m),o(n);
  cin>>n;
  rep(i,n){
    cin>>s.at(i);
  }
  cin>>m;
  rep(j,m){
    cin>>t.at(j)
  }
  rep(i,n){
    int sss=0, ttt=0;
      rep(j,n){
        if(s.at(i)==s.at(j)){
          sss++;
        }
      }
  rep(k,m){
    if(s.at(i)==t.at(k)){
      ttt++;
    }
  }
    o.at(i) = sss - ttt;
 }
  int max=0;
  rep(i,n){
    if(max<o.at(i)){
      max = o.at(i);
    }
  }
  cout<<max;
}

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n,m;
  vector<string> s(n),t(m),o(n);
  cin>>n;
  rep(i,n){
    cin>>s.at(i);
  }
  cin>>m;
  rep(j,m){
    cin>>t.at(j)
  }
  rep(i,n){
    int sss=0, ttt=0;
      rep(j,n){
        if(s.at(i)==s.at(j)){
          sss++;
        }
      }
  }
  rep(k,m){
    if(s.at(i)==t.at(k)){
      ttt++;
    }
    o.at(i) = sss - ttt;
  }
  int max=0;
  rep(i,n){
    if(max<o.at(i)){
      max = o.at(i);
    }
  }
  cout<<max;
}

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n,m;
  vector<string> s(n),t(m),o(n);
  cin>>n;
  rep(i,n){
    cin>>s.at(i);
  }
  cin>>m;
  rep(j,m){
    cin>>t.at(j)
  }
  rep(i,n){
    int sss=0, ttt=0;
      rep(j,n){
        if(s.at(i)==s.at(j)){
          sss++;
        }
      }
      rep(k,m){
        if(s.at(i)==t.at(k)){
          ttt++;
        }
      o.at(i) = sss - ttt;
    }
  int max=0;
  rep(i,n){
    if(max<o.at(i)){
      max = o.at(i);
    }
  }
  cout<<max;
}
  
  
  
      
          
        
  
  
  
  
  
}

Submission status: Runtime Error

Solution code:
s = [input() for _ in range(int(input()))]
t = [input() for _ in range(int(input()))]
yMax = 0
c = count

for i in s:
    cnt = s.c(i) - t.c(i)
    if yMax < cnt:
        yMax = cnt
print(yMax)

Submission status: Runtime Error

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

pnt = []

for b in blue:
    if b in red:
        pnt.append(blue[b] - red[b])
    else:
        pnt.append(blue[b])
        
print(max(pnt) if max(pnt) > 0 else 0)

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
st = s + t
c = []
maxidx = 0
maxcount = -float('inf')

for i in set(st):
    count = s.count(i) - t.count(i)
    c.append((i, count))
    if count > maxcount:
        maxcount = count
        maxind = st.index(i)
c.append(('zero', 0))
if c[maxind][1] > 0:
    print(c[maxind][1])
else:
    print(c[-1][1])

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
st = s + t
c = []
maxidx = 0
maxcount = -float('inf')

for i in set(st):
    count = s.count(i) - t.count(i)
    c.append((i, count))
    if count > maxcount:
        maxcount = count
        maxind = st.index(i)
        
if not(len(c) == 0) and (c[maxind][1] > 0):
    print(c[maxind][1])
else:
    print(0)

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
st = s + t
c = []
maxidx = 0
maxcount = -float('inf')

for i in set(st):
    count = s.count(i) - t.count(i)
    c.append((i, count))
    if count > maxcount:
        maxcount = count
        maxind = st.index(i)
        
if c[maxind][1] > 0:
    print(c[maxind][1])
else:
    print(0)

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
st = s + t
c = []
maxidx = 0
maxcount = -float('inf')

for i in set(st):
    count = s.count(i) - t.count(i)
    c.append((i, count))
    if count > maxcount:
        maxcount = count
        maxind = st.index(i)
        
if c[maxind][1] >= 0:
    print(c[maxind][1])
else:
    print(0)

Submission status: Runtime Error

Solution code:
import collections

n = int(input())
s_list = [input() for _ in range(n)]
m = int(input())
t_list = [input() for _ in range(m)]

s_dict = collections.Counter(s_list)
t_dict = collections.Counter(t_list)

s_t_dict = (s_dict - t_dict).values()
print(max(s_t_dict))

Submission status: Runtime Error

Solution code:
import numpy as np

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

s = np.array(s)
t = np.array(t)

s = np.unique(s, return_counts=True)
t = np.unique(t, return_counts=True)

ans = 0
for i,ch_s in enumerate(s[0]):
  ans_tmp = s[1][i]
  for j,ch_t in enumerate(t[0]):
    if ch_s == ch_t:
      ans_tmp -= t[1][j]
  if ans_tmp > ans:
    ans = ans_tmp
print(int(ans))

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())
s = []
for i in range(N):
  s.append(input())
    
M = int(input())
t = []
for i in range(M):
  t.append(input())
    
s = np.unique(s, return_counts=True)
t = np.unique(t, return_counts=True)

ans = 0
#for i,ch_s in enumerate(s[0]):
#  ans_tmp = s[1][i]
#  for j,ch_t in enumerate(t[0]):
#    if ch_s == ch_t:
#      ans_tmp -= t[1][j]
#  if ans_tmp > ans:
#    ans = ans_tmp
print(int(ans))

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())
s = []
for i in range(N):
  s.append(input())
    
M = int(input())
t = []
for i in range(M):
  t.append(input())
    
s = np.unique(s, return_counts=True)
t = np.unique(t, return_counts=True)

ans = 0
for i,ch_s in enumerate(s[0]):
  ans_tmp = s[1][i]
  for j,ch_t in enumerate(t[0]):
    if ch_s == ch_t:
      ans_tmp -= t[1][j]
  if ans_tmp > ans:
    ans = ans_tmp
print(int(ans))

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())
s = []
for i in range(N):
  s.append(input())
    
M = int(input())
t = []
for i in range(M):
  t.append(input())
    
s = np.unique(s, return_counts=True)
t = np.unique(t, return_counts=True)

ans = 0
for i,ch_s in enumerate(s[0]):
  ans_tmp = s[1][i]
  for j,ch_t in enumerate(t[0]):
    if ch_s == ch_t:
      ans_tmp -= t[1][j]
    if ans_tmp > ans:
      ans = ans_tmp
print(int(ans))

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())
s = []
for i in range(N):
    s.append(input())
    
M = int(input())
t = []
for i in range(M):
    t.append(input())
    
s = np.unique(s, return_counts=True)
t = np.unique(t, return_counts=True)

ans = 0
for i,ch_s in enumerate(s[0]):
    ans_tmp = s[1][i]
    for j,ch_t in enumerate(t[0]):
        if ch_s == ch_t:
            ans_tmp -= t[1][j]
    if ans_tmp > ans:
        ans = ans_tmp
print(int(ans))

Submission status: Runtime Error

Solution code:
s = [input() for i in range(int(input()))]
t = [input() for i in range(int(input()))]
l = list(set(s))
print(max(0, max(s.count(l[i] - t.count(l[i])) for i in l)))

Submission status: Runtime Error

Solution code:
s = [input() for i in range(int(input()))]
t = [input() for i in range(int(input()))]
l = list(set(s))
  print(max(0, max(s.count(l[i] - t.count(l[i])) for i in l)))

Submission status: Runtime Error

Solution code:
n=int(input())
nl=[input() for i in range(n)]
m=int(input())
ml=[input() for i in range(n)]
nsl=list(set(nl))
mx=0
for x in range(len(nsl)):
	d=nl.count(nsl[x])-ml.count(nsl[x])
	if d>mx:mx=d
print(max(0,mx))

Submission status: Runtime Error

Solution code:
from collections import*
c=Counter.most_common
n=int(input())
n_l =[int(input()) for i in range(n)]
m=int(input())
m_l =[int(input()) for i in range(m)]
d=n_l.c()[0][1]-m_l.c()[-1][1]
if d <=0:print(0)
else:print(d)

Submission status: Runtime Error

Solution code:
from collections import*
c=Counter.most_common
n=int(input())
n_l =[input() for i in range(n)]
m=int(input())
m_l =[input() for i in range(m)]
d=n_l.c()[0][1]-m_l.c()[-1][1]
if d <=0:print(0)
else:print(d)

Submission status: Runtime Error

Solution code:
n = int(input())
c = []
for i in range(n):
    c.append(input())
d = []
m = int(input())
for i in range(m):
    d.append(input())

scores = []
for i in c:
    score = 0
    for j in range(n):
        if i == c[j]:
            score += 1
    for j in range(m):
        if i == d[j]:
            score -= 1
    scores.append(score)
if max(scores) >= 0:
    print(max(scores))
else:
    print(0)n = int(input())
c = []
for i in range(n):
    c.append(input())
d = []
m = int(input())
for i in range(m):
    d.append(input())

scores = []
for i in c:
    score = 0
    for j in range(n):
        if i == c[j]:
            score += 1
    for j in range(m):
        if i == d[j]:
            score -= 1
    scores.append(score)
print(max(scores))

Submission status: Runtime Error

Solution code:
N = int(input())
s = list(input() for i range(N))
M = int(input())
t = list(input() for i range(M))

s_set = list(set(s))
ans = 0
for name in s_set:
    count = s.count(name) - t.count(name)
    ans = max(count, ans)

print(ans)

Submission status: Runtime Error

Solution code:
N = input()
s = list(input() for i range(N))
M = input()
t = list(input() for i range(M))

s_set = list(set(s))
ans = 0
for name in s_set:
    count = s.count(name) - t.count(name)
    ans = max(count, ans)
    
print(ans)

Submission status: Runtime Error

Solution code:
n = [input() for i in range(int(input()))]
m = [input() for i in range(int(input()))]
l = list(set(n))
print(max(0, max(n.count(l[i])-m.count(l[i]) for i in range(len(l))))

Submission status: Runtime Error

Solution code:
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]
lis=set(s)
print(max(0,max([s.count(l)-t.count(l) for l in lis]))

Submission status: Runtime Error

Solution code:
from collections import defaultdict

n = int(input())
d = defaultdict()
for _ in range(n):
    s = input()
    d[s] += 1
m = int(input())
for _ in range(m):
    s = input()
    d[s] -= 1

answer = sorted([d[k] for k in d.keys()])[-1]
if answer < 0:
    answer = 0
print(answer)

Submission status: Runtime Error

Solution code:
from collections import defaultdict

n = int(input())
d = defaultdict()
for _ in range(n):
    s = input()
    d[s] += 1
m = int(input())
for _ in range(m):
    s = input()
    d[s] -= 1

print(sorted([d[k] for k in d.keys()])[-1])

Submission status: Runtime Error

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

dic={}
for i in s:
    if i in dic:
        dic[i]+=1
    else:
        dic[i]=1

for i in t:
    if i in dic:
        dic[i]-=1
print(max(dic.values(),0))

Submission status: Runtime Error

Solution code:
n = [input() for _ in range(int(input()))]
m = [input() for _ in range(int(input()))]
l = list(set(n))

print(max(0,max([n.count(l[i]) - m.count(l[i]) for i in range(len(n))])))

Submission status: Runtime Error

Solution code:
n = int(input())
dic = {}
for i in range(n):
  s = input()
  if s in dic.keys():
    dic[s] += 1
  else:
    dic[s] = 1

m = int(input())
for i in range(n):
  t = input()
  if t in dic.keys():
    dic[t] -= 1
    
ans = 0
for key in dic.keys():
  ans = max(ans, dic[key])
  
print(max(ans, 0))

Submission status: Runtime Error

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

l = list(set(s))

print(max(0, max(s.count(l[i]) - t.count(l[i]) for i in range(len(l)))))

Submission status: Runtime Error

Solution code:
for i in range(int(input())):
	s = input()
    if s not in hmap: hmap[s] = 1
    else: hmap[s] += 1
      
for i in range(int(input())):
	s = input()
    if s not in hmap: hmap[s] = -1
    else: hmap[s] -= 1

m = 0
for k,v in hmap.items():
	m = max(m,v)
print(m)

Submission status: Runtime Error

Solution code:
a = [input() for _ in range(int(input()))]
b = [input() for _ in range(int(input()))]
l = list(set(a))
c = max(0, max[a.count(i) - b.count(i) for i in l])
print(c)

Submission status: Runtime Error

Solution code:
a = [input() for _ in range(int(input()))]
b = [input() for _ in range(int(input()))]

l = list(set(a))


a = max(0, [a.count(l[i]) - b.count(l[i]) for i in range(len(l))])
print(a)

Submission status: Runtime Error

Solution code:
n=(input() for i in range(int(input())))
m=(input() for i in range(int(input())))

l=list(set(n))

print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))

Submission status: Runtime Error

Solution code:
    s = list(input() for _ in range(int(input())))
    t = list(input() for _ in range(int(input())))
    print(max(0,max(s.count(S)-t.count(S) for S in set(s))))

Submission status: Runtime Error

Solution code:
n = [ input() for _ in range( int( input() ) )]
m = [ input() for = in range( int( input() ) )]
l = list( set(n) )
print( max( 0, max( n.count(l[i]) - m.count(l[i]) for i in range( len(l) ) ) ) )

Submission status: Runtime Error

Solution code:
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0 ,max(n.count(l[i])-m.count(l[i]) for i in range(l))))

Submission status: Runtime Error

Solution code:
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,n.count(l[i])-m.count(l[i]) for i in range(l)))

Submission status: Runtime Error

Solution code:
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,n.count(l[i])-m.count(l[i])) for i in range(l))