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

Fixed submission:
from functools import reduce

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

MOD = 10 ** 9 + 7

def f(A):
    num = reduce(lambda x, y: x * y % MOD, range(N, N - A, -1))
    den = reduce(lambda x, y: x * y % MOD, range(1, A + 1))
    return num * pow(den, MOD - 2, MOD) % MOD

answer = pow(2, N, MOD) - 1 - f(A) - f(B)
answer %= MOD
print(answer)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())

import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

MDO = 10 ** 9 + 7

total = 2 ** n - 1
ans = total - combinations_count(n, a) - combinations_count(n, b)
print(ans % MOD)
Problem p03081 (python)

Fixed submission:
N, Q = map(int, input().split())
s = '.' + input() + '.'
TD = [input().split() for _ in range(Q)]

def check(x):
    #Q回の呪文後の位置をチェック
    #1 <= x <= N
    for t, d in TD:
        if s[x] == t:
            if d == 'L':
                x -= 1
            else:
                x += 1
        if x == 0:
            return -1
        if x == N + 1:
            return 1
    return 0

ok = 0
ng = N + 1
while ng - ok > 1:
    mid = (ok + ng) // 2
    if check(mid) == -1:
        ok = mid
    else:
        ng = mid
l = ok


ok = N + 1
ng = 0
while ok - ng > 1:
    mid = (ok + ng) // 2
    if check(mid) == 1:
        ok = mid
    else:
        ng = mid

r = ng

print(r - l)

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
s = input()
TD = [input().split() for _ in range(Q)]

def check(x):
    #Q回の呪文後の位置をチェック
    #1 <= x <= N
    for t, d in TD:
        if s[x] == t:
            if d == 'L':
                x -= 1
            else:
                x += 1
        else:
            continue

        if x == 0:
            return -1
        if x == N + 1:
            return 1
    return 0

ok = 0
ng = N + 1
while ng - ok > 1:
    mid = (ok + ng) // 2
    if check(mid) == -1:
        ok = mid
    else:
        ng = mid
l = ok


ok = N + 1
ng = 0
while ok - ng > 1:
    mid = (ok + ng) // 2
    if check(mid) == 1:
        ok = mid
    else:
        ng = mid

r = ng

print(r - l)
Problem p03102 (python)

Fixed submission:
n, m, c = map(int, input().split())
b = [int(x) for x in input().split()]
a = []
for i in range(n):
    a.append([int(x) for x in input().split()])
cnt = 0
for an in a:
    dot = 0
    for i, j in zip(an, b):
        dot += i*j
    dot += c
    cnt += int(dot>0)
    
print(cnt)

Buggy submission (verdict: Runtime Error):
n, m, c = map(int, input().split())
b = input().split()
a = [input().split() for input() in range(n)]

cnt = 0
for an in a:
    dot = 0
    for i, j in zip(an, b):
        dot += i*j
    dot += c
    cnt += (dot>0).astype(int)
    
print(cnt)
Problem p03106 (python)

Fixed submission:
a, b, k = map(int, input().split())
m = min(a, b)
cnt = 0
for i in range(m, 0 ,-1):
    if (a % i == 0) and (b % i == 0):
        cnt += 1
        if cnt == k:
            print(i)
            exit()

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
m = min(a, b)
cnt = 0
for i in range(m, 0, -1):
	if (a % i == 0) and (b % i == 0):
      cnt += 1
      if cnt == k:
        print(i)
Problem p03125 (python)

Fixed submission:
a, b= map(int, input().split())
print(a+b) if b%a==0 else print(b-a)

Buggy submission (verdict: Runtime Error):
a, b= input().split()
print(a+b) if b%a==0 else print(b-a)
Problem p03136 (python)

Fixed submission:
n = int(input())
L = list(map(int, input().split()))
Lmax = max(L)
L.remove(Lmax)
print('Yes' if Lmax < sum(L) else 'No')

Buggy submission (verdict: Runtime Error):
n = int(input())
L = list(map(int, input().split()))
Lmax = L.max()
L.remove(Lmax)
print('Yes' if Lmax < L.sum() else 'No')
Problem p03212 (python)

Fixed submission:
N = int(input())
ans = 0

