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

Fixed submission:
AB, BC, CA = map(int, input().split())

result = int(AB * BC / 2)

print(result)

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

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

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

Buggy submission (verdict: Runtime Error):
 import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
from operator import itemgetter


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

def main():
    # 種類最小から最大までそれぞれ計算する
    N, K = LI()
    T = []
    D = []
    TD = []
    for i in range(N):
        TD.append(LI())
    #  print(T, '\n', D)
    TD = sorted(TD, key=itemgetter(1), reverse=True)
    #  print('TD', TD)

    max_value_per_type = [[t, max([td[1] for td in TD if td[0] == t])]for t in set([i[0] for i in TD])]
    #  print('max_value_per_type', max_value_per_type)
    content_per_type = [[t, [i[1] for i in TD if i[0] == t]] for t in set(i[0] for i in TD)]
    #  print(content_per_type)
    max_idx_per_type = [i[1].index([mvpt[1] for mvpt in max_value_per_type if mvpt[0] == i[0]][0]) for i in content_per_type]
    #  print('max_idx_per_type', max_idx_per_type)
    for idx, i in enumerate(max_idx_per_type):
        del content_per_type[idx][1][i]
    #  remaining_values_per_type = [[c[0], [i[0] for i in content_per_type if ]] for c in content_per_type]
    #  print('各タイプから最大値を抜きました', content_per_type)
    results = [0]
    for i in range(1, K+1):
        #  print('\n---------\n',i,'回目')
        # iを種類数とみなす
        # 何を選んだかは関係ない
        
        # 種類の全組み合わせを求める
        #  print(i)
        if len(set([i[0] for i in TD])) < i:
            break 
        combinations = list(itertools.combinations(set([i[0] for i in TD]), i))
        #  print('combi', combinations)
        type_bonus = i * i
        for combination in combinations:
            #  print('\n')
            # 各組み合わせでの最大値を求める
            current_options = [i for i in TD if i[0] in combination]
            
    print(max(results))


main()
Problem p03151 (python)

Fixed submission:
import numpy as np

N = input()
a_list = np.array(list(map(int, input().split())))
b_list = np.array(list(map(int, input().split())))

#  # すべての準備度が必要度を上回っている場合
#  if all([a >= b for a, b in zip(a_list, b_list)]):
#      print(0)
#  # 準備度が足りていない試験がある場合
#  else:
# そもそも準備度の総量が足りない場合
if sum(a_list) < sum(b_list):
    print(-1)
else:
    # 準備度を移動すれば受かる場合
    # 一番数の大きいところから足りていないところに割り振る戦略
    # a_listをcopy
    # 準備度の余裕をリストに格納
    diff_list = a_list - b_list
    # 昇順にソート
    diff_list.sort()
    start = 0
    end = -1
    current_value = diff_list[end]
    while diff_list[start] < 0:
        # 最大値から減算
        current_value += diff_list[start]
        while current_value < 0:
            end -= 1
            current_value += diff_list[end]
        start += 1
    if start == 0:
        print(0)
    else:
        print(start - end)

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

N = input()
a_list = np.array(list(map(int, input().split())))
b_list = np.array(list(map(int, input().split())))

#  # すべての準備度が必要度を上回っている場合
#  if all([a >= b for a, b in zip(a_list, b_list)]):
#      print(0)
#  # 準備度が足りていない試験がある場合
#  else:
# そもそも準備度の総量が足りない場合
if sum(a_list) < sum(b_list):
    print(-1)
else:
    # 準備度を移動すれば受かる場合
    # 一番数の大きいところから足りていないところに割り振る戦略
    # a_listをcopy
    # 準備度の余裕をリストに格納
    diff_list = a_list - b_list
    diff_list.sort()
    start = 0
    end = -1
    current_value = diff[end]
    while current_value < 0:
        current_value += diff_list[i]
        while current_value < 0:
            end -= 1
            a += diff[end]
        start += 1
    if start == 0:
        print(0)
    else:
        print(i - j)
