ZhenlongDai/ACPR huggingface dataset:
Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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, n.count(n[i-1])-m.count(n[i-1])))


Failing test case input:
3
appme
prange
apple
0
grape

Expected output:
1


Actual output:
1
1
1


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

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]
l=list( set(s) )
maxbox=[]
for i in range( len(l) ):
    maxbox.append( int( s.count(l[i])-t.count(l[i]) ) ) 
print(max(maxbox),0)

Failing test case input:
1
voldemort
7
vnledmort
vpldemort
vnldemort
dolvemort
uomdelort
tromedlov
woleetorm
loledvort
volremodt
voldemosu

Expected output:
1


Actual output:
1 0


Fixed submission (verdict: Accepted):
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]
l=list( set(s) )
maxbox=[]
for i in range( len(l) ):
    maxbox.append( int( s.count(l[i])-t.count(l[i]) ) ) 
maxbox.append(0)
print(max(maxbox))

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]
print(max([s.count(s[i]) - t.count(s[i]) for i in range(len(s))]))


Failing test case input:
1
voldemort
7
vnledmort
voldemort
tromedlnv
dolvemort
uomdelort
voldemort
woleetorm
loledvort
tdomerlov
voldemosu

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]
tmp=max([s.count(s[i]) - t.count(s[i]) for i in range(len(s))])
print(max(tmp,0))

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()))

Failing test case input:
1
voldemort
8
vnledmort
voldemort
tromedlnv
voldemort
uoldemort
voldemort
woleetorm
voleelort
tromedlov
voldemoru

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
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
ans = max(b.values())
if max(b.values()) < 0:
    ans = 0

print(ans)
Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)


Failing test case input:
3
appme
prange
apple
0
grape

Expected output:
1


Actual output:
defaultdict(<class 'int'>, {'appme': 1, 'prange': 1, 'apple': 1})
dict_items([('appme', 1), ('prange', 1), ('apple', 1)])
1


Fixed submission (verdict: Accepted):
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)

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
import sys

N = int(input())
S = [input() for i in range(N)]

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

words_count = {}
for i in range(N):
    words_count[S[i]] = words_count.get(S[i], 0) + 1

for i in range(M):
    words_count[T[i]] = words_count.get(T[i], 0) - 1

print(max(words_count.values()))


Failing test case input:
1
voldemort
10
vnldemort
voldemort
tromedlov
voldemort
uoldemort
voldemort
voldemort
voleemort
tromedlov
voldemort

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
from sys import stdin
import sys

N = int(input())
S = [input() for i in range(N)]

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

words_count = {}
for i in range(N):
    words_count[S[i]] = words_count.get(S[i], 0) + 1

for i in range(M):
    words_count[T[i]] = words_count.get(T[i], 0) - 1

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

Problem: p03408
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

ans_list = []
for s in S:
  ans = 0
  ans += S.count(s)
  ans -= T.count(s)
  ans_list.append(ans)

print(max(ans_list))

Failing test case input:
1
voldemort
10
vnledmort
voldemort
tromedlov
voldemort
uoldemort
voldemort
voldemort
voleelort
tromedlov
voldemort

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

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

print(ans)
Problem: p03408
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]
dict={}

for i in s:
  if i not in dict.keys():
    dict[i]=1
  else:
    dict[i]+=1
for j in t:
  if j in s:
    dict[j]-=1
print(max(dict.values()))

Failing test case input:
1
voldemort
10
vnldemort
voldemort
voldemort
voldemort
uoldemort
voldemort
voldemort
voleemort
tromedlov
voldemort

Expected output:
0


Actual output:
-5


Fixed submission (verdict: Accepted):
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]
dict={}

for i in s:
  if i not in dict.keys():
    dict[i]=1
  else:
    dict[i]+=1
for j in t:
  if j in s:
    dict[j]-=1
m=max(dict.values())
print(m if m>0 else "0")

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
ss=set(s)
ans = [1]
for i in ss:
  ans.append(s.count(i)-t.count(i))
print(max(ans))

Failing test case input:
1
voldemort
10
voldemort
voldemort
voldemort
voldemort
uoldemort
voldemort
voldemort
voleemort
voldemort
voldemort

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
ss=set(s)
ans = [0]
for i in ss:
  ans.append(s.count(i)-t.count(i))
print(max(ans))

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
s_list = [input() for _ in range(N)]
M = int(input())
t_list = [input() for _ in range(M)]

s_set = list(set(s_list))
result = []
for s in s_set:
    r = 0
    for i in s_list:
        if i == s:
            r += 1
    for j in t_list:
        if j == s:
            r -= 1
    result.append(r)
print(max(result))


Failing test case input:
1
voldemort
7
vnledmort
voldemort
tromedlnv
dolvemort
uoldemort
voldemort
woleetorm
voleelort
tdomerlov
voldemoru

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
s_list = [input() for _ in range(N)]
M = int(input())
t_list = [input() for _ in range(M)]
tmp = s_list.copy()
tmp.append("fdsfsdfsfs")
s_set = list(set(tmp))
result = []
for s in s_set:
    r = 0
    for i in s_list:
        if i == s:
            r += 1
    for j in t_list:
        if j == s:
            r -= 1
    result.append(r)