def dfs(i):
    global ans
    if int(i) > N:
        return
    if all(i.count(c) for c in '753'):
        ans += 1
    dfs(i + '3')
    dfs(i + '5')
    dfs(i + '7')
    
dfs('0')

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0

def dfs(s):
    if int(s) > N:
        return

    if s.count('7') and s.count('5') and s.count('3'):
        cnt += 1
    
    dfs(s + '7')
    dfs(s + '5')
    dfs(s + '3')

dfs('')

print(ans)
Problem p03243 (python)

Fixed submission:
N = input()
 
if int(N) <= int(N[0] * 3):
    print(int(N[0] * 3))
else:
    print(int(str((int(N[0]) + 1)) * 3))

Buggy submission (verdict: Runtime Error):
N = input()
 
if int(N) <= int(N[0] * 3):
    print(int(N[0] * 3))
else:
    print(int((N[0] + 1) * 3))

Buggy submission (verdict: Runtime Error):
N = input()

if int(N) < int(N[0] * 3):
    print(int(N[0] * 3))
else:
    print(int((N[0] + 1) * 3))
Problem p03251 (python)

Fixed submission:
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for i in range(X+1, Y+1):
    if i > max(x) and i <= min(y):
        print('No War')
        break
else:
    print('War')

Buggy submission (verdict: Runtime Error):
N = int(input())
words = [input() for _ in range(N)]

for i, w in enumerate(words):
    if words.count(w) > 1:
        print('No')
        break
    if w[0] != words[i - 1][-1]:
        print('No')
        break
else:
    print('Yes')
Problem p03260 (python)

Fixed submission:
a, b = map(int, input().split())
for c in range(1, 4):
    if (a * b * c) % 2 != 0:
        print('Yes')
        break
else:
    print('No')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
for c in range(1, 4):
    if (a * b * c) % 2 != 0:
        print('Yes')
        break
else:
    print('No')

Buggy submission (verdict: Runtime Error):
A, B = mpa(int, input(),.split())
for c in range(1, 4):
    if (a * b * c) % 2 != 0:
        print('Yes')
        break
else:
    print('No')
Problem p03316 (python)

Fixed submission:
N = input()

n = int(N)
sn = sum(list(map(int, list(N))))

print('Yes' if n % sn == 0 else 'No')

Buggy submission (verdict: Runtime Error):
N = input()

n = int(N)
sn = sum(list(N))

if n % sn == 0:
    print('Yes') 
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = input()

n = int(N)
sn = sum(list(N))

print('Yes') if n % sn == 0 else print('No')

Buggy submission (verdict: Runtime Error):
N = input()

n = int(N)
sn = sum(list(N))

print('Yes' if n % sn == 0 else 'No')
Problem p03324 (python)

Fixed submission:
D, N = map(int, input().split())
if N == 100:
    N = 101
if D == 0:
    print(N)
elif D == 1:
    print(N * 100)
else:
    print(N * (100 ** 2))

Buggy submission (verdict: Runtime Error):
D, N = map(int, input().split())
if N = 100:
    N = 101
if D == 0:
    print(N)
elif D == 1:
    print(N * 100)
else:
    print(N * (100 ** 2))
Problem p03360 (python)

Fixed submission:
A, B, C = map(int, input().split())
K = int(input())

biggest = max(A, B, C)
print(biggest * 2 ** K + sum([A, B, C]) - biggest)

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
K = int(input())

biggest = max([A, B, C])
print(biggest * 2 ** K + sum(A, B, C) - biggest)

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
K = int(input())

biggest = max(A, B, C)
print(biggest * 2 ** K + sum(A, B, C) - biggest)
Problem p03370 (python)

Fixed submission:
N , X = map(int, input().split())
m = [int(input()) for _ in range(N)]


