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

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
temp = a[0] ^ a[1]
for i in range(2,n):
    temp = temp ^ a[i]
if temp == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = set(a)
d = [0,0,0]
index = 0
if len(b) != 3 and n % 3 != 0:
    print("No")
    exit()
for i in list(b):
    for j in a:
        if i == j:
            d[index] += 1
    index += 1
if d[0] == d[1] and d[1] == d[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = set(a)
d = [0,0,0]
index = 0
if len(b) != 3 and len(n) % 3 != 0:
    print("No")
    exit()
for i in list(b):
    for j in a:
        if i == j:
            d[index] += 1
    index += 1
if d[0] == d[1] and d[1] == d[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = set(a)
d = [0,0,0]
index = 0
if len(b) != 3 and len(n) % 3 == 0:
    print("No")
    exit()
for i in list(b):
    for j in a:
        if i == j:
            d[index] += 1
    index += 1
if d[0] == d[1] and d[1] == d[2]:
    print("Yes")
else:
    print("No")
Problem p02985 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**5)
n, k = map(int, input().split())
mod = 10 ** 9 + 7
adjacent_list = [[] for i in range(n+1)]
for i in range(n - 1):
    a, b = map(int, input().split())
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
finished = set([1])
ans = k
def dfs(current, finished,num):
    global ans
    global k
    unsearched = set(adjacent_list[current]) - finished
    num = max(k - 1, num)
    if len(unsearched) == 0:
        return
    for i in unsearched:
        finished.add(i)
        num -= 1
        ans *= num
        ans %= mod
        dfs(i,finished, num)
dfs(1,finished,k)
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
mod = 10 ** 9 + 7
adjacent_list = [[] for i in range(n+1)]
for i in range(n - 1):
    a, b = map(int, input().split())
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
finished = set([1])
ans = k
def dfs(current, finished,num):
    global ans
    global k
    unsearched = set(adjacent_list[current]) - finished
    num = max(k - 1, num)
    if len(unsearched) == 0:
        return
    for i in unsearched:
        finished.add(i)
        num -= 1
        ans *= num
        ans %= mod
        dfs(i,finished, num)
dfs(1,finished,k)
print(ans)
Problem p02993 (python)

Fixed submission:
s = input()
for i in range(len(s) - 1):
    if s[i] == s[i+1]:
        print("Bad")
        exit()
print("Good")

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(len(s)):
    if s[i] == s[i+1]:
        print("Bad")
        exit()
print("Good")
Problem p03000 (python)

Fixed submission:
n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
length = 0
i = 0
count = 1
while n > i:
    length += L[i]
    if length <= x:
        count += 1
    i += 1
print(count)

Buggy submission (verdict: Runtime Error):
n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
length = 0
i = 0
while x >= length and n >= i:
    length += L[i]
    i += 1
print(i)

Buggy submission (verdict: Runtime Error):
n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
length = 0
i = 0
while x >= length:
    length += L[i]
    i += 1
print(i)
Problem p03005 (python)

Fixed submission:
n, k = map(int,input().split())
if (k == 1):
    print(0)
else:
    print(n - k)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
if (K == 1):
    print(0)
else:
    print(n - k)
Problem p03006 (python)

Fixed submission:
n = int(input())
data = []
for i in range(n):
    data.append(list(map(int, input().split())))
dif = dict()
data.sort()
for i in range(n):
    for j in range(i+1, n):
        x = data[i][0] - data[j][0]
        y = data[i][1] - data[j][1]
        if (x,y) in dif:
            dif[(x,y)] += 1
        else:
            dif[(x,y)] = 1
if len(dif.keys()) == 0:
    print(n)
    exit()
print(n - max([dif[i] for i in dif.keys()]))

Buggy submission (verdict: Runtime Error):
n = int(input())
data = []
for i in range(n):
    data.append(list(map(int, input().split())))
dif = dict()
data.sort()
for i in range(n):
    for j in range(i+1, n):
        x = data[i][0] - data[j][0]
        y = data[i][1] - data[j][1]
        if (x,y) in dif:
            dif[(x,y)] += 1
        else:
            dif[(x,y)] = 1
print(dif)
print(n - max([dif[i] for i in dif.keys()]))

Buggy submission (verdict: Runtime Error):
n = int(input())
data = []
for i in range(n):
    data.append(list(map(int, input().split())))
dif = dict()
for i in range(n):
    for j in range(i+1, n):
        x = data[i][0] - data[j][0]
        y = data[i][1] - data[j][1]
        if (x,y) in dif:
            dif[(x,y)] += 1
        else:
            dif[(x,y)] = 1
print(n - max([dif[i] for i in dif.keys()]))
Problem p03029 (python)

Fixed submission:
a, p = list(map(int,input().split()))
print(int(((3 * a + p) / 2)))

Buggy submission (verdict: Runtime Error):
a, p = input().split()
print((3 * a + p) / 2)
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
n = int(input())
tree = [[] for i in range(n + 1)]
for i in range(n-1):
    u, v, w = map(int, input().split())
    tree[u].append([v,w])
    tree[v].append([u,w])
finished = set()
ans = [-1 for i in range(n + 1)]
def dfs(node, weight):
    finished.add(node)
    if weight % 2 == 0:
        ans[node] = 0
    else:
        ans[node] = 1
    for i in tree[node]:
        next, w = i
        if next not in finished:
            dfs(next, w + weight)
dfs(1,0)
for i in range(1, len(ans)):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
tree = [[] for i in range(n + 1)]
for i in range(n-1):
    u, v, w = map(int, input().split())
    tree[u].append([v,w])
    tree[v].append([u,w])
finished = set()
ans = [-1 for i in range(n + 1)]
def dfs(node, weight):
    finished.add(node)
    if weight % 2 == 0:
        ans[node] = 0
    else:
        ans[node] = 1
    for i in tree[node]:
        next, w = i
        if next not in finished:
            dfs(next, w + weight)
dfs(1,0)
for i in range(1, len(ans)):
    print(ans[i])
Problem p03102 (python)

Fixed submission:
n, m, c = list(map(int ,input().split()))
b = list(map(int ,input().split()))
A = []
for i in range(n):
    A.append(list(map(int ,input().split())))
count = 0
for i in range(n):
    sum = 0
    for j in range(m):
        sum += (b[j] * A[i][j])
    if sum + c > 0:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n, m, c = list(map(int ,input().split()))
b = list(map(int ,input().split()))
A = []
for i in range(n):
    A.appened(list(map(int ,input().split())))
count = 0
for i in range(n):
    sum = 0
    for j in range(m):
        sum += (b[m] * A[n][m])
    if sum + c > 0:
        count += 1
print(count)
Problem p03136 (python)

Fixed submission:
n = int(input())
L = list(map(int, input().split()))
L.sort()
L.reverse()
if L[0] < sum(L[1:n]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
L = list(map(int, input().split()))
L.sort().reverse()
if L[0] < sum(L[1:n]):
  print("Yes")
else:
  print("No")
Problem p03138 (python)

Fixed submission:
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
bit_len = len(format(k, 'b'))
for i in range(n):
    bit_len = max(bit_len, len(format(a[i],'b')))
bit_count = [0 for i in range(bit_len)]
for i in range(n):
    bit = format(a[i], 'b').zfill(bit_len)
    for j in range(bit_len):
        if bit[j] == '1':
            bit_count[j] += 1
ans = 0
now_num = 0
for i in range(bit_len):
    if bit_count[i] < n - bit_count[i]:
        if now_num + 2 ** (bit_len - i - 1) <= k:
            now_num += 2 ** (bit_len - i - 1)
            ans += (n - bit_count[i]) * (2 ** (bit_len - i - 1))
            continue
    ans += bit_count[i] * (2 ** (bit_len - i - 1))
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = list(str(format(k, 'b')))
L = len(ans)
zero = 0
one = 0
for i in range(n):
    a[i] = str(format(a[i], 'b'))
    if len(a[i]) < L:
        a[i] = '0' * (L - len(a[i])) + a[i]
for i in range(L + 1):
    one = 0
    zero = 0
    for j in range(n):
        if a[j][i] == '0':
            zero += 1
        else:
            one += 1
    if zero > one:
        ans[i] = '1'
    else:
        ans[i] = '0'
ans = "".join(ans)
sum = 0
for i in range(n):
    a[i] = int(a[i], 2)
    sum += a[i] ^ int(ans, 2)
print(sum)

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
alpha = ''
b = []
one = 0
zero = 0
for i in range(n):
    b.append(format(a[i], '041b'))
if k == 0:
    print(sum(a))
    exit()
else:
    k = len(format(k,'b'))

for i in range(k):
    one = 0
    zero = 0
    for j in range(n):
        if b[-j][-i] == '1':
            one += 1
        else:
            zero += 1
    if one >= zero:
        alpha += '0'
    else:
        alpha += '1'
beta = int(alpha, 2)
sumA = 0
for i in range(n):
    sum += a[i] ^ beta
print(sum)
Problem p03148 (python)

Fixed submission:

n, k = list(map(int, input().split()))
sushi = []
for i in range(n):
    sushi.append(list(map(int, input().split())))
point = 0
sushi_kind = set()
duplication = []
sushi.sort(key=lambda x: x[1],reverse = True)
for i in range(k):
    point += sushi[i][1]
    if sushi[i][0] in sushi_kind:
        duplication.append(sushi[i])
    else:
        sushi_kind.add(sushi[i][0])
ans = point + pow(len(sushi_kind),2)
dup_index = len(duplication) - 1
for i in range(k,n):
    if sushi[i][0] in sushi_kind:
        continue
    else:
        if dup_index >= 0:
            point -= duplication[dup_index][1]
            dup_index -= 1
            point += sushi[i][1]
            sushi_kind.add(sushi[i][0])
    ans = max(ans, point + pow(len(sushi_kind),2))
print(ans)

Buggy submission (verdict: Runtime Error):

n, k = list(map(int, input().split()))
sushi = []
for i in range(n):
    sushi.append(list(map(int, input().split())))
point = 0
sushi_kind = set()
duplication = []
sushi.sort(key=lambda x: x[1],reverse = True)
for i in range(k):
    point += sushi[i][1]
    if sushi[i][0] in sushi_kind:
        duplication.append(sushi[i])
    else:
        sushi_kind.add(sushi[i][0])
ans = point + pow(len(sushi_kind),2)
dup_index = len(duplication) - 1
for i in range(k,n):
    if sushi[i][0] in sushi_kind:
        continue
    else:
        point += sushi[i][1]
        sushi_kind.add(sushi[i][0])
        point -= duplication[dup_index][1]
    ans = max(ans, point + pow(len(sushi_kind),2))
print(ans)
Problem p03160 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
inf = 10 ** 8 + 1
dp = [inf] * n
dp[0] = 0
dp[1] = abs(h[0] - h[1])
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])

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
inf = 10 ** 4 + 1
dp = [inf] * n
dp[0] = 0

