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

Fixed submission:
import math

n, k = map(int, input().split())
mod = 10 ** 9 + 7

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


for i in range(1, k + 1):
    # print("{0}C{1} * {2}C{3}".format(n - k + 1, i, k-1,i-1))
    if n -k +1 >=i:
        print(((cmb_count((n - k + 1), i) % mod) * (cmb_count(k - 1, i - 1)) % mod))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
mod = 10 ** 9 + 7


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


for i in range(1, k + 1):
    # print("{0}C{1} * {2}C{3}".format(n - k + 1, i, k-1,i-1))
    print(((cmb_count((n - k + 1), i) % mod) * (cmb_count(k - 1, i - 1)) % mod))

Buggy submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())
mod = 10**9+7

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

for i in range(1, k + 1):
    print((cmb_count((n - k + 1), i) * cmb_count(k - 1, i - 1)) % mod)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(1000000)
n, k = map(int, input().split())
mod = 10**9+7

nCr = {}


def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n, r) in nCr: return nCr[(n, r)]
    nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)
    return nCr[(n, r)]


for i in range(1, k + 1):
    # print("{0}C{1} * {2}C{3}".format(n - k + 1, i, k-1,i-1))
    print((cmb((n - k + 1), i) * cmb(k - 1, i - 1)) % mod)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10000000)
n, k = map(int, input().split())
mod = 10**9+7

nCr = {}


def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n, r) in nCr: return nCr[(n, r)]
    nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)
    return nCr[(n, r)]


for i in range(1, k + 1):
    # print("{0}C{1} * {2}C{3}".format(n - k + 1, i, k-1,i-1))
    print((cmb((n - k + 1), i) * cmb(k - 1, i - 1)) % mod)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(1000000)
n, k = map(int, input().split())

nCr = {}


def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n, r) in nCr: return nCr[(n, r)]
    nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)
    return nCr[(n, r)]


for i in range(1, k + 1):
    # print("{0}C{1} * {2}C{3}".format(n - k + 1, i, k-1,i-1))
    print(cmb((n - k + 1), i) * cmb(k - 1, i - 1))
Problem p03208 (python)

Fixed submission:
n,k = map(int,input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
h_max = 0
h_min = 0
r = 0
ans = []
#print(h)
for i in range(r,n-k+1):
    if n - r < k: 
        break
    h_max = h[r+k-1]
    #print(h[r:k])
    h_min = h[r]
    ans.append(h_max - h_min)
    r += 1
print(min(ans))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
h_max = 0
h_min = 0
r = 0
ans = []
#print(h)
for i in range(r,n-k+1):
    if n - r < k: 
        break
    h_max = h[r+k]
    #print(h[r:k])
    h_min = h[r])
    ans.append(h_max - h_min)
    r += 1
print(min(ans))

