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

Fixed submission:
def tenka18beg_c():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    A_desc = sorted(A, reverse=True)

    if N % 2 == 1:
        tot1, tot2 = 0, 0
        for i, a in enumerate(A_desc):
            if i < N//2 - 1:
                tot1 += 2*a
                tot2 += 2*a
            elif i == N//2 - 1:
                tot1 += a
                tot2 += 2*a
            elif i == N//2:
                tot1 += a
                tot2 -= a
            elif i == N//2 + 1:
                tot1 -= 2*a
                tot2 -= a
            elif N//2 + 1 < i:
                tot1 -= 2*a
                tot2 -= 2*a
        ans = max(tot1, tot2)
    else:
        tot = 0
        for i, a in enumerate(A_desc):
            if i < N//2 - 1:
                tot += 2*a
            elif i == N//2 - 1:
                tot += a
            elif i == N//2:
                tot -= a
            elif N//2 < i:
                tot -= 2*a
        ans = tot
    print(ans)

tenka18beg_c()

Buggy submission (verdict: Runtime Error):
def tenka18beg_c():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    A_desc = sorted(A, reverse=True)

    if N % 2 == 1:
        tot1, tot2 = 0, 0
        for i, a in enumerate(A_desc):
            if i < N//2 - 1:
                tot1 += 2*a
                tot2 += 2*a
            elif i == N//2 - 1:
                tot1 += a
                tot2 += 2*a
            elif i == N//2:
                tot1 += a
                tot2 -= a
            elif i == N//2 + 1:
                tot1 -= 2*a
                tot2 -= a
            elif N//2 + 1 < i:
                tot1 -= 2*a
                tot2 -= 2*a
        ans = max(ans, max(tot1, tot2))
    else:
        tot = 0
        for i, a in enumerate(A_desc):
            if i < N//2 - 1:
                tot += 2*a
            elif i == N//2 - 1:
                tot += a
            elif i == N//2:
                tot -= a
            elif N//2 < i:
                tot -= 2*a
        ans = tot
    print(ans)

tenka18beg_c()
Problem p03240 (python)

Fixed submission:
def solve():
  size = 101
  n = int(input())
  points = []
  for _ in range(n):
    x, y, h = map(int, input().split())
    # h=0の点はスキップ ←勾配がないので高さ計算に使えない
    if h == 0: continue
    else: points.append((x, y, h))

  if len(points) == 1:
    # 必ず頂上が1つに定まる制約なので、測定点が1つしかなければそれが答え
    ans = points[0]
    return ans

  ans = (-1, -1, -1)
  for i in range(size):
    for j in range(size):
      # 高いほうに持ち上げるよう試みて、整合性とれなければ却下
      max_h = None
      succ = True
      for x, y, h in points:
        tmp = abs(i-x) + abs(j-y) + h
        if max_h == None:
          max_h = tmp
          continue
        else:
          if max_h != tmp:
            succ = False
            break
      # 成り立っているなかでの最高点を更新していく
      if succ:
        if ans[2] < max_h:
          ans = (i, j, max_h)
  # すべて終了
  return ans

ans = solve()
print('{} {} {}'.format(ans[0], ans[1], ans[2]))

Buggy submission (verdict: Runtime Error):
size = 101
n = int(input())
points = [tuple(map(int, input().split())) for _ in range(n)]
ans = None
for i in range(size):
  for j in range(size):
    # 高いほうに持ち上げるよう試みて、整合性とれなければ却下
    max_h = None
    succ = True
    for x, y, h in points:
      tmp = abs(i-x) + abs(j-y) + h
      if max_h == None:
        max_h = tmp
        continue
      else:
        if max_h != tmp:
          succ = False
          break
    if succ:
      ans = (i, j, max_h)
      break
  if succ: break
