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

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

def main():
    n, m = map(int, input().split())
    g = [[] for i in range(n)]
    deg2 = [0]*n
    atode = []
    for i in range(m):
        s, t = map(int, input().split())
        g[s-1].append(t-1)
        deg2[s-1] += 1
        atode.append((s-1,t-1))

    ee = [-1]*n
    def rec2(cur, s,t):
        if ee[cur] != -1:
            return ee[cur]
        res = 0
        cnt = 0
        for to in g[cur]:
            if cur==s and to ==t:
                continue
            res += rec2(to,s,t)+1
            cnt += 1
        if cnt:
            res /= cnt
        ee[cur] = res
        return ee[cur]

    rec2(0,-1,-1)
    ret = ee[0]

    use = [[-1, -1] for i in range(n)]
    for s,t in atode:
        if deg2[s] < 2:
            continue
        if use[s][1] < ee[t]:
            use[s][0] = t
            use[s][1] = ee[t]

    for s, (t,cost) in enumerate(use):
        if s == -1:
            continue
        ee = [-1]*n
        rec2(0,s,t)
        ret = min(ret, ee[0])
    print(ret)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

def main():
    n, m = map(int, input().split())
    g = [[] for i in range(n)]
    deg2 = [0]*n
    atode = []
    for i in range(m):
        s, t = map(int, input().split())
        g[s-1].append(t-1)
        deg2[s-1] += 1
        atode.append((s-1,t-1))


    # すべての辺について、やる
    # 辺が使える条件→fromの辺の次数が必ず2以上
    # このとき、fromよりもトポロジカル順番で後ろにあるものについては計算しなくていい

    # s,tの辺を消したときの期待値
    ee = [-1]*n
    def rec2(cur, s,t):
        # 計算済みのとき
        if ee[cur] != -1:
            return ee[cur]
        # 計算する
        res = 0
        cnt = 0
        for to in g[cur]:
            if cur==s and to ==t:
                continue
            res += rec2(to,s,t)+1
            cnt += 1
        if cnt:
            res /= cnt
        ee[cur] = res
        return ee[cur]

    # 何もしなかった時が最小値の候補の内最大
    rec2(0,-1,-1)
    ret = e[0]

    # 辺を消す候補はN個
    use = [[-1, -1] for i in range(n)]
    for s,t in atode:
        if deg2[s] < 2:
            continue
        if use[s][1] < e[t]:
            use[s][0] = t
            use[s][1] = e[t]

    for s, (t,cost) in enumerate(use):
        if s == -1:
            continue
        ee = [-1]*n
        rec2(0,s,t)
        ret = min(ret, ee[0])
    print(ret)

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

Fixed submission:
from heapq import heappop, heappush
n, m = map(int, input().split())
l = [[] for i in range(n)]
for i in range(n):
    a,b = map(int, input().split())
    c = min(m-a, n-1)
    if c < 0:
        continue
    heappush(l[c], -b)
heap = []
ans = 0
for i in range(n)[::-1]:
    for b in l[i]:
        heappush(heap, b)
    if heap:
        b = heappop(heap)
        ans += -b
print(ans)

Buggy submission (verdict: Runtime Error):
from heapq import heappop, heappush
n, m = map(int, input().split())
l = [[] for i in range(n)]
for i in range(n):
    a,b = map(int, input().split())
    c = min(m-a, n)
    if c < 0:
        continue
    heappush(l[c], -b)
heap = []
ans = 0
for i in range(n)[::-1]:
    for b in l[i]:
        heappush(heap, b)
    if heap:
        b = heappop(heap)
        ans += -b
print(ans)
Problem p02990 (python)