print(max(result))
Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
d ={}
for i in range(N):
  s = input()
  if s in d:
    d[s] += 1
  else:
    d[s] = 1
M = int(input())
for j in range(M):
  a = input()
  if a in d:
    d[a] -= 1
  else:
    d[a] = -1
li = d.values()
print(max(li))

Failing test case input:
1
voldemort
7
vnledmort
voldemort
vnldemort
dolvemort
uomdelort
voldemort
woleetorm
loledvort
volremodt
voldemosu

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
d ={}
for i in range(N):
  s = input()
  if s in d:
    d[s] += 1
  else:
    d[s] = 1
M = int(input())
for j in range(M):
  a = input()
  if a in d:
    d[a] -= 1
  else:
    d[a] = -1
li = d.values()
print(max(li) if max(li) >= 0 else 0)

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
ans = -M
for i in range(N):
    ans = max(ans, s.count(s[i])-t.count(s[i]))
print(ans)

Failing test case input:
1
voldemort
10
vnledmort
voldemort
tromedlnv
voldemort
uoldemort
voldemort
voleemort
voleelort
tromedlov
voldemort

Expected output:
0


Actual output:
-3


Fixed submission (verdict: Accepted):
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 range(N):
    ans = max(ans, s.count(s[i])-t.count(s[i]))
print(ans)

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
3
apole
orange
lppae
5
afplp
apple
apple
apple
apple

Expected output:
1


Actual output:
apole
orange
lppae
1


Fixed submission (verdict: Accepted):
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)
Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter, defaultdict


def solve():
    N = int(input())
    
    A = [input() for _ in range(N)]
    count_A = Counter(A)
    
    M = int(input())
    B = [input() for _ in range(M)]
    count_B = Counter(B)
    for k,v in count_B.items():
        if k in count_A:
            count_A[k] -= v
    
    print(count_A.most_common()[0][1])
    
solve()

Failing test case input:
1
voldemort
8
vnledmort
voldemort
tromedlnv
voldemort
uoldemort
voldemort
woleetorm
voleelort
tromedlov
voldemort

Expected output:
0


Actual output:
-2


Fixed submission (verdict: Accepted):
from collections import Counter, defaultdict


def solve():
    N = int(input())
    
    A = [input() for _ in range(N)]
    count_A = Counter(A)
    
    M = int(input())
    B = [input() for _ in range(M)]
    count_B = Counter(B)
    for k,v in count_B.items():
        if k in count_A:
            count_A[k] -= v
    
    ret = count_A.most_common()[0][1]
    print(max(ret,0))
    
solve()

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = [str(input()) for i in range(n)]
m = int(input())
t = [str(input()) for j in range(m)]
words = list(set(s + t))
if len(words) == 1:
    print(max([len(s)-len(t), 0]))
else:
    print(max(s.count(words[i]) - t.count(words[i]) for i in range(len(words))))

Failing test case input:
1
voldemort
10
voldemort
voldemort
voldemort
voldemort
uoldemort
voldemort
voldemort
voldemort
voldemort
voldemort

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
s = [str(input()) for i in range(n)]
m = int(input())
t = [str(input()) for j in range(m)]
words = list(set(s + t))
print(max([max(s.count(words[i]) - t.count(words[i]) for i in range(len(words))), 0]))

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
3
apole
orange
lppae
5
plpfa
apple
apple
apple
apple

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
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
for i in range(N):
    res=max(res, s.count(s[i])-t.count(s[i]))
print(res)
Problem: p03408
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import collections
n = int(input())
s = [str(input()) for _ in range(n)]
m = int(input())
t = [str(input()) for _ in range(m)]
s = collections.Counter(s)
t = collections.Counter(t)

for k, j in t.items():
    if k in s:
        s[k] -= j

values, counts = zip(*s.most_common())
print(counts[0])


Failing test case input:
1
voldemort
7
vnledmort
voldemort
tromedlnv
dolvemort
uoldemort
voldemort
woleetorm
voleelort
tdomerlov
voldemoru

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
import collections
n = int(input())
s = [str(input()) for _ in range(n)]
m = int(input())
t = [str(input()) for _ in range(m)]
s = collections.Counter(s)
t = collections.Counter(t)

for k, j in t.items():
    if k in s:
        s[k] -= j

values, counts = zip(*s.most_common())
print(max(0,counts[0]))

Problem: p03408
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
s = [input().split() for _ in range(n)]
m = int(input())
t = [input().split() for _ in range(m)]
ans = -100
for i in s:
    ans = max(ans,s.count(i) - t.count(i))
print(ans)

Failing test case input:
1
voldemort
7
vnledmort
voldemort
tromedlnv
dolvemort
uoldemort
voldemort
woleetorm
loleevort
tdomerlov
voldemosu

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
s = [input().split() for _ in range(n)]
m = int(input())
t = [input().split() for _ in range(m)]
ans = -100
for i in s:
    ans = max(ans,s.count(i) - t.count(i))
if ans < 0:
    ans = 0
