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

Fixed submission:
c=0
def doublet(n,f):
    global c
    if n<f:
        c=c+1
        return doublet(2*n,f)
    else:
        return c
num,k=input().split()
num=int(num)
k=int(k)
#k=eval(input())
if (num>=1 and num<=10**5) and (k>=1 and k<=10**5):
    sum_power=0.0
    for i in range(1,(num+1),1):
        count=doublet(i,k)
        p=pow(2,count)*num
        sum_power=sum_power+(1/p)
        c=0
    print(sum_power)

Buggy submission (verdict: Runtime Error):
c=0
def doublet(n,f):
    global c
    if n<f:
        c=c+1
        return doublet(2*n,f)
    else:
        return c
num=eval(input())
k=eval(input())
if (num>=1 and num<=10**5) and (k>=1 and k<=10**5):
    sum_power=0.0
    for i in range(1,(num+1),1):
        count=doublet(i,k)
        p=pow(2,count)*num
        sum_power=sum_power+(1/p)
        c=0
    print(sum_power)

Buggy submission (verdict: Runtime Error):
c=0
def doublet(n,f):
    global c
    if n<f:
        c=c+1
        return doublet(2*n,f)
    else:
        return c
num=eval(input())
k=eval(input())
if (num>=1 and num<=10**5) and (k>=1 and k<=10**5):
    sum_power=0.0
    for i in range(1,(num+1),1):
        count=doublet(i,k)
        p=pow(2,count)*num
        sum_power=sum_power+(1/p)
        c=0
    print(sum_power)

Buggy submission (verdict: Runtime Error):
c=0
def doublet(n,f):
    global c
    if n<f:
        c=c+1
        return doublet(2*n,f)
    else:
        return c
num=eval(input("n= "))
k=eval(input("k="))
sum_power=0.0
for i in range(1,(num+1),1):
    count=doublet(i,k)
    p=pow(2,count)*num
    sum_power=sum_power+(1/p)
    c=0
print(sum_power)
Problem p02817 (python)

Fixed submission:
line=input().split(' ')
print(line[1] + line[0])

Buggy submission (verdict: Runtime Error):
line = input().split(' ')
A = int(line[0])
B = int(line[1])
K = int(line[2])
Z = 0

def p2(num1, num2, Z):
  if Z:
    return(0)
  else:
    if(num1 < num2):
      return (num2 - num1)
      Z = 1
    else:
      return(0)
  
print(str(p2(K, A, Z)) + ' ' + str(p2(K - A, B, Z)))

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
print(b + a)
Problem p02818 (python)

Fixed submission:
line = input().split(' ')
A = int(line[0])
B = int(line[1])
K = int(line[2])

if K < A:
  print(str(A - K) + ' ' + str(B))
else:
  if K - A < B:
    print(str(0) + ' ' + str(B - K + A))
  else:
    print(str(0) + ' ' + str(0))

Buggy submission (verdict: Runtime Error):
line = input().split(' ')
A = int(line[0])
B = int(line[1])
K = int(line[2])
Z = 0

def p2(num1, num2, Z):
  if Z:
    return(0)
  else:
    if(num1 < num2):
      return (num2 - num1)
      Z = 1
    else:
      return(0)
  
print(str(p2(K, A)) + ' ' + str(p2(K - A, B)))
Problem p02830 (python)

Fixed submission:
N=input()
ST=input()
S=ST.split(' ')[0]
T=ST.split(' ')[1]
result=''

for i in range(int(N)):
  result+=S[i]
  result+=T[i]
  
print(result)

Buggy submission (verdict: Runtime Error):
N=input()
ST=input()
S=ST.split(' ')[0]
T=ST.split(' ')[1]

for i in range(N):
  result.append(S[i])
  result.append(T[i])
  
print(result)

Buggy submission (verdict: Runtime Error):
N=input()
ST=input()
S=ST.split(0,N)
T=ST.split(N,2*N)

for i in range(N):
  result.append(S[i])
  result.append(T[i])
  
print(result)
Problem p02713 (python)

Fixed submission:
from math import *

K = int(input())

ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        tmp = gcd(i, j)
        for k in range(1, K+1):
            ans += gcd(tmp, k)

