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

Fixed submission:
#import generator


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

"""
with open('generator.txt', 'r') as f:
    read = f.read().split('\n')
    N = int(read[0])
    A = list(map(int, read[1].split()))
    B = list(map(int, read[2].split()))
    C = list(map(int, read[3].split()))
"""
A.sort()
C.sort()


def binary_search(lst, value, high):
    l = 0
    r = N - 1
    while l <= r:
        mid = (l + r) // 2
        if lst[mid] < value:
            l = mid + 1
        elif lst[mid] > value:
            r = mid - 1
        else:
            # lstの中にある場合
            if high:
                # 真に大きい
                return binary_search(lst, value + 0.5, high)
            else:
                # 真に小さい
                return binary_search(lst, value - 0.5, high)
    if high:
        return l
    else:
        return r


def main():
    ans = 0
    # Bの値でループしてそれより小さいA、大きいCの個数を求めて掛け合わせる
    for middle in B:
        lower = binary_search(A, middle, False) + 1 # 0-indexedで返るので+1する
        higher = N - binary_search(C, middle, True)
        ans += lower * higher
    print(ans)

    
# 愚直解
def main2():
    ans = 0
    for a in A:
        for b in B:
            for c in C:
                if a < b < c:
                    ans += 1
    print(ans)
    

if __name__ == "__main__":
    main()
    #main2()

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()))

A.sort()
C.sort()


def binary_search(lst, value, high):
  	if high:
      	value += 0.5
    else:
      	value -= 0.5
    l = 0
    r = N - 1
    while l <= r:
        mid = (l + r) // 2
        if lst[mid] < value:
            l = mid + 1
        elif lst[mid] > value:
            r = mid - 1
    if high:
        return l
    else:
        return r


def main():
    ans = 0
    for middle in B:
        lower = binary_search(A, middle, False) + 1
        higher = N - binary_search(C, middle, True)
        ans += lower * higher
    print(ans)


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

Fixed submission:
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

if v == w:
    print("NO")
else:
    if w > v:
        print("NO")
    else:
        if abs(b-a) / (v-w) <= t:    
            print("YES")
        else:
            print("NO")

Buggy submission (verdict: Runtime Error):
if v <= w:
    print("NO")
elif (b-a)%(v-w) == 0 and (b-a)//(v-w)+1 > t:
    print("NO")
elif -(-(b-a)//(v-w)) > t:
    print("NO") 
else:
    print("YES")
Problem p02705 (python)

Fixed submission:
n = int(input())
print(2*n*3.14159264)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(2*n*math.pi)
Problem p03000 (python)

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

ans = [0]
for i in range(n):
    ans.append(ans[i]+l[i])
count = 0
for i in ans:
    if i <= x:
        count += 1
print(count)

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

ans = 0
d = 0
while 1:
    if d > x:
        break
    d += l[ans]
    ans += 1
print(ans)
Problem p03006 (python)

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

check = []
for i in range(n-1):
    for j in range(i+1,n):
        check.append([xy[i][0]-xy[j][0],xy[i][1]-xy[j][1]])
#print(check)
ans = 10**9
for i in check:
    b = []
    for j in range(n):
        b.append([xy[j][0]-i[0],xy[j][1]-i[1]])
    c = n
    for j in range(n):
        if b[j] in xy:
            c -= 1
    if c < ans:
        ans = c
if n == 1:
    print(1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]

check = []
for i in range(n-1):
    for j in range(i+1,n):
        check.append([xy[i][0]-xy[j][0],xy[i][1]-xy[j][1]])

ans = 10**9
for i in check:
    b = []
    for j in range(n):
        b.append([xy[j][0]-i[0],xy[j][1]-i[1]])
    c = n
    for j in range(n):
        if b[j] in xy:
            c -= 1
    if c < ans:
        ans = c
print(c)
Problem p03048 (python)

Fixed submission:
R,G,B,N = map(int,input().split())
ans = 0
for r in range(int(N/R)+1):
    for g in range(int((N-r*R)/G)+1):
        if N-(r*R+g*G) >= 0 and (N-(r*R+g*G))%B == 0:
        #    print(r,g,(N-(r*R+g*G))%B)
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]