print('{} {} {}'.format(ans[0], ans[1], ans[2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
points = [tuple(map(int, input().split())) for _ in range(n)]
size = 101
ans = None
for i in range(size):
  for j in range(size):
    # 高いほうに持ち上げるよう試みて、整合性とれなければ却下
    max_h = 0
    succ = True
    for x, y, h in points:
      tmp = abs(i-x) + abs(j-y) + h
      if max_h == 0:
        max_h = tmp
        continue
      else:
        if max_h != tmp:
          succ = False
          break
    if succ:
      ans = (i, j, max_h)
      break
  if succ: break
print('{} {} {}'.format(ans[0], ans[1], ans[2]))
Problem p03283 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10010010)

def abc106_d():
    n, m, q = map(int, input().split())
    table = [[0]*(n+1) for _ in range(n+1)]
    for _ in range(m):
        l, r = map(int, input().split())
        table[l][r] += 1
    query = [tuple(map(int, input().split())) for _ in range(q)]

    dp = [[-1]*(n+1) for _ in range(n+1)]

    def calc(l, r):
        nonlocal dp
        if l == 0 or r == 0: return 0
        if dp[l][r] != -1: return dp[l][r]
        res = calc(l-1, r) + calc(l, r-1) - calc(l-1, r-1) + table[l][r]
        dp[l][r] = res
        return res

    for p, q in query:
        ans = calc(q, q) - calc(q, p-1) - calc(p-1, q) + calc(p-1, p-1)
        print(ans)

if __name__ == '__main__':
    abc106_d()

Buggy submission (verdict: Runtime Error):
def abc106_d():
    n, m, q = map(int, input().split())
    table = [[0]*(n+1) for _ in range(n+1)]
    for _ in range(m):
        l, r = map(int, input().split())
        table[l][r] += 1
    query = [tuple(map(int, input().split())) for _ in range(q)]

    dp = [[-1]*(n+1) for _ in range(n+1)]

    def calc(l, r):
        nonlocal dp
        if l == 0 or r == 0: return 0
        if dp[l][r] != -1: return dp[l][r]
        res = calc(l-1, r) + calc(l, r-1) - calc(l-1, r-1) + table[l][r]
        dp[l][r] = res
        return res

    for p, q in query:
        ans = calc(q, q) - calc(q, p-1) - calc(p-1, q) + calc(p-1, p-1)
        print(ans)

if __name__ == '__main__':
    abc106_d()
Problem p03290 (python)

Fixed submission:
D, G = map(int, input().split())
P = []
C = []
for i in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)

ans = 1e9
for mask in range(2**D):
  score = 0
  num = 0
  rest_max = -1

  for i in range(D):
    if (mask >> i) & 1:
      score += 100 * (i+1) * P[i] + C[i]
      num += P[i]
    else:
      rest_max = i

  if score < G:
    scr1 = 100 * (rest_max + 1)
    need = (G - score + scr1 - 1) // scr1
    if need >= P[rest_max]:
      continue
    num += need

  ans = min(ans, num)

print(ans)

Buggy submission (verdict: Runtime Error):
D, G = map(int, input().split())
P = []
C = []
for i in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)

ans = 1e9
for mask in range(2**D - 1):
  score = 0
  num = 0
  rest_max = -1

  for i in range(D):
    if (mask >> i) & 1:
      score += 100 * (i+1) * P[i] + C[i]
      num += P[i]
    else:
      rest_max = i

  #print('mask {}, score {}, num {}, rest_max {}'.format(format(mask, '010b'), score, num, rest_max))

  if score < G:
    scr1 = 100 * (rest_max + 1)
    need = (G - score + scr1 - 1) // scr1
    if need >= P[rest_max]:
      #print('fault')
      continue
    num += need
    #print('追加 {}, 合計 {}'.format(need, num))
  else:
    #print('合計 {}'.format(num))

  ans = min(ans, num)

print(ans)
Problem p03309 (python)

Fixed submission:
# https://atcoder.jp/contests/abc102/submissions/7991084

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

