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

Fixed submission:
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd+1):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
yakusuu_arr.sort(reverse=True)
print(yakusuu_arr[K-1])

Buggy submission (verdict: Runtime Error):
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
print(yakusuu_arr)
print(yakusuu_arr[-K+1])

Buggy submission (verdict: Runtime Error):
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
print(yakusuu_arr[K-1])

Buggy submission (verdict: Runtime Error):
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while x % y != 0:
            z = x % y
            x = y
            y = z
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
print(yakusuu_arr[K-1])

Buggy submission (verdict: Runtime Error):
import math
A, B, K = map(int, input().split())
A_B_gcd = math.gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
print(yakusuu_arr[K-1])
Problem p03146 (python)

Fixed submission:
s = int(input())
s_list = []
if s != 1 or s != 2:
    while s != 1:
        if s % 2 == 0:
            s = s / 2
        else:
            s = 3 * s + 1
        s_list.append(s)
    print(max(len(s_list)+2, 4))
else:
    print(4)

Buggy submission (verdict: Runtime Error):
s = int(input())
s_list = []
if s != 1 or s != 2:
    while s != 1:
        if s % 2 == 0:
            s = s / 2
        else:
            s = 3 * s + 1
        s_list.append(s)
    print(max(len(s_list)+2), 4)
else:
    print(4)
Problem p03150 (python)

Fixed submission:
s = input()
if s[:7] == 'keyence':
    print('YES')
    exit()
if s[-7:] == 'keyence':
    print('YES')
    exit()
for i in range(len(s)):
    if s[:i] + s[-(7-i):] == 'keyence':
        print('YES')
        exit()
print('NO')

Buggy submission (verdict: Runtime Error):
s = input()
if s[:7] == 'keyence':
    print('YES')
    exit()
if s[-7:] == 'keyence':
    print('YES')
    exit()
for i in range(n):
    if s[:i] + s[-(7-i):] == 'keyence':
        print('YES')
        exit()
print('NO')

Buggy submission (verdict: Runtime Error):
s = input()
if s[:7] === 'keyence':
    print('YES')
    exit()
if s[-7:] === 'keyence':
    print('YES')
    exit()
for i in range(n):
    if s[:i] + s[-(7-i):] == 'keyence':
        print('YES')
        exit()
print('NO')
Problem p03244 (python)

Fixed submission:
import itertools
from collections import Counter


n = int(input())
v = list(map(int, input().split()))
ev_cnt = Counter(v[::2])
od_cnt = Counter(v[1::2])
ev_cnt[-1] = 0
od_cnt[-2] = 0
ev = ev_cnt.most_common(2)
od = od_cnt.most_common(2)
ans = n
for (k1, v1), (k2, v2) in itertools.product(ev, od):
    if k1 == k2:
        continue
    x = (n - v1 - v2)
    ans = min(ans, x)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
count=0
v=[]
v=[int(i) for i in input().split()]
for i in range(n-2):
    if v[i]==v[i+2]:
        pass
    else:
        count+=1
num=v[0]
for i in range(n):
    v.remove(num)
print(v)
if len(v)==0:
    if n%2==0:
        count=int(n/2)
    else:
        count=int((n-1)/2)
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
count=0
v=[]
v=[int(i) for i in input().split()]
for i in range(n-2):
    if v[i]==v[i+2]:
        pass
    else:
        count+=1
v.pop(v[0])
if len(v)==0:
    if n%2==0:
        count=int(n/2)
    else:
        count=int((n-1)/2)
print(count)
Problem p03280 (python)

Fixed submission:
def square():
    x,y=[int(i) for i in input().split()]
    print( x*y-x-y+1)

square()

Buggy submission (verdict: Runtime Error):
import sys

def square():
    argvs=sys.argv
    print( int(argvs[1])*int(argvs[2])-int(argvs[1])-int(argvs[2])+1)

square()
Problem p03281 (python)

Fixed submission:
def calculate_num_of_divisor(N):
    yakusuu = []
    for i in range(1, N+1):
        if N % i == 0:
            yakusuu.append(i)
    return len(yakusuu)

N = int(input())
count = []
for i in range(N+1):
    if i % 2 == 1 and calculate_num_of_divisor(i) == 8:
        count.append(i)
print(len(count))

Buggy submission (verdict: Runtime Error):
import sys
from collection import defaultdict
import math

