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

Fixed submission:
import sys

stdin = sys.stdin

mod = 1000000007

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

def gcd(m, n):
	if n == 0:
		return m
	return gcd(n, m % n)

def lcm(m, n):
	return m * n // gcd(m, n)

n = ni()
a = na()

l = a[0]
for i in range(n):
	l = lcm(l, a[i])

l -= 1
ans = 0
for i in range(n):
	ans += l % a[i]

print(ans)

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

mod = 1000000007

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

def gcd(m, n):
	if n == 0:
		return m
	return gcd(n, m % n)

def lcm(m, n):
	return m * n // gcd(m, n)

n = ni()
a = na()

l = a[0]
for i in range(n):
	l = lcm(l, a[i])

l -= 1
ans = 0
for i in range(n):
	ans += l % a[i]

print(ans
Problem p03625 (python)

Fixed submission:
# Author: cr4zjh0bp
# Created: Tue Mar 24 00:01:43 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import Counter

n = ni()
a = na()
c = Counter(a)
m = list(c.items())
m.sort(reverse=True)
xy = [0] * 2
i = 0
flag = False
for k, v in m:
    if v >= 4:
        if i != 0:
            print(xy[0] * k)
        else:
            print(k * k)
        flag = True
        break
    elif v >= 2:
        xy[i] = k
        i += 1
        if i == 2:
            print(xy[0] * xy[1])
            flag = True
            break
if not flag:
    print(0)

Buggy submission (verdict: Runtime Error):
# Author: cr4zjh0bp
# Created: Tue Mar 24 00:01:43 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import Counter

n = ni()
a = na()
c = Counter(a)
m = list(c.items())
m.sort(reverse=True)
xy = [0] * 2
i = 0
flag = False
for k, v in m:
    if v >= 4:
        if i != 0:
            print(xy[0] * k)
        else:
            print(k * K)
        flag = True
        break
    elif v >= 2:
        xy[i] = k
        i += 1
        if i == 2:
            print(xy[0] * xy[1])
            flag = True
            break
if not flag:
    print(0)
Problem p03651 (python)

Fixed submission:
# Author: cr4zjh0bp
# Created: Sun Mar 22 17:06:57 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, k = na()
a = na()

def gcd(m, n):
    if n == 0:
        return m
    else:
        return gcd(n, m % n)

g = a[0]
for i in range(n):
    g = gcd(g, a[i])

m = max(a)
if g == 1 and k <= m:
    print("POSSIBLE")
elif k % g == 0 and k <= m:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
# Author: cr4zjh0bp
# Created: Mon Mar 23 15:10:04 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

import numpy as np

n, k = na()
a = np.array(na())

g = np.gcd.reduce(a)
m = np.amax(a)
if g == 1 and k <= m:
    print("Yes")
elif k % g == 0 and k <= m:
    print("Yes")
else:
    print("No")
Problem p02691 (python)

Fixed submission:
from collections import defaultdict


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

memo = defaultdict(int)
ans = 0
for i, x in enumerate(a, 1):
    ans += memo[i - x]
    memo[x + i] += 1

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict


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

memo = defaultdict(int)
ans = 0
for i, x in enumerate(a, 1):
    print(memo)
    ans += memo[i - x]
    memo[x + i] += 1

print(ans)
Problem p02780 (python)

Fixed submission:
from itertools import accumulate
n, k = map(int, input().split())
p = list(map(int, input().split()))
p_acc = list(accumulate(p))
ans_max = p_acc[k-1]
ans = 0
if n > k:
    for i in range(n-k):
        ans_max = max(ans_max, p_acc[i+k] - p_acc[i])
        if p_acc[i+k] - p_acc[i] == ans_max:
            ans = i
    print((p_acc[ans+k] - p_acc[ans] + k) / 2)
else:
    print((sum(p) + n) / 2)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
n, k = map(int, input().split())
p = list(map(int, input().split()))
p_acc = list(accumulate(p))
ans_max = p_acc[k-1]
ans = 0
for i in range(n-k):
    ans_max = max(ans_max, p_acc[i+k] - p_acc[i])
    if p_acc[i+k] - p_acc[i] == ans_max:
        ans = i
print((p_acc[ans+k] - p_acc[ans] + k) / 2)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
n, k = map(int, input().split())
p = list(map(int, input().split()))
p_acc = list(accumulate(p))
ans_max = 0
for i in range(n-k):
    ans_max = max(ans_max, p_acc[i+k] - p_acc[i])
    if p_acc[i+k] - p_acc[i] == ans_max:
        ans = i
print((p_acc[i+k] - p_acc[i] + k) / 2)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
ans_max = 0
for i in range(n-2):
    ans_max = max(ans_max, sum(p[i:i+k]))
    if sum(p[i: i+k]) == ans_max:
        ans = i
print((sum(p[ans: ans+k]) + k) / 2)
Problem p02855 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np


H, W, K = map(int,readline().split())
grid = np.frombuffer(read(),'S1').reshape(H, -1)[:,:W]
X, Y = np.where(grid == b'#')
A = np.zeros((H, W),np.int32)
A[X, Y] = np.arange(1, K+1)
np.maximum.accumulate(A, axis=1, out=A)
for w in range(W-2,-1,-1):
    A[:,w] += A[:,w+1] * (A[:,w] == 0)
for h in range(1,H):
    if A[h,-1] == 0:
        A[h] += A[h-1]
for h in range(H-1,-1,-1):
    if A[h,-1] == 0:
        A[h] += A[h+1]
print('\n'.join(' '.join(row) for row in A.astype(str)))

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np


H, W, K = map(int,readline().split())
grid = np.frombuffer(read(),'S1').reshape(H, -1)[:,:W]
X, Y = np.where(grid == b'#')
A = np.zeros((H, W),np.int32)
A[X, Y] = np.arange(1, kK1)
np.maximum.accumulate(A, axis=1, out=A)
for w in range(W-2,-1,-1):
    A[:,w] += A[:,w+1] * (A[:,w] == 0)
for h in range(1,H):
    if A[h,-1] == 0:
        A[h] += A[h-1]
for h in range(H-1,-1,-1):
    if A[h,-1] == 0:
        A[h] += A[h+1]
print('\n'.join(' '.join(row) for row in A.astype(str)))
Problem p02947 (python)

Fixed submission:
n = int(input())
s = []
for i in range(n):
    s.append(sorted(list(input())))
cnt_ans = 0
s.sort()
cnt = 0
left = 0
right = 1
while right <= n-1:
    if s[left] == s[right]:
        right += 1
        cnt += 1
    else:
        left, right = right, right+1
        cnt_ans += ((cnt+1)*cnt//2)
        cnt = 0
    if right == n:
        cnt_ans += ((cnt+1)*cnt//2)
print(cnt_ans)

Buggy submission (verdict: Runtime Error):
s = []
for i in range(n):
    s.append(sorted(list(input())))
cnt_ans = 0
s.sort()

while len(s):
    cnt = 0
    for i in range(1, len(s)):
        if s[0] == s[i]:
            cnt += 1
        else:
            break
    cnt = int((cnt+1) * (cnt) / 2)
    cnt_ans += cnt
    s = s[cnt+1:]
print(cnt_ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
s = []
for i in range(n):
    s.append(Counter(list(input())))
ans = s.copy()
cnt_ans = 0
while len(s):
    remove_list = []
    cnt = 0
    for i in range(1, len(s)):
        if s[0] == s[i]:
            cnt += 1
            remove_list.append(s[i])
    cnt = int((cnt+1) * (cnt) / 2)
    cnt_ans += cnt
    remove_list.append(s[0])
    for lst in remove_list:
        s.remove(lst)
print(cnt_ans)
Problem p02983 (python)

Fixed submission:
l, r = map(int, input().split())
lr_ans = []
if r - l  >= 2019:
    print(0)
    exit()
for i in range(l, r+1):
    for j in range(i+1, r+1):
        lr_ans.append((i*j)%2019)
print(min(lr_ans))

Buggy submission (verdict: Runtime Error):
from fractions import gcd


l, r = map(int, input().split())
lr_ans = []
for i in range(l, r+1):
    lr_ans.append(i%2019)
lr_ans.sort()
print(int(lr_ans[0]*lr_ans[1]/gcd(lr_ans[0], lr_ans[1])))
Problem p03006 (python)

Fixed submission:
from collections import Counter
n = int(input())
xy = [tuple([int(_) for _ in input().split()]) for i in range(n)]
if n == 1:
    result = 1
else:
    xy.sort()
    dxy = [(xy[i][0]-xy[j][0], xy[i][1]-xy[j][1])
           for i in range(n)
           for j in range(i+1, n)]
    cdxy = Counter(dxy)
    result = n - max(cdxy.values())
print(result)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
xy = [tuple([int(_) for _ in input().split()]) for i in range(n)]
if n == 1:                                                     range(stop)
    result = 1
else:
    xy.sort()
    dxy = [(xy[i][0]-xy[j][0], xy[i][1]-xy[j][1])
           for i in range(n)
           for j in range(i+1, n)]
    cdxy = Counter(dxy)
    result = n - max(cdxy.values())
print(result)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
xy = [tuple([int(_) for _ in input().split()]) for i in range(N)]
if n == 1:
    result = 1
else:
    xy.sort()
    dxy = [(xy[i][0]-xy[j][0], xy[i][1]-xy[j][1])
           for i in range(N)
           for j in range(i+1, N)]
    cdxy = Counter(dxy)
    result = N - max(cdxy.values())
print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [0]*n
y = [0]*n
x_y_sum = [0]*n
total = []
p_q = []
for i in range(n):
    x[i], y[i] = map(int, input().split())
total.append([0, x[0], y[0]])
for i in range(1, n):       append(object)
    total.append([x[i]-x[i-1]+y[i]-y[i-1], x[i], y[i]])
total.sort()
cnt = 1
for i in range(1, n):
    p_q.append([total[i][1]-total[i-1][1], total[i][2]-total[i-1][2]])
p_q.sort()
new = []
for i in range(1, len(p_q)):
    new.append(list(set(p_q[i])-set(p_q[i-1])))
for i in range(len(new)):
    if new[i] != []:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [0]*n
y = [0]*n
x_y_sum = [0]*n
total = []
p_q = []
for i in range(n):
    x[i], y[i] = map(int, input().split())
total.append(0, x[0], y[0])
for i in range(1, n):    append()
    total.append([x[i]-x[i-1]+y[i]-y[i-1], x[i], y[i]])
total.sort()
cnt = 1
for i in range(1, n):
    p_q.append([total[i][1]-total[i-1][1], total[i][2]-total[i-1][2]])
p_q.sort()
new = []
for i in range(1, len(p_q)):
    new.append(list(set(p_q[i])-set(p_q[i-1])))
for i in range(len(new)):
    if new[i] != []:
        cnt += 1
print(cnt)
Problem p03014 (python)

Fixed submission:
from functools import reduce
import sys
import numpy as np


mod = 10 ** 9 + 7
buffer = sys.stdin.buffer
h, w = map(int, buffer.readline().split())
s = np.frombuffer(buffer.read(h*(w+1)), dtype='B') == ord('.')
s = s.reshape((h, w+1))[:, :-1]
l = np.empty((h, w), dtype='i4')
r = np.empty((h, w), dtype='i4')
u = np.empty((h, w), dtype='i4')
d = np.empty((h, w), dtype='i4')
l[:, 0] = s[:, 0]
for i in range(1, w):
    l[:, i] = (l[:, i-1] + 1) * s[:, i]
r[:, -1] = s[:, -1]
for i in range(1, w):
    r[:, -1-i] = (r[:, -i] + 1) * s[:, -1-i]
u[0] = s[0]
for i in range(1, h):
    u[i] = (u[i-1] + 1) * s[i]
d[-1] = s[-1]
for i in range(1, h):
    d[-1-i] = (d[-i] + 1) * s[-1-i]
score = l + r + u + d - 3
print(int(score.max()))

Buggy submission (verdict: Runtime Error):
from functools import reduce
import sys
import numpy as np


mod = 10 ** 9 + 7
buffer = sys.stdin.buffer
h, w = map(int, buffer.readline().split())
s = np.frombuffer(buffer.read(h*(w+1)), dtype='B') == ord('.')
s = s.reshape((h, w+1))[:, :-1]
l = np.empty((h, w), dtype='i4')
r = np.empty((h, w), dtype='i4')
u = np.empty((h, w), dtype='i4')
d = np.empty((h, w), dtype='i4')
l[:, 0] = s[:, 0]
for i in range(1, w):
    l[:, i] = (l[:, i-1] + 1) * s[:, i]
r[:, -1] = s[:, -1]
for i in range(1, w):
    r[:, -1-i] = (r[:, -i] + 1) * s[:, -1-i]
u[0] = s[0]
for i in range(a, h):
    u[i] = (u[i-1] + 1) * s[i]
d[-1] = s[-1]
for i in range(1, h):
    d[-1-i] = (d[-i] + 1) * s[-1-i]
score = l + r + u + d - 3
print(int(score.max()))

Buggy submission (verdict: Runtime Error):
from functools import reduce
import sys
import numpy as np


mod = 10 ** 9 + 7
buffer = sys.stdin.buffer
h, w = list(map(int, buffer.readline().split()))
s = np.frombuffer(buffer.read(h*(w+1)), dtype='B') == ord('.')
s = s.reshape((h, w+1))[:, :-1]
l = np.empty((h, w), dtype='i4')
r = np.empty((h, w), dtype='i4')
u = np.empty((h, w), dtype='i4')
d = np.empty((h, w), dtype='i4')
l[:, 0] = s[:, 0]
for i in range(1, w):
    l[:, i] = (l[:, i-1] + 1) * s[:, i]
r[:, -1] = s[:, -1]
for i in range(1, w):
    r[:, -1-i] = (r[:, -i] + 1) * s[:, -1-i]
u[0] = s[0]
for i in range(a, h):
    u[i] = (u[i-1] + 1) * s[i]
d[-1] = s[-1]
for i in range(1, h):
    d[-1-i] = (d[-i] + 1) * s[-1-i]
score = l + r + u + d - 3
print(int(score.max()))
Problem p03031 (python)

Fixed submission:
n, m = map(int, input().split())
s_lists = [list(map(int, input().split()))[1:] for _ in range(m)]
P = list(map(int, input().split()))
count = 0
for i in range(2**n):
  l = 1
  for p, S in zip(P, s_lists):
    l *= (sum([int(bin(i)[2:].zfill(n)[s-1]) for s in S]) % 2 == p)
  count += l
print(count)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [list(map(int, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))
c = 0
for n in range(1 << n):
    for i, s in enumerate(a):
        if p[i] ^ sum(n >> s-1 & 1 for s_ in s) & 1:
            break
        else:
            c += 1
print(c)
Problem p03043 (python)

Fixed submission:
N, K = map(int, input().split())
coin_num_list = []
if N != K:
    for i in range(1, min(K, N+1)):
        dice_val = i
        j = 0
        while dice_val < K:
            dice_val *= 2
            j += 1
        coin_num_list.append(j)
else:
    for i in range(1, K):
        dice_val = i
        j = 0
        while dice_val < K:
            dice_val *= 2
            j += 1
        coin_num_list.append(j)
pro_sum = 0
for coin_val in coin_num_list:
    pro_sum += (1/2)**coin_val
if N >= K:
    print((N-K+1)/N + pro_sum/N)
else:
    print(pro_sum/N)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = 0
for i in range(1, n+1):
    sum_ = i         range()
    j = 0
    while True:
        if sum_ >= k:
            break
        sum_ *= 2
        j += 1
    q = 1
    for x in range(j):
        q *= 0.5
    p += q
p /= n
print(p)
Problem p03061 (python)

Fixed submission:
import functools
import fractions


N = int(input())
a = list(map(int, input().split()))
A = list(set(a))
ans = [functools.reduce(fractions.gcd, A)]
if len(A) == 1:
    print(A[0])
    exit()
else:
    for i in A:
        b = sorted(A)
        b.remove(i)
        if a.count(i) == 1:
            ans.append(functools.reduce(fractions.gcd, b))
print(max(ans))

Buggy submission (verdict: Runtime Error):
import functools
import fractions


N = int(input())
A = list(map(int, input().split()))
A = list(set(A))
ans = [functools.reduce(fractions.gcd, A)]
if len(A) == 1:
    print(A[0])
    exit()
else:
    for i in A:
        b = sorted(A)
        b.remove(i)
        if a.coount(i) == 1:
            ans.append(functools.reduce(fractions.gcd, b))
print(max(ans))

Buggy submission (verdict: Runtime Error):
import functools
import fractions


N = int(input())
A = list(map(int, input().split()))
A = list(set(A))
ans = [functools.reduce(fractions.gcd, A)]
if len(A) == 1:
    print(A[0])
    exit()
else:
    b = sorted(A)
    b.remove(i)
    if a.coount(i) == 1:
        ans.append(functools.reduce(fractions.gcd, b))
print(max(ans))

Buggy submission (verdict: Runtime Error):
import functools
import fraction


N = int(input())
A = list(map(int, input().split()))
gcd_ans = []
for i in range(N):
    A_sub = (A[0:i]+A[i+1:N]).copy()
    gcd = functools.reduce(fraction.gcd, A_sub)
    gcd_ans.append(gcd)
print(max(gcd_ans))

Buggy submission (verdict: Runtime Error):
import functools, math


N = int(input())
A = list(map(int, input().split()))
gcd_ans = []
for i in range(N):
    A_sub = (A[0:i]+A[i+1:N]).copy()
    gcd = functools.reduce(math.gcd, A_sub)
    gcd_ans.append(gcd)
print(max(gcd_ans))
Problem p03076 (python)

Fixed submission:
A_list = []
for i in range(5):
    A_list.append(input())
one_list = []
one_list.append(int(A_list[0][-1]))
one_list.append(int(A_list[1][-1]))
one_list.append(int(A_list[2][-1]))
one_list.append(int(A_list[3][-1]))
one_list.append(int(A_list[4][-1]))
min_num = max(one_list)
min_one_list_index = 1
for i in range(len(one_list)):
    if one_list[i] != 0 and min_num >= one_list[i]:
        min_num = one_list[i]
        min_one_list_index = i
A_list_min = A_list[min_one_list_index]
del A_list[min_one_list_index]


def ceil(src, range):
    if src % 10 == 0:
        return src
    else:
        return ((int)(src / range) + 1 ) * range


for i in range(len(A_list)):
    A_list[i] = ceil(int(A_list[i]), 10)
print(sum(A_list)+int(A_list_min))

Buggy submission (verdict: Runtime Error):
A_list = []
for i in range(5):
    A_list.append(input())
one_list = []
one_list.append(int(A_list[0][-1]))
one_list.append(int(A_list[1][-1]))
one_list.append(int(A_list[2][-1]))
one_list.append(int(A_list[3][-1]))
one_list.append(int(A_list[4][-1]))
min_num = max(one_list)
for i in range(len(one_list)):
    if one_list[i] != 0 and min_num >= one_list[i]:
        min_num = one_list[i]
        min_one_list_index = i
A_list_min = A_list[min_one_list_index]
del A_list[min_one_list_index]


def ceil(src, range):
    if src % 10 == 0:
        return src
    else:
        return ((int)(src / range) + 1 ) * range


for i in range(len(A_list)):
    A_list[i] = ceil(int(A_list[i]), 10)
print(sum(A_list)+int(A_list_min))

Buggy submission (verdict: Runtime Error):
A_list = []
for i in range(5):
    A_list.append(input())
one_list = []
one_list.append(int(A_list[0][-1]))
one_list.append(int(A_list[1][-1]))
one_list.append(int(A_list[2][-1]))
one_list.append(int(A_list[3][-1]))
one_list.append(int(A_list[4][-1]))
min_num = max(one_list)
for i in range(len(one_list)):
    if one_list[i] != 0 and min_num >= one_list[i]:
        min_num = one_list[i]
        min_one_list_index = i
A_list_min = A_list[min_one_list_index]
del A_list[min_one_list_index]


def ceil(src, range):
    return ((int)(src / range) + 1 ) * range


for i in range(len(A_list)):
    A_list[i] = ceil(int(A_list[i]), 10)
print(sum(A_list)+int(A_list_min))
Problem p03085 (python)

Fixed submission:
b = input()
if b == "A":
    print("T")
elif b == "T":
    print("A")
elif b == "C":
    print("G")
else:
    print("C")

Buggy submission (verdict: Runtime Error):
b = int(input())
if b == "A":
    print("T")
elif b == "T":
    print("A")
elif b == "C":
    print("G")
else:
    print("C")
Problem p03086 (python)

Fixed submission:
S = input()
list_atgc = ["A", "C", "G", "T"]
demand_list = []
for i in range(len(S)):
    if S[i] in list_atgc:
        j = 0
        string_k = ""
        while True:
            if S[i+j] in list_atgc:
                string_k += S[i+j]
                demand_list.append(string_k)
                j += 1
                if i + j >= len(S):
                    break
            else:
                break
if demand_list:
    print(len(max(demand_list, key=len)))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
S = input()
list_atgc = ["A", "C", "G", "T"]
demand_list = []
for i in range(len(S)):
    if S[i] in list_atgc:
        for j in range(i, len(S)-i):
            if S[j] in list_atgc:
                demand_list.append(S[i:j+1])
print(len(max(demand_list, key=len)))

Buggy submission (verdict: Runtime Error):
S = input()
list_atgc = ["A", "C", "G", "T"]
demand_list = []
for i in range(len(S)):
    if S[i] in list_atgc:
        for j in range(i, len(S)-i):
            if S[j] in list_atgc:
                demand_list.append(S[i:j+1])
print(max(demand_list, key=len))
Problem p03102 (python)

Fixed submission:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
a = []
correct_num = 0
for i in range(N):
    a.append(list(map(int, input().split())))
    sum = 0
    for j in range(M):
        sum += a[i][j] * B[j]
    if sum + C > 0:
        correct_num += 1
    else:
        pass
print(correct_num)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
a = []
correct_num = 0
for i in range(N):
    a.append(map(int, input().split()))
    sum = 0
    for j in range(M):
        sum + =a[i][j] * B[j]
    if sum > 0:
        correct_num += 1
    else:
        pass
print(sum)
Problem p03103 (python)

Fixed submission:
N, M = map(int, input().split())
A_B = []
for i in range(N):
    A_B.append(list(map(int, input().split())))
A_B.sort()
sum = 0
money = 0
i = 0
while sum <= M and i < N:
    money += A_B[i][0] * A_B[i][1]
    sum += A_B[i][1]
    i += 1
money -= A_B[i-1][0] * (sum - M)
print(money)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A_B = []
for i in range(N):
    A_B.append(list(map(int, input().split())))
A_B.sort()
sum = 0
money = 0
i = 0
while sum <= M:
    money += A_B[i][0] * A_B[i][1]
    sum += A_B[i][1]
    i += 1
money -= A_B[i-1][0] * (sum - M)
print(money)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A_B = []
for i in range(N):
    A_B.append(list(map(int, input().split())))
A_B.sort()
print(A_B)
sum = 0
money = 0
i = 0
while sum <= M:
    money += A_B[i][0] * A_B[i][1]
    sum += A_B[i][1]
    print(sum)
    i += 1
money -= A_B[i-1][0] * (sum - M)
print(money)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = []
for i in range(N):
    A.append(list(map(int , input().split())))
A = sorted(A)
min_money = 0
if A[0][1] >= M:
    min_money = A[0][0] * M
else:
    i = 0
    num_of_buy = A[0][1]
    min_money = A[0][0] * A[0][1]
    while True:
        if num_of_buy + A[i+1][1] > M:
            min_money += A[i+1][0] * (M - num_of_buy)
            break
        else:
            min_money += A[i+1][0] * A[i+1][1]
            num_of_buy += A[i+1][1]
            i += 1
print(min_money)