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

Fixed submission:
S_ = input()
T = input()
loop = len(S_) - len(T) + 1
stringlist = []

# check S_ in T
for n in range(loop):
    chance = True
    for i in range(len(T)):
        if S_[n+i] == T[i] or S_[n+i] == "?":
            pass
        else:
            chance = False
            break

    if chance:
        tmp = S_[:n] + T + S_[n+len(T):]
        stringlist.append(tmp)

if len(stringlist) == 0:
    print("UNRESTORABLE")
else:
    stringlist.sort()
    String = stringlist[0]
    S = ""
    for i in range(len(S_)):
        if String[i] == "?":
            S += "a"
        else:
            S += String[i]
    print(S)

Buggy submission (verdict: Runtime Error):
S_ = input()
T = input()
loop = len(S_) - len(T) + 1
stringlist = []

# check S_ in T
for n in range(loop):
    chance = True
    for i in range(len(T)):
        if S_[n+i] == T[i] or S_[n+i] == "?":
            pass
        else:
            chance = False
            break

    if chance:
        tmp = S_[:n] + T + S_[n+len(T):]
        stringlist.append(tmp)

if len(stringlist) == 0:
    print("UNRESTORABLE")
else:
    stringlist.sort()
    String = stringlist[0]
    S = ""
    for i in range(len(S_)):
        if String[i] == "?":
            S += "a"
        else:
            S += String[i]

print(S)

Buggy submission (verdict: Runtime Error):
S_ = input()
T = input()
loop = len(S_) - len(T) + 1
stringlist = []

# check S_ in T
for n in range(loop):
    chance = True
    for i in range(len(T)):
        if S_[n+i] == T[i] or S_[n+i] == "?":
            pass
        else:
            chance = False
            break

    if chance:
        tmp = S_[:n] + T + S_[n+len(T):]
        stringlist.append(tmp)

if len(stringlist) == 0:
    print(UNRESTORABLE)
else:
    stringlist.sort()
    String = stringlist[0]
    S = ""
    for i in range(len(S_)):
        if String[i] == "?":
            S += "a"
        else:
            S += String[i]

print(S)
Problem p03632 (python)

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


def solve(A, B, C, D):
    if A < C:
        if B < C:
            return 0
        elif A <= C and D <= B:
            return (D - C)
        else:
            return (B - C)
    else:
        if D < A:
            return 0
        elif C <= A and B <= D:
            return (B - A)
        else:
            return (D - A)

print(solve(A, B, C, D))

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


def solve(A, B, C, D):
    if A < C:
        if B < C:
            print("0")
        elif A <= C and D <= B:
            print(str(D-C))
        else:
            ptint(str(B-C))
    else:
        if D < A:
            print("0")
        elif C <= A and B <= D:
            print(str(B-A))
        else:
            print(str(D-A))

solve(A, B, C, D)

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

if A < C:
    if B < C:
        print(0)
    elif A <= C and D <= B:
        print(D-C)
    else:
        ptint(B-C)
else:
    if D < A:
        print(0)
    elif C <= A and B <= D:
        print(B-A)
    else:
        print(D-A)

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

if A < C:
    if B < C:
        print(0)
    elif A <= C and D <= B:
        print(D-C)
    else:
        ptint(B-C)
else:
    if D < A:
        print(0)
    elif C <= A and N <= D:
        print(B-A)
    else:
        print(D-A)
Problem p03138 (python)

Fixed submission:
from math import log2

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

def f(n):
    return sum(n^i for i in A)

K += 1

if K == 1:
    print(f(0))
else:
    mb = int(log2(K))
    hN = N / 2

    s = 0
    A_ = A.copy()
    for i in range(mb+1):
        s += (0 if sum(i &0x01 for i in A_) >= hN else 1) * (1 << i)
        A_ = [i >> 1 for i in A_]

    if s >= K:
        def g(i, n, k):
            mask = (2**i) - 1
            s_ = (s & mask) | (k - (k & mask))
            s_ -= (s_ & (1 << i))
            return s_

        gl = [g(i, s, K) for i, b in enumerate("{:b}".format(K)[::-1]) if b == "1"]
        fl = [f(i) for i in gl]
        print(max(fl))
    else:
        print(f(s))