Buggy submission (verdict: Runtime Error):
Cn,k = map(int,input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
h_max = 0
h_min = 0
r = 0
ans = []
#print(h)
for i in range(r,n):
    h_max = max(h[r:k+r])
    #print(h[r:k])
    h_min = min(h[r:k+r])
    if n -r < k: 
        break
    ans.append(h_max - h_min)
    r += 1
print(min(ans))
Problem p03011 (python)

Fixed submission:
l = list(map(int,input().split()))
a = l.pop(l.index(min(l)))
b = l.pop(l.index(min(l)))
print(a+b)

Buggy submission (verdict: Runtime Error):
l = list(map(int,input().split()))
a = l.pop(min(l))
b = l.pop(min(l))
print(a+b)
Problem p03041 (python)

Fixed submission:


n,k = map(int,input().split(" "))
S = list(input())

s = S[k-1]
if s == "A" :
	S[k-1] = "a"
elif s == "B" :
	S[k-1] = "b"
else :
	S[k-1] = "c"

print("".join(S))

Buggy submission (verdict: Runtime Error):


n,k = map(int,input().split(" "))
S = list(input())

s = S[k-1]
if s == "A" :
	S[k-1] = "a"
elif s == "B" :
	s[k-1] = "b"
else :
	s[k-1] = "c"

print("".join(S))
Problem p02912 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Oct  2 07:56:16 2019

@author: avina
"""
from queue import PriorityQueue as Q
n,t = map(int,input().split())

q = Q()
for i in input().split():
    a = -1*int(i)
    q.put(a)

while t >0:
    a = -1*(q.get())
    a = -1*(a//2)
    q.put(a)
    t-=1

ans = 0
while q.qsize()>0:
    ans += q.get()
print(-1*ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Thu Oct  3 07:43:37 2019

@author: avina
"""

import heapq

class Maxheap():
    
    def __init__(self, x):
        self.heap = [-e for e in x]
        heapq.heapify(self.heap)
    
    def push(self, value):
        heapq.heappush(self.heap, -value)
    
    def pop(self):
        return -heapq.heappop(self.heap)

n,t = map(int, input().split())

l = list(map(int, input().split()))
a = Maxheap(l)
for i in range(l):
    b = a.pop()//2
    a.push(b)
    
sums = 0
for i in range(n):
    sums += a.pop()
print(sums)
Problem p03073 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon May 13 09:24:23 2019

@author: avina
"""

s = input().strip()

k = s[0]
cnt_1 = 0;cnt_2 = 1
for i in range(1,len(s)):
    if k == s[i] and i%2 !=0:
        cnt_1+=1
    
    if i%2 ==0 and k != s[i]:
        cnt_1+=1
if k == '1':
    e = '0'
else :
    e = '1'

for i in range(1,len(s)):
    
    if e != s[i] and i%2 ==0:
        cnt_2 +=1
    
    if e == s[i] and i%2 != 0:
        cnt_2+=1

print(min(cnt_1, cnt_2))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Mon May 13 09:24:23 2019

@author: avina
"""

s = input().strip()

k = s[0]
cnt_1 = 0;cnt_2 = 1
for i in range(1,len(s)):
    if k == s[i] and i%2 !=0:
        cnt_1+=1
    
    if i%2 ==0 and k != s[i]:
        cnt_1+=1
        e =s[i]

for i in range(1,len(s)):
    
    if e != s[i] and i%2 ==0:
        cnt_2 +=1
    
    if e == s[i] and i%2 != 0:
        cnt_2+=1

print(min(cnt_1, cnt_2))
Problem p03013 (python)

Fixed submission:
n, m = map(int, input().split())
mod = 10 ** 9 + 7
A = []
for i in range(m):
    A.append(int(input()))
    
dp = [None for i in range(n + 1)]
dp[0] = 1

for a in A:
    dp[a] = 0
    
for i in range(1,n+1):
    if dp[i] != 0:
        dp[i] = 0
        if i >= 2:
            dp[i] += (dp[i-2] + dp[i-1]) % mod
        elif i == 1:
            dp[i] += dp[i-1] % mod
            
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
 
A = []
for i in range(m):
    A.append(int(input()))
    
dp = [0 for i in range(n + 1)]
dp[0] = 1
 
count = 0
for i in range(n+1):
    if  i !=  A[min(count, len(A)-1)]:
        if i >= 2:
            dp[i] += (dp[i-2] + dp[i-1]) % (10 ** 9 + 7)
        elif i == 1:
            dp[i] += dp[i-1] % (10 ** 9 + 7)
    else:
            count += 1
            
print(dp[-1] % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
 
A = []
for i in range(m):
    A.append(int(input()))
    
dp = [0 for i in range(n + 1)]
dp[0] = 1
 
count = 0
for i in range(n+1):
    if  i !=  A[count]:
        if i >= 2:
            dp[i] += (dp[i-2] + dp[i-1]) % (10 ** 9 + 7)
        elif i == 1:
            dp[i] += dp[i-1] % (10 ** 9 + 7)
    else:
            count += 1
            
print(dp[-1] % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
 
A = []
for i in range(m):
    A.append(int(input()))
    
dp = [0 for i in range(n + 1)]
dp[0] = 1
 
count = 0
for i in range(n+1):
    if  i !=  A[min(count, len(A)-1)]:
        if i >= 2:
            dp[i] += (dp[i-2] + dp[i-1]) % (10 ** 9 + 7)
        elif i == 1:
            dp[i] += dp[i-1] % (10 ** 9 + 7)
    else:
            count += 1
            
print(dp[-1] % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
 
A = []
for i in range(m):
    A.append(int(input()))
    
dp = [0 for i in range(n + 1)]
dp[0] = 1
 
count = 0
for i in range(n+1):
    count = min(m-1, count)
    if  i !=  A[count]:
        if i >= 2:
            dp[i] += (dp[i-2] + dp[i-1]) % (10 ** 9 + 7)
        elif i == 1:
            dp[i] += dp[i-1] % (10 ** 9 + 7)
    else:
            count += 1
            
print(dp[-1] % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())

A = []
for i in range(m):
    A.append(int(input()))
    
dp = [0 for i in range(n + 1)]
dp[0] = 1

count = 0
for i in range(n+1):
    if  i !=  A[count]:
        if i >= 2:
            dp[i] += (dp[i-2] + dp[i-1]) % (10 ** 9 + 7)
        elif i == 1:
            dp[i] += dp[i-1] % (10 ** 9 + 7)
    else:
        if count < m-1:
            count += 1
            
print(dp[-1] % (10 ** 9 + 7))
Problem p03038 (python)

Fixed submission:
N, M = map(int, input().split())
A = [int(i) for i in input().split()]

D = {}
for i in range(M):
    b,c = map(int, input().split())
    if c in D:
        D[c] += b
    else:
        D[c] = b
        
for a in A:
    if a in D:
        D[a] += 1
    else:
        D[a] = 1
        
D_sort = sorted(D.items(), reverse=True)
check = 0
ans = 0
for d in D_sort:
    check += d[1]
    if check <= N:
        ans += d[0] * d[1]
    else:
        ans += d[0] * (d[1] - (check - N))
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
 
A = [int(i) for i in input().split()]
 
L = []
for i in range(m):
    b,c = map(int, input().split())
    L.append((b,c))
    
A = sorted(A)
 
from bisect import bisect_left
import numpy as np
A = np.array(A)
for l in L:
    tmp0 = l[0]
    tmp1 = l[1]
    A_select = A[0:tmp0]
    A_len = bisect_left(A_select, tmp1)
    A[0:A_len] = tmp1
    A = np.sort(A)
    
    
print(sum(A))
Problem p03208 (python)

Fixed submission:
n, k = map(int, input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
a = []
for i in range(n-k+1):
    a.append(h[i+k-1] - h[i])
print(min(a))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
a = []
for i in range(n-2):
    a.append(h[i+k-1] - h[i])
print(min(a))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())

h = []
for i in range(n):
    h.append(int(input()))
h.sort()
ans = 1000000000000000000000000000
for i in range(n-2):
    a = h[i+k-1] - h[i] 
    ans = min(ans, a)
print(ans)
Problem p03221 (python)

Fixed submission:
n, m = map(int, input().split())
D = [[] for _ in range(n)]
for i in range(m):
    p,y = map(int, input().split())
    D[p-1].append((y,i))
ans = [None] * m
for i,d in enumerate(D):
    d.sort()
    for j, (k,l) in enumerate(d):
        ans[l] = str(i+1).zfill(6) + str(j+1).zfill(6)
for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
a = [[] for _ in range(m)]

count = 1
for i in range(m):
    p,y = map(int, input().split())
    a[p-1].append([y, count])
    count += 1
b = []
for i,j in enumerate(a):
    j_sort = sorted(j)
    for k,l in enumerate(j_sort):
        b.append([l[1],str(i+1).zfill(6)+str(k+1).zfill(6)])
        
for i in sorted(b):
    print(i[1])
Problem p03329 (python)

Fixed submission:
n = int(input())
max_n = 10 ** 5

dp = [int(i) for i in range(max_n + 1)]

for i in (6,9):
    v = i
    while v < max_n:
        for j in range(len(dp)):
            if j + v < max_n+1:
                dp[j+v] = min(dp[j+v],dp[j]+1)
        v *= i
        
print(dp[n])

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

max_range = 10 ** 5
dp = [int(i) for i in range(max_range + 1)]

for i in [6,9]:
    check = i
    while check < max_range:
        for j in range(max_range + 1):
            if j - check >= 0:
                dp[j] = min(dp[j],dp[j-check] + 1)

        check =  check *
        
print(dp[n])
Problem p02916 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n-1):
  if (a[i+1]-a[i])==1:
    s+=c[a[i]-1]
print(s+sum(b))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
sum=0
for i in range(n-1):
  if (a[i+1]-a[i])==1:
    sum+=c[a[i]-1]
print(sum(b)+sum)
Problem p02916 (python)

Fixed submission:
# -*- coding:utf8 -*-

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

ans = 0
for i in range(n):
    ans += b[a[i] - 1]
    if i != 0 and a[i] == a[i - 1] + 1:
        ans += c[a[i - 1] - 1]
print(ans)

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

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

ans = 0
for i in range(n):
    ans += b[a[i - 1]]
    if i != 0 and a[i] == a[i - 1] + 1:
        ans += c[a[i - 1] - 1]
print(ans)

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

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

ans = 0
for i in range(n):
    ans += b[a[i]]
    if i != 0 and a[i] == a[i - 1] + 1:
        ans += c[a[i - 1] - 1]
print(ans)

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

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

ans = 0
for i in range(n):
        ans += b[a[i]]
        if i != 0 and a[i] == a[i - 1] + 1:
                ans += c[a[i - 1]]
print(ans)
Problem p02935 (python)

Fixed submission:
n=int(input())
v=list(map(int, input().split()))

v.sort()
#print(v)
subtotal=(v[0]+v[1])/2

for i in range(n-2):
    subtotal = (subtotal+v[i+2])/2
print(subtotal)

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int, input().split()))

v.sort()
print(v)
#subtotal=(v[0]+v[1])/2

for i in range(n-2):
    subtotal = (subtotal+v[i+2])/2
print(subtotal)
Problem p02933 (python)

Fixed submission:
a=int(input())
s=str(input())

if(a>=3200):
  print(s)
else:
  print('red')

Buggy submission (verdict: Runtime Error):
a=int(input().split())
s=str(input().split())

if(a>=3200):
  print('red')
else:
  print(s)

Buggy submission (verdict: Runtime Error):
a=int(input())
s=str(input())

if(a>=3200):
  print('red')
 else:
  print(s)
Problem p03326 (python)

Fixed submission:
import sys
import itertools

cin = sys.stdin
# cin = open("in.txt", "r")


def line2N():
    return map(int, cin.readline().split())


N, M = line2N()
if M==0:
    print(0)
    exit(0)
x = [0] * N
y = [0] * N
z = [0] * N
for i in range(N):
    x[i], y[i], z[i] = line2N()

rMax = 0
for sx, sy, sz in itertools.product((-1,1), repeat=3):
    s = [sx * xi + sy * yi + sz * zi for xi, yi, zi in zip(x, y, z)]
    s.sort()
    rMax = max(rMax, sum(s[-M:]))

print(rMax)

Buggy submission (verdict: Runtime Error):
import sys

cin = sys.stdin
# cin = open("in.txt", "r")


def line2N():
    return map(int, cin.readline().split())


N, M = line2N()
x = [0] * N
y = [0] * N
z = [0] * N
for i in range(N):
    x[i], y[i], z[i] = line2N()

vis = [False] * N
pool = set(range(N))

if M==0:
    print(0)
    exit(0)

rMax = 0
for k0 in range(N):
    k = k0
    pool = set(range(N))
    x0, y0, z0 = x[k], y[k], z[k]
    pool.remove(k)
    for i in range(M-1):
        k = -1
        maxV = 0
        for p in pool:
            v = abs(x0 + x[p]) + abs(y0+y[p]) + abs(z0+z[p])
            if v>maxV:
                maxV = v
                k = p
        x0, y0, z0 = x0 + x[k], y0+y[k], z0+z[k]
        pool.remove(k)
    maxV = abs(x0) + abs(y0) + abs(z0)
    if rMax<maxV:
        rMax = maxV

print(rMax)
Problem p03003 (python)

Fixed submission:
MOD = 10**9 + 7

n,m = (int(num) for num in input().split())
s = [int(num) for num in input().split()]
t = [int(num) for num in input().split()]

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

for i in range(1,n+1):
    for j in range(1,m+1):
        dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1]
        if s[i-1] == t[j-1]:
            dp[i][j] += dp[i-1][j-1]
        dp[i][j] = dp[i][j] % MOD
        
        