ans = 0
A = 0
B = 0
BA = 0
for i in s:
    ans += i.count("AB")
    if i[0:1] != "B" and i[-1:] == "A":
        A += 1
    elif i[0:1] == "B" and i[-1:] != "A":
        B += 1
    elif i[0:1] == "B" and i[-1:] == "A":
        BA += 1

#print(ans)
#print(A,B,BA)

while 1:
    if BA == 0 or A == B:
        break
    if A >= B:
        B += 1
    else:
        A += 1
    BA -= 1
#print(A,B,BA)
if A == 0 and B == 0:
    BA -= 1
print(ans + min(A,B) + BA)
Problem p03050 (python)

Fixed submission:
import math
n = int(input())

def yakusu(n):
    l = []
    for i in range(1,int(math.sqrt(n))+1):
 #       print(i)
        if n%i == 0:
            l.append(i)
            l.append(n//i)
    return(l)

l = yakusu(n)

ans = 0
for m in l:
    if m-1 > 0 and n == int(n/(m-1))*m:
        ans += m-1
    
#print(l)
print(ans)

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

def yakusu(n):
    l = []
    for i in range(1,int(math.sqrt(n))+1):
 #       print(i)
        if n%i == 0:
            l.append(i)
            l.append(n//i)
    return(l)

l = yakusu(n)

ans = 0
for m in l[1:]:
    if n == int(n/(m-1))*m:
        ans += m-1
    
#print(l)
print(ans)
Problem p03086 (python)

Fixed submission:
s = input()
ans = [0]
for i in range(len(s)):
    if s[i] == "A":
        ans[-1] += 1
    elif s[i] == "C":
        ans[-1] += 1
    elif s[i] == "G":
        ans[-1] += 1
    elif s[i] == "T":
        ans[-1] += 1
    else:
        ans.append(0)
print(max(ans))

Buggy submission (verdict: Runtime Error):
s = input()
ans = []
a = 0
for i in range(len(s)):
    if s[i] == "A":
        a += 1
    elif s[i] == "C":
        a += 1
    elif s[i] == "G":
        a += 1
    elif s[i] == "T":
        a += 1
    else:
        ans.append(a)
        a = 0
print(max(ans))
Problem p02585 (python)

Fixed submission:
import copy

def cost_val(visit_list, P, C):
    maxval = [-10**10] * (len(P) + 1)
    for start_idx in visit_list:
        cost = 0
        now_id = start_idx
        for i in range(len(visit_list)):
            now_id = P[now_id]
            cost += C[now_id]
            maxval[i + 1] = max(maxval[i + 1], cost)
    return maxval[1:len(visit_list) + 1]

def cycles(P):
    cycle_list = []
    visit_list = [False] * len(P)
    for i in range(len(P)):
        if visit_list[i]:
            continue
        now_id = i
        cycle = []
        for j in range(len(P)):
            if visit_list[now_id]:
                break
            cycle.append(now_id)
            visit_list[now_id] = True
            now_id = P[now_id]
        cycle_list.append(cycle)
    return cycle_list

def main():
    N, K = map(int, input().split())
    P = list(map(lambda x: int(x) - 1, input().split()))
    C = list(map(int, input().split()))
    cycle_list = cycles(P)
    ans = max(C)
    for cycle in cycle_list:
        maxval = cost_val(cycle, P, C)
        if len(cycle) > K:
            ans = max(ans, max(maxval[:K]))
        else:
            if K % len(cycle) == 0:
                ans = max(ans, max(maxval), max(map(lambda x: x + maxval[-1] * (K // len(cycle) - 1), maxval)), maxval[-1] * (K // len(cycle)))
            else:
                ans = max(ans, max(maxval), max(map(lambda x: x + maxval[-1] * (K // len(cycle) - 1), maxval)), maxval[-1] * (K // len(cycle)) + max(maxval[:(K % len(cycle))]))
    return ans

if __name__ == '__main__':
    print(main())

Buggy submission (verdict: Runtime Error):
import copy

def cost_val(visit_list, P, C):
    maxval = [-10**10] * (len(P) + 1)
    for start_idx in visit_list:
        cost = 0
        now_id = start_idx
        for i in range(len(visit_list)):
            now_id = P[now_id]
            cost += C[now_id]
            maxval[i + 1] = max(maxval[i + 1], cost)
    return maxval[1:len(visit_list) + 1]

def cycles(P):
    cycle_list = []
    visit_list = [False] * len(P)
    for i in range(len(P)):
        if visit_list[i]:
            continue
        now_id = i
        cycle = []
        for j in range(len(P)):
            if visit_list[now_id]:
                break
            cycle.append(now_id)
            visit_list[now_id] = True
            now_id = P[now_id]
        cycle_list.append(cycle)
    return cycle_list

def main():
    N, K = map(int, input().split())
    P = list(map(lambda x: int(x) - 1, input().split()))
    C = list(map(int, input().split()))
    cycle_list = cycles(P)
    ans = -10**9
    for cycle in cycle_list:
        maxval = cost_val(cycle, P, C)
        if N >= K:
            ans = max(ans, max(maxval[:K]))
        else:
            ans = max(ans, max(maxval), maxval[-1] * (K // len(cycle)) + max(maxval[:(K % len(cycle))]))
    return ans

if __name__ == '__main__':
    print(main())
Problem p02642 (python)

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

if N == 1:
    print(1)
    exit()
    
check_list = [0] * (10**6 + 1)

cnt = 0
for i in range(len(A)):
    tmp = A[i]
    while True:
        if tmp > A[-1]:
            break
        check_list[tmp] += 1
        tmp += A[i]

for a in A:
    if check_list[a] == 1:
        cnt += 1
print(cnt)

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

if N == 1:
    print(1)
    exit()
    
A = sorted(A)
check_list = [0] * (10**6 + 1)

cnt = 0
for i in range(len(A)):
    tmp = A[i]
    while True:
        check_list[tmp] += 1
        if tmp > 10**6:
            break
        tmp += A[i]

for a in A:
    if check_list[a] == 1:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return sorted(divisors, reverse=True)


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

if N == 1:
    print(1)
    
A = sorted(A)
check_list = [0] * (10**6 + 1)

for a in A:
    check_list[a] = 1

cnt = 0
prev_val = -1
next_val = A[1]
for i in range(len(A)):
    if len(A) - 1 == i:
        if prev_val == A[i]:
            continue        
        prev_val = A[i]
    else:
        if next_val == A[i]:
            continue
        next_val = A[i + 1]
    divisors = make_divisors(A[i])[1:-1]
    check_ok = True
    for d in divisors:
       if check_list[d] == 1:
           check_ok = False
    if check_ok == True:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return sorted(divisors, reverse=True)


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

if N == 1:
    print(1)
    
A = sorted(A)
check_list = [0] * (10**6 + 1)

for a in A:
    check_list[a] = 1

cnt = 0
prev_val = -1
next_val = A[1]
for i in range(len(A)):
    if prev_val == A[i]:
        continue        
    prev_val = A[i]
    if len(A) - 1 != i:
        next_val = A[i + 1]
        if next_val == A[i]:
            continue
    divisors = make_divisors(A[i])[1:-1]
    check_ok = True
    for d in divisors:
       if check_list[d] == 1:
           check_ok = False
    if check_ok == True:
        cnt += 1
print(cnt)
Problem p02658 (python)

Fixed submission:
N = input()
A = list(map(int, input().split()))
 
if 0 in A:
    print(0)
    exit()
 
A = sorted(A)[::-1]
val = 1
 
for a in A:
    val *= a
    if val > 10 ** 18:
        print(-1)
        exit()
print(val)

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

if A in 0:
    print(0)
    exit()

prod = 1
for i in range(len(A)):
    prod *= A[i]
    if prod > 10 ** 18:
        print(-1)
        exit()

print(prod)
Problem p02706 (python)

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split(" ")))
val = N-sum(A)
if val < 0:
    print(-1)
else :
    print(N-sum(A))

Buggy submission (verdict: Runtime Error):
import numpy as np
 
if __name__ == "__main__":
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    ret = -1
    A_sum = sum(A)
    if not (A_sum < 0):
        ret = N - A_sum
    print(int(ret))
Problem p02713 (python)

Fixed submission:
import math
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        f = math.gcd(a,b)
        for c in range(1, K+1):
            g = math.gcd(f,c)
            sumval += g
print(sumval)

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools
 
if __name__ == "__main__":
    K = int(input())+1
    ret = 0
    for a, b, c in itertools.product(range(1,K), range(1,K), range(1,K)):
        ret += np.gcd.reduce(list({a,b,c}))
    print(ret)

Buggy submission (verdict: Runtime Error):
from math import gcd
K = int(input())
sumval = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            g = math.gcd(math.gcd(a,b),c)
            sumval += g
print(sumval)
Problem p02714 (python)

Fixed submission:
N = int(input())
S = input()
R_sum = [0]*N
G_sum = [0]*N
B_sum = [0]*N
rcnt = 0
gcnt = 0
bcnt = 0
cnt = 0
for c in S:
    if c == 'R':
        rcnt += 1
    elif c == 'G':
        gcnt += 1
    elif c == 'B':
        bcnt += 1
    R_sum[cnt] = rcnt
    G_sum[cnt] = gcnt
    B_sum[cnt] = bcnt
    cnt += 1

anssum = 0
for i in range(N):
    for j in range(i + 1, N):
        if S[i] == S[j]: continue
        clist = [S[i], S[j]]
        diff_idx = j - i

        if not ('R' in clist):
            anssum += (R_sum[N-1] - R_sum[j-1])
            if diff_idx + j < N:
                if S[diff_idx + j] == 'R':
                    anssum -= 1
        elif not ('G' in clist):
            anssum += (G_sum[N-1] - G_sum[j-1])
            if diff_idx + j < N:
                if S[diff_idx + j] == 'G':
                    anssum -= 1
        elif not ('B' in clist):
            anssum += (B_sum[N-1] - B_sum[j-1])
            if diff_idx + j < N:
                if S[diff_idx + j] == 'B':
                    anssum -= 1
print(anssum)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
S = input()
R_sum = np.zeros(N, dtype=np.int16)
G_sum = np.zeros(N, dtype=np.int16)
B_sum = np.zeros(N, dtype=np.int16)
rcnt = 0
gcnt = 0
bcnt = 0
cnt = 0
for c in S:
    if c == 'R':
        rcnt += 1
    elif c == 'G':
        gcnt += 1
    elif c == 'B':
        bcnt += 1
    R_sum[cnt] = rcnt
    G_sum[cnt] = gcnt
    B_sum[cnt] = bcnt
    cnt += 1

anssum = 0
for i in range(N):
    for j in range(i + 1, N):
        if S[i] == S[j]: continue
        clist = [S[i], S[j]]
        diff_idx = j - i

        if not ('R' in clist):
            anssum += (R_sum[N-1] - R_sum[j-1])
            if diff_idx + j < N:
                if S[diff_idx + j] == 'R':
                    anssum -= 1
        elif not ('G' in clist):
            anssum += (G_sum[N-1] - G_sum[j-1])
            if diff_idx + j < N:
                if S[diff_idx + j] == 'G':
                    anssum -= 1
        elif not ('B' in clist):
            anssum += (B_sum[N-1] - B_sum[j-1])
            if diff_idx + j < N:
                if S[diff_idx + j] == 'B':
                    anssum -= 1
print(anssum)
Problem p02727 (python)

Fixed submission:
import numpy as np
X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))
q = sorted(list(map(int, input().split())))
r = np.array(sorted(list(map(int, input().split())), reverse=True))

p_cut = np.array(p[A-X:])
q_cut = np.array(q[B-Y:])
pi = 0
qi = 0
for i in range(len(r)):
    if pi >= X and qi >= Y:
        break
    if pi >= X:
        if q_cut[qi] >= r[i]:
            break
        q_cut[qi] = r[i]
        qi += 1
    elif qi >= Y:
        if p_cut[pi] >= r[i]:
            break
        p_cut[pi] = r[i]
        pi += 1
    elif p_cut[pi] >= q_cut[qi] :
        if q_cut[qi] >= r[i]:
            break
        q_cut[qi] = r[i]
        qi += 1
    else:
        if p_cut[pi] >= r[i]:
            break
        p_cut[pi] = r[i]
        pi += 1
print(np.sum(p_cut) + np.sum(q_cut))

Buggy submission (verdict: Runtime Error):
import numpy as np
X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))
q = sorted(list(map(int, input().split())))
r = np.array(sorted(list(map(int, input().split())), reverse=True))

p_cut = np.array(p[A-X:])
q_cut = np.array(q[B-Y:])
pi = 0
qi = 0
for i in range(len(r)):
    if p_cut[pi] >= q_cut[qi] :
        if q_cut[qi] >= r[i]:
            break
        q_cut[qi] = r[i]
        qi += 1
    else:
        if p_cut[pi] >= r[i]:
            break
        p_cut[pi] = r[i]
        pi += 1
print(np.sum(p_cut) + np.sum(q_cut))
Problem p02924 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
  n = int(N / 2)
  print(n * (N - 1))
else:
  n = int((N-1)/2)
  print(N*n)

Buggy submission (verdict: Runtime Error):
N = int(input())
print(sum(list(range(N))))
Problem p03136 (python)

Fixed submission:
N = int(input())
L = sorted(list(map(int,input().split())))[::-1]
if L[0] >= sum(L[1:]) :
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
L = sorted(list(map(int,input())))[::-1]
if L[0] >= sum(L[1:]) :
  print("No")
else:
  print("Yes")
Problem p03386 (python)

Fixed submission:
A, B, K = list(map(int, input().split()))
left = set(list(range(A, min(B, A + K))))
right = set(list(range(max(B - K + 1, A) , B + 1)))
[print(i) for i in sorted(list((left | right)))]

Buggy submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))
left = set(list(range(A, A+k)))
right = set(list(range(b-k+1, b+1)))
[print(i) for i in sorted(list((left | right)))]

Buggy submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))
l = list(range(A, B + 1))
left = set(l[0:K])
right = set(l[B-K-A+1:])
[print(i) for i in sorted(list((left | right)))]

Buggy submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))
l = list(range(A, B + 1))
left = set(l[0:K])
right = set(l[B-K-A+1:])
[print(i) for i in sorted(list((left | right)))]
Problem p02641 (python)

