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

Fixed submission:
N,M=map(int, input().split())
H=list(map(int,input().split()))
List=[list(map(int,input().split())) for i in range(M)]

sup_list=[1 for i in range(N)]

for j in range(M):
    if H[List[j][0]-1]>H[List[j][1]-1]:
        sup_list[List[j][1]-1]=0
    elif H[List[j][0]-1]==H[List[j][1]-1]:
        sup_list[List[j][0]-1]=0
        sup_list[List[j][1]-1]=0
    else:
        sup_list[List[j][0]-1]=0


print(sum(sup_list))

Buggy submission (verdict: Runtime Error):
N,M=map(int, input().split())
H=list(map(int,input().split()))
List=[list(map(int,input().split())) for i in range(M)]
ans=0
alllist=[[0 for i in range(N)]for j in range(N)]

for j in range(M):
    alllist[List[j][0]-1][List[j][1]-1]=1
    alllist[List[j][1]-1][List[j][0]-1]=1


for s in range(M):
    flag=True
    for t in range(M):
        if H[s]<alllist[s][t]*H[t]:
            flag=False
            break
    if flag:
        ans=ans+1

print(ans)
Problem p02693 (python)

Fixed submission:
K=int(input())
A,B=map(int,input().split())
flag=True
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        flag=False
        break
if flag:
    print("NG")

Buggy submission (verdict: Runtime Error):
K=int(input())
A,B=map(int,input().split())
flag=True
for i in range(A:B+1):
    if i%K==0:
        print("OK")
        flag=False
        break
if flag:
    print("NG")
Problem p02873 (python)

Fixed submission:
S=list(str(input()))
ans=0
sofar=0
j=1
nax=0
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        ans+=j
        j+=1
    elif S[i]=='<' and S[i+1]=='>':
        ans+=j
        nax=j
        j=1    
    else:
        ans+=j
        if nax!=0:
            ans-=j
        j=1
        nax=0
    if j>nax:
        ans-=nax
        nax=0
if j>nax:
    ans+=j
    ans-=nax
print(ans)

Buggy submission (verdict: Runtime Error):
S=list(str(input()))
ans=0
sofar=0
j=1
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        ans+=j
        j+=1
    elif S[i]=='<' and S[i+1]=='>':
        ans+=j
        nax=j
        j=1    
    else:
        ans+=j
        if nax!=0:
            ans-=j
        j=1
        nax=0
    if j>nax:
        ans-=nax
        nax=0
ans+=j
print(ans)
Problem p02881 (python)

Fixed submission:
import math
N=int(input())
sqn=math.floor(math.sqrt(N))

for fac in reversed(range(sqn+1)):
    if N%fac==0:
        print(int(fac+N/fac-2))
        break

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
sqn=math.floor(math.sqrt(N))

for fac in reversed(range(sqn)):
    if N%fac==0:
        print(int(fac+N/fac-2))
        break
Problem p03053 (python)

Fixed submission:
import collections
import math
import copy

H,W=map(int,input().split())

A=[list(str(input())) for i in range(H)]
#1<=sy<=R
d=[[-1 for j in range(W)]for i in range(H)]
inf=10**6
ans=0
queue=collections.deque()
for i in range(H):
    for j in range(W):
        if A[i][j]=='#':
            queue.append([i,j])
            d[i][j]=0

moves=[[1,0],[-1,0],[0,1],[0,-1]]

nax=0
while len(queue)>0:
    now=queue.popleft()
    for i in range(4):
        ny=now[0]+moves[i][0]
        nx=now[1]+moves[i][1]
        if 0<=ny and ny<H and 0<=nx and nx<W and A[ny][nx]=='.' and d[ny][nx]==-1:
            d[ny][nx]=d[now[0]][now[1]]+1
            nax=max(nax,d[ny][nx])
            queue.append([ny,nx])


print(nax)

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())

A=[list(str(input())) for i in range(H)]
#1<=sy<=R
d=[[-1 for j in range(W)]for i in range(H)]
inf=10**6
ans=0
queue=collections.deque()
for i in range(H):
    for j in range(W):
        if A[i][j]=='#':
            queue.append([i,j])
            d[i][j]=0

moves=[[1,0],[-1,0],[0,1],[0,-1]]