Fixed submission:
class PERM_COMB_MOD():
    # http://drken1215.hatenablog.com/entry/2018/06/08/210000
    def __init__(self, max_n=510000, mod=10**9+7):
        self.fac = [0]*max_n
        self.finv = [0]*max_n
        self.inv = [0]*max_n
        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1
        self.max = max_n
        self.mod = mod
        self._maesyori()

    def _maesyori(self):
        for i in range(2,self.max):
            self.fac[i] = self.fac[i-1] * i % self.mod
            self.inv[i] = self.mod - self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.finv[i] = self.finv[i-1] * self.inv[i] % self.mod

    def perm(self, n, k):
        if n < k : return 0
        if n < 0 or k < 0:return 0
        return self.fac[n] * self.finv[n-k] % self.mod % self.mod

    def comb(self, n, k):
        if n < k : return 0
        if n < 0 or k < 0:return 0
        return self.fac[n] * (self.finv[k] * self.finv[n-k] % self.mod) % self.mod

p = PERM_COMB_MOD()

mod = 10**9+7
n, k = map(int, input().split())
# n個をr個に分ける
def h(n, r):
    if n == 0 and r == 0:
        return 1
    return p.comb(n-1, r-1)

for i in range(1, k+1):
    blue = h(k, i)
    red = h(n-k, i-1) + 2*h(n-k, i) + h(n-k, i+1)
    ans = blue*red
    ans %= mod
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import math
input = sys.stdin.readline
N, K = map(int, input().split())

def combinations(n, r):
    return math.factorial(n) // math.factorial(n - r) // math.factorial(r)

for i in range(1, K+1):
    remain = N - K
    ans = combinations(remain + 1, i) % 1000000007
    ans = ans * combinations(K-1, i-1) % 1000000007
    print(ans % 1000000007 )
Problem p03055 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)

def dfs(cur, cost):
    dist[cur] = cost
    for to in G[cur]:
        if dist[to] == -1:
            dfs(to, cost+1)
dist = [-1]*n
dfs(0, 0)
m = max(dist)
for i in range(n):
    if dist[i] == m:
        start = i
        break
dist = [-1]*n
dfs(start, 0)
m = max(dist)

if m%3==1:
    print("Second")
else:
    print("First")

Buggy submission (verdict: Runtime Error):
n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)

def dfs(cur, cost):
    dist[cur] = cost
    for to in G[cur]:
        if dist[to] == -1:
            dfs(to, cost+1)
dist = [-1]*n
dfs(0, 0)
m = max(dist)
for i in range(n):
    if dist[i] == m:
        start = i
        break
dist = [-1]*n
dfs(start, 0)
m = max(dist)

if m%3==1:
    print("Second")
else:
    print("First")
Problem p03104 (python)

Fixed submission:
a, b = list(map(int, input().split()))
bin_b = bin(b)[2:]
bin_a = bin(a)[2:].zfill(len(bin_b))
ans = []
for i in range(len(bin_b)):
    cnt = b-a+1
    d = {-1:0,1:0}
    ai = bin_a[-(i+1)]
    if ai == "0":
        ai = -1
    else:
        ai = 1
    if i == 0:
        hoge = 0
        if ai == 1:
            hoge = (cnt+1)//2
        else:
            hoge = cnt//2
        if hoge%2:
            ans.append(1)
        else:
            ans.append(0)
        continue
    ai_1 = int(bin_a[-i:],2) if i >0 else 0
    start = 2**i - ai_1
    if start >= cnt:
        d[ai] += cnt
        cnt = 0
    else:
        d[ai] += start
        cnt -= start
    ai *= -1
    hoge = cnt//(2**i)
    fuga = cnt % (2**i)
    if hoge%2:
        ai *= -1
    d[ai] += fuga
    if d[1]%2:
        ans.append(1)
    else:
        ans.append(0)
e = int("".join(map(str,ans[::-1])), 2)
print(e)

