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

Fixed submission:
N=int(input())

a=1
b=N//a
dis=abs(b-a)

for i in range(1,int(N**0.5)+1):
    if N%i==0:
        _a=i
        _b=N//i
        _dis=abs(_b-_a)
        if _dis<dis:
            a=_a
            b=_b
            dis=_dis

print(a-1+b-1)

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

a=1
b=N//a
dis=abs(a-b)

for i in range(int(N**0.5)+1):
    if N%i==0:
        _a=i
        _b=N/i
        _dis=abs(_a-_b)
        if _dis<dis:
            a=_a
            b=_b
            dis=_dis

print(a-1+b-1)

Buggy submission (verdict: Runtime Error):

#素因数分解
def prime_factorization(N):
    n=N
    a=2
    prime_factor=[]
    while a**2<=n:
        while n%a==0:
            prime_factor.append(a)
            n//=a
        a+=1
    if n>1:
        prime_factor.append(n)
    return prime_factor


# N=100
N=int(input())

a=1
b=N//a
dis=abs(a-b)

Li=prime_factorization(N)
# print(Li)

for p in range(2**len(Li)):
    bit=[]
    for e in range(len(Li)):
        if (p>>e)&1==1:
            bit.append(1)
        else:
            bit.append(0)
    # print(bit)
        proindex=[]
        for _ in range(len(bit)):
            if bit[_] ==1:
                proindex.append(_)
        _a=1
        for j in range(len(Li)**0.5):
            if proindex.count(j)==1:
                _a*=Li[j]
        _b=N//_a
        _dis=abs(_a-_b)
        if _dis<dis:
            a=_a
            b=_b
            dis=_dis
# print(a,b)

print(a-1+b-1)

Buggy submission (verdict: Runtime Error):

#素因数分解
def prime_factorization(N):
    n=N
    a=2
    prime_factor=[]
    while a**2<=n:
        while n%a==0:
            prime_factor.append(a)
            n//=a
        a+=1
    if n>1:
        prime_factor.append(n)
    return prime_factor


# N=100
N=int(input())

a=1
b=N//a
dis=abs(a-b)

Li=prime_factorization(N)
# print(Li)

if len(Li)>=6:
    math.random()
    


for p in range(2**len(Li)):
    bit=[]
    for e in range(len(Li)):
        if (p>>e)&1==1:
            bit.append(1)
        else:
            bit.append(0)
    # print(bit)
        proindex=[]
        for _ in range(len(bit)):
            if bit[_] ==1:
                proindex.append(_)
        _a=1
        for j in range(len(Li)):
            if proindex.count(j)==1:
                _a*=Li[j]
        _b=N//_a
        _dis=abs(_a-_b)
        if _dis<dis:
            a=_a
            b=_b
            dis=_dis
# print(a,b)


print(a-1+b-1)
Problem p03017 (python)

Fixed submission:
N,A,B,C,D=map(int,input().split())
S=input()

c1=S[B-2:D+1].count('...')
c2=S[A-1:D].count('##')

if c2>=1:
    print('No')
    exit()
else:
    pass

if C>D and c1==0:
    print('No')
    exit()
else:
    pass


print('Yes')

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

c1=S[B-2:C].count('...')
c2=S[A-1:D].count('##')

if c2>=1:
    print('No')
    exit()
else:
    pass

if C>D:
    if c1==0:
    print('No')
    exit()
    else:
        print('Yes')
        exit()
Problem p03038 (python)

Fixed submission:
import numpy as np


N,M=map(int,input().split())
# A=np.array(list(map(int,input().split())))
A=np.array(list(map(int,input().split())),dtype=np.int32)
A=np.sort(A)

EXC=[]

for i in range(M):
    exc=list(map(int,input().split()))
    EXC.append(exc)
excArry=np.array(EXC,dtype=np.int32)

col_num=1
Arr=excArry[np.argsort(excArry[:,col_num])[::-1]]
# print(A)
# print(Arr)

point=0


for j in range (M):
    change_Num=Arr[j][1]
    count=np.count_nonzero(A<change_Num)
    if count > 0:
        m=min(count,Arr[j][0])
        A[point:point+m]=change_Num
        point+=m
        # A=np.sort(A)
    else:
        break

print(np.sum(A))
    
#     for j in range (B):
#         count=np.count_nonzero(A<C)
#         if count>0:
#             m=min(B,count)
#             A[:m]=C
#         else:
#             continue
    
