Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02761 (python)

Fixed submission:
def main():
    n, m = map(int, input().split())
    ans = [None]*n
    for _ in range(m):
        s, c = map(int, input().split())
        try:
            if ans[s-1] is None:
                if c == 0 and s != n:
                    print("-1")
                    return
                ans[s-1] = c
            elif ans[s-1] != c:
                print("-1")
                return
        except:
            print("-1")
            return
    ans_str = ""
    p = ans.pop(0)
    if p is None:
        if n == 1:
            ans_str += "0"
        else:
            ans_str += "1"
    else:
        ans_str += str(p)
    if ans:
        for a in ans:
            ans_str += str(a) if a else "0"
    print(ans_str)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    num = [set() for _ in range(n)]
    ans = ""
    for _ in range(m):
        s, v = input().split()
        num[int(s)-1].add(v)
    if n > 1 and list(num[0])[0] == "0":
        print(-1)
        return
    for i in num[:-1]:
        if len(i) == 0:
            ans += "0"
        elif len(i) == 1:
            ans += list(i)[0]
        else:
            print(-1)
            return
    if len(num[-1]) > 1:
        print(-1)
        return
    if len(num[-1]) == 1:
        ans += list(num[-1])[0]
    else:
        if m == 1:
            ans += "0"
        else:
            ans += "1"
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    num = [set() for _ in range(m)]
    ans = ""
    for _ in range(m):
        s, v = input().split()
        num[int(s)-1].add(v)
    if n > 1 and list(num[0])[0] == "0":
        print(-1)
        return
    for i in num[:-1]:
        if len(i) == 0:
            ans += "0"
        elif len(i) == 1:
            ans += list(i)[0]
        else:
            print(-1)
            return
    if len(num[-1]) > 1:
        print(-1)
        return
    if len(num[-1]) == 1:
        ans += list(num[-1])[0]
    else:
        if m == 1:
            ans += "0"
        else:
            ans += "1"
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    num = [set() for _ in range(m)]
    ans = ""
    for _ in range(m):
        s, v = input().split()
        num[int(s)-1].add(v)
    for i in num[:-1]:
        if len(i) == 0:
            ans += "0"
        elif len(i) == 1:
            ans += list(i)[0]
        else:
            print(-1)
            return
    if len(num[-1]) > 1:
        print(-1)
        return
    if len(num[-1]) == 1:
        ans += list(num[-1])[0]
    else:
        if n == 1:
            ans += "0"
        else:
            ans += "1"
    print(ans)

if __name__ == "__main__":
    main()
Problem p02901 (python)

Fixed submission:
n, m = map(int, input().split())
ac = []
for _ in range(m):
    a, _ = map(int, input().split())
    c = sum([2**(int(i)-1) for i in input().split()])
    ac.append([a, c])
dp = [float('inf')] * 2**n
dp[0] = 0
for s in range(2**n):
    for a, c in ac:
        t = s|c
        if dp[t] > dp[s] + a:
            dp[t] = dp[s] + a
ans = dp[-1]
if ans == float('inf'):
    ans = -1
print(ans)

Buggy submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    p = 2**n
    inf = 10**7
    dp = [inf]*p
    dp[0] = 0
    for _ in range(m):
        a, _ = map(int, input().split())
        c = sum([1<<(int(i)-1) for i in input().split()])
        def k(s):
            if dp[s|c] > dp[s] + a
                dp[s|c] = dp[s] + a
        [k(s) for s in range(p)]
    ans = dp[-1]
    if ans == inf:
        ans = -1
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    p = 2**n
    inf = 10**7
    dp = [inf]*p
    dp[0] = 0
    for _ in range(m):
        a, _ = map(int, input().split())
        c = sum([2**(int(i-1)) for i in input().split()])
        for s in range(p):
                t = s|c
                new = dp[s] + a
                if dp[t] > new:
                    dp[t] = new
    ans = dp[-1]
    if ans == inf:
        ans = -1
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    p = 2**n
    inf = 10**7
    dp = [inf]*p
    dp[0] = 0
    for _ in range(m):
        a, _ = map(int, input().split())
        c = sum([1<<(int(i-1)) for i in input().split()])
        for s in range(p):
                t = s|c
                new = dp[s] + a
                if dp[t] > new:
                    dp[t] = new
    ans = dp[-1]
    if ans == inf:
        ans = -1
    print(ans)

