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

Fixed submission:
import sys
import numpy as np
import random
import math
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	n = I()
	x, y = 1, 1
	for _ in range(n):
		t, a = LI()
		m = max((x+t-1)//t,(y+a-1)//a)
		x, y = m*t, m*a
	print(x+y)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
import random
import math
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	n = I()
	x, y = 1, 1
	for _ in range(n):
		t, a = LI()
		m = max((x+t-1)//a,(y+a-1)//b)
		x, y = m*t, m*a
	print(x+y)


if __name__ == '__main__':
    main()
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
 
p = list(map(int, input().split()))
p = sorted(p)
 
if n == 0:
    print(x)
    exit()
 
q = [i for i in range(0, 101+1)]
r = []
 
for i in q:
    if i not in p:
        r.append(i)

s = [abs(x-i) for i in r]
 
print(r[s.index(min(s))])

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

if n == 0:
    print(x)
    exit()

p = list(map(int, input().split()))
p = sorted(p)
q = [i for i in range(1, 100+1)]
r = []


for i in q:
    if i not in p:
        r.append(i)

s = [abs(x-i) for i in r]

print(r[s.index(min(s))])
Problem p02664 (python)

Fixed submission:
t = input()
u = list(t)
if u[0] == '?':
    u[0] = 'D'
if u[-1] == '?':
    u[-1] = 'D'
for i in range(1, len(u)-1):
    if u[i] == '?':
        if u[i-1] == 'P':
            u[i] = 'D'
        elif u[i+1] == 'D':
            u[i] = 'P'
        else:
            u[i] = 'D'
print(''.join(u))

Buggy submission (verdict: Runtime Error):
t = input()
u = list(t)
if u[0] == '?':
    if u[1] == 'D':
        u[0] = 'P'
    else:
        u[0] = 'D'
if u[-1] == '?':
    u[-1] = 'D'
for i in range(1, len(u)-1):
    if u[i] == '?':
        if u[i-1] == 'P':
            u[i] = 'D'
        elif u[i+1] == 'D':
            u[i] = 'P'
        else:
            u[i] = 'D'
print(''.join(u))
Problem p02696 (python)

Fixed submission:
import math
a, b, n = map(int, input().split())
if b <= n:
    print(math.floor((a * (b-1)) / b) - a * math.floor((b-1) / b))
elif b > n:
    print(math.floor((a * (n)) / b) - a * math.floor((n) / b))

Buggy submission (verdict: Runtime Error):
a, b, n = map(int, input().split())
ans = [0] * n
for i in range(n):
    ans[i] = (a * (i+1) / b) // 1 - a * (((i+1) / b) // 1)
print(int(max(ans)))

Buggy submission (verdict: Runtime Error):
import math
a, b, n = map(int, input().split())
ans = [0] * n
for i in range(n):
    ans[i] = math.floor(a * (i+1) / b) - a * math.floor((i+1) / b)
print(max(ans))
Problem p02713 (python)

Fixed submission:
import math
k = int(input())
sum =0
for a in range(1, k+1):
     for b in range(1, k+1):
          for c in range(1, k+1):
               sum += math.gcd(math.gcd(a, b), c)
print(sum)

Buggy submission (verdict: Runtime Error):
import math
k = int(input())
sum =0
for a in range(1, k+1):
     for b in range(1, k+1):
         x = gcd(a, b)
         for c in range(1, k+1):
             sum += gcd(x, c)
print(sum)
Problem p02719 (python)

Fixed submission:
n, k = map(int, input().split())
a = n % k
b = k - a
print(min(a, b))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
if min(n, k) ==1:
    print("0")
else:
    if n < k:
        n, k = k, n
    while n % k != 0:
        n, k = k, n % k
    print(k)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
x = n
i = 0
c = max(n, k) / min(n, k)
if k == 1:
    print("0")
else:
    while i <= c:
        x = abs(x - k)
        i += 1
    print(min(n, x))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
x = n
i = 0
c = max(n, k) / min(n, k)
if k == 1:
    print("0")
else:
    while i <= c:
        x = abs(x - k)
        i += 1
print(min(n, x))
Problem p02730 (python)

Fixed submission:
s = input()
a = s[:(len(s)-1)//2:]
b = s[(len(s)+1)//2:]
if a == b and a == a[::-1]:
     print("Yes")
else:
     print("No")

Buggy submission (verdict: Runtime Error):
s = input()
l = s[:(len(s)-1)//2:]
r = s[(len(s)+1)//2:]
if a == b and a == a[::-1]:
     print("Yes")
else:
     print("No")
Problem p02731 (python)

Fixed submission:
print((int(input())/3)**3)

Buggy submission (verdict: Runtime Error):
l = int(input())
ans = []
for i in range(1, l//3+1):
    for j in range(1, l//3+1):
        ans.append(i*j*(l-i-j))
print(max(ans))
Problem p02755 (python)

Fixed submission:
import math
a, b = map(int, input().split())
x = []
y = []
for i in range(math.ceil(b/0.1), math.floor((b+1)/0.1)):
    y.append(i)
for i in range(math.ceil(a/0.08), math.floor((a+1)/0.08)):
    x.append(i)
    if y.count(i) == 1:
        print(i)
        exit()
print('-1')

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
if n%(a+b) < a:
    print(n//(a+b)*a+n%(a+b))
else:
    print(n//(a+b)*a+a)
Problem p02993 (python)

Fixed submission:
s = list(input())
if s[0] != s[1] and s[1] != s[2] and s[2] != s[3]:
     print('Good')
else:
     print('Bad')

Buggy submission (verdict: Runtime Error):
s = list(int(input()))
if s[0] != s[1] and s[1] != s[2] and s[2] != s[3]:
     print('Good')
else:
     print('Bad')
Problem p02999 (python)

Fixed submission:
x, a = map(int,input().split())
if x < a:
     print("0")
else:
     print("10")

Buggy submission (verdict: Runtime Error):
x, a = int(input())
if x < a:
     print("0")
else:
     print("10")
Problem p03086 (python)

Fixed submission:
s = input()
count = 0
ans = 0
for i in s:
    if i in'AGCT':
        count += 1
    else:
        count = 0
    ans = max(ans, count)
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
count = 0
ans = []
for i in s:
    if i == 'A' or i =='C' or i =='G' or i =='T':
        count += 1
    else:
        ans.append(count)
        count = 0
print(max(ans))

Buggy submission (verdict: Runtime Error):
s = list(input())
t = [0] * len(s)
count = 0
ans = []
for i in range(len(s)):
    if s[i] == 'A' or s[i] =='C' or s[i] =='G' or s[i] =='T':
        t[i] = 1
        count += 1
    else:
        ans.append(count)
        count = 0
print(max(ans))
Problem p03239 (python)

Fixed submission:
n, t = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
x = []
for i in range(n):
     if a[i][1] <= t:
          x.append(a[i][0])
if x != []:
     print(min(x))
else:
     print("TLE")

Buggy submission (verdict: Runtime Error):
n, t = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
x = []
for i in range(n):
     if a[i][1] <= t:
          x.append(a[i][0])
print(min(x))
Problem p03285 (python)

Fixed submission:
n = int(input())

ans = []
for i in range(n//4+1):
    for j in range(n//7+1):
        if 4*i+7*j <= n:
            ans.append(4*i+7*j)
if ans.count(n) != 0:
    print('Yes')
else:
    print('No')

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

if n % 4 == 0 or n % 7 == 0
    print('Yes')

elif (n % 7) % 4 == 0:
    print('Yes')

else:
    print('No')
Problem p03289 (python)

Fixed submission:
s = input()
ans = 'WA'
a = []
if s[0] == 'A' and s[2:-1].count('C') == 1:
     a = list(s)
     a.remove('A')
     a.remove('C')
     a = str(a)
     if a.islower() == True:
          ans = 'AC'
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1 and s[:2].count('C') == 0 and s[-1:].count('C' == 0):
     list(s).remove("A")
     list(s).remove("C")
     print(s.islower())
     if s.islower() == 0:
          print("AC")
          exit()
else:
     print("WA")
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
b = int(input())
c = a * b
if c%2 == 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = a * b
if c%2 == 0:
    print("Even")
else:
    print("Odd")
Problem p03456 (python)

Fixed submission:
import math
a, b = map(str, input().split())
c = int(a+b)
if float.is_integer(math.sqrt(c)) == True:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a, b = map(str, input().split())
c = int(a+b)
if float.is_integer(math.sqrt(c)) == True:
    print('Yes')
else:
    print('No')
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
print(input().conut("1"))

Buggy submission (verdict: Runtime Error):
print(input().conut("1"))
Problem p03607 (python)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]

a = sorted(a)
tmp = 0
ans = 0
for i in a:
    if i == tmp:
        ans -= 1
        tmp = 0
    else:
        ans += 1
        tmp = i

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]

a = sorted(a):
tmp = 0
ans = 0
for i in a:
    if i == tmp:
        ans -= 1
        tmp = 0
    else:
        ans += 1
        tmp = i
print(ans)
Problem p03671 (python)

Fixed submission:
a, b, c = map(int, input().split())
print(a + b + c - max(a, b, c))

Buggy submission (verdict: Runtime Error):
a, b, c = map(int(input().split()))
print(sum(a, b, c)-max(a, b, c))
Problem p03729 (python)

Fixed submission:
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a, b, c = map(input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')
Problem p03778 (python)

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

if b + w < a:
    print(a - (b + w))
elif a <= b + w <= a + w:
    print(0)
elif a <= b <= a + w:
    print(0)
elif a + w < b:
    print(b - (a + w))

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

if b + w < a:
    print(a - (b + w))
elif a <= b + w <= a + w:
    print(0):
elif a <= b <= a + w:
    print(0)
elif a + w < b:
    print(b- (a + w))
Problem p03795 (python)

Fixed submission:
n = int(input())
print(n*800-n//15*200)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
print(n*800-n//15*200)
Problem p03844 (python)

Fixed submission:
a, op, b = input().split()
if op == '+':
  print(int(a)+int(b))
else:
  print(int(a)-int(b))

Buggy submission (verdict: Runtime Error):
a, op, b = map(input().split())
if op == '+':
  print(int(a)+int(b))
else:
  print(int(a)-int(b))

Buggy submission (verdict: Runtime Error):
a, op, b = map(input().split())
if op == '+':
  print(int(a)+int(b)
else:
  print(int(a)-int(b))
Problem p03852 (python)

Fixed submission:
c = input()
if c == 'a' or c =='i' or c == 'u' or c == 'e' or c =='o':
  print('vowel')
else:
  print('consonant')

Buggy submission (verdict: Runtime Error):
c = input()
if c == 'a' or c =='i' or c == 'u' or c == 'e' or c =='o':
  priint('vowel')
else:
  print('consonant')

Buggy submission (verdict: Runtime Error):
c = input()
if c == 'a' or c =='i' or c == 'u' or c == 'e' or c =='O':
  priint('vowel')
else:
  print('consonant')
Problem p04043 (python)

Fixed submission:
n = list(map(int, input().split()))
if n.count(5) == 2 and n.count(7) == 1:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))
if n.count(5) == 2 and n.count(7) == 1:
  print('YES')
else:
  orint('NO')
Problem p02641 (python)

Fixed submission:
x,n=map(int,input().split())
if n==0:
  print(x)
else:
  p=list(map(int,input().split()))
  p.sort()
  ans=0
  on=1
  dif=1
  if x in p:
    now=p.index(x)
    while on==1:
      if now-dif<0:
        ans=x-dif
        on=0
      elif p[now-dif]!=x-dif:
        ans=x-dif
        on=0
      elif now+dif==n:
        ans=x+dif  
        on=0
      elif p[now+dif]!=x+dif:
        ans=x+dif
        on=0
      else:
        dif+=1
    print(ans)
  else:
    print(x)

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
if n==0:
  print(x)
else:
  p=list(map(int,input().split()))
  p.sort()
  ans=0
  on=1
  dif=1
  if x in p:
    now=p.index(x)
    while on==1:
      if p[now-dif]!=x-dif:
        ans=x-dif
        on=0
      elif p[now+dif]!=x+dif:
        ans=x+dif
        on=0
      else:
        dif+=1
    print(ans)
  else:
    print(x)
Problem p02658 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
i=0
con=1
mod=10**18
ans=1
why=0
while con==1:
  ans=ans*a[i]
  i+=1
  if ans>mod and i!=n:
    ans=1
    why=1
  elif ans>mod and i==n:
    con=0
    ans=1
    why=1
  elif i==n:
    con=0
if ans==0:
  print(0)
elif why==1:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
i=0
con=1
mod=10**18
ans=1
why=0
while con==1:
  ans=ans*a[i]
  i+=1
  if ans>mod:
    ans=1
    why=1
  elif i==n:
    con=0
if ans==0:
  print(0)
elif why==1:
  print(-1)
else:
  print(ans)
Problem p02691 (python)

Fixed submission:
import numpy as np
n=int(input())
ans=0
a=list(map(int,input().split()))
now=max(a)
noww=now
k=n+2*now
matc=[0]*(n+2)
mat2=[0]*(n+2)
for i in range(n):
  neg=i-a[i]
  pos=i+a[i]
  if neg>=0:
    matc[neg]+=1
  if pos<=n:
    mat2[pos]+=1
  now+=1
#print(matc)
for j in range(n+2):
  ans+=matc[j]*mat2[j]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
a=list(map(int,input().split()))
now=max(a)
noww=now
ka=n+2*now
matc=[0]*ka
mat2=[0]*ka
for i in range(n):
  matc[now-a[i]]+=1
  mat2[now+a[i]]+=1
  now+=1
#print(matc)
for j in range(noww,noww+n+1):
  ans+=matc[j]*mat2[j]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
a=list(map(int,input().split()))
now=max(a)
noww=now
matc=list(0 for i in range(n+2*now))
mat2=list(0 for i in range(n+2*now))
for i in range(n):
  matc[now-a[i]]+=1
  mat2[now+a[i]]+=1
  now+=1
#print(matc)
for j in range(noww,noww+n+10):
  ans+=matc[j]*mat2[j]
print(ans)
Problem p02713 (python)

Fixed submission:
import math
from functools import reduce
k=int(input())
def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans=0
for i in range(1,k+1):
  for j in range(i,k+1):
    for l in range(j,k+1):
      if l==i:
        ans+=gcd(i,j,l)
      elif i==j or j==l:
        ans+=3*gcd(i,j,l)
      else:
        ans+=6*gcd(i,j,l)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
k=int(input())
def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans=0
for i in range(1,k+1):
  for j in range(j,k+1):
    for l in range(l,k+1):
      if l==i:
        ans+=gcd(i,j,l)
      elif i==j or j==l:
        ans+=2*gcd(i,j,l)
      else:
        ans+=gcd(i,j,l)
print(ans)
Problem p03061 (python)

Fixed submission:
def gcd(a,b):
  if a==b:
    return a 
  elif a<b:
    a,b=b,a
    while a%b!=0:
      a,b=b,a%b
    return b
  else:
    while a%b!=0:
      a,b=b,a%b
    return b
 

N=int(input())
A=list(map(int,input().split()))

data_ans=[]
data1=[A[0]]
data2=[A[N-1]]
l=A[0]
m=A[N-1]
for i in range(1,N-2):
  l=gcd(l,A[i])
  m=gcd(m,A[N-i-1])
  data1.append(l)
  data2.append(m)
l=gcd(l,A[N-2])
m=gcd(m,A[1])
data_ans.append(l)
data_ans.append(m)
for i in range(0,N-2):
  data_ans.append(gcd(data1[i],data2[N-3-i]))
print(max(data_ans))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  if a==b:
    return a 
  elif a<b:
    a,b=b,a
    while a%b!=0:
      a,b=b,a%b
    return b
  else:
    while a%b!=0:
      a,b=b,a%b
    return b
 

N=int(input())
A=list(map(int,input().split()))

data_ans=[]
data1=[A[0]]
data2=[A[N-1]]
l=A[0]
m=A[N-1]
for i in range(1,N-3):
  l=gcd(l,A[i])
  m=gcd(m,A[N-i])
  data1.append(l)
  data2.append(m)
l=gcd(l,A[N-1])
m=gcd(m,A[1])
data_ans.append(l)
data_ans.append(m)
for i in range(0,N-3):
  data_ans.append(data1[i],data2[N-2-i])
print(max(data_ans))
Problem p03324 (python)

Fixed submission:
D,N=map(int,input().split())
F=100**D
if N<100:
  print(F*N)

else:
  print(F*101)

Buggy submission (verdict: Runtime Error):
D,N=map(int,input().split())
if N<100:
  F=100**D
  print(F*N)

else:
  print(F*101)
Problem p02632 (python)

Fixed submission:
MOD = 10**9+7

k = int(input())
s = input()
MAX = k + len(s)

factorial = [0] * (MAX + 1)
factorial[0] = 1
for i in range(1, MAX + 1):
    factorial[i] = factorial[i-1] * i % MOD


ifactorial = [0] * (MAX + 1)
ifactorial[MAX] = pow(factorial[MAX], MOD - 2, MOD)
for i in range(MAX, 0, -1):
    ifactorial[i - 1] = ifactorial[i] * i % MOD

pow25 = [1] * (k + 1)
pow26 = [1] * (k + 1)
for i in range(k):
    pow25[i + 1] = pow25[i] * 25
    pow25[i + 1] %= MOD
    pow26[i + 1] = pow26[i] * 26
    pow26[i + 1] %= MOD


def combination(n, k):
    ret = factorial[n] * ifactorial[k] * ifactorial[n - k]
    return ret % MOD


ans = 0
for i in range(k + 1):
    tmp = combination(i + len(s) - 1, len(s) - 1)
    tmp *= pow25[i]
    tmp %= MOD
    # tmp *= pow(25, i, MOD)
    tmp *= pow26[k - i]
    # tmp *= pow(26, k - i, MOD)
    tmp %= MOD
    ans += tmp
    ans %= MOD
print(ans)

Buggy submission (verdict: Runtime Error):
from functools import lru_cache
import sys
sys.setrecursionlimit(10**6)


@lru_cache
def factorial(n):
    if n == 0:
        return 1
    return (n * factorial(n-1)) % MOD


@lru_cache
def ifactorial(n):
    return pow(factorial(n), MOD-2, MOD)


@lru_cache
def combination(n, k):
    ret = factorial(n) * ifactorial(k)
    ret %= MOD
    ret *= ifactorial(n - k)
    return ret % MOD


k = int(input())
s = input()
MOD = 10**9+7

ans = 0
for i in range(k + 1):
    tmp = combination(i + len(s) - 1, len(s) - 1)
    tmp *= pow(25, i, MOD)
    tmp *= pow(26, k - i, MOD)
    tmp %= MOD
    ans += tmp
    ans %= MOD
print(ans)

Buggy submission (verdict: Runtime Error):
from functools import lru_cache


@lru_cache
def factorial(n):
    if n == 0:
        return 1
    return (n * factorial(n-1)) % MOD


@lru_cache
def ifactorial(n):
    return pow(factorial(n), MOD-2, MOD)


@lru_cache
def combination(n, k):
    return (factorial(n) * ifactorial(k) * ifactorial(n - k)) % MOD


k = int(input())
s = input()
MOD = 10**9+7

ans = 0
for i in range(k + 1):
    tmp = combination(i + len(s) - 1, len(s) - 1)
    tmp *= pow(25, i, MOD)
    tmp *= pow(26, k - i, MOD)
    tmp %= MOD
    ans += tmp
    ans %= MOD
print(ans)

Buggy submission (verdict: Runtime Error):
from functools import lru_cache


@lru_cache
def factorial(n):
    if n == 0:
        return 1
    return n * factorial(n-1)


@lru_cache
def combination(n, k):
    return factorial(n) // factorial(k) // factorial(n - k)


k = int(input())
s = input()
MOD = 10**9+7

ans = 0
for i in range(k + 1):
    tmp = combination(i + len(s) - 1, len(s) - 1)
    tmp *= pow(25, i, MOD)
    tmp *= pow(26, k - i, MOD)
    tmp %= MOD
    ans += tmp
    ans %= MOD
print(ans)

Buggy submission (verdict: Runtime Error):
from functools import lru_cache


@lru_cache
def factorial(n):
    if n == 0:
        return 1
    return (n * factorial(n-1)) % MOD


def combination(n, k):
    return factorial(n) // factorial(k) // factorial(n - k)


k = int(input())
s = input()
MOD = 10**9+7

ans = 0
for i in range(k + 1):
    tmp = combination(i + len(s) - 1, len(s) - 1)
    tmp *= pow(25, i, MOD)
    tmp *= pow(26, k - i, MOD)
    ans += tmp
    ans %= MOD
print(ans)
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
ps = list(map(int, input().split()))
nums = list(range(-1, 102))
for p in ps:
    nums.remove(p)
min_diff = float("inf")
min_original = float("inf")
for num in nums:
    diff = abs(num - x)
    if diff < min_diff:
        min_diff = diff
        min_original = num
    elif diff == min_diff:
        if num < min_original:
            min_original = num
print(min_original)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
ps = list(map(int, input().split()))
nums = list(range(1, 101))
for p in ps:
    nums.remove(p)
for i, num in enumerate(nums):
    if num > x:
        break
if i - 1 < 0:
    print(nums[i])
else:
    diff1 = abs(nums[i - 1] - x)
    diff2 = abs(nums[i] - x)
    if diff1 < diff2:
        print(nums[i - 1])
    elif diff1 > diff2:
        print(nums[i])
    else:
        print(nums[i-1])
Problem p02642 (python)

Fixed submission:
from collections import Counter
n = int(input())
a = Counter(map(int, input().split()))
MAX = 1000000 + 9
dp = [True] * MAX
for num in a:
    for i in range(num*2, MAX, num):
        dp[i] = False
ans = 0
for num in a:
    if dp[num] and a[num] == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = Counter(map(int, input().split()))
MAX = 2*100000 + 9
dp = [True] * MAX
for num in a:
    for i in range(num*2, MAX, num):
        dp[i] = False
ans = 0
for num in a:
    if dp[num] and a[num] == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = Counter(map(int, input().split()))
MAX = 2*100000 + 9
dp = [True] * MAX
for num in a.keys():
    for i in range(num*2, MAX, num):
        dp[i] = False
ans = 0
for num in a:
    if dp[num] and a[num] == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = Counter(map(int, input().split()))
ans = n
for num, count in a.items():
    if count > 1:
        ans -= count
        continue
    if 1 in a and num != 1:
        ans -= count
        continue
    i = 2
    if num % i == 0:
            if i in a or (num // i) in a:
                ans -= count
                break
        i += 1
    while i * i <= num:
        if num % i == 0:
            if i in a or (num // i) in a:
                ans -= count
                break
        i += 2
print(ans)