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

Fixed submission:
#author : dokueki

import sys


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def main():
    x, y, a, b, c = map(int, sys.stdin.readline().split())
    r = list(map(int, sys.stdin.readline().split()))
    g = list(map(int, sys.stdin.readline().split()))
    blind = list(map(int, sys.stdin.readline().split()))
    r.sort(reverse=True)
    g.sort(reverse=True)
    blind.sort(reverse=True)
    red_need = r[:x]
    green_need = g[:y]
    res = red_need + green_need
    res.sort()
    #print(res)
    for i in range(min(c,len(res))):
        if blind[i] > res[i]:
            res[i] = blind[i]
    print(sum(res))


if __name__ == "__main__":
    # IOE()
    main()

Buggy submission (verdict: Runtime Error):
#author : dokueki

import sys


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def main():
    x, y, a, b, c = map(int, sys.stdin.readline().split())
    r = list(map(int, sys.stdin.readline().split()))
    g = list(map(int, sys.stdin.readline().split()))
    blind = list(map(int, sys.stdin.readline().split()))
    r.sort(reverse=True)
    g.sort(reverse=True)
    blind.sort(reverse=True)
    red_need = r[:x]
    green_need = g[:y]
    res = red_need + green_need
    res.sort()
    #print(res)
    for i in range(c):
        if blind[i] > res[i]:
            res[i] = blind[i]
    print(sum(res))


if __name__ == "__main__":
    # IOE()
    main()

Buggy submission (verdict: Runtime Error):
#author : dokueki

import sys


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def main():
    x, y, a, b, c = map(int, sys.stdin.readline().split())
    r = list(map(int, sys.stdin.readline().split()))
    g = list(map(int, sys.stdin.readline().split()))
    blind = list(map(int, sys.stdin.readline().split()))
    r.sort()
    g.sort()
    blind.sort(reverse=True)
    red_need = r[-x:a]
    green_need = g[-y:b]
    res = red_need + green_need
    res.sort()
    # print(res)
    for i in range(c):
        if blind[i] > res[i]:
            res[i] = blind[i]
    print(sum(res))


if __name__ == "__main__":
    #IOE()
    main()
Problem p02786 (python)

Fixed submission:
import math
n = int(input())
k = math.log(n, 2) + 1
print(2**math.floor(k)-1)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
k = math.log2(n) + 1
print(2**math.floor(k)-1)
Problem p02801 (python)

Fixed submission:
"""
author : dokueki
"""
s = input()
t = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(t)):
    if t[i] == s:
        print(t[i+1])
        break

Buggy submission (verdict: Runtime Error):
"""
author : dokueki
"""
s = input()
t = "abcdefghijklmnopqrstuvwxyza"
for i in range(len(t)):
    if t[i] == a:
        print(t[i+1])
        break
Problem p02813 (python)

Fixed submission:
from itertools import permutations

n = int(input())
a = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))
x, y = 0, 0
perm = list(permutations(list(range(1, n+1))))
# print(perm)
for i in perm:
    if i == a:
        x = perm.index(i)
    if i == b:
        y = perm.index(i)
print(abs(x-y))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))
x, y = 0, 0
perm = list(permutations(list(range(1, n+1))))
# print(perm)
for i in perm:
    if i == a:
        x = perm.index(i)
    if i == b:
        y = perm.index(i)
print(abs(x-y))
Problem p03059 (python)