if __name__ == '__main__':
    main()
Problem p02909 (python)

Fixed submission:
s = input()
weathers = ['Sunny', 'Cloudy', 'Rainy']
print(weathers[(weathers.index(s)+1)%3])

Buggy submission (verdict: Runtime Error):
n, m, *a = map(int, open(0).read().split())
new_a = sorted(a, key=lambda x: -x)
sum = 0
for _ in range(m):
    new_a[0] /= 2
    new_a.sort(key=lambda x: -x)
for price in new_a:
    sum += int(price)
print(sum)

Buggy submission (verdict: Runtime Error):
import sys
s = sys.argv
weathers = ['Sunny', 'Cloudy', 'Rainy']
for i, weather in enumerate(weathers):
    if s == weather:
        return weathers[(i+1)%3]

Buggy submission (verdict: Runtime Error):
import sys
s = sys.argv
weathers = ['Sunny', 'Cloudy', 'Rainy']
for i, weather in enumerate(weathers):
    if s == weather:
        return weathers[i+1]
Problem p02911 (python)

Fixed submission:
n, k, q = map(int, input().split())
out = [k-q for _ in range(n)]
for _ in range(q):
    a = int(input())-1
    out[a] += 1
for i in range(n):
    msg = "Yes" if out[i] > 0 else "No"
    print(msg)

Buggy submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
if k-q >=1:
    for _ in range(q):
        print("Yes")
out = [k-q for _ in range(n)]
for _ in range(q):
    a = int(input())
    out[a] += 1
for i in range(n):
    msg = "Yes" if out[i] >= 1 else "No"
    print(msg)
Problem p03061 (python)

Fixed submission:
from fractions import gcd
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ar = a[::-1]
    lgcds = [1]*n
    rgcds = [1]*n
    lgcd, rgcd = a[0], ar[0]
    lgcds[0] = rgcd
    lgcds[1] = lgcd
    rgcds[n-1] = lgcd
    rgcds[n-2] = rgcd
    for i in range(2, n):
        lgcd = gcd(lgcd, a[i-1])
        rgcd = gcd(rgcd, ar[i-1])
        lgcds[i] = lgcd
        rgcds[n-1-i] = rgcd
    ans = 1
    for i in range(n):
        gi = gcd(lgcds[i], rgcds[i])
        if gi > ans:
            ans = gi
    print(ans)
    

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from math import gcd
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ar = a[::-1]
    lgcds = [1]*n
    rgcds = [1]*n
    lgcd, rgcd = a[0], ar[0]
    lgcds[0] = rgcd
    lgcds[1] = lgcd
    rgcds[n-1] = lgcd
    rgcds[n-2] = rgcd
    for i in range(2, n):
        lgcd = gcd(lgcd, a[i])
        rgcd = gcd(rgcd, ar[i])
        lgcds[i] = lgcd
        rgcds[n-1-i] = rgcd
    ans = 1
    for i in range(n):
        gi = gcd(lgcds[i], rgcds[i])
        if gi > ans:
            ans = gi
    print(ans)
    

if __name__ == "__main__":
    main()
Problem p03160 (python)

Fixed submission:
n = int(input())
H = list(map(int, input().split()))
cost = [None]*n
h1 = [None]*(n-1)
h2 = [None]*(n-2) 
one_ago = H[1]
two_ago = H[0]
h1[0] = abs(two_ago-one_ago)
for i in range(2, n):
    new = H[i]
    h1[i-1] = abs(one_ago-new)
    h2[i-2] = abs(two_ago-new)
    two_ago, one_ago = one_ago, new
cost[0], cost[1] = 0, h1[0]
for i in range(2, n):
    cost[i] = min(cost[i-2]+h2[i-2], cost[i-1]+h1[i-1])
