qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
s_set = list(set(s))
t_set = list(set(t))
check_list = []
for i in s_set:
    check_list.append(s.count(i) - t.count(i))
print(max(check_list))

Fixed code:
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
s_set = list(set(s))
t_set = list(set(t))
check_list = []
for i in s_set:
    check_list.append(s.count(i) - t.count(i))
print(max(max(check_list), 0))
Buggy code:
from collections import Counter

N=int(input())
A=[input() for _ in range(N)]

M=int(input())
B=[input() for _ in range(M)]

a=Counter(A)
b=Counter(B)

ans=0
for p in A:
    print(p)
    ans=max(ans,a[p]-b[p])
    
print(ans)

Fixed code:
from collections import Counter

N=int(input())
A=[input() for _ in range(N)]

M=int(input())
B=[input() for _ in range(M)]

a=Counter(A)
b=Counter(B)

ans=0
for p in A:
    ans=max(ans,a[p]-b[p])
    
print(ans)
Buggy code:
# B - Two Colors Card Game
from collections import Counter
n = int(input())
n_dict = {}
for _ in range(n):
    ns = str(input())
    if ns not in n_dict.keys():
        n_dict[ns] = 1
    else:
        n_dict[ns] += 1

m = int(input()
m_dict = {}
for _ in range(n):
    ms = str(input())
    if ms not in m_dict.keys():
        n_dict[ms] = 1
    else:
        n_dict[ms] += 1

delta = dict(Counter(n_dict) - Counter(m_dict))
ans = max(delta.values())
print(ans)

Fixed code:
# B - Two Colors Card Game
from collections import Counter
n = int(input())
n_dict = {}
for _ in range(n):
    ns = str(input().split())
    if ns not in n_dict.keys():
        n_dict[ns] = 1
    else:
        n_dict[ns] += 1

m = int(input())
m_dict = {}
for _ in range(m):
    ms = str(input().split())
    if ms not in m_dict.keys():
        m_dict[ms] = 1
    else:
        m_dict[ms] += 1

delta = dict(Counter(n_dict) - Counter(m_dict))
if len(delta)>0:
  ans = max(delta.values())
else:
  ans = 0
print(ans)
Buggy 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())
    
cnt = {}

for S in s:
    if S not in cnt.keys():
        cnt[S] = 1
    else:
        cnt[S] += 1

for T in t:
    if T not in cnt.keys():
        cnt[T] = -1
    else:
        cnt[T] -= 1
        
print(max(cnt.values()))

Fixed 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())
    
cnt = {}

for S in s:
    if S not in cnt.keys():
        cnt[S] = 1
    else:
        cnt[S] += 1

for T in t:
    if T not in cnt.keys():
        cnt[T] = -1
    else:
        cnt[T] -= 1
        
if max(cnt.values()) < 0:
    print(0)
else:
    print(max(cnt.values()))
Buggy code:
s = [input() for _ in range(int(input()))]
t = [input() for _ in range(int(Input()))]

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

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

print(max(0,max(s.count(s[i]) - t.count(s[i]) for i in range(len(s)))))
Buggy code:
#abc091 b
n=int(input())
card=dict()
for i in range(n):
    s=input()
    if s not in card:
        card[s]=1
    else:
        card[s]+=1
m=int(input())
for i in range(m):
    t=input()
    if t not in card:
        card[t]=-1
    else:
        card[t]-=1
ans=-m

for i in card.values():
    ans=max(ans,i)
print(ans)


Fixed code:
#abc091 b
n=int(input())
card=dict()
for i in range(n):
    s=input()
    if s not in card:
        card[s]=1
    else:
        card[s]+=1
m=int(input())
for i in range(m):
    t=input()
    if t not in card:
        card[t]=-1
    else:
        card[t]-=1
ans=-m

for i in card.values():
    ans=max(ans,i,0)
print(ans)
Buggy code:
#091_B
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]