print(ans)

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
h={};
for i in[1,-1]:
    for _ in range(int(input())):
        s=input()
        if s in h:h[s]+=i
        else:h[s]=i
print(max(h.values()))

Failing test case input:
1
voldemort
10
vnledmort
voldemort
tromedlov
voldemort
uoldemort
voldemort
voldemort
voleelort
tromedlov
voldemort

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
h={"":0};
for i in[1,-1]:
    for _ in range(int(input())):
        s=input()
        if s in h:h[s]+=i
        else:h[s]=i
print(max(h.values()))

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
b=[input()for _ in range(n)]
m=int(input())
r=[input()for _ in range(m)]
c=[b.count(l)-r.count(l)for l in set(b)]
print(max(c))

Failing test case input:
1
voldemort
10
vnledmort
voldemort
tromedlov
voldemort
uoldemort
voldemort
voldemort
voleelort
tromedlov
voldemort

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
n=int(input())
b=[input()for _ in range(n)]
d={l:b.count(l)for l in set(b)}
m=int(input())
for _ in range(m):
  s=input()
  if s in d.keys():
    d[s]-=1
print(max(list(d.values())+[0]))
Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=int(input())
b,d,e=[],[],[]
for i in range(a):
    b.append(str(input()))
c=int(input())
up,down=0,0
for j in range(c):
    d.append(str(input()))
for k in set(b):
    up+=b.count(k)
    down+=d.count(k)
    e.append(up-down)
    up,down=0,0
print(max(e))

Failing test case input:
1
voldemort
10
vnledmort
voldemort
tromedlov
voldemort
uoldemort
voldemort
voldemort
voleemort
tromedlov
voldemort

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
a=int(input())
b,d,e=[],[],[0]
for i in range(a):
    b.append(str(input()))
c=int(input())
up,down=0,0
for j in range(c):
    d.append(str(input()))
for k in set(b):
    up+=b.count(k)
    down+=d.count(k)
    e.append(up-down)
    up,down=0,0
print(max(e))

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n=int(input())
s=[]
for _ in range(n):
	s.append(input())
c=collections.Counter(s)
m=int(input())
for _ in range(m):
	t=input()
	c[t] -= 1
print(max(c.values()))

Failing test case input:
1
voldemort
10
vnledmort
voldemort
tromedlov
voldemort
uoldemort
voldemort
voldemort
voleelort
tromedlov
voldemort

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
import collections
n=int(input())
s=[]
for _ in range(n):
	s.append(input())
c=collections.Counter(s)
m=int(input())
for _ in range(m):
	t=input()
	c[t] -= 1
if max(c.values()) >= 0:
	print(max(c.values()))
else:
	print(0)

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
ans={}
n=int(input())
for i in range(n):
    a = input()
    if a in ans:
        ans[a]+=1
    else:
        ans[a] = 1
m=int(input())
for i in range(m):
    a = input()
    if a in ans:
        ans[a]-=1
    else:
        ans[a] = -1
ans = sorted(ans.items(), key=lambda x: x[1], reverse=True)
print(ans[0][1])

Failing test case input:
1
voldemort
7
vnledmort
voldemort
tromedlnv
dolvemort
uoldemort
voldemort
woleetorm
loleevort
tdomerlov
voldemoru

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
ans={}
n=int(input())
for i in range(n):
    a = input()
    if a in ans:
        ans[a]+=1
    else:
        ans[a] = 1
m=int(input())
for i in range(m):
    a = input()
    if a in ans:
        ans[a]-=1
    else:
        ans[a] = -1
ans = sorted(ans.items(), key=lambda x: x[1], reverse=True)
if ans[0][1] < 0:
    print(0)
else:
    print(ans[0][1])
Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict
d = defaultdict(int)

N = int(input())
a = list(input() for i in range(N))
M = int(input())
b = list(input() for i in range(M))

for i in range(N):
  d[str(a[i])] += 1

for i in range(M):
  d[b[i]] -= 1
print(max(d.values()))


Failing test case input:
1
voldemort
10
vnledmort
voldemort
tromedlnv
voldemort
uoldemort
voldemort
voleemort
voleelort
tromedlov
voldemort

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
from collections import defaultdict
d = defaultdict(int)

N = int(input())
a = list(input() for i in range(N))
M = int(input())
b = list(input() for i in range(M))

for i in range(N):
  d[str(a[i])] += 1

for i in range(M):
  d[b[i]] -= 1
print(max(d.values()) if max(d.values()) > 0 else 0)

Problem: p03408
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter
from sys import maxsize


N = int(input())
S = Counter([input() for i in range(N)])
M = int(input())
T = Counter([input() for j in range(M)])


max_cnt = -maxsize
for s in S.keys():
    cnt = S[s]
    if s in T.keys():
        cnt -= T[s]

    if max_cnt < cnt:
        max_cnt = cnt

print(max)


Failing test case input:
3
appme
prange
apple
0
grepa

Expected output:
1


Actual output:
<built-in function max>


Fixed submission (verdict: Accepted):
from collections import Counter


N = int(input())
S = Counter([input() for i in range(N)])
M = int(input())
T = Counter([input() for j in range(M)])