print(dp[n][m])

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
const ll mod = 1000000007;

using namespace std;

int n, m;
int s[2010], t[2010];
int dp[2010][2010];

signed main() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> s[i];
    for (int i = 0; i < m; i++) cin >> t[i];

    for (int i = 0; i <= 2009; i++) {
        for (int j = 0; j <= 2009; j++) {
            dp[i][j] = 1;
        }
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
            dp[i][j] += mod - dp[i-1][j-1];
            if (s[i - 1] == t[j - 1]) dp[i][j] += dp[i - 1][j - 1];
            dp[i][j] %= mod;
        }
    }

    cout << dp[n][m] << endl;
}

// 共通部分列
Problem p02915 (python)

Fixed submission:
n = int(input())

print(n ** 3)

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

print(n ** 3
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if a>=3200: print(s)
else: print('red')

Buggy submission (verdict: Runtime Error):
if int(input())>=3200: print(input()) else print('red')

Buggy submission (verdict: Runtime Error):
if int(input())>=3200: print(input());else: print('red')
Problem p02935 (python)

Fixed submission:
N = int(input())
v = list(map(int, input().split()))

v_s = sorted(v)

out = 0
for i in range(N):
  if i == 0:
    out += v_s[i]*((1/2)**(N-1))
  else:
    out += v_s[i]*((1/2)**(N-i))
  
print(out)

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

v_sorted = sorted(v)

out = 0
for i in range(N-1):
  out += v_sorted[i]*(1/2)^(N-1-i)

print(out+v_sorted[-1]*(1/2))
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if a < 3200:
  print('red')
else:
  print(s)

Buggy submission (verdict: Runtime Error):
a = int(input())
s = input()
if a < 3200:
  print('red')
else:
  print(s
Problem p02925 (python)

Fixed submission:
N = int(input())
A = [[x - 1 for x in list(map(int, input().split()))] for i in range(N)]

days = 0
cand = set(range(N))

while True:
    games = set() # その日に試合ができるプレイヤーの集合
    
    for p in cand:
        if A[p] != []:
            if A[ A[p][0] ][0] == p:
                games.add(p)
                games.add(A[p][0])
            
    # print(A)
    
    if not games: # その日の試合が開催されない
        if any(A): # 未だ組み合わせ希望が残っている
            print(-1) # 大会の組み合わせ希望は不可能
            break
        else: # 大会が終了
            print(days)
            break
    else:
        for i in games:
            A[i].pop(0)

    days += 1
    cand = games # 前日試合をした選手の中から、その日試合する選手を選択

Buggy submission (verdict: Runtime Error):
days = 0
cand = set(range(N))

while True:
    games = set() # その日に試合ができるプレイヤーの集合
    
    for p in cand:
        if A[p] != []:
            if A[ A[p][0] ][0] == p:
                games.add(p)
                games.add(A[p][0])
    
    if not games: # その日の試合が開催されない
        if any(A): # 未だ組み合わせ希望が残っている
            print(-1) # 大会の組み合わせ希望は実現不可能
            break
        else: # 大会が終了
            print(days)
            break
    else: #その日の試合が開催された
        for i in games:
            A[i].pop(0) # 大会の組み合わせ希望から、該当する試合を取り除く

    days += 1
    # cand = games # 前日試合をした選手の中から、その日試合する選手を選択

Buggy submission (verdict: Runtime Error):
days = 0
cand = set(range(N))

while True:
    games = set() # その日に試合ができるプレイヤーの集合
    
    for p in cand:
        if A[p] != []:
            if A[ A[p][0] ][0] == p:
                games.add(p)
                games.add(A[p][0])

    if not games: # その日の試合が開催されない
        if any(A): # 未だ組み合わせ希望が残っている
            print(-1) # 大会の組み合わせ希望は実現不可能
            break
        else: # 大会が終了
            print(days)
            break
    else: #その日の試合が開催された
        for i in games:
            A[i].pop(0) # 大会の組み合わせ希望から、該当する試合を取り除く

    days += 1
Problem p03803 (python)

Fixed submission:
A, B = map(int, input().split())
if(A ==1):
  A += 13
if(B ==1):
  B += 13
if(A > B):
  print("Alice")
elif(B > A):
  print("Bob")
else:
  print("Draw")

Buggy submission (verdict: Runtime Error):

A = int(input())
B = int(input())
if(A > B):
  print("Alice")
elif(B > A):
  print("Bob")
else:
  print("Draw")

Buggy submission (verdict: Runtime Error):
A = int(input())
b = int(input())
if(A > B):
  print("Alice")
elif(B > A):
  print("Bob")
else:
  print("Draw")

Buggy submission (verdict: Runtime Error):
if(A > B):
  print("Alice")
elif(B > A):
  print("Bob")
else:
  print("Draw")
Problem p02951 (python)

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


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

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input.split())


print(c-(a-b))
Problem p03834 (python)

Fixed submission:
s = input().replace(','," ")
print(s)

Buggy submission (verdict: Runtime Error):
s = list(str(input()))

print(s[0]+s[1]+s[2]+s[3]+s[4])+" "+s[6]+s[7]+s[8]+s[9]+s[10]+s[11]+s[12]+" "+s[14]+s[15]+s[16]+s[17]+s[18])
Problem p02948 (python)

