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

Fixed submission:
s=input()
k=int(input())
chain_hajime=0
chain_owa=0
for i in range(len(s)):
    if s[0]==s[i]:
        chain_hajime+=1
    else: break
for i in range(len(s)):
    if s[-1]==s[-(i+1)]:
        chain_owa+=1
    else: break
#print(chain_hajime)
#print(chain_owa)
import re
def nchars(s, n):
    """文字列 s に、同じ文字が n 個以上連続している部分文字列を見つける
    """

    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))  # カンマを取ると n 個ちょうどになる
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]
a=list(nchars(s, 2))
b=0
for i in a:
    b+=len(i)//2


if len(set(s))==1:
    print(len(s)*k//2)
elif s[0]!=s[-1]:
    print(b*k)
else:
    print(b*k-(chain_hajime//2+chain_owa//2-(chain_hajime+chain_owa)//2)*(k-1))

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
chain_hajime=0
chian_owa=0
for i in range(len(s)):
    if s[0]==s[i]:
        chain_hajime+=1
    else: break
for i in range(len(s)):
    if s[-1]==s[-(i+1)]:
        chian_owa+=1
    else: break
print(chain_hajime)
print(chain_owa)
import re
def nchars(s, n):
    """文字列 s に、同じ文字が n 個以上連続している部分文字列を見つける
    """

    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))  # カンマを取ると n 個ちょうどになる
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]
a=list(nchars(s, 2))
b=0
for i in a:
    b+=len(i)//2


if len(set(s))==1:
    print(len(s)*k//2)
elif s[0]!=s[-1]:
    print(b*k)
else:
    print(b*k-(chain_hajime//2+chain_owa//2-(chain_hajime+chain_owa)//2)*(k-1))

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

import re
def nchars(s, n):
    """文字列 s に、同じ文字が n 個以上連続している部分文字列を見つける
    """

    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))  # カンマを取ると n 個ちょうどになる
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]
        