max_cnt = 0
for s in S.keys():
    cnt = S[s]
    if s in T.keys():
        cnt -= T[s]

    if max_cnt < cnt:
        max_cnt = cnt

print(max_cnt)

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]
A = []
B = []
for s in S:
    if s not in A:
        B.append(S.count(s)-T.count(s))
        A.append(s)
print(max(B))

Failing test case input:
1
voldemort
7
vnledmort
voldemort
vnldemort
dolvemort
uomdelort
voldemort
woleetorm
loledvort
tdomerlov
voldemosu

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]
A = []
B = []
for s in S:
    if s not in A:
        B.append(S.count(s)-T.count(s))
        A.append(s)
ans = max(B)
if ans < 0:
  ans = 0
print(ans)
Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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


Failing test case input:
1
voldemort
7
tromdelnv
vpldemort
sromedlnv
tromevdol
troledmov
tmoredlov
wolpeterm
loledvort
tdomerlov
voldemosv

Expected output:
1


Actual output:
['voldemort']
['tromdelnv', 'vpldemort', 'sromedlnv', 'tromevdol', 'troledmov', 'tmoredlov', 'wolpeterm']
['voldemort']
1


Fixed submission (verdict: Accepted):


n1=int(input())
n=[input() for i in range(n1)]
m1=int(input())
m=[input() for i in range(m1)]


l=list(set(n))

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

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)
for y in b:
  temp = a.count(y)-b.count(y)
  k.append(temp)
print(max(k))

Failing test case input:
1
voldemort
10
vnledmort
voldemort
tromedlov
voldemort
uoldemort
voldemort
voldemort
voleelort
tromedlov
voldemort

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
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))

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[]
b=[]
c=[]

for i in range(n):
    a.append(str(input()))
m=int(input())
for s in range(m):
    b.append(str(input()))
for k in range(n):
    c.append(a.count(a[k])-b.count(a[k]))
print(max(c))

Failing test case input:
1
voldemort
8
vnledmort
voldemort
tromedlnv
voldemort
uoldemort
voldemort
woleetorm
voleelort
tromedlov
voldemoru

Expected output:
0


Actual output:
-2


Fixed submission (verdict: Accepted):
n=int(input())
a=[]
b=[]
c=[]

for i in range(n):
    a.append(str(input()))
m=int(input())
for s in range(m):
    b.append(str(input()))
for k in range(n):
    c.append(a.count(a[k])-b.count(a[k]))
for l in range(m):
    c.append(a.count(b[l]) - b.count(b[l]))
c.append(0)
print(max(c))

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = int(input())
b = list(input() for i in range(a))
c = int(input())
d = list(input() for i in range(c))
e = list()

for s in b:
  e.append(b.count(s)-d.count(s))
else:
  print(max(e))

Failing test case input:
1
voldemort
7
vnledmort
voldemort
tromedlnv
dolvemort
uoldemort
voldemort
woleetorm
voleelort
tdomerlov
voldemoru

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
a = int(input())
b = list(input() for i in range(a))
c = int(input())
d = list(input() for i in range(c))
e = [0]

for s in b:
  e.append(b.count(s)-d.count(s))
else:
  print(max(e))
Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
6
red
red
blue
xolely
yellow
red
5
red
ree
yellow
gseen
blue

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
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
for i in range(N):
    res=max(res, s.count(s[i])-t.count(s[i]))
print(res)

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
1
voldemort
10
vnlddmort
voldemort
tromedlov
voldemort
uoldemort
voldemort
voldemort
voleemort
tromedlov
voldemort

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
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<=0:
	print(0)
else:
	print(Max)

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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(sum(table))

Failing test case input:
3
apple
orange
lppae
3
pmpfa
apple
apelp
paple
apple

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
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]
table.append(0)
print(max(table))

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
ans_1=0
ans=""
for S in s:
    ans_1=s.count(S)
    if s.count(S)>=ans_1:
        ans_1=s.count(S)
        ans=S

if ans_1>t.count(ans):
    print(ans_1-t.count(ans))
else :
    print("0")

Failing test case input:
6
rde
red
bluf
xplely
yellow
der
5
der
rdf
yewlom
sgeen
bluf

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
def ans1(x):
    return s.count(x)-t.count(x)
ans2=0
ans_1=0
for S in s:
    if ans1(S)>0 and ans1(S)>ans2:
            ans2=ans1(S)
if ans2>=0:
    print(ans2)
else:
    print("0")
Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n=int(input())
S=[input() for i in range(n)]
S=dict(Counter(S).most_common())
m=int(input())
T=[input() for i in range(m)]
T=dict(Counter(T).most_common())

for i in S:
  for k in T:
    if i==k:
      S[i] -= T[k]

S=sorted(S.items())
print(S[0][1])


Failing test case input:
6
red
red
bluf
ylelox
yellow
der
5
der
rdf
yemlow
sgeen
bluf

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
from collections import Counter
n=int(input())
S=[input() for i in range(n)]
S=dict(Counter(S).most_common())
m=int(input())
T=[input() for i in range(m)]
T=dict(Counter(T).most_common())

for i in S:
  for k in T:
    if i==k:
      S[i] -= T[k]