res=0
for S in set(s):
    res+=max(0,s.count(S)-t.count(S))
print(res)

Fixed code:
#091_B
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]

res=0
for S in set(s):
    res=max(res,s.count(S)-t.count(S))
print(res)
Buggy code:
n = int(input())
sL = [input() for i in range(n)]
m = int(input())
tL = [input() for i in range(m)]
L = list(set(sL))
maxnum = 0
for i in range(len(L)):
    num = max(0, max(sL.count(L[i])-tL.count(L[i])))
    if num > maxnum:
        maxnum = num
print(maxnum)

Fixed code:
n = int(input())
sL = [input() for i in range(n)]
m = int(input())
tL = [input() for i in range(m)]
L = list(set(sL))
maxnum = 0
for i in range(len(L)):
    num = max(0, sL.count(L[i])-tL.count(L[i]))
    if num > maxnum:
        maxnum = num
print(maxnum)
Buggy code:

n = int(input())
ss = [input() for _ in range(n)]
m = int(input())
tt = [input() for _ in range(n)]

res = 0
for u in ss:
    tmp = ss.count(u) - tt.count(u)
    res = max(res, tmp)
print(res)


Fixed code:

n = int(input())
ss = [input() for _ in range(n)]
m = int(input())
tt = [input() for _ in range(m)]

res = 0
for u in ss:
    tmp = ss.count(u) - tt.count(u)
    res = max(res, tmp)
print(res)
Buggy code:
from collections import defaultdict

b = defaultdict(int)
r = defaultdict(int)

n = int(input())
for i in range(n):
    b[input()] += 1
m = int(input())
for i in range(m):
    r[input()] += 1
print(b)
print(b.items())

ans = 0
for k, v in b.items():
    ans = max(ans, v - r[k])
print(ans)


Fixed code:
from collections import defaultdict

b = defaultdict(int)
r = defaultdict(int)

n = int(input())
for i in range(n):
    b[input()] += 1
m = int(input())
for i in range(m):
    r[input()] += 1
ans = 0
for k, v in b.items():
    ans = max(ans, v - r[k])
print(ans)
Buggy code:

nN = int(input())

sListA = []
nListA = [ 0 for i in range(nN)]

for i in range(nN):
  sTmp = input()
  if sTmp in sListA:
    nTmp = sListA.index(sTmp)
    nListA[nTmp] += 1
  else:
    sListA.append(sTmp)
    nTmp = sListA.index(sTmp)
    nListA[nTmp] += 1

    
nN = int(input())
sListB = []
nListB = [ 0 for i in range(nN)]

for i in range(nN):
  sTmp = input()
  if sTmp in sListA:
    nTmp = sListA.index(sTmp)
    nListB[nTmp] -= 1

nMax =max(nListA)
print(nListA)


Fixed code:
nN = int(input())
 
sListA = []
nListA = [ 0 for i in range(202)]
 
for i in range(nN):
  sTmp = input()
  if sTmp in sListA:
    nTmp = sListA.index(sTmp)
    nListA[nTmp] += 1
  else:
    sListA.append(sTmp)
    nTmp = sListA.index(sTmp)
    nListA[nTmp] += 1
 
    
nN = int(input())
sListB = []
nListB = [ 0 for i in range(nN)]
 
for i in range(nN):
  sTmp = input()
  if sTmp in sListA:
    nTmp = sListA.index(sTmp)
    nListA[nTmp] -= 1
  else:
    sListA.append(sTmp)
    nTmp = sListA.index(sTmp)
    nListA[nTmp] -= 1
 
nMax = max(nListA)
# print(sListA)
print(nMax)
Buggy 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()))

Fixed 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(max(d.values()), 0))
Buggy code:
import collections
n_co = collections.Counter()
m_co = collections.Counter()

n = int(input())

for i in range(n):
	ni = input()
	n_co[ni] += 1

m = int(input())

for j in range(m):
	mi = input()
	m_co[mi] += 1

ans = (n_co - m_co).most_common(1)