def calc(num):
    if num<=1:
        return 1
    else:
        num_sqrt=math.floor(math.sqrt(num))
        prime_list=make_prime_list_2(num_sqrt)

        dict_counter=defaultdict(int)
        for prime in prime_list:
            while num % prime==0:
                dict_counter[prime]+=1
                num //=prime
        if num !=1:
            dict_counter[num]+=1

        dict_counter=dict(dict_counter)

        return dict_counter
def main():
    num=input()
    eight_counter=[]
    calc_result=calc(num)
    for i in range(num):
        if calc_result==8:
            eight_counter.append(num)
        else:
            pass
    print(len(eight_counter))

main()

Buggy submission (verdict: Runtime Error):
import sys
from collection import defaultdict
import math

def calc(num):
    if num<=1:
        return 1
    else:
        num_sqrt=math.floor(math.sqrt(num))
        prime_list=make_prime_list_2(num_sqrt)

        dict_counter=defaultdict(int)
        for prime in prime_list:
            while num % prime==0:
                dict_counter[prime]+=1
                num //=prime
        if num !=1:
            dict_counter[num]+=1

        dict_counter=dict(dict_counter)

        return dict_counter
def main():
    num=input()
    eight_counter=[]
    for i in range(num):
        if calc(num)==8:
            eight_counter.append(num)
        else:
            pass
    print(len(eight_counter))

main()

Buggy submission (verdict: Runtime Error):
import sys
from collection import defaultdict
import math

def calc(num):
    if num<=1:
        return 1
    else:
        num_sqrt=math.floor(math.sqrt(num))
        prime_list=make_prime_list_2(num_sqrt)

        dict_counter=defaultdict(int)
        for prime in prime_list:
            while num % prime==0:
                dict_counter[prime]+=1
                num //=prime
        if num !=1:
            dict_counter[num]+=1

        dict_counter=dict(dict_counter)

        return dict_counter
def main():
    argvs=sys.argv
    num=int(argvs[1])
    eight_counter=[]
    for i in range(num):
        if calc(num)==8:
            eight_counter.append(num)
        else:
            pass
    print(len(eight_counter))

main()
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
flg = False
for i in range(K):
    if S[i] != '1':
        print(S[i])
        flg = False
        break
    else:
        flg = True
if flg:
    print('1')

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
S_list = []
infinity = 50000000000000
S_str = str()
for i in range(len(S)):
    if int(S[i]) != 1:
        S_list.append(S[i])
        break
    else:
        pass
print(S_list[0])
Problem p03293 (python)

Fixed submission:
S = input()
T = input()
ans = 'No'
if S == T:
    ans = 'Yes'
for i in range(len(S)):
    S = S[-1] + S
    S = S[:-1]
    if S == T:
        ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
ans = 'No'
if S == T:
    ans = 'Yes'
for i in range(len(S)):
    S = S[-1] + S
    S = S.rstrip(S[-1])
    if S == T:
        ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
ans = 'No'
for i in range(len(S)):
    S = S[-1] + S
    S = S.rstrip(S[-1])
    if S == T:
        ans = 'Yes'
print(ans)
Problem p03316 (python)

Fixed submission:
N = input()
S = 0
for i in range(len(N)):
    S += int(N[i])
if int(N) % S == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = input()
S = 0
for i in range(len(N)):
    S += int(N[i])
if N % S == 0:
    print('Yes')
else:
    print('No')
Problem p03351 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
if (abs(b-a) <= d and abs(c-b) <= d) or abs(c-a) <= d:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
if (abs(b-a) <= d and abd(c-b) <= d) or abs(c-a) <= d:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a=input("数字を入力してください")
b=input("数字を入力してください")
c=input("数字を入力してください")
d=input("数字を入力してください")

if b-a<=d:
    if c-b<=d:
        print('Yes')
    else:
        print('No')
else:
    print('No')
Problem p03352 (python)

Fixed submission:
x = int(input())
set_x = set(n**e for n in range(32) for e in range(2, 11) if n**e <= x)
ans = max(set_x)
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
set_x = set(n**e for n in range(32) for e in range(2, 11) if n**e <= X)
ans = max(set_x)
print(ans)
Problem p03361 (python)

Fixed submission:
h, w = map(int, input().split())
s = ['.' * (w+2)] + ['.' + input() + '.' for _ in [0]*h] + ['.' * (w+2)]
a = 'Yes'
for i in range(1, h+1):
    for j in range(1, w+1):
        if s[i][j] == '#':
            if s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and\
               s[i][j+1] == '.':
                a = 'No'
print(a)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
s_list = []
for i in range(W):
    s_list.append(input())
