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:
from collections import Counter

n = int(input())
blue = Counter(input() for _ in range(n))
m = int(input())
red = Counter(input() for _ in range(m))
c = (blue - red).most_common(1)

print(max(c[0][1], 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(m)]

S=set(s[i] for i in range(n))
L=len(S)
a=[0]*(L+1)
for i in range(L):
    a[i]=s.count(S[i])-t.count(S[i])
print(max(a))

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)]

S=set(s[i] for i in range(n))
L=len(S)
a=[0]*(L+1)
for i in L:
    a[i]=s.count(S[i])-t.count(S[i])
print(max(a))

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)]

S=set(s)
L=len(S)
a=[0]*(L+1)
for i in L:
    a[i]=s.count(S[i])-t.count(S[i])
print(max(a))

Submission status: Runtime Error

Solution code:
import numpy as np
import random

N = int(input())
A = []
B = []
C = []
D = []
E = []
ans = 0
for i in range(0,N):
  H = list(map(int,input().split()))
  A.append(H[0])
  B.append(H[1])
  
for i in range(0,N):
  H = list(map(int,input().split()))
  C.append(H[0])
  D.append(H[1])
  E.append(i)

for i in range(0, 15000):
  random.shuffle(E)
  a = 0
  for j in range(0,N):
    if A[j] < C[E[j]] and B[j] < D[E[j]]:
      a += 1
  ans = max(ans,a)
print(ans)

Submission status: Runtime Error

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

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)]

pointList = dict();

for temp in s:
  pointList[temp] = 0
for temp in t:
  pointList[temp] = 0
  
for temp in s:
  pointList[temp] += 1
for temp in t:
  pointList[temp] -= 1
  
ans = max(0, max(pointList.values()))

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

s = []
t = []
for _ in range(N):
    s.append(input())

for _ in range(N):
    t.append(input())

sets = set(s)

ans = []
for word in sets:
    tmp = 0
    tmp += s.count(word)
    tmp -= t.count(word)
    ans.append(tmp)

print(max(ans))

Submission status: Runtime Error

Solution code:
N = int(input())

s = []
t = []
for _ in range(N):
    s.append(input())

for _ in range(N):
    t.append(input())

sets = set(s)

ans = []
for word in sets:
    tmp += s.count(word)
    tmp -= t.count(word)
    ans.append(tmp)

print(min(ans))

Submission status: Runtime Error

Solution code:
#91b
import collections as c

n=int(input())
b_l=sorted([input() for _ in range(n)])
b=c.Counter(b_l)
b=b.most_common()

m=int(input())
r_l=sorted([input() for _ in range(m)])
r=c.Counter(r_l)
r=r.most_common()
ans=0
i=0
while i<=m-1:
    if b[i][0]==r[i][0]:
        temp=b[0][1]-r[0][1]
        i+=1
        if temp>0:
            ans=max(temp,ans)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
card = {}
for i in range(N):
  S = input()
  card[S] = card.get(S, 0) + 1

M = int(input())
for i in range(M):
  S = input()
  card[S] = card.get(S, 0) - 1
  
print(max(max(list(card.values()),0))

Submission status: Runtime Error

Solution code:
d={}
n=int(input())
for i in range(n):
    s=input()
    if s in d: d[s]+=1
    else:      d[s] =1
n=int(input())
    s=input()
    if s in d: d[s]-=1
ans=chk=0
for i in d:
    ans=max(ans,d[i])
print(ans)

Submission status: Runtime Error

Solution code:
N= int(input())
s = list()
for i in range(N):
    s.append(input())

M= int(input())
t = list()
for i in range(M):
    t.append(input())

    
max_count = 0
for i in range(N):
    for j in range(M):
        B = s.count(s[i]) - t.count(s[i])
        C = s.count(t[i]) - t.count(t[i])
        
        if B > C:
            E = B
        else:
            E = C
               
        if E > max_count:
            max_count = E
    
print(max_count)

Submission status: Runtime Error

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())

    
max_count = 0
for i in range(N):
    for j in range(M):
        B = s.count(s[i]) - t.count(s[i])
        C = s.count(t[i]) - t.count(t[i])
        
        if B > C:
            E = B
        else:
            E = C
               
        if E > max_count:
            max_count = E
    
print(max_count)