Buggy submission (verdict: Runtime Error):
from math import log2

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

def f(n):
    return sum(n^i for i in A)

K += 1

if K == 1:
    print(f(0))
else:
    mb = int(log2(K))
    hN = N / 2

    s = 0
    A_ = A.copy()
    for i in range(mb+1):
        s += (0 if sum(i &0x01 for i in A_) >= hN else 1) * (1 << i)
        A_ = [i >> 1 for i in A_]

    if s >= K:
        def g(i, n, k):
            mask = (2**i) - 1
            s_ = (s & mask) | (k - (k & mask))
            s_ -= (s_ & (1 << i))
            return s_

        gl = [g(i, s, K) for i, b in enumerate(f"{K:b}"[::-1]) if b == "1"]
        fl = [f(i) for i in gl]
        print(max(fl))
    else:
        print(f(s))
Problem p03160 (python)

Fixed submission:
N = int(input())
h = [int(i) for i in input().split()]

def g(n, h):
    g2 = 0
    g1 = abs(h[1] - h[0])
    for i in range(2, n+1):
        g = min(abs(h[i] - h[i-1]) + g1, abs(h[i] - h[i-2]) + g2)
        g2 = g1
        g1 = g
    return g1

print(g(N-1, h))

Buggy submission (verdict: Runtime Error):
N = int(input())
h = [int(i) for i in input().split()]

def f(n, h):
    g = {0: 0, 1: abs(h[1] - h[0])}
    def f_(n, h):
        if n in g:
            return g[n]

        g[n] = min(abs(h[n] - h[n-1]) + f_(n-1, h), abs(h[n] - h[n-2]) + f_(n-2, h))
        return g[n]
    return f_(n, h)

print(f(N-1, h))
Problem p03161 (python)

Fixed submission:
from collections import deque
N, K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
def g(n, k, h):
    gk = deque([abs(h[1] - h[0]), 0])
    g = gk[0]
    for i in range(2, n):
        g = min(abs(h[i] - h[i-j]) + gk[j-1] for j in range(1, min(i, k)+1))
        if i >= k:
            gk.pop()
        gk.appendleft(g)
    return g

print(g(N, K, h))

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

def g(n, k, h):
    g = abs(h[1] - h[0])
    gk = deque([0, g], k)
    for i in range(2, n):
        h_i = h[i]
        j = max(i - k, 0)
        g = min(abs(h_i - h_j) + h_k for h_j, h_k in zip(h[j:i], gk))
        if i >= k:
            gk.popleft()
        gk.append(g)
    return g

print(g(N, K, h))

Buggy submission (verdict: Runtime Error):
from collections import deque
N, K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

def g(n, k, h):
    gk = deque([0, abs(h[1] - h[0])], k)
    g = gk[1]
    for i in range(2, n):
        h_i = h[i]
        j = max(i - k, 0)
        g = min(abs(h_i - h_j) + h_k for h_j, h_k in zip(h[j:], gk))
        if i >= k:
            gk.popleft()
        gk.append(g)
    return g

print(g(N, K, h))
Problem p03187 (python)

Fixed submission:
import math

L, N = (int(i) for i in input().split())
X = [int(input()) for _ in range(N)]
X.insert(0, 0)

X_r = [L - i for i in reversed(X)]
X_r.insert(0, 0)
X_r.pop()

def lsum(l):
    s = 0
    for i in l:
        s += i
        yield s

X_sum = list(lsum(X))
X_r_sum = list(lsum(X_r))