def abc102_c():
    N = int(readline())
    A = np.array(read().split(), dtype=np.int64)

    # b=0として変形する
    B = A - np.arange(1, N+1)
    # 中央値が0になるよう高さ調整する
    B.sort()
    x = B[N//2]
    # 絶対値の合計をとる
    ans = np.abs(B - x).sum()
    print(ans)

abc102_c()

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc102/submissions/7991084
def abc102_c():
    N = int(readline())
    A = np.array(read().split(), dtype=np.int64)

    # b=0として変形する
    B = A - np.arange(1, N+1)
    # 中央値が0になるよう高さ調整する
    B.sort()
    x = B[N//2]
    # 絶対値の合計をとる
    ans = np.abs(B - x).sum()
    print(ans)

abc102_c()
Problem p03583 (python)

Fixed submission:
def tenka17_c():
    N = int(input())
    ans = None
    for x in range(1, 3501):
        for y in range(1, 3501):
            a = N * x * y
            b = 4*x*y - N*y - N*x
            if b < 1: continue
            if a % b == 0:
                ans = (x, y, a//b)
                break
        if ans: break
    print(*ans, sep=' ')

tenka17_c()

Buggy submission (verdict: Runtime Error):
N = int(input())
b, c, d = 1, 1, 2
while True:
    x = N//4 + b
    y = c*N*x
    tmp = c * (4*x - N) - 1
    if y % tmp == 0:
        z = y // tmp
        break
    else:
        b += 1
print(*[x,y,z], sep=' ')
Problem p03638 (python)

Fixed submission:
import numpy as np

def abc069_d():
    H, W = map(int, input().split())
    _ = int(input())
    A = list(map(int, input().split()))

    # いったん1次元に並べる
    flat = []
    for i, a in enumerate(A):
        flat += [i+1] * a

    # 2次元に変形して、1行飛ばしで反転(折り返して往復すればつながる)
    grid = np.array(flat, dtype=int).reshape((H, W))
    for i in range(H):
        if i % 2 == 0:
            print(*grid[i], sep=' ')
        else:
            print(*grid[i, ::-1], sep=' ')

abc069_d()

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

def abc069_d():
    H, W = map(int, input().split())
    _ = int(input())
    A = list(map(int, input().split()))

    # いったん1次元に並べる
    flat = []
    for i, a in enumerate(A):
        flat += [i+1] * a

    # 2次元に変形して、1行飛ばしで反転(折り返して往復すればつながる)
    grid = np.array(flat, dtype=int).reshape((H, W))
    for i in range(H):
        if i % 2 == 0:
            print(*grid[i], sep=' ')
        else:
            print(*np.flip(grid[i]), sep=' ')

abc069_d()
Problem p03826 (python)

Fixed submission:
a,b,c,d = map(int, input().split())
s = a*b
t = c*d
if s > t: print(s)
else: print(t)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
s = a*b
t = c*d
if s > t = print(s)
else: print(t)
Problem p03994 (python)

Fixed submission:
def codefes16qa_c():
    s = str(input())
    k = int(input())
    n = len(s)
    ans = ''
    for i in range(n):
        if s[i] == 'a':
            ans += s[i]
            continue
        step2a = 1 + ord('z') - ord(s[i])
        if step2a <= k:
            ans += 'a'
            k -= step2a
        else:
            ans += s[i]
    if k > 0:
        last = ord(ans[-1]) + (k % 26)
        ans = ans[:n-1] + chr(last)
    print(ans)

codefes16qa_c()

Buggy submission (verdict: Runtime Error):
def codefes16qa_c():
    s = str(input())
    k = int(input())
    n = len(s)
    ans = ''
    for i in range(n):
        step2a = 1 + ord('z') - ord(s[i])
        if step2a <= k:
            ans += 'a'
            k -= step2a
        else:
            ans += s[i]
    if k > 0:
        last = ord(ans[-1]) + k
        ans = ans[:n-1] + chr(last)
    print(ans)

codefes16qa_c()
Problem p02923 (python)

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

count=0
ans=0

for i in range(n-1):
  if h[i]>=h[i+1]:
    count+=1
  else:
    count=0
  ans=max(count, ans)
  
print(ans)

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

def ml(i,count,maxmove):
  if i==n-1:
    if count>maxmove: maxmove=count
    return maxmove
  if h[i]>=h[i+1]:
    count+=1
    return ml(i+1,count,maxmove)
  if count>maxmove:
    maxmove=count
  return ml(i+1,0,maxmove)
  
print(ml(0,0,0))
Problem p02600 (python)

Fixed submission:
from sys import stdin

def main():
    h = int(input())
    kyu = 8
    if 600 <= h and h < 800:
        kyu = 7
    if 800 <= h and h < 1000:
        kyu = 6
    if 1000 <= h and h < 1200:
        kyu = 5
    if 1200 <= h and h < 1400:
        kyu = 4
    if 1400 <= h and h < 1600:
        kyu = 3
    if 1600 <= h and h < 1800:
        kyu = 2
    if 1800 <= h and h < 2000:
        kyu = 1
    print(kyu)
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    h = [int(x) for x in stdin.readline().rstrip().split()]
    kyu = 8
    if 600 <= h and h < 800:
        kyu = 7
    if 800 <= h and h < 1000:
        kyu = 6
    if 1000 <= h and h < 1200:
        kyu = 5
    if 1200 <= h and h < 1400:
        kyu = 4
    if 1400 <= h and h < 1600:
        kyu = 3
    if 1600 <= h and h < 1800:
        kyu = 2
    if 1800 <= h and h < 2000:
        kyu = 1
    print(kyu)
    
if __name__ == "__main__":
    main()
Problem p02621 (python)

Fixed submission:
from sys import stdin

def main():
    n = int(input())
    nn = n ** 2
    nnn = n ** 3
    ans = n + nn + nnn
    print(ans)
    

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    n, m, k = [int(x) for x in stdin.readline().rstrip().split()]

    pileda = 0
    a = [0]
    # ai = 0
    for x in stdin.readline().rstrip().split():
        # ai += 1
        x = int(x)
        pileda += x
        a.append(pileda)
        if pileda > k:
            break
    
    piledb = 0
    b = [0]
    for x in stdin.readline().rstrip().split():
        x = int(x)
        piledb += x
        b.append(piledb)
        if piledb > k:
            break

    ans = 0
    for ai, time_a in enumerate(a):
        for bi, time_b in enumerate(b):
            if time_a + time_b > k:
                break
            if time_a + time_b <= k and ai + bi > ans:
                ans = ai + bi
    print(ans)

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

Fixed submission:
from sys import stdin

a = [int(x) for x in stdin.readline().rstrip().split()]


for i, x in enumerate(a):
    i += 1
    if x == 0:
        print(i)

Buggy submission (verdict: Runtime Error):
from sys import stdin

x, n = [int(x) for x in stdin.readline().rstrip().split()]
if n > 0:
    P = [int(x) for x in stdin.readline().rstrip().split()]

memos = [False] * 102

for p in P:
    memos[p] = True

tgt = x
offset = 1
look_down = True
while True:

    if memos[tgt] == False:
        break
    if look_down:
        look_down = False
        tgt = tgt-offset
    else:
        look_down = True
        tgt = offset + offset
        offset += 1

print(tgt)

Buggy submission (verdict: Runtime Error):
from sys import stdin

x, y = [int(x) for x in stdin.readline().rstrip().split()]


if y < 2*x or 4*x < y:
    print('No')
else:
    if (4*x-y) % 2 == 0:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
from sys import stdin

x, y = [int(x) for x in stdin.readline().rstrip().split()]


if y < 2*x and 4*x < y:
    print('No')
else:
    if (4*x-y) % 2 == 0:
        print('Yes')
    else:
        print('No')
Problem p02641 (python)

Fixed submission:
from sys import stdin

x, n = [int(x) for x in stdin.readline().rstrip().split()]
if n > 0:
    P = [int(x) for x in stdin.readline().rstrip().split()]

    memos = [False] * 102

    for p in P:
        memos[p] = True

    tgt = x
    offset = 1
    look_down = True
    while True:

        if memos[tgt] == False:
            break
        if look_down:
            look_down = False
            tgt = x-offset
        else:
            look_down = True
            tgt = tgt + offset + offset
            offset += 1

    print(tgt)
else:
    print(x)

Buggy submission (verdict: Runtime Error):
from sys import stdin

x, n = [int(x) for x in stdin.readline().rstrip().split()]
if n > 0:
    P = [int(x) for x in stdin.readline().rstrip().split()]

memos = [False] * 102

for p in P:
    memos[p] = True

tgt = x
offset = 1
look_down = True
while True:

    if memos[tgt] == False:
        break
    if look_down:
        look_down = False
        tgt = tgt-offset
    else:
        look_down = True
        tgt = offset + offset
        offset += 1

print(tgt)
Problem p02642 (python)

Fixed submission:
from sys import stdin

n = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]

# 使わなくて良い
# def get_sieve_of_eratosthenes_new(n):
#     import math
#     if not isinstance(n, int):
#         raise TypeError('n is int type.')
#     if n < 2:
#         raise ValueError('n is more than 2')
#     prime = []
#     limit = math.sqrt(n)
#     data = [i + 1 for i in range(1, n)]
#     while True:
#         p = data[0]
#         if limit <= p:
#             return prime + data
#         prime.append(p)
#         data = [e for e in data if e % p != 0]

# 倍数はOUTという判定を行ってく

# その前に複数あるものはのぞく

cnt = [0] * ((10**6)+1)
for elem in a:
    cnt[elem] += 1

filtered = []

for i in range((10**6)+1):
    if cnt[i] == 1:
        filtered.append(i)

# 倍数かどうかチェック用カウンタ
cnt = [0] * ((10**6)+1)

# 重複のない要素それぞれで倍数を見ていく（上限まで）
a = list(set(a))
for elem in a:
    # 自分自身はカウントしない
    # elemずつ増えるので、倍数という意味になる
    for i in range(elem*2, (10**6)+1, elem):
        cnt[i] += 1

ans = 0
# filteredのうち何らかの倍数になっていないものの数が答え
for i in filtered:
    if cnt[i] == 0:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin

n = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]

rest_lists = []

P.sort()

def return_filtered(div, rl):
    new = []
    protect = True
    for tgt in rl:
        if protect and tgt == div:
            new.append(tgt)
            protect = False
        elif tgt == div and len(new) >0:
            new.pop()
        elif not tgt % div == 0:
            new.append(tgt)
    print(new)
    return new

new_list = P
k = 0
while True:
    if len(new_list) == 0:
        break
    k += 1
    if 1+k > len(new_list):
        break
    new_list = return_filtered(new_list[1+k], new_list)

print(len(new_list))
Problem p02645 (python)

Fixed submission:
n = input()

print(n[:3])

Buggy submission (verdict: Runtime Error):
from sys import stdin

n, k = [int(x) for x in stdin.readline().rstrip().split()]
intense_counters = [0]
dd = [int(x) for x in stdin.readline().rstrip().split()]
intense_counters.extend(dd)

max_intense = False
additional = 0
if k >= n-1:
    print(" ".join(list(map(str, [n]*n))))
else:
    for times in range(k):
        counter = 0
        new_intense_counters = [0] * (n+1)
        add_all = 0
        for i, intense in enumerate(intense_counters):
            if i == 0:
                continue
            intense += additional

            if intense == n-1:
                counter += 1
                add_all += 1
            else:
                min = i - intense
                if min < 1:
                    min = 1
                max = i + intense
                if max > n:
                    max = n

                if min == 1 and max == n:
                    add_all += 1
                else:
                    for lighted_position in range(min, max+1):
                        new_intense_counters[lighted_position] += 1
        if counter == n:
            max_intense = True
            break
        intense_counters = new_intense_counters
        additional = add_all

    if max_intense:
        print(" ".join(list(map(str, [n]*n))))
    else:
        print(" ".join(list(map(str, intense_counters[1:]))))

Buggy submission (verdict: Runtime Error):
from sys import stdin

n, k = [int(x) for x in stdin.readline().rstrip().split()]
intense_counters = [0]
dd = [int(x) for x in stdin.readline().rstrip().split()]
intense_counters.extend(dd)


for times in range(k):
    lighted_positions = []
    for i, intense in enumerate(intense_counters):
        if i == 0:
            continue

        min = i - intense
        max = i + intense

        for lighted_position in range(min, max+1):
            if 0 < lighted_position and lighted_position <= n:
                lighted_positions.append(lighted_position)

    intense_counters = [0] * (n+1)
    for lp in lighted_positions:
        intense_counters[lp] += 1

print(" ".join(list(map(str, intense_counters[1:]))))
Problem p02709 (python)

Fixed submission:
def solve():
    INF = float('inf')
 
    def max2(x, y): return x if x >= y else y
 
    N = int(input())
    As = [(A, i) for i, A in enumerate(map(int, input().split()))]
 
    As.sort(reverse=True)
 
    dp = [[-INF]*(N+1) for _ in range(N+1)]
    dp[0][0] = 0
    for no, (A, pos) in enumerate(As):
        for i in range(no+1):
            j = no-i
            dp[i+1][j] = max2(dp[i+1][j], dp[i][j] + A*abs(pos-i))
            dp[i][j+1] = max2(dp[i][j+1], dp[i][j] + A*abs(pos-(N-1-j)))
 
    ans = 0
    for i in range(N+1):
        j = N-i
        ans = max2(ans, dp[i][j])
 
    print(ans)
 
 
solve()

Buggy submission (verdict: Runtime Error):
AAwIdx = [[0]*2 for _ in range(N)]
for i in range(N):
    AAwIdx[i][0] = i
    AAwIdx[i][1] = AA[i]
AA_sorted = sorted(AAwIdx, key=lambda x: x[1], reverse=True)
#print(AA_sorted)
Idx_i = 0
Idx_f = N-1
AnsIdx = [0]*N
#print(Idx_f)
answer = 0
for i in range(N):
    if Idx_f - AA_sorted[i][0] > AA_sorted[i][0] - Idx_i:
        AnsIdx[AA_sorted[i][0]] = Idx_f
        #answer += abs(AA_sorted[i][0]-Idx_f)*AA_sorted[i][1]
        Idx_f -= 1
    else:
        AnsIdx[AA_sorted[i][0]] = Idx_i
        #answer += abs(AA_sorted[i][0]-Idx_i)*AA_sorted[i][1]
        Idx_i += 1
    #print(AA_sorted[i][0],Idx_i,Idx_f)
for i in range(N):
    answer += abs(AAwIdx[i][0] - AnsIdx[i])*AAwIdx[i][1]
answerb = 0
Idx_i = 0
Idx_f = N-1
AnsIdx = [0]*N
if Idx_f - AA_sorted[0][0] > AA_sorted[0][0] - Idx_i:
    AnsIdx[AA_sorted[i][0]] = Idx_i
    #answer += abs(AA_sorted[i][0]-Idx_i)*AA_sorted[i][1]
    Idx_i += 1
else:
    AnsIdx[AA_sorted[i][0]] = Idx_f
    #answer += abs(AA_sorted[i][0]-Idx_f)*AA_sorted[i][1]
    Idx_f -= 1
for i in range(1,N):
    if Idx_f - AA_sorted[i][0] > AA_sorted[i][0] - Idx_i:
        AnsIdx[AA_sorted[i][0]] = Idx_f
        #answer += abs(AA_sorted[i][0]-Idx_f)*AA_sorted[i][1]
        Idx_f -= 1
    else:
        AnsIdx[AA_sorted[i][0]] = Idx_i
        #answer += abs(AA_sorted[i][0]-Idx_i)*AA_sorted[i][1]
        Idx_i += 1
    #print(AA_sorted[i][0],Idx_i,Idx_f)
for i in range(N):
    answerb += abs(AAwIdx[i][0] - AnsIdx[i])*AAwIdx[i][1]
#print(AnsIdx)
print(max(answer, answerb))
Problem p02576 (python)

Fixed submission:
import math
n,x,t=list(map(int,input().split()))
print(math.ceil(n/x)*t)

Buggy submission (verdict: Runtime Error):
n=input()
s=0
for i in n:
  s+=int(i)
  s=s%9
if s%9==0:
  print(Yes)
else:
  print("No")
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
m = n
while m > 0:
  n = min(abs(n - k), n)
  if m > n:
      m = n
  else:
      print(m)
      break

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
m = n
while m > 0:
  n = min(abs(n - k), n)
  if m > n:
      m = n
  else:
      print(n)
      break

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
m = n
while m > 0:
  n = min(abs(n - k), m)
  if m > n:
      m = n
  else:
      print(n)
      break
Problem p02717 (python)

Fixed submission:
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
import math
# stdin = open("sample.txt")

a, b, c = [int(x) for x in stdin.readline().rstrip().split()]

print(c,a,b)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
import math
# stdin = open("sample.txt")

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

K = int(stdin.readline().rstrip())
a = list(range(1,10))
b = []
attack = 100000
while attack > 0:
    go = a.pop(0)
    ue = go*10
    shimo = go%10
    b.append(go)
    if shimo == 0:
        a.append(ue)
        a.append(ue+1)
    elif shimo == 9:
        a.append(ue+shimo-1)
        a.append(ue+shimo)
    else:
        a.append(ue+shimo-1)
        a.append(ue+shimo)
        a.append(ue+shimo+1)
    attack -= 1

print(b[K-1])