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

Fixed submission:
# -*- coding:utf-8 -*-
"""解説
B以下の整数のうち、CでもDでも割り切れないものの個数をCountBとする
A以下の整数のうち、CでもDでも割り切れないものの個数をCountAとする

求める答えは、CountB - CountA

・CountBの求め方
B以下の整数のうち、Cで割り切れるものの個数はCountB_C = B//C
B以下の整数のうち、Dで割り切れるものの個数はCountB_D = B//D
B以下の整数のうち、CでもDでも割り切れるものの個数はCountB_CD = B//lcm(C,D)

CountB = B - (CountB_C + CountB_D - CountB_CD)

"""
from fractions import gcd

def solve():
    A, B, C, D = list(map(int, input().split()))
    def lcm(a, b):
        """ aとbの最小公倍数を返す """
        return a*b // gcd(a, b)

    def f(x):
        """ 1以上x以下の整数のうち、CでもDでも割り切れないものの個数を返す """
        return x - (x//C + x//D - x//lcm(C,D))    

    ans = f(B) - f(A-1)

    print(ans)


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
import sys
from math import gcd

def f(a, x):
    """1以上a以下で、xで割り切れるものの数"""
    return a // x

def lcm(a, b):
    """ aとbの最小公倍数を返す """
    return a*b // gcd(a, b)

def solve():
    A, B, C, D = list(map(int, sys.stdin.readline().split()))
    A -= 1

    # CでもDでも割り切れないもの
    b = B - f(B, C) - f(B, D) + f(B, lcm(C, D))
    a = A - f(A, C) - f(A, D) + f(A, lcm(C, D))
    print(b-a)


if __name__ == "__main__":
    solve()
Problem p03001 (python)

Fixed submission:
# -*- coding:utf-8 -*-
"""考え方
(x, y)と長方形の中心を両方通るような直線で分割すると、大きくない方の面積は全体の半分の面積。

・与えられた(x, y)が長方形の中心の場合、区切り方は無限にある。
・与えられた(x, y)が長方形の中心でない場合、一通りに求まる。
"""
def solve():
    W, H, x, y = list(map(int, input().split()))

    ans_area = W*H/2

    if x == W/2 and y == H/2:
        is_multi = 1
    else:
        is_multi = 0
    
    print(ans_area, is_multi)

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
"""考え方
よくわからんけど、縦か横の直線で分割する？
あと原点から(x,y)座標へ向けて斜めに分割する奴も考える

"""
def solve():
    W, H, x, y = list(map(int, input().split()))

    # 縦に分割する場合
    ans1 = min(x*H, (W-x)*H)

    # 横に分割する場合
    ans2 = min(W*y, W*(H-y))

    # 斜めに分割する場合
    d = y/x
    if d <= 1:
        # 傾きが1以下の場合
        ans3 = W * (W*d) / 2
    else:
        # 傾きが1より大きい
        d = x/y
        ans3 = H * (H*d) / 2

    ans = max(ans1, ans2, ans3)

    if ((ans==ans1 and ans1==ans2) or 
       (ans==ans2 and ans2==ans3) or 
       (ans==ans3 and ans3==ans1)):
        is_multi = 1
    else:
        is_multi = 0

    print(ans, is_multi)


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
"""考え方
よくわからんけど、縦か横の直線で分割する？
あと原点から(x,y)座標へ向けて斜めに分割する奴も考える

"""
def solve():
    W, H, x, y = list(map(int, input().split()))

    # 縦に分割する場合
    ans1 = min(x*H, (W-x)*H)

    # 横に分割する場合
    ans2 = min(W*y, W*(H-y))

    # 斜めに分割する場合
    d = y/x
    if d <= 1:
        # 傾きが1以下の場合
        ans3 = W * (W*d) / 2
    else:
        # 傾きが1より大きい
        d = x/y
        ans3 = H * (H*d) / 2

    ans = max(ans1, ans2, ans3)

    if ((ans==ans1 and ans1==ans2) or 
       ((ans==ans2 and ans2==ans3) or 
       ((ans==ans3 and ans3==ans1)):
        is_multi = 1
    else:
        is_multi = 0

    print(ans, is_multi)


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
"""考え方
よくわからんけど、縦か横の直線で分割する？
あと原点から(x,y)座標へ向けて斜めに分割する奴も考える

"""
def solve():
    W, H, x, y = list(map(int, input().split()))

    # 縦に分割する場合
    ans1 = min(x*H, (W-x)*H)

    # 横に分割する場合
    ans2 = min(W*y, W*(H-y))

    # 斜めに分割する場合
    d = y/x
    if d <= 1:
        # 傾きが1以下の場合
        ans3 = W * (W*d) / 2
    else:
        # 傾きが1より大きい
        d = x/y
        ans3 = H * (H*d) / 2

    ans = max(ans1, ans2, ans3)

    if ans1==ans2 or ans2==ans3 or ans3==ans1:
        is_multi = 1
    else:
        is_multi = 0

    print(ans, is_multi)


if __name__ == "__main__":
    solve()
Problem p03032 (python)

Fixed submission:
# -*- coding:utf-8 -*-
from collections import deque
"""解説
全探索

左からL個、右からR個宝石を取り、K-(L+R)個の宝石を筒に詰めるとき方針として、

・筒に詰める宝石は絶対値の大きい負の値のもの

あとは全探索
"""

def solve():
    N, K = list(map(int, input().split()))
    V = list(map(int, input().split()))

    ans = 0
    r = min(N, K)
    for a in range(r+1):  # 左から取る個数
        for b in range(r+1):  # 右から取る個数
            if r < a+b: continue

            t = V[:a] + V[::-1][:b]  # 左からa個、右からb個とった宝石を「持っているリストt」にぶちこむ
            t.sort(reverse=True)

            for _ in range(K-a-b):
                if len(t) > 0 and t[-1] < 0:
                    t.pop()
                    continue
                break
            ans = max(ans, sum(t))

    print(ans)



if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
import copy

def solve():
    N, K = list(map(int, input().split()))
    V = list(map(int, input().split()))
    
    ans = 0
    M = min(N,K)
    for l in range(M+1):
        having = []
        for r in range(M+1):
            if l+r > K: break
            if l+r == 0: continue
            # 左からl, 右からr個の宝石を取り出す
            having = V[:l] + V[::-1][:r]
            having.sort(reverse=True)

            restK = K - (l+r)

            for i in range(restK):
                if having[-1] < 0:
                    having.pop()
                    continue
                break

            ans = max(ans, sum(having))
    
    print(ans)

if __name__ == "__main__":
    solve()
Problem p03049 (python)

Fixed submission:
# -*- coding:utf-8 -*-

def solve():
    N = int(input())
    ans = 0
    endA = 0
    startB = 0
    ryouhou = 0
    # Aで終わるs1と、Bで始まるs2を連結させれば1個増える
    for i in range(N):
        s = input()
        if s[-1]=="A" and s[0]=="B":
            ryouhou += 1
        elif s[-1]=="A":
            endA += 1
        elif s[0]=="B":
            startB += 1
        
        ans += s.count("AB")
    

    if endA>=1 and startB>=1 and ryouhou>=1:
        ans += min(endA-1, startB-1)
        ans += ryouhou + 1
        print(ans)
        return
    elif ((endA>=1 and startB==0 and ryouhou>=1) or
          (endA==0 and startB>=1 and ryouhou>=1)):
        ans += ryouhou
        print(ans)
        return
    elif endA==0 and startB==0 and ryouhou>=1:
        ans += ryouhou-1
        print(ans)
        return
    else:
        # ryouhou==0のとき
        ans += min(endA, startB)
        rest = abs(max(endA, startB) - min(endA, startB))
        
        ans += min(rest, ryouhou)
        rest = ryouhou - rest
        if rest <= 0:
            print(ans)
            return
        else:
            ans += rest//2
            print(ans)
            return

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
"""
.....A
B.....
を連結させればABは一個増える
"""
def solve():
    N = int(input())

    ans = 0
    b_start = 0
    a_end = 0
    ryouhou = 0
    for i in range(N):
        s = input()
        ans += s.count("AB")
        
        if s[0] == "B" and S[-1] == "A":
            ryouhou += 1
        elif s[0] == "B":
            b_start += 1
        elif s[-1] == "A":
            a_end += 1
    
    add_ab_num = min(b_start, a_end)
    ans += add_ab_num

    rest_katahou = (max(b_start, a_end) - add_ab_num)

    if ryouhou >= rest_katahou:
        ans += rest_katahou
        rest_ryouhou = (ryouhou - rest_katahou)
        ans += rest_ryouhou//2
    else:
        ans += ryouhou
    
    print(ans)
   
        

if __name__ == "__main__":
    solve()
Problem p03050 (python)

Fixed submission:
# -*- coding:utf-8 -*-

"""解説
http://drken1215.hatenablog.com/entry/2019/05/12/004500

N//m = N%m = k （kは約数。かつ余り）とすると、

N = mk + k ...(1)
N = k(m+1)

k は MOD m の余りなので、m > k である。
よって、

N = k*(m+1) > k*k

よって、

N > k**2
√N > k

これに気づけばOK。あとはkについて全探索。O(√N)


(例)
・N=8, m=3のとき
3*2 + 2 = 8
m*k + k = N

・N=8, m=7のとき
7*1 + 1 = 8
m*k + k = N

"""
import math

def solve():
    N = int(input())

    ans = 0
    for k in range(1, math.floor(math.sqrt(N))+1):
        if N%k != 0: continue # kはNの約数より
        # N = k(m+1)
        # m = (N/k) - 1
        m = (N/k) - 1
        if m <= 0: continue
        if N//m == N%m:
            ans += m
    print(int(ans))


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

"""解説
http://drken1215.hatenablog.com/entry/2019/05/12/004500

N//m = N%m = k （kは約数。かつ余り）とすると、

N = mk + k ...(1)
N = k(m+1)

k は MOD m の余りなので、m > k である。
よって、

N = k*(m+1) > k*k

よって、

N > k**2
√N > k

これに気づけばOK。あとはkについて全探索。O(√N)


(例)
・N=8, m=3のとき
3*2 + 2 = 8
m*k + k = N

・N=8, m=7のとき
7*1 + 1 = 8
m*k + k = N

"""
import math

def solve():
    N = int(input())

    ans = 0
    for k in range(1, math.floor(math.sqrt(N))+1):
        if N%k != 0: continue # kはNの約数より
        # N = k(m+1)
        # m = (N/k) - 1
        m = (N/k) - 1
        if N//m == N%m:
            ans += m
    print(int(ans))


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

Fixed submission:
# -*- coding:utf-8 -*-

def solve():
    A, B, C = list(map(int, input().split()))
    if A <= C and C <= B:
        print("Yes")
    elif A >= C and C >= B:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

def solve():
    N = int(input())
    S = input()

    kuro_num = 0
    siro_num = 0
    for moji in S:
        if moji == "#":
            kuro_num += 1
        else:
            siro_num += 1

    if siro_num == N:
        print(0)
        exit()

    # ..........############ のパターン
    rest_kuro_num = kuro_num
    rest_siro_num = siro_num
    ans = siro_num
    for i in range(0, len(S)):
        num = rest_siro_num
        if S[i] == "#":
            num += 1 + (kuro_num - rest_kuro_num)
            rest_kuro_num -= 1
        else:
            num += kuro_num - rest_kuro_num
            rest_siro_num -= 1
        ans = min(ans, num)

    print(ans)

if __name__ == "__main__":
    solve()
Problem p03076 (python)

Fixed submission:
# -*- coding:utf-8 -*-
import math

def solve():
    menus = []
    for i in range(0, 5):
        menus.append(int(input()))
    
    # １の位が最も小さいものを最後に注文する。あとはなんでもいい
    amari = 10
    last = 0
    for i in range(0, 5):
        if menus[i]%10 < amari and menus[i]%10 != 0:
            last = i
            amari = menus[i]%10
    
    ans = 0
    for i in range(0, 5):
        if i == last:
            continue

        ans += menus[i]
        ans = math.ceil(ans/10) * 10
    
    ans += menus[last]
    print(ans)



if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
import math

def solve():
    menus = []
    for i in range(0, 5):
        menus.append(int(input()))
    
    # １の位が最も小さいものを最後に注文する。あとはなんでもいい
    amari = 10
    for i in range(0, 5):
        if menus[i]%10 < amari and menus[i]%10 != 0:
            last = i
            amari = menus[i]%10
    
    ans = 0
    for i in range(0, 5):
        if i == last:
            continue

        ans += menus[i]
        ans = math.ceil(ans/10) * 10
    
    ans += menus[last]
    print(ans)



if __name__ == "__main__":
    solve()
Problem p03087 (python)

Fixed submission:
# -*- coding:utf-8 -*-

def solve():
    N, Q = list(map(int, input().split(" ")))
    S = input()
    L, R = [], []
    for i in range(Q):
        l, r = list(map(int, input().split(" ")))
        L.append(l)
        R.append(r)
    
    # 累積話で解く
    accumulations = [0] * N

    for i in range(1, N):
        if S[i-1]+S[i] == "AC":
            accumulations[i] = accumulations[i-1] + 1
        else:
            accumulations[i] = accumulations[i-1]

    for i in range(Q):
        if L[i]-1 == 0:
            print(accumulations[R[i]-1])
            continue
        else:
            print(accumulations[R[i]-1] - accumulations[L[i]-1])
            continue


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

def solve():
    N, Q = list(map(int, input().split()))
    S = input()

    dp = [0]*(N)
    dp[0] = 0
    for i in range(0, N-1):
        if S[i]=="A" and S[i+1]=="C":
            dp[i+1] = dp[i] + 1
        else:
            dp[i+1] = dp[i]
    
    for i in range(Q):
        l, r = list(map(int, input()))
        print(dp[r-1] - dp[l-1])
    
    

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

def solve():
    N, Q = list(map(int, input().split()))
    S = input()

    dp = [0]*(N)
    dp[0] = 0
    for i in range(0, N-1):
        if S[i]=="A" and S[i+1]=="C":
            dp[i+1] = dp[i] + 1
        else:
            dp[i+1] = dp[i]
    
    for i in range(Q):
        l, r = list(map(int, input()))
        print(dp[r-1] - dp[l-1])
    
    

if __name__ == "__main__":
    solve()
Problem p03160 (python)

Fixed submission:
# -*- coding:utf-8 -*-

def solve():
    N = int(input())
    H = list(map(int, input().split()))

    INF = 10**4+10
    dp = [INF]*(N+10)
    dp[0] = 0
    dp[1] = abs(H[1] - H[0])
    for i in range(2, N):
        dp[i] = min(dp[i-1]+abs(H[i]-H[i-1]), dp[i-2]+abs(H[i]-H[i-2]))
    
    print(dp[N-1])


if __name__ == "__main__":
    solve()

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

INF=float("inf")

dp=[INF]*N

for i in range(0, N-1):
  for k in range(1, K+1):
    if i+k <= N-1:
      dp[i+k]=min(dp[i+k],dp[i]+abs(A[i]-A[i+k]))
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

def solve():
    """ DP """
    N = int(input())
    H = list(map(int, input().split()))

    INF = 10**4+10
    dp = [INF]*(N+10)
    dp[0] = 0
    dp[1] = abs(H[1] - H[0])
    for i in range(2, N):
        dp[i] = min(dp[i-1]+abs(H[i]-H[i-1]), dp[i-2]+abs(H[i]-H[i-2]))
    
    print(dp[N-1])


def solve2():
    """ メモ化再帰 """
    N = int(input())
    H = list(map(int, input().split()))

    INF = 10**14+10
    dp = [INF] * (N+10)
    dp[0] = 0
    dp[1] = abs(H[0]-H[1])

    def dfs(i):
        """ 足場iの時点の最小値を返す """
        if dp[i] != INF: return dp[i]
                
        ans2 = INF
        ans1 = dfs(i-1) + abs(H[i]-H[i-1])  # i-1の足場から来た場合
        if i-2 >= 0:
            ans2 = dfs(i-2) + abs(H[i]-H[i-2])  # i-2の足場から来た場合

        dp[i] = min(ans1, ans2)

        return dp[i]
    
    print(dfs(N-1))



if __name__ == "__main__":
    solve2()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

def solve():
    """ DP """
    N = int(input())
    H = list(map(int, input().split()))

    INF = 10**4+10
    dp = [INF]*(N+10)
    dp[0] = 0
    dp[1] = abs(H[1] - H[0])
    for i in range(2, N):
        dp[i] = min(dp[i-1]+abs(H[i]-H[i-1]), dp[i-2]+abs(H[i]-H[i-2]))
    
    print(dp[N-1])


def solve2():
    """ メモ化再帰 """
    N = int(input())
    H = list(map(int, input().split()))

    INF = 10**14+10
    dp = [INF] * (N+10)
    dp[0] = 0
    dp[1] = abs(H[0]-H[1])

    def dfs(i):
        """ 足場iの時点の最小値を返す """
        if dp[i] != INF: return dp[i]
                
        ans2 = INF
        ans1 = dfs(i-1) + abs(H[i]-H[i-1])  # i-1の足場から来た場合
        if i-2 >= 0:
            ans2 = dfs(i-2) + abs(H[i]-H[i-2])  # i-2の足場から来た場合

        ans = min(ans1, ans2)

        return ans
    
    print(dfs(N-1))



if __name__ == "__main__":
    solve2()
Problem p03161 (python)

Fixed submission:
# -*- coding:utf-8 -*-

def solve():
    """ dp[i+k]を求める方法
    TLE 
    """
    N,K=list(map(int,input().split()))
    A=list(map(int,input().split()))
    
    INF=float("inf")
    
    dp=[INF]*N
    dp[0]=0
    
    for i in range(0, N-1):
        for k in range(1, K+1):
            if i+k <= N-1:
                dp[i+k]=min(dp[i+k],dp[i]+abs(A[i]-A[i+k]))
            else:
                break
    print(dp[N-1])


def solve2():
    """dp[i]を求める方法
    """
    N,K=list(map(int,input().split()))
    A=list(map(int,input().split()))
    
    INF=float("inf")
    
    dp=[INF]*N
    dp[0]=0
    for i in range(1, N):
        for k in range(1, K+1):
            if i-k >= 0:
                dp[i] = min(dp[i], dp[i-k]+abs(A[i]-A[i-k]))
            else:
                break
    print(dp[N-1])


if __name__ == "__main__":
    solve2()

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

INF=float("inf")

dp=[INF]*N

for i in range(0, N-1):
  for k in range(1, K+1):
    if i+k <= N-1:
      dp[i+k]=min(dp[i+k],dp[i]+abs(A[i]-A[i+k])
print(dp[N-1])
Problem p03238 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def main():
    N = input()

    if N == "1":
        print("Hello World")
        exit()
    else:
        print(int(input()) + int(input()))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def main():
    N = input()

    if N == 1:
        print("Hello World")
        exit()
    else:
        print(int(input()) + int(input()))

if __name__ == '__main__':
    main()
Problem p03274 (python)

Fixed submission:
# -*- coding:utf-8 -*-

"""解説
https://www.youtube.com/watch?v=5O4k1n5Ejzw

区間を考える問題

-30 -10 0 10 20 50

・K = 3のとき、

0座標を必ず含める、ある連続するK個のロウソクについて考える

・-30 -10 0 10
・-10 0 10 20
・0 10 20 50

左端と右端に到達する最小値を求めていけばよくて、間のロウソクは無視してよい（必ず移動中に火をつけるので）

すべての場合について求めて、その中の最小値が答え
"""
def solve():
    N, K = list(map(int, input().split()))
    X = list(map(int, input().split()))
    if 0 in X:
        # 0座標にロウソクがあるなら、火をつけるロウソクをひとつ減らしてよい
        K -= 1
    else:
        X.append(0)
    X.sort()

    origin_i = X.index(0)
    left_i = max(origin_i-K, 0)

    INF = 10**12
    ans = INF
    while left_i <= origin_i:
        if left_i+K < len(X):
            tmp1 = abs(X[left_i]-0)*2 + abs(X[left_i+K]-0)
            tmp2 = abs(X[left_i]-0) + abs(X[left_i+K]-0)*2
        else:
            break
        ans = min(ans, tmp1, tmp2)
        left_i += 1
    print(ans)

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
import copy

INF = 2*(10**8)+1
memo = INF  # メモ化用変数

def solve():
    N, K = list(map(int, input().split(" ")))
    X = [0]
    X.extend(list(map(int, input().split(" "))))
    X.sort()


    def dfs(depth, cost, i, Xs):
        global memo
        if depth == K:
            memo = min(cost, memo)
            return cost
        
        if cost >= memo:
            # 探索を打ち切る
            return INF
        
        ret1, ret2 = INF, INF
        if i+1 < len(Xs):
            # 右に移動
            tmpCost = abs(Xs[i] - Xs[i+1])
            tmpXs = copy.deepcopy(Xs)
            del tmpXs[i]
            ret1 = dfs(depth+1, cost+tmpCost, i, tmpXs)
        if i-1 >= 0:
            # 左に移動
            costCost = abs(Xs[i] - Xs[i-1])
            tmpXs = copy.deepcopy(Xs)
            del tmpXs[i]
            ret2 = dfs(depth+1, cost+tmpCost, i-1, tmpXs)
        
        return min(ret1, ret2)

    # 0座標のインデックスは？
    for i in range(len(X)):
        if X[i] == 0:
            break
    ans = dfs(0, 0, i, X)
    print(ans)


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
import copy

INF = 2*(10**8)+1
memo = INF  # メモ化用変数

def solve():
    N, K = list(map(int, input().split(" ")))
    X = [0]
    X.extend(list(map(int, input().split(" "))))
    X.sort()


    def dfs(depth, cost, i, Xs):
        global memo
        if depth == K:
            memo = min(cost, memo)
            return cost
        
        if cost > memo:
            # 探索を打ち切る
            return INF
        
        ret1, ret2 = INF, INF
        if i+1 < len(Xs):
            # 右に移動
            tmpCost = abs(Xs[i] - Xs[i+1])
            tmpXs = copy.deepcopy(Xs)
            del tmpXs[i]
            ret1 = dfs(depth+1, cost+tmpCost, i, tmpXs)
        if i-1 >= 0:
            # 左に移動
            costCost = abs(Xs[i] - Xs[i-1])
            tmpXs = copy.deepcopy(Xs)
            del tmpXs[i]
            ret2 = dfs(depth+1, cost+tmpCost, i-1, tmpXs)
        
        return min(ret1, ret2)

    # 0座標のインデックスは？
    for i in range(len(X)):
        if X[i] == 0:
            break
    ans = dfs(0, 0, i, X)
    print(ans)


if __name__ == "__main__":
    solve()
Problem p03352 (python)

Fixed submission:
# -*- coding:utf-8 -*-
import math

def solve(X):
	ans = X
	# b^p = ansとなるansを探す
	for b in range(2, X):
		p = math.log(ans, b) # 精度で死ぬ(log(100, 10)など)
		if float.is_integer(p):
			return ans
	return 1

def solve2(X):
	# 全探索
	for x in range(X, 1, -1):
		for p in range(2, x):
			for b in range(2, x):
				bp = b**p
				if bp == x:
					return x
				if bp >= x:
					break
	return 1

if __name__ == "__main__":
	X = int(input())
	print(solve2(X))

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
import math

def solve(X):
	# b^p = xとなるxを探す
	for x in range(X, 1, -1)
    	for b in range(2, x):
    		p = math.log(x, b)
    		if float.is_integer(p):
    			return x
    	return 1

if __name__ == "__main__":
	X = int(input())
	print(solve(X))
Problem p03386 (python)

Fixed submission:
#-*- coding:utf-8 -*-

if __name__ == "__main__":
    A, B, K = list(map(int, input().split()))
    end = A + K
    if end >= B+1:
        end = B + 1
    for i in range(A, end):
        print(i)
    if end == B + 1:
        exit()

    start = B - K + 1
    if start <= i:
        start = i + 1
    for j in range(start, B+1):
        print(j)

Buggy submission (verdict: Runtime Error):
#-*- coding:utf-8 -*-

if __name__ == "__main__":
    A, B, K = list(map(int, input().split()))
    end = A + K
    if end >= B+1:
        end = B
    for i in range(A, end):
        print(i)

    start = B - K + 1
    if start <= i:
        start = i + 1
    for j in range(start, B+1):
        print(j)
Problem p03407 (python)

Fixed submission:
#-*- coding:utf-8 -*-

if __name__ == "__main__":
	A, B, C = list(map(int, input().split()))
	if A+B >= C:
		print("Yes")
	else:
		print("No")

Buggy submission (verdict: Runtime Error):
#-*- coding:utf-8 -*-

if __name__ == "__main__":
    A, B, C = list(map(int, liput().split()))
    if (A + B) >= C:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
#-*- coding:utf-8 -*-

if __name__ == "__main__":
	A, B, C = list(map(int, input.split()))
	if A+B >= C:
		print("Yes")
	else:
		print("No")
Problem p03415 (python)

Fixed submission:
# -*- coding: utf-8 -*-
#
if __name__ == "__main__":
    l1 = input()
    l2 = input()
    l3 = input()
    print("{}{}{}".format(l1[0], l2[1], l3[2]))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#
if __name__ == "__main__":
    l1 = input()
    l2 = input()
    l3 = input()
    print({}{}{}.format(l1[0], l2[1], l3[2]))
Problem p03416 (python)

Fixed submission:
# -*- coding:utf-8 -*-

if __name__ == "__main__":
    A, B = list(map(int, list(map(float, input().split()))))
    ans = 0
    for i in range(A, B+1):
        c = str(i)
        length = len(c)
        if length%2 == 0:
            continue
        for j in range(length):
            if c[j] == c[length-1-j]:
                if j == length-1-j:
                    ans += 1
                    break
                continue
            else:
                break
    print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

if __name__ == "__main__":
    A, B = list(map(int, input().split()))
    ans = 0
    for i in range(A, B+1)
        c = str(i)
        length = len(c)
        if length%2 == 0:
            continue
        for j in range(length):
            if c[j] == c[length-1-j]:
                if j == length-1-j:
                    ans += 1
                    break
                continue
            else:
                break
        print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

if __name__ == "__main__":
    A, B = list(map(int, input().split()))
    ans = 0
    for i in range(A, B+1)
        c = str(i)
        if len(c)%2 == 0:
            continue
        J = len(c)
        for j in range(J):
            if c[j] == c[J-1-j]:
                if j == J-1-j:
                    ans += 1
                    break
            else:
                break
        print(ans)