for i in range(n - 2):
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
    dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))
dp[n - 1] = min(dp[n - 1], dp[n - 2] + abs(h[n - 2] - h[i + 1]))
print(dp[n - 1])
Problem p03161 (python)

Fixed submission:
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
inf = 10 ** 4 + 1
dp = [inf] * n
dp[0] = 0
for i in range(1,n):
    H = h[i]
    dp[i] = min([dp[j] + abs(h[j] - H) for j in range(max(0, i - k), i)])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
inf = 10 ** 4+1
dp = [inf] * n
dp[0] = 0
for i in range(n):
    dp[i] = min([dp[i - j]  + abs(h[i - j] - h[i]) for j in range(max(0,i-k),i)])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
inf = 10 ** 4+1
dp = [inf] * n
dp[0] = 0
for i in range(n):
    dp[i] = min([dp[i - j]  + abs(h[i - j] - h[i]) for j in range(max(0,i-k),i))])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
inf = 10 ** 8 + 1
dp = [inf] * n
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, n):
    for j in range(1, k):
        dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]))
print(dp[n - 1])
Problem p03163 (python)

Fixed submission:
n, W = list(map(int, input().split()))
w = [0 for i in range(n + 1)]
v = [0 for i in range(n + 1)]
for i in range(n):
    w[i + 1], v[i + 1] = list(map(int, input().split()))