S=sorted(S.items(),key=lambda x:x[1],reverse=True)

if S[0][1] < 0:
  print(0)
else:
  print(S[0][1])

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()))

Failing test case input:
1
voldemort
10
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort
voldemort

Expected output:
0

Actual output:
-9


Fixed submission (verdict: Accepted):
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))

Problem: p03408
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
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()


Failing test case input:
1
voldemort
10
vnledmort
voldemort
tromedlnv
voldemort
uoldemort
voldemort
voleemort
voleelort
tromedlov
voldemort

Expected output:
0


Actual output:
-3


Fixed submission (verdict: Accepted):
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(max(ss.values()), 0))

main()
Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
d = {}
for i in range(N):
    s = input()
    if s in d.keys():
        d[s] += 1
    else:
        d[s] = 1
M = int(input())
for i in range(M):
    t = input()
    if t in d.keys():
        d[t] -= 1
    else:
        d[t] = -1
print(max(d.values()))


Failing test case input:
1
voldemort
7
vnledmort
voldemort
vnldemort
dolvemort
uomdelort
voldemort
woleetorm
loledvort
volremodt
voldemosu

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
d = {}
for i in range(N):
    s = input()
    if s in d.keys():
        d[s] += 1
    else:
        d[s] = 1
M = int(input())
for i in range(M):
    t = input()
    if t in d.keys():
        d[t] -= 1
    else:
        d[t] = -1
print(max(max(d.values()),0))

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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)


Failing test case input:
1
voldemort
8
vnledmort
voldemort
tromedlnv
voldemort
uoldemort
voldemort
woleetorm
voleelort
tromedlov
voldemoru

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):

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)

Problem: p03408
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter as cnt
b = cnt([input() for _ in range(int(input()))])
r = cnt([input() for _ in range(int(input()))])
a = -10**3
for l in b.keys(): a = max(a,b[l]-r[l])
print(a)

Failing test case input:
1
voldemort
10
vnledmort
voldemort
tromedlnv
voldemort
uoldemort
voldemort
voldemort
voleelort
tromedlov
voldemort

Expected output:
0


Actual output:
-4


Fixed submission (verdict: Accepted):
from collections import Counter as cnt
b = cnt([input() for _ in range(int(input()))])
r = cnt([input() for _ in range(int(input()))])
a = 0
for l in b.keys(): a = max(a,b[l]-r[l])
print(a)
Problem: p03659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))

s = sum(a)
x = 0
ans = abs(2 * a[0] - s)
snuke = 0

for i in range(1, n-1):
    snuke += 2 * a[i]
    if abs(snuke - s) < ans:
        ans = abs(snuke - s)

print(ans)


Failing test case input:
6
-1 15 3 5 1 4

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))

s = sum(a)
x = 0
ans = abs(2 * a[0] - s)
snuke = a[0]

for i in range(1, n-1):
    snuke += a[i]
    if abs(2 * snuke - s) < ans:
        ans = abs(2 * snuke - s)

print(ans)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = [int(item) for item in input().split()]

sunuke = sum(a)
raccoon = 0
minimum = abs(sunuke - raccoon)
for i in a:
    sunuke -= i
    raccoon += i
    if(abs(sunuke - raccoon) < minimum):
        minimum = abs(sunuke - raccoon)
print(minimum)

Failing test case input:
2
-66 3

Expected output:
69


Actual output:
63


Fixed submission (verdict: Accepted):
N = int(input())
a = [int(item) for item in input().split()]

sunuke = sum(a[1:])
raccoon = a[0]
minimum = abs(sunuke - raccoon)
for i in range(1, N):
    if(abs(sunuke - raccoon) < minimum):
        minimum = abs(sunuke - raccoon)
    sunuke -= a[i]
    raccoon += a[i]
       
print(minimum)

Problem: p03659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

N = int(input())
A = list(map(int,input().split()))

s = [0]*(N+1)
for i in range(N-1):
    s[i+1] = s[i] + A[i]
print(s)

ans = 10**10
for i in range(1,N):
    diff = abs((s[N-1] + A[-1] - s[i]) - s[i])
    ans = min(ans,diff)
print(ans)

Failing test case input:
2
-50 2

Expected output:
52


Actual output:
[0, -50, 0]
52


Fixed submission (verdict: Accepted):

N = int(input())
A = list(map(int,input().split()))

s = [0]*(N+1)
for i in range(N-1):
    s[i+1] = s[i] + A[i]

ans = 10**10
for i in range(1,N):
    diff = abs((s[N-1] + A[-1] - s[i]) - s[i])
    ans = min(ans,diff)
print(ans)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a_arr = list(map(int, input().split()))

def main(arr):
    sum_sunuke = 0
    sum_arai      = sum(arr)
    min_val = 2*(10**5)
    for i in range(1,N):
        sum_sunuke += arr[i]
        sum_arai      -= arr[i]
        val = abs(sum_sunuke - sum_arai)
        print(sum_sunuke)
        if min_val > val:
            min_val = val
    return min_val

print(main(a_arr))

Failing test case input:
6
1 3 3 7 8 13

Expected output:
7


