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

Fixed submission:
import math
import fractions
n, m = map(int, input().split())
a = list(map(int, input().split()))
num = 1
cnt = []
for x in a:
    c = 0
    for i in range(int(math.log(x,2))):
        if x>>c&1:
            break
        else:
            c+=1
    cnt.append(c)
if max(cnt) != min(cnt):
    print(0)
else:
    for x in a:
        num = num * (x//2) // fractions.gcd(num, x//2)
    print(m//num-(m//num)//2)

Buggy submission (verdict: Runtime Error):
import fractions
n, m = map(int, input().split())
a = list(map(int, input().split()))
num = 1
cnt = []
for x in a:
    c = 0
    for i in range(int(math.log(x,2))+1):
        if x>>c&1:
            break
        else:
            c+=1
    cnt.append(c)
if max(cnt) != min(cnt):
    print(0)
else:
    for x in a:
        num = num * (x//2) // fractions.gcd(num, x//2)
    print(m//num-(m//num)//2)

Buggy submission (verdict: Runtime Error):
import math
n, m = map(int, input().split())
a = list(map(int, input().split()))
num = 1
for x in a:
    num = num * (x//2) // math.gcd(num, x//2)
cnt = 0
print(m//num-(m//num)//2)

Buggy submission (verdict: Runtime Error):
import math
n, m = map(int, input().split())
a = list(map(int, input().split()))
num = 1
for x in a:
    num = num * (x//2) // math.gcd(num, x)
cnt = 0
print(m//num-(m//num)//2)

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
    for i in reversed(range(min(x, y) + 1)):
        if x%i == 0 and y % i == 0:
            return i

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(numbers):
    if len(numbers) == 2:
        return lcm_base(numbers[0], numbers[1])
    a = numbers.pop()
    return lcm_base(a, lcm(numbers))
N, M = map(int, input().split())
a = list(map(int, input().split()))
b = lcm(a)//2
ans = (M - b)//lcm(a) + 1
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
N, M = map(int, input().split())
a = list(map(int, input().split()))
b = lcm(a)//2
ans = (M - b)//lcm(a) + 1
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
N, M = map(int, input().split())
a = list(map(int, input().split()))
b = lcm(a)//2
ans = (M - b)//lcm(a) + 1
print(ans)
Problem p02900 (python)

Fixed submission:
from fractions import gcd
from math import sqrt
A, B = map(int, input().split())
n = gcd(A,B)
ans = 0
i = 2
while i ** 2 <= n:
    if n%i == 0:
        ans += 1
        while n%i == 0:
            n //= i
    i += 1
if n > 1:
    ans += 1
print(ans+1)

Buggy submission (verdict: Runtime Error):
from sympy import sieve
from fractions import gcd
from math import sqrt
A, B = map(int, input().split())
n = gcd(A,B)
ans = 0
for x in sieve.primerange(2,n//2+1):
    if n%x == 0:
        ans += 1
print(ans+1)
Problem p03164 (python)

Fixed submission:
N, W = map(int, input().split())
w = [0]*N
v = [0]*N
for i in range(N):
    w[i], v[i] = map(int, input().split())
vmax = max(v)
dp = [[0]*(N * vmax + 1) for i in range(N + 1)]
dp[0][0] = 0
for j in range(N * vmax):
    dp[0][j + 1] = float("inf")

for i in range(N):
    for j in range(N * vmax + 1):
        if j < v[i]:
            dp[i + 1][j] = dp[i][j]
        else: 
            dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i])

ans = 0
for j in range(N * vmax + 1):
    if dp[N][j] <= W:
        ans = j
print(ans)

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
w = [0]*N
v = [0]*N
for i in range(N):
    w[i], v[i] = map(int, input().split())
vmax = max(v)
dp = [[0]*(N * vmax + 1) for i in range(N + 1)]
dp[0][0] = 0
for j in range(N * vmax):
    dp[0][j + 1] = float("inf")

for i in range(N):
    for j in range(N * vmax + 1):
        if j < v[i]:
            dp[i + 1][j] = dp[i][j]
        else: 
            dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i])

ans = 0
for j in range(N*vmax):
    if dp[N][j] <= W:
        ans = j
print(ans
Problem p03174 (python)

Fixed submission:
mod = 10**9+7
N = int(input())
li = [list(map(int, input().split())) for i in range(N)]
lc = [0] * (1<<N)
dp = [0]*(1<<N)
dp[0] = 1
for S in range(1, 1<<N):
    lc[S] = lc[S>>1]+S%2
    for i in range(N):
        if S>>i&li[lc[S]-1][i] == 1:
            dp[S] = (dp[S]+dp[S-(1<<i)]) %mod
print(dp[(1<<N)-1])

Buggy submission (verdict: Runtime Error):
lc = [0] * (1<<N)
mod = 10**9+7
N = int(input())
li = [list(map(int, input().split())) for i in range(N)]
dp = [0]*(1<<N)
dp[0] = 1
for S in range(1, 1<<N):
    lc[S] = lc[S>>1]+S%2
    for i in range(N):
        if S>>i&li[lc[S]-1][i] == 1:
            dp[S] = (dp[S]+dp[S-(1<<i)]) %mod
print(dp[(1<<N)-1])
Problem p03231 (python)

Fixed submission:
import fractions
N, M = map(int, input().split())
S = input()
T = input()
f = fractions.gcd(N, M)
flag = True
for i in range(f):
    if S[i*N//f] != T[i*M//f]:
        flag = False
        break
print([-1,N*M//f][flag])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
S = input()
T = input()
f = fractions.gcd(N, M)
flag = True
for i in range(f):
    if S[i*N//f] != T[i*M//f]:
        flag = False
        break
print([-1,N*M//f][flag])
Problem p03498 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
cnt1 = 0
li1 = []
for i in range(1,N):
    M = max(a)
    num = 0
    for j in range(N):
        if a[j] == M:
            n = j
    if a[i] < a[i-1]:
        if M <= 0:
            cnt1= -1
            break
        num += -((-a[i-1]+a[i])//M)
        if num < 0 or num > 2*N:
            cnt1 = -1
            break
        a[i] += num*M
        for j in range(num):
            li1.append([n+1, i+1])
        cnt1 += num
cnt2 = 0
li2 = []
for i in range(1,N):
    M = min(a)
    num = 0
    for j in range(N):
        if a[j] == M:
            n = j
    if a[N-i] < a[N-i-1]:
        if M >= 0:
            cnt2 = -1
            break
        num += -((-a[N-i-1]+a[N-i])//(-M))
        if num < 0 or num > 2*N:
            cnt2 = -1
            break
        a[N-i-1] += num *M
        for j in range(num):
            li2.append([n+1, N-i])
        cnt2 += num
if cnt1 <= 2*N and cnt1 >= 0:
    print(cnt1)
    for x in li1:
        print(*x)
else:
    print(cnt2)
    for x in li2:
        print(*x)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
if abs(max(a)) >= abs(min(a)):
    for i in range(N):
        if a[i] = max(a):
            num = i
            break
    print(2*N-1)
    for i in range(N):
        if num != i:
            print(num+1, i+1)
    print(num+1, num+1)
    for i in range(1,N):
        print(i, i+1)
else:
    for i in range(N):
        if a[i] = min(a):
            num = i
            break
    print(2*N-1)
    for i in range(N):
        if num != i:
            print(num+1, i+1)
    print(num+1, num+1)
    for i in range(N):
        print(N-i, N-i-1)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
cnt1 = 0
li1 = []
for i in range(1,N):
    M = max(a)
    num = 0
    for j in range(N):
        if a[j] == M:
            n = j
    if a[i] < a[i-1]:
        num += -((-a[i-1]+a[i])//M)
        if num < 0:
            cnt1 = -1
            break
        a[i] += num*M
        for j in range(num):
            li1.append([n+1, i+1])
        cnt1 += num
cnt2 = 0
li2 = []
for i in range(1,N):
    M = min(a)
    num = 0
    for j in range(N):
        if a[j] == M:
            n = j
    if a[N-i] < a[N-i-1]:
        num += -((-a[N-i-1]+a[N-i])//(-M))
        if num < 0:
            cnt2 = -1
            break
        a[N-i-1] += num *M
        for j in range(num):
            li2.append([n+1, N-i])
        cnt2 += num
if cnt1 <= 2*N and cnt1 >= 0:
    print(cnt1)
    for x in li1:
        print(*x)
else:
    print(cnt2)
    for x in li2:
        print(*x)
Problem p03559 (python)

Fixed submission:
from collections import defaultdict
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ad = defaultdict(lambda: -1)
i, j = 0, 0
while i < N and j < N:
    if A[i] < B[j]:
        ad[i] = j
        i += 1
    else:
        j += 1
bd = defaultdict(lambda: -1)
i, j = 0, 0
while i < N and j < N:
    if B[i] < C[j]:
        bd[i] = j
        i += 1
    else:
        j += 1
csum = [0] * N
for i in range(N):
    if bd[i] >= 0:
        csum[i] = N-bd[i]
bsum = [0]* N
cnt = 0
for i in range(N):
    cnt += csum[N-1-i]
    bsum[N-1-i] = cnt
ans = 0
for i in range(N):
    if ad[i] >= 0:
        ans += bsum[ad[i]]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ad = defaultdict(lambda: -1)
i, j = 0, 0
while i < N and j < N:
    if A[i] < B[j]:
        ad[i] = j
        i += 1
    else:
        j += 1
bd = defaultdict(lambda: -1)
i, j = 0, 0
while i < N and j < N:
    if B[i] < C[j]:
        bd[i] = j
        i += 1
    else:
        j += 1
csum = [0] * N
for i in range(N):
    if bd[i] >= 0:
        csum[i] = N-bd[i]
bsum = [0]* N
cnt = 0
for i in range(N):
    cnt += csum[N-1-i]
    bsum[N-1-i] = cnt
ans = 0
for i in range(N):
    if ad[i] >= 0:
        ans += bsum[ad[i]]
print(ans)
Problem p03612 (python)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    if p[i] == i+1:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1
if p[n-1] == n:
    p[n-1], p[n-2] = p[n-2], p[n-1]
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    if p[i] == i+1:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1
if p[n-1] = n:
    p[n-1], p[n-2] = p[n-2], p[n-1]
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
    if p[i] == i+1:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1
print(ans)
Problem p03633 (python)

Fixed submission:
from fractions import gcd
def lcm(list):
    if len(list) == 1:
        return list[0]
    if len(list) == 2:
        [a, b] = list
        return a*b//gcd(a,b)
    x = list.pop()
    y = lcm(list)
    return x*y//gcd(x,y)

N = int(input())
li = []
for i in range(N):
    li.append(int(input()))
print(lcm(li))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
def lcm(list):
    if len(list) == 2:
        [a, b] = list
        return a*b//gcd(a,b)
    x = list.pop()
    y = lcm(list)
    return x*y//gcd(x,y)

N = int(input())
li = []
for i in range(N):
    li.append(int(input()))
print(lcm(li))
Problem p03910 (python)

Fixed submission:
N = int(input())
if N == 1 or N == 2:
    print(N)
else:
    for i in range(N+1):
        if i*(i+1)//2 > N:
            num = i-1
            break
    ans = []
    for i in range(num):
        ans.append(i+1)
    if num*(num+1)//2 != N:
        cnt = N-num*(num+1)//2
        ans.remove(num+1-cnt)
        ans.append(num+1)
    for x in ans:
        print(x)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N == 1 or N == 2:
    print(N)
else:
    for i in range(N):
        if i*(i+1)//2 > N:
            num = i-1
            break
    ans = []
    for i in range(num):
        ans.append(i+1)
    if num*(num+1)//2 != N:
        cnt = N-num*(num+1)//2
        ans.pop(num-cnt)
        ans.append(num+1)
    for x in ans:
        print(x)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N == 1 or N == 2:
    print(N)
else:
    for i in range(N):
        if i*(i+1)//2 > N:
            num = i-1
            break
    ans = []
    for i in range(num):
        ans.append(i+1)
    if num*(num+1)//2 != N:
        cnt = N-num*(num+1)//2
        ans.remove(num+1-cnt)
        ans.append(num+1)
    for x in ans:
        print(x)
Problem p04041 (python)

Fixed submission:
mod = 10**9+7
N,X,Y,Z = map(int, input().split())
Num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*Num for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for k in range(Num):
        for j in range(1,11):
            a = (k<<j)|(1<<(j-1))
            if a&ng != ng:
                a &= Num-1
                dp[i+1][a] += dp[i][k]
                dp[i+1][a] %= mod
cnt = 1
for i in range(N):
    cnt *= 10
    cnt %= mod
for x in dp[N]:
    cnt -= x
    cnt %= mod
print(cnt)

Buggy submission (verdict: Runtime Error):
mod = 10**9+7
N,X,Y,Z = map(int, input().split())
num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*Num for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(1,11):
        for k in range(num):
            K = (k*2+1)<<(j-1)
            if K&ng != ng:
                K &= Num-1
                dp[i+1][K] += dp[i][k]
                dp[i+1][K] %= mod

print((10**N%mod-sum(dp[N])%mod)%mod)

Buggy submission (verdict: Runtime Error):
mod = 10**9+7
N,X,Y,Z = map(int, input().split())
Num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*(1<<l) for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(1, 11):
        for k in range(Num):
            a = (k<<j)|(1<<(j-1))
            if a&ng != ng:
                a &= Num-1
                dp[i+1][a] += dp[i][k]
                dp[i+1][a] %= mod
cnt = 0
for x in dp[N]:
    cnt += x
    cnt %= mod
print((10**N%mod-cnt)%mod)

Buggy submission (verdict: Runtime Error):
mod = 10**9+7
N,X,Y,Z = map(int, input().split())
Num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*(1<<l) for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(1, 11):
        for k in range(Num):
            a = (k<<j)|(1<<(j-1))
            if a&ng != ng:
                a &= Num-1
                dp[i+1][a] += dp[i][k]
                dp[i+1][1] %= mod
print((10**N-sum(dp[N]))%mod)
Problem p03076 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
nums =[a, b, c, d, e]
tmp = [i % 10 for i in nums]
if a % 10 == b % 10 == c % 10 == d % 10 == e % 10 == 0:
    print(a + b + c + d + e)
else:
    mm = [10 - i % 10 for i in nums]
    mm = [x for x in mm if x != 10]
    for i in range(5):
        if nums[i] % 10 == 0:
            ans += nums[i]
        else:
            ans += nums[i] + (10 - nums[i] % 10)
    print(ans - max(mm))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
nums =[a, b, c, d, e]
tmp = [i % 10 for i in nums]
mm = [10 - i % 10 for i in nums]
mm = [x for x in mm if x != 10]
tmp = set(tmp)
tmp = list(tmp)
for i in range(5):
    if nums[i] % 10 == 0:
        ans += nums[i]
    else:
        ans += nums[i] + (10 - nums[i] % 10)
print(ans - max(mm))
Problem p03693 (python)

Fixed submission:
r, g, b = map(int, input().split())
a = r * 100 + g * 10 + b
if a % 4 == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
r, g, b = map(int, input().split())
a = r * 100 + g * 10 + b
if a % 4 == 0:
    print('Yes')
else:
    pritn('No')
Problem p03759 (python)

Fixed submission:
a, b, c = map(int, input().split())
if b - a == c - b:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a, b, c = map(str, input().split())
if b - a == c - b:
    print('YES')
else:
    print('NO')
Problem p03962 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a == b == c:
    print(1)
elif a == b != c or b == c != a or c == a != b:
    print(2)
else:
	print(3)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a == b == c:
    print(1)
elif: a == b != C or b == c != a or c == a != b:
    print(2)
else:
	print(3)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a == b == c:
    print(1)
elif: a == b or b == c or c == a:
    print(2)
else:
	print(3)
Problem p03998 (python)

Fixed submission:
s = [input() for i in range(3)]
flg = 1
while(True):
    if flg == 1:
        if s[0] == '':
            print('A')
            break
        elif s[0][0] == 'a':
            s[0] = s[0][1:]
            flg = 1
        elif s[0][0] == 'b':
            s[0] = s[0][1:]
            flg = 2
        elif s[0][0] == 'c':
            s[0] = s[0][1:]
            flg = 3
        
    elif flg == 2:
        if s[1] == '':
            print('B')
            break
        elif s[1][0] == 'a':
            s[1] = s[1][1:]
            flg = 1
        elif s[1][0] == 'b':
            s[1] = s[1][1:]
            flg = 2
        elif s[1][0] == 'c':
            s[1] = s[1][1:]
            flg = 3

    elif flg == 3:
        if s[2] == '':
            print('C')
            break
        elif s[2][0] == 'a':
            s[2] = s[2][1:]
            flg = 1
        elif s[2][0] == 'b':
            s[2] = s[2][1:]
            flg = 2
        elif s[2][0] == 'c':
            s[2] = s[2][1:]
            flg = 3

Buggy submission (verdict: Runtime Error):
s = [input() for i in range(3)]
flg = 1
while(True):
    if flg == 1:
        if s[0] == '':
            print('A')
            break
        elif s[0][0] == 'a':
            s[0] = s[0][1:]
            flg = 1
        elif s[0][0] == 'b':
            s[0] = s[0][1:]
            flg = 2
        elif s[0][0] == 'c':
            s[0] = s[0][1:]
            flg = 3
        
    elif flg == 2:
        if s[1] == '':
            print('B')
            break
        elif s[1][0] == 'a':
            s[1] = s[1][1:]
            flg = 1
        elif s[1][0] == 'b':
            s[1] = s[1][1:]
            flg = 2
        elif s[1][0] == 'c':
            s[1] = s[1][1:]
            flg = 3

    elif flg == 3:
        if s[0] == '':
            print('C')
            break
        elif s[2][0] == 'a':
            s[2] = s[2][1:]
            flg = 1
        elif s[2][0] == 'b':
            s[2] = s[2][1:]
            flg = 2
        elif s[2][0] == 'c':
            s[2] = s[2][1:]
            flg = 3
Problem p02681 (python)

Fixed submission:
S = input()
T = input()
print("Yes" if S == T[:-1] else "No")

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

total = []
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if i + j + k == K:
        t = i - k
        total.append(t)

print(max(total))
Problem p02909 (python)

Fixed submission:
S = input()
W = ["Sunny","Cloudy","Rainy"]
print(W[(W.index(S)+1) % 3])

Buggy submission (verdict: Runtime Error):
S = input()
W = ["Sunny","Cloudy","Rainy"]
print(W[W.index(S)+1 % 3])
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
a = set(map(int, input().split()))
print(min([i for i in range(102) if i not in a], key=lambda y:abs(x-y)))

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
a=set(map,int(input().split()))
print(min([i for i in range(102) if i not in a],key=lambda y:abs(x-y)))
Problem p02732 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
l = [0] * 10000001
for i in A:
    l[i] += 1
s = 0
for i in range(N + 1):
    i = l[i]
    s += i * (i - 1) // 2
for a in A:
    a = l[a]
    print(s - (a * (a - 1) // 2) + ((a - 1) * (a - 2) // 2))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
l = [0] * 100000
for i in A:
    l[i] += 1
c = 0
nums = [0] * N
for i in range(N):
    nums[i] = l[i] * (l[i] - 1) / 2
s = sum(nums)
for i in range(N):
    a = A[i]
    print(int(s - (l[a] * (l[a] - 1)) / 2 + (l[a] - 1) * (l[a] - 2) / 2))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
l = [0] * 100000
for i in A:
    l[i] += 1
c = 0
nums = [0] * N
for i in range(N):
    nums[i] = l[i] * (l[i] - 1) / 2
s = sum(nums)
for i in range(N):
    a = A[i]
    print(int(s - nums[a - 1] + (l[a] - 1) * (l[a] - 2) / 2))

Buggy submission (verdict: Runtime Error):

N = int(input())
A = list(map(int, input().split()))
l = [0] * 100000
for i in A:
    l[i] += 1
c = 0
nums = [0] * N
for i in range(N):
    nums[i] = l[i] * (l[i] - 1) / 2
s = sum(nums)
for i in range(N):
    a = A[i]
    print(int(s - nums[a] + (l[a] - 1) * (l[a] - 2) / 2))
Problem p02780 (python)

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
t = [0] * 1000000
for i in range(N):
    t[i + 1] = t[i] + P[i] + 1
ans = 0
for i in range(N - K + 1):
    ans = max(ans, t[i+K] - t[i])
print(ans / 2)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))


def f(x):
    return sum(range(x + 1)) / x


s = []

for i in range(n-k):
    s.append(sum([sum(range(p[i + j] + 1)) / p[i + j] for j in range(k)]))

print("{:.13f}".format(max(s)))
Problem p02802 (python)

Fixed submission:
n, m = map(int, input().split())

a = [0] * (n+1)
b = [0] * (n+1)

c = 0

for i in [0]*(m):

    s = input().split()

    if a[int(s[0])] == 0:
        if s[1] == "AC":
            a[int(s[0])] = 1
            c += b[int(s[0])]
        else:
            b[int(s[0])] += 1

print(sum(a), c)

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


c = 0
a = 0

t = [0]*(n+1)

temp = []


for i in range(m):
    s = input().split()
    x = s[0]
    y = s[1]
    if y == 'AC' x not in temp:
        a += 1
        c += t[int(x)]
        temp += [x]
    elif y == 'WA':
        t[int(x)] += 1

print(a, c)
Problem p02911 (python)

Fixed submission:
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]
p = k - q
s = [p]*n
for i in a:
    s[i-1] += 1

for i in s:
    if i < 1:
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]
p = k - q
s = [[i, p] for i in range(n)]
for i in a:
    s[i][1] += 1

for i in s:
    if i[1] < 1:
        print("No")
    else:
        print("Yes")
Problem p03106 (python)

Fixed submission:
a, b, k = map(int, input().split())

s = []

for i in range(1, max(a, b)+1):
    if a % i == 0 and b % i == 0:
        s.append(i)

sorted(s)

s = s[::-1]

print(s[k-1])

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

s = []

for i in range(1, max(a, b)):
    if a % i == 0 and b % i == 0:
        s.append(i)

sorted(s)

s = s[::-1]

print(s[k-1])

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

s = []

for i in range(1, max(a, b)):
    if a % i == 0 and b % i == 0:
        s.append(i)

sorted(s)

print(s[len(s) - k])

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

s = []

for i in range(1, max(a, b)):
    if a % i == 0 and b % i == 0:
        s.append(i)

sorted(s, reverse=True)

print(s[len(s) - k])
Problem p03211 (python)

Fixed submission:
s = input()
t = 100000000000
for i in range(len(s)-2):
    t = min(abs(753 - int(s[i]+s[i+1]+s[i+2])), t)
print(t)

Buggy submission (verdict: Runtime Error):
import itertools
S = input()
S = list(S)
l = max(list(sum(c) for c  in itertools.combinations(l, 3)))
print(adb(753-l))
Problem p03212 (python)

Fixed submission:
n = int(input())


def dfs(s):
    if int(s) > n:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0
    for c in '753':
        ret += dfs(s + c)
    return ret


print(dfs('0'))

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


def dfs(s):
    if int(s) > n:
        return 0
    ret = 1 if all(s.count > 0 for c in '753') else 0
    for c in '753':
        ret += dfs(s + c)
    return ret


print(dfs('0'))