Problem p03211 (python)

Fixed submission:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    S = input()

    # 10文字までしかないので、一個ずつ見ていっても良いのでは
    result = 10**10
    for i in range(0, len(S) - 2):
        r = min(abs(753 - int(S[i:i+3])), abs(int(S[i:i+3]) - 753))
        if r < result:
            result = r

    print(result)

main()

Buggy submission (verdict: Runtime Error):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    S = input()

    # 10文字までしかないので、一個ずつ見ていっても良いのでは
    result = 10**10
    for i in range(0, len(S) - 2):
        r = min(abs(753 - int(S[i:i+3])))
        if r < result:
            result = r

    print(result)

main()
Problem p03212 (python)

Fixed submission:
def main():
    global results, S
    S = int(input())
    S_str = str(S)
    results = []
    for i in range(len(S_str)):
        digits = len(S_str) - i
        if digits < 3:
            break

        # 全部7の状態からはじめて、次は5次は3というふうにやる
        bfs(digits, '')

    print(len(results))


def bfs(i, s):
    global results, S
    if i == 0:
        if int(s) <= S and len(set(s)) == 3:
            results.append(s)
        return
    i -= 1
    bfs(i, s + '3')
    bfs(i, s + '5')
    bfs(i, s + '7')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    global results, S
    S = int(input())
    S_str = str(S)
    results = []
    for i in range(len(S_str)):
        digits = len(S_str) - i
        if digits < 3:
            break

        bfs(digits, '')

    print(len(results))


def bfs(i, s):
    #  global results, S
    if i == 0:
        if int(s) <= S and len(set(s)) == 3:
            results.append(s)
        return
    i -= 1
    bfs(i, s + '3')
    bfs(i, s + '5')
    bfs(i, s + '7')


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

Fixed submission:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


N = I()
T, A = LI()
H = LI()

result = 10**18
result_idx = 0
for idx, h in enumerate(H):
    height = T - h * 0.006
    if abs(A - height) < result:
        result = abs(A - height)
        result_idx = idx + 1

print(result_idx)

Buggy submission (verdict: Runtime Error):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


N = I()
T, A = LI()
H = LI()

new_H = sorted(H)
new_H = [T - i*0.006 for i in H]
#  print(new_H)
#  print(bisect.bisect_left(new_H, A))
idx = bisect.bisect_left(new_H, A)
if idx == len(new_H):
    print(len(H)-1)
    exit()
print(H.index(new_H[idx]))
Problem p03240 (python)

Fixed submission:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

N = I()
xyh = []
for i in range(N):
    x, y, h = LI()
    xyh.append([x,y,h])


for i in range(100+1):
    for j in range(100+1):
        cx, cy = i, j
        H = []
        for item in xyh:
            #  print(item)
            if item[2] == 0:
                continue

            new_H = max(item[2] + abs(item[0] - cx) + abs(item[1] - cy), 0)
            H.append(new_H)
        else:
            if len(set(H)) == 1:
                center_H = H[0]
                H = []
                for item in xyh:
                    if item[2] == 0:
                        # 0の場合にも正しいか判定する
                        ch = abs(item[0] - cx) + abs(item[1] - cy)
                        if ch < center_H:
                            break
                else:
                    print(i, j, center_H)
                    exit()

Buggy submission (verdict: Runtime Error):
import sympy
Problem p03262 (python)

Fixed submission:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


N, X = LI()
X_list = LI()

#  N = 10**5
#  X = 10**9
#  X_list = [i for i in range(1, 10**5, 5)]

#  if N == 1:
#      print(abs(X_list[0] - 1))
#      exit()
X_list.sort()

bisect.insort_left(X_list, X)
#  print(X_list)
X_diff = [abs(j-i) for i, j in zip(X_list[:-1], X_list[1:])]
X_diff = list(set(X_diff))
#  result = min(X_diff)
# 全部行けない場合がある
# 1 4 9 など
# すべてステップ幅-1で割り切れなければ不可

def gcd(a,b):
    if b == 0: return a
    return gcd(b, a%b)

for i in range(len(X_diff)):
    #  print(i)
    if i == 0:
        result = X_diff[i]
        continue
    
    result = gcd(X_diff[i], result)
#  while True:
#      if all(x % result == 0 for x in X_diff):
#          result = i
#      else:
#          result = [i for i in range(result, 0, -1) if ]

print(result)

Buggy submission (verdict: Runtime Error):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


N, X = LI()
X_list = LI()
X_list.sort()

bisect.insort_left(X_list, X)
#  print(X_list)
X_diff = [j-i for i, j in zip(X_list[:-1], X_list[1:])]
print(min(X_diff)
Problem p03387 (python)

Fixed submission:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

A, B, C = LI()

nums = sorted([A,B,C])
set_nums = list(set([A,B,C]))
result = 0
if len(set_nums) == 1:
    print(0)
elif len(set_nums) == 2:
    # 2種類は一緒
    #前２つが一緒かつはぐれが大きい
    if nums[0] == nums[1]:
        result += nums[2]-nums[1]
        print(result)
        exit()
    elif nums[1] == nums[2]:
        # 後ろ２つが等しく、はぐれが最小
        result += (nums[1] - nums[0])//2
        if (nums[1]-nums[0]) % 2 != 0:
            result += 2
        print(result)
        exit()
else:
    # 全数字が異なる
    result += nums[2]-nums[1]
    nums[0] += nums[2]-nums[1]
    result += (nums[2] - nums[0]) // 2
    if (nums[2] - nums[0]) % 2 != 0:
        result += 2

    print(result)

Buggy submission (verdict: Runtime Error):
A, B, C = LI()
X = max(A,B,C)
result1 = 3*X - (A+B+C)
result2 = 3*(X+1) - (A+B+C)
if result1%2 == 0:
    print(result1/2)
else:
    print(result2/2)
Problem p03607 (python)

Fixed submission:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N=I()
A=[I() for i in range(N)]
counts = collections.Counter(A)
ans=0
for i in counts.values():
    if i%2 == 1: 
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N=I()
A=[I() for i in range(N)]
counts = collections.Counter(A)
ans=0
for i in counts.values():
    if values%2 == 1: 
        ans += 1
print(ans)
Problem p03637 (python)

Fixed submission:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N=I()
A=LI()
# A=[I() for i in range(N)]
# ignore %2==0 numbers
f=[]
odds=[]
t=[]
for n in A:
    if n%4==0:
        f.append(n)
    elif n%2!=0:
        odds.append(n)
    else:
        t.append(n)
if len(odds)==0:
    print('Yes')
elif len(f) < len(odds)-1:
    print('No')
else:
    if len(odds) - 1 == len(f):
        if len(t)> 0:
            print('No')
        else:
            print('Yes')
    else:
        print('Yes')

Buggy submission (verdict: Runtime Error):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N=I()
A=[I() for i in range(N)]
# ignore %2==0 numbers
f=[]
odds=[]
for n in N:
    if n%4==0:
        f.append(n)
    elif n%2!=0:
        odds.append(n)
if len(odds)==0:
    print('Yes')
elif len(f) < len(odds)-1:
    print('No')
else:
    print('Yes')
Problem p03836 (python)

Fixed submission:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True, end="")

sx,sy,tx,ty=LI()

for i in range(abs(ty-sy)):
	pf("U")

for i in range(abs(sx-tx)):
	pf("R")

for i in range(abs(ty-sy)):
	pf("D")
	
for i in range(abs(sx-tx)):
	pf("L")

pf("L")

for i in range(abs(ty-sy)):
	pf("U")
pf("U")
pf("R")

for i in range(abs(sx-tx)):
	pf("R")
	
pf("D")

pf("R")

for i in range(abs(ty-sy)):
	pf("D")
pf("D")
pf("L")
for i in range(abs(tx-sx)):
	pf("L")
pf("U")

Buggy submission (verdict: Runtime Error):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True, end="")

sx,sy,tx,ty=LI()

for i in range(abs(ty-sy)):
	pf("U")

for i in range(abs(sx-tx)):
	pf("R")

for i in range(abs(ty-sy)):
	pf("D")
	
for i in range(abs(sx-tx)):
	pf("L")

pf("L")

for i in range(abs(ty-sy)):
	pf("U")
pf("U")
pf("R")

for i in range(abs(sx-tx)):
	pf("R")
	
pf("D")

pf("R")

for i in range(abs(ty-sy)):
	pf("D")
pf("D")
pf("L")
for i in range(abs(tx-sx)):
	pf("L")
pf("U")
Problem p03647 (python)

Fixed submission:
def f():
    n,m = map(int,input().split(" "))
    s = []
    w = [[] for i in range(n+2)]
    for i in range(m):
        a,b = map(int,input().split(" "))
        
        if a==1:
            s.append(b)
        if b==1:
            s.append(a)
        w[a].append(b)
        w[b].append(a)
    for i in s:
        if n in w[i]:
            print("POSSIBLE")
            return 0
    print("IMPOSSIBLE")
    return 0
f()

Buggy submission (verdict: Runtime Error):
    def f():
        n,m = map(int,input().split(" "))
        s = []
        w = [[] for i in range(n+2)]
        for i in range(m):
            a,b = map(int,input().split(" "))
            
            if a==1:
                s.append(b)
            if b==1:
                s.append(a)
            w[a].append(b)
            w[b].append(a)
        for i in s:
            if n in w[i]:
                print("POSSIBLE")
                return 0
        print("IMPOSSIBLE")
        return 0
    f()
Problem p03680 (python)

Fixed submission:
n=int(input())
a=[0]*100097

for i in range(n):
  a[i+1]=int(input())

cnt=0
needle=1
while not(needle==2 or cnt >100097):
  needle=a[needle]
  cnt+=1

if cnt>100001:
  cnt=-1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[0]*10007

for i in range(n):
  a[i+1]=int(input())

cnt=0
needle=1
while not(needle==2 or cnt >10007):
  needle=a[needle]
  cnt+=1

if cnt>10001:
  cnt=-1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[0]*10007

for i in range(n):
  a[i+1]=int(input())

cnt=0
needle=1
while not(needle==2 or cnt >10007):
  needle=a[needle]
  cnt+=1
Problem p03700 (python)

Fixed submission:
import math

n, a, b = map(int, input().split(" "))

h = []
for i in range(n):
    h.append(int(input()))

h.sort(reverse=True)


def check(count_target, h, a, b):
    count = 0

    for i in h:
        if i >= count_target * b:
            count += math.ceil((i - count_target * b) / (a - b))
    return count_target - count


l = 1
r = math.ceil(h[0] / b)


while r - l > 1:
    mid = math.floor(l + (r - l) / 2)

    if check(mid, h, a, b) < 0:
        l = mid
    else:
        r = mid


if check(l, h, a, b) < 0:
    print(int(r))
else:
    print(int(l))

Buggy submission (verdict: Runtime Error):
    import math
     
    n, a, b = map(int, input().split(" "))
     
    h = []
    for i in range(n):
        h.append(int(input()))
     
    h.sort(reverse=True)
     
     
    def check(count_target, h, a, b):
        count = 0
     
        for i in h:
            if i >= count_target * b:
                count += math.ceil((i - count_target * b) / (a - b))
        return count_target - count
     
     
    l = 1
    r = math.ceil(h[0] / b)
     
     
    while r - l > 1:
        mid = math.floor(l + (r - l) / 2)
     
        if check(mid, h, a, b) < 0:
            l = mid
        else:
            r = mid
     
     
    if check(l, h, a, b) < 0:
        print(int(r))
    else:
        print(int(l))