cnt = 0
for i in range(1, H):
    for j in range(1, W):
        if s_list[i][j] == '#':
            if s_list[i][j-1] != '#' and s_list[i-1][j] != '#'\
               and s_list[i][j+1] !='#' and s_list[i+1][j] != '#':
            cnt += 1
if cnt == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
s_list = []
for i in range(W):
    s_list.append(input())
cnt = 0
for i in range(1, H):
    for j in range(1, W):
        if s_list[i][j] == '#' and s_list[i][j-1] != '#' and\
           s_list[i-1][j] != '#' and s_list[i][j+1] !='#' and\
                                                       s_list[i+1][j] != '#':
            cnt += 1
if cnt == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
s_list = []
for i in range(W):
    s_list.append(input())
cnt = 0
for i in range(H):
    for j in range(1, W):
        if s_list[i][j] == '#' and s_list[i][j-1] != '#' and\
           s_list[i-1][j] != '#' and s_list[i][j+1] !='#' and\
                                                       s_list[i+1][j] != '#':
            cnt += 1
if cnt == 0:
    print('Yes')
else:
    print('No')
Problem p03427 (python)

Fixed submission:
ns = list(map(int, list(input())))
print(max(sum(ns), ns[0]-1 + 9*(len(ns)-1)))

Buggy submission (verdict: Runtime Error):
n = input()
print(max((len(n)-1)*9 + int(n[0])-1, sum(n)))
Problem p03438 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
for a_, b_ in zip(a, b):
    if a_ > b_:
        cnt += a_ - b_
    else:
        cnt -= (b_ - a_) // 2
if cnt <= 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
for a_, b_ in zip(a, b):
    if a_ > b_:
        cnt += a - b
    else:
        cnt -= (b - a) // 2
if cnt <= 0:
    print('Yes')
else:
    print('No')
Problem p03450 (python)

Fixed submission:
import sys
sys.setrecursionlimit(200002)


def dfs(s):
    global x, G
    for t, d in G[s]:
        if x[t] is None:
            x[t] = x[s] + d
            if not dfs(t):
                return False
        else:
            if x[t] != x[s] + d:
                return False
    return True


n, m = map(int, input().split())
x = [None] * n
G = [[] for _ in range(n)]
for _ in range(m):
    l, r, d = map(int, input().split())
    G[l-1].append([r-1, d])
    G[r-1].append([l-1, -d])
res = True
for i in range(n):
    if x[i] is None:
        x[i] = 0
        res &= dfs(i)
print('Yes' if res==True else 'No')

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(200002)


def dfs(s):
    global x, G
    for t, d in G[s]:
        if x[t] is None:
            x[t] = x[s] + d
            if not dfs(t):
                return False
        else:
            if x[t] != x[s] + d:
                return False
    return True


n, m = map(int, input().split())
x = [None] * n
G = [[] for _ in range(n)]
for _ in range(m):
    l, r, d = map(int, input().split())
    G[l-1].append([r-1, d])
    g[r-1].append([l-1, -d])
res = True
for i in range(n):
    if x[i] is None:
        x[i] = 0
        res &= dfs(i)
print('Yes' if res==True, else 'No')
Problem p03457 (python)

Fixed submission:
N = int(input())
t = [0]*N
x = [0]*N
y = [0]*N
for i in range(N):
    t, x, y = map(int, input().split())
    if ((x+y)%2) != (t%2):
        print('No')
        exit()
    if t < x+y:
        print('No')
        exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
t = [0]*N
x = [0]*N
y = [0]*N
for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())
    if ((x+y)%2) != (t%2):
        print('No')
        exit()
    if t < x+y:
        print('No')
        exit()
print('Yes')
Problem p03472 (python)

Fixed submission:
n, h = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(n)]
A,B = zip(*AB)
a = max(A)
B = [b for b in B if b > a]
B.sort(reverse=True)
ans = 0
hp = h
attack_cnt = 0
for b in B:
    if hp <= 0:
        break
    attack_cnt += 1
    hp -= b
if hp > 0:
    attack_cnt += (hp - 1) // a + 1
print(attack_cnt)

Buggy submission (verdict: Runtime Error):
n, h,  *ab = map(int, open(0).read().split())
a = ab[::2]
x = max(a)
b = sorted([i for i in ab[1**2] if i > x], reverse=1)
ans = 0
for i in b:
    ans += 1
    h -= i
    if h <= 0:
        break
ans += (h + x - 1) // x
print(ans)