def f_l(p, n):
    N_tmp = N - n
    a = N_tmp // 2
    if N_tmp == 0:
        return 0
    elif N_tmp % 2 == 0:
        return 2 * X_sum[a] + X_r_sum[a + n] + X_r_sum[a + n - 1] - 2 * X_r_sum[n] + p
    else:
        return X_sum[a+1] + X_sum[a] + 2 * X_r_sum[a + n] - 2 * X_r_sum[n] + p


def f_r(p, n):
    N_tmp = N - n
    a = N_tmp // 2
    if N_tmp == 0:
        return 0
    elif N_tmp % 2 == 0:
        return 2 * X_r_sum[a] + X_sum[a + n] + X_sum[a + n - 1] - 2 * X_sum[n] + p
    else:
        return X_r_sum[a+1] + X_r_sum[a] + 2 * X_sum[a + n] - 2 * X_sum[n] + p

max_l = max(X[i] + f_r(X[i], i) for i in range(1, N+1))
max_r = max(X_r[i] + f_l(X_r[i], i) for i in range(1, N+1))

print(max(max_l, max_r))

Buggy submission (verdict: Runtime Error):
L, N = (int(i) for i in input().split())
X = [int(input()) for _ in range(N)]
X.insert(0, 0)

X_c = [L - i for i in X]

def f(L, N, X, p, l, r, d_r):
    w = 0
    for _ in range(N - (l + r)):
        if d_r:  # L
            l += 1
            w += X[l] - p
            p = X[l]
            d_r = False
        else:  # R
            r += 1
            w += L - X[-r] + p
            p = X[-r] - L
            d_r = True
    return w

len_l = [X[i] + f(L, N, X, X[i], i, 0, True) for i in range(1, N)]
len_r = [X_c[-i] + f(L, N, X, X[-i] - L, 0, i, False) for i in range(1, N)]
max_l = max(len_l)
max_r = max(len_r)
print(max(max_l, max_r))
Problem p03240 (python)

Fixed submission:
N = int(input())
xyh = [tuple(int(i) for i in input().split()) for i in range(N)]


def H(cx, cy, x, y, h):
    return h + abs(x - cx) + abs(y - cy)


def g(l, cx, cy):
    H_max_l = set(H(cx, cy, x, y, h) for x, y, h in l if h == 0)
    h_max = min(H_max_l) if any(H_max_l) else -1
    
    TH = set(H(cx, cy, x, y, h) for x, y, h in l if h > 0)
    if len(TH) == 1:
        high = TH.pop()
        if h_max == -1 or high <= h_max:
            return high
    return -1


def f(l):
    for cx in range(0, 101):
        for cy in range(0, 101):
            h = g(l, cx, cy)
            if h > 0:
                return cx, cy, h

cx, cy, h = f(xyh)
print(cx, cy, h)

Buggy submission (verdict: Runtime Error):
N = int(input())
xyh = [tuple(int(i) for i in input().split()) for i in range(N)]


def H(cx, cy, x, y, h):
    return h + abs(x - cx) + abs(y - cy)


def g(l, cx, cy):
    H_max_l = set(H(cx, cy, x, y, h) for x, y, h in xyh if h == 0)
    h_max = min(H_max_l) if any(H_max_l) else 10**9
    
    TH = set(H(cx, cy, x, y, h) for x, y, h in l if h > 0)
    if len(TH) == 1:
        high = TH.pop()
        if high <= h_max:
            return high
    return -1


def f(l):
    for cx in range(0, 101):
        for cy in range(0, 101):
            h = g(l, cx, cy)
            if h > 0:
                return cx, cy, h

cx, cy, h = f(xyh)
print(cx, cy, h)

Buggy submission (verdict: Runtime Error):
N = int(input())
xyh = [tuple(int(i) for i in input().split()) for i in range(N)]


def H(cx, cy, x, y, h):
    return h + abs(x - cx) + abs(y - cy)


def g(l, cx, cy):
    H_max_l = set(H(cx, cy, x, y, h) for x, y, h in xyh if h == 0)
    h_max = min(H_max_l) if any(H_max_l) else 10**9
    
    TH = set(H(cx, cy, x, y, h) for x, y, h in l if h > 0)
    if len(TH) == 1:
        high = TH.pop()
        if high <= h_max:
            return high
    return -1



