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

Fixed submission:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数

N,K,S = imn()
cnt = 0
A = []
for i in range(N):
    
    cnt += 1
    if cnt <= K: 
        A.append(str(S))
    else:
        if S != 10**9:
            A.append(str(10**9)) 
        else:
            A.append(str(1))
print(join(A, ' '))

Buggy submission (verdict: Runtime Error):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数

N,K,S = imn()
cnt = 0
A = []
for i in range(N):
    
    cnt += 1
    if cnt <= K: 
        A.append(str(S))
    else:
        if S != 10**9:
            A.append(str(10**9)) 
        else:
            A.append(1)
print(join(A, ' '))
Problem p02995 (python)

Fixed submission:
import fractions

def main(): 
    A,B,C,D = map(int, input().split())

    c_cnt = (B // C) - ((A-1) // C)
    d_cnt = (B // D) - ((A-1) // D)

    lcm= (C * D) // fractions.gcd(C, D)

    cd_cnt = (B // lcm) - ((A-1) // lcm)

    print(B - (A-1) - c_cnt - d_cnt + cd_cnt)


    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math

def main(): 
    A,B,C,D = map(int, input().split())

    c_cnt = (B // C) - ((A-1) // C)
    d_cnt = (B // D) - ((A-1) // D)

    lcm= (C * D) // math.gcd(C, D)

    cd_cnt = (B // lcm) - ((A-1) // lcm)

    print(B - (A-1) - c_cnt - d_cnt + cd_cnt)


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

Fixed submission:


a,b,c=map(int,input().split())

if a <=c <=b:
    print('Yes')
elif a >= c >= b:
    print('Yes')
else:
    print('No')

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

if a <=c <=b:
    print('Yes')
elif a >= c >= b
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):


a,b,c=map(int,input().split())

if a < c < b:
    print('Yes')
else:
    print('No)
Problem p03087 (python)

Fixed submission:
N,Q = map(int, input().split())
S = input()
LR = [list(map(lambda x : int(x)-1, input().split())) for _ in range(Q)]

L = [0 for _ in range(N)]
R = [0 for _ in range(N)]

for i in range(1,N):
    if S[i-1:i+1] == 'AC':
        if i == 0:
            L[i] = 1
        else:
            L[i] = L[i-1] + 1
    else:
        if i > 0:
            L[i] = L[i-1]

for i in range(Q):
    Li = LR[i][0]
    Ri = LR[i][1]

    print(L[Ri] - L[Li])

Buggy submission (verdict: Runtime Error):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

N,Q = imn()
S = input()
lr = [iln() for _ in range(Q)]

s = [0 for _ in range(N+1)]

for i in range(N):
    s[i+1] = s[i]
    if S[i] == 'A' and S[i+1] == 'C':
        s[i+1] += 1

for i in range(Q):
    l = lr[i][0]
    r = lr[i][1]
    print(s[r-1]-s[l-1])
Problem p03160 (python)

Fixed submission:
def main(): 
    
    N = int(input())
    h = list(map(int, input().split()))

    dp = [0 for _ in range(N)]

    for i in range(1,N):
        if i == 1:
            dp[i] = abs(h[i] - h[i-1])
        else:
            dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))

    print(dp[N-1])

    
if __name__ == "__main__":
    main()

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

    dp = [10000 for _ in range(n)]

    dp[0] = 0

    for i in range(1, N):
        dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i -1]))
        if i > 1:
            dp[i] = min(dp[i], dp[i -2] + abs(h[i] - h[i-2]))

    print(dp[N-1])





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

Fixed submission:
def is_target_string(S):
    if S[0] != 'A':
        return False
    C_cnt = 0
    C_index = -1
    for i in range(2, len(S)-1):
        if S[i] == 'C':
            C_cnt += 1
            C_index = i
    if C_cnt != 1:
        return False

    for i in range(len(S)):
        if i != 0 and i != C_index:
            if S[i].isupper():
                return False

    return True

S = input()

print('AC' if is_target_string(S) else 'WA')

Buggy submission (verdict: Runtime Error):
def is_target_string(S):
    if S[0] != 'A':
        return false
    C_cnt = 0
    C_index = -1
    for i in range(2, len(S)-1):
        if S[i] == 'C':
            C_cnt += 1
            C_index = i
    if C_cnt != 1:
        return False

    for i in range(len(S)):
        if i != 0 and i != C_index:
            if S[i].isupper():
                return False

    return True

S = input()

print('AC' if is_target_string(S) else 'WA')
Problem p03386 (python)

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

AB = range(A,B+1)
tail = len(AB)
AB_L = set(AB[0:min(K,tail)])
AB_R = set(AB[max(0,tail-K):tail])
AB_SL = sorted(AB_L | AB_R)

for ab in AB_SL:
    print(ab)

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

AB = range(A,B+1)

tail = len(AB)

for i in range(K):
    print(AB[i])

for i in range(tail - K, tail):
    print(AB[i])
Problem p03503 (python)

Fixed submission:
N = int(input())
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]