print(cost[n-1])

Buggy submission (verdict: Runtime Error):
n, K = map(int, input().split())
h = list(map(int, input().split()))
inf = 10**10
dp = [inf]*n
dp[0] = 0
for i in range(1, n):
    di = dp[i]
    hi = h[i]
    for k in range(max(i-K, 0), i):
        a = dp[k]+abs(hi-h[k])
        if di > a:
            di = a
    dp[i] = di
print(dp[n-1])
Problem p03161 (python)

Fixed submission:
def main():
    n, K = map(int, input().split())
    h = list(map(int, input().split()))
    inf = 10**10
    dp = [inf]*n
    dp[0] = 0
    for i, (di, hi) in enumerate(zip(dp[1:], h[1:]), 1):
        num = max(i-K, 0)
        for dk, hk in zip(dp[num:i], h[num:i]):
            a = dk+abs(hi-hk)
            if di > a:
                di = a
        dp[i] = di
    print(dp[n-1])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n, K = map(int, input().split())
h = list(map(int, input().split()))
inf = 10**10
dp = [inf]*n
dp[0] = 0
for i in range(1, n):
    for k in range(i-K, i):
        dp[i] = min(dp[i], dp[k]+abs(h[i]-h[k]))
print(dp[n-1])
Problem p03162 (python)

Fixed submission:
n = int(input())
abc = [list(map(int, input().split())) for _ in range(n)]
dp = [[None]*3 for _ in range(n)]
dp[0] = abc[0]
m = [[0, [1, 2]], [1, [0, 2]], [2, [0, 1]]]
for i in range(1, n):
    abci = abc[i]
    for j, k in m:
        dp[i][j] = max(dp[i-1][k[0]]+abci[j], dp[i-1][k[1]]+abci[j])
print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
n = int(input())
abc = [list(map(int, input().split())) for _ in range(n)]
dp = [[None]*3 for _ in range(n)]
dp[0] = abc[0]
K = [[1, 2], [0, 2], [0, 1]]
for i in range(1, n):
    abci = abc[i]
    for j in range(3):
        for k in K[j]:
            dp[i][j] = max(dp[i-1][k[0]]+abci[j], dp[i-1][k[1]]+abci[j])
print(max(dp[-1]))
Problem p03166 (python)

Fixed submission:
import sys

def main():
  out = 0
  for i in range(1, n+1):
    if dp[i]:
        di = dp[i]
        if di > out:
            out = di
    else:
        di = cal(i)
        if di > out:
            out = di
  print(out)

def cal(a):
  if xy[a]:
    ans = 0
    for b in xy[a]:
      if dp[b]:
        num = dp[b]
      else:
        num = cal(b)
        dp[b] = num
      if num+1 > ans:
        ans = num+1
    return ans
  return 0

if __name__ == "__main__":
  sys.setrecursionlimit(100000)
  n, m = map(int, input().split())
  xy = [set() for _ in range(n+1)]
  dp = [None]*(n+1)
  for _ in range(m):
    x, y = map(int, input().split())
    xy[x].add(y)
  main()

Buggy submission (verdict: Runtime Error):
def main():
  out = 0
  for i in range(1, n+1):
    if dp[i]:
        di = dp[i]
        if di > out:
            out = di
    else:
        di = cal(i)
        if di > out:
            out = di
  print(out)

def cal(a):
  if xy[a]:
    ans = []
    for b in xy[a]:
      num = cal(b)
      dp[b] = num
      ans.append(num+1)
    return max(ans)
  return 0

if __name__ == "__main__":
  sys.setrecursionlimit(100000)
  n, m = map(int, input().split())
  xy = [set() for _ in range(n+1)]
  dp = [None]*(n+1)
  for _ in range(m):
    x, y = map(int, input().split())
    xy[x].add(y)
  main()

Buggy submission (verdict: Runtime Error):
def main():
  out = 0
  for i in range(1, n+1):
    if dp[i]:
        di = dp[i]
        if di > out:
            out = di
    else:
        di = cal(i)
        if di > out:
            out = di
  print(out)