Buggy submission (verdict: Runtime Error):
n, h,  *ab = map(int, open(0).read().split())
a = ab[::2]
x = max(a)
b = sorted([i for i in ab[1**2] if i > x], reverse=1)
ans = 0
for i in b:
    ans += 1
    h -= i
    if h <= 0:
        break
ans += (h + x = 1) // x
print(ans)
Problem p03474 (python)

Fixed submission:
a, b = map(int, input().split())
s = list(input())
num = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
if s[a] == '-' and len(s) == (a+b+1) and s.count('-')==1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a, b = map(int. input().split())
s = list(input())
if s[a] == '-' and len(s) == (a+b):
    print('Yes')
else:
    print('No')
Problem p03494 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
def pow(x):
    if x % 2 != 0:
        return 0
    else:
        return 1 + pow(x/2)
print(min(pow(_) for _ in a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
def pow(x):
    if x % 2 == 0:
        return 0
    else:
        return 1 + pow(x/2)
print(min(pow(_) for _ in a))
Problem p03545 (python)

Fixed submission:
abcd = input()
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
d = int(abcd[3])
ans_list = []
if a+b+c+d == 7:
    print(str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'=7')
elif a-b+c+d == 7:
    print(str(a)+'-'+str(b)+'+'+str(c)+'+'+str(d)+'=7')
elif a+b-c+d == 7:
    print(str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'=7')
elif a+b+c-d == 7:
    print(str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'=7')
elif a-b-c+d == 7:
    print(str(a)+'-'+str(b)+'-'+str(c)+'+'+str(d)+'=7')
elif a-b-c-d == 7:
    print(str(a)+'-'+str(b)+'-'+str(c)+'-'+str(d)+'=7')
elif a+b-c-d == 7:
    print(str(a)+'+'+str(b)+'-'+str(c)+'-'+str(d)+'=7')
else:
    print(str(a)+'-'+str(b)+'+'+str(c)+'-'+str(d)+'=7')

Buggy submission (verdict: Runtime Error):
abcd = input()
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[-2])
d = int(abcd[-1])
if (a-b-c-d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
if (a-b+c+d) == 7:
    print(f'{a}-{b}+{c}+{d}=7')
    exit()
if (a+b+c+d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
if (a+b-c+d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
if (a+b+c-d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
if (a+b-c-d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
if (a-b+c-d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
if (a-b-c+d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
Problem p03547 (python)

Fixed submission:
x, y = input().split()
if x > y:
    print('>')
elif x == y:
    print('=')
else:
    print('<')

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x > y:
    print('>')
else:
    print('<')
Problem p03557 (python)

Fixed submission:
import bisect
import sys
input = sys.stdin.readline


N = int(input())
A = list(map(int ,input().split()))
B = list(map(int ,input().split()))
C = list(map(int ,input().split()))
A.sort()
B.sort()
C.sort()
cnt = 0
for j in B:
    a_index = bisect.bisect_left(A, j)
    c_index = bisect.bisect_right(C, j)
    cnt += a_index*(N-c_index)
print(cnt)

Buggy submission (verdict: Runtime Error):
import bisect
input = sys.stdin.readline


N = int(input())
A = list(map(int ,input().split()))
B = list(map(int ,input().split()))
C = list(map(int ,input().split()))
A.sort()
B.sort()
C.sort()
cnt = 0
for j in B:
    a_index = bisect.bisect_left(A, j)
    c_index = bisect.bisect_right(C, j)
    cnt += len(A[:a_index])*len(C[c_index:])
print(cnt)

Buggy submission (verdict: Runtime Error):
import bisect
input = sys.stdin.readline


N = int(input())
A = list(map(int ,input().split()))
B = list(map(int ,input().split()))
C = list(map(int ,input().split()))
A.sort()
B.sort()
C.sort()
cnt = 0
for j in B:
    a_index = bisect.bisect_left(A, j)
    c_index = bisect.bisect_right(C, j)
    cnt += len(A[:a_index])*len(C[c_index:])
print(cnt)
Problem p03575 (python)

Fixed submission:
n, m = map(int, input().split())
edges = [list(map(int, input().split())) for i in range(m)]
ans = 0
for x in edges:
    l = list(range(n))
    for y in edges:
        if y != x:
            l = [l[y[0]-1] if l[i] == l[y[1]-1] else l[i] for i in range(n)]
    if len(set(l)) != 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
const int limit = 50;

int n, m;
int a[limit], b[limit];

bool graph[limit][limit];
bool visited[limit];

void dfs(int v){
    visited[v] = true;
    for (int v2=0; v2<n;++v2){
        if (graph[v][v2]==false) continue;
        if (visited[v2]==true) continue;
        dfs(v2);
    }
}

int main(void){
    cin >> n >> m;
    for (int i=0; i<m; ++i){
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
        for (int j=0; j<n; ++j) visited[j] = false;
        dfs(0);
        bool bridge = false;
        for (j=0; j<n; ++j) if (visited[j] == false) bridge = true;
        if (bridge) ans += 1;
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
        }
    cout << ans << endl;
    return 0;
    }
Problem p03599 (python)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
A *= 100
B *= 100
water = []
sugar = []
for i in range(1+F//A):
    for j in range(1+F//B):
        if i * A + j * B <= F:
            water.append(i * A + j * B)
for i in range(1+F//C):
    for j in range(1+F//D):
        if i * C + j * D <= F:
            sugar.append(i * C + j * D)
max_sugar_percent = 0
max_sugar_water = 0
max_sugar = 0
water.sort()
sugar.sort()
for i in water:
    for j in sugar:
        if i + j > F:
            break
        if j > E * i / 100:
            break
        sugar_percent = i and (100 * j) / (i + j)
        if sugar_percent >= max_sugar_percent:
            max_sugar_percent = sugar_percent
            max_sugar = j
            max_sugar_water = i + j
print(max_sugar_water, max_sugar)

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())
A *= 100
B *= 100
water = []
sugar = []
for i in range(1+F//A):
    for j in range(1+F//B):
        if i * A + j * B <= F:
            water.append(i * A + j * B)
for i in range(1+F//C):
    for j in range(1+F//D):
        if i * C + j * D <= F:
            sugar.append(i * C + j * D)
max_sugar_percent = 0
max_sugar_water = 0
max_sugar = 0
water.sort()
sugar.sort()
for i in water:
    for j in sugar:
        if i + j > F:
            break
        if j > E * i / 100:
            break
        sugar_percent = i and (100 * s) / (i + j)
        if sugar_percent >= max_sugar_percent:
            sugar_percent = max_sugar_percent
            max_sugar = j
            max_sugar_water = i + j
print(max_sugar_water, max_sugar)
Problem p03608 (python)

Fixed submission:
from collections import deque
import itertools
from scipy.sparse.csgraph import floyd_warshall as wf
import sys


MAX = 1e9


def main():
    n, m, r = map(int, input().split())
    R = list(map(int, input().split()))
    link = [[MAX if j != i else 0 for j in range(n+1)] for i in range(n+1)]
    for i in range(m):
        a, b, c = map(int, input().split())
        link[a][b] = c
        link[b][a] = c
    link = wf(link)
    ans = MAX
    for per in list(itertools.permutations(R)):
        tmp = 0
        for i in range(r-1):
            tmp += link[per[i]][per[i+1]]
        ans = min(ans, tmp)
    print(int(ans))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from collections import deque
import itertools
from scipy.sparse.csgraph import floyd_warshall as wf
import sys


MAX = 1e9


def main():
    n, m, r = map(int, input().split())
    r = list(map(int, input().split()))
    link = [[MAX if j != i else 0 for j in range(n+1)] for i in range(n+1)]
    for i in range(m):
        a, b, c = map(int, input().split())
        link[a][b] = c
        link[b][a] = c
    link = wf(link)
    ans = MAX
    for per in list(itertools.permutations(r)):
        tmp = 0
        for i in range(r-1):
            tmp += link[per[i]][pre[i+1]]
        ans = min(ans, tmp)
    print(int(ans))


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

Fixed submission:
from collections import Counter
N = int(input())
a = list(map(int, input().split()))
i_list = []
for i in a:
    i_list.append(i-1)
    i_list.append(i)
    i_list.append(i+1)
print(Counter(i_list).most_common()[0][1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
a = list(map(int, input().split()))
i_list = []
#return tuple list: Counter().most_common()                                                                          for i in a:
    i_list.append(i-1)
    i_list.append(i)
    i_list.append(i+1)
print(Counter(i_list).most_common()[0][1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
a = list(map(int, input().split()))
i_list = []
#return tuple list: Counter().most_common()                                                                          for i in a:
    i_list.append(i-1)
    i_list.append(i)
    i_list.append(i+1)
print(i_list)
print(Counter(i_list).most_common()[0][1])

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
i_list = []
for x in range(max(a)):
    cnt = 0
    for i in range(N):
        if abs(x - a[i]) == 1 or x == a[i]:
            cnt += 1
    i_list.append(cnt)
print(max(i_list))