max_v = -(10 ** 10)
for i in range(1,2**10):

    S_cnt = [0] * N 
    for j in range(10):
        if i % 2 == 1:
            for k in range(N):
                if F[k][j] == 1:
                    S_cnt[k] += 1
        i //= 2

    tmp_v = 0
    for j in range(N):
        tmp_v += P[j][S_cnt[j]]
    max_v = max(max_v, tmp_v)

print(max_v)

Buggy submission (verdict: Runtime Error):
N = int(input())
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]

max_v = -(10 ** 10)
for i in range(1,2**10):

    S_cnt = [0] * 10
    for j in range(10):
        if i % 2 == 1:
            for k in range(N):
                if F[k][j] == 1:
                    S_cnt[k] += 1
        i //= 2
    print

    tmp_v = 0
    for j in range(N):
        tmp_v += P[j][S_cnt[j]]
    max_v = max(max_v, tmp_v)

print(max_v)
Problem p03565 (python)

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

t_len = len(T)
found = False
for i in range(len(S)-len(T), -1,-1):
    for j in range(len(T)):
        if S[i+j] != T[j] and S[i+j] != '?':
            break
    else:
        if i + t_len == len(S):
            S = S[:i] + T
        else:
            S = S[:i] + T + S[i+t_len:]
        found = True
    if found:
        print(S.replace('?','a'))
        break
else:
    print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

t_len = len(T)
found = False
for i in range(len(S)-len(T), -1,-1):
    for j in range(len(T)):
        if S[i+j] != T[j] and S[i+j] != '?':
            break
    else:
        if i + t_len == len(S):
            S = S[:i] + T
        else:
            S = S[:i] + T + S[i+tlen:]
        found = True
    if found:
        print(S.replace('?','a'))
        break
else:
    print('UNRESTORABLE')
Problem p03633 (python)

Fixed submission:
import fractions

N = int(input())
T = [int(input()) for _ in range(N)]

def lcm(a,b):
    return a * b // fractions.gcd(a,b)

ans = T[0]

for i in range(1, N):
    ans = lcm(ans, T[i])

print(ans)

Buggy submission (verdict: Runtime Error):
import fractions

N = int(input())
T = [int(input()) for _ in range(N)]

def lcm(a,b):
    return int(a * b / fractions.gcd(a,b))

ans = T[0]

for i in range(1, N):
    ans = lcm(ans, T[i])

print(ans)
Problem p03637 (python)

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

cnt_of_4 = 0
cnt_of_2 = 0
for i in range(N):
    if a[i] % 4 == 0:
        cnt_of_4 += 1
    elif a[i] % 2 ==  0:
        cnt_of_2 += 1

if cnt_of_4 >= N//2 or cnt_of_4 *2 + cnt_of_2 >= N:
    print('Yes')
else:
    print('No')

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

cnt_of_4 = 0
cnt_of_2 = 0
cnt_of_1 = 0
for i in range(N):
    if a[i] % 4 == 0:
        cnt_of_4 += 1
    elif a[i] == 2:
        cnt_of_2 += 1
    else:
        cnt_of_1 += 1

if cnt_of_4 == N//2:
    print('Yes')