Buggy submission (verdict: Runtime Error):
import math as m
a, b = list(map(int, input().split()))
bin_b = bin(b)[2:]
bin_a = bin(a)[2:].zfill(len(bin_b))
ans = []
for i in range(int(m.log2(b))+1):
    cnt = b-a+1
    d = {-1:0,1:0}
    ai = bin_a[-(i+1)]
    if ai == "0":
        ai = -1
    else:
        ai = 1
    if i == 0:
        hoge = 0
        if ai == 1:
            hoge = (cnt+1)//2
        else:
            hoge = cnt//2
        if hoge%2:
            ans.append(1)
        else:
            ans.append(0)
        continue
    ai_1 = int(bin_a[-i:],2) if i >0 else 0
    start = 2**i - ai_1
    if start >= cnt:
        d[ai] += cnt
        cnt = 0
    else:
        d[ai] += start
        cnt -= start
    ai *= -1
    hoge = cnt//(2**i)
    fuga = cnt % (2**i)
    if hoge%2:
        ai *= -1
    d[ai] += fuga
    if d[1]%2:
        ans.append(1)
    else:
        ans.append(0)
e = int("".join(map(str,ans[::-1])), 2)
print(e)
Problem p03275 (python)

Fixed submission:
from itertools import accumulate

class BIT_RSQ():
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)

    def add(self, i, v):
        while i <= self.n:
            self.data[i-1] += v
            i += i & -i

    def sum(self, i):
        ret = 0
        while(i > 0):
            ret += self.data[i-1]
            i -= i & -i
        return ret

n = int(input())
a = list(map(int, input().split()))

def check(m):
    b = [[-1,1][i>=m] for i in a]
    bit = BIT_RSQ(2*n+1)
    s = [0] + list(accumulate(b))
    res = 0
    for i in range(n):
        bit.add(s[i]+n+1, 1)
        res += bit.sum(s[i+1]+n+1)
    return res >= (n*(n+1)//2+1)//2

left = 0
right = 10**9+1
while right-left > 1:
    mid = (right+left)//2
    if check(mid):
        left = mid
    else:
        right = mid
print(left)

Buggy submission (verdict: Runtime Error):
class BIT_RSQ():
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)

    def add(self, i, v):
        while i <= self.n:
            self.data[i-1] += v
            i += i & -i

    def sum(self, i):
        ret = 0
        while(i > 0):
            ret += self.data[i-1]
            i -= i & -i
        return ret

n = int(input())
a = list(map(int, input().split()))