d = min(m)
print(N + (X - sum(m)) // d)

Buggy submission (verdict: Runtime Error):
d = min(m)
print(N + (X - sum(m)) // d)
Problem p03386 (python)

Fixed submission:
A, B, K = map(int, input().split())
L = []

for i in range(K):
    if A + i > B - i:
        break
    else:
        L.append(A + i)
        L.append(B - i)

L = set(L)
L = sorted(L)

for l in L:
    print(l)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
L = list(range(A, B + 1))
if len(L) - 2 <= 2 * K:
    for l in L:
        print(l)
else:
    ans = []
    for i in range(K):
        ans.append(L[i])
        ans.append(L[-i - 1])
    for a in sorted(ans):
        print(a)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
L = list(range(A, B + 1))
if len(L) <= 2 * K:
    for l in L:
        print(l)
else:
    ans = []
    for i in range(K):
        ans.append(L[i])
        ans.append(L[-i - 1])
    for a in sorted(ans):
        print(a)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
L = list(range(A, B + 1))
if len(L) <= 2 * K:
    for l in L:
        print(l)
else:
    ans = []
    for i in range(K):
        ans.append(L[i])
        ans.append(L[-i])
    for a in ans:
        print(a)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
L = []
for i in range(A, A + K):
    L.append(i)

for j in range(B - k + 1, B + 1):
    L.append(i)

L = sorted(L, reverse=True)

for l in L:
    print(l)
Problem p03399 (python)

Fixed submission:
A, B, C, D = [int(input()) for _ in range(4)]
print(min(A, B) + min(C, D))

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
print(min(A, B) + min(C, D))
Problem p03408 (python)

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

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

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [int(input()) for _ in range(N)]
M = int(input())
t = [int(input()) for _ in range(M)]

ans = 0
for word in set(s):
    given = s.count(word) - t.count(word)
    ans = max(ans, given)
    
print(ans)
Problem p03424 (python)

Fixed submission:
N = int(input())
S = list(input().split())

if 'Y' in S:
    print('Four')
else:
    print('Three')

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

if 'Y' in S:
    print('Four')
else:
    print('Three')
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0

for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if 500 * a + 100 * b + 50 * c == X:
                ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0

for a in range(A + 1):
    for b in range(b + 1):
        for c in range(c + 1):
            if 500 * a + 100 * b + 50 * c == X:
                ans += 1

print(ans)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a*b % 2 == 0:
  return 'Even'
else:
  return 'Odd'
Problem p03469 (python)

Fixed submission:
S = input()

print(S.replace('2017', '2018'))

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
 
#10000:a, 5000:b, 1000:c
for a in range(N+1):
    for b in range(N+1-a):
        c = N - a - b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            print(a, b, c)
            exit()
print(-1, -1, -1)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
 
#10000:a, 5000:b, 1000:c
for a in range(N+1):
    for b in range(N+1-a):
        c = N - a - b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            print(a, b, c)
            break
print(-1, -1, -1)
N, Y = map(int, input().split())
 
#10000:a, 5000:b, 1000:c
for a in range(N+1):
    for b in range(N+1-a):
        c = N - a - b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            print(a, b, c)
            exit()
print(-1, -1, -1)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
 
#10000:a, 5000:b, 1000:c
for a in range(N+1):
    for b in range(N+1-a):
        c = N - a - b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            print(a, b, c)
            break
print(-1, -1, -1)
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())
 
#10000:a, 5000:b, 1000:c
for a in range(N+1):
    for b in range(N+1-a):
        c = N - a - b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            print(a, b, c)
            exit()
print(-1, -1, -1)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
 
#10000:a, 5000:b, 1000:c
for a in range(N+1):
    for b in range(N+1-a):
        c = N - a - b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            print(a, b, c)
            exit()
print(-1, -1, -1)
N, Y = map(int, input().split())
 
#10000:a, 5000:b, 1000:c
for a in range(N+1):
    for b in range(N+1-a):
        c = N - a - b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            print(a, b, c)
            exit()
print(-1, -1, -1)
Problem p03543 (python)

Fixed submission:
N = input()
if (N[0] == N[1] and N[1] == N[2]) or (N[1] == N[2] and N[2] == N[3]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = input()
if len(set(list(str(N))) <= 2:
    print('Yes')
else:
    print('No')
Problem p03545 (python)

Fixed submission:
n = input()
#+,-が入る可能性があるのは間だけ
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
    op = ['-'] * op_cnt
    for j in range(op_cnt):
        if (i >> j) & 1:
            op[j] = '+'
            
    formula = ''
    for a, b in zip(n, op + ['']):
        formula += (a + b)
    if eval(formula) == 7:
        print(formula + '=7')
        break

Buggy submission (verdict: Runtime Error):
n = [int(x) for x in input()]
#+,-が入る可能性があるのは間だけ
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
    op = ['-'] * op_cnt
    for j in range(op_cnt):
        if (i >> j) & 1:
            op[j] = '+'
            
    formula = ''
    for a, b in zip(n, op + ['']):
        formula += (a + b)
    if eval(formula) == 7:
        print(formula + '=7')
        break
Problem p03555 (python)

Fixed submission:
c11, c12, c13 = list(input())
c21, c22, c23 = list(input())
if c11 == c23 and c12 == c22 and c13 == c21:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
c11, c12, c13 = map(int, list(input()))
c21, c22, c23 = map(int, list(input()))
if c11 == c23 and c12 == c21 and c13 == c21:
    print('YES')
else:
    print('NO')
Problem p03574 (python)

Fixed submission:
import copy

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
ans = copy.deepcopy(S)

dx = [1, 1, 0, -1, -1, -1, 0, 1]
dy = [0, 1, 1, 1, 0, -1, -1, -1]

for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            cnt = 0
            for dir in range(8):
                if 0 <= i + dy[dir] < H and 0 <= j + dx[dir] < W:
                    cnt += (S[i + dy[dir]][j + dx[dir]] == "#")
                
            ans[i][j] = str(cnt)
for h in range(H):
    print("".join(ans[h]))

Buggy submission (verdict: Runtime Error):
import copy

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
ans = copy.deepcopy(S)

dx = [1, 1, 0, -1, -1, -1, 0, 1]
dy = [0, -1, -1, -1, 0, 1, 1, 1]

for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            cnt = 0
            for dir in range(8):
                try:
                    cnt += (S[i + dx[dir]][j + dy[dir]] == "#")
                except:
                    pass
            ans[i][j] = cnt
for h in range(H):
    print("".join(ans[h]))
Problem p03598 (python)

Fixed submission:
N = int(input())
K = int(input())
x = list(map(int, input().split()))
ans = 0
for i in range(N):
    if abs(K - x[i]) > abs(x[i]):
        ans += 2 * x[i]
    else:
        ans += 2 * (K - x[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
x = list(map(int, input().split()))
ans = 0
for i in range(N):
    if abs(K - x[i]) > abs(x[i]):
        ans += 2 * x[i]
    else:
        ans += 2 * (k - x[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
x = list(map(int, input().split()))
ans = 0
for i in range(N):
    ans.append(min(abs(0 - x[i]), abs(K - x[i])))
print(ans)
Problem p03606 (python)

Fixed submission:
N = int(input())
ans = 0
for i in range(N):
    l, r = map(int, input().split())
    ans += (r - l) + 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(N):
    l, r = input().split()
    ans += (r - l) + 1
print(ans)
Problem p03632 (python)

Fixed submission:
A, B, C, D = map(int, input().split())
if A < C and B < D:
    print(max(0, B - C))
elif C <= A and B < D:
    print(max(0, B - A))
elif A < C and D <= B:
    print(max(0, D - C))
else:
    print(max(0, D - A))

Buggy submission (verdict: Runtime Error):
if max(A, C) < min(B, D):
    print(min(B, D) - max(A, C))
else:
    print(0)
Problem p02719 (python)

Fixed submission:
def main():
    N, K = list(map(int, input().split()))
    m = N % K
    m = min(m, abs(K-m))
    print(m)
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
N, K = [int(x) for x in input().split()]

if N == 0:
    print(0)
elif K == 0:
    print(N)

t1 = abs(N - K)
t2 = K // t1

if t2 > N:
    print(N)
else:
    print(t2)

Buggy submission (verdict: Runtime Error):
N, K = [int(x) for x in input().split()]

t1 = abs(N - K)
t2 = K // t1

if t2 > N:
    print(N)
else:
    print(t2)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()

ret = 0
for i in range(3):
    if S[i] == T[i]:
        ret += 1
print(ret)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
    
ans = 0
if B / A == 1:
    ans = 1
else:
    ans = 1 + -(-(B - A) // (A - 1))
print(ans)

Buggy submission (verdict: Runtime Error):
    A,B = map(int,input().split())
     
    ans = 0
    if B / A == 1:
        ans = 1
    else:
        ans = 1 + -(-(B - A) // (A - 1))
    print(ans)
Problem p03680 (python)

Fixed submission:
N = int(input())
lst = [int(input()) for _ in range(N)]

cnt = 0
idx = 0

while True :
    x = lst[idx]
    cnt += 1
    if x == 2:
        print(cnt)
        exit()
    idx = x - 1
    if cnt > N:
        print(-1)
        exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
dic = {}
for i in range(1, N + 1):
    dic[i] = int(input())

routedDic = []

def NextRoute(i):
    x = dic[i]
    if x in routedDic:
        return -1
    
    routedDic.append(x)

    if x == 2:
        return len(routedDic)
    else:
        return NextRoute(x)

print(NextRoute(1))
Problem p02911 (python)

Fixed submission:
if __name__ == "__main__":
  n, k, q = list(map(int, input().split()))
  A = [k-q]*n
  for _ in range(q):
    a = int(input())
    A[a-1] += 1

  for i in range(n):
    print("Yes\n" if A[i]>0 else "No\n")

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
  n, k, q = list(map(int, input().split()))
  A = [k-q]*n
  for _ in range(n):
    a = int(input())
    A[a-1] += 1

  for i in range(n):
    print("Yes\n" if A[i]>0 else "No\n")
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())

print(int((a + b) * h / 2))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = iny(input())
h = int(input())

print((a + b)*h/2)
Problem p02971 (python)

Fixed submission:
a=int(input())
b=[int(input()) for i in range(a)]
sr=list(reversed(sorted(b)))
if sr[1]==sr[0]:
  for i in range(a):
    print(sr[0])
else:
  for i in b:
    if i==sr[0]:
      print(sr[1])
    else:
      print(sr[0])

Buggy submission (verdict: Runtime Error):
a=int(input())
b=list(map(int, input().split()))
cou,ju=0,0
ans=[]
while cou<a:
  i=1
  su=0
  while i*(cou+1)<a:
    su+=b[i*(cou+1)]
    i+=1
  if su%2!=b[cou]:
    ans+=[cou+1]
  cou+=1
if ans==[]:
  print("0")
else:
  s=""
  for i in ans:
    s+=str(i)+" "
  print(s)
Problem p03061 (python)

Fixed submission:
from fractions import*
a=int(input())
b=list(map(int,input().split()))
alis=[b[0]]
blis=[b[-1]]
for i in range(a-1):
  alis.extend([gcd(alis[-1],b[i+1])])
  blis.extend([gcd(blis[-1],b[-i-2])])
blis=list(reversed(blis))+[0]
alis=[0]+alis
ans=[]
for i in range(a):
	ans+=[gcd(alis[i],blis[i+1])]
print(max(ans))

Buggy submission (verdict: Runtime Error):
import itertools
a=int(input())
b=list(map(int,input().split()))
aak=list(itertools.combinations(b,a-1))
ans=[]
def gud(a,b):
  if a%b==0:
    return b
  else:
    return gud(b,a%b)
def allgud(a):
  if len(a)==1:
    return a[0]
  else:
    a+=(gud(a[0],a[1]),)
    return allgud(a[2:])
ans=list(map(lambda d: allgud(d) ,aak))
print(max(ans))

Buggy submission (verdict: Runtime Error):
import itertools
a=int(input())
b=list(map(int,input().split()))
aak=list(itertools.combinations(b,a-1))
ans=[]
def gud(a,b):
  if a%b==0:
    return b
  else:
    return gud(b,a%b)
def allgud(a):
  if len(a)==1:
    return a[0]
  else:
    a+=(gud(a[0],a[1]),)
    return allgud(a[2:])
ans=[]
for i in aak:
  ans+=[allgud(i)]
print(max(ans))

Buggy submission (verdict: Runtime Error):
import itertools
a=int(input())
b=list(map(int,input().split()))
aak=list(itertools.combinations(b,a-1))
ans=[]
def gud(a,b):
  if a%b==0:
    return b
  else:
    return gud(b,a%b)
for i in aak:
  for v in range(a-2):
    i+=(gud(i[v],i[v+1]),)
    i+=1
  ans+=[i[-1]]
print(max(ans))
Problem p03062 (python)

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
c=list(filter(lambda n:n<=0,b))
c=list(map(lambda n:n*-1,c))
d=list(filter(lambda n:n>0,b))
ans=sum(d)+sum(c)
ansl=c+d
if len(c)%2!=0:  
  ans-=min(ansl)*2
print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
lis=list(map(int,input().split()))
lis=sorted(lis)
i=0
while lis[i]<0 and i<a-1:
  if lis[i]<=0 and lis[i+1]>=0:
    if -1*lis[i]>lis[i+1]:
      lis[i],lis[i+1]=-lis[i],-lis[i+1]
  elif lis[i]<=0 and lis[i+1]<=0:
    lis[i],lis[i+1]=-lis[i],-lis[i+1]
  i+=2
print(sum(lis))

Buggy submission (verdict: Runtime Error):
a=int(input())
lis=list(map(int,input().split()))
lis=sorted(lis)
i=0
while lis[i]<0:
  if lis[i]<=0 and lis[i+1]>=0:
    if -1*lis[i]>lis[i+1]:
      lis[i],lis[i+1]=-lis[i],-lis[i+1]
  elif lis[i]<=0 and lis[i+1]<=0:
    lis[i],lis[i+1]=-lis[i],-lis[i+1]
  i+=2
print(sum(lis))
Problem p03071 (python)

Fixed submission:
b=input().split(" ")
a=[]
for i in b:
  a+=[int(i)]
ans=0
if a[1]-a[0]>=1:
  ans+=a[1]*2-1
elif a[0]-a[1]>=1:
  ans+=a[0]*2-1
else:
  ans+=a[0]+a[1]
print(ans)

Buggy submission (verdict: Runtime Error):
a=input().sprit()
ans=0
if a[1]-1a[0]>=1:
  ans+=a[1]*2-1
elif a[0]-a[1]>=1:
  ans+=a[0]*2-1
else:
  ans+=a[0]+a[1]
print(ans)
Problem p03472 (python)

Fixed submission:
from math import ceil
 
N, H = map(int, input().split())
a, b = [], []
 
for _ in range(N):
    a_i, b_i = map(int, input().split())
    a.append(a_i)
    b.append(b_i)
 
max_a = max(a)
b = sorted(b, reverse=True)
ans = float('inf')
th_po = 0
 
for i in range(N):
    th_po += b[i]
    
    if H >= th_po:
        ans_cand = i + 1 + ceil((H - th_po) / max_a)
    else:
        ans_cand = i + 1
    
    ans = min([ans, ans_cand])
 
print(ans)

Buggy submission (verdict: Runtime Error):
honsu,hp=map(int , input().split())
huru=[]
nageru=[]
for i in range(honsu):
  a,b=input().split()
  huru.append(int(a))
  nageru.append(int(b))
cc=filter(lambda v:v>=max(huru) , nageru)
cou=0
for i in reversed(sorted(cc)):
  hp-=i
  cou+=1
  if hp<=0:
    break
if hp>0:
  cou+=math.ceil(hp/max(huru))
print(cou)

Buggy submission (verdict: Runtime Error):
import math
honsu,hp=map(int , input().split())
huru=[]
nageru=[]
for i in range(honsu):
  a,b=input().split()
  hur+=[int(a)]
  nageru+=[int(b)]
cc=list(filter(lambda v:v>=max(huru) , nageru))
cou=0
for i in reversed(sorted(cc)):
  hp-=i
  cou+=1
  if hp<=0:
    break
if hp>0:
  cou+=math.ceil(hp/max(huru))
print(cou)
Problem p03338 (python)

Fixed submission:
n = int(input())
s = input()
x = 0
for i in range(n+1):
    f = set(s[i:])
    d = set(s[:i])
    count =len(f & d)
    if count > x:
        x = count
print(x)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
x = 0
for i in range(n+1):
    f = set(s[i:])
    d = set(s[:i])
    count =len(f & d)
    if count > x:
        x = count
print(x)
n = int(input())
s = input()
c = 0
for i in range(n+1):
    f = set(s[i:])
    d = set(s[:i])
    count =len(f & d)
    if count > c:
        c = count
print(c)