def cal(a):
  if xy[a]:
    ans = []
    for b in xy[a]:
      num = cal(b)
      dp[b] = num
      ans.append(num+1)
    return max(ans)
  return 0

if __name__ == "__main__":
  n, m = map(int, input().split())
  xy = [set() for _ in range(n+1)]
  dp = [None]*(n+1)
  for _ in range(m):
    x, y = map(int, input().split())
    xy[x].add(y)
  main()

Buggy submission (verdict: Runtime Error):
def main():
  out = 0
  for i in range(1, n+1):
    if dp[i]:
      out = max(out, dp[i])
    else:
      out = max(out, cal(i))
  print(out)

def cal(a):
  if xy[a]:
    ans = []
    for b in xy[a]:
      num = cal(b)
      dp[b] = num
      ans.append(num+1)
    return max(ans)
  return 0

if __name__ == "__main__":
  n, m = map(int, input().split())
  xy = [set() for _ in range(n+1)]
  dp = [None]*(n+1)
  for _ in range(m):
    x, y = map(int, input().split())
    xy[x].add(y)
  main()
Problem p03353 (python)

Fixed submission:
s = input()
k = int(input())
n = len(s)
if n == 1:
    print(s)
elif n == 2:
    l2 = sorted(list(set([s[i:i+2] for i in range(n-1)])))
    print(l2[0])
elif n == 3:
    l1 = list(set(s))
    l2 = list(set([s[i:i+2] for i in range(n-1)]))
    l3 = list(set([s[i:i+3] for i in range(n-2)]))
    out = sorted(l1 + l2 + l3)
    print(out[k-1])
elif n == 4:
    l1 = list(set(s))
    l2 = list(set([s[i:i+2] for i in range(n-1)]))
    l3 = list(set([s[i:i+3] for i in range(n-2)]))
    l4 = list(set([s[i:i+4] for i in range(n-3)]))
    out = sorted(l1 + l2 + l3 + l4)
    print(out[k-1])
else:
    l1 = list(set(s))
    l2 = list(set([s[i:i+2] for i in range(n-1)]))
    l3 = list(set([s[i:i+3] for i in range(n-2)]))
    l4 = list(set([s[i:i+4] for i in range(n-3)]))
    l5 = list(set([s[i:i+5] for i in range(n-4)]))
    out = sorted(l1 + l2 + l3 + l4 + l5)
    print(out[k-1])

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    k = int(input())
    ss = set()
    if len(s) <= 5:
        for i in range(len(s)):
            for j in range(i+1, len(s)+1):
                ss |= {s[i:j]}
    else:
        m = sorted(s)[0]
        for i in range(len(s)):
            if s[i] == m:
                for j in range(i+1, len(s)+1):
                    ss |= {s[i:j]}
    print(sorted(ss)[k-1])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
n = len(s)
l2 = sorted([s[i:i+2] for i in range(n-1)])
l3 = sorted([s[i:i+3] for i in range(n-2)])
l4 = sorted([s[i:i+4] for i in range(n-3)])
l5 = sorted([s[i:i+5] for i in range(n-4)])
out = sorted([min(s),l2[0],l2[1],l2[2],l2[3],l3[0],l3[1],l3[2],l4[0],l4[1],l5[0]])
print(out[k-1])
Problem p03362 (python)

Fixed submission:
n = int(input())

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

p_list = primes(55555)
p5_list = [i for i in p_list if i%5 == 1]
out = ' '.join(map(str, p5_list[:n]))
print(out)

Buggy submission (verdict: Runtime Error):
n = int(input())

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

p_list = primes(55555)
p5_list = [i for i in p_list if i%5 == 1]
out = p5_list[:n]
print(' '.join(out))
Problem p03363 (python)

Fixed submission:
from collections import Counter
n = int(input())
A = [int(i) for i in input().split()]
S = [0]*(n+1)
for i in range(n):
    S[i+1] = S[i] + A[i]