Fixed submission:
x,n = map(int,input().split())
if n == 0:
    print(x)
else:
    p = list(map(int,input().split()))
    absolute = list(map(lambda i:abs(i-x),p))
    if 0 not in absolute:
        print(x)
    else:
        ab = set(p)
        i = 1
        while i < 100:
            if absolute.count(i) == 2:
                i += 1
            else:
                opt = set([x-i,x+i])
                ans = opt - ab
                break

        print(min(ans))

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
if n == 0:
    print(x)
else:
    p = list(map(int,input().split()))
    absolute = list(map(lambda i:abs(i-x),p))
    if 0 not in absolute:
        print(x)
    else:
        ab = set(absolute)
        i = 1
        while i < 100:
            if absolute.count(i) == 2:
                i += 1
            else:
                opt = set([x-i,x+i])
                ans = opt - ab
                break

        print(min(ans))

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
if n == 0 or 0 not in absolute:
    print(x)
else:
    p = list(map(int,input().split()))
    absolute = list(map(lambda i:abs(i-x),p))
    ab = set(absolute)
    i = 1
    while i < 100:
        if absolute.count(i) == 2:
            i += 1
        else:
            opt = set([x-i,x+i])
            ans = opt - ab
            break

    print(min(ans))

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
p = list(map(int,input().split()))
absolute = list(map(lambda i:abs(i-x),p))
ab = set(absolute)