dp = [[0 for i in range(W+1)] for j in range(n+1)]
for i in range(1,n+1):
    for j in range(1,W+1):
        if w[i] > j:
            dp[i][j] = dp[i - 1][j]
        else:
            dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i])
print(int(dp[n][W]))

Buggy submission (verdict: Runtime Error):
import numpy as np
n, W = list(map(int, input().split()))
w = [0 for i in range(n + 1)]
v = [0 for i in range(n + 1)]
for i in range(n):
    w[i + 1], v[i + 1] = list(map(int, input().split()))
dp = np.zeros((n + 1,W+1))
for i in range(1,n+1):
    for j in range(1,W+1):
        if w[i] > j:
            dp[i][j] = dp[i - 1][j]
        else:
            dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i])
print(int(dp[n][W]))

Buggy submission (verdict: Runtime Error):
import numpy as np
n, w = list(map(int, input().split()))
data = []
for i in range(n):
    data.append(list(map(int, input().split())))
dp = np.zeros((n + 1,w + 1))
for i in range(n):
    for j in range(w+1):
        if data[i][0] > j:
            dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
        else:
            dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - data[i][0]] + data[i][1])
print(int(dp[n - 1][w]))
Problem p03165 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**5)
s = input()
t = input()

#dp[i][j] => s[i], t[j]までの最長部分文字列