print(ans[0][1])

Fixed code:
import collections
n_co = collections.Counter()
m_co = collections.Counter()

n = int(input())

for i in range(n):
	ni = input()
	n_co[ni] += 1

m = int(input())

for j in range(m):
	mi = input()
	m_co[mi] += 1

ans = (n_co - m_co)

if len(ans) == 0:
	print(0)
else:
	ans = ans.most_common(1)
	print(ans[0][1])
Buggy code:
N=int(input())
A=[]
for i in range(N):
  A.append(input())
K=int(input())

for i in range(K):
  s=input()
  if s in A==1:
    A.remove(s)
B=set(A)
ans=0
for i in B:
  if A.count(i)>ans:
    ans=A.count(i)
print(ans)

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

K=int(input())
for i in range(K):
  s=input()
  if (str(s) in A)==1:
    A.remove(s)
B=set(A)
ans=0
for i in B:
  if A.count(i)>ans:
    ans=A.count(i)
print(ans)
Buggy code:
N = int(input())
s = [input() for _ in range(N)]
M = int(input())
t = [input() for _ in range(M)]

set_s = list(set(s))
print( max(s.count(set_s[i])-t.count(set_s[i]) for i in range(len(set_s)))) 

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

set_s = list(set(s))
print( max(0,max(s.count(set_s[i])-t.count(set_s[i]) for i in range(len(set_s)))) )
Buggy code:
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(blues, reds):
    blue_counts = {}
    red_counts = {}

    for b in blues:
        if b not in blue_counts:
            blue_counts[b] = 1
        else:
            blue_counts[b] += 1

    for r in reds:
        if r not in red_counts:
            red_counts[r] = 1
        else:
            red_counts[r] += 1

    max_count = 0
    for name, c in blue_counts.items():
        if name in red_counts:
            max_count = max(max_count, c - red_counts[name])
        else:
            max_count = max(max_count, c)
    return max_count


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [N] = string_to_int(inputs())
    blues = inputs(N)
    [M] = string_to_int(inputs())
    reds = inputs(M)
    ret = solve(blues, reds)
    print(ret)


Fixed code:
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(blues, reds):
    blue_counts = {}
    red_counts = {}

    for b in blues:
        if b not in blue_counts:
            blue_counts[b] = 1
        else:
            blue_counts[b] += 1

    for r in reds:
        if r not in red_counts:
            red_counts[r] = 1
        else:
            red_counts[r] += 1

    max_count = 0
    for name, c in blue_counts.items():
        if name in red_counts:
            max_count = max(max_count, c - red_counts[name])
        else:
            max_count = max(max_count, c)
    return max_count


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [N] = string_to_int(input())
    blues = inputs(N)
    [M] = string_to_int(input())
    reds = inputs(M)
    ret = solve(blues, reds)
    print(ret)
Buggy code:
d={}
for _ in [0]*int(input()):
    s=input()
    d[s]=d.get(s,0)+1
for _ in [0]*int(input()):
    s=input()
    d[s]=d.get(s,0)-1
print(sorted(d.items(), key=lambda x: x[1])[-1][0])

Fixed code:
d={}
for _ in [0]*int(input()):
    s=input()
    d[s]=d.get(s,0)+1
for _ in [0]*int(input()):
    s=input()
    d[s]=d.get(s,0)-1
print(max(sorted(d.items(), key=lambda x: x[1])[-1][1],0))
Buggy code:
import sys
input = lambda: sys.stdin.readline().rstrip()
n=int(input())
a=[] ; b=[]
for _ in range(n):
    a.append(input())
m=int(input())
for _ in range(m):
    b.append(input())
from collections import Counter
a=Counter(a)
b=Counter(b)
for i in b:
    if i in a:
        a[i]-=b[i]
print(max(a.values()))
        


Fixed code:
import sys
input = lambda: sys.stdin.readline().rstrip()
n=int(input())
a=[] ; b=[]
for _ in range(n):
    a.append(input())