while len(queue)>0:
    now=queue.popleft()
    for i in range(4):
        ny=now[0]+moves[i][0]
        nx=now[1]+moves[i][1]
        if 0<=ny and ny<H and 0<=nx and nx<W and A[ny][nx]=='.' and d[ny][nx]==-1:
            d[ny][nx]=d[now[0]][now[1]]+1
            queue.append([ny,nx])

nax=0
for i in range(H):
    for j in range(W):
        nax=max(nax,d[i][j])
print(nax)
Problem p03745 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
if N==1:
    print(1)
    exit()

B=[A[i]-A[i-1] for i in range(1,N)]
ans=0
flag=False
for i in range(N-1):
    if B[i]!=0:
        first=B[i]
        flag=True
    if flag:
        break
for i in range(N-1):
    if first*B[i]>=0:
        pass
    else:
        ans+=1
        j=i+1
        while j<=N-2:
            if B[j]!=0:
                first=B[j]
                break
            else:
                j+=1

print(ans+1)

Buggy submission (verdict: Runtime Error):

N=int(input())
A=list(map(int,input().split()))
B=[A[i]-A[i-1] for i in range(1,N)]

ans=0
first=B[0]
for i in range(N-1):
    if first*B[i]>=0:
        pass
    else:
        ans+=1
        if i+1<=N-2:
            first=B[i+1]

print(ans+1)
Problem p02552 (python)

Fixed submission:
t=int(input())
if(t==1):
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
t=int(input())
if(t==1):
  print(0)
else:
  print(1)/
Problem p02549 (python)

Fixed submission:
def resolve():
  base = 998244353
  N, K = map(int, input().split(" "))

  LRs = []
  for _ in range(K):
    (L, R) = map(int, input().split(" "))
    LRs.append((L, R))

  dp = [0] * (N+1)
  dp_sum = [0] * (N+1)
  dp[1] = 1
  dp_sum[1] = 1

  for i in range(2, N+1):
    for lr in LRs:
      left = max(i - lr[1] - 1, 0)
      right = max(i - lr[0], 0)
      dp[i] += dp_sum[right] - dp_sum[left]
      if dp[i] >= base:
        dp[i] %= base
      dp_sum[i] = dp_sum[i-1] + dp[i]
  print(dp[-1])

if __name__ == "__main__":
  resolve()

Buggy submission (verdict: Runtime Error):
# 配るDP
def resolve():
  base = 998244353
  N, K = map(int, input().split(" "))

  LRs = []
  for _ in range(K):
    (L, R) = map(int, input().split(" "))
    LRs.append((L, R))

  dp = [0] * (N+1)
  dp[1] = 1

  for i in range(1, N):
    dp[i] += dp[i-1]

    for lr in LRs:
      left = i + lr[0]
      right = i + lr[1] + 1
      if left <= N:
        dp[left] += dp[i]
        dp[left] = mod(dp[left], base)
      if right <= N:
        dp[right] -= dp[i]
        dp[right] = mod(dp[right], base)
  print(mod(dp[-1], base))

if __name__ == "__main__":
  resolve()
Problem p02550 (python)

Fixed submission:

def resolve():
  N, X, M = map(int, input().split(" "))
  checked = [False] * M
  val = X
  ans = 0
  val_list = []

  base = M
  for i in range(N):
    if checked[val] != False:
      loop_start_index = checked[val]
      loop_vals = val_list[loop_start_index:]
      loop_val = sum(loop_vals)
      loop_length = len(val_list[loop_start_index:])
      
      if loop_length != 0:
        ans += ((N - i) // loop_length) * loop_val

        for i in range(((N - i) % loop_length)):
          ans += loop_vals[i]
      break
    ans += val
    checked[val] = i
    val_list.append(val)

    val*=val
    if val >= base:
      val %= base


  print(ans)

if __name__ == "__main__":
  resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
  N, X, M = map(int, input().split(" "))
  checked = [False] * M
  val = X
  ans = val
  val_list = [val]
  checked[val] = val

  base = M
  for i in range(N-1):
    val*=val
    if val >= base:
      val %= base

    if checked[val] != False:
      loop_start_index = checked[val]+1

      loop_val = sum(val_list[loop_start_index:])
      loop_length = len(val_list[loop_start_index:])
      
      ans += ((N - i - 1) // loop_length) * loop_val
      segment = val_list[loop_start_index:loop_start_index + ((N - i - 1) % loop_length) ]
      ans += sum(segment)
      break
    ans += val
    checked[val] = i
    val_list.append(val)


  print(ans)

if __name__ == "__main__":
  resolve()
Problem p02624 (python)

Fixed submission:
def resolve():
  N = int(input())
 
  table = [1]*(N+1)
  for i in range(2, N+1):
    n = i
    while n <= N:
      table[n] += 1
      n += i
 
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]
 
  print(ans)
 

if __name__ == "__main__":
  resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
  N = int(input())
 
  table = [1]*(N+1)
  for i in range(2, N+1):
    n = i
    while n <= N:
      table[n] += 1
      n += i
 
  # print(table)  
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]
 
  print(ans)
 