dp = [[0] * (len(t) + 1) for j in range(len(s) + 1)]
for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        if s[i-1] == t[j-1]:
            x = 1
        else:
            x = 0
        dp[i][j] = max(dp[i-1][j-1] + x, dp[i-1][j], dp[i][j-1])


def make_ans(a, b):
    if a ==  0 or b == 0:
        return 
    if s[a-1] == t[b-1]:
        make_ans(a-1,b-1)
        ans.append(s[a-1])
    else:
        if a == 0:
            make_ans(a, b - 1)
        elif b == 0:
            make_ans(a - 1,b)
        else:
            if dp[a - 1][b] > dp[a][b - 1]:
                make_ans(a-1,b)
            else:
                make_ans(a,b-1)

ans = []
make_ans(len(s),len(t))
print("".join(ans))

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

#dp[i][j] => s[i], t[j]までの最長部分文字列

dp = [[0] * (len(t) + 1) for j in range(len(s) + 1)]
for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        if s[i - 1] == t[j - 1]:
            dp[i][j] = dp[i - 1][j] + 1
        else:
            c, d = dp[i][j-1], dp[i-1][j]
            #上か左の長いほうを入れる
            if c < d:
                dp[i][j] = d
            else:
                dp[i][j] = c
def make_ans(a, b):
    if a < 0 or b < 0:
        return 
    if s[a - 1] == t[b - 1]:
        make_ans(a-1,b-1)
        ans.append(s[a-1])
    else:
        if dp[a - 1][b] > dp[a][b - 1]:
            make_ans(a-1,b)
        else:
            make_ans(a,b-1)

ans = []
make_ans(len(s),len(t))
print("".join(ans))
Problem p03166 (python)

Fixed submission:
from collections import deque
import sys 
input = sys.stdin.readline
sys.setrecursionlimit(10**5)
n, m = map(int, input().split())
adjacent_list = [[] for i in range(n+1)]
not_root = set()
for i in range(m):
    x, y = map(int, input().split())
    not_root.add(y)
    adjacent_list[x].append(y)
dp = [-1 for i in range(n+1)]
def cul(x):
    if dp[x] != -1:
        return dp[x]
    else:
        if len(adjacent_list[x]) == 0:
            return 0
        dp[x] = max([cul(i) + 1 for i in adjacent_list[x]])
        return dp[x]
for i in range(1,n+1):
    cul(i)
print(max(dp))

Buggy submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())
adjacent_list = [[] for i in range(n+1)]
not_root = set()
for i in range(m):
    x, y = map(int, input().split())
    not_root.add(y)
    adjacent_list[x].append(y)
