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

Fixed submission:
import sys
from collections import defaultdict as dd
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
N, M = map(int, input().split())
e = dd(list)
inc = [0] * (N + 1)
for _ in range(M):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)
  inc[u] += 1
  inc[v] += 1
s = 0
inc[0] = float("inf")
for i in range(N):
  if inc[i] < inc[s]:
    s = i
vis = set()
vis.add(s)
res = []
def dfs(x):
  global vis
  global res
  vis.add(x)
  res.append(x)
  c = 0
  for y in e[x]:
    if y in vis: continue
    c += 1
    dfs(y)
  if c == 0:
    for y in e[s]:
      if not (y in vis):
        c += 1
    if c == 0:
      print(len(res))
      print(*res)
      exit(0)
  res.pop()
  vis.discard(x)

dfs(s)

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N, M = map(int, input().split())
e = dd(list)
inc = [0] * (N + 1)
for _ in range(M):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)
  inc[u] += 1
  inc[v] += 1
s = 0
inc[0] = float("inf")
for i in range(N):
  if inc[i] < inc[s]:
    s = i
vis = set()
vis.add(s)
res = []
def dfs(x):
  global vis
  global res
  vis.add(x)
  res.append(x)
  c = 0
  for y in e[x]:
    if y in vis: continue
    c += 1
    dfs(y)
  if c == 0:
    for y in e[s]:
      if not (y in vis):
        c += 1
    if c == 0:
      print(len(res))
      print(*res)
      exit(0)
  res.pop()
  vis.discard(x)

dfs(s)
Problem p03780 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
t = 0
res = -1
for i in range(N):
  if t + a[i] < K: t += a[i]
  else: res = i
print(N - res - 1)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

def check(x):
  dp = [0] * (K + 1)
  dp[0] = 1
  for i in range(N):
    for j in range(K - 1, -1, -1):
      if i == x: continue
      if dp[j]:
        dp[min(K, j + a[i])] = dp[j]
  for j in range(max(0, K - a[x]), K):
    if dp[j]: return True
  return False
#for i in range(N): print(check(i))

if check(0):
  print(0)
  exit(0)
ok = N + 1
ng = 0
while ok - ng > 1:
  m = (ok + ng) // 2
  if check(m): ok = m
  else: ng = m
print(ok)
Problem p03828 (python)

Fixed submission:
N = int(input())
mod = 10 ** 9 + 7 
f = 1
res = 1
for i in range(2, N + 1): f *= i
for i in range(2, N + 1):
  c = 0
  while f % i == 0:
    c += 1
    f //= i
  res *= (c + 1) % mod
  res %= mod
print(res % mod)

Buggy submission (verdict: Runtime Error):
from math import sqrt
N = int(input())
mod = 10 ** 9 + 7 
divs = [0] * (N + 1)
for i in range(1, N + 1):
  for j in range(1, sqrt(i)):
    if i % j == 0:
      divs[j] += 1
print(sum(divs))
Problem p03829 (python)

Fixed submission:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
res = 0
for i in range(N - 1):
  if (X[i + 1] - X[i]) * A > B:
    res += B
  else:
    res += (X[i + 1] - X[i]) * A
print(res)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
res = 0
for i in range(N - 1):
  if X[i + 1] - X[i] > B:
    res += B
  else:
    res += X[i + 1] = X[i]
print(res)
Problem p03832 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N, A, B, C, D = map(int, input().split())
dp = [[0] * (B + 1) for _ in range(N + 1)]
mod = 10 ** 9 + 7

class Factorial:
  def __init__(self, n, mod):
    self.f = [1]
    for i in range(1, n + 1):
      self.f.append(self.f[-1] * i % mod)
    self.i = [pow(self.f[-1], mod - 2, mod)]
    for i in range(1, n + 1)[: : -1]:
      self.i.append(self.i[-1] * i % mod)
    self.i.reverse()
  def factorial(self, i):
    return self.f[i]
  def ifactorial(self, i):
    return self.i[i]
  def combi(self, n, k):
    return self.f[n] * self.i[n - k] % mod * self.i[k] % mod