#     A=np.sort(A)

# print(np.sum(A))

Buggy submission (verdict: Runtime Error):
import numpy as np


N,M=map(int,input().split())
# A=np.array(list(map(int,input().split())))
A=np.array(list(map(int,input().split())),dtype=np.int64)
A=np.sort(A)

EXC=[]

for i in range(M):
    exc=list(map(int,input().split()))
    EXC.append(exc)
excArry=np.array(EXC,dtype=np.int64)

col_num=1
Arr=excArry[np.argsort(excArry[:,col_num])[::-1]]
# print(A)
# print(Arr)

for j in range (M):
    count=np.count_nonzero(A<Arr[j][1])
    if count > 0:
        m=min(count,Arr[j][0])
        A[:m]=Arr[j][1]
        A=np.sort(A)
    else:
        break

print(np.sum(A))
    
#     for j in range (B):
#         count=np.count_nonzero(A<C)
#         if count>0:
#             m=min(B,count)
#             A[:m]=C
#         else:
#             continue
    
#     A=np.sort(A)

# print(np.sum(A))

Buggy submission (verdict: Runtime Error):
import numpy as np


N,M=map(int,input().split())
A=np.array(list(map(int,input().split())))
# A=np.array(list(map(int,input().split())),dtype=np.int64)
A=np.sort(A)

for i in range(M):
    B,C=map(int,input().split())
    for j in range (B):
        count=np.count_nonzero(A<C)
        if count>0:
            m=min(B,count)
            A[:m]=C
        else:
            continue
    
    A=np.sort(A)

print(np.sum(A))
Problem p02754 (python)

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

ans=n//(a+b)*a
r=n%(a+b)
ans+=min(r,a)
print(ans)

Buggy submission (verdict: Runtime Error):

if a==0:
    print(0)
elif n>a:
    print(n-b)
elif n<=a:
    print(n)
Problem p02547 (python)

Fixed submission:
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]

exist = False
for i in range(n-2):
    for j in range(3):
        if d[i+j][0] != d[i+j][1]:
            break
    else:
        exist = True
if exist:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
for i in range(n-3):
    exist = True
    for j in range(3):
        if not d[i+j][0] == d[i+j][1]:
            exist = False
    if exist:
        break
if exist:
    print('Yes')
else:
    print('No')
Problem p02831 (python)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

a, b = map(int, input().split())
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a, b = map(int, input().split())
print(lcm(a, b))
Problem p02851 (python)

Fixed submission:
from collections import defaultdict

n, k = map(int, input().split())
A = list(map(int, input().split()))
S = [0] * (n + 1)
for i in range(n):
    S[i+1] = S[i] + A[i]

f = lambda n: (S[n] - n) % k
C = defaultdict(int)
ans = 0
for i in range(n):
    C[f(i)] += 1
    j = i - k + 1
    if 0 <= j:
        C[f(j)] -= 1
    ans += C[f(i+1)]
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
A = list(map(int, input().split()))
S = [0] * (n + 1)
for i in range(n):
    S[i+1] = S[i] + A[i]

f = lambda n: (S[n] - n) % k
C = [0] * k
ans = 0
for i in range(n):
    C[f(i)] += 1
    j = i - k + 1
    if 0 <= j:
        C[f(j)] -= 1
    ans += C[f(i+1)]
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
A = list(map(int, input().split()))
S = [0] * (n + 1)
for i in range(n):
    S[i+1] = S[i] + A[i]

C = [0] * k
ans = 0
for i in range(n+1):
    j = i - k
    mi = (S[i] - i) % k
    if j >= 0:
        mj = (S[j] - j) % k
        C[mj] -= 1
    ans += C[mi]
    C[mi] += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
A = list(map(int, input().split()))
S = [0] * (n + 1)
for i in range(n):
    S[i+1] = S[i] + A[i]

C = [0] * k
ans = 0
for i in range(n+1):
    j = i - k
    mi = (S[i] - i) % k
    mj = (S[j] - j) % k
    if j >= 0:
        C[mj] -= 1
    ans += C[mi]
    C[mi] += 1
print(ans)

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

n, k = map(int, input().split())
A = list(map(int, input().split()))
S = [0] * (n + 1)
for i in range(n):
    S[i+1] = S[i] + A[i]

C = defaultdict(int)
ans = 0
for i in range(n+1):
    j = i - k
    mi = (S[i] - i) % k
    mj = (S[j] - j) % k
    if j >= 0:
        C[mj] -= 1
    ans += C[mi]
    C[mi] += 1