else:
    if cnt_of_1 < cnt_of_4:
        cnt_of_2 = cnt_of_2 - (cnt_of_4-cont_of1)
    if cnt_of_4 * 2 + ((cnt_of_2//2)*2) >= N:
        print('Yes')
    else:
        print('No')
Problem p03695 (python)

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

def get_color(point):
    color = ''
    if 400 > point:
        color = 'grey'
    elif 800 > point:
        color = 'brown'
    elif 1200 > point:
        color = 'green'
    elif 1600 > point:
        color = 'light blue'
    elif 2000 > point:
        color = 'blue'
    elif 2400 > point:
        color = 'yellow'
    elif 2800 > point:
        color = 'orange'
    elif 3200 > point:
        color = 'red'
    else:
        color = 'free'
    return color
dict = {}
for i in range(N):
    color = get_color(a[i])
    if color not in dict.keys():
        dict[color] = 1
    else:
        dict[color] += 1

min_cnt = 0
max_cnt = 0
if 'free' not in dict.keys():
    min_cnt = max_cnt = len(dict.keys())
else:
    min_cnt = max(1, len(dict.keys())-1)
    max_cnt = len(dict.keys())-1 + dict['free']

print(min_cnt, max_cnt)

Buggy submission (verdict: Runtime Error):

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

def get_color(point):
    color = ''
    if 400 > point:
        color = 'grey'
    elif 800 > point:
        color = 'brown'
    elif 1200 > point:
        color = 'green'
    elif 1600 > point:
        color = 'light blue'
    elif 2000 > point:
        color = 'blue'
    elif 2400 > point:
        color = 'yellow'
    elif 2800 > point:
        color = 'orange'
    elif 3200 > point:
        color = 'red'
    else:
        color = 'free'
    return color
dict = {}
for i in range(N):
    color = get_color(a[i])
    if color not in dict.keys():
        dict[color] = 1
    else:
        dict[color] += 1

min_cnt = 0
max_cnt = 0
if 'free' not in dict.keys():
    min_cnt = max_cnt = len(dict.keys())
else:
    min_cnt = len(dict.keys())-1
    max_cnt = min(8, min_cnt + len(dict['free']))

print(min_cnt, max_cnt)
Problem p02709 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
num  = []
for i in range(n):
    num.append([a[i],i])
num.sort(reverse = True)
dp = [[0]*(n+1)for i in range(n+1)]
ans = 0
for l in range(n):
    for r in range(n):
        if l+r == n:
            ans = max(ans,dp[l][r])
            break
        dp[l+1][r] = max(dp[l+1][r], dp[l][r] + num[l+r][0]*abs(num[l+r][1]-l))
        dp[l][r+1] = max(dp[l][r+1],dp[l][r]+num[l+r][0]*abs(num[l+r][1]-n+1+r))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a  = list(map(int,input().split()))
cnt = {}
for i in range(n):
    if a[i] not in cnt:cnt[a[i]] = [i]
    else:cnt[a[i]].append(i)

    
lcnt,rcnt = 0,0
ans = 0
for val,ind in res:
    if ind-lcnt < n-ind-1-rcnt:
        
        ans +=val*(n-ind-1-rcnt)
        rcnt+=1
    else:
        ans +=val*(ind - lcnt)
        lcnt+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a  = list(map(int,input().split()))
cnt = {}
for i in range(n):
    if a[i] not in cnt:cnt[a[i]] = [i]
    else:cnt[a[i]].append(i)

    
lcnt,rcnt = 0,0
ans = 0
for val,ind in res:
    if ind-lcnt < n-ind-1-rcnt:
        
        ans +=val*(n-ind-1-rcnt)
        rcnt+=1
    else:
        ans +=val*(ind - lcnt)
        lcnt+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a  = list(map(int,input().split()))
cnt = {}
for i in range(n):
    if a[i] not in cnt:cnt[a[i]] = [i]
    else:cnt[a[i]].append(i)

    
lcnt,rcnt = 0,0
ans = 0
for val,ind in res:
    if ind-lcnt < n-ind-1-rcnt:
        
        ans +=val*(n-ind-1-rcnt)
        rcnt+=1
    else:
        ans +=val*(ind - lcnt)
        lcnt+=1
print(ans)
Problem p02743 (python)

Fixed submission:
a,b,c = map(int,input().split())
if (c-b-a) > 0 and (c-b-a)**2 > 4*a*b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if sqrt(a) + sqrt(b) < sqrt(c):
    print("Yes")
else:
    print("No")
Problem p02803 (python)

Fixed submission:
h,w = map(int,input().split())
field = [list(input())for i in range(h)]


vec = [(-1,0),(1,0),(0,1),(0,-1)]
ans = 0
for i in range(h):
    for j in range(w):
        if field[i][j] == "#":continue
        stack = [(i,j)]
        visited = [[0]*w for i in range(h)]
        a= [[0]*w for i in range(h)]
        
        while stack:
            next = []
            for x,y in stack:
                
                if visited[x][y]:continue

                visited[x][y] = 1
                

                for tx,ty in vec:
                    nx = x+tx
                    ny = y+ty
                    if nx < 0 or ny <0 or nx >=h or ny >=w:continue
                    if field[nx][ny] == "#" :continue
                    if visited[nx][ny]:continue
                    next.append((nx,ny))
                    a[nx][ny] = a[x][y]+1
                    
                    
            stack = next
        ans = max(ans,max(max(row)for row in a))
print(ans)

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
field = [list(input())for i in range(h)]
a= [[0]*w for i in range(h)]

vec = [(-1,0),(1,0),(0,1),(0,-1)]
ans = 0
for i in range(h):
    for j in range(w):
        if field[i][j] == "#":continue
        stack = [(i,j)]
        visited = [[0]*w for i in range(w)]
        a[i][j] = 0
        
        while stack:
            next = []
            for x,y in stack:
                
                if visited[x][y]:continue

                visited[x][y] = 1
                

                for tx,ty in vec:
                    nx = x+tx
                    ny = y+ty
                    if nx < 0 or ny <0 or nx >=h or ny >=w:continue
                    if field[nx][ny] == "#" :continue
                    if visited[nx][ny]:continue
                    next.append((nx,ny))
                    a[nx][ny] = a[x][y] + 1
                    
                    
            stack = next
   
        for i in range(h):
            ans = max(ans,max(a[i]))
            a[i] = [0]*w
print(ans)
Problem p02814 (python)

Fixed submission:
import fractions
from functools import reduce
n,m = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n):
    a[i] = a[i]//2
wa=[]
for i in range(n):
    p=a[i]
    f=0
    while p%2==0:
        p=p//2
        f+=1
    wa.append(f)
if max(wa)!=min(wa):
    print(0)
    exit()
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcm = lcm_list(a)#aの要素をすべて2で割った数列の最小公倍数
#にぶんたんさく(lcmをｘ倍してｍを超えないようなギリギリのｘ)
bottom = 0
top = m+1#m//2くらいで十分だけど大きめにとる
while top - bottom > 1:
    middle = (top+bottom )//2
    if lcm * middle <= m:
        bottom = middle
    else:
        top = middle



print(( bottom+1)//2)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce
n,m = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n):
    a[i] = a[i]//2
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcm = lcm_list(a)#aの要素をすべて2で割った数列の最小公倍数
#にぶんたんさく(lcmをｘ倍してｍを超えないようなギリギリのｘ)
bottom = 0#
top = m+1#m//2くらいで十分だけど大きめにとる
while top - bottom > 1:
    middle = (top+bottom )//2
    if lcm * middle <= m:
        bottom = middle
    else:
        top = middle

ok = True
for i in range(1, N):
    c = 0
    while a[i] % 2 == 0:
        a[i] //= 2
        c+= 1
    if cnt != c :ok = False
if not ok:
    print(0)
    exit(0)

print(( bottom+1)//2)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce
n,m = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n):
    a[i] = a[i]//2
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcm = lcm_list(a)#aの要素をすべて2で割った数列の最小公倍数
#にぶんたんさく(lcmをｘ倍してｍを超えないようなギリギリのｘ)
bottom = 0#
top = m+1#m//2くらいで十分だけど大きめにとる
while top - bottom > 1:
    middle = (top+bottom )//2
    if lcm * middle <= m:
        bottom = middle
    else:
        top = middle

ok = True
for i in range(1, N):
    c = 0
    while a[i] % 2 == 0:
        a[i] //= 2;
        c+= 1
    if cnt != c :ok = False
if not ok:
    print(0)
    exit(0)

print(( bottom+1)//2)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
n,m = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n):
    a[i] = a[i]//2
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
ans = lcm_list(a)
p = 0
i = 1
for i in range(m,1,-1):
    if i%ans == 0 and i //ans %2 ==1:
        break
    if i >ans:break
    
print((i )//2+1)
Problem p02837 (python)

Fixed submission:
n = int(input())
a =[0]*n
x = [[0] *n for i in range(n)]
y = [[0] *n for i in range(n)]
ans = []
for i in range(n):
    a[i] = int(input())
    for j in range(a[i]):
        x[i][j],y[i][j] = map(int,input().split())
        x[i][j]-=1
        
ishonest= [-1]*n + [0]
def check(ishonest):
    for i in range(n):
        if not ishonest[i]:continue
        for j in range(a[i]):
            if y[i][j] == 1 and ishonest[x[i][j]] == 0:
                return False
            if y[i][j] == 0 and ishonest[x[i][j]] == 1:
                return False
    return True

def dfs(now,h_or_not= -1):
    ishonest[now] = h_or_not
    if now == n-1:
        if check(ishonest):
      
            return sum(ishonest)+1
        else:
            return 0
  
    return max(dfs(now+1,0),dfs(now+1,1))

print(dfs(-1))

Buggy submission (verdict: Runtime Error):
n = int(input())
xy = []
ansp = []
people =[-1]*n
sp = [-1]*n



for i in range(n):
    a = int(input())
    for j in range(a):
        x, y = map(int,input().split())
        xy.append([x-1,y])
def dfs(now,ok):
    global sp
    global people
    if now ==n:
        ansp.append(people.count(1))
        sp = [-1]*n
        people = [-1]*n
        return
    if len(xy[now]) >0:
        for i in range(len(xy[now])):
            x = xy[i][0]
            y = xy[i][1]
            if ok:
                if sp[x] == y or sp[x] == -1:
                    sp[x] = y
                else:continue
            else:
                if sp[x] == y^1 or sp[x] == -1:
                    sp[x] == y^1
                else:continue
    
        
        
    people[now] = ok    
    dfs(now+1,ok)
    dfs(now+1,ok^1)
dfs(0,0)
dfs(0,1)
if len(ansp) == 0:
    print(0)
    exit(0)
print(max(ansp))
Problem p02843 (python)

Fixed submission:
x = int(input())
f = (x%100)//5
ff = (x%100)%5
a = [0,101,102,103,104]
if 105*f+a[ff]<= x:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
X=int(input())
dp = [0]*(X+1)
dp[0]=1
dp[100]=1
dp[101]=1
dp[102]=1
dp[103]=1
dp[104]=1
dp[105]=1
if X>105:

    for i in range(106,X+1):
	        if dp[i-100] == 1:
	    	        dp[i]=1
	        elif dp[i-101] == 1:
	    	        dp[i]=1
	        elif dp[i-102] == 1:
	    	        dp[i]=1
	        elif dp[i-103] == 1:
	    	        dp[i]=1
	        elif dp[i-104] == 1:
	        	dp[i]=1
	        elif dp[i-105] == 1:
	    	        dp[i]=1
	        else:
	    	        dp[i]=0
	    
print(dp[X])

Buggy submission (verdict: Runtime Error):
X=int(input())
dp = [0]*(X+1)
dp[0]=1
dp[100]=1
dp[101]=1
dp[102]=1
dp[103]=1
dp[104]=1
dp[105]=1
for i in range(106,X+1):
	    if dp[i-100] == 1:
	    	    dp[i]=1
	    elif dp[i-101] == 1:
	    	    dp[i]=1
	    elif dp[i-102] == 1:
	    	    dp[i]=1
	    elif dp[i-103] == 1:
	    	    dp[i]=1
	    elif dp[i-104] == 1:
	    	    dp[i]=1
	    elif dp[i-105] == 1:
	    	    dp[i]=1
	    else:
	    	    dp[i]=0
	    
print(dp[X])
Problem p02852 (python)

Fixed submission:
n,m = map(int,input().split())
s = input()
cnt = [0]*(n+1)
r = n
for i in range(n-1,-1,-1):
    if s[i] == '1':
        cnt[i] = -1
        continue
    while r > i+m:r -=1
    while cnt[r] == -1:r -= 1
    if i == r:
        print(-1)
        exit(0)
    cnt[i] =cnt[r]+1
now = 0
ans = []
for i in range(n+1):
    if cnt[i] == -1:continue
    if cnt[i] == cnt[now]-1:
        ans.append(i-now)
        now = i
print(*ans)

Buggy submission (verdict: Runtime Error):
n= int(input())
a = list(map(int,input().split()))
now = a[0] 
a.sort()
res = 0
ans = 1
for i in range(n-1):
    if a[i+1] != now:
        ans+=1
        now = a[i+1]
if ans%2:print(ans)
else: print(ans-1)
Problem p02885 (python)

Fixed submission:
A,B = map(int,input().split())
ans = max(0,A-(2*B))
print(ans)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
ans = min(0,A-(2`B)
print(ans)
Problem p02886 (python)

Fixed submission:
N = int(input())
ans = 0
d = list(map(int,input().split()))
for i in range(N-1):
    for j in range(i+1,N):
        ans+= d[i]*d[j]

print(ans)

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

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