print(ans)

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

K = int(input())

ans = 0
for i in range(1, K+1):
    for j in range(i, K+1):
        for k in range(j, K+1):
            ans += gcd(i, j, k)

print(ans)
Problem p02743 (python)

Fixed submission:
import math

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

# a + b + 2 sqrt(ab) < c
# c - a - b > 2 sqrt(ab)
# (c - a - b)^2 > 4ab

if (c - a - b)**2 > 4 * a * b and c - a - b > 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import math

def nroot(a, n, x=1.0, eps=1e-7):
    while abs(a - x**n) > eps:
        x = ( (n-1)*x + a/(x**(n-1)) ) / n
    return x


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

sa = nroot(a)
sb = nroot(b)
sc = nroot(c)

if sa + sb < sc:
    print('Yes')
else:
    print('No')
Problem p02760 (python)

Fixed submission:
import numpy as np
import sys

A = np.zeros((3, 3), dtype=np.int64)
for i in range(3):
    l, m, n = map(int, input().split())
    A[i][0] = l
    A[i][1] = m
    A[i][2] = n
N = int(input())
b = []
for i in range(N):
    k = int(input())
    b.append(k)
for k in range(N):
    for i in range(3):
        for j in range(3):
            if b[k] == A[i][j]:
                A[i][j] = 0


row = np.sum(A, axis=1)
for i in range(3):
    if row[i] == 0:
        print('Yes')
        sys.exit()


col = np.sum(A, axis=0)
for i in range(3):
    if col[i] == 0:
        print('Yes')
        sys.exit()

c = 0
for i in range(3):
    c += A[i][i]
if c == 0:
    print('Yes')
    sys.exit()

c = 0
for i in range(3):
    c += A[3-i-1][i]
if c == 0:
    print('Yes')
    sys.exit()

print('No')

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

for i in range(3):
    A = list(map(int, input().split()))
N = int(input())
b = []
for i in range(N):
    k = int(input())
    b.append(k)
for k in b:
    for row in A:
        for elem in row:
            if k == elem:
                elem = 0


row = np.sum(A, axis=1)
for i in range(3):
    if row[i] == 0:
        print('Yes')
        sys.exit()


col = np.sum(A, axis=0)
for i in range(3):
    if col[i] == 0:
        print('Yes')
        sys.exit()

c = 0
for i in range(3):
    c += A[i][i]
if c == 0:
    print('Yes')
    sys.exit()

c = 0
for i in range(3):
    c += A[3-i-1][i]
if c == 0:
    print('Yes')
    sys.exit()

print('No')
Problem p02778 (python)

Fixed submission:
S = input()

ls = len(S)

ans = ''
for i in range(ls):
    ans += 'x'

print(ans)

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

ls = len(S)

ans = ''
for i in range(ls):
    ans.append('x')

print(ans)

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

ls = len(S)

ans = ''
for i in range(ls):
    ans.append(x)

print(ans)
Problem p02786 (python)

Fixed submission:
def f(x):
    if x == 1:
        return 1
    else:
        return 2 * f(x // 2) + 1   

H = int(input())

min = f(H)

print(min)

Buggy submission (verdict: Runtime Error):
def f(x):
    if x == 1:
        return 1
    else:
        return 2 * f(H // 2) + 1   

H = int(input())

min = f(H)

print(min)

Buggy submission (verdict: Runtime Error):
def f(x):
    if x == 1:
        return 1
    else:
        return 2 * f(H // 2) + 1   

H = int(input())

min = f(H)

print(min)

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

def f(x):
    if x == 1:
        return 1
    else:
        return 2 * f(H // 2) + 1   

H = int(input())

    min = f(H)

print(min)
Problem p02787 (python)

Fixed submission:
INF = float('inf')

H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


# i個目までを使って与えた魔力の総和がjの時の最小コスト
dp = [[INF for j in range(H + 1)] for i in range(N + 1)]

dp[0][0] = 0

for i in range(N):
    for j in range(H + 1):
        if j < A[i]:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][0] + B[i])
        else:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])

print(dp[N][H])

Buggy submission (verdict: Runtime Error):
INF = float('inf')

H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