m=int(input())
for _ in range(m):
    b.append(input())
from collections import Counter
a=Counter(a)
b=Counter(b)
for i in b:
    if i in a:
        a[i]=max(0,a[i]-b[i])
print(max(a.values()))
Buggy code:
N = int(input())
s = {}
for i in range(N):
  a = input()
  if a in s:
    s[a] += 1
  else:
    s[a] = 1
M = int(input())
t = {}
for i in range(M):
  b = input()
  if b in t:
    t[b] += 1
  else:
    t[b] = 1
ans = 0
for p in s:
  if p in t:
    m = s[p] - t[p]
  else:
    m = s[p]
  if m > n:
    ans = m
print(ans)
  

Fixed code:
N = int(input())
s = {}
for i in range(N):
  a = input()
  if a in s:
    s[a] += 1
  else:
    s[a] = 1
M = int(input())
t = {}
for i in range(M):
  b = input()
  if b in t:
    t[b] += 1
  else:
    t[b] = 1
ans = 0
for p in s:
  if p in t:
    m = s[p] - t[p]
  else:
    m = s[p]
  if m > ans:
    ans = m
print(ans)
Buggy code:
d = {}
n = int(input())
for _ in range(n):
    e = input()
    if e not in d:
        d[e] = 1
    else:
        d[e] += 1
m = int(input())
for _ in range(m):
    e = input()
    if e not in d:
        d[e] = -1
    else:
        d[e] -= 1

print(max(d.values()))


Fixed code:
d = {}
n = int(input())
for _ in range(n):
    e = input()
    if e not in d:
        d[e] = 1
    else:
        d[e] += 1
m = int(input())
for _ in range(m):
    e = input()
    if e not in d:
        d[e] = -1
    else:
        d[e] -= 1

print(max(max(d.values()), 0))
Buggy code:
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for j in range(m)]
d=set(s+t)
cnt=[]
for k in d:
  score=0
  p=s.count(k)
  m=t.count(k)
  score=p-m
  cnt.append(score)
print(max(cnt))

Fixed code:
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for j in range(m)]
d=set(s+t)
cnt=[0]
for k in d:
  score=0
  p=s.count(k)
  m=t.count(k)
  score=p-m
  if score>0:
    cnt.append(score)
print(max(cnt))
Buggy 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))

Fixed 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(max(d.values()),0))
Buggy code:
# B
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

ans = 0
for ss in s:
    score = s.count(ss) - t.count(s)
    if ans < score:
        ans = score
print(ans)

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

ans = 0
for ss in s:
    score = s.count(ss) - t.count(ss)
    if ans < score:
        ans = score
print(ans)
Buggy 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))

Fixed code:
N = int(input())
a = [input() for i in range(N)]
M = int(input())
b = [input() for i in range(M)]
 
k = [0]
 
for x in a:
  temp = a.count(x)-b.count(x)
  k.append(temp)
for y in b:
  temp = a.count(y)-b.count(y)
  k.append(temp)
print(max(k))
Buggy 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())

Fixed code:
#coding:utf-8
n = int(input())
blue = []
plus = []
for i in range(n):
    s = input()
    if s in blue:
        plus[blue.index(s)] += 1
    else:
        blue.append(s)
        plus.append(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.append(-1)
print(max(0, max(plus)))
Buggy code:
b=int(input())
a=[for i in range(b)]
r=int(input())
c=[for i in range(r)]
cnt=0
for i in range(b):
  cnt=max(cnt,a.count(a[i])-c.count(a[i]))
print(cnt)

Fixed code:
b=int(input())
a=[input() for i in range(b)]
r=int(input())
c=[input() for i in range(r)]
cnt=0
for i in range(b):
  cnt=max(cnt,a.count(a[i])-c.count(a[i]))
print(cnt)
Buggy 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))

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

if c:
  print(max(c[0][1], 0))
else:
  print(0)