Problem p03253 (python)

Fixed submission:
import math
from collections import Counter

n, m = map(int, input().split())
mod = 10**9 + 7

K = 50
fact = [0] * (n+1+K)
ifact = [0] * (n+1+K)
fact[0] = 1
for i in range(1,n+1+K):
    fact[i] = fact[i-1] * i % mod
ifact[n+K] = pow(fact[n+K], mod-2, mod)
for i in reversed(range(1,n+1+K)):
    ifact[i-1] = ifact[i] * i % mod

def comb(n, k):
    return fact[n] * ifact[n-k] % mod * ifact[k] % mod

def getprime(n):
    primes = []
    i = 2
    while n >= i * i:
        while n % i == 0:
            n //= i
            primes.append(i)
        i += 1
    if n != 1:
        primes.append(n)
    return primes

ans = 1
counter = Counter(getprime(m))
for k in counter.values():
    ans *= comb(n+k-1, k)
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from collections import Counter

n, m = map(int, input().split())
mod = 10**9 + 7

K = 20
fact = [0] * (n+1+K)
ifact = [0] * (n+1+K)
fact[0] = 1
for i in range(1,n+1+K):
    fact[i] = fact[i-1] * i % mod
ifact[n+K] = pow(fact[n+K], mod-2, mod)
for i in reversed(range(1,n+1+K)):
    ifact[i-1] = ifact[i] * i % mod

def comb(n, k):
    return fact[n] * ifact[n-k] % mod * ifact[k] % mod

def getprime(n):
    primes = []
    i = 2
    while n >= i * i:
        while n % i == 0:
            n //= i
            primes.append(i)
        i += 1
    if n != 1:
        primes.append(n)
    return primes

ans = 1
counter = Counter(getprime(m))
for k in counter.values():
    ans *= comb(n+k-1, k)
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from collections import Counter

n, m = map(int, input().split())
mod = 10**9 + 7

K = 20
fact = [0] * (n+1+K)
ifact = [0] * (n+1+K)
fact[0] = 1
for i in range(1,n+1+K):
    fact[i] = fact[i-1] * i % mod
ifact[n+K] = pow(fact[n+K], mod-2, mod)
for i in reversed(range(1,n+1+K)):
    ifact[i-1] = ifact[i] * i % mod

def comb(n, k):
    return fact[n] * ifact[n-k] % mod * ifact[k] % mod

def getprime(n):
    primes = []
    i = 2
    while n > i * i:
        while n % i == 0:
            n //= i
            primes.append(i)
        i += 1
    if n != 1:
        primes.append(n)
    return primes

ans = 1
counter = Counter(getprime(m))
for k in counter.values():
    ans *= comb(n+k-1, k)
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from collections import Counter

n, m = map(int, input().split())
mod = 10**9 + 7

fact = [0] * (n+21)
ifact = [0] * (n+21)
fact[0] = 1
for i in range(1,n+21):
    fact[i] = fact[i-1] * i % mod
ifact[n+20] = pow(fact[n+20], mod-2, mod)
for i in reversed(range(1,n+21)):
    ifact[i-1] = ifact[i] * i % mod

def comb(n, k):
    return fact[n] * ifact[n-k] % mod * ifact[k] % mod

def getprime(n):
    primes = []
    i = 2
    while n > i * i:
        while n % i == 0:
            n //= i
            primes.append(i)
        i += 1
    if n != 1:
        primes.append(n)
    return primes

ans = 1
counter = Counter(getprime(m))
print(counter)
for k in counter.values():
    print(n+k-1, k, comb(n+k-1, k))
    ans *= comb(n+k-1, k)
    ans %= mod
print(ans)
Problem p02859 (python)

Fixed submission:
r= int(input())
print(r*r)

Buggy submission (verdict: Runtime Error):
r=int(intput())
print(r*r)
Problem p03107 (python)

Fixed submission:
import sys

cubes = list(input()) # 入力受付
stack = []
count = 0

for cube in cubes:
    if not stack:
        stack.append(cube)
    elif stack[-1] != cube:
        count += 2
        stack.pop()
    else:
        stack.append(cube)
print(count)

Buggy submission (verdict: Runtime Error):
import sys

cubes = list(input()) # 入力受付
stack = []
count = 0