if __name__ == "__main__":
  resolve()
def resolve():
  N = int(input())

  table = [1]*(N+1)
  for i in range(2, N+1):
    n = i
    while n <= N:
      table[n] += 1
      n += i

  # print(table)  
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]

  print(ans)

if __name__ == "__main__":
  resolve()
Problem p02659 (python)

Fixed submission:
import numpy as np
import math
from decimal import Decimal

def resolve():
  S = input().split(" ")
  print(math.floor(int(S[0])*Decimal(S[1])))


if __name__ == "__main__":
  resolve()

Buggy submission (verdict: Runtime Error):
# https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8

def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0:
        cnt+=1
        temp //= i
      arr.append([i, cnt])

  if temp!=1:
    arr.append([temp, 1])

  if arr==[]:
    arr.append([n, 1])

  return arr

def resolve():
  N = int(input())
  prime_factors = factorization(N)

  result = 0
  for prime_factor in prime_factors:
    if prime_factor[0] == 1:
      continue

    for count in range(2, 42):
      if prime_factor[1] < (count + 1)*count//2:
        result += count - 1
        break
  print(result)


if __name__ == "__main__":
  resolve()

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
from decimal import Decimal

def resolve():
  S = input().split(" ")
  # print(math.floor(int(S[0])*Decimal(S[1])))
  # print(math.floor((int(S[0]) * int(float(S[1])*100))) // 100)
  print(math.floor((int(A) * int(float(B)*100))) // 100)
# if __name__ == "__main__":
#   resolve()

if __name__ == "__main__":
  resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
  S = input().split(" ")
  A = int(S[0])
  B = float(S[1])
  B = int(B * 100)
  if A == 0 or B == 0:
    print(0)
    return True
  AB = np.asarray([A, B], dtype = np.uint64)
  # print("{:17}".format(AB[0]*AB[1]).replace(" ", "").replace(".0", ""))
  # result = str(AB[0]*AB[1])
  print(A*B//100)

  # if len(result) > 2:
  #   print(result[:-2])
  # else:
  #   print(0)

if __name__ == "__main__":
  resolve()
Problem p02711 (python)

Fixed submission:
N = list(input())
if ("7" in N):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
    N = list(input())
    if ("7" in N):
      print("Yes")
    else:
      print("No")
Problem p02735 (python)

Fixed submission:
def resolve():
  H, W = map(int, input().split(" "))
  s = []
  dp = [[0] * W for i in range(H)]
  for _ in range(H):
    s.append([x == "." for x in list(input())])

  for h in range(H):
    for w in range(W):
      if h == 0 and w == 0:
        if not s[0][0]:
          dp[0][0] = 1

      elif h == 0:
        dp[0][w] = dp[0][w-1]
        if s[0][w-1] and not s[0][w]:
          dp[0][w] += 1

      elif w == 0:
        dp[h][0] = dp[h-1][0]
        if s[h-1][0] and not s[h][0]:
          dp[h][0] += 1

      else:
        # 左側と上側を見て、操作回数が最小になるようにする。
        # 上だけをみる
        temp_up = dp[h-1][w]
        if s[h-1][w] and not s[h][w]:
          temp_up += 1

        # 左だけを見る
        temp_left = dp[h][w-1]
        if s[h][w-1] and not s[h][w]:
          temp_left += 1

        dp[h][w] = min(temp_up, temp_left)

  print(dp[H-1][W-1])

if __name__ == "__main__":
  resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
  H, W = map(int, input().split(" "))
  s = []
  dp = [[0] * W for i in range(H)]
  for _ in range(W):
    s.append([x == "." for x in list(input())])

  for h in range(H):
    for w in range(W):
      if h == 0 and w == 0:
        if not s[0][0]:
          dp[0][0] = 1

      elif h == 0:
        dp[0][w] = dp[0][w-1]
        if s[0][w-1] and not s[0][w]:
          dp[0][w] += 1

      elif w == 0:
        dp[h][0] = dp[h-1][0]
        if s[h-1][0] and not s[h][0]:
          dp[h][0] += 1

      else:
        # 左側と上側を見て、操作回数が最小になるようにする。
        # 上だけをみる
        temp_up = dp[h-1][w]
        if s[h-1][w] and not s[h][w]:
          temp_up += 1

        # 左だけを見る
        temp_left = dp[h][w-1]
        if s[h][w-1] and not s[h][w]:
          temp_left += 1

        dp[h][w] = min(temp_up, temp_left)

  print(dp[H-1][W-1])
  
if __name__ == "__main__":
  resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
  H, W = map(int, input().split(" "))
  s = []
  dp = [[0] * W for i in range(H)]
  for _ in range(W):
    s.append([x == "." for x in list(input())])

  for h in range(H):
    for w in range(H):
      if h == 0 and w == 0:
        if not s[0][0]:
          dp[0][0] = 1
      elif h == 0:
        if s[0][w-1] and not s[0][w]:
          dp[0][w] = dp[0][w-1] + 1
        else:
          dp[0][w] = dp[0][w-1]
      elif w == 0:
        if s[h-1][0] and not s[h][0]:
          dp[h][0] = dp[h-1][0] + 1
        else:
          dp[h][0] = dp[h-1][0]
      else:
        # 左側と上側を見て、操作回数が最小になるようにする。
        # 上だけをみる
        if s[h-1][w] and not s[h][w]:
          temp_up = dp[h-1][w] + 1
        else:
          temp_up = dp[h-1][w]
        
        # 左だけを見る
        if s[h][w-1] and not s[h][w]:
          temp_left = dp[h][w-1] + 1
        else:
          temp_left = dp[h][w-1]

        dp[h][w] = min(temp_up, temp_left)

  print(dp[H-1][W-1])

if __name__ == "__main__":
  resolve()
Problem p03221 (python)

Fixed submission:
N, M = map(int, input().split())
base = []
for i in range(M):
  (a, b) = map(int, input().split())
  base.append((a, b, i))
sorted_target = sorted(base) 

prefecture_index = sorted_target[0][0]

i=0
result = {}

for target in sorted_target:
  if prefecture_index == target[0]:
    i+=1
  else:
    prefecture_index = target[0]
    i = 1
  result[target[2]] = [prefecture_index, i]

for i in range(M):
  print("{:0=6}{:0=6}".format(result[i][0], result[i][1]))

Buggy submission (verdict: Runtime Error):
import numpy as np
 
N, M = map(int, input().split())
base = [[int(l) for l in input().split()] for i in range(M)]
sort_target = np.sort(base, axis=0).tolist()
 
prefecture_index = sort_target[0][0]
i=0
result = []
for target in sort_target:
  i = i + 1 if prefecture_index == target[0] else 1
  prefecture_index = target[0]
  result.append([base.index(target), "{:0=6}{:0=6}".format(target[0], i)])
sorted_result = sorted(result)
 
for result in sorted_result:
  print(result[1])
Problem p02570 (python)

Fixed submission:
d, t, s = map(int, input().split())
if d/s <= t:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
d, t, s = map(int, input().split())
x = d / s
if x < t:
    print('Yes')
elif x == y:
  print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
d, t, s = map(int, input().split())
x = d // s
if x < t:
    print('Yes')
elif x == y:
  print('Yes')
else:
    print('No')
Problem p02594 (python)

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

Buggy submission (verdict: Runtime Error):
t = int(input())
if t > == 30:
  print('Yes')
else:
  print('No')

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

Fixed submission:
a = input()
if a.islower():
    print('a')
elif a.isupper():
    print('A')

Buggy submission (verdict: Runtime Error):
a = input()
if a == type.lower():
    print('a')
elif a == type.upper():
    print('A')
Problem p02623 (python)

Fixed submission:
import sys

N,M,K=list(map(int,input().split()))

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

nmax=0

Asum=list()
Asum.append(0)
Bsum=list()
Bsum.append(0)

imax_a = N
for i in range(N):
    s = Asum[i]+A[i]
    Asum.append(s)
    if s > K:
        imax_a = i+1
        break

imax_b = M
for i in range(M):
    s = Bsum[i]+B[i]
    Bsum.append(s)
    if s > K:
        imax_b = i+1
        break
        
for i in range(imax_a+1):
    for j in range(imax_b, -1, -1):
        time = Asum[i]+Bsum[j]
        # print("i=",i,"j=",j,"time=",time)
        if time <= K:
            imax_b = j

            if nmax < i+j:
                nmax = i+j
                # print("i=",i," j=",j," Asum",Asum[i]," Bsum", Bsum[j], " time=",time, " nmax=", nmax)

            break

print(nmax)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(400001)

N,M,K=list(map(int,input().split()))

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


def readAB(ia,ib,left_k,nbooks):
    global N,M,nmax

    # print(ia,ib,left_k,N,M,nbooks)

    if nbooks > nmax:
        nmax = nbooks

    if  ia <= N-1:
        if left_k >= A[ia]:
            # print("A")
            readAB(ia+1,ib,left_k-A[ia],nbooks+1)

    if ib <= M-1:
        if left_k >= B[ib]:
            # print("B")
            readAB(ia,ib+1,left_k-B[ib],nbooks+1)

nmax=0
readAB(0,0,K,0)
print(nmax)

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

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


def readAB(ia,ib,left_k,nbooks):
    global N,M,nmax

    # print(ia,ib,left_k,N,M,nbooks)

    if nbooks > nmax:
        nmax = nbooks

    if  ia <= N-1 and left_k >= A[ia]:
        # print("A")
        readAB(ia+1,ib,left_k-A[ia],nbooks+1)

    if ib <= M-1 and left_k >= B[ib]:
        # print("B")
        readAB(ia,ib+1,left_k-B[ib],nbooks+1)

nmax=0
readAB(0,0,K,0)
print(nmax)
Problem p03295 (python)

Fixed submission:
from operator import itemgetter
n,m=map(int,input().split())
a=[""]*m
b=[""]*m
for i in range(m):
    x,l=map(int,input().split())
    a[i]=x*10+5
    b[i]=l*10-5
st=sorted([(a[i],b[i]) for i in range(m)], key=itemgetter(1))
ans=0
last=0
last=-float("inf")
for i in range(m):
    if last<st[i][0]:
        ans+=1
        last=st[i][1]
print(ans)

Buggy submission (verdict: Runtime Error):
a=[""]*m
b=[""]*m
for i in range(m):
    x,l=map(int,input().split())
    a[i]=x*10+5
    b[i]=l*10-5
st=sorted([(a[i],b[i]) for i in range(m)], key=itemgetter(1))
ans=0
last=0
last=-float("inf")
for i in range(m):
    if last<st[i][0]:
        ans+=1
        last=st[i][1]
print(ans)
Problem p03805 (python)

Fixed submission:
import itertools
n,m=map(int,input().split())
path=[[False]*n for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    path[a][b]=True
    path[b][a]=True
ans=0;

for i in itertools.permutations(range(n),n):
    if i[0]==0:
        for j in range(n):
            if j==n-1:
                ans+=1
                break
            if not path[i[j]][i[j+1]]:
                break
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
n,m=map(int,input().split())
path=[[False]*n for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    path[a][b]=True
    path[b][a]=True
ans=0;

for i in itertools.permutations(range(n),n):
    if i[0]==0:
        for j in range(n):
            if j==n-1:
                ans+=1
                break
            if not path[i[j]][i[j]+1]:
                break
print(ans)
Problem p02595 (python)

Fixed submission:
n, d = list(map(int, input().split()))
cnt = 0
d2 = d**2
x, y = [], []
for i in range(n):
	tx, ty = list(map(int, input().split()))
	x.append(tx)
	y.append(ty)

for i in range(n):
	if(x[i]**2 + y[i]**2 <= d2):
		cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, d = list(map(int, input().strip()))
cnt = 0
d2 = d**2
x, y = [], []
for i in range(n):
	tx, ty = list(map(int, input().strip()))
	x.append(tx)
	y.append(ty)

for i in range(n):
	if(x[i]**2 + y[i]**2 <= d2):
		cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, d = list(map(int, input().strip()))
cnt = 0
d2 = d**2
for i in range(n):
	x, y = list(map(int, input().strip()))
	if(x**2 + y**2 <= d2):
		cnt += 1
print(cnt)
Problem p02624 (python)

Fixed submission:
n = int(input())
ans = 0

for j in range(1, n+1):
    a = n//j
    ans += a*(a+1)*j//2
print(ans)

Buggy submission (verdict: Runtime Error):
import sympy
n = int(input())
ans, count = 0, 0

for j in range(1, n+1):
    a = n//j
    ans += a*(a+1)*j//2
print(ans)
Problem p02676 (python)

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

   
if len(S) <= int(K):
  print(S)
else:
  S = S[:int(K)]
  S += '...'
  print(S)

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

try:
   if 0 > int(K) or int(K) >= 100:
      print("K's value must be over 1 and under 100")
      exit()
except ValueError:
   print("K's value must be integer")
   exit() 

S = input()
  if 1 > len(S) or 100 < len(S):
    print("S's length must be over 1 and under 100")
    exit()
   
  if len(S) <= int(K):
    print(S)
  else:
    S = S[:int(K)]
    S += '...'
    print(S)

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

try:
   if 0 > int(K) or int(K) >= 100:
      print("K's value must be over 1 and under 100")
      exit()
except ValueError:
   print("K's value must be integer")
   exit() 

S = input()
  if 1 > len(S) or 100 < len(S):
    print("S's length must be over 1 and under 100")
    exit()
   
  if len(S) <= int(K):
    print(S)
  else:
  S = S[:int(K)]
  S += '...'
  print(S)

Buggy submission (verdict: Runtime Error):
K = input()
try:
  if 0 > int(K) or int(K) >= 100:
    print("K's value must be over 1 and under 100")
    exit()
except ValueError:
  print("K's value must be integer")
  exit()

S = input()
if 1 > len(S) or 100 < len(S):
  print("S's length must be over 1 and under 100")
  exit()
  
if len(S) <= int(K):
  print(S)
else:
  S = S[:K]
  S.append('...')
  print(S)
Problem p02729 (python)

Fixed submission:
N, M = map(int, input().split())
print(int(N*(N-1)/2+M*(M-1)/2))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

N, M = map(int, input().split())
print(comb(N, 2) + comb(M, 2))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

N, M = map(int, input().split())
print(comb(N, 2, exact=True) + comb(M, 2, exact=True))
Problem p02880 (python)

Fixed submission:
import sys
N = int(input())

if N > 81 or N == 50 or N == 60 or N == 70 or N == 80:
    print('No')
    sys.exit()
else:
    val = []
    i = 3
    while N != 1:
        if N % 2 == 0:
            val.append(2)
            N //= 2
        else:
            if i >= 10:
                print('No')
                sys.exit()
            elif N % i == 0:
                val.append(i)
                N //= i
            else:
                i += 2

print('Yes')

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

if N > 81:
    print('No')
else:
    val = []
    i = 3
    while N != 1:
        if N % 2 == 0:
            val.append(2)
            N //= 2
        else:
            if i >= 10:
                print('No')
                sys.exit()
            elif N % i == 0:
                val.append(i)
                N //= i
            else:
                i += 2
if val.count(5) >= 2 and len(val) >= 3:
    print('No')
elif val.count(7) >= 2 and len(val) >= 3:
    print('No')
else:
    print('Yes')
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])

nums = [0]*(N+1)
nums[0] = 1
if 1 not in a:
    nums[1] = 1
for i in range(2, N+1):
    if not i in a:
      nums[i] = nums[i-1] + nums[i-2]

print(nums[N]%(1000000007))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]

nums = [0]*(N+1)
nums[0] = 1
if 1 not in a:
    nums[1] = 1
for i in range(2, N+1):
    print(nums)
    if not i in a:
      nums[i] = nums[i-1] + nums[i-2]

print(nums[N]%(1000000007))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
route = [int(x) for x in range(N)]
a = [int(input()) for _ in range(M)]
route = [item for index, item in enumerate(route) if index not in a]

nums = [0]*(N+1)
nums[0] = 1
if 1 not in a:
    nums[1] = 1
for i in range(2, N+1):
    print(nums)
    if not i in a:
      nums[i] = nums[i-1] + nums[i-2]

print(nums[N]%(1000000007))