def check(m):
    b = [[-1,1][i>=m] for i in a]
    bit = BIT_RSQ(2*n+1)
    s = [0] + list(accumulate(b))
    res = 0
    for i in range(n):
        bit.add(s[i]+n+1, 1)
        res += bit.sum(s[i+1]+n+1)
    return res >= (n*(n+1)//2+1)//2

left = 0
right = 10**9+1
while right-left > 1:
    mid = (right+left)//2
    if check(mid):
        left = mid
    else:
        right = mid
print(left)
Problem p03291 (python)

Fixed submission:
import numpy as np
mod = 10**9 + 7

s = input()[::-1]
#s = "?"*(10**5)
n = len(s)
DP = [[0]*3 for i in range(n+1)]

power_three = 1

for i, c in enumerate(list(s)):
    for j in range(3):
        if c == "?":
            DP[i+1][j] = 3*DP[i][j] % mod
        else:
            DP[i+1][j] = DP[i][j] % mod
    if c == "C" or c == "?":
        DP[i+1][0] = (DP[i+1][0] + power_three) % mod
    if c == "B" or c == "?":
        DP[i+1][1] = (DP[i+1][1] + DP[i][0]) % mod
    if c == "A" or c == "?":
        DP[i+1][2] = (DP[i+1][2] + DP[i][1]) % mod
    if c == "?":
        power_three = 3*power_three % mod
print(DP[n][2] % mod)

Buggy submission (verdict: Runtime Error):
import numpy as np
mod = 10**9 + 7

s = input()[::-1]
n = len(s)
DP = np.zeros((n+1, 3))
#[[0]*3 for i in range(n+1)]

htn_cnt = 0
for i, c in enumerate(list(s)):
    DP[i+1]
    if c == "C" or c == "?":
        DP[i+1][0] += DP[i][0] + 3**htn_cnt
        DP[i+1][1] += DP[i][1]
        DP[i+1][2] += DP[i][2]
    if c == "B" or c == "?":
        DP[i+1][0] += DP[i][0]
        DP[i+1][1] += DP[i][1] + DP[i][0]
        DP[i+1][2] += DP[i][2]
    if c == "A" or c == "?":
        DP[i+1][0] += DP[i][0]
        DP[i+1][1] += DP[i][1]
        DP[i+1][2] += DP[i][2] + DP[i][1]
    if c == "?":
        htn_cnt += 1
    for j in range(3):
        DP[i+1][j] = DP[i+1][j] % mod
print(int(DP[n][2] % mod))
Problem p03332 (python)

Fixed submission:
from fractions import gcd

class PERM_COMB_MOD():
    # http://drken1215.hatenablog.com/entry/2018/06/08/210000
    def __init__(self, max_n=510000, mod=10**9+7):
        self.fac = [0]*max_n
        self.finv = [0]*max_n
        self.inv = [0]*max_n
        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1
        self.max = max_n
        self.mod = mod
        self._maesyori()

    def _maesyori(self):
        for i in range(2,self.max):
            self.fac[i] = self.fac[i-1] * i % self.mod
            self.inv[i] = self.mod - self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.finv[i] = self.finv[i-1] * self.inv[i] % self.mod

    def comb(self, n, k):
        if n < k : return 0
        if n < 0 or k < 0:return 0
        return self.fac[n] * (self.finv[k] * self.finv[n-k] % self.mod) % self.mod

mod = 998244353
hoge = PERM_COMB_MOD(mod=mod)
n,a,b,k = map(int, input().split())
if k % gcd(a,b) != 0:
    print(0)
    exit()
ans = 0
for i in range(n+1):
    tmp = k-a*i
    if tmp % b:
        continue
    j = tmp//b
    if j < 0 or n < j:
        continue
    ans += hoge.comb(n, i)*hoge.comb(n, j)
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

class PERM_COMB_MOD():
    # http://drken1215.hatenablog.com/entry/2018/06/08/210000
    def __init__(self, max_n=510000, mod=10**9+7):
        self.fac = [0]*max_n
        self.finv = [0]*max_n
        self.inv = [0]*max_n
        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1
        self.max = max_n
        self.mod = mod
        self._maesyori()

    def _maesyori(self):
        for i in range(2,self.max):
            self.fac[i] = self.fac[i-1] * i % self.mod
            self.inv[i] = self.mod - self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.finv[i] = self.finv[i-1] * self.inv[i] % self.mod

    def comb(self, n, k):
        if n < k : return 0
        if n < 0 or k < 0:return 0
        return self.fac[n] * (self.finv[k] * self.finv[n-k] % self.mod) % self.mod

mod = 998244353
n,a,b,k = map(int, input().split())
if k % gcd(a,b) != 0:
    print(0)
    exit()
hoge = PERM_COMB_MOD(n=n+10, mod=mod)
ans = 0
for i in range(n+1):
    tmp = k-a*i
    if tmp % b:
        continue
    j = tmp//b
    if j < 0 or n < j:
        continue
    ans += hoge.comb(n, i)*hoge.comb(n, j)
    ans %= mod
print(ans)
Problem p03634 (python)

Fixed submission:
import heapq

G = [{}]

def setNode(n):
  global G
  G = [{} for i in range(n)]
def solve(s, n):
  global G
  fixed = [None]*n
  q = []
  heapq.heappush(q, (0,s))
  while q:
    w,x = heapq.heappop(q)
    if fixed[x] is not None: continue
    fixed[x] = w
    for y in G[x]:
        if fixed[y] is None:
            heapq.heappush(q, (w + G[x][y], y))
  return fixed


n = int(input())
setNode(n)
for i in range(n-1):
  s,t,w = map(int,input().split())
  G[s-1][t-1] = w
  G[t-1][s-1] = w
Q, K = map(int, input().split())
dist = solve(K-1,n)
for i in range(Q):
    x, y = map(int,input().split())
    print(dist[x-1]+dist[y-1])

Buggy submission (verdict: Runtime Error):
def dfs_rec(start, cost, aa, bb, cc):
    use_index = []
    for i in range(aa.count(start)):
        use_index.append(aa.index(start))
    for i in range(bb.count(start)):
        use_index.append(bb.index(start))
    use_index = sorted(use_index)[::-1]
    # この点から行けるところがないとき
    if len(use_index) == 0:
        return
    for i in use_index:
        p = aa[i] if bb[i] == start else bb[i]
        DP_modoki[p-1] = cc[i] + cost
        aa.pop(i)
        bb.pop(i)
        cc.pop(i)
        dfs_rec(p, DP_modoki[p-1], aa, bb, cc)


# ダイクストラとDP?
#ある頂点pからKまでの最短距離のリストがあれば良い?
# 結局Q個その都度検索したほうが早いか?
# 意地悪なサンプルでTLEするかも
N = int(input())
a, b, c = [], [], []
for i in range(N-1):
    s1, s2, s3 = list(map(int, input().split()))
    a.append(s1)
    b.append(s2)
    c.append(s3)
Q, K = list(map(int, input().split()))
x, y = [], []
for i in range(Q):
    s1, s2 = list(map(int, input().split()))
    x.append(s1)
    y.append(s2)
# Kまでの最短距離が必要な頂点のリスト
keisan_list = list(set(x).intersection(set(y)))
# 0からN-1に注意
DP_modoki = [0 for _ in range(N)]

#ここからDP?→ではなく、深さ優先探索で全探索
# 閉路がないなら、辿っていけば最短距離?
dfs_rec(K, 0, a, b, c)
for i in range(Q):
    print(DP_modoki[x[i]-1] + DP_modoki[y[i]-1])
Problem p04049 (python)

Fixed submission:
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

sys.setrecursionlimit(10**9)


n,k = map(int, input().split())
G = [[] for i in range(n)]
edges = []
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)
    edges.append((a,b))