def f(l):
    for cx in range(0, 101):
        for cy in range(0, 101):
            h = g(l, cx, cy)
            if h >= 0:
                return cx, cy, h

cx, cy, h = f(xyh)
print(cx, cy, h)
Problem p03262 (python)

Fixed submission:
from fractions import gcd
from functools import reduce

N, X = tuple(int(i) for i in input().split())
x = [int(i) for i in input().split()]

x.append(X)
sx = sorted(x)
dx = [j - i for i, j in zip(sx[:-1], sx[1:])]

mdx = reduce(gcd, dx)

print(mdx)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

N, X = tuple(int(i) for i in input().split())
x = [int(i) for i in input().split()]

x.append(X)
sx = sorted(x)
dx = [j - i for i, j in zip(sx[:-1], sx[1:])]

mdx = reduce(math.gcd, dx)

print(mdx)
Problem p03273 (python)

Fixed submission:
H, W = tuple(int(i) for i in input().split())
As = [input() for i in range(H)]

a = [i for i in As if "#" in i]
b = ["".join(j[i] for j in a) for i in range(W)]
b_ = [i for i in b if "#" in i]
a_ = ["".join(j[i] for j in b_) for i in range(len(b_[0]))]

for i in a_:
  print(i)

Buggy submission (verdict: Runtime Error):
H, W = input().split()
H = int(H)
W = int(W)

a = [input() for i in range(W)]

a = [i for i in a if "#" in i]
b = ["".join([for a[i]]) for i in range(H) for j in a]
b = [i for i in b if "#" in i]

a = ["".join([for a[i]]) for i in range(len(b)) for j in b]

for i in a:
  print(i)
Problem p03309 (python)

Fixed submission:
import math

def median(l):
    n = len(l)
    ls = sorted(l)
    if n%2 == 0:
        m1 = ls[int(n/2)-1]
        m2 = ls[int(n/2)]
        return (m1+m2)/2
    
    return ls[int(n/2)]

N = int(input())
A = [int(i) for i in input().split()]

A_ = [A[i] - i - 1 for i in range(N)]

A_m = median(A_)
A_m1 = math.floor(A_m)
A_m2 = math.ceil(A_m)

A_b = [sum([abs(a - i) for a in A_]) for i in (A_m1, A_m2)]

print(min(A_b))

Buggy submission (verdict: Runtime Error):
def median(l):
    n = len(l)
    ls = sorted(l)
    if n == 1: return ls[0]
    if n%2 == 0:
        m1 = ls[int(n/2)-1]
        m2 = ls[int(n/2)]
        return (m1+m2)/2
    
    return ls[int(n/2)-1]

N = int(input())
A = [int(i) for i in input().split()]

A_ = [A[i] - i - 1 for i in range(N)]

A_m = median(A_)
A_m1 = math.floor(A_m)
A_m2 = math.ceil(A_m)

A_b = [sum([abs(a - i) for a in A_]) for i in (A_m1, A_m2)]

print(min(A_b))
Problem p03215 (python)

Fixed submission:
n,k=map(int,input().split())
d=list(map(int,input().split()))

ds = []

for i in range(0,n):
    sum = 0
    for j in range(i,n):
        sum += d[j]
        ds.append(sum)
        #print(str(sum) + " ",end='')
    #print()

ds.sort(reverse=True)

sum = 0
for i in range(40,-1,-1):
    count = 0
    o = []
    for dss in ds:
        if dss & (1 << i) > 0 :
            count += 1
            o.append(dss)

    if count >= k :
        sum += 1 << i
        ds = o

print(sum)

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

ds = []

for i in range(0,n):
    sum = 0
    for j in range(i,n):
        sum += d[j]
        ds.append(sum)
        //print(str(sum) + " ",end='')
    //print()

ds.sort(reverse=True)