Fixed submission:
def main():
    # ヒープキューをインポート
    from heapq import heappush, heappop
 
    n, m = map(int, input().split())
    jobs = [[] for _ in range(m)]  # 締め切り別に，報酬を管理
 
    # See:
    # https://www.youtube.com/watch?v=1Z6ofKN03_Y
    for i in range(n):
        ai, bi = map(int, input().split())
 
        # 報酬が振り込まれる日がM日よりも後になる場合は除外
        if ai > m:
            continue
 
        # i件目のアルバイトを遅くてもいつまでに始める必要があるかを計算
        # heappopは最小値を返す．biを-1倍することで，最大値が取り出せる
        deadline = m - ai
        jobs[deadline].append(-bi)
 
    ans = 0
    reward = []
 
    # M-1日に始める必要があるアルバイトのうち，最も報酬の高いものを選択
    # 以降，今日始める必要があるアルバイトまで，順番に調べる
    # ある時点で得られる報酬の大小に着目
    for i in range(m - 1, -1, -1):
        for job in jobs[i]:
            # ヒープキューに，報酬の候補を追加
            heappush(reward, job)
 
        # 条件を満たすもののうち，最大の報酬を選択
        if reward:
            ans += heappop(reward)
 
    # ヒープキューに追加するときに，-1倍した分を元に戻す
    print(-ans)
 
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
Copy
# -*- coding: utf-8 -*-
 
 
def main():
    # ヒープキューをインポート
    from heapq import heappush, heappop
 
    n, m = map(int, input().split())
    jobs = [[] for _ in range(m)]  # 締め切り別に，報酬を管理
 
    # See:
    # https://www.youtube.com/watch?v=1Z6ofKN03_Y
    for i in range(n):
        ai, bi = map(int, input().split())
 
        # 報酬が振り込まれる日がM日よりも後になる場合は除外
        if ai > m:
            continue
 
        # i件目のアルバイトを遅くてもいつまでに始める必要があるかを計算
        # heappopは最小値を返す．biを-1倍することで，最大値が取り出せる
        deadline = m - ai
        jobs[deadline].append(-bi)
 
    ans = 0
    reward = []
 
    # M-1日に始める必要があるアルバイトのうち，最も報酬の高いものを選択
    # 以降，今日始める必要があるアルバイトまで，順番に調べる
    # ある時点で得られる報酬の大小に着目
    for i in range(m - 1, -1, -1):
        for job in jobs[i]:
            # ヒープキューに，報酬の候補を追加
            heappush(reward, job)
 
        # 条件を満たすもののうち，最大の報酬を選択
        if reward:
            ans += heappop(reward)
 
    # ヒープキューに追加するときに，-1倍した分を元に戻す
    print(-ans)
 
 
if __name__ == '__main__':
    main()
Problem p02970 (python)

Fixed submission:
import math
N,D=map(int,input().split())
print(math.ceil(N/(D*2+1)))

Buggy submission (verdict: Runtime Error):
import math
N,D=input().split()
print(math.ceil(N/(D*2+1)))
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()

if a >=3200:
  print(s)
else:
  print("red")

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

if a >= 3200:
  print(s)
else:
  print("red")