Actual output:
3
6
13
21
34
7


Fixed submission (verdict: Accepted):
N = int(input())
a_arr = list(map(int, input().split()))

def main(arr):
    sum_sunuke = 0
    sum_arai      = sum(arr)
    min_val = 10**10
    


    
    for i in range(N-1):
        sum_sunuke += arr[i]
        sum_arai      -= arr[i]
        val = abs(sum_sunuke - sum_arai)


        if min_val > val:
            min_val = val


    return min_val

print(main(a_arr))
Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
a = list(map(int, input().split()))


def cum(array):
    result = [0]
    for i in range(len(array)):
        result.append(array[i]+result[i])
    return result


cumArray = cum(a)

ans = 10**9
for i in range(1, n+1):
    ans = min(ans, abs(cumArray[i]-(cumArray[n]-cumArray[i])))

print(ans)


Failing test case input:
2
-259 1

Expected output:
260


Actual output:
258


Fixed submission (verdict: Accepted):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
a = list(map(int, input().split()))


def cum(array):
    result = [0]
    for i in range(len(array)):
        result.append(array[i]+result[i])
    return result


cumArray = cum(a)


ans = 10**12
for i in range(1, n):
    
    
    ans = min(ans, abs(cumArray[n]-2*cumArray[i]))

print(ans)

Problem: p03659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())

lis = list(map(int, input().split()))

lis = sorted(lis)

x = sum(lis)

ans = 100100100100100100

X = 0
for i in range(n-1):
    X += lis[i]
    ans = min(ans, abs(x-2*X))

print(ans)

Failing test case input:
6
1 30 1 10 -1 6

Expected output:
15


Actual output:
13


Fixed submission (verdict: Accepted):
import itertools

n = int(input())
lis = list(map(int, input().split()))
k = list(itertools.accumulate(lis))
x = sum(lis)

ans = 100100100100100100

for i in range(n-1):
    t = k[i]
    t2 = x - t
    
    ans = min(ans, abs(t-t2))

print(ans)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = input()

card_list = list(map((int),input().split(' ')))

sum_card = sum(card_list)

score = []
araiguma = 0

for i in range(int(a)-1):
    
    araiguma += sum_card - card_list[i]
    score.append(abs(sum_card-2*araiguma))

print(min(score))

Failing test case input:
6
0 3 3 7 1 13

Expected output:
1


Actual output:
27


Fixed submission (verdict: Accepted):
a = input()

card_list = list(map((int),input().split(' ')))

sum_card = sum(card_list)

score = []
sunuke = 0

for i in range(int(a)-1):
    
    sunuke += card_list[i]
    score.append(abs(sum_card-2*sunuke))

print(min(score))
Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

s = input().split()
s = [int(i) for i in s]
N = s[0]

s = input().split()
a = [int(i) for i in s]

L = [0] * N
L[0] = a[0] - sum(a[1 : ])

if N == 2 : 
    print(abs(a[0] - a[1]))
else : 
    for i in range(1 , N - 1) : 
        L[i] = L[i - 1] + 2 * a[i]
        if L[i] > 0 : break
    print(L)
    
    print(min( abs(L[i]) , abs(L[i - 1])))

Failing test case input:
6
-1 10 3 3 1 4

Expected output:
2


Actual output:
[-22, -2, 4, 0, 0, 0]
2


Fixed submission (verdict: Accepted):

s = input().split()
s = [int(i) for i in s]
N = s[0]

s = input().split()
a = [int(i) for i in s]

L = [0] * N
L[0] = a[0] - sum(a[1 : ])

if N == 2 : 
    print(abs(a[0] - a[1]))
else : 
    MIN = float("inf")
    for i in range(1 , N - 1 ) : 
        L[i] = L[i - 1] + 2 * a[i]
        if MIN > min( abs(L[i]) , abs(L[i - 1])) : MIN = min( abs(L[i]) , abs(L[i - 1]))
    print(MIN)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
B = [0]
for i in range(N):
    B.append(B[i]+A[i])
dmin = B[N]
for i in range(1,N):
    dmin = min(dmin,abs(B[N]-2*B[i]))
print(dmin)

Failing test case input:
2
-142 1

Expected output:
143


Actual output:
-141


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
B = [0]
for i in range(N):
    B.append(B[i]+A[i])
dmin = 10**15
for i in range(1,N):
    dmin = min(dmin,abs(B[N]-2*B[i]))
print(dmin)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N=int(input())
a=list(map(int,input().split()))
x=a[0]
y=sum(a)-x
ans=abs(x-y)
for i in range(N-2):
    if ans>abs(x-y+2*a[i+1]):
        ans=abs(x-y+2*a[i+1])
print(ans)

Failing test case input:
6
1 2 3 7 8 8

Expected output:
3


Actual output:
11


Fixed submission (verdict: Accepted):

N=int(input())
a=list(map(int,input().split()))
x=a[0]
y=sum(a)-x
ans=abs(x-y)
for i in range(N-2):
    x+=a[i+1]
    y-=a[i+1]
    if ans>abs(x-y):
        ans=abs(x-y)
print(ans)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = list(map(int,input().split()))