Submission status: Runtime Error

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

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

    
max_count = 0
for i in range(N):
    for j in range(M):
        B = s.count(s[i]) - t.count(s[i])
        C = s.count(t[i]) - t.count(t[i])
        
        if B > C:
            E = B
        else:
            E = C
               
        if E > max_count:
            max_count = E
    
print(max_count)

Submission status: Runtime Error

Solution code:
from collections import defaultdict
d = defaultdict(int)
for _ in range(int(input())):
    d[input()] += 1
for _ in range(int(input())):
    d[input()] -= 1
print(max(d.values(),0))

Submission status: Runtime Error

Solution code:
# 青の文字の辞書にtupleの1つ目に数を数える
# 赤の文字の辞書のtupleの２つ目に数を数える
# 青 -　赤を計算する

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

# 別のインスタンスを作成する
s2 = s[:]
set(s2)
ans = 0

for i in s2:
    if ans < s.count(i) - t.count(i):
        ans = s.count(i) - t.count(i)

print(ans)

Submission status: Runtime Error

Solution code:
# 青の文字の辞書にtupleの1つ目に数を数える
# 赤の文字の辞書のtupleの２つ目に数を数える
# 青 -　赤を計算する

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

# 別のインスタンスを作成する
s2 = s[:]

# 
ans = 0

for i in s2:
    if ans < s.count(i) - t.count(i):
        ans = s.count(i) - t.count(i)

print(ans)

Submission status: Runtime Error

Solution code:
def main():
    a, b, k = [int(i) for i in input().split()]

    s = set()
    for i in range(k):
        if a <= a+i and a+i <= b:
            s.add(a+i)
    for i in reversed(range(k)):
        if a <= b-i and b-i <= b:
            s.add(b-i)

    ans = list(s)
    ans.sort()

    for a in ans:
        print(a)
            
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N = int(input())
S = list()
for _ in range(N):
    S.append(input())
M = int(input())
for _ in range(M):
    T.append(input())

all_words = set(S+T) # unique strings only
scores = [S.count(w) - T.count(w) for w in all_words]
print(max(0,max(scores)))

Submission status: Runtime Error

Solution code:
n=int(input())
s=[]
t=[]
for i in range(n):
  s.append(input())
m=int(input())
for i in range(m):
  t.append(input())
max=0
for i in range(len(s)):
  get=0
  for j in range(len(s[i:n])):
    if s[i]==s[j]:
      get+=1
  for k in range(len(t)):
    if s[i]==s[k]:
      get-=1
  if get>max:
    max=get
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(M)]

count_max = 0
for i in range(N):
    count = s.count(s[i]) - t.count(s[i])
    if count > count_max:
         count_max = count
            
print(count_max)
N = int(input())
s = [input() for i in range(N)]

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

count_max = 0
for i in range(N):
    count = s.count(s[i]) - t.count(s[i])
    if count > count_max:
         count_max = count
            
print(count_max)

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)]

count = 0
for word in (s):
    counter = max(counter,s.count(word) - t.count(word))
print(counter)

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
num = {i:s.count(i) for i in set(s)}
out = [v-max(0,t.count(k)) for k, v in num.items()]
print(max(out,0))

Submission status: Runtime Error

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

s1 = list(set(s))
a = []
for i in range (len(s1)):
    for j in range (N):
        if s1[i] == s[j]:
            a[i]+=1
for i in range (len(s1)):
    for j in range (M):
        if s1[i] == t[j]:
            a[i]-=1
print(max(a))

Submission status: Runtime Error

Solution code:
import collections

bluecard = []
redcard = []

n = int(input())
for i in range(n):
    bluecard.append(input())

m = int(input())
for i in range(m):
    redcard.append(input())

blue_count = collections.Counter(bluecard)
red_count = collections.Counter(redcard)
diff = blue_count - red_count
if len(diff.keys) > 0:
    print(diff.most_common(1)[0][1])
else:
    print(0)

Submission status: Runtime Error

Solution code:
import collections

bluecard = []
redcard = []

n = int(input())
for i in range(n):
    bluecard.append(input())

m = int(input())
for i in range(m):
    redcard.append(input())

blue_count = collections.Counter(bluecard)
red_count = collections.Counter(redcard)
diff = blue_count - red_count
print(diff.most_common(1)[0][1])

Submission status: Runtime Error