cnt = [0]
def search(cur, prev, depth, k):
    if depth > k:
        cnt[0] += 1
    for to in G[cur]:
        if to != prev:
            search(to, cur, depth+1, k)


ans = float("inf")
# 点中心
if k % 2 == 0:
    for i in range(n):
        cnt = [0]
        search(i, -1, 0, k//2)
        ans = min(ans, cnt[0])
# 辺中心
else:
    for a, b in edges:
        cnt = [0]
        search(a, b, 0, k//2)
        search(b, a, 0, k//2)
        ans = min(ans, cnt[0])

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

n,k = map(int, input().split())
G = [[] for i in range(n)]
edges = []
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)
    edges.append((a,b))

cnt = [0]
def search(cur, prev, depth, k):
    if depth > k:
        cnt[0] += 1
    for to in G[cur]:
        if to != prev:
            search(to, cur, depth+1, k)


ans = float("inf")
# 点中心
if k % 2 == 0:
    for i in range(n):
        cnt = [0]
        search(i, -1, 0, k//2)
        ans = min(ans, cnt[0])
# 辺中心
else:
    for a, b in edges:
        cnt = [0]
        search(a, b, 0, k//2)
        search(b, a, 0, k//2)
        ans = min(ans, cnt[0])

print(ans)
Problem p02689 (python)

Fixed submission:
n,m = map(int,input().split())
h = list(map(int,input().split()))
 
H = [0]*n
for p in range(n):
  H[p] = []
 
 
for _ in range(m):
  a,b = map(int,input().split())
 
  H[a-1].append(h[b-1])
  H[b-1].append(h[a-1])

ans = 0
i = 0
 
for one in H:
 
  i += 1
  if one == []:
    ans += 1
  else:
    for k in one:
      if k >= h[i-1]:
        break
    else:
      ans += 1
        
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
H = []
for _ in range(N):
  h = int(input())
  H.append(h)
  
edge = [[] for _ in range(N+1)]

for _ in range(M):
  a,b = map(int,input().split())
  edge[a].append(b)
  edge[b].append(a)

ans = 0

for i in range(1,N+1):
  h = H[i-1]
  for e in edge[i]:
    if h < h[e-1]:
      break
  else:
    ans += 1

print(ans)
Problem p02859 (python)

Fixed submission:
n = int(input())

print(n**2)

Buggy submission (verdict: Runtime Error):
#ABC145 E
N,T = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(N)]
ab.sort()

a = []
b = []
for ai, bi in ab:
    a.append(ai)
    b.append(bi)
    
dp = [[0 for j in range(T)] for _ in range(N+1)]
# i番目より前まで注文してT分以内(max T-1)で完食する
    
for i in range(N):
    for t in range(T): 
        if t+a[i] <= T-1:
        	dp[i+1][t+a[i]] =max(dp[i+1][t+a[i]],dp[i][t]+b[i])
        
        dp[i+1][t] = max(dp[i+1][t],dp[i][t])

#一番遅いものをラスト(T-1分)に注文
#i番目をラストに注文 = dp[i][t-1] + b[i]
ans = 0
for i in range(N):
    ans = max(ans,dp[i][t-1]+b[i])
    
print(ans)

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
a = 1
b = 1
n = (2*y-x)//3
m = (2*x-y)//3

if (x+y)%3 == 0:
  for i in range(n+1,n+m+1):
    a *= i
  for j in range(1,m+1):
    b *= j
  print(a//b)
else:
  print(0)
Problem p02879 (python)

Fixed submission:
A,B = [int(x) for x in input().split()]

if (A>=10)or(B>=10):
  print("-1")
else:
  print(A*B)

Buggy submission (verdict: Runtime Error):
A,B = [int(x) for x in input().spit()]

if (A>=10)&&(B>=10):
  print("-1")
else:
  print(A*B)

Buggy submission (verdict: Runtime Error):
A,B = int(input().split())

if (A>=10)&&(B>=10):
  print("-1")
else:
  print(A*B)

Buggy submission (verdict: Runtime Error):
A,B = int(input()).split()

if (A>=10)&&(B>=10):
  print("-1")
else:
  print(A*B)

Buggy submission (verdict: Runtime Error):
A,B = [int(i) i for input().split(" ")]

if A >= 10 && B >=10:
  print("-1")
else:
  print(A*B)

Buggy submission (verdict: Runtime Error):
if ((0<A<9)&&(0<B<9)):
  return A*B
else:
  return "-1"
Problem p02881 (python)

Fixed submission:
n = int(input())
 
import math
max = math.trunc(n**0.5)
for i in range(max,0,-1):
  if n % i == 0:
    j = int(n / i)
    print(i+j-2)
    break

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

import math
max = math.trunc(n**0.5)
for i in range(max:0:-1):
  if n % i == 0:
    j = n / i
    print(i+j-2)
Problem p02897 (python)

Fixed submission:
n = int(input())
import random
 
print(1-(n//2)/n)

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

if n % 2 == 0:
  print(0.5)
else:
  print(n-1/2n)
Problem p02570 (python)

Fixed submission:
d, t, s = list(map(int, input().split(' ')))
if (s * t >= d):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
d, t, s = list(map(int, input()))
if (s * t >= d):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
d, t, s = list(map(int, input()))
if (s * t >= d):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
d, t, s = list(map(int, input()))
print(s * t >= d)
Problem p02547 (python)

Fixed submission:
n=int(input())

c=0
flag=0
for i in range(n):
  a,b = map(int,input().split())
  if(a==b):
    c+=1
  else:
    c=0
  if(c==3):
    print("Yes")
    flag=1
    break
if(flag==0):
  print("No")

Buggy submission (verdict: Runtime Error):
n=input()

c=0
flag=0
for i in range(n):
  a,b = map(int(),input().split())
  if(a==b):
    c+=1
  else:
    c=0
  if(c==3):
    print("Yes")
    flag=1
    break
if(flag==0):
  print("No")

Buggy submission (verdict: Runtime Error):
n=input()

c=0
flag=0
for i in range(n):
  a,b = map(int,input().split())
  if(a==b):
    c+=1
  else:
    c=0
  if(c==3):
    print("Yes")
    flag=1
    break
if(flag==0):
  print("No")
Problem p02935 (python)

Fixed submission:
import numpy as np

def set_list(es):
    return len(list(set(es))) == 1

n = int(input())
a = [int(i) for i in input().split()]

if(len(a)==2):
    print((a[0]+a[1])/2)    
elif(len(a)!=2 and set_list(a)):
    print(a[0])
else:
    for i in range(1,n):
        idx = np.argmin(a)
        num1 = a.pop(idx)
        idx = np.argmin(a)
        num2 = a.pop(idx)
        a.append((num1+num2)/2)
    print(a[0])

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

def set_list(es):
    return len(list(set(es))) == 1

n = int(input())
a = [int(i) for i in input().split()]

if(len(a)==2):
    print((a[0]+a[1])/2)  
elif(len(a)!=2 and set_list(a)):
    print(a[0])
else:
  for i in range(1,n):
    idx = np.argmin(a)
    num1 = a.pop(idx)
    idx = np.argmin(a)
    num2 = a.pop(idx)
    a.append((num1+num2)/2)
	print(a[0])
Problem p02948 (python)

Fixed submission:
import heapq

n,m = (int(i) for i in input().split())
jobs = [[] for i in range(m)]
for i in range(n):
    tmp,tmp2 = (int(i) for i in input().split())
    if(tmp>m):
        continue
    jobs[m-tmp].append(tmp2)
    
ans = 0
h=[]
for i in range(m-1,-1,-1):
    for b in jobs[i]:
        heapq.heappush(h,-b)
        
    if(len(h)!=0):
        a = -heapq.heappop(h)
        ans += a

print(ans)

Buggy submission (verdict: Runtime Error):
import heapq

n,m = (int(i) for i in input().split())
jobs = [[] for i in range(m)]
for i in range(n):
    tmp,tmp2 = (int(i) for i in input().split())
    if(tmp>m):
        continue
    jobs[m-tmp].append(tmp2)
    
ans = 0
h=[]
for i in range(m-1,-1,-1):
    for b in jobs[i]:
        heapq.heappush(h,b)
        heapq._heapify_max(h)
        
    if(len(h)!=0):
        ans += heapq._heappop_max(h)
        print(h)

print(ans)

Buggy submission (verdict: Runtime Error):
n,m = (int(i) for i in input().split())
a=[]
b=[]
jobs = [[] for i in range(m)]
for i in range(n):
    tmp,tmp2 = (int(i) for i in input().split())
    if(tmp>m):
        continue
    a.append(tmp)
    b.append(tmp2)
    jobs[m-tmp].append(tmp2)
    
ans = 0
h=[]
for i in range(m-1,-1,-1):
    for b in jobs[i]:
        heapq.heappush(h,b)
        heapq._heapify_max(h)
        
    if(len(h)!=0):
        ans += heapq._heappop_max(h)

print(ans)
Problem p02951 (python)

Fixed submission:
a,b,c = (int(i) for i in input().split())

if(b+c-a>=0):
  print(b+c-a)
else:
  print(0)

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

flag = 1
for i in range(len(h)-1):
    for j in range(i+1,len(h)):
        if(h[i]-h[j]>=2):
            print("No")
            flag=0
            break
    if(flag==0):
        break
            
if(flag==1):
    print("Yes")