Fixed submission:
a,b,k = map(int,input().split())
print(b*(k//a))

Buggy submission (verdict: Runtime Error):
"""
~~ Author : Bhaskar
~~ Dated : 07~06~2020
"""

import sys
from bisect import *
from math import floor,sqrt,ceil,factorial as F,gcd,pi,log
from itertools import chain,combinations,permutations,accumulate
from collections import Counter,defaultdict,OrderedDict,deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)-1
mod = 1000000007
ch = "abcdefghijklmnopqrstuvwxyz"
lcm = lambda a,b : (a*b)//gcd(a,b)
setbit = lambda x : bin(x)[2:].count("1")

def solve():
    a,b,k = map(int,sys.stdin.readline().split())
    print(b*(k//a))

if __name__ == "__main__":
    try:
        sys.stdin = open("input.txt","r")
    except :
        pass
    solve()
Problem p03061 (python)

Fixed submission:
import sys
# from math import gcd
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)
n = int(sys.stdin.readline())
a = list(map(int,sys.stdin.readline().split()))
pref,suf = [0]*(n+2),[0]*(n+2)
pref[1] = a[0]
for i in range(2,n+1):
    pref[i] = gcd(pref[i-1],a[i-1])
suf[n] = a[n-1]
for i in range(n-1,0,-1):
    suf[i] = gcd(suf[i+1],a[i-1])
ans = max(suf[2],pref[n-1])
for i in range(2,n):
    ans = max(ans,gcd(pref[i-1],suf[i+1]))
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n = int(sys.stdin.readline())
a = list(map(int,sys.stdin.readline().split()))
pref,suf = [0]*(n+2),[0]*(n+2)
pref[1] = a[0]
for i in range(2,n+1):
    pref[i] = gcd(pref[i-1],a[i-1])
suf[n] = a[n-1]
for i in range(n-1,0,-1):
    suf[i] = gcd(suf[i+1],a[i-1])
ans = max(suf[2],pref[n-1])
for i in range(2,n):
    ans = max(ans,gcd(pref[i-1],suf[i+1]))
print(ans)
Problem p03086 (python)

Fixed submission:
import re
s = input()
match = re.findall(r"[ACGT]+",s)
if len(match)==0:
    print(0)
else:
    print(max([len(i) for i in match]))

Buggy submission (verdict: Runtime Error):
import re
s = input()
match = re.findall(r"[ACGT]+",s)
print(max([len(i) for i in match]))
Problem p03105 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(min((b//a),c)
Problem p03106 (python)

Fixed submission:
a,b,c = map(int,input().split())
l,x,y = [],min(a,b),max(a,b)
for i in range(1,x+1):
  if x%i==0 and y%i==0: 
    l.append(i)
l = l[::-1]
#print(l)
print(l[c-1])

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
l =[]
for i in range(1,max(a,b)):
  if max(a,b)%i==0:
    l.append(i)

print(l[c-1])

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
l =[]
for i in range(1,min(a,b)):
  if min(a,b)%i==0:
    l.append(i)

print(l[c-1])
Problem p03369 (python)

Fixed submission:
s = input()
print(700+s.count("o")*100)

Buggy submission (verdict: Runtime Error):
s = input()
print(700+s.count("o)*100)

Buggy submission (verdict: Runtime Error):
# @Date:   2020-06-06T20:03:11+05:30
# @Filename: A.py
# @Last modified time: 2020-06-06T20:03:11+05:30
"""
~~ Author : Bhaskar
~~ Dated : 06~06~2020
"""

import sys
from bisect import *
from math import floor,sqrt,ceil,factorial as F,gcd,pi
from itertools import chain,combinations,permutations,accumulate
from collections import Counter,defaultdict,OrderedDict,deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)-1
mod = 1000000007
ch = "abcdefghijklmnopqrstuvwxyz"
lcm = lambda a,b : (a*b)//gcd(a,b)
setbit = lambda x : bin(x)[2:].count("1")

def solve():
    s = input()
    o = s.count("o")
    print(700+(o*100))

if __name__ == "__main__":
    try:
        sys.stdin = open("input.txt","r")
    except :
        pass
    solve()
Problem p02536 (python)

Fixed submission:
from collections import deque
n,m = map(int, input().split())
G = [[] for _ in range(n)]
for i in range(m):
    a,b = map(int, input().split())
    a-=1
    b-=1
    G[b].append(a)
    G[a].append(b)

dist = [-1]*n
que = deque()
cnt = 0

for i in range(n):
    if dist[i]!=-1:
        continue
    dist[i]=0
    que.append(i)
    while len(que):
        v = que.pop()
        s = G[v]
        for j in s:
            if dist[j]!=-1:
                continue
            dist[j]=0
            que.append(j)
    cnt += 1

print(cnt-1)

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

nodes = [_ for _ in range(n)]
group = [1]*n

def dfs(node, group):
    s = li[node]
    group[node]=0
    for v in s:
        if group[v]!=0:
            dfs(v, group)

cnt = 0       
for i in range(n):
    if group[i]!=0:
        dfs(i,group)
        cnt += 1

print(cnt-1)

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

nodes = [i for i in range(n)]
group = [1]*n

def dfs(node, group):
    s = li[node]
    group[node]=0
    for v in s:
        if group[v]!=0:
            dfs(v, group)

cnt = 0       
for i in range(n):
    if group[i]!=0:
        dfs(i,group)
        cnt += 1

print(cnt-1)
Problem p02660 (python)

Fixed submission:
import math
import numpy as np
n = int(input())

s = math.sqrt(n)
i = 2
f = {}
while i <= s:
    while n % i == 0:
        f[i] = f.get(i,0)+1
        n = n // i
    i += 1

ans = 0
for x in f.values():
    e = 0
    cumsum = 0
    while e + cumsum + 1 <= x:
        e += 1
        cumsum += e
    ans += e
print(ans+(n>1))

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
n = int(input())
# 素因数分解
s = math.sqrt(n)
i = 2
f = np.zeros(n)
while i <= s:
    while n % i == 0:
        f[i-1] += 1
        n = n // i
    i += 1

ans = 0
for x in f:
    e = 0
    while x > 0:
        e += 1
        x -= e
    ans += e
print(ans)
Problem p02678 (python)

Fixed submission:
from sys import stdin
from collections import deque
import numpy as np
class edge(object):
    def __init__(self, to, rev):
        self.to = to
        self.rev = rev
def add_edge(from_, to_, G):
    G[from_].append(edge(to_, len(G[to_])))
    G[to_].append(edge(from_, len(G[from_])-1))

def bfs(src, level, li, li_from):
    que = deque([src])
    level[src] = 0
    while len(que)!=0:
        v = que.popleft()
        for i in range(len(li[v])):
            e = li[v][i]
            if level[e.to]<0:
                level[e.to] = level[v]+1
                li_from[e.to] = v
                que.append(e.to)

n,m = map(int, input().split())
li = []
for i in range(n):
    li.append([])
for i in range(m):
    a, b = map(int,  stdin.readline().split())
    if a > b:
        a, b = b, a
    add_edge(a-1, b-1, li)


if len(li[0])==0:
    print("No")
else:
    print("Yes")
    level = np.full(n, -1, dtype=np.int)
    li_from = np.full(n, -1, dtype=np.int)
    bfs(0,level,li, li_from)
    for i in li_from:
        if i==-1:
            continue
        print(i+1)

Buggy submission (verdict: Runtime Error):
from sys import stdin
n,m = map(int, input().split())
li = []
for i in range(n):
    li.append([])
for i in range(m):
    a, b = map(int, stdin.readline().split())
    if a > b:
        a, b = b, a
    if a == 1:
        li[a-1].append(b-1)
    else:
        li[a-1].append(b-1)
        li[b-1].append(a-1)
if len(li[0])==0:
    print("No")
else:
    print("Yes")
    # guide: [[before, kyori]]
    guide = [-1]*n
    dist = [10**8]*n
    dist[0] = 0
    def rec(i):
        # 部屋i と 部屋v をつなぐ道がある
        li_v = li[i]
        for v in li_v:
            if v!=0 and dist[v] > dist[i]+1:
                guide[v] = i
                dist[v] = dist[i] + 1
                rec(v)
    rec(0)

    for i in range(n):
        if i==0:
            continue
        print(guide[i]+1)
Problem p02767 (python)

Fixed submission:
n = int(input())
index = list(map(int, input().split()))
energy = []
for p in range(min(index), max(index)+1):
    sum = 0
    for xi in index:
        sum += (xi-p)**2
    energy.append(sum)
print(min(energy))

Buggy submission (verdict: Runtime Error):
n = int(input())
index = list(map(int, input().split()))
energy = []
for p in range(min(index), max(index)):
    sum = 0
    for xi in index:
        sum += (xi-p)**2
    energy.append(sum)
print(min(energy))
Problem p02837 (python)

Fixed submission:
n = int(input())
li = [[-1 for _ in range(n)] for _ in range(n)]
for i in range(n):
    a = int(input())
    for j in range(a):
        x, y = map(int, input().split())
        li[i][x-1] = y

ans = 0
for i in range(2**n):
    s = 0
    t = [0]*n
    for j in range(n):
        if i>>j & 1:
            t[j]=1
    is_contradict = 0
    for j in range(n):
        if t[j]:
            for k in range(n):
                if li[j][k]==-1:
                    continue
                if li[j][k] != t[k]:
                    is_contradict = 1
    if not is_contradict:
        ans = max(ans, sum(t))

print(ans)

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

n = int(input())
li = [np.full(n, -1, dtype=np.int) for _ in range(n)]
for i in range(n):
    a = int(input())
    for j in range(a):
        x, y = map(int, input().split())
        li[i][x-1] = y

ans = 0
for i in range(2**n):
    s = 0
    t = [0]*n
    for j in range(n):
        if i>>j & 1:
            t[j]=1
    is_contradict = 0
    for j in range(n):
        if t[j]:
            for k in range(n):
                if li[j][k]==-1:
                    continue
                if li[j][k] != t[k]:
                    is_contradict = 1
    if not is_contradict:
        ans = max(ans, sum(t))

print(ans)
Problem p02882 (python)

Fixed submission:
import math
a,b,x = map(int,input().split())
v = a **2 * b
h = 0
ans = 0
if v == x:
    ans = 0
elif(x > v // 2):
    ans = 90 - math.degrees(math.atan(a ** 3 / ( 2 * (v - x))))
else:
    ans = 90 - math.degrees(math.atan(x / (a * b **2 // 2)))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())
v = a **2 * b
h = 0
ans = 0
if v == x:
    ans = 0
if(x > v // 2):
    ans = 90 - math.degrees(math.atan(a ** 3 / ( 2 * (v - x))))
else:
    ans = 90 - math.degrees(math.atan(x / (a * b **2 // 2)))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())
v = a **2 * b
h = 0
ans = 0
if(x > v // 2):
    ans = 90 - math.degrees(math.atan(a ** 3 / ( 2 * (v - x))))
else:
    ans = 90 - math.degrees(math.atan(x / (a * b **2 // 2)))
print(ans)
Problem p03000 (python)

Fixed submission:
n,x = map(int,input().split())
lis = list(map(int,input().split()))
d = 0
c = 1
for l in lis:
    d += l
    if d <= x:
        c += 1
print(c)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
lis = list(map(int,input().split()))
d = 0
c = 0
for i in range(n+1):
    d = d + lis[i]
    if d > x:
        c = 1
        print(i+1)
        break
if c == 0:
    print(n+1)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
lis = list(map(int,input().split()))
d = 0
for i in range(n+1):
    d = d + lis[i]
    if d > x:
        print(i+1)
        break
Problem p03086 (python)

Fixed submission:
s = list(input())
c = 0
li = ["A","C","G","T"]
li2 = []
for i in range(len(s)):
    if s[i] in li:
        c += 1
        
    else:
        li2.append(c)
        c = 0
li2.append(c)
print(max(li2))

Buggy submission (verdict: Runtime Error):
s = list(input())
c = 0
li = ["A","C","G","T"]
li2 = []
for i in range(len(s)):
    if s[i] in li:
        c += 1
    else:
        li2.append(c)
        c = 0
print(max(li2))

Buggy submission (verdict: Runtime Error):
s = list(input())
c = 0
li = ["A","C","G","T"]
li2 = []
for i in range(len(s)):
    if s[i] in li:
        c += 1
        
    else:
        li2.append(c)
        c = 0
print(max(li2))
Problem p03131 (python)

Fixed submission:
k,a,b = map(int,input().split())
biscuits = 1

if b - a <= 1:
        biscuits = k+1
else:
    p = k - a + 1
    biscuits = a + (b - a) * (p // 2)
    biscuits = biscuits + (k - a + 1) % 2

print(biscuits)

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

#交換しても割に合わない
if a > b:
        biscuits = k+1

#交換するとお得

#交換できない(叩き続ける)
if a < b:
    if k - 1 < a:
        biscuits = k + 1

#交換可能(集まり次第交換)
    if k - 1 >= a:
        if (k - a - 1) % 2 == 0:
            p = k - a - 1
            biscuits = (p / 2 + 1) * b - p / 2 * a
        else:
            biscuits = (p / 2 + 1) * b + 1

        
print(biscuits)
Problem p03145 (python)

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

print(a * b // 2)

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

print(a * b / 2)

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

s = a * b / 2

print(s)
Problem p03206 (python)

Fixed submission:
d = int(input())

if d == 22:
    print("Christmas Eve Eve Eve")
elif d == 23:
    print("Christmas Eve Eve")
elif d == 24:
    print("Christmas Eve")
else:
    print("Christmas")

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

if d = 22:
    print("Christmas Eve Eve Eve")
elif d = 23:
    print("Christmas Eve Eve")
elif d = 24:
    print("Christmas Eve")
else:
    print("Christmas")
Problem p03219 (python)

Fixed submission:
a,b = map(int,input().split())
print(a + (b//2))

Buggy submission (verdict: Runtime Error):
a,b = ma-(int,input().split())
print(a + (b//2))

Buggy submission (verdict: Runtime Error):
a,b = ma-(int,input().split())
print(a + (b/2))
Problem p03220 (python)

Fixed submission:
n = int(input())
t,a = map(int,input().split())
li = list(map(int,input().split()))
p = []
for i in range(len(li)):
    m = abs(a-(t - 0.006 * li[i]))
    p.append(m)

print((p.index(min(p)) + 1))

Buggy submission (verdict: Runtime Error):
n = int(input())
t,a = map(int,input().split())
li = list(map(int,input().split()))
p = []
for i in range(len(li)):
    m = t - 0.006 * li[i]
    p.append(m)
print(li.index(int((t-min(p)) / 0.006)))
Problem p03239 (python)

Fixed submission:
N,T = map(int,input().split())
li = []
for i in range(N):
    c,t = map(int,input().split())
    if t > T:
        continue
    else:
        li.append(c)
if li == []:
    print("TLE")
else:
    print(min(li))

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split())
li = []
for i in range(N):
    c,t = map(int,input().split())
    if t > T:
        continue
    else:
        li.append(c)
print(min(li))
Problem p03261 (python)

Fixed submission:
n = int(input())
li = []
c = 1
for i in range(n):
    w = input()
    if w in li:
        c = 0
        
    else:
        li.append(w)

if c == 1:
    for i in range(1,n):
        if li[i - 1][-1] != li[i][0]:
            c = 0
            break
        else:
            c = 1
        
if c == 0:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
li = []
c = 0
for i in range(n):
    w = input()
    if w in li:
        print("No")
        break
    else:
        li.append(w)
for i in range(n-1):
    if li[i][-1] == li[i + 1][0]:
        c = 1
    else:
        c = 0
        break
if c == 0:
    print("No")
else:
    print("Yes")
Problem p03273 (python)

Fixed submission:
h,w = map(int,input().split())
li = []
for i in range(h):
    a = list(input())
    li.append(a)
li2 = li.copy()
c = 0
for i in range(h):
    for j in range(w):
        c = 0
        if li[i][j] == ".":
            continue
        elif li[i][j] == "#":
            c = 1
            break
    if c == 0:
        li[i] = ["a"] * w
d = 0
n = []
for i in range(w):
    for j in range(h):
        d = 0
        if li[j][i] == "." or li[j][i] == "a":
            continue
        else:
            d = 1
            break
    if d == 0:
        n.append(i)
for i in n:
    for j in range(h):
        li[j][i] = "a"

for i in range(h):
    grid = ""
    for x in li[i]:
        if x != "a":
            grid += x
    if grid != "":
        print(grid)

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
li = []
for i in range(h):
    a = list(input().split())
    li.append(a)
li2 = li.copy()
c = 0
for i in range(h):
    for j in range(w):
        c = 0
        if li[i][j] == ".":
            continue
        elif li[i][j] == "#":
            c = 1
            break
    if c == 0:
        li[i] = ["a"] * w
d = 0
n = []
for i in range(w):
    for j in range(h):
        d = 0
        if li[j][i] == "." or li[j][i] == "a":
            continue
        else:
            d = 1
            break
    if d == 0:
        n.append(i)
for i in n:
    for j in range(h):
        li[j][i] = "a"

for i in range(h):
    grid = ""
    for x in li[i]:
        if x != "a":
            grid += x
    print(grid)
Problem p03290 (python)

Fixed submission:
d,g = map(int,input().split())
po = [0]
co = [0]
for i in range(d):
    p,c = map(int,input().split())
    po.append(p)
    co.append(c)

# f(g,i) :　残りG点で、i番目の問題を最大いくつ選べるか
# i番目の問題をn問解いて、
# その得点sがGより小さかったら、f(G-s,i-1)をnに加える。
# ここでiをデクリメントするのは、完全に解く問題より高い得点の問題を
# 中途半端に解くことが最適な問題の選び方ではないため。
# i == 0 の時は float('inf') を返す。（解けない場合）
def f(G,i):
    if i == 0:
        return float("inf")
    n = min(G//(i * 100),po[i])
    s = 100 * i * n 
    if n == po[i]:
        s += co[i]
    if s < G:
        n += f(G-s,i-1)
    return min(n,f(G,i-1))

print(f(g,d))

Buggy submission (verdict: Runtime Error):
d,g = map(int,input().split())
po = [0]
co = [0]
for i in range(d):
    p,c = map(int,input().split())
    po.append(p)
    co.append(c)

# f(g,i) :　残りG点で、i番目の問題を最大いくつ選べるか
# i番目の問題をn問解いて、
# その得点sがGより小さかったら、f(G-s,i-1)をnに加える。
# ここでiをデクリメントするのは、完全に解く問題より高い得点の問題を
# 中途半端に解くことが最適な問題の選び方ではないため。
# i == 0 の時は float('inf') を返す。（解けない場合）
def f(G,i):
    if i == 0:
        return float("inf")
    n = min(G//(i * 100),po[i])
    s = 100 * i * n 
    if n == po[i]:
        s += c[i]
    if s < G:
        n += f(G-s,i-1)
    return min(n,f(G,i-1))

print(f(g,d))

Buggy submission (verdict: Runtime Error):
d,g = map(int,input().split())
po = [0]
co = [0]
for i in range(d):
    p,c = map(int,input().split())
    po.append(p)
    co.append(c)

# f(g,i) :　残りG点で、i番目の問題を最大いくつ選べるか
# i番目の問題をn問解いて、
# その得点sがGより小さかったら、f(G-s,i-1)をnに加える。
# ここでiをデクリメントするのは、完全に解く問題より高い得点の問題を
# 中途半端に解くことが最適な問題の選び方ではないため。
# i == 0 の時は float('inf') を返す。（解けない場合）
def f(G,i):
    if i == 0:
        return float("inf")
    n = min(G//(i * 100),p[i])
    s = 100 * i * n 
    if n == p[i]:
        s += c[i]
    if s < G:
        n += f(G-s,i-1)
    return min(n,f(G,i-1))

print(f(g,d))
Problem p03308 (python)

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
print(max(li)-min(li))

Buggy submission (verdict: Runtime Error):
n = int(input())
li = list(input())
print(max(li)-min(li))
Problem p03324 (python)

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

if N == 100:
    N = 101

if D == 0:
    print(N)
elif D == 1:
    print(100 * N)
else:
    print(100 ** 2 * N)

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

if N == 100:
    N = 101

if D == 0:
    print(N)
elif D == 1:
    print(100 * N)
else:
    print(100 ** 2 * N)
print(n)

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

if N = 100:
    N = 101

if D == 0:
    print(N)
elif D == 1:
    print(100 * N)
else:
    print(100 ** 2 * N)
print(n)

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


if D == 0:
    n = N
elif D === 1:
    n = 100 * N 
else:
    n = 100 ** 2 * N
print(n)
Problem p03338 (python)

Fixed submission:
n = int(input())
s = input()
c = 0

for i in range(1,n-1):
    a = set(s[:i])
    b = set(s[i:])
    cnt = len(a) + len(b) - len(a|b)
    c = max(c,cnt)

print(c)

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

for i in range(1,n-1):
    a = set(s[:i])
    b = set(s[i:])
    cnt = len(a) + len(b) - len(s)
    c = max(c,cnt)

print(c)
Problem p03386 (python)

Fixed submission:
a,b,k = map(int,input().split())
li = []
if 2 * k > b - a:
    for x in range(a,b+1):
        print(x)
else:
    for i in range(k):
        li.append(a + i)
    for i in range(k):
        li.append(b - i)
    for i in sorted(set(li)):
        print(i)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
li = []
if k >= b - a:
    print([x for x in range(a,b+1)])
else:
    for i in range(k):
        li.append(a + i)
    for i in range(k):
        li.append(b - i)
    for i in sorted(li):#sorted()で昇順にできる
     　 print(i)