Solution code:
import collections

bluecard = []
redcard = []

n = int(input())
for i in range(n):
    bluecard.append(input())

m = int(input())
for i in range(m):
    redcard.append(input())

blue_count = collections.Counter(bluecard)
red_count = collections.Counter(redcard)
diff = red_count - blue_count
print(diff.most_common(1)[0][1])

Submission status: Runtime Error

Solution code:
import collections

bluecard = []
redcard = []

n = int(input())
for i in range(n):
    bluecard.append(input())

m = int(input())
for i in range(m):
    bluecard.append(input())

blue_count = collections.Counter(bluecard)
red_count = collections.Counter(redcard)
diff = red_count - blue_count
print(diff.most_common(1)[0][1])

Submission status: Runtime Error

Solution code:
n = int(input())
blue = [input() for i in range(n)]
m = int(input())
red = [input() for i in range(n)]
x = 0
for w in set(blue):
    x = blue.count(w) - red.count(w) if blue.count(w) - red.count(w) > x else pass
print(x)

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)]
 
k = []
 
for x in a:
	temp = a.count(x)-b.count(x)
    k.append(temp)
print(max(k))

Submission status: Runtime Error

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

k = []

for x in a:
	temp = a.count(x)-b.count(x)
    k.append(temp)
print(max(k))

Submission status: Runtime Error

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 c_r.has_key(k_b):
        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: Runtime Error

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_r]:
            res = c_b[k_b] - c_r[k_r]

print(res)

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 str in s: 
    cou = s.oount(str) - t.count(str) 
    ans = max(cou, ans)

print(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 str in s: #strは単語を表している。ループの回数としてはn回（sの配列数）
    cou = s.oount(str) - t.count(str) #sの中にstr（たとえばapple)が何個あるか、tの中に同じく　str（spple)が何個あるか調べて引いてる。
    ans = max(cou, ans)

print(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 str in s:#strは単語を表している。ループの回数としてはn回（sの配列数）
    count = s.oount(str)-t.count(str) #sの中にstr（たとえばapple)が何個あるか、tの中に同じく　str（spple)が何個あるか調べて引いてる。
    ans = max(ans,count)　

print(ans)

Submission status: Runtime Error

Solution code:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<ll, P> E;
#define MOD (1000000007ll)
#define l_ength size
#define PI 3.14159265358979

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int n,m,i,j,ans=0,tmp;
	string s[123],t[123];
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> s[i];
	}
	cin >> m;
	for(j=0; j<m; ++j){
		cin >> t[j];
	}
	for(i=0; i<n; ++i){
		tmp = 0;
		for(j=0; j<n; ++j){
			if(s[i] == s[j]){
				++tmp;
			}
		}
		for(j=0; j<m; ++j){
			if(s[i] == t[j]){
				--tmp;
			}
		}
		ans = max(ans,tmp);
	}
	cout << ans << endl;
	return 0;
}

Submission status: Runtime Error

Solution code:
red = []
blue = []
ans = 0
n = int(input())
for _ in range(n):
    red.append(input())
m = int(input())
for _ in range(n):
    blue.append(input())
for word in set(red):
    if word in blue:
        tmp = red.count(word) - blue.count(word)
    else:
        tmp = red.count(word)
    if tmp > ans:
        ans = tmp
print(ans)

Submission status: Runtime Error

Solution code:
si = []
sn = []
ti = []
tn = []
an = []
n = int(input())
for i in range(n):
  a = input()
  si.append(a)
  if not(a in si):
    sn.append(a)
    
m = int(input())
for i in range(m):
  b = input()
  ti.append(b)
  if not(b in ti):
    tn.append(b)

for i in range(sn):
  a[i] = si.count(sn[i]) - ti .count(sn[i])

print(an.max())

Submission status: Runtime Error

Solution code:
si = []
sn = []
ti = []
tn = []
an = []
n = input()
for i in range(n):
  a = input()
  si.append(a)
  if not(a in si):
    sn.append(a)
    
m = input()
for i in range(m):
  b = input()
  ti.append(b)
  if not(b in ti):
    tn.append(b)

for i in range(sn):
  a[i] = si.count(sn[i]) - ti .count(sn[i])

print(an.max())

Submission status: Runtime Error

Solution code:

# -*- Coding: utf-8 -*-

blue=int(input())
blue_dict={}