sum = 0
for i in range(40,-1,-1):
    count = 0
    o = []
    for dss in ds:
        if dss & (1 << i) > 0 :
            count += 1
            o.append(dss)

    if count >= k :
        sum += 1 << i
        ds = o

print(sum)
Problem p03219 (python)

Fixed submission:
x,y = map(int,input().split())
print(str(x+(y>>1)))

Buggy submission (verdict: Runtime Error):
#import time as time

#s = time.time()

n,m = map(int,input().split())
py = []
od = [[]*1 for i in range(n)]

#print ("create list: " + str(time.time() - s) )

#s = time.time()
for i in range(0,m):
    p,y = map(int,input().split())
    py.append([p,y])
       
    odlen = len(od[p-1])
    if odlen >= 1 :

        low = 0
        high = odlen - 1
        mid = odlen//2

        while low <= high:
            mid = (low + high) >> 1
            guess = od[p-1][mid]
            if guess == y:
                break
            if guess > y :
                high = mid - 1
            else:
                low  = mid + 1

        od[p-1].insert(low,y)

    else:
        od[p-1].append(y)

#print ("sort: " + str(time.time() - s) )

#s = time.time()
for i in range(0,m):
    r = od[py[i][0]-1].index(py[i][1])

    tmp = py[i][0]
    digit = 0
    while tmp > 0 :        
        digit += 1
        tmp = tmp // 10
    
    for j in range(6-digit):
        print('0',end="")
    print(py[i][0],end="")

    tmp = r + 1
    digit = 0
    while tmp > 0 :        
        digit += 1
        tmp = r // 10

    for j in range(6-digit):
        print('0',end="")
    print(r+1)

#print ("index: " + str(time.time() - s) )
Problem p03240 (python)

Fixed submission:
n = int(input())

l = []
a = {}
b = {}

for i in range(n):
    x,y,h = map(int,input().split())
    if h > 0 :
        l.append([x,y,h])

for cx in range(100+1):
    for cy in range(100+1):
              
        count = 0
        preheight = abs(l[0][0]-cx) + abs(l[0][1]-cy) + l[0][2]

        for ll in l :
            height = abs(ll[0]-cx) + abs(ll[1]-cy) + ll[2] 
            if preheight != height:
                break
            count = count + 1

        if count >= len(l) :
            if preheight in a:
                a[preheight] += 1
                b[preheight] = [cx,cy]
            else:
                a[preheight] = 1
                b[preheight] = [cx,cy]

for ans in a.keys() :
    if a[ans] == 1 :
        print(b[ans][0],b[ans][1],ans)
        exit(0)

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

l = []
for i in range(n):
    x,y,h = map(int,input().split())
    if h > 0 :
        l.append([x,y,h])

for cx in range(100+1):
    for cy in range(100+1):
              
        count = 0
        preheight = abs(l[0][0]-cx) + abs(l[0][1]-cy) + l[0][2]

        for i in range(n):            
            height = abs(l[i][0]-cx) + abs(l[i][1]-cy) + l[i][2] 
            if preheight != height:
                break

            count = count + 1

        if count >= len(l) :
            print(cx,cy,preheight)
            exit(0)
Problem p03244 (python)

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

e = v[::2]
o = v[1::2]

ev = {}
ov = {}
for t in e :
    if t in ev :
        ev[t] = ev[t] + 1
    else :
        ev[t] = 1

for t in o :
    if t in ov:
        ov[t] = ov[t] + 1
    else :
        ov[t] = 1

ev = sorted(ev.items(),key=lambda x : x[1],reverse=True)
ov = sorted(ov.items(),key=lambda x : x[1],reverse=True)

#li = []
#for elm in list(ev.keys()) :
#    li.append([0,[elm,ev[elm]]])
#for elm in list(ov.keys()) :
    #li.append([1,[elm,ov[elm]]])
#li.sort(key=lambda x : x[1][1],reverse=True)
#print(li)

ee  = ev[0][0]
oo  = ov[0][0]