if n == 0 or 0 not in absolute:
    print(x)
else:
    i = 1
    while i < 100:
        if absolute.count(i) == 2:
            i += 1
        else:
            opt = set([x-i,x+i])
            ans = opt - ab
            break

print(min(ans))
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())
print(a*b)
Problem p02917 (python)

Fixed submission:

n =int(input())
b = list(map(int,input().split()))
a = []
a.append(b[0])
sum = 0


for i in range(n-1):
    if(i>0):
        if(b[i]>=b[i-1]):
            a.append(b[i-1])
        else:
            a.append(b[i])

if(a[-1]>=b[-1]):
    a.append(a[-1])
else:
    a.append(b[-1])

for j in range(n):
    sum += a[j]

print(sum)

Buggy submission (verdict: Runtime Error):

n =int(input())
b = list(map(int,input().split()))
a = []
a.append(b[0])
sum = 0


for i in range(n-1):
    if(i>0):
        if(b[i]>=b[i-1]):
            a.append(b[i-1])
        else:
            a.append(b[i])

if(b[-2]>=b[-1]):
    a.append(b[-2])
else:
    a.append(b[-1])

for j in range(n):
    sum += a[j]

print(sum)

Buggy submission (verdict: Runtime Error):
n =int(input())
b = list(map(int,input().split()))
a = []
a.append(b[0])
sum = 0