red_dict={}
for i in range(blue):
    tmp=input()
    if tmp in blue_dict.keys():
        value=blue_dict[tmp]
        value+=1
        blue_dict[tmp]=value
        red_dict[tmp]=0
    else:
        blue_dict[tmp]=1
        red_dict[tmo]=0

        
red=int(input())
for i in range(red):
    tmp=input()
    if tmp in red_dict.keys():
        value=red_dict[tmp]
        value+=1
        red_dict[tmp]=value
        if tmp not in blue_dict.keys():
        blue_dict[tmp]=0
    else:
        red_dict[tmp]=1

result=0
for i in blue_dict.keys():
    sub=blue_dict[i]-red_dict[i]
    if sub>result:
        result=sub

print(result)

Submission status: Runtime Error

Solution code:
N = int(input("Blue Cards:"))
b = []
for i in range(N):
	b.append(input("Blue Character " + str(i) + ":"))

M = int(input("Red Cards:"))
r = []
for j in range(M):
	r.append(input("Red Character " + str(j) +":"))

point_list = []
for k in range(N):
	point_list.append(b.count(b[k]))
point = max(point_list)
bad = r.count(b[max(point_list)])
print(point - bad)

Submission status: Runtime Error

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

Submission status: Runtime Error

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]) >= (s_counter[1][1] - t_counter[1][1])):
        print(s_counter[0][1] - t_counter[0][1])
    else:
        print(s_counter[1][1] - t_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: Runtime Error

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
    else:
        blue.append(s)
        plus[blue.index(s)] -= 1
print(max(0, max(plus)))

Submission status: Runtime Error

Solution code:
from collections import Counter
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_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]) > (s_counter[1][1] - t_counter[1][1])):
        print(s_counter[0][1] - t_counter[0][1])
    else:
        print(s_counter[1][1] - t_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: Runtime Error

Solution code:
m = {}

n = int(input())
for i in range(n):
    s = input().strip()
    if s not in m:
        m[s] = 1
    else:
        m[s] += 1

m = int(input())
for i in range(m):
    t = input().strip()
    if t not in m:
        m[t] = -1
    else:
        m[t] -= 1

res = max(m.values())
if res<0:
    res = 0

print(res)

Submission status: Runtime Error

Solution code:
from collections import Counter
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_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]) > (s_counter[1][1] - t_counter[1][1])):
        print(s_counter[0][1] - t_counter[0][1])
    else:
        print(t_counter[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: Runtime Error

Solution code:
INP = input().split()
N = int(INP[0])
M = int(INP[N + 1])
ans = [0] * N

for i in range(N):
    for k in range(N):
        if INP[i + 1] == INP[k + 1]:
            ans[i] += 1
for i in range(N):
    for j in range(M):

        if INP[i+1] == INP[N + j + 1]:
            ans[i] -= 1

for i in range(N):
    if ans[i] < 0:
        ans[i] = 0
        
mx = max(ans)
print(mx)

Submission status: Runtime Error

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 = t.most_common(1)[0][1]
print(max(ans, t))

Submission status: Runtime Error

Solution code:

INP = input().split()
N = int(INP[0])
M = int(INP[N + 1])
ans = [0] * N

for i in range(N):
    for k in range(N):
        if INP[i + 1] == INP[k + 1]:
            ans[i] += 1
for i in range(N):
    for j in range(M):

        if INP[i+1] == INP[N + j + 1]:
            ans[i] -= 1
mx = max(ans)
print(mx)

Submission status: Runtime Error

Solution code:
INP = input().split()
N = int(INP[0])
M = int(INP[N + 1])
#print(N,M)
ans = [0] * N
#print(ans)

for i in range(N):
    for k in range(N):
        if INP[i + 1] == INP[k + 1]:
            print(INP[i + 1])
            ans[i] += 1
for i in range(N):
    for j in range(M):

        if INP[i+1] == INP[N + j + 1]:
            ans[i] -= 1
mx = max(ans)
print(mx)

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input())
s, t = []
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: Runtime Error

Solution code:
from collections import Counter
n = int(input())
s, t = [], []
for _ in range(n):
    s.append(input())
m = int(input())
for _ in range(m):
    t.append(input())
u = Counter(s) - Counter(t)
ans = u.most_common(1)[0][1]
print(ans)

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input())
s, t = [], []
for _ in range(n):
    s.append(input())