es0 = ev[0][1]
os0 = ov[0][1]
ans = n - es0 - os0

if ee == oo:
    tmp1 = n - es0
    tmp2 = n - os0

    if len(ev) > 1:
        es1 = ev[1][1]
        tmp1 = n  - es1  - os0

    if len(ov) > 1:
        os1 = ov[1][1]
        tmp2 = n  - es0  - os1

    if tmp1 > tmp2 :
        ans = tmp2 
    else :
        ans = tmp1

print(ans)

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

e = v[::2]
o = v[1::2]

ev = {}
ov = {}
for t in e :
    if t in ev :
        ev[t] = ev[t] + 1
    else :
        ev[t] = 1

for t in o :
    if t in ov:
        ov[t] = ov[t] + 1
    else :
        ov[t] = 1

print(ev)
print(ov)

sorted(ev.items(),key=lambda x : x[1],reverse=True)
sorted(ov.items(),key=lambda x : x[1],reverse=True)

eidx = 0
oidx = 0
et = list(ev.values())[eidx]
ot = list(ov.values())[oidx]

if et == ot :
    if ev[et] > ov[ot] :
        if len(ot) > 1:
            ot = list(ov.values())[oidx+1]
    else:
        if len(et) > 1:
            et = list(ov.values())[eidx+1]

ans = len(e) - et + len(o) - ot
print(ans)
Problem p03262 (python)

Fixed submission:
import math

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

n,x = map(int,input().split())
t   = list(map(int,input().split()))

ans = abs(t[0]-x)
for i in range(1,len(t)):
    t[i] = abs(t[i]-x)
    ans = gcd(ans,t[i])

print(ans)

Buggy submission (verdict: Runtime Error):
import math

n,x = map(int,input().split())
t   = list(map(int,input().split()))

max = abs(t[0]-x)
for i in range(1,len(t)):
    t[i] = abs(t[i]-x)
    max = math.gcd(t[i],max)

print(max)
Problem p03284 (python)

Fixed submission:
n,k = map(int,input().split())
if n < k:
    print(1)
else:
    if n%k == 0:
        print(0)
    else:
        if k >= n%k:
            print(1)
        else : 
            print(k - n%k)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