for cube in cubes:
    print(stack, cube)
    if not stack:
        stack.append(cube)
    elif stack[-1] != cube:
        print(stack, cube)
        count += 2
        stack.pop()
    else:
        stack.append(cube)
print(count)

Buggy submission (verdict: Runtime Error):
import sys
import re
def INPUT_AS_INT(): return int(sys.stdin.readline().rstrip())
# def INPUT_AS_INT_LIST(): return list(map(int,sys.stdin.readline().rstrip().split()))
# def INPUT_AS_STRING(): return sys.stdin.readline().rstrip()
# def INPUT_AS_STRING_LIST(): return list(sys.stdin.readline().rstrip().split())

str = INPUT_AS_STRING() # 入力受付
_str = str #　結果と比較用
while True:
    tmp = str
    tmp = re.sub("10", "", tmp)
    tmp = re.sub("01", "", tmp)
    if str == tmp:
        break
    str = tmp

print(len(_str) - len(str))
Problem p02785 (python)

Fixed submission:
from heapq import heapify, heappop
from math import ceil
N, K = map(int, input().split())
H = list(map(int, input().split()))
# N=8
# K=9
# H=[7, 9, 3, 2, 3, 8, 4, 6]

Hminus = list(map(lambda x: x*(-1), H))
# print(type(Hminus))
heapify(Hminus)
# print(Hminus)
if K > len(H):
    print(0)
else:
    for _ in range(K):
        heappop(Hminus)
    print(sum(Hminus)*(-1))

Buggy submission (verdict: Runtime Error):
from heapq import heapify, heappop
from math import ceil
N, K = map(int, input().split())
H = list(map(int, input().split()))
# N=3
# K=1
# H=[4,1,5]

Hminus = list(map(lambda x: x*(-1), H))
# print(type(Hminus))
heapify(Hminus)
# print(Hminus)
for _ in range(K):
    heappop(Hminus)
print(sum(Hminus)*(-1))

Buggy submission (verdict: Runtime Error):
from heapq import heapify, heappop
from math import ceil
N, K = map(int, input().split())
H = list(map(int, input().split()))
Hminus = list(map(lambda x: x*(-1), H))
Hheap = heapify(Hminus)
for _ in range(K):
    heappop(Hheap)
print(sum(Hheap))
Problem p02891 (python)

Fixed submission:
S = input()
K = int(input())
ans = 0

# 先頭と後頭が一致していた場合の例外処理
Sfront = S[0]
Srear  = S[-1]
if Sfront == Srear and K > 1:
    Sleft = S.lstrip(Srear)
    kazu_left = len(S) - len(Sleft)
    ans += int(kazu_left/2)
#     print(ans)
    
    Sleftright = Sleft.rstrip(Srear)
    kazu_right = len(Sleft) - len(Sleftright)
    if kazu_right != 0: # 通常
        ans += int(kazu_right/2)

        kazu_wa = len(S) - len(Sleftright)
        ans += int(kazu_wa/2) * (K-1)

        S = Sleftright
         
    else: # 全部同じ文字の例外
        ans = int(kazu_left * K / 2)
        
        S = ""
else:
    pass

while len(S) > 0:
#     print(S)
    current = S[0]
    Snext = S.lstrip(current)
    kazu = len(S) - len(Snext)
    ans += int(kazu/2) * K
    S = Snext
print(ans)

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

# 先頭と後頭が一致していた場合の例外処理
Sfront = S[0]
Srear  = S[-1]
if Sfront == Srear and K > 1:
    Sleft = S.lstrip(Srear)
    kazu_left = len(S) - len(Sleft)
    ans += int(kazu_left/2)
    
    Sleftright = Sleft.rstrip(Srear)
    kazu_right = len(Sleft) - len(Sleftright)
    ans += int(kazu_right/2)
    
    kazu_wa = len(S) - len(Sleftright)
    ans += int(kazunoko/2) * (K-1)
    
    S = Sleftright
else:
    pass

while len(S) > 0:
#     print(S)
    current = S[0]
    Snext = S.lstrip(current)
    kazu = len(S) - len(Snext)
    ans += int(kazu/2) * K
    S = Snext
print(ans)

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

# 先頭と後頭が一致していた場合の例外処理
Sfront = S[0]
Srear  = S[-1]
if Sfront == Srear and K > 1:
    Sleft = S.lstrip(Srear)
    kazu_left = len(S) - len(Sleft)
    ans += int(kazu_left/2)
    
    Sleftright = Sleft.rstrip(Srear)
    kazu_right = len(Sleft) - len(Sleftright)
    ans += int(kazu_right/2)
    
    kazu_wa = len(S) - len(Sleftright)
    ans += int(kazunoko/2) * (K-1)
    
    S = Sleftright