if len(s)==1:
	print(k//2)
elif len(s)==2:
	if len(set(s))==1:
		print(k)
	else:
		print(0)
elif len(s)==3:
	if len(set(s))==1:
		print(3*k//2)
	elif len(set(s))==2:
		print(k)
else:
    if s[0]!=s[-1]:
        a=list(nchars(s, 2))
        b=0
        for i in a:
            b+=len(i)//2
        print(b*k)
    else:
        if s[0]!=s[1] and s[-1]!=s[-2]:
            a=list(nchars(s, 2))
            b=0
            for i in a:
                b+=len(i)//2
            print(b*k+k-1)
        else:
            a=list(nchars(s, 2))
            b=0
            c=list(nchars(s+s, 2))
            l1_l2_sym_diff = set(a) ^ set(c)
            if len(l1_l2_sym_diff)%2==1 and (s[0]!=s[1] or s[-1]!=s[-2]):
				for i in a:
                    b+=len(i)//2
                print(b*k)
            else:
                for i in a:
                    b+=len(i)//2
                print(b*k+k-1)
Problem p02915 (python)

Fixed submission:
#140 a
N=int(input())
print(pow(N,3))

Buggy submission (verdict: Runtime Error):
#132 a
s=list(input())
s.sort()
print(s)
if s[0]==s[1] and s[2]==s[3] and s[1]!=s[2]:
    print("Yes")
else:
    print("No")
Problem p02970 (python)

Fixed submission:
n,d=map(int,input().split())
w=2*d+1
if n%w==0:
  print(n//w)
else:
  print(n//w+1)

Buggy submission (verdict: Runtime Error):
N,D=map(int,input.split())
a=N/(2*D+1)
if a%1==0:
  print(a)
else:
  print(int(a)+1)
Problem p03072 (python)

Fixed submission:
n=int(input())
c=list(map(int,input().split()))
s=0
for i in range(n):
    d=0
    for j in range(i):
        if c[i]>=c[j]:
            d+=0
        else: 
            d+=1
    if d==0:
        s+=1
    else:
        s+=0
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
c=list(map(int,input().split()))
s=0
for i in range(n):
    for j in range(i):
        d=0
        if c[i]>=c[j]
            d+=0
        else: 
            d+=1
    if d==0:
        s+=1
    else:
        s+=0
print(s)
Problem p03242 (python)

Fixed submission:
s=list(input())
for i in range(3):
    if s[i]=="1":
        s[i]=9
    else:
        s[i]=1
print(s[0]*100+s[1]*10+s[2])

Buggy submission (verdict: Runtime Error):
s=list(input())
for i in range(s):
	if s[i]==1:
    	s[i]=9
    else:
    	s[i]=1
Problem p02627 (python)

Fixed submission:
N=input()
X=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
if N in X:
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(i) for i in input().split()]
Q=int(input())
X=[i+1 for i in range((10**5))]
dic={}
ans=sum(A)
for i in A:
	try:
		dic[i]+=1
	except:
		dic.setdefault(i,1)
for i in range(Q):
	[B,C]=[int(i) for i in input().split()]
	try:
		ans+=dic[B]*(C-B)
		try:
			dic[C]+=dic[B]
		except:
			dic.setdefault(C,dic[B])
		dic[B]=0
	except:
		ans+=0

	print(ans)
Problem p02659 (python)

Fixed submission:
[A,B]=[i for i in input().split()]
A=int(A)
a=[]
f=False
for i in range(len(B)):
	if B[i]!=".":
		a+=[B[i]]
B=int("".join(a))
print(A*B//100)

Buggy submission (verdict: Runtime Error):
[A,B]=[i for i in input().split()]
A=int(A)
B=int(B*100)
print(A*B//100)
Problem p02693 (python)

Fixed submission:
K=int(input())
[A,B]=[int(i) for i in input().split()]
f=0
for n in range(A,B+1):
  if n%K==0:
    f+=1
    break
if f==0:print("NG")
else:print("OK")

Buggy submission (verdict: Runtime Error):
K=int(input())
[A,B]=list(map(int(),input().split()))
flg=0
for n in range(A,B+1):
  if n%K==0:
    print("OK")
    flg==1
    break
if flg==0:print("N_G")

Buggy submission (verdict: Runtime Error):
K=int(input())
[A,B]=list(map(int(),input().split()))
flg=0
for n in range(A,B+1):
  if n%K==0:
    print("OK")
    flg==1
    break
if flg==0:print("NG")
Problem p02699 (python)

Fixed submission:
[S,W]=[int(i) for i in input().split()]
if S>W:
  print("safe")
else:
  print("unsafe")

Buggy submission (verdict: Runtime Error):
N=int(input())
lis=[]
ans=0
for i in range(N):
	x=input()
	try:
		y=lis.index(x)
	except:
		lis+=[x]
		ans+=1
print(ans)
Problem p02701 (python)

Fixed submission:
N=int(input())
lis=[]
ans=0
for i in range(N):
	lis+=[input()]
print(len(set(lis)))

Buggy submission (verdict: Runtime Error):
N=int(input())
lis=[]
ans=0
for i in range(N):
	try:
		y=lis.index(input())
	except:
		lis+=[input()]
		ans+=1
print(ans)
Problem p02771 (python)

Fixed submission:
[A,B,C]=[int(i) for i in input().split()]
if A==B:
	if B!=C:
		print("Yes")
	else:
		print("No")
else:
	if B==C:
		print("Yes")
	else:
		if A==C:
			print("Yes")
		else:
			print("No")

Buggy submission (verdict: Runtime Error):
[A,B,C]=[int(i) for i in input().split()]
if A==B:
	if B!=C:
		print("Yes")
	else:
		print("No")
else:
	if B==C:
		print("No")
	else:
		if A=C:
			print("Yes")
		else:
			print("No")
Problem p02970 (python)

Fixed submission:
[N,D]=[int(i) for i in input().split()]
a=(2*D)+1
b=(N//a)+1

if N%a==0:b-=1
print(b)

Buggy submission (verdict: Runtime Error):
N=int(input())
D=int(input())
a=2*n+1
b=D//a+1
print(b)
Problem p02624 (python)

Fixed submission:
import collections

n = int(input())

f = [1] * (n + 1)
for i in range(2, n + 1):
    if f[i] != 1: continue
    m = i
    while m <= n:
        tmp = m
        cnt = 0
        while tmp % i == 0:
            tmp = tmp // i
            cnt += 1
        f[m] *= cnt + 1
        m += i

ans = 0
for i in range(1, n + 1):
    ans += i * f[i]
print(ans)

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

ans = 1
flag = [True] * (n + 1)
flag[2] = False
for i in range(2, n + 1):
    if flag[i]: continue
    m = i
    while m <= n:
        tmp = m
        cnt = 0
        while tmp % i == 0:
            tmp = tmp // i
            cnt += 1
        flag[m] = False
        ans += m * (cnt + 1)
        m += i

print(ans)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())

f = [1] * (n + 1)
for i in range(2, n + 1):
    if f[i] != 1: continue
    m = i
    while m <= n:
        tmp = m
        cnt = 0
        while tmp % i == 0:
            tmp = tmp // i
            cnt += 1
            loop += 1
        f[m] *= cnt + 1
        m += i

ans = 0
for i in range(1, n + 1):
    ans += i * f[i]
print(ans)
Problem p02771 (python)

Fixed submission:
a, b, c = map(int, input().split())
ans = 'Yes' if len(set([a, b, c])) == 2 else 'No'
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left

def binsearch(l, r, fn):
    while r - l > 1:
        m = (l + r) // 2
        if fn(m):
            l = m
        else:
            r = m
    return l

n, k = map(int, input().split())
A = sorted(list(map(int, input().split())))
p = bisect_left(A, 0)
an = A[:p]
ap = A[p:]

if k < p * (n - p):
    def helper(x):
        t = 0
        r = 0
        for p in ap:
            while t < len(an) and an[t] * p <= x:
                t += 1
            r += t
        return r < k
    l = binsearch(ap[-1] * an[0] - 1, 1, helper)
else:
    k -= p * (n - p)
    an.reverse()
    def helper(x):
        r = 0
        for a in [ap, an]:
            t = len(a) - 1
            for i, p in enumerate(a):
                if t <= i:
                    break
                while t > i and a[t] * p > x:
                    t -= 1
                r += t - i
            return r < k
        m = ap[-1]
        if an:
            m = max(m, -an[-1])
        l = binsearch(-1, m * m, helper)
print(l + 1)
Problem p02781 (python)

Fixed submission:
from collections import deque
n = input()
a = [int(i) for i in list(n)]
k = int(input())
n = len(n)
ans = 0

if k > n:
    ans = 0
elif k == 1:
    # n 桁目に非負整数
    ans += a[0]
    # n 桁目以外に非負整数
    ans += (n - 1)*9
elif k == 2:
    # 上と同様
    for i in range(1, n):
        if a[i] != 0:
            j = i
            break
    else:
        j = n - 1
    ans += a[j] + (n - j - 1)*9
    # n 桁目の最大ではない非負整数と n-1 桁目以降に 1 つ非負整数
    ans += (a[0] - 1)*(n - 1)*9
    # n-1 桁目以降の中から 2 つ非負整数
    ans += (n - 1)*(n - 2)*9*9//2
else:
    # 上と同様
    j, l= -1, n - 1
    for i in range(1, n):
        if a[i] != 0:
            if j == -1:
                j = i
            else:
                l = i
                break
    if j != -1 and j != n - 1:
        ans += a[l] + (n - l - 1)*9 + (a[j] - 1)*(n - j - 1)*9 + (n - j - 1)*(n - j - 2)*9*9//2
    # n 桁目の最大でない非負整数と n-1 桁目以降に 2 つ非負整数
    ans += (a[0] - 1)*(n - 1)*(n - 2)*9*9//2
    # n-1 桁目以降から 3 つ非負整数
    ans += (n - 1)*(n - 2)*(n - 3)*9*9*9//6
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
n = input()
k = int(input())
a = [int(n[i]) for i in range(min(k, len(n)))]
n = len(n)

if k > n:
    ans = 0
elif k == 1:
    # n 桁目に非負整数
    ans += a[0]
    # n 桁目以外に非負整数
    ans += (n - 1)*9
elif k == 2:
    # 上と同様
    ans += a[1] + (n - 2)*9
    # n 桁目の最大ではない非負整数と n-1 桁目以降に 1 つ非負整数
    ans += (a[0] - 1)*(n - 1)*9
    # n-1 桁目以降の中から 2 つ非負整数
    ans += (n - 1)*(n - 2)*9*9//2
else:
    # 上と同様
    ans += a[2] + (n - 3)*9 + (n - 2)*(n - 3)*9*9//2
    if a[1] != 0:
        ans += (a[1] - 1)*(n - 2)*9
    # n 桁目の最大でない非負整数と n-1 桁目以降に 2 つ非負整数
    ans += (a[0] - 1)*(n - 1)*(n - 2)*9*9//2
    # n-1 桁目以降から 3 つ非負整数
    ans += (n - 1)*(n - 2)*(n - 3)*9*9*9//6
print(ans)
Problem p02820 (python)

Fixed submission:
import sys

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

win_choice = {'s':'r', 'p':'s', 'r':'p'}
janken_point = {'r':r, 's':s, 'p':p}

dp = []
# a: 相手の手, x:自分が出せない手
def point(a, x=None):
    if x == win_choice[a]: return 0
    else: return janken_point[win_choice[a]]

score = 0
flag = [('0', 1)] * k
for i in range(n):
    if flag[i % k][0] != t[i]:
        score += point(t[i])
        flag[i % k] = (t[i], -1)
    elif flag[i % k][0] == t[i] and flag[i % k][1] == 1:
        score += point(t[i])
        flag[i % k] = (t[i], -1)
    else:
        flag[i % k] = (t[i], 1)

print(score)

Buggy submission (verdict: Runtime Error):
import sys

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

win_choice = {'s':'r', 'p':'s', 'r':'p'}
janken_point = {'r':r, 's':s, 'p':p}

dp = []
# a: 相手の手, x:自分が出せない手
def point(a, x=None):
    if x == win_choice[a]: return 0
    else: return janken_point[win_choice[a]]

def total_score(i, cnt, x=None):
    if cnt == 0:
        return 0
    else:
        a = t[(cnt - 1) * k + i]
        a_next = t[(cnt - 2) * k + i] if cnt > 1 else None
        choice = win_choice[a]
        if a == a_next and point(a, x) != 0:
            return point(a, x) + total_score(i, cnt - 1, choice)
        else:
            return point(a, x) + total_score(i, cnt - 1)

sys.setrecursionlimit(n + 1)
r = [0] * k
for i in range(n):
    i = i % k
    r[i] += 1

score = 0
for i in range(k):
    cnt = r[i]
    score += total_score(i, cnt)

print(score)

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

win_choice = {'s':'r', 'p':'s', 'r':'p'}
janken_point = {'r':r, 's':s, 'p':p}

# a: 相手の手, x:自分が出せない手
def point(a, x=None):
    if x == win_choice[a]: return 0
    else: return janken_point[win_choice[a]]

def total_score(i, cnt, x=None):
    if cnt == 0:
        return 0
    else:
        a = t[(cnt - 1) * k + i]
        choice = win_choice[a]
        return max(point(a, x) + total_score(i, cnt - 1, choice), total_score(i, cnt - 1))

r = [0] * k
for i in range(n):
    i = i % k
    r[i] += 1

score = 0
for i in range(k):
    cnt = r[i]
    score += total_score(i, cnt)

print(score)
Problem p02912 (python)

Fixed submission:
import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = [-1 * i for i in a]
heapq.heapify(a)
cnt = 0
while cnt < m:
    x = heapq.heappop(a) * -1
    x = x // 2
    cnt += 1
    heapq.heappush(a, x * -1)
print(sum(a) * -1)

Buggy submission (verdict: Runtime Error):
from collections import deque
import bisect
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = deque(sorted(a))
cnt = 0
while cnt < m:
    x = a.pop()
    x = x // 2
    cnt += 1
    if len(a) == 0 or x > a[-1]:
        a.append(x)
    else:
        bisect.insort_left(a, x)
print(sum(a))
Problem p02915 (python)

Fixed submission:
n = int(input())
print(n ** 3)

Buggy submission (verdict: Runtime Error):
n = input()
print(n ** 3)
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if b - a <= k and c - a <= k and d - a <= k and e - a <= k and c-b <= k and d-b <= k and e-b <= k and d-c <= k and e-c <= k and e - d <= k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if b - a <= k and c - b <= k and d - c <= k and e - d <= k and c - a <= k and d - a <= k and e - a <= k and d - b <= k and e - b <= k and e - c <= k:
    print("Yay!
")
else:
    print(": (")
Problem p03127 (python)

Fixed submission:
import fractions
from functools import reduce
n = int(input())
a_li = list(map(int, input().split()))


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


print(gcd_list(a_li))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
n = int(input())
a_li = list(map(int, input().split()))


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


print(gcd_list(a_li))
Problem p02594 (python)

Fixed submission:
a=int(input())
if a>=30:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a=int(input())
if a=>30:
  print('Yes')
else:
  print('No')
Problem p02627 (python)

Fixed submission:
t="qwertyuioplkjhgfdsazxcvbnm"
T="QWERTYUIOPLKJHGFDSAZXCVBNM"
a=str(input())
if a in t:
  print('a')
else:
  print('A')

Buggy submission (verdict: Runtime Error):
t='qwertyuioplkjhgfdsazxcvbnm'
T='QWERTYUIOPLKJHGFDSAZXCVBNM'
a=str(input())
if a in t:
  print(a)
else:
  print(A)

Buggy submission (verdict: Runtime Error):
t="qwertyuioplkjhgfdsazxcvbnm"
T="QWERTYUIOPLKJHGFDSAZXCVBNM"
a=str(input())
if a in t:
  print(a)
else:
  print(A)
Problem p02699 (python)

Fixed submission:
S,W=map(int,input().split())
if W>=S:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
S=input()
l=len(S)
z=0
for x in range(l):
    for y in range(l-x-3):
        T=S[x:x+y+4]
        t=int(T)
        
        if t%2019==0:
            z+=1
print(z)
Problem p02595 (python)

Fixed submission:
N,D = map(int,input().split())
l = []
for i in range (N):
    x,y = map(int,input().split())
    l.append(x*x+y*y)
    
ans = 0
for i in range(N):
    if l[i] <= D*D:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N,D = map(int,input().split())
l = []
for i in range (N):
    x,y = map(int,input().split())
    l.append(x*x+y*y)
    
ans = 0
for i in range(N):
    if l[i] < D*D:
        ans += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
N,D = map(int,input().split())
l = []
for i in range (N):
    x,y = map(int,input().split())
    l.append(x*x+y*y)
    
ans = 0
for i in range(N):
    if l[i] < D*D:
        cnt += 1

print(cnt)
Problem p02785 (python)

Fixed submission:
N,K = map(int,input().split())
H = list(map(int, input().split()))
H  = sorted(H)


if N > K:
    print(sum(H[:N-K]))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
H = input().split()
H = [int h for h in H]
H = sorted(H)

if N > K:
    print(K + sum(H[:H-K]))
else:
    print(K)
Problem p03073 (python)

Fixed submission:
s = input()
c1 = 1 if s[0] == '0' else 0
a = []
a.append('1')
for i in range(1,len(s)):
  if s[i] == a[len(a)-1]:
    c1+=1
    a.append('0' if s[i]=='1' else '1')
  else:
    a.append(s[i])
    
a = []
a.append('0')
c2 = 1 if s[0]=='1' else 0
for i in range(1,len(s)):
  if s[i] == a[len(a)-1]:
    c2+=1
    a.append('0' if s[i]=='1' else '1')
  else:
    a.append(s[i])
    
    
print(min(c1,c2))

Buggy submission (verdict: Runtime Error):
s = input()
c1 = 1 if s[0] == '0' else 0
a = []
a.append('1')
for i in range(1,len(s)):
  if s[i] == a[len(a)-1]:
    c1+=1
    a.append('0' if s[i]=='1' else '1')
  else:
    a.append(s[i])
    
a = []
c2 = 1 if s[0]=='1' else 0
for i in range(1,len(s)):
  if s[i] == a[len(a)-1]:
    c2+=1
    a.append('0' if s[i]=='1' else '1')
  else:
    a.append(s[i])
    
    
print(min(c1,c2))
Problem p03127 (python)

Fixed submission:
# from math import gcd
def gcd(a,b):
    if b == 0 :return a
    return gcd(b,a%b)


n = int(input())
arr = [int(x) for x in input().split()]


ans = arr[0]

for i in range(1,n):
    ans = gcd(ans,arr[i])

print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd
n = int(input())
arr = [int(x) for x in input().split()]


ans = arr[0]

for i in range(1,n):
    ans = gcd(ans,arr[i])

print(ans)
Problem p02793 (python)

Fixed submission:
# from math import gcd
from fractions import gcd

n = int(input())
a = list(map(int,input().split()))
ans = 1
for i in a:
    ans = ans * i // gcd(ans, i)
mod = 10**9+7
print(sum(map(lambda x: ans // x, a)) % mod)

Buggy submission (verdict: Runtime Error):
# from math import gcd
from fraction import gcd

n = int(input())
a = list(map(int,input().split()))
ans = 1
for i in a:
    ans = ans * i // gcd(ans, i)
mod = 10**9+7
print(sum(map(lambda x: ans // x, a)) % mod)
Problem p02836 (python)

Fixed submission:
s = input()
l = len(s)
ret = 0
for i in range(l): 
  ret += (s[i] != s[-i-1])
print(ret//2)

Buggy submission (verdict: Runtime Error):
s = input()
l = len(s)
ret = 0
for i in range(l): ret += (s[l] != s[-l-1])
print(ret//2)
Problem p02881 (python)

Fixed submission:
def main():
  n = int(input())
  i = int((n)**0.5) + 1
  while i * i > n: i -= 1
  while i >= 1:
    if n % i == 0:
      print(i+n//i-2)
      return
    i -= 1
main()

Buggy submission (verdict: Runtime Error):
def main():
  n = int(input())
  i = int(sqrt(n)) + 1
  while i * i > n: i -= 1
  while i >= 1:
    if n % i == 0
      print(i+n//i)
      return
    i -= 1
main()
Problem p03835 (python)

Fixed submission:
k,s = map(int,input().split())
ret = 0
for i in range(k+1):
    bmax = min(k,s-i)+1
    bmin = max(0,s-i-k)
    if bmin < bmax : ret += bmax - bmin
print(ret)

Buggy submission (verdict: Runtime Error):
k,s = int(input().split())
ret = 0
for i in range(k+1):
    bmax = min(k,bpc)+1
    bmin = max(0,s-i-k)
    if bmin < bmax : ret += bmax - bmin
print(ret)
Problem p02792 (python)

Fixed submission:
n=int(input())
d = [[0] * 10 for i in range(10)]

ans = 0
for i in range(1,n+1):
    s=str(i)
    if s[0]=="0" or s[-1]=="0":
        continue
    else:
        d[int(s[0])][int(s[-1])] += 1

ans = 0
for i in range(1,10):
    for j in range(1,10):
        ans += d[i][j] * d[j][i]

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
d = [[0] * 10 for i in range(10)]

ans = 0
for i in range(1,n+1):
    s=str(i)
    if s[0]=="0" or s[-1]=="0":
        continue
    else:
        d[int(s[0])][int(s[-1])] += 1

ans = 0
for i in range(1,10):
    for j in range(1,10):
        ans += d[i][j] * d[j][i]

print(ans)
n = int(input())

d = [[0] * 10 for i in range(10)]

ans = 0
for i in range(1,n + 1):
    s = str(i)
    if s[0] == "0" or s[-1] == "0":
        continue
    else:
        d[int(s[0])][int(s[-1])] += 1

ans = 0
for i in range(1,10):
    for j in range(1,10):
        ans += d[i][j] * d[j][i]

print(ans)
Problem p02820 (python)

Fixed submission:
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
p_list=[]
score=0
for i in range(len(t)):
    if i<k:
        if t[i]=='r':
            p_list.append('p')
            score+=p
        elif t[i]=='s':
            p_list.append('r')
            score+=r
        else:
            p_list.append('s')
            score+=s
    else:
        if t[i]=='r':
            if p_list[i-k]=='p':
                if i+k>=len(t):
                    p_list.append('a')
                else:
                    p_list.append(t[i+k])
            else:
                p_list.append('p')
                score+=p
        elif t[i]=='s':
            if p_list[i-k]=='r':
                if i+k>=len(t):
                    p_list.append('a')
                else:
                    p_list.append(t[i+k])
            else:
                p_list.append('r')
                score+=r
        else:
            if p_list[i-k]=='s':
                if i+k>=len(t):
                    p_list.append('a')
                else:
                    p_list.append(t[i+k])
            else:
                p_list.append('s')
                score+=s
print(score)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
p_list=[]
score=0
for i in range(len(t)):
    if i<k:
        if t[i]=='r':
            p_list.appned('p')
            score+=p
        elif t[i]=='s':
            p_list.appned('r')
            score+=r
        else:
            p_list.appned('s')
            score+=s
    else:
        if t[i]=='r':
            if t[i-k]=='p':
                if i+k>=len(t):
                    score+=0
                else:
                    p_list.appned(t[i+k])
            else:
                p_list.appned('p')
                score+=p
        elif t[i]=='s':
            if t[i-k]=='r':
                if i+k>=len(t):
                    score+=0
                else:
                    p_list.appned(t[i+k])
            else:
                p_list.appned('r')
                score+=r
        else:
            if t[i-k]=='s':
                if i+k>=len(t):
                    score+=0
                else:
                    p_list.appned(t[i+k])
            else:
                p_list.appned('s')
                score+=s
print(score)
Problem p03013 (python)

Fixed submission:
n,m = map(int,input().split())
mod = 10**9+7
a = set()
for i in range(m):
  s = int(input())
  a.add(s)
  
dp = [0]*(n+1)
dp[0] = 1
for i in range(1,n+1):
  if i in a:
    continue
  dp[i] = (dp[i-1] + dp[i-2]) % mod
  
print(dp[-1])

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