for i in range(n-1):
    if(i>0):
        if(b[i]>b[i-1]):
            a.append(b[i-1])
        else:
            a.append(b[i])

if(b[-2]>=b[-1]):
    a.append(b[-2])
else:
    a.append(b[-1])

for j in range(n):
    sum += a[j]

print(sum)
Problem p02922 (python)

Fixed submission:
a,b = map(int,input().split())
m = 1
cnt = 0
while m < b:
    m -= 1
    m += a
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
tap,out = map(int,input().split()
print(int((out-1)/(tap-1)))

Buggy submission (verdict: Runtime Error):
tap,out = map(int,input().split()
print((out-1)/(tap-1))

Buggy submission (verdict: Runtime Error):
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f

tap,out = map(int,input().split())

count = 1

while(1):
    if(out>tap):
        out = out - (tap-1)
        count += 1
    else:
        break
print(count)
Problem p03352 (python)

Fixed submission:
x = int(input())
ans = 1
for b in range(1,x):
    for p in range(2,x):
        a = b**p
        if a == a // 1 and a > ans and a <= x:
            ans = a
        if a>x:
            break
    if a > x:
        continue
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
ans = 1
for b in range(1,x+1):
    for p in range(2,x+1):
        a = b**p
        if a == a // 1 and a > ans and a <= x:
            ans = a
        if a>x:
            break
    if a > x:
        continue
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
ans = 1
for b in range(1,x+1):
    for p in range(2,x+1):
        a = pow(b,p)
        if a > ans and a <= x:
            ans = a
        if a>x:
            break
    if a > x:
        continue
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
ans = set()
for b in range(1,x):
    for p in range(2,x):
        if pow(b,p) > x:
            break
        else:
            ans.add(pow(b,p))
    if max(ans) > x:
        break
print(max(ans))

Buggy submission (verdict: Runtime Error):
x = int(input())
ans = set()
for b in range(1,x+1):
    for p in range(2,x+1):
        if pow(b,p) >= x:
            break
        else:
            ans.add(pow(b,p))
    if max(ans) >= x:
        break
print(max(ans))