else:
    pass

while len(S) > 0:
    print(S)
    current = S[0]
    Snext = S.lstrip(current)
    kazu = len(S) - len(Snext)
    ans += int(kazu/2) * K
    S = Snext
print(ans)
Problem p02916 (python)

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

ans = 0
for i in range(N):
    k = A[i]
    ans += B[k-1]
    if i < N-1:
        if A[i+1] == k+1 and k != N:
            ans += C[k-1]
        else:
            pass
    else:
        pass
print(ans)

Buggy submission (verdict: Runtime Error):
if N == 2:
    if A[1] == 2:
        print(sum(B)+sum(C))
    else:
        print(sum(B))
else:
    k = A[-1]
    if k == A[N-1]:
        print(sum(B)+sum(C))
    else:
        print(sum(B)+sum(C)-C[k-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
   
if N == 2:
    print(sum(B)+sum(C))
elif N == 1:
    print(sum(B))
else:
    k = A[-1]
    print(sum(B)+sum(C)-C[k-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
   
if N == 2:
    print(sum(B)+sum(C))
else:
    k = A[-1]
    print(sum(B)+sum(C)-C[k-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
   
k = A[-1]
print(sum(B)+sum(C)-C[k-1])
Problem p02598 (python)

Fixed submission:
N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]

def judge(x):
    k = 0
    for a in A:
        v = a // x
        if a % x == 0:
            v -= 1
        k += v
    return k <= K

low = 1
high = max(A)

A.sort()

while low < high - 1:
    mid = (low + high) // 2
    if judge(mid):
        high = mid
    else:
        low = mid

if judge(low):
    print(low)
else:
    print(high)

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

def judge(x):
    k = 0
    for a in A:
        v = a // x
        if a % x == 0:
            v -= 1
        k += v
    return k <= K

low = 0
high = max(A)

while low < high - 1:
    mid = (low + high) // 2
    if judge(mid):
        high = mid
    else:
        low = mid

if judge(low):
    print(low)
else:
    print(high)

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

def judge(x):
    k = 0
    for a in A:
        v = a // mid
        k += v
    return k <= K

low = 0
high = max(A)

while low < high - 1:
    mid = (low + high) // 2
    if judge(mid):
        high = mid
    else:
        low = mid

if judge(low):
    print(low)
else:
    print(high)
Problem p02753 (python)

Fixed submission:
S = input()

if S == "AAA" or S == "BBB":
    print("No")
else:
    print("Yes")

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

if S == "AAA" or S = "BBB":
    print("No")
else:
    print("Yes")
Problem p02831 (python)

Fixed submission:
import fractions

def lcm(x, y):
    return(x * y // fractions.gcd(x, y))

A, B = [int(_) for _ in input().split()]

print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return(x * y // math.gcd(x, y))

A, B = [int(_) for _ in input().split()]

print(lcm(A, B))
Problem p03725 (python)

Fixed submission:
from collections import deque

H, W, K = map(int, raw_input().split())

MAP = [raw_input() for _ in xrange(H)]
visited = [[False for _ in xrange(W)] for _ in xrange(H)]

for y in range(H):
    x = MAP[y].find('S')
    if x != -1:
        sx = x
        sy = y

Q = deque()
Q.append((0, (sx, sy)))
visited[sy][sx] = True
while len(Q) > 0:
    cost, [x, y] = Q.popleft()
    for dx, dy in [(-1, 0), (1, 0), (0, 1), (0, -1)]:
        px, py = x+dx, y+dy
        if 0 <= px < W and 0 <= py < H:
            if not visited[py][px] and MAP[py][px] != "#":
                visited[py][px] = True
                if cost + 1 < K:
                    Q.append((cost + 1, (px, py)))

d = 10000
for x in xrange(W):
    for y in xrange(H):
        if visited[y][x]:
            d = min(d, x, W-1-x)
            d = min(d, y, H-1-y)

print (d + K - 1) / K + 1

Buggy submission (verdict: Runtime Error):
H, W, K = map(int, raw_input().split())

MAP = [raw_input() for _ in xrange(H)]
dist = [[10000 for _ in range(W)] for _ in xrange(H)]

for i in range(H):
    x = MAP[i].find('S')
    if x != -1:
        sy = i
        sx = MAP[i].find('S')

Q = []
q(sx, sy)]
visited[sy][sx] = 0
while len(Q) > 0:
    x, y = Q.pop()
    d = visited[y][x]
    for dx, dy in [(-1, 0), (1, 0), (0, 1), (0, -1)]:
        px, py = x+dx, y+dy
        if px < 0 or px >= W:
            continue
        if py < 0 or py >= H:
            continue
        if abs(px - sx) + abs(py - sy) > K:
            continue
        if visited[py][px]:
            continue
        if MAP[py][px] == "#":
            continue
        Q.append((px, py))

d = 10000
for x in xrange(W):
    for y in xrange(H):
        if visited[y][x]:
            d = min(d, x, W-1-x)
            d = min(d, y, H-1-y)

if d == 0:
    print 1
elif d < K:
    print 2
else:
    print 1 + d/K
Problem p03803 (python)

Fixed submission:
A, B = map(int, raw_input().split())
card = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]
if card.index(A) > card.index(B):
    print "Alice"
elif card.index(A) < card.index(B):
    print "Bob"
else:
    print "Draw"

Buggy submission (verdict: Runtime Error):
from copy import deepcopy

N, MA, MB = map(int, raw_input().split())
X = [map(int, raw_input().split()) for _ in range(N)]

DP = [[100000 for _ in range(401)] for _ in range(401)]
DP[0][0] = 0

S = {(0, 0)}
for a, b, c in X:
    DP2 = deepcopy(DP)
    for sa, sb in S:
        if DP[sa+a][sb+b] > DP2[sa][sb] + c:
            DP[sa+a][sb+b] = DP2[sa][sb] + c
    T = {(sa+a, sb+b) for sa, sb in S}
    S |= T

a, b = MA, MB
ans = 100000
while a <= 400 and b <= 400:
    ans = min(ans, DP[a][b])
    a += MA
    b += MB

if ans == 100000:
    print -1
else:
    print ans
Problem p02777 (python)

Fixed submission:
S, T = map(str, input().split())
A, B = map(int, input().split())
U = str(input())

if S == U:
  print(A-1, B)
else:
  print(A, B-1)

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

flag = True
A = sorted(A)
for i in range(N-1):
  if A[i] == A[i+1]:
    flag = False
    break
if flag:
  print("YES")
else:
  print("NO")
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = list(str(input()))

if (S[K-1] == 'A'):
  S[K-1] = 'a'
elif (S[K-1] == 'B'):
  S[K-1] = 'b'
elif (S[K-1] == 'C'):
  S[K-1] = 'c'
  
ans = ''.join(S)
    
print(ans)

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

if (S[K-1] == 'A'):
  S[K] = 'a'
elif (S[K-1] == 'B'):
  S[K] = 'b'
elif (S[K-1] == 'C'):
  S[K] = 'c'
  
ans = ''.join(S)
    
print(ans)

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

if (S[K-1] == "A"):
  S[K] = "a"
elif (S[K-1] == "B"):
  S[K] = "b"
elif (S[K-1] == "C"):
  S[K] = "c"
  
ans = ','.join(S)
    
print(ans)

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

if (S[K] == 'A'):
  S[K] = 'a'
elif (S[K] == 'B'):
  S[K] = 'b'
else:
  S[K] = 'c'
  
ans = ','.join(S)
    
print(ans)

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

if (S[K] == 'A'):
  S[K] = 'a'
elif (S[K] == 'B'):
  S[K] = 'b'
else:
  S[K] = 'c'
    
print(S)

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

if (S[K] == 'A'):
  S[K] = 'a'
elif (S[K] == 'B'):
  S[K] = 'b'
else:
  S[K] = 'c'
    
printf(S)

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

if (S[K] == 'A'):
  S[K] = 'a'
elif (S[K] == 'B'):
  S[K] = 'b'
else:
  S[K] = 'c'
    
printf(S)

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

if (S[K] == 'A'):
	S[K] = 'a'
elif (S[K] == 'B'):
    S[K] = 'b'
else:
	S[K] = 'c'
    
printf(S)
Problem p03250 (python)

Fixed submission:
num = [int(i) for i in input().split()]
num.sort()
print(sum(num)+num[-1]*9)

Buggy submission (verdict: Runtime Error):
num = [int(i) for i in input().split()]
num = num.sorted(reverse=True)
ans = 10*num[0] + num[1] + num[2]
print(ans)