x = a[0]
y = sum(a[1:])

ans = abs(x-y)

if N != 2:    
    for i in range(N-1):
        ans = min(ans, abs(ans - 2*a[i+1]))

print(ans)

Failing test case input:
6
0 3 3 5 1 8

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int,input().split()))

s = sum(a)
l = 0

ans = 10**10
   
for i in range(N-1):
    l += a[i]
    ans = min(ans, abs(s - 2*l))

print(ans)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(x) for x in input().split()]
ans = pow(10, 15)
key = sum(a)
p = 0
for i in range(n):
  p += a[i]
  if ans > abs(key-2*p):
    ans = abs(key-2*p)
    
print(ans)

Failing test case input:
2
-40 1

Expected output:
41


Actual output:
39


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(x) for x in input().split()]
ans = pow(10, 15)
key = sum(a)
p = 0
for i in range(n-1):
  p += a[i]
  if ans > abs(key-2*p):
    ans = abs(key-2*p)
    
print(ans)
Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
card = list(map(int,input().split(' ')))
 
sum_card = sum(card)
dif_list = []
min_value = 1000000000
sunuke = 0
for i in range(0,N,1):
  sunuke += card[i]
  if abs(sum_card/2 - sunuke) < min_value:
    min_value = abs(sum_card/2 - sunuke)
  
print(int(2*min_value))

Failing test case input:
2
-47 7

Expected output:
54


Actual output:
40


Fixed submission (verdict: Accepted):
N = int(input())
card = list(map(int,input().split(' ')))

sum_card = sum(card)
min_value = 10000000000
sunuke = 0
for i in range(0,N-1,1):
  sunuke += card[i]
  if abs(sum_card - 2*sunuke) < min_value:
    min_value = abs(sum_card - 2*sunuke)
  
print(int(min_value))

Problem: p03659
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
a = list(map(int,input().split()))
suma = sum(a)
ans = suma
if N == 2:
    print(abs(a[0]-a[1]))
else:
    for i in range(1,N-1):
        sumb = sum([a[i] for i in range(i)])
        ans = min(ans,abs(suma - 2*sumb))
    print(ans)

Failing test case input:
6
0 3 3 7 1 24

Expected output:
10


Actual output:
12


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int,input().split()))
suma = sum(a)
ans = abs(suma - a[0])
sumb = a[0]
if N == 2:
    print(abs(a[0]-a[1]))
else:
    for i in range(1,N-1):
        sumb += a[i]
        ans = min(ans,abs(suma - 2*sumb))
    print(ans)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
A = sum(a[:n-1])-a[n-1]
c = n*(10**9)
c = min(c,A)
if n == 2:
    print(abs(a[0]-a[1]))
else:
    for i in range(1,n-1):
        A=A-2*a[n-1-i]
        c = min(c,abs(A))
    print(c)


Failing test case input:
6
0 3 3 7 1 24

Expected output:
10


Actual output:
-10


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
A = sum(a[:n-1])-a[n-1]
c = n*(10**9)
c = min(c,abs(A))
if n == 2:
    print(abs(a[0]-a[1]))
else:
    for i in range(1,n-2):
        A=A-2*a[n-1-i]
        c = min(c,abs(A))
    print(c)

Problem: p03659
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))

accum=[0]
for i in range(N):
    accum.append(accum[i]+a[i])

accum.remove(0)
print(accum)
S=accum[-1]
lst=[]
for i in range(N-1):
    lst.append(abs(S-accum[i]*2))
print(min(lst))

Failing test case input:
6
0 3 3 7 1 13

Expected output:
1


Actual output:
[0, 3, 6, 13, 14, 27]
1


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int, input().split()))

accum=[0]
for i in range(N):
    accum.append(accum[i]+a[i])

accum.remove(0)

S=accum[-1]
lst=[]
for i in range(N-1):
    lst.append(abs(S-accum[i]*2))
print(min(lst))
Problem: p03659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
a=list(map(int,input().split()))
l,r=0,sum(a)
ans=10**9
for i in a:
    l,r=i,r-i
    ans=min(ans,abs(l-r))
print(ans)

Failing test case input:
2
-34 5

Expected output:
39


Actual output:
5


Fixed submission (verdict: Accepted):
N=int(input())
a=list(map(int,input().split()))
l,r=a.pop(0),sum(a)
ans=10**10
for i in a:
    ans=min(ans,abs(l-r))
    l,r=l+i,r-i
print(ans)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import * 
n=int(input())
l=[int(x) for x in input().split()]
summ=sum(l)
sum1=0
ans=10**30
for i in range(n):
    sum1+=l[i]
    ans=min(ans,abs(summ-2*sum1))
print(ans)

Failing test case input:
2
-47 1

Expected output:
48


Actual output:
46


Fixed submission (verdict: Accepted):
from math import * 
n=int(input())
l=[int(x) for x in input().split()]
summ=sum(l)
sum1=0
ans=10**30
for i in range(n-1):
    sum1+=l[i]
    ans=min(ans,abs(summ-2*sum1))
print(ans)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
x = a[0]
y = sum(a[1:])
mina = abs(x - y)
for i in range(1, n):
    x += a[i]
    y -= a[i]
    mina = min(mina, abs(x - y))