Buggy code:
from collections import Counter

n = int(input())
s = [None] * n
for i in range(n):
    s[i] = input().rstrip()

m = int(input())
t = [None] * m
for i in range(m):
    t[i] = input().rstrip()

ctr = Counter(s) - Counter(t)
if ctr:
    print(ctr.most_common(1)[0][0])
else:
    print(0)

Fixed code:
from collections import Counter

n = int(input())
s = [None] * n
for i in range(n):
    s[i] = input().rstrip()

m = int(input())
t = [None] * m
for i in range(m):
    t[i] = input().rstrip()

ctr = Counter(s) - Counter(t)
if ctr:
    print(ctr.most_common(1)[0][1])
else:
    print(0)
Buggy 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 s:
  ans=(max(ans, s.count(i))- t.count(i))
print(ans)

Fixed 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 s:
  ans=max(ans, s.count(i)- t.count(i))
print(ans)
Buggy code:
n=int(input())
s=[]
for x in range(n):
    s.append(input())
m=int(input())
t=[]
for y in range(m):
    t.append(input())
m=0
for i in range(n):
    v=s[i]
    c=0
    for k in range(i,n):
        if v==s[k]:
            c+=1
    for j in range(m):
        if v==t[j]:
            c-=1
    if c>m:
        m=c
print(m)

Fixed code:
n=int(input())
s=[]
for x in range(n):
    s.append(input())
m=int(input())
t=[]
for y in range(m):
    t.append(input())
q=0
for i in range(n):
    v=s[i]
    c=0
    for k in range(i,n):
        if v==s[k]:
            c+=1
    for j in range(m):
        if v==t[j]:
            c-=1
    if c>q:
        q=c
print(q)
Buggy code:
def solve(string):
    count = dict([])
    n, *rest = string.split()
    n = int(n)
    blues = rest[:n]
    m = rest[n]
    reds = rest[n + 1:]
    for key in blues:
        if key in count:
            count[key] += 1
        else:
            count[key] = 1
    for key in reds:
        if key in count:
            count[key] -= 1
        else:
            count[key] = -1
    num = 0
    for k, v in count.items():
        if num < v:
            num = v
    return str(num)


if __name__ == '__main__':
    n = int(input())
    ins = '{}\n'.format(n) + '\n'.join([input() for _ in range(n)])
    m = int(input())
    print(solve(ins + '{}\n'.format(m) + '\n'.join([input() for _ in range(m)])))


Fixed code:
def solve(string):
    count = dict([])
    n, *rest = string.split()
    n = int(n)
    blues = rest[:n]
    m = rest[n]
    reds = rest[n + 1:]
    for key in blues:
        if key in count:
            count[key] += 1
        else:
            count[key] = 1
    for key in reds:
        if key in count:
            count[key] -= 1
        else:
            count[key] = -1
    num = 0
    for k, v in count.items():
        if num < v:
            num = v
    return str(num)


if __name__ == '__main__':
    n = int(input())
    ins = '{}\n'.format(n) + '\n'.join([input() for _ in range(n)])
    m = int(input())
    print(solve(ins + '\n{}\n'.format(m) + '\n'.join([input() for _ in range(m)])))
Buggy code:
N=int(input())
s=[int(input()) for _ in range(N)]
M=int(input())
t=[int(input()) for _ in range(M)]
l=set(s)
List=[s.count(l[i])-t.count(l[i]) for i in range(len(l))]
print(max(0,max(List)))

Fixed code:
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(s))
List=[s.count(l[i])-t.count(l[i]) for i in range(len(l))]
print(max(0,max(List)))
Buggy code:
n = int(input())
s, t = [],[]
for _ in range(n):
    s.append(input())
s_dict = {s_:0 for s_ in s}
m = int(input())
for _ in range(m):
    t.append(input())
t_dict = {t_:0 for t_ in t}
for i in range(n):
    s_dict[s[i]] += 1
for i in range(m):
    t_dict[t[i]] += 1
    
