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

Fixed submission:
# ABC166 B
n,k = map(int, input().split())
# お菓子を持っているすぬけ君かを判断する配列d 1ならもってる 0はもってない
d = [0] * n
# お菓子iを持っているのはどのすぬけ君か？
for i in range(k):
    # お菓子iを持っている人数m人
    m = int(input())
    # お菓子iを持っているすぬけ君のリスト
    a = list(map(int, input().split()))
    for j in range(m):
        # すぬけ君a[j]は少なくとも一つ以上のお菓子を持っている
        d[a[j]-1] = 1 
        
#いたずらされる人数ans人
ans = 0
for i in range(n):
    if d[i] == 0:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import math
x = int(input())
n = 100
y = 0

while x > n:
    # 小数点以下切り捨て
    n += n // 100
    y += 1

print(y)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
# お菓子を持っているすぬけ君かを判断する配列d 1ならもってる 0はもってない
d = [0] * n
# お菓子iを持っているのはどのすぬけ君か？
for i in range(k):
    # お菓子iを持っている人数m人
    m = int(input())
    # お菓子iを持っているすぬけ君のリスト
    a = list(map(int, input().split()))
    for j in a:
        # すぬけ君a[j]は少なくとも一つ以上のお菓子を持っている
        d[a[j]-1] = 1 
        
#いたずらされる人数ans人
ans = 0
for i in range(n):
    if d[i] == 0:
        ans += 1

print(ans)
Problem p02880 (python)

Fixed submission:
N = int(input())
flag = False
for i in range(1, 10):
    if N % i == 0 and int(N / i) <= 9:
        flag = True
        break

if flag:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(1, 10):
    if N % i == 0 and N / i <= 9:
        print('Yes')
        exit(1)
print('No')
Problem p02831 (python)

Fixed submission:
import fractions

a, b = map(int, input().split())

ans = a * b // fractions.gcd(a, b)

print(ans)

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())

ans = a * b // math.gcd(a, b)

print(ans)
Problem p02879 (python)

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

if 1 <= a <= 9:
    if 1 <= b <= 9:
        print(a * b)
        exit()
print("-1")

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