root_cand = set(list(range(1, n+1))) - not_root
root_cand = deque(root_cand)
dp = [0] * (n+1)
def dfs(node, count):
    dp[node] = max(dp[node], count + 1)
    if len(adjacent_list[node]) != 0:
        for i in adjacent_list[node]:
            dfs(i, dp[node])

while len(root_cand) != 0:
    root = root_cand.pop()
    dfs(root, -1)
print(max(dp))
Problem p03167 (python)

Fixed submission:
from collections import deque
h, w = list(map(int, input().split()))
grid = []
for i in range(h):
    grid.append(list(input()))
#x,y渡すと、（h,w）に入ってるかどうか判定
def check(s,t):
    if (0 <=  s <= h - 1) and (0 <= t <= w - 1):
        return True
    else:
        return False
ans = [[0 for i in range(w)] for j in range(h)]
#graph => そこまでの距離を保存した二次元配列　grid=>与えられた迷路
ans[0][0] = 1
mod = 10**9+7
for i in range(h):
    for j in range(w):
        if grid[i][j] != '#':
            if i - 1 >= 0:
                ans[i][j] += ans[i-1][j]
            if j - 1 >= 0:
                ans[i][j] += ans[i][j-1]
        else:
            ans[i][j] = 0
        ans[i][j] %= mod
print(ans[-1][-1])

Buggy submission (verdict: Runtime Error):
h, w = list(map(int, input().split()))
data = []
for i in range(h):
    data.append(list(input()))
dp = [[-1 for i in range(w)] for j in range(h)]
dp[0][0] = 1
def cal(row, column):
    if row < 0 or column < 0:
        return 0

    if data[row][column] == '#':
        return 0

    if dp[row][column] == -1:
        dp[row][column]  = cal(row - 1, column) + cal(row, column - 1)


    return dp[row][column]
mod = (10 ** 9) + 7
print(cal(h - 1, w - 1) % mod)

Buggy submission (verdict: Runtime Error):
h, w = list(map(int, input().split()))
data = []
for i in range(h):
    data.append(list(input()))
dp = [[None for i in range(w)] for j in range(h)]
dp[0][0] = 1
def cal(row, column):
    if row < 0 or column < 0:
        return 0

    if data[row][column] == '#':
        return 0

    if dp[row][column] == None:
        dp[row][column]  = cal(row - 1, column) + cal(row, column - 1)


    return dp[row][column]
mod = (10 ** 9) + 7
print(cal(h - 1, w - 1) % mod)

Buggy submission (verdict: Runtime Error):
h, w = list(map(int, input().split()))
data = []
for i in range(h):
    data.append(list(input()))
dp = [[None for i in range(w)] for j in range(h)]
dp[0][0] = 1
def cal(row, column):
    if row < 0 or column < 0:
        return 0

    if data[row][column] == '#':
        return 0

    if dp[row][column] == None:
        dp[row][column]  = cal(row - 1, column) + cal(row, column - 1)
        return dp[row][column]
    else:

        return dp[row][column]
mod = (10 ** 9) +7
print(cal(h - 1, w - 1) % mod)
Problem p03197 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(n):
    if int(input()) % 2 != 0:
        print("first")
        exit()
print("second")

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
    ans += int(input())
if ans % 2 == 0:
    print("second")
else:
    print("first")
Problem p03231 (python)

Fixed submission:
from fractions import gcd
n, m = map(int, input().split())
s = input()
t = input()
#一文字目が違うと無理
gcd_n_m = gcd(n,m)
if gcd_n_m == 1 and s[0] == t[0]:
    print(n*m)