f = Factorial(1000 * 1000, mod)
dp[0][A - 1] = 1
for i in range(N):
  for k in range(A - 1, B):
    x = k + 1
    t = 1
    for j in range(1, C): t = t * f.combi(x * j, x) % mod
    for j in range(C, D + 1):
      if i + x * j <= N:
        t = t * f.combi(x * j, x) % mod
        dp[i + x * j][x] += dp[i][k] * f.combi(N - i, x * j) % mod * t % mod * f.ifactorial(j) % mod
        dp[i + x * j][x] %= mod
      else: break
      #print(j, t, dp)
    dp[i][x] += dp[i][k]
    dp[i][x] %= mod
    #print(dp)

res = 0
for k in range(A, B + 1):
  res += dp[-1][k]
  res %= mod
print(res)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, A, B, C, D = map(int, input().split())
dp = [[0] * (B + 1) for _ in range(N + 1)]
mod = 10 ** 9 + 7

class Factorial:
  def __init__(self, n, mod):
    self.f = [1]
    for i in range(1, n + 1):
      self.f.append(self.f[-1] * i % mod)
    self.i = [pow(self.f[-1], mod - 2, mod)]
    for i in range(1, n + 1)[: : -1]:
      self.i.append(self.i[-1] * i % mod)
    self.i.reverse()
  def factorial(self, i):
    return self.f[i]
  def ifactorial(self, i):
    return self.i[i]
  def combi(self, n, k):
    return self.f[n] * self.i[n - k] % mod * self.i[k] % mod

f = Factorial(N, mod)
dp[0][A - 1] = 1
for i in range(N):
  for k in range(A - 1, B):
    x = k + 1
    t = 1
    for j in range(1, C): t = t * f.combi(x * j, x) % mod
    for j in range(C, D + 1):
      if i + x * j <= N:
        t = t * f.combi(x * j, x) % mod
        dp[i + x * j][x] += dp[i][k] * f.combi(N - i, x * j) % mod * t % mod * f.ifactorial(j) % mod
        dp[i + x * j][x] %= mod
      else: break
      #print(j, t, dp)
    dp[i][x] += dp[i][k]
    dp[i][x] %= mod
    #print(dp)

res = 0
for k in range(A, B + 1):
  res += dp[-1][k]
  res %= mod
print(res)
Problem p03846 (python)

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

A.sort()
mod = 10 ** 9 + 7
i = 0
res = 0
if N == 1:
  if A[0] == 0:
    print(1)
  else:
    print(0)
  exit(0)
if N % 2 == 1:
  res = 1
  i = 1
  if A[0] == A[1]:
    print(0)
    exit(0)
  if A[0] == 1:
    print(0)
    exit(0)
else:
  res = 2
  i = 2
  if A[0] != A[1]:
    print(0)
    exit(0)
  if A[0] == 0:
    print(0)
    exit(0)