divisors = []
for i in range(1, int(n**0.5)+1):
    if n % i == 0:
        divisors.append(i)
        if i != n // i:
            divisors.append(n // i)
a = divisors[-1]
b = divisors[-2]
print(a + b - 2)
Problem p02627 (python)

Fixed submission:
a = input()
if a.isupper()== True :
    print('A')
else :
    print('a')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
for _ in range(Q):
    B,C = map(int, input().split())
A.sort()
ans = 0
for a in range(Q) :
    x=C if A=B else 0
    ans = sum(A)
print(ans)
Problem p02693 (python)

Fixed submission:
K = int(input())
A, B = map(int, input().split())


ps = int(A / K)
pa = A % K
qs = int(B / K)
qa = B % K

if A==B:
	if pa==0:
		print("OK")
	else:
		print("NG")
else:
	if qs-ps>0:
		print("OK")
	else:
		if pa==0 or qa ==0:
			print("OK")
		else:
			print("NG")

Buggy submission (verdict: Runtime Error):
k=input()
a,b = map(int, input().split())
ans="NG"
while a <= b:
  if a%k=0:
    ans ="OK"
  else:
    a=a+1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,n=map(int,(input().split())
x = min(b-1,n)
print(int(a*x/b)-a*int(x/b))

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


ps = int(A / K)
pa = A % K
qs = int(B / K)
qa = B % K

if A==B:
	if p==0:
		print("OK")
	else:
		print("NG")
else:
	if qs-ps>0:
		print("OK")
	else:
		if pa+qa >K:
			print("OK")
		else:
			print("NG")
Problem p02699 (python)

Fixed submission:
s, w = map(int, input().split())
if s > w:
  print("safe")
else:
  print("unsafe")

Buggy submission (verdict: Runtime Error):
# a:高橋 体力
# b:高橋 攻撃力
# c:青木　体力
# d:青木　攻撃力

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

while c > 0:
  c = c-b　#青木体力
  if c <= 0:
    print("Yes")
  a = a-d
  if a <= 0:
    print("No")

Buggy submission (verdict: Runtime Error):
s, w = map(int, input().strip())

if s > w:
  print("safe")
else:
  print("unsafe")

Buggy submission (verdict: Runtime Error):
s, w = map(int, input().strip())
print(s)
print(w)
#if s > w:
#  print("safe")
#else:
#  print("unsafe")

Buggy submission (verdict: Runtime Error):
s, w = map(int, input().strip())
print s
if s > w:
  print("safe")
else:
  print("unsafe")

Buggy submission (verdict: Runtime Error):
s, w = map(int, input().strip())
if s > w:
  print("safe")
else:
  print("unsafe")

Buggy submission (verdict: Runtime Error):
s, w = map(int, input().strip())
if s > w:
  print("safe")
else:
  print("unsafe)
Problem p02622 (python)

Fixed submission:
S = input()
T = input()
cnt = 0
for i, v in enumerate(zip(S,T)):
  if v[0] == v[1]:
    continue
  else:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
cnt = 0
for i, v in enumerate(zip(S,T)):
  if v[0] == v[1]:
    continue
  else:
    S[i] = v[1]
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
cnt = 0
for i, v in zip(S,T):
  if v[0] == v[1]:
    continue
  else:
    S[i] = v[1]
    cnt += 1
print(cnt)
Problem p02622 (python)

Fixed submission:
S = input()
T = input()
tmp = 0
for i in range(len(S)):
  if S[i] == T[i]:
    pass
  else:
    tmp += 1
    
    
print(tmp)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
tmp = 0
for i in range(len(S)):
  if S[i] == T[i]:
    pass:
  else:
    tmp += 1
    
    
print(tmp)
Problem p02659 (python)

Fixed submission:
A, B = input().split()
A = int(A)
B = B.replace(".", "")
B = int(B)
AB = A*B
AB = str(AB)
AB = "00" + AB
AB = AB[:-2]
print(int(AB))

Buggy submission (verdict: Runtime Error):
A, B = list(map(int,input().split()))
print(int(A*B))
Problem p02629 (python)

Fixed submission:
l = ["z","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"]
l2 = [0]*11

n = int(input())
for i in range(11):
  p = 0
  q = 0
  p = n%26
  if n==0 and p==0:
    l2[i]=""
  else:
    l2[i]=l[p]
    if p ==0:
      q = n - 26
    else:
      q = n - p
    n = q//26
print(l2[10]+l2[9]+l2[8]+l2[7]+l2[6]+l2[5]+l2[4]+l2[3]+l2[2]+l2[1]+l2[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(11):
  p = 0
  q = 0
  p = n%26
  if n==0 and p==0:
    l2[i]=""
  else:
    l2[i]=l[p]
    if p ==0:
      q = n - 26
    else:
      q = n - p
    n = q//26
print(l2[10]+l2[9]+l2[8]+l2[7]+l2[6]+l2[5]+l2[4]+l2[3]+l2[2]+l2[1]+l2[0])
Problem p02820 (python)

Fixed submission:
N, K = map(int,input().split())
R, S, P = map(int,input().split())
T = input()
 
def EarnScore(rsp, t):
    if t == 'r':
        return rsp[2]
    elif t == 's':
        return rsp[0]
    elif t == 'p':
        return rsp[1]
    else:
        return 0
 
RSP = [R, S, P]
Answer = 0
ListT = list(T)
for i in range(N):
    Answer = EarnScore(RSP, ListT[i]) + Answer
    if i + K < N:
        if ListT[i] == ListT[i+K]:
            ListT[i+K] = 'x'
 
print(Answer)

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
R, S, P = map(int,input().split())
T = input()

def MaxScore(rsp, t):
    Score = 0
    t = t + 't'
    for i in range(len(t)):
        if t[i] == t[i+1]:
            pass
        else:
            if t[i] == 'r':
                Score = Score + rsp[2]
            elif t[i] == 's':
                Score = Score + rsp[0]
            else:
                Score = Score + rsp[1]
    return Score

def strsplit(n, t, k):
    tList = [""] * k
    for i in range(n):
        tList[i % k] = tList[i % k] + t[i]
    return tList

RSP = [R, S, P]
Answer = 0
for i in range(K):
    Answer = MaxScore(RSP, strsplit(N, T, K)[i]) + Answer

print(Answer)
Problem p02723 (python)

Fixed submission:
s = input()
if s[2] == s[3]:
    if s[4] == s[5]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
arrayP = list(map(int, input().split()))
arrayQ = list(map(int, input().split()))
arrayR = list(map(int, input().split()))
arrayP.sort(reverse=True)
arrayQ.sort(reverse=True)
arrayR.sort(reverse=True)
arrayAns = []
for i in range(x):
    arrayAns.append(int(arrayP[i]))
for i in range(y):
    arrayAns.append(int(arrayQ[i]))
arrayAns.sort()
for i in range(len(arrayR)):
    if len(arrayAns) >= i
        if arrayAns[i] <= int(arrayR[i]):
           arrayAns[i] = int(arrayR[i])
        else:
            break
print(sum(arrayAns))

Buggy submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
arrayP = list(map(int, input().split()))
arrayQ = list(map(int, input().split()))
arrayR = list(map(int, input().split()))
arrayP.sort(reverse=True)
arrayQ.sort(reverse=True)
arrayR.sort(reverse=True)
arrayAns = []
for i in range(x):
    arrayAns.append(int(arrayP[i]))
for i in range(y):
    arrayAns.append(int(arrayQ[i]))
arrayAns.sort()
for i in range(len(arrayR)):
    if arrayAns[0] <= int(arrayR[i]):
        arrayAns[0] = int(arrayR[i])
        arrayAns.sort()
    else:
        break
print(sum(arrayAns))

Buggy submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
arrayP = list(input().split())
arrayQ = list(input().split())
arrayR = list(input().split())
arrayP.sort(reverse=True)
arrayQ.sort(reverse=True)
arrayR.sort(reverse=True)
arrayAns = []
for i in range(x):
    arrayAns.append(int(arrayP[i]))
for i in range(y):
    arrayAns.append(int(arrayQ[i]))
arrayAns.sort()
for i in range(len(arrayR)):
    if arrayAns[0] <= int(arrayR[i]):
        arrayAns[0] = int(arrayR[i])
        arrayAns.sort()
print(sum(arrayAns))
Problem p02726 (python)

Fixed submission:
n, x, y = map(int, input().split())
array = [0]*(n-1)

for i in range(1, n+1):
    for j in range(i+2, n+1):
        array[min(j-i, abs(x-i)+1+abs(y-j), abs(y-i)+1+abs(x-j))-1] += 1

print(n)
for k in range(1, n-1):
    print(array[k])

Buggy submission (verdict: Runtime Error):
n, x, y = map(int, input().split())
array = [0]*(n-1)

for i in range(1, n+1):
    for j in range(i+2, n+1):
        array[min(j-i, abs(x-i)+1+abs(y-j), abs(y-i)+1+abs(x-j))-1] += 1

print(n)
for k in range(1, n):
    print(array[k])

Buggy submission (verdict: Runtime Error):
n, x, y = map(int, input().split())
array = [0]*(n-1)

for i in range(1, n+1):
    for j in range(i+2, n+1):
        array[min(j-i, abs(x-i)+1+abs(y-j), abs(y-i)+1+abs(x-j))-1] += 1

print(n)
for k in range(1, n):
    print(array[k])
Problem p02753 (python)

Fixed submission:
s = input()
if s == "AAA" or s == "BBB":
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
import math
A,B = map(int, input().split())
answerA = math.ceil(A/0.08)
answerAA = math.floor((A+1)/0.08)
answerB = math.ceil(B/0.1)
answerBB = math.floor((B+1)/0.1)
if answerA < answerB and answerAA >= answerB:
    print(answerB)
elif answerB < answerA and answerBB >= answerA:
    print(answerA)
elif answerB > answerAA:
    print("-1")
elif answerBB < answerA:
    print("-1")
elif answerA >= answerB and answerAA <= answerBB:
    print(answerA)
elif answerB >= answerA and answerBB <= answerAA:
    print(answerB)
else:
    print("-1")
Problem p02771 (python)

Fixed submission:
A,B,C = map(int,input().split())

if A != B and B != C and A != C:
    print("No")
elif A == B and B == C:
    print("No")
else:
    print("Yes")

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

if A != B and B != C and A != C:
    print("No")
elif A = B and B = C:
    print("No")
else:
    print("Yes")
Problem p02779 (python)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
c = Counter(A)
if c.most_common()[0][1] >= 2:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
c = Counter(A)
if c.most_common()[0][1] => 2:
    print("NO")
else:
    print("YES")
Problem p02785 (python)

Fixed submission:
N,K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
for i in range(K):
    H.pop()
    if len(H) == 0:
        break
print(sum(H))

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
for i in range(K):
    H.pop()
print(sum(H))
Problem p02820 (python)

Fixed submission:
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
memo = [""]*N
ans = 0
for i in range(N):
    if i >= K:
        if T[i] == "r":
            if memo[i-K] == "p":
                if i+K <= N-1:
                    memo[i] = T[i+K]
            else:
                memo[i] = "p"
                ans += P
        elif T[i] == "s":
            if memo[i-K] == "r":
                if i+K <= N-1:
                    memo[i] = T[i+K]
            else:
                memo[i] = "r"
                ans += R
        else:
            if memo[i-K] == "s":
                if i+K <= N-1:
                    memo[i] = T[i+K]
            else:
                memo[i] = "s"
                ans += S
    else:
        if T[i] == "r":
            memo[i] = "p"
            ans += P
        elif T[i] == "s":
            memo[i] = "r"
            ans += R
        else:
            memo[i] = "s"
            ans += S
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
memo = [""]*N
ans = 0
for i in range(N):
    if i >= K:
        if T[i] == "r":
            if memo[i-K] == "p":
                memo[i] = T[i+K]
            else:
                memo[i] = "p"
                ans += P
        elif T[i] == "s":
            if memo[i-K] == "r":
                memo[i] = T[i+K]
            else:
                memo[i] = "r"
                ans += R
        else:
            if memo[i-K] == "s":
                memo[i] = T[i+K]
            else:
                memo[i] = "s"
                ans += S
    else:
        if T[i] == "r":
            memo[i] = "p"
            ans += P
        elif T[i] == "s":
            memo[i] = "r"
            ans += R
        else:
            memo[i] = "s"
            ans += S
print(ans)
Problem p02847 (python)

Fixed submission:
S = input()
l = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
print(7-l.index(S))

Buggy submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
keta = 0
for i in range(1,24):
    cx = x - b*(i)
    if cx < a*(10**(i-1)):
        keta = i-1
        break
if keta == 0:
    print(0)
elif keta >= 10:
    t = len(cx//a)
    print(10**9)
else:
    cx = x - keta*b
    if cx//a >= 10**9:
        print(10**9)
    else:
        if len(cx//a) > keta:
            print(10**(keta)-1)
        else:
            print(cx//a)
Problem p03253 (python)

Fixed submission:
from collections import Counter
import math
mod = 10**9+7
N,M = map(int,input().split())
factors = []
f = 2
while M%f==0:
    M//=2
    factors.append(f)
f = 3
while f*f<=M:
    if M%f==0:
        M//=f
        factors.append(f)
    else:
        f+=2
if M!=1:
    factors.append(M)
count = Counter(factors)

def choose(n,k):
    return math.factorial(n)//(math.factorial(n-k)*math.factorial(k))
ans = 1
for v in count.values():
    ans *= choose(N+v-1,N-1)
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
from math import factorial
N,M = map(int,input().split())

# 因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

# 重複組み合わせ
# フェルマーの小定理nHk≡(n+k−1)!⋅(k!)M−2⋅((n−1)!)M−2(modM)
def comb(n,k,p):
    """power_funcを用いて(nCk) mod p を求める"""
    if n<=0 or k<0 or n<k: return 0
    if k==0　or n==1: return 1
    a=factorial(n+k-1) %p
    b=factorial(k) %p
    c=factorial(n-1) %p
    return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p

def power_func(a,b,p):
    """a^b mod p を求める"""
    if b==0: return 1
    if b%2==0:
        d=power_func(a,b//2,p)
        return d*d %p
    if b%2==1:
        return (a*power_func(a,b-1,p ))%p

a = prime_factorize(M)
c = Counter(a)
l = []
ans = 1
for i in c.values():
    # それぞれの余りがわかっている時、その積の余りを求める時は以下
    ans *= comb(N,i,10**9+7)
    ans %= 10**9+7

print(ans)
Problem p02629 (python)

Fixed submission:
N=int(input())
def kore(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return kore(num//26-1)+chr(90)
    else:
        return kore(num//26)+chr(64+num%26)
s=kore(N)
s=s.lower()
print(s)

Buggy submission (verdict: Runtime Error):
N=int(input())
def kore(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
s=kore(N)
s.lower()
print(s)
Problem p02951 (python)

Fixed submission:
a, b, c = map(int, input().split(" "))
res = (c - (a - b))
if res > 0:
    print(str(res))
else:
    print("0")

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




list_a=np.arange(1, N+1)
list_b =[]




for i in list_a:
    if  len(str(i))%2 !=0:
        list_b.append(i)

print(len(list_b))
Problem p02987 (python)

Fixed submission:
s = input()
if len(set(s))==2 and s.count(s[0])==2:
  print("Yes" )
else:
  print("No")
  
#set関数とはリストやタプルから重複した要素を取り除くことができるる。
#count関数とは

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

li = list(map(int,input().split()))

ans= 0

for i in range(1,n-1):
    lis= sorted([li[i],li[i-1],li[i+1]])
    #print(lis)
    if lis[1]==li[i]:
        ans +=1
print(ans)
Problem p02688 (python)

Fixed submission:
num_sunuke, num_okashi_kind = map(int, input().split())
sunuke = [0] * (num_sunuke+1)

ans = 0
for idx_okashi_kind in range(1, num_okashi_kind+1) :
    num_have_okashi = int(input())
    idx_sunuke_with_okashi = map(int,input().split())

    for i in range(1, num_have_okashi+1) :
        for j in idx_sunuke_with_okashi :
            sunuke[j] = 1

for s in sunuke :
    if s == 1 :
        ans = ans + 1

print(num_sunuke - ans)

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

sunuke = [[0] * (n+2)] * (k+2)
ans = 0
for j in range(1, k+1) :
    num_have_okashi = int(input())
    oakshi_sunuke = list(map(int,input().split()))

    for i in oakshi_sunuke :
        sunuke[i][j] = 1
        print('num_have_okashi = [%d]' % (num_have_okashi))
        print(oakshi_sunuke)
        print('sunuke[%d][%d] = %d' % (i, j, sunuke[i][j]))
        ans = ans + 1
        break

print(n-ans)
Problem p02659 (python)

Fixed submission:
a, b = input().split()
a = int(a)
b, c = map(int, b.split("."))
b = 100*b+c

print(a*b // 100)

Buggy submission (verdict: Runtime Error):
a, b = input().split()
a = int(a)
b = int(float(b)*100)
print(a*b /?100)
Problem p03072 (python)

Fixed submission:
n = int(input())
h = [int(x) for x in input().split()]
c = 1

for i in range(1, n):
    if h[i] >= max(h[:i]):
        c += 1
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(x) for x in input().split()]
c = 0
for i in range(n):
    if h[i] >= max(h[:i]):
        c += 1
print(c)
Problem p03075 (python)

Fixed submission:
a, b, c, d, e, k = [int(input()) for _ in range(6)]


i = e-a

if i <= k:
    print("Yay!")
else:
    print(":(")

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

i = abs(e-a)

if i < k:
    print("Yay!")
else:
    print(":(")
Problem p03137 (python)

Fixed submission:
def main():
    N, M = map(int, input().split())
    X = [j for j in map(int, input().split())]
    if N >= M:
        print(0)
        exit()
    X.sort()
    s = max(X)-min(X)
    d = [X[i+1]-X[i] for i in range(M-1)]
    d.sort()
    if N == 1:
        print(s)
    else:
        print(s-sum(d[-N+1:]))


main()

Buggy submission (verdict: Runtime Error):
def main():
    N, M = map(int, input().split())
    X = [j for j in map(int, input().split())]
    if N >= M:
        print(0)
        exit()
    X.sort()
    s = max(X)-min(X)
    d = [X[i+1]-X[i] for i in range(M-1)]
    d.sort()
    if N = 1:
        print(s-d[-1])
    else:
        print(s-sum(d[-N+1:]))


main()

Buggy submission (verdict: Runtime Error):
deff main():
    N, M = map(int, input().split())
    if N >= M:
        print(0)
        exit()
    X = [j for j in map(int, input().split())]
    X.sort()
    s = max(X)-min(X)
    d = [X[i+1]-X[i] for i in range(M-1)]
    d.sort()

    print(s-sum(d[-N+1:]))

main()
Problem p02676 (python)

Fixed submission:
K = int(input()) 
S = input()

if len(S) > K:
    S = S[:K]  + '...'

print(S)

Buggy submission (verdict: Runtime Error):
K = int(input()) 
S = input()

if len(S) > K:
    S = S[:K]  + '...'

print(a)

Buggy submission (verdict: Runtime Error):
K = int(input()) 
S = input()

if len(S) > K:
    a = S[:K]  + '...'

print(a)

Buggy submission (verdict: Runtime Error):
K = int(input()) 
S = input()

if len(S) > K:
    # print(S[:K])
    a = S[:K]  + '...'
    # S = S[:K].append('...')

print(a)
Problem p02711 (python)

Fixed submission:



N = input()

if N[0]=='7' or N[1]=='7' or N[2]=='7':
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):



N = input()

N1 = N[]
print(N1)
if N[0]=='7' or N[1]=='7' or N[2]=='7':
    print('Yes')
else:
    print('No')
Problem p02781 (python)

Fixed submission:
N= int(input())
K= int(input())

from math import factorial

str_n = str(N)
len_n = len(str(str_n))

def conb(n, r):
    return factorial(n)//factorial(r)//factorial(n-r)
    
def get_num(top, k_val, depth):
    if k_val==0:
        return 1
    elif k_val>(len_n-depth+1):
        return 0
    elif top:
        if int(str_n[depth - 1])==0:
            return get_num(top, k_val, depth + 1)
        else:
            b1 = get_num(top, k_val - 1, depth + 1)
            b2 = (int(str_n[depth-1])-1) * get_num(False, k_val-1, depth+1)
            b3 = get_num(False, k_val, depth + 1)
            return b1+b2+b3
    else:
        return 9**(k_val) * conb(len_n - depth + 1, k_val)
    
    
a1 = get_num(True, K-1, 2)
a2 = (int(str_n[0])-1)*get_num(False, K-1, 2)
a3 = get_num(False, K, 2)

#print(a1, a2, a3)
print(a1+a2+a3)

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

from scipy.misc import comb
from math import factorial

n_d = len(str(n))
digits = str(n)

def get_num(top, k_val, d_num):
  #print(top, k_val, d_num)
  if d_num>n_d:
    return 1
  elif k_val==0:
    return 1
  elif top:
    below1 = get_num(True, k_val-1, d_num+1)
    below2 = (int(digits[d_num])-1) * get_num(False, k_val-1, d_num+1)
    below3 = get_num(False, k_val, d_num+1)
    return below1 + below2 + below3
  else:
    return factorial(n_d-d_num) / factorial(k_val) / factorial(n_d - d_num - k_val) * 9**(k_val)
    #return comb(n_d-d_num, k_val) * 9**(k_val)



if k<n_d :
  #a = comb(n_d-1, k)
  a = factorial(n_d-1) / factorial(k) / factorial(n_d-1 - k)
else:
  a = 0
a *= 9**k
#b = (int(digits[0]) - 1) * comb(n_d-1, k-1) * 9**(k-1)
c1 = get_num(True, k-1, 1)
c2 = (int(digits[0]) - 1) * get_num(False, k-1, 1)

#print(a, c1, c2)
print(int(a+c1+c2))
Problem p02792 (python)

Fixed submission:
N = int(input())
 
c = [[0]*10 for _ in range(10)]
for i in range(1,N+1):
	c[int(str(i)[0])][int(str(i)[-1])] += 1
    
ans = 0
for i in range(1, 10):
	for j in range(1, 10):
		ans += c[i][j]*c[j][i]

print(ans)

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

str_n = str(n)
 
c = [[0]*10 for _ in range(10)]
for i in range(1,N+1):
	c[int(str(i)[0])][int(str(i)[-1])] += 1
    
ans = 0
for i in range(1, 10):
	for j in range(1, 10):
        ans += c[i][j]*c[j][i]

print(ans)
Problem p02831 (python)

Fixed submission:
import fractions

a, b = map(int, input().split())

print((a * b) // fractions.gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())

print((a * b) // math.gcd(a, b))
Problem p03835 (python)

Fixed submission:
k,s=map(int, input().split())
ans = 0
for i in range(k+1):
  for j in range(k+1):
    x = s-i-j
    if x>=0 and x<=k:
      ans += 1

print(ans)

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

for i in range(k+1):
  for j in range(k+1):
    x = s-i-j
    if x>=0 and x<=k:
      ans += 1

print(ans)