m = int(input())
for _ in range(n):
    t.append(input())
u = Counter(s) - Counter(t)
ans = u.most_common(1)[0][1]
print(ans)

Submission status: Runtime Error

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()

X=np.empty(N)    
Y=np.empty(M)    

xx=np.empty(N+M)

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

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

Submission status: Runtime Error

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.sorted()
if count[0] < 0:
    print("0")
else:
    print (count[0])

Submission status: Runtime Error

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)

blue.sorted()
if blue[0] < 0:
    print("0")
else:
    print(blue[0])

Submission status: Runtime Error

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)

blue.sorted()
if blue[0] < 0:
    print("0")
else:
    print (blue[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
# -*- coding: utf-8 -*-
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: Runtime Error

Solution code:
N = map(int,input())
blue = []
red = []
for i in range(N):
    blue.append(input())
M = map(int,input())
for i in range(M):
    red.append(input())
blue_list = Counter(blue)
red_list = Counter(red)
b = max(blue_list)
c=min(red_list)
print(blue_list[b] - red_list[c])

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input())
s = Counter(int)
for _ in n:
    word = str(input())
    s[word] += 1
m = int(input())
for _ in m:
    word = str(input())
    if word in s.keys():
        s[word] -= 1
ans = s.most_common(1)
print(ans[1])

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input())
s = Counter(int)
for _ in n:
    word = str(input())
    s[word] += 1
m = int(input())
for _ in m:
    word = str(input())
    if word in s.keys():
        s[word] -= 1
print(s.most_common(1)[1])

Submission status: Runtime Error

Solution code:
n = int(input())
nlist = [input() for i in range(n)]
m = int(input())
mlist = [input() for i in range(m)]

for i in range mlist:
    if i in nlist:
        nlist.remove(i)

def maxCOUNT( lis ):
  '''
  与えられたリストの中に、最も多く存在する要素を返す
  (最大の数の要素が複数ある場合、pythonのsetで先頭により近い要素を返す)
  '''
  L = lis[:]#copy
  S = set(lis)
  S = list(S)
  MaxCount=0

  for elem in S:
    c=0
    while elem in L:
      ind = L.index(elem)
      foo = L.pop(ind)
      c+=1
    if c>MaxCount:
      MaxCount=c
  return MaxCount

print(maxCOUNT(nlist))

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input())
s = Counter(int)
for _ in n:
    word = str(input())
    s[word] += 1
m = int(input())
for _ in m:
    word = str(input())
    if word in s.keys():
        s[word] -= 1
print(s.most_common(1))

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input())
s, t = Counter(int)
for _ in n:
    word = str(input())
    s[word] += 1
m = int(input())
for _ in m:
    word = str(input())
    s[word] -= 1
print(s.most_common(1))

Submission status: Runtime Error

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(plus.max())

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input())
s, t = Counter(int)
for _ in n:
    word = input()
    s[word] += 1
m = int(input())
for _ in m:
    word = input()
    s[word] -= 1
print(s.most_common(1))

Submission status: Runtime Error

Solution code:
blue = []
red = []
N = int(input())
for card in range(N):
    blue.append(input())
M = int(input())
for card in range(M):
    red.append(input())

s = input()
prize = blue.count(s) - red.count(s)
print(prize)

Submission status: Runtime Error

Solution code:
import sys
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    dic = {}
    for i in range(N):
        input_raw = read_func().strip().split()
        if input_raw[0] in dic:
            dic[input_raw[0]] += 1
        else:
            dic[input_raw[0]] = 1
    input_raw = read_func().strip().split()
    [M] = [int(input_raw[0])]
    for i in range(N):
        input_raw = read_func().strip().split()
        if input_raw[0] in dic:
            dic[input_raw[0]] -= 1

    print max(max(dic.values()), 0)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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(n):
    a=input()
    if a in d:
        d[a]-=1
    else:
        d[a]=-1
print(max(d.values()))

Submission status: Runtime Error

Solution code:
blue = []
red = []
N = int(input())
for card in range(N):
    blue.append(input())
M = int(input())
for card in range(M):
    red.append(input())

prize = 0
s = input()
for n in blue:
    if s == n:
        prize +=1
for m in red:
    if s == m:
        prize -=1
print(prize)