print(abs(n//k - (n-(n//k)*k))
Problem p03323 (python)

Fixed submission:
args = (input())
a = int( args.split(" ")[0])
b = int(args.split(" ")[1])

if(a>8 or b>8):
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
import sys

args = sys.argv

if(args[1]>8 or args[2]>8):
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
import sys

printf(sys.argv[1])
Problem p04047 (python)

Fixed submission:
N = input()
Li = list(map(int, input().split(" ")))
Li.sort()
total = 0
for i in Li[0::2]:
    total += i
print(total)

Buggy submission (verdict: Runtime Error):
N = input()
Li = map(int, input().split(" "))
Li.sort()
total = 0
for i in Li[0::2]
    total += i
print(total)
Problem p03071 (python)

Fixed submission:
line = input()
lines = line.split()
a = int(lines[0])
b = int(lines[1])
res = 0
if a > b:
  res = a + a - 1
elif b > a:
  res = b + b - 1
else:
  res = a + b

print(res)

Buggy submission (verdict: Runtime Error):
line = raw_input()
lines = line.split()
a = int(lines[0])
b = int(lines[1])
res = 0
if a > b:
  res = a + a - 1
elif b > a:
  res = b + b - 1
else:
  res = a + b

print(res)

Buggy submission (verdict: Runtime Error):
line = raw_input()
lines = line.split()
a = int(lines[0])
b = int(lines[1])
res = 0
if a > b:
  res = a + a - 1
elif b > a:
  res = b + b - 1
else:
  res = a + b

print(res)
Problem p03101 (python)

Fixed submission:
in1 = input().split()
in2 = input().split()

H = int(in1[0])
W = int(in1[1])

h = int(in2[0])
w = int(in2[1])

print((H - h) * (W - w))

Buggy submission (verdict: Runtime Error):
in1 = input().split()
in2 = input().split()

H = in1[0]
W = in1[1]

h = in2[0]
w = in2[1]

print((H - h) * (W - w))
Problem p03105 (python)

Fixed submission:
in1 = input().split()

a = int(in1[0])
b = int(in1[1])
c = int(in1[2])

if b / a < c:
  print(int(b / a))
else:
  print(c)

Buggy submission (verdict: Runtime Error):
in = input().split()

a = int(in[0])
b = int(in[1])
c = int(in[2])

if b / a < c:
  print(b/ a)
else:
  print(c)
Problem p03043 (python)

Fixed submission:
import math

N,K = map(int, input().split())

p = 0.0

if K>N:
    tp = 0.0
    for i in range(1,N+1):#1~N
        #deme i
        tp += 0.5**math.ceil(math.log2(K/i))
    tp = tp / N
    print(tp)
elif K == 1:
    print(1.0)
else:
    p = (N-K+1.0)/N#No coin
    tp = 0.0
    for i in range(1,K):#1~K-1
        #deme i
        tp += 0.5**math.ceil(math.log2(K/i))
    tp = tp / (K-1.0)
    print(p+(1.0-p)*tp)

Buggy submission (verdict: Runtime Error):
import math

N,K = map(int, input().split())

p = 0.0

if K>N:
    tp = 0.0
    for i in range(1,N+1):#1~N
        #deme i
        tp += 0.5**math.ceil(math.log2(K/i))
    tp = tp / N
    print(tp)
else:
    p = (N-K+1.0)/N#No coin
    tp = 0.0
    for i in range(1,K):#1~K-1
        #deme i
        tp += 0.5**math.ceil(math.log2(K/i))
    tp = tp / (K-1.0)
    print(p+(1.0-p)*tp)

Buggy submission (verdict: Runtime Error):
import math

N,K = map(int, input().split())

p = 0

if K>N:
    tp = 0
    for i in range(1,N+1):
        #deme i
        tp += 0.5**math.ceil(math.log2(K/i))
    tp = tp / N
    print(tp)
else:
    p = (N-K+1)/N#No coin
    tp = 0
    for i in range(1,K):
        #deme i
        tp += 0.5**math.ceil(math.log2(K/i))
    tp = tp / (K-1)
    print(p+(1-p)*tp)
Problem p03059 (python)

Fixed submission:
A,B,T = map(int, input().split())
Ans = ((T+0.5)//A)*B
print(int(Ans))

Buggy submission (verdict: Runtime Error):
A,B,T = map(int, input().split())
Ans = ((T+0.5)//A)*B
print(int(Ans)
Problem p03076 (python)

Fixed submission:
cook = []
amari = [0]
t = 0
for i in range(5):
    cook.append(int(input()))

for i in range(5):
    if cook[i] % 10 != 0:
        t += cook[i] + (10 - cook[i] % 10)
    else:
        t += cook[i]

for i in range(5):
    if cook[i] % 10 != 0:
        amari.append(10 - cook[i] % 10)

print(t - max(amari))

Buggy submission (verdict: Runtime Error):
cook = []
amari = []
t = 0
for i in range(5):
    cook.append(int(input()))

for i in range(5):
    if cook[i] % 10 != 0:
        t += cook[i] + (10 - cook[i] % 10)
    else:
        t += cook[i]

for i in range(5):
    if cook[i] % 10 != 0:
        amari.append(10 - cook[i] % 10)

print(t - max(amari))

Buggy submission (verdict: Runtime Error):
cook = []
t = 0
for i in range(5):
    cook.append(int(input()))

for i in range(5):
    if cook[i] % 10 != 0:
        t += cook[i] + (10 - cook[i] % 10)
    else:
        t += cook[i]

amari = []
for i in range(5):
    if cook[i] % 10 != 0:
        amari.append((10 - cook[i] % 10))

print(t - max(amari))