for i in s_dict:
    if i in t_dict:
        s_dict[i] -= t_dict[i]
        
max(s_dict.values())

Fixed code:
n = int(input())
s, t = [],[]
for _ in range(n):
    s.append(input())
s_dict = {s_:0 for s_ in s}
s_dict['aaaaaaaaaaa'] = 0
m = int(input())
for _ in range(m):
    t.append(input())
t_dict = {t_:0 for t_ in t}
for i in range(n):
    s_dict[s[i]] += 1
for i in range(m):
    t_dict[t[i]] += 1
    
for i in s_dict:
    if i in t_dict:
        s_dict[i] -= t_dict[i]
        
print(max(s_dict.values()))
Buggy code:
N = int( input())
s = [ input() for i in range(N)]
M = int(input())
t = [ input() for j in rangwe(M)]

judge = 0
for l in range(N):
  money = s.count(s[l]) - t.count(s[l])
  
  if( judge < money):
    judge = money
  
  else:
    continue
    
print(judge)

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

judge = 0
for l in range(N):
  money = s.count(s[l]) - t.count(s[l])
  
  if( judge < money):
    judge = money
  
  else:
    continue
    
print(judge)
Buggy code:
in_num = input()
in_data=[]
for i in range(0,int(in_num)):
  in_data.append(input())
  
out_num = input()

out_data = []

for i in range(0,int(out_num)):
  out_data.append(input())

max_count=0
for n in in_data:
  tmp = out_data.count(n)
  if tmp > max_count:
    max_count = tmp
    
print(max_count)

Fixed code:
in_num = input()
in_data=[]
for i in range(0,int(in_num)):
  in_data.append(input())
  
out_num = input()

out_data = []

for i in range(0,int(out_num)):
  out_data.append(input())

max_count=0
for n in in_data:
  tmp = in_data.count(n) - out_data.count(n)
  if tmp > max_count:
    max_count = tmp
    
print(max_count)
Buggy 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))

Fixed 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)
x = list(S)
a=[0]*(L+1)
for i in range(L):
    a[i]=s.count(x[i])-t.count(x[i])
print(max(a))
Buggy code:
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

s = set(s)
tot = 0
for i in s:
  res = s.count(i) - t.count(i)
  tot = max(res,tot)
  
print(tot)


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

k = set(s)
tot = 0
for i in k:
  tot = max(s.count(i) - t.count(i),tot)
  
print(tot)
Buggy 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()))

Fixed 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]
ans_max = max(ans.values())
print(max(0, ans_max))
Buggy code:
n = int(input())
ls_s = [input() for _ in range(n)]
m = int(input())
ls_t = [input() for _ in range(m)]

ls_u =ls_s + ls_t
p = m + n 

ans = 0

for i in range(n):
    cnt = 0
    for j in range(p):
        if ls_u[i] == ls_u[j] and j < n - 1:
            cnt += 1
        elif ls_u[i] == ls_u[j] and n - 1 <= j:
            cnt += -1
    if cnt >= ans:
        ans = cnt

print(ans)

Fixed code:
n = int(input())
ls_s = [input() for _ in range(n)]
m = int(input())
ls_t = [input() for _ in range(m)]

ls_u =ls_s + ls_t
p = m + n 

ans = 0


for i in range(n):
    cnt = 0
    for j in range(p):
        if ls_u[i] == ls_u[j] and j <= n - 1:
            cnt += 1
        elif ls_u[i] == ls_u[j] and n - 1 < j:
            cnt += -1
    if cnt >= ans:
        ans = cnt

print(ans)
Buggy code:
from collections import Counter

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

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

c1 = Counter(s)
c2 = Counter(t)
print(max(v - c2[i] for i, v in c1.most_common()))


Fixed code:
from collections import Counter

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

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

c1 = Counter(s)
c2 = Counter(t)
ans = max(v - c2[i] for i, v in c1.most_common())
print(max(0, ans))