print(mina)

Failing test case input:
2
-47 7

Expected output:
54


Actual output:
40


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
x = a[0]
y = sum(a[1:])
mina = abs(x - y)
for i in range(1, n - 1):
    x += a[i]
    y -= a[i]
    mina = min(mina, abs(x - y))
print(mina)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
m=list(map(int,input().split()))
a=sum(m)
for i in range(1,n):
  m[i]-=m[i-1]
ans=99999999
for i in m:
  ans=min(ans,abs(a-i-i))
print(ans)

Failing test case input:
2
-1 -89

Expected output:
88


Actual output:
86


Fixed submission (verdict: Accepted):
n=int(input())
m=list(map(int,input().split()))
a=sum(m)
for i in range(1,n):
  m[i]+=m[i-1]
ans=99999999999999
for i in m[:n-1]:
  ans=min(ans,abs(a-i-i))
print(ans)

Problem: p03659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
a = [int(i) for i in input().split()]

b = sum(a)
for i in range(N-1):
    b = min(b, abs(sum(a[:i+1])-sum(a[:i:-1])))
print(b)


Failing test case input:
2
-68 -1

Expected output:
67


Actual output:
-69


Fixed submission (verdict: Accepted):
N = int(input())
a = [int(i) for i in input().split()]
sum_a = sum(a)
b = []
c = 0
for i in range(N-1):
    c += a[i]
    b.append(abs(2*c-sum_a))
print(min(b))

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[int(i) for i in input().split()]
Sum=sum(a)
ans=10**9
cnt=a[0]
for i in a:
    cnt+=i
    diff=abs(Sum-2*cnt)
    if ans>diff:
        ans=diff
print(ans)

Failing test case input:
2
-1 -75

Expected output:
74


Actual output:
72


Fixed submission (verdict: Accepted):
n=int(input())
a=[int(i) for i in input().split()]
Sum=sum(a)
ans=10**18
cnt=0
for i in a[:n-1]:
    cnt+=i
    diff=abs(Sum-2*cnt)
    if ans>diff:
        ans=diff
print(ans)
Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N = int(input())
    a = list(map(int, input().split()))

    sum_a = sum(a)
    min_diff = float('inf')
    sum_first = 0
    for i in range(N-1):
        sum_first += i
        if min_diff > abs(sum_a - 2 * sum_first):
            min_diff = abs(sum_a - 2 * sum_first)

    print(min_diff)

main()

Failing test case input:
2
-62 -1

Expected output:
61


Actual output:
63


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    a = list(map(int, input().split()))

    sum_a = sum(a)
    min_diff = float('inf')
    sum_first = 0
    for i in range(N-1):
        sum_first += a[i]
        if min_diff > abs(sum_a - 2 * sum_first):
            min_diff = abs(sum_a - 2 * sum_first)

    print(min_diff)

main()

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
a=[int(i) for i in input().split()]
X=0
Y=0
min=10**9+1
for i in range(N):
  X=X+a[i]

for j in range(N-2):
  Y=Y+a[j]
  if abs(X-2*Y) <= min:
   min=abs(X-2*Y)
print(min)


Failing test case input:
2
-47 2

Expected output:
49


Actual output:
1000000001


Fixed submission (verdict: Accepted):
N=int(input())
a=[int(i) for i in input().split()]
X=0
Y=0
min=10**11
for i in range(N):
  X=X+a[i]

for j in range(N-1):
  Y=Y+a[j]
  if abs(X-2*Y) <= min:
   min=abs(X-2*Y)
print(min)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
L = list(map(int,input().split()))
sum1 = sum(L)
sum2 = 0
L.sort()
if n == 2:
    print(abs(L[1]-L[0]))
    exit ()
ans = 10**20
for i in range(n-1):
    sum2 +=L[i]
    sa = abs(sum1 - sum2- sum2)
    
    ans = min(ans,sa)
print(ans)

Failing test case input:
6
0 10 3 4 1 8

Expected output:
0


Actual output:
6


Fixed submission (verdict: Accepted):
n = int(input())
L = list(map(int,input().split()))
sum1 = sum(L)
sum2 = 0

if n == 2:
    print(abs(L[1]-L[0]))
    exit ()
ans = 10**20
for i in range(n-1):
    sum2 +=L[i]
    sa = abs(sum1 - sum2- sum2)
    ans = min(ans,sa)
print(ans)

Problem: p03659
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
a=list(map(int,input().split()))
S=sum(a)
SS=0
mi=abs(S-SS)
for i in range(N):
  S=S-a[i]
  SS=SS+a[i]
  if mi>=abs(S-SS):
    mi=abs(S-SS)
print(mi)


Failing test case input:
2
-21 3

Expected output:
24


Actual output:
18


Fixed submission (verdict: Accepted):
N=int(input())
a=list(map(int,input().split()))
S=sum(a)
SS=0
mi=1000000000000000
for i in range(N-1):
    S=S-a[i]
    SS=SS+a[i]
    if mi>=abs(S-SS):
        mi=abs(S-SS)
print(mi)