# i個目までを使って与えた魔力の総和がj以下の時の最小コスト
dp = [[INF for j in range(H + 2)] for i in range(N + 1)]

dp[0][0] = 0

for i in range(N):
    for j in range(H + 2):
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])

if dp[N][H] == INF:
    print(dp[N][H + 1])
else:
    print(dp[N][H])

Buggy submission (verdict: Runtime Error):
INF = float('inf')

H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


# i個目までを使って与えた魔力の総和がj以下の時の最小コスト
dp = [[INF for j in range(H + 1)] for i in range(N + 1)]

dp[0][0] = 0

for i in range(N):
    for j in range(H + 2):
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])

if dp[N][H] == INF:
    print(dp[N][H + 1])
else:
    print(dp[N][H])

Buggy submission (verdict: Runtime Error):
INF = float('inf')

H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


# i個目までを使って与えた魔力の総和がj以下の時の最小コスト
dp = [[INF for j in range(H + 1)] for i in range(N + 1)]

dp[0][0] = 0

for i in range(N):
    for j in range(H + 1):
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])

print(dp[N][H])

Buggy submission (verdict: Runtime Error):
INF = float('inf')

H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


# i個目までを使って与えた魔力の総和がj以下の時の最小コスト
dp = [[INF for j in range(H + 1)] for i in range(N + 1)]

dp[0][0] = 0

for i in range(N):
    for j in range(H + 1):
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])

print(dp[N][H])

Buggy submission (verdict: Runtime Error):
INF = 10**9

H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


# i個目までを使って与えた魔力の総和がj以下の時の最小コスト
dp = [[0 for j in range(H + 1)] for i in range(N + 1)]

for i in range(N):
    for j in range(H + 1):
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])
    

print(dp[H][N])
Problem p02803 (python)

Fixed submission:
from collections import deque

inf = float('inf')
di = [-1, 0, 1, 0]
dj = [0, -1, 0, 1]

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

ans = 0

# bfs
for si in range(h):
    for sj in range(w):
        if s[si][sj] == '#':
            continue
        dist = [[-inf for j in range(w)] for i in range(h)]
        q = deque()
        
        def update(i, j, x):
            if dist[i][j] != -inf:
                return
            dist[i][j] = x
            q.append([i, j])
        
        update(si, sj, 0)
        
        while len(q):
            i = q[0][0]
            j = q[0][1]
            q.popleft()
            for dir in range(4):
                ni = i + di[dir]
                nj = j + dj[dir]
                if ni < 0 or ni >= h or nj < 0 or nj >= w:
                    continue
                if s[ni][nj] == '#':
                    continue
                update(ni, nj, dist[i][j] + 1)

        # 2次元配列のmax
        dist_max = max(list(map(lambda x: max(x), dist)))
        ans = max(ans, dist_max)

print(ans)

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

inf = float('inf')
di = [1, 0, -1, 0]
dj = [0, 1, 0, -1]

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

# bfs
for si in range(h):
    for sj in range(w):
        if s[si][sj] == '#':
            continue
        dist = [[inf for j in range(w)] for i in range(h)]
        q = deque()
        
        def update(i, j, x):
            if dist[i][j] != inf:
                return
            dist[i][j] = x
            q.append([i, j])
        
        update(si, sj, 0)
        
        while len(q):
            i = q[0]
            j = q[1]
            q.popleft()
            for dir in range(4):
                ni = i + di[dir]
                nj = j + dj[dir]
                if ni < 0 or ni >= h or nj < 0 or nj >= w:
                    continue
                if s[ni][nj] == '#':
                    continue
                update(ni, nj, dist[i][j] + 1)
        
for i in range(h):
    for j in range(w):
        if dist[i][j] == inf:
            continue
        ans = max(ans, dist[i][j])

print(ans)
Problem p02812 (python)

Fixed submission:
length = int(input())
string = input()
print(string.count("ABC"))

Buggy submission (verdict: Runtime Error):
length = int(input())
string = input()
count=0

if(length>=3):
    for i in range(0,length):
        if ("A" == string[i]) and ("B" == string[i+1]) and ("C" == string[i+2]):
            count+=1
            i+=3
            if i>length-3:
                break