def hello(data):
    dt = Counter()
    for i in data:
        dt[str(i)] += 1
    return dt
num = hello(S)
out = [i*(i-1)//2 for i in num.values() if i>1]
print(sum(out))

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [input() for _ in range(n)]
out = 0
for k in range(n):
    a = A[k:][:] + A[:k][:]
    if ''.join(a) == ''.join(map(''.join, zip(*a))):
        out += n
print(out)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [int(i) for i in input().split()]
S = [A[0]]
for i in range(n+1):
    S[i+1] = S[i] + A[i]
out = 0
for i in set(S):
    num = S.count(i)
    out += num*(num-1)//2
print(out)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [int(i) for i in input().split()]
count = 0
for j in range(n):
    for k in range(1,n-j+1,1):
        print(A[j:j+k])
        if not sum(A[j:j+k]):
            count += 1
print(count)
Problem p03364 (python)

Fixed submission:
n = int(input())
A = [input() for _ in range(n)]
# AT = list(map(''.join,zip(*A)))
count = 0
for a in range(n):
    arr = A[a:][:] + A[:a][:]
    arrT = list(map(''.join, zip(*arr)))
    for i in range(n):
        if arr[i][i+1:] != arrT[i][i+1:]:
            break
    else:
        count += n
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
A = [[ord(i) for i in input()] for j in range(n)]
count = 0
for a in range(n):
    arr = np.roll(A, a, axis=0)
    arrT = arr.T
    for i in range(n):
        if arr[i][i:] != arrT[i][i:]:
            break
    else:
        count += n
print(count)
Problem p03370 (python)

Fixed submission:
n, x = map(int, input().split())
m = [int(input()) for _ in range(n)]
a = x - sum(m)
out = a//min(m)
print(out + n)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
m = [int(input()) for _ in range(n)]
a = x - sum(m)
out = a//min(a)
print(out + n)
Problem p03377 (python)

Fixed submission:
a, b, x = map(int, input().split())
if a + b >= x and a <= x:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
x1, x2 = y[n//2-1], y[n//2]
for i, xx in enumerate(x):
    if xx<=x1:
        print(x2)
    else:
        print(x1)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
x1, x2 = y[n//2-1], y[n//2]
for i, yy in enumerate(y):
    if yy<=x1:
        print(x2)
    else:
        print(x1)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=map(int,input().split())
y = sorted(x)
x1, x2 = y[n//2-1], y[n//2]
for i in range(n):
    if x[i]<=x1:
        print(x2)
    else:
        print(x1)
Problem p03379 (python)

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
N=int(n/2)
y=sorted(x)
a=y[N-1]
b=y[N]
for j in range(n):
    if x[j]<=a:
        print(b)
    else:
        print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
y=sorted(list(map(int,input().split())))
x1, x2 = y[n//2-1], y[n//2]
for i in range(n):
    if x[i]<=x1:
        print(x2)
    else:
        print(x1)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=map(int,input().split())
y = sorted(x)
x1, x2 = y[n//2-1], y[n//2]
for i in range(n):
    if x[i]<=x1:
        print(x2)
    else:
        print(x1)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=map(int,input().split())
y = sorted(x)
x1, x2 = y[n//2-1], y[n//2]
for i in range(n):
    if x[i]<=x1:
        print(x2)
    else:
        print(x1)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = sorted(map(int, input().split()))
x1 = x[n/2-1]
x2 = x[n/2]
for i, xx in enumerate(x):
    if xx <= x1:
        print(x2)
    else:
        print(x1)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = sorted(map(int, input().split()))
x1, x2 = x[n//2-1], x[n//2]
for i, xx in enumerate(x):
　if xx <= x1:
　　print(x2)
　else:
　　print(x1)

Buggy submission (verdict: Runtime Error):
n = input()
x = list(map(int, input().split()))
out = [sorted(x[:i] + x[i+1:])[(len(val)-1)//2] for i, xx in enumerate(x)]
for o in out:
    print(o)
Problem p03393 (python)

Fixed submission:
s = input()
t = set(map(chr, range(ord('a'), ord('z')+1))) - set(s)
if t:
    print(s + min(t))
else:
    u = {s[-1]}
    for i in range(len(s)-1)[::-1]:
        x = [c for c in u if s[i]<c]
        if x:
            print(s[:i] + min(x))
            break
        u.add(s[i])
    else:
        print(-1)

Buggy submission (verdict: Runtime Error):
s = input()
old = ''
flag = 0
sample = [chr(i) for i in range(97, 97+26)]
if len(s) == 26:
    u = {s[-1]}
    for i in range(len(s) - 1)[::-1]:
        x = [c for c in u if s[i] < c]
        if x:
            print(s[:i] + min(x))
            break
        u.add(s[i])
    else:
        print(-1)
else:
    out = s + min(set(sample)-set(s))

print(out)

Buggy submission (verdict: Runtime Error):
s = input()
old = ''
flag = 0
sample = [chr(i) for i in range(97, 97+26)]
if len(s) == 26:
    if s == sample[::-1]:
        out = -1
    else:
        for i, s1 in enumerate(s[::-1]):
            if i != 0 and s1 < old[-1]:
                out = s[:len(s)-i-1] + min(old)
                break
            old += s1
else:
    for i1, i2 in zip(sorted(s), sample):
        if i1 != i2:
            out = s + i2
            flag = 1
            break
    if flag != 1:
        out = s + sample[len(s)]

print(out)

Buggy submission (verdict: Runtime Error):

o = input()
s = list(o)
old = ''
sample = [chr(i) for i in range(97, 97+26)]
if len(s) == 26:
    if s == sample[::-1]:
        out = -1
    else:
        for i, s1 in enumerate(s[::-1]):
            if i != 0 and s1 < old[-1]:
                out = ''.join(s[:len(s)-i-1]) + min(old)
                break
            old += s1
else:
    for i1,i2 in zip(sorted(s), sample):
        if i1 != i2:
            out = o + i2
            break
print(out)

Buggy submission (verdict: Runtime Error):
o = input()
s = list(o)
sample = [chr(i) for i in range(97, 97+26)]
if len(s) == 26:
    if s == sample[::-1]:
        out = -1
    else:
        for i, s1 in enumerate(sample):
            if s[i] != s1:
                out = ''.join(s[:i-1]) + s1
                break
else:
    for i1,i2 in zip(sorted(s), sample):
        if i1 != i2:
            out = o + i2
            break
print(out)
Problem p03408 (python)

Fixed submission:
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(max(out),0))

Buggy submission (verdict: Runtime Error):
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))
Problem p03434 (python)

Fixed submission:
N = int(input())
A = sorted(list( map( int, input().split() ) ), reverse=True)
Alice = 0
Bob = 0
for i in range(0,N,2):
    Alice += A[i]
    if i+1 <= N-1:
        Bob += A[i+1]
print(Alice-Bob)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = sorted(list( map( int, input().split() ) ), reverse=True)
Alice = 0
Bob = 0
for i in range(0,N,2):
    Alice += A[i]
    Bob += A[i+1]
print(Alice-Bob)
Problem p02630 (python)

Fixed submission:
N = int(input())
As = list(map(int,input().split()))
Q = int(input())

count_array = [0]*(10**5+1)
for i in range(N):
    count_array[As[i]] += 1

sum = 0
for i in range(len(As)):
    sum += As[i]

for i in range(Q):
    x,y = map(int,input().split())
    sum += count_array[x]*(y-x)
    print(sum)
    count_array[y] += count_array[x]
    count_array[x] = 0

Buggy submission (verdict: Runtime Error):
N = int(input())
As = list(map(int,input().split()))
Q = int(input())

count_array = [0]*(10**5)
for i in range(N):
    count_array[As[i]] += 1

sum = 0
for i in range(len(As)):
    sum += As[i]

for i in range(Q):
    x,y = map(int,input().split())
    sum += count_array[x]*(y-x)
    print(sum)
    count_array[y] += count_array[x]
    count_array[x] = 0