while i < N - 1:
  if A[i] == A[i + 1]:
    if N % 2 == 0:
      if A[i] != 2 * (i / 2 + 1) - 1:
        res = 0
        break
    else:
      if A[i] != 2 * (i // 2 + 1):
        res = 0
        break
    res *= 2
    i += 2
  else:
    res = 0
    break
print(res % mod)

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

A.sort()
i = 0
res = 0
if N % 2 == 1:
  res = 1
  i = 1
  if A[0] == A[1]:
    print(0)
    exit(0)
  if A[0] == 1:
    print(0)
    exit(0)
else:
  res = 2
  i = 2
  if A[0] != A[1]:
    print(0)
    exit(0)
  if A[0] == 0:
    print(0)
    exit(0)
while i < N - 1:
  if A[i] == A[i + 1]:
    if N % 2 == 0:
      if A[i] != 2 * (i / 2 + 1) - 1:
        res = 0
        break
    else:
      if A[i] != 2 * (i // 2 + 1):
        res = 0
        break
    res *= 2
    i += 2
  else:
    res = 0
    break
print(res)

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

A.sort()
i = 0
if N % 2 == 1:
  i = 1
  if A[0] == A[1]:
    print(0)
    exit(0)
  if A[0] == 1:
    print(0)
    exit(0)
else:
  i = 2
  if A[0] != A[1]:
    print(0)
    exit(0)
  if A[0] == 0:
    print(0)
    exit(0)
res = 1
while i < N - 1:
  if A[i] == A[i + 1]:
    if N % 2 == 0:
      if A[i] != 2 * (i / 2 + 1) - 1:
        res = 0
        break
    else:
      if A[i] != 2 * (i // 2 + 1):
        res = 0
        break
    res *= 2
    i += 2
  else:
    res = 0
    break
print(res)

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

A.sort()
i = 0
if N % 2 == 1:
  i = 1
  if A[0] == A[1]:
    print(0)
    exit(0)
  if A[0] == 1:
    print(0)
    exit(0)
else:
  i = 2
  if A[0] != A[1]:
    print(0)
    exit(0)
  if A[0] == 0:
    print(0)
    exit(0)
res = 1
while i < N - 1:
  print("a", i)
  if A[i] == A[i + 1]:
    if N % 2 == 0:
      if A[i] != 2 * (i / 2 + 1) - 1:
        res = 0
        break
    else:
      if A[i] != 2 * (i // 2 + 1):
        res = 0
        break
    res *= 2
    i += 2
  else:
    res = 0
    break
print(res)

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

A.sort(reverse = True)
if N % 2 == 1:
  if A.count(A[-1]) == 0:
    print(0)
    exit(0)
else:
  if A.count(A[-1]) == 1:
    print(0)
    exit(0)
res = 1
i = 0
while i <= N - 1:
  if A[i] == A[i + 1]:
    res *= 2
    i += 2
  else:
    res = 0
    break
print(res)
Problem p04014 (python)

Fixed submission:
import math
#平方オーダーなら収まるので平方根とって方針を分ける
n = int(input())
s = int(input())
if n == s:
  print(n + 1)
  exit(0)
def sqrt(k):
  return int(math.sqrt(k))
def digitsum(b, m):
  if m < b:
    return m
  return digitsum(b, m // b) + m % b
#√nより小さいなら
#全探索余裕 桁は多くて40程度なので
for b in range(2, sqrt(n) + 1):
  if digitsum(b, n) == s:
    print(b)
    exit(0)
#√nより大きいなら
#b^2 > n である。２桁ということ
#2桁目がpなら、1桁目はs-pである
#pb + s - p = n
#b = (n - s) // p + 1
for p in range(sqrt(n), 0, -1):
  b = (n - s) // p + 1
  if b <= 1: continue
  if digitsum(b, n) == s:
    print((n - s) // p + 1)
    exit(0)
print(-1)

Buggy submission (verdict: Runtime Error):
import math
#平方オーダーなら収まるので平方根とって方針を分ける
n = int(input())
s = int(input())
if n == s:
  print(n + 1)
  exit(0)
def sqrt(k):
  return int(math.sqrt(k))
def digitsum(b, m):
  if m < b:
    return m
  return digitsum(b, m // b) + m % b
#√nより小さいなら
#全探索余裕 桁は多くて40程度なので
for b in range(2, sqrt(n) + 1):
  if digitsum(b, n) == s:
    print(b)
    exit(0)
#√nより大きいなら
#b^2 > n である。２桁ということ
#2桁目がpなら、1桁目はs-pである
#pb + s - p = n
#b = (n - s) // p + 1
for p in range(1, sqrt(n)):
  b = (n - s) // p + 1
  if b == 1: continue
  if digitsum(b, n) == s:
    print((n - s) // p + 1)
    exit(0)
print(-1)

Buggy submission (verdict: Runtime Error):
import math
#平方オーダーなら収まるので平方根とって方針を分ける
n = int(input())
s = int(input())
if s == 1:
  print(n)
  exit(0)
if n == s:
  print(n + 1)
  exit(0)
def sqrt(k):
  return int(math.sqrt(k))
def digitsum(b, m):
  if m < b:
    return m
  return digitsum(b, m // b) + m % b
#√nより小さいなら
#全探索余裕 桁は多くて40程度なので
for b in range(2, sqrt(n) + 1):
  if digitsum(b, n) == s:
    print(b)
    exit(0)
#√nより大きいなら
#b^2 > n である。２桁ということ
#2桁目がpなら、1桁目はs-pである
#pb + s - p = n
#b = (n - s) // p + 1
for p in range(2, sqrt(n)):
  if (n - s) % p == 0:
    b = (n - s) // p + 1
    if b == 1: continue
    if digitsum(b, n) == s:
      print((n - s) // p + 1)
      exit(0)
print(-1)

Buggy submission (verdict: Runtime Error):
import math
#平方オーダーなら収まるので平方根とって方針を分ける
n = int(input())
s = int(input())
if s == 1:
  print(n)
  exit(0)
def sqrt(k):
  return int(math.sqrt(k))
def digitsum(b, m):
  if m < b:
    return m
  return digitsum(b, m // b) + m % b
#√nより小さいなら
#全探索余裕 桁は多くて40程度なので
for b in range(2, sqrt(n) + 1):
  if digitsum(b, n) == s:
    print(b)
    exit(0)
#√nより大きいなら
#b^2 > n である。２桁ということ
#2桁目がpなら、1桁目はs-pである
#pb + s - p = n
#b = (n - s) // p + 1
for p in range(2, sqrt(n)):
  if (n - s) % p == 0:
    b = (n - s) // p + 1
    if digitsum(b, n) == s:
      print((n - s) // p + 1)
      exit(0)
print(-1)
Problem p04039 (python)

Fixed submission:
from bisect import bisect_left as bl
N, K = map(list, input().split())
D = list(map(int, input().split()))
D = [i for i in range(10) if not i in D]
res = []
big = 0
if int("".join([str(D[-1])] * len(N))) < int("".join(N)):
  if int(K[0]) < 9:
    if D[0] == 0:
      res = [D[1]] + [0] * len(N)
    else:
      res = [D[0]] * (len(N) + 1)
  else:
    res = [D[0]] * (len(N) + 1)
else:
  for i in range(len(N)):
    if big == 0:
      res.append(D[bl(D, int(N[i]))])
    else: res.append(D[0])
    if res[i] > int(N[i]): big = 1
print("".join(list(map(str, res))))

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left as bl
N, K = map(list, input().split())
D = list(map(int, input().split()))
D = [i for i in range(10) if not i in D]
res = []
big = 0
if int("".join([str(D[-1])] * len(N))) < int("".join(N)):
  if D[0] == 0:
    res = [D[1]] + [0] * len(N)
  else:
    res = [D[1]] * (len(N) + 1)
else:
  for i in range(len(N)):
    if big == 0:
      res.append(D[bl(D, int(N[i]))])
    else: res.append(D[0])
    if res[i] > int(N[i]): big = 1
print("".join(list(map(str, res))))
Problem p02554 (python)

Fixed submission:
n=int(input())
mod=(1e+9)+7
x=1
if n>=2:
  ans=1
else:
  ans=0
for i in range(n):
  x*=10
  ans*=8
  ans%=mod
  x%=mod
nin=1

for i in range(n):
  nin*=9
  nin%=mod
x+=ans
x%=mod
x-=(nin*2)%mod
if x<0:
  x+=mod
if n==1:
  print(0)
else:
  print(int(x%mod))

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

if a*b>0 and c*d>0 and (a<0 ^ c<0):
  ans=max(a*d,b*c)
else:
  ans=max(a*c,b*d)
print(ans)
Problem p02555 (python)

Fixed submission:
n=int(input())
ans=0
mod=int((1e+9)+7)
def cmb(n,r):
  if r<0 or r>n:
    return 0
  r=min(r,n-r)
  return g[n]*gg[r]*gg[n-r]%mod
g=[1,1]
gg=[1,1] 
inv=[0,1] 
for i in range(2,n+1):
  g.append((g[-1]*i)%mod)
  inv.append((-inv[mod%i]*(mod//i))%mod)
  gg.append((gg[-1]*inv[-1])%mod)

for i in range(n//3):
  x=n-(3*(i+1))
  ans+=cmb(x+i,i)

  ans%=mod
  
print(ans)

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

pnt=[]
for i in range(n):
  pnt.append(list(map(int,input().split())))
  #pnt.append([random.randint(int(-1e9),int(1e9)),random.randint(int(-1e9),int(1e9))])
pnt.sort(key=lambda x:abs(x[0])+abs(x[1]),reverse=True)
mn=list(reversed(pnt))
mx=0

for i in range(min(n,5000)):
  for j in range(i+1,min(n,5000)):
    mx=max(abs(pnt[i][0]-pnt[j][0])+abs(pnt[i][1]-pnt[j][1]),mx)
    mx=max(abs(pnt[i][0]-mn[j][0])+abs(pnt[i][1]-mn[j][1]),mx)
print(mx)
Problem p02606 (python)

Fixed submission:
x,y,d=map(int,input().split())
ans=0
for i in range(x,y+1):
  if i%d==0:
    ans+=1
print(ans)

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

ch=[0]*10001

for i in range(1,100):
  for j in range(1,100):
    for k in range(1,100):
      x=i**2+j**2+k**2+i*j+j*k+k*i
      if x<=10000:
        ch[x]+=1
for i in range(n):
  print(ch[i+1])
Problem p02612 (python)

Fixed submission:
n=int(input())
while n>0:
  n-=1000
print(abs(n))

Buggy submission (verdict: Runtime Error):
n=input()
while n>0:
  n-=1000
print(abs(n))
Problem p02618 (python)

Fixed submission:
d=int(input())
c=list(map(int, input().split()))
s=[]
for i in range(d):
  s.append(list(map(int, input().split())))
for i in s:
  print(i.index(max(i))+1)

Buggy submission (verdict: Runtime Error):
import random
import time
import copy
import math
start=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
for i in range(d):
  s.append(list(map(int,input().split())))
last=[0]*26
score=0
solution=[]
for day in range(1,d+1):
  co=[]
  dla=[]
  down=0
  for (i,j) in zip(last,c):
    down+=(day-i)*j
  for (i,j) in zip(last,c):
    dla.append(down-(j*(day-i)))
  for con in range(26):
    co.append(s[day-1][con]-dla[con])
  choice=co.index(max(co))
  score+=co[choice]
  last[choice]=day
  #print(choice+1)
  #print(score)
  solution.append(choice)
#print(score)
stemp=4000
etemp=100
def tem()
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.9:
  
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(1)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[day-i][j]
  try:
    prob = math.exp((sc-score)/tem())
  except:
    prob=0
  #print("{} {}".format(sc,prob))
  if prob>random.random():
    solution=copy.deepcopy(sol)
    score=sc
    #print(score)
for i in solution:
  print(i+1)
#print(sco)

Buggy submission (verdict: Runtime Error):
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))
last=[0]*26

for day in range(1,d+1):
  co=[]
  dla=[]
  down=0
  for (i,j) in zip(last,c):
    down+=(day-i)*j
  for (i,j) in zip(last,c):
    dla.append(down-(j*(day-i)))
  for con in range(26):
    co.append(s[day][con]-dla[con]*c[con])
  choice=co.index(max(co))
  last[choice]=day
  print(choice+1)

Buggy submission (verdict: Runtime Error):
import random
import time
import copy
import math
start=time.time()
d=int(input())
c=list(map(int, input().split()))
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
s=[]
solution=[]
last=[0]*26
sco=0
for i in range(d):
  s.append(list(map(int, input().split())))
for day in range(1,d+1):
  man=[]
  for i in range(26):
    man.append(s[day-1][i]+last[i]*c[i])
  con=man.index(max(man))
  sco+=s[day-1][con]
  last[con]=day
  for (i,j) in zip(last,range(26)):
    sco-=cli[i][j]
  solution.append(con)
#print(sco)
stemp=1000000
etemp=1000
def tem():
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.9:
  
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(3)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[i][j]
  prob = math.exp((sc-sco)/tem())
  #print("{} {}".format(sc,prob))
  if prob>random.random():
    solution=copy.deepcopy(sol)
    sco=sc
for i in solution:
  print(i+1)
#print(sco)
Problem p02646 (python)

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

if a>b:
  muki=-1
else:
  muki=1

at=a+v*muki*t
bt=b+w*muki*t

if muki==1:
  if at>=bt:
    print("YES")
  else:
    print("NO")
else:
  if at<=bt:
    print("YES")
  else:
    print("NO")

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

if a>b:
  muki=-1
else:
  muki=1

at=a+v*muki*t
bt=b+w*muki*t

if muki:
  if at>=bt:
    print("YES")
  else:
    print("NO")
else:
  if at=<bt:
    print("YES")
  else:
    print("NO")
Problem p02743 (python)

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

d=c-a-b
if d>0 and d*d>4*a*b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
from decimal import *
a,b=input().split()
a=Decimal(a)
b=Decimal(b)
ans=int(a*b)
print(ans)
Problem p02765 (python)

Fixed submission:
n,r=map(int,input().split())
print(r+(100*(10-min(n,10))))

Buggy submission (verdict: Runtime Error):
import math as mt
n,k=map(int,input().split())
print(mt.ceil(mt.log(n,k)))
Problem p02780 (python)

Fixed submission:
n,k=map(int,input().split())
li=list(map(int,input().split()))
kai=[0]
for i in range(1,1001):
  kai.append(kai[i-1]+i)
ka=[0]+[kai[i]/i for i in range(1,len(kai))]
lis=[ka[i] for i in li]

ans=sum(lis[:k])
mx=ans
for i in range(len(li)-k):
  ans-=lis[i]
  ans+=lis[i+k]
  mx=max(ans,mx)
print(mx)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
li=list(map(int,input().split()))
kai=[0]
for i in range(1,1001):
  kai.append(kai[i-1]+i)
li.sort(reverse=True)
ans=0
for i in li[:k]:
  ans+=kai(i)/i
print(ans)
Problem p02783 (python)

Fixed submission:
h,a=map(int,input().split())
ans=h//a+1
if h%a==0:
  ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
mon=list(map(int,input().split()))
mon.sort(reverse=True)

print(sum(mon[k:]))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
mon=list(map(int,input().split()))
mon.sort(reverse=True)
for i in range(k):
  mon.pop(0)
print(sum(mon))

Buggy submission (verdict: Runtime Error):
h,a=map(int,input().split()
ans=h//a+1
if h%a==0:
  ans-=1
print(ans)
Problem p02795 (python)

Fixed submission:
import math
h=int(input())
w=int(input())
n=int(input())
print(math.ceil(n/max(h,w)))

Buggy submission (verdict: Runtime Error):
import math
h,w,n=map(int,input().split())
print(math.ceil(n/max(h,w)))
Problem p02817 (python)

Fixed submission:
s,t=input().split()
print(t+s)

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

ans=abs(abs(x)-abs(y))

if x<0 and y<=0 or x>=0 and y>0:
  if x>y:
    ans+=2

else:
  ans+=1
  
print(ans)
Problem p02823 (python)

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

if (b-a)%2==0:
  ans=(b-a)//2
else:
  ans=min((a+b)//2,(2*(n+1)-(a+b))//2)
  
print(ans)

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

if (b-a)%2==0:
  ans=(b-a)/2
else:
  ans=(a+b)//2
  
print(ans)
Problem p02830 (python)

Fixed submission:
n=int(input())
s,t=input().split()
out=""
for i in range(n):
  out+=s[i]+t[i]
print(out)

Buggy submission (verdict: Runtime Error):
n=int(input())
s,t=input().split()
out=""
for i=range(n):
  out+=s[i]+t[i]
print(out)
Problem p02885 (python)

Fixed submission:
x,y=map(int,input().split())
print(max(x-2*y,0))

Buggy submission (verdict: Runtime Error):
print(max(int(input())-int(input())*2,0))
Problem p02911 (python)

Fixed submission:
n,k,q=map(int,input().split())

lis=[0]*n

for i in range(0,q):
  lis[int(input())-1]+=1
for p in lis:
  if k-q+p>0:
    print("Yes")
  else:
    print("No")

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

lis=[0]*n

for i in range(0,q):
  lis[int(input())]+=1
for p in lis:
  if k-q+p>0:
    print("Yes")
  else:
    print("No")
Problem p02952 (python)

Fixed submission:
ans=0
for i in range(1,int(input())+1):
  if len(str(i))%2:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
ans=0
for i in range(1,n+1):
  if len(str(i))%2:
    ans+=1
print(ans)
Problem p03085 (python)

Fixed submission:
x=input()
if x=="A":
  print("T")
if x=="T":
  print("A")
if x=="G":
  print("C")
if x=="C":
  print("G")

Buggy submission (verdict: Runtime Error):
x=input()
if x="A":
  print("T")
if x="T":
  print("A")
if x="G":
  print("C")
else:
  print("G")
Problem p03106 (python)

Fixed submission:
a,b,k=map(int,input().split())
war=[]
for i in range(1,max(a,b)+1):
  if a%i==0 and b%i==0:
    war.append(i)
war.reverse()

print(war[k-1])

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
war=[]
for i in range(1,max(a,b)):
  if a%i==0 and b%i==0:
    war.append(i)
war.reverse()
print(war[k-1])
Problem p03139 (python)

Fixed submission:
n,a,b=map(int,input().split())
mx=min(a,b)
mn=max(mx-(n-max(a,b)),0)
print(str(mx)+" "+str(mn))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input.split())
mx=min(a,b)
mn=mx-(n-max(a,b))
print(str(mx)+" "+str(mn))
Problem p03239 (python)

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

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

Fixed submission:
s=list(input())
k=int(input())
x=0
ans=0
while x<len(s) and s[x]=="1":
  x+=1
if x>0:
  if k<=x:
    ans=1
  else:
    ans=s[x]
else:
  ans=s[0]

print(ans)

Buggy submission (verdict: Runtime Error):
s=list(input())
k=int(input())
x=0
ans=0
while s[x]=="1":
  x+=1
if x>0:
  if k<=x:
    ans=1
  else:
    ans=s[x]
else:
  ans=s[0]

print(ans)
Problem p03284 (python)

Fixed submission:
n,k=map(int,input().split())
if n%k==0:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
if int(input())%3==0:
  print(0)
else:
  print(1)
Problem p03288 (python)

Fixed submission:
n=int(input())
if n<1200:
  print("ABC")
elif n<2800:
  print("ARC")
else:
  print("AGC")

Buggy submission (verdict: Runtime Error):
n=int(input())
if n<1200:
  print("ABC")
elif:
  print("ARC")
else:
  print("AGC")
Problem p03337 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(inr,input().split())
print(max([a+b,a-b,a*b]))
Problem p03359 (python)

Fixed submission:
x,y=map(int,input().split())
if y<x:
  x-=1
print(x)

Buggy submission (verdict: Runtime Error):
x,y=int(input()),int(input())
if y<x:
  x-=1
print(x)

Buggy submission (verdict: Runtime Error):
x=int(input())-1
if int(input())>=x:
  x+=1
print(x)