print(count)

Buggy submission (verdict: Runtime Error):
length = int(input())
string = input()
count=0
for i in range(0,length):
    if ("A" == string[i]) and ("B" == string[i+1]) and ("C" == string[i+2]):
        count+=1
        i+=3
        if i>length-3:
            break
print(count)

Buggy submission (verdict: Runtime Error):
length = int(input())
string = input()
count=0

for i in range(0,length):
    if ("A" == string[i]) and ("B" == string[i+1]) and ("C" == string[i+2]) and i>length-2:
        count+=1
        i+=3

print(count)

Buggy submission (verdict: Runtime Error):
length = int(input())
string = input()
count=0

for i in range(0,length):
    if ("A" == string[i]) and ("B" == string[i+1]) and ("C" == string[i+2]):
        count+=1
        i+=3

print(count)
Problem p03105 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(min(b//a,c))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
print(min(b//a,c))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
print(min(b/a,c))
Problem p03145 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(a*b//2)

Buggy submission (verdict: Runtime Error):
#coding:UTF-8
As=input()
Bs=input()
Cs=input()
a=int(As)
b=int(Bs)
print(a*b/2)

Buggy submission (verdict: Runtime Error):
#coding UTF-8
As=input()
Bs=input()
Cs=input()
a=int(As)
b=int(Bs)
print(a*b/2)

Buggy submission (verdict: Runtime Error):
As=input()
Bs=input()
Cs=input()
a=int(As)
b=int(Bs)
print(a*b/2)
Problem p02658 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
ans = 1
if 0 in a:
  print(0)
else:
  for i in a:
    ans = ans * i
    if ans > 1000000000000000000:
  	  break
  if ans > 1000000000000000000:
    print('-1')
  else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
ans = 1
for i in a:
  ans = ans * i
  if ans >= 1000000000000000000:
  	break:

if ans >= 1000000000000000000:
    print('-1')
else:
  print(ans)
Problem p02705 (python)

Fixed submission:
import math


r = int(input())
print(2*r*math.pi)

Buggy submission (verdict: Runtime Error):
import math

r = int(input())
print(round(2*r*math.pi, 3)
Problem p03029 (python)

Fixed submission:
A, P = map(int, input().split())
print((A*3+P)//2)

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

print((A*3+p)/2)
Problem p03086 (python)

Fixed submission:
S = input()

ok_list = ["A", "C", "G", "T"]
count = 0
ans = 0

for c in S:
  if c in ok_list:
    count += 1
    if ans < count:
      ans = count
  else:
    count = 0

print(ans)

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

ok_list = ["A", "C", "G", "T"]
ans_list = []
ans = 0

for i in S:
  if i in ok_list:
    ans += 1
  else:
    ans_list.append(ans)
    ans = 0

print(max(ans_list))
Problem p03139 (python)

Fixed submission:
N,A,B = map(int,input().split())
maxN,minN = 0,0

if N >= A + B:
  minN = 0
  maxN = min([A,B])
else:
  minN = A + B - N
  maxN = min([A,B])
  
print('{} {}'.format(maxN,minN))

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
maxN,minN = 0

if N >= A + B:
  minN = 0
  maxN = min([A,B])
else:
  minN = A + B - N
  maxN = min([A,B])
  
print('{} {}'.format(maxN,minN))
Problem p03493 (python)

Fixed submission:
s = input()

ans = 0

for i in s:
  ans += int(i)

print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0
ans += [int(i) for i in s]
print(ans)

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

ans += [int(i) for i in s]
print(ans)
Problem p02684 (python)

Fixed submission:
# 4 5 (4 cities and 5 steps)
# 3 2 4 1

# 1 => 3
# 2 => 2
# 3 => 4
# 4 => 1

# 1 (0)
# 1 => 3 (1)
# 3 => 4 (2)
# 4 => 1 (3)

# 2 を作る 5 と2 と 1 を使う
# 2  = (5 - 3) % 2 + 3 - 1

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

paths = {}

for i in range(N):
    paths[i+1] = A_i[i]

# print('paths:', paths)

# 6 5 2 5 3 2

# 1 => 6 (1)
# 6 => 2 (2)
# 2 => 5 (3)
# 5 => 3 (4)
# 3 => 2 (5)

# loop_steps = 5 - 2 - 1 = 2
# 5 + 2 * m + r = 727202214173249351
# steps + loop_steps * m + r = K
# r = (K - steps) % loop_steps

state = 1
steps = 0
flag = False
known_states = {}

while steps < K:
    known_states[state] = steps # state => 2, steps => 2

    state = paths[state] # state => 5
    steps += 1 # steps => 3

    # print(f'steps: {steps}, state: {state}')

    if state in known_states and not flag: # state => 2 steps => 5
        loop_steps = steps - known_states[state]
        K = (steps - loop_steps) + (K - (steps - loop_steps))  % loop_steps
        # print('loop_steps:', loop_steps)
        # print('steps - loop_steps:', steps - loop_steps)
        # print('K:', K)
        state = 1
        steps = 0
        # print('steps:', steps)
        flag = True
        # print('loop detected')



print(state)

Buggy submission (verdict: Runtime Error):
# 4 5 (4 cities and 5 steps)
# 3 2 4 1

# 1 => 3
# 2 => 2
# 3 => 4
# 4 => 1

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

paths = {}

for i in range(N):
    paths[i+1] = A_i[i]

# print('paths:', paths)

# 6 5 2 5 3 2

# 1 => 6 (1)
# 6 => 2 (2)
# 2 => 5 (3)
# 5 => 3 (4)
# 3 => 2 (5)

# loop_steps = 5 - 2 - 1 = 2
# 5 + 2 * m + r = 727202214173249351
# steps + loop_steps * m + r = K
# r = (K - steps) % loop_steps

state = 1
steps = 0
flag = False
known_states = {}

while steps < K:
    known_states[state] = steps # state => 2, steps => 2

    state = paths[state] # state => 5
    steps += 1 # steps => 3

    # print(f'steps: {steps}, state: {state}')

    if state in known_states and not flag: # state => 2 steps => 5
        loop_steps = steps - known_states[state] - 1
        steps = K - ((K - steps) % loop_steps)
        print('steps:', steps)
        flag = True
        # print('loop detected')


print(state)

Buggy submission (verdict: Runtime Error):
# 4 5 (4 cities and 5 steps)
# 3 2 4 1

# 1 => 3
# 2 => 2
# 3 => 4
# 4 => 1

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

paths = {}

for i in range(N):
    paths[i+1] = A_i[i]

# print('paths:', paths)

# 6 5 2 5 3 2

# 1 => 6 (1)
# 6 => 2 (2)
# 2 => 5 (3)
# 5 => 3 (4)
# 3 => 2 (5)

state = 1
steps = 0
flag = False
known_states = {}

while steps < K:
    known_states[state] = steps # state => 2, steps => 2

    state = paths[state] # state => 5
    steps += 1 # steps => 3

    # print(f'steps: {steps}, state: {state}')

    if state in known_states and not flag: # state => 2 steps => 5
        loop_steps = (steps - known_states[state] - 1)
        steps = K - ((K - steps) % loop_steps)
        flag = True
        # print('loop detected')


print(state)
Problem p02696 (python)

Fixed submission:
# floor(Ax/B) - A floor(x/B) の最大値Mを求める
# xはN以下の非負整数
# floor(Ax / B) = M + A floor(x / B)
# x / B = k + r
# Ax / B = Ak + Ar

# floor(Ak + Ar) = M + A floor(k + r)
# Ak + floor(Ar) = M + Ak + A floor(r)
# floor(Ar) = M

# r = x / B - k
# M = floor(A * (x / B - k))
#   = floor(A * x /B) - Ak
#   = floor(A/B * x) - Ak
#   = floor(A/B * x) - A * (x // B) 

# A B N
# 5 7 4

# M = floor(5/7 * x) - 5 * (x // 7)


# A B N 
# 11 10 9
# M = floor(11 / 10 * x) - 11 * (x // 10)

import math

def calcM(A, B, x):
        return math.floor(A / B * x) - A * math.floor(x / B)    

def resolve_v1(A, B, N):
    maxM = 0
    for x in range(N+1): # O(N)
        M = calcM(A, B, x)
        maxM = max(maxM, M)

    return maxM

def resolve_v2(A, B, N):
    # x == kB - 1
    maxM = calcM(A, B, N)

    for x in filter(lambda x: (x + 1) % B == 0, range(N+1)): # O(N/B)
        maxM = max(maxM, calcM(A, B, x))
    return maxM


def resolve_v3(A, B, N):
    maxM = calcM(A, B, N)

    k, r = divmod(N, B)
    if k and B * k -1 <= N:
        # k * B - 1で調査
        maxM = max(maxM, calcM(A, B, k * B - 1))
    # if r == 0:
    #     maxM = max(maxM, calcM(A, B, N - 1))

    maxM = calcM(A, B, min(N, B - 1))


    return maxM

if __name__ == '__main__':
    A, B, N = map(int, input().split())
    M = resolve_v3(A, B, N)
    print(M)

Buggy submission (verdict: Runtime Error):
# floor(Ax/B) - A floor(x/B) の最大値Mを求める
# xはN以下の非負整数
# floor(Ax / B) = M + A floor(x / B)
# x / B = k + r
# Ax / B = Ak + Ar

# floor(Ak + Ar) = M + A floor(k + r)
# Ak + floor(Ar) = M + Ak + A floor(r)
# floor(Ar) = M

# r = x / B - k
# M = floor(A * (x / B - k))
#   = floor(A * x /B) - Ak
#   = floor(A/B * x) - Ak
#   = floor(A/B * x) - A * (x // B) 

# A B N
# 5 7 4

# M = floor(5/7 * x) - 5 * (x // 7)


# A B N 
# 11 10 9
# M = floor(11 / 10 * x) - 11 * (x // 10)

import math

def calcM(A, B, x):
        return math.floor(A / B * x) - A * math.floor(x / B)    

def resolve_v1(A, B, N):
    maxM = 0
    for x in range(N+1): # O(N)
        M = calcM(A, B, x)
        maxM = max(maxM, M)

    return maxM

def resolve_v2(A, B, N):
    # x == kB - 1
    maxM = calcM(A, B, N)

    for x in filter(lambda x: (x + 1) % B == 0, range(N+1)): # O(N/B)
        maxM = max(maxM, calcM(A, B, x))
    return maxM


def resolve_v3(A, B, N):
    maxM = calcM(A, B, N)
    if B < N:
        max_x = max(list(filter(lambda x: (x + 1) % B == 0, range(N-B, N+1))), default=N)
    # print('max_x:', max_x)
    return max(maxM, calcM(A, B, max_x))

if __name__ == '__main__':
    A, B, N = map(int, input().split())
    M = resolve_v3(A, B, N)
    print(M)
Problem p03693 (python)

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

Buggy submission (verdict: Runtime Error):
r = input()
g = input()
b = input()

c = int(r+g+b)
if c % int(4) == 0:
    print("YES")
else:
    print("NO")
Problem p03149 (python)

Fixed submission:
i = set(map(str, input().split()))
if ( '1' in i and '9' in i and '7' in i and '4' in i ):
    print ('YES')
else:
    print ('NO')

Buggy submission (verdict: Runtime Error):
  i = set(map(str, input().split()))
  if ( '1' in i and '9' in i and '7' in i and '4' in i ):
      print ('YES')
  else:
      print ('NO')
Problem p02677 (python)

Fixed submission:
import math
A, B, H, M = map(int, input().split())
Longdegree = H * 30 + M * 0.5
Shortdegree =  M * 6
LSdegree = abs(Longdegree - Shortdegree)
print(math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(math.radians(LSdegree))))

Buggy submission (verdict: Runtime Error):
import math
A, B, H, M = map(int, input().split())
Longdegree = H * 30 + M * 0.5
Shortdegree =  M * 6
LSdegree = abs((Longdegree ** 2 - Shortdegree ** 2) / (Longdegree + Shortdegree))
if LSdegree >= 0 and  LSdegree < 180:
    print(math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(math.radians(LSdegree))))
elif  LSdegree >= 180 and  LSdegree <=360:
    LSdegree = LSdegree - 180
    print(math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(math.radians(LSdegree))))