else:
    step_s = n // gcd_n_m
    step_t = m // gcd_n_m
    index_s = 0
    index_t = 0
    while index_s < n and index_t < m:
        if s[index_s] != t[index_t]:
            print(-1)
            exit()
        index_s += step_s
        index_t += step_t
    print(n*m//gcd_n_m)

Buggy submission (verdict: Runtime Error):
import fractions
n,m=map(int,input().split())
s=list(str(input()))
t=list(str(input()))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

l=lcm(n, m)
ans=[0]*(l*2)

for i in range(n):
    index=l//n*i+1

    if ans[index]==0:
        ans[index]=s[i]
#print(ans)
for i in range(m):
    index=l//m*i+1
    if ans[index]==0:
        ans[index]=t[i]
    else:
        if t[i]!=ans[index]:
            print(-1)
            exit()
#print(ans)
print(l)

Buggy submission (verdict: Runtime Error):
import fractions
n,m=map(int,input().split())
s=list(str(input()))
t=list(str(input()))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

l=lcm(n, m)
ans=[0]*(l+2)

for i in range(n):
    index=l//n*i+1

    if ans[index]==0:
        ans[index]=s[i]
#print(ans)
for i in range(m):
    index=l//m*i+1
    if ans[index]==0:
        ans[index]=t[i]
    else:
        if t[i]!=ans[index]:
            print(-1)
            exit()
#print(ans)
print(l)
Problem p03239 (python)

Fixed submission:
n, t = list(map(int, input().split()))
data = []
for i in range(n):
    data.append(list(map(int, input().split())))
minCost = 1001
for i in range(n):
    if data[i][1] <= t and minCost > data[i][0]:
        minCost = data[i][0]

if minCost == 1001:
    print("TLE")
else:
    print(minCost)

Buggy submission (verdict: Runtime Error):
n, t = list(map(int, input().split()))
data = []
for i in range(n):
    data.append(list(map(int, input().split())))
minCost = 1001
for i in range(n):
    if data[i][1] <= t && minCost > data[i][0]:
        minCost = data[i][0]

if minCost == 1001:
    print("TLE")
else:
    print(minCost)

Buggy submission (verdict: Runtime Error):
n, t = list(map(input().split()))
data = []
for i in range(n):
    data.append(list(map(input().split())))
minCost = 1001
for i in range(n):
    if data[i][1] <= t:
        minCost = data[i][0]

if minCost == 1001:
    printf("TLE")
else:
    printf(minCost)
Problem p03241 (python)

Fixed submission:
import math

n, m = list(map(int, input().split()))
reg = (m / n)
k = 1
for i in range(1, int(math.sqrt(m) + 1)):
    if m % i == 0:
        a = m/i
        b = i
        if reg >= b and k < b:
            k = b
        if reg >= a and k < a:
            k = a
print(int(k))

Buggy submission (verdict: Runtime Error):
import math

n, m = list(map(int, input().split()))
k = 0
for i in range(1, int(math.sqrt(m) + 1)):
    if m % i == 0 and m/k >= n:
        k = i
print(k)

Buggy submission (verdict: Runtime Error):
import math

n, m = list(map(int, input().split()))
k = 0
for i in range(1, int(math.sqrt(m) + 1):
    if m % i == 0:
        k = i
print(k)
Problem p03263 (python)

Fixed submission:
#奇数だったら左にずらす。
#左にずらせないのであれば、下にずらす
h, w = map(int, input().split())
grid = []
ans = []
for i in range(h):
    grid.append(list(map(int, input().split())))
for i in range(h):
    for j in range(w):
        if grid[i][j] % 2 != 0:
            if j == w - 1:
                if i != h - 1:
                    ans.append([i+1,j+1,i+2,j+1])
                    grid[i+1][j] += 1
            else:
                ans.append([i+1,j+1,i+1,j+2])
                grid[i][j+1] += 1
n = len(ans)
print(n)
for i in ans:
    print("{} {} {} {}".format(i[0], i[1],i[2],i[3]))

Buggy submission (verdict: Runtime Error):
#奇数だったら左にずらす。
#左にずらせないのであれば、下にずらす
h, w = map(int, input().split())
grid = []
ans = []
for i in range(h):
    grid.append(list(map(int, input().split())))
for i in range(h):
    for j in range(w):
        if grid[i][j] % 2 != 0:
            if j == w - 1 and i != h - 1:
                ans.append([i+1,j+1,i+2,j+1])
                grid[i+1][j] += 1
            else:
                ans.append([i+1,j+1,i+1,j+2])
                grid[i][j+1] += 1
n = len(ans)
print(n)
for i in ans:
    print("{} {} {} {}".format(i[0], i[1],i[2],i[3]))