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

Fixed submission:
I=lambda:map(int,input().split())
h,w,d=I()
H={}
W={}
for i in range(1,h+1):
  for j,k in enumerate(I(),1):
    H[k],W[k]=i,j
x=1+h*w
s=[0 for _ in range(x)]
for i in range(d+1,x):
  s[i]=s[i-d]+abs(H[i]-H[i-d])+abs(W[i]-W[i-d])

for _ in range(int(input())):
  a,b=I()
  print(s[b]-s[a])

Buggy submission (verdict: Runtime Error):
I=lambda:[int(i) for i in input().split()]
h,w,d=I()
p=[[-1,-1] for i in range(h*w+1) ]
a=[]
for i in range(h):
  a.append(I())
  for j in range(w):
    p[a[i][j]]=[i,j]

import sys
sys.setrecursionlimit(100000)
from functools import lru_cache

@lru_cache(maxsize=100000)
def dist_d(s,g,d):
  if s==g:
    return 0
  else:
    y0,x0=p[s]
    s = a[y0][x0]+d
    y,x = p[s]
    return abs(x-x0)+abs(y-y0) + dist_d(s,g,d)
  
for i in range(int(input())):
  s,g=I()
  print(dist_d(s,g,d))

Buggy submission (verdict: Runtime Error):
h,w,d=[int(i) for i in input().split()]
p=[[-1,-1] for i in range(h*w+1) ]
a=[]
for i in range(h):
  a0 =[int(i0) for i0 in input().split()]
  a.append(a0)
  for j in range(w):
    p[a0[j]]=[i,j]

n=int(input())

import sys
sys.setrecursionlimit(100000)
from functools import lru_cache

@lru_cache(maxsize=3000)
def dist_d(s,g,d,y0,x0):
  if s==g:
    return 0
  else:
    s = s+d
    y,x = p[s]
    return abs(x-x0)+abs(y-y0) + dist_d(s,g,d,y,x)
  
for i in range(n):
  z=0
  s,g=[int(i0) for i0 in input().split()]
  y0,x0=p[s]
  print(dist_d(s,g,d,y0,x0))

Buggy submission (verdict: Runtime Error):
h,w,d=[int(i) for i in input().split()]
p=[[-1,-1] for i in range(h*w+1) ]
a=[]
for i in range(h):
  a0 =[int(i0) for i0 in input().split()]
  a.append(a0)
  for j in range(w):
    p[a0[j]]=[i,j]

n=int(input())

import sys
sys.setrecursionlimit(100000)
from functools import lru_cache

@lru_cache(maxsize=None)
def dist_d(s,g,d):
  if s==g:
    return 0
  else:
    y0,x0=p[s]
    s = a[y0][x0]+d
    y,x = p[s]
    return abs(x-x0)+abs(y-y0) + dist_d(s,g,d)
  
for i in range(n):
  z=0
  s,g=[int(i0) for i0 in input().split()]
 
  print(dist_d(s,g,d))

Buggy submission (verdict: Runtime Error):
h,w,d=[int(i) for i in input().split()]
p=[[-1,-1] for i in range(h*w+1) ]
a=[]
for i in range(h):
  a0 =[int(i0) for i0 in input().split()]
  a.append(a0)
  for j in range(w):
    p[a0[j]]=[i,j]

n=int(input())

import sys
sys.setrecursionlimit(100000)
from functools import lru_cache

@lru_cache(maxsize=1000)
def dist_d(s,g,d,y0,x0):
  if s==g:
    return 0
  else:
    s = s+d
    y,x = p[s]
    return abs(x-x0)+abs(y-y0) + dist_d(s,g,d,y,x)
  
for i in range(n):
  z=0
  s,g=[int(i0) for i0 in input().split()]
  y0,x0=p[s]
  print(dist_d(s,g,d,y0,x0))
Problem p03785 (python)

Fixed submission:
n,c,k=[int(i) for i in input().split()]
a=sorted([int(input()) for i in range(n)])
b=[i+k for i in a]
i0=[]
ans=0
bi=0
for i in range(n):
  i0.append(a[i])
  l=len(i0)
  if l== c or (b[bi] < a[i] and i!=0) :
    ans+=1
    i0=[]
    bi=i
  if l != c and i==n-1:
    ans+=1

print(ans)

Buggy submission (verdict: Runtime Error):
n,c,k=[n,c,k=[int(i) for i in input().split()]
a=sorted([int(input()) for i in range(n)])
b=[i+k for i in a]
i0=[]
ans=0
bi=0
for i in range(n):
  i0.append(a[i])
  l=len(i0)
  if l== c or (b[bi] < a[i] and i!=0) :
    ans+=1
    i0=[]
    bi=i
  if l != c and i==n-1:
    ans+=1

print(ans)
Problem p02711 (python)

Fixed submission:
def main():
    line = str(input())
    print("No" if line.find("7") == -1 else "Yes")
    return


main()

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>

#define __STDC_FORMAT_MACROS
#define p64 PRId64

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(f, x, ...)                                                         \
    ([&] (decltype ((x)) ALL) {                                                \
        return (f) (begin (ALL), end (ALL), ##__VA_ARGS__);                    \
    }) (x)

using namespace std;
using ll = int64_t;

int main() {
    string line;
    cin >> line;
    cout << (ALL (find, line, '7') == line.end() ? "No" : "Yes") << endl;
    return 0;
}
Problem p02989 (python)

Fixed submission:
def main():
    N, *d = map(int, open(0).read().split())
    d.sort()
    print(d[N // 2] - d[N // 2 - 1])
    return


main()

Buggy submission (verdict: Runtime Error):
A = 0
B = 0
C = 0
D = 0


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    g = gcd(a, b)
    return a * (b // g)


def f(n):
    return n - n // C - n // D + n // lcm(C, D)


def main():
    global A, B, C, D
    A, B, C, D = map(int, input().split())
    print(f(B) - f(A - 1))
    return


main()
Problem p02682 (python)

Fixed submission:
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(a,b,c,k):
    res = 0
    if k < a:
        res = k
    elif a <= k < a+b:
        res = a
    elif a+b <= k:
        res = a - (k - (a + b))
    return res

a,b,c,k = mi()
print(main(a,b,c,k))

Buggy submission (verdict: Runtime Error):
def main(a,b,c,k):
    res = 0
    if k < a:
        res = k
    elif a <= k < a+b:
        res = a
    elif a+b <= k:
        res = a - (k - (a + b))
    return res

a,b,c,k = mi()
print(main(a,b,c,k))
Problem p02723 (python)

Fixed submission:

s = input()

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

Buggy submission (verdict: Runtime Error):
s = input
print("Yes" if s[2]==s[3] and s[4]==s[5] else "No")
Problem p02792 (python)

Fixed submission:
def main3(N):
    lst = list()
    for i in range(1, 10):
        lst.append([0]*9)

    for n in range(1, N+1):
        head = int(str(n)[0])
        tail = int(str(n)[-1])
        #末尾が0はNG
        if tail != 0:
            lst[head-1][tail-1] += 1
        
    #for i in range(0, len(lst)):
    #    print(lst[i])
    
    count = 0
    for i in range(0, len(lst)):
        for j in range(0, len(lst[i])):
            count += lst[i][j] * lst[j][i]

    print(count)

N = int(input())
main3(N)

Buggy submission (verdict: Runtime Error):
def main2(N):
    #9*9の表
    lst = list()
    for i in range(1,10):
        lst.append([0]*9)

    for n in range(1, N+1):
        for i in range(1,10):
            for j in range(1,10):
                head = str(n)[0]
                tail = str(n)[-1]
                if i == int(head) and j == int(tail):
                    lst[i-1][j-1] += 1
    
    count = 0
    for i in range(0, len(lst)):
        for j in range(0, len(lst[i])):
            count += lst[i][j] * lst[j][i]

    print(count)

main2(N)
Problem p02820 (python)

Fixed submission:
from collections import Counter
from collections import defaultdict

def main(n,k,r,s,p,t):
    score = 0
    for i in range(len(t)):
        if i < k:
            continue
        if t[i] == t[i-k]:
            t[i] = "N"
    c = Counter(t)
    i = defaultdict(int,c)
    score += i["r"]*p + i["s"]*r + i["p"]*s
    return score
    
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = list(input())
print(main(n,k,r,s,p,t))

Buggy submission (verdict: Runtime Error):
from collections import Counter

def main(n,k,r,s,p,t):
    score = 0
    for i in range(len(t)):
        if i < k:
            continue
        if t[i] == t[i-k]:
            t[i] = "N"
    c = Counter(t)
    i = dict(c)
    score += i["r"]*p + i["s"]*r + i["p"]*s
    return score
    
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = list(input())
print(main(n,k,r,s,p,t))
Problem p02829 (python)

Fixed submission:
A = int(input())
B = int(input())

print(6-(A+B))

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

print(6-(A+B))
Problem p02831 (python)

Fixed submission:
import fractions
def main(a,b):
    g = fractions.gcd(a,b)
    lcm = (a * b) // g
    return lcm
    
a,b = map(int,input().split())
print(main(a,b))

Buggy submission (verdict: Runtime Error):
import numpy as np
def main(a,b):
    g = np.gcd(a,b)
    lcm = (x * y) // g
    return lcm

a,b = map(int,input().split())
print(main(a,b))
Problem p02836 (python)

Fixed submission:
def main(s):
    isEven = int(len(s)%2)
    ran = int((len(s)-1)/2 if isEven else (len(s)/2))
    count = 0
    for i in range(ran):
        if s[i] != s[-(i+1)]:
            count += 1
    return count

s = input()
print(main(s))

Buggy submission (verdict: Runtime Error):
def main(s):
    isEven = int(len(s)%2)
    ran = (len(s)-1)/2 if isEven else (len(s)/2)
    count = 0
    for i in range(ran):
        if s[i] != s[-(i+1)]:
            count += 1
    return count

s = input()
print(main(s))
Problem p02847 (python)

Fixed submission:
dic = {}

dic["SUN"] = 7
dic["MON"] = 6
dic["TUE"] = 5
dic["WED"] = 4
dic["THU"] = 3
dic["FRI"] = 2
dic["SAT"] = 1

S = str(input())

print(dic[S])

Buggy submission (verdict: Runtime Error):
dic[]

dic["SUN"] = 7
dic["MON"] = 6
dic["TUE"] = 5
dic["WED"] = 4
dic["THU"] = 3
dic["FRI"] = 2
dic["SAT"] = 1

S = str()input()

print(dic[S])
Problem p03041 (python)

Fixed submission:
#INPUT
#N K
#S

#1≤N≤50
#1≤K≤N
#Sは A, B, C からなる長さNの文字列

#ex
#3 1
#ABC

#OUTPUT
#文字列SのK文字目を小文字に書き換え、新しくできたSを出力せよ。

N, K =  map(int, input().split())
S = input()

if K==1 :
    str1 = ''
else :
    str1 = S[0:K-1]

if K==N:
    str3 = ''
else :
    str3 = S[K:N]

before = S[K-1]
str2 = before.lower()

print(str1+str2+str3)

Buggy submission (verdict: Runtime Error):
N, K = input().split()
S = input()

if K==1 :
    str1 = ''
else :
    str1 = S[0:K-2]

if K==N:
    str3 = ''
else :
    str3 = S[K:N]

before = S[K-1]
str2 = before.lower()

print(str1+str2+str3)
Problem p02693 (python)

Fixed submission:
N = int(input())
A=[int(x) for x in input().split()]
k=0
if N==1:
    print("OK")
else:
     if A[0]//int(N) == A[1]//int(N)  and A[0]%int(N)!=0  and A[1]%int(N)!=0:
        print("NG")
     else:
         print("OK")

Buggy submission (verdict: Runtime Error):
N = int(input())
A=[int(x) for x in input().split()]
k=0
if N==1:
    print("OK")
else:
     if A[0]//int(N) == A[1]//int(N) and A[0]%int(N)==A[1]%int(N) and A[0]%int(N)==0 :
        print("OK")
    elif A[0]//int(N) != A[1]//int(N) and A[0]%int(N)!=0 :
        print("OK")
     else:
        print("NG")
Problem p02699 (python)

Fixed submission:
N=[int(x) for x in input().split()]
if N[0]>N[1]:
    print("safe")
else:
   print("unsafe")

Buggy submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]
if not N[0]%N[3]==0:
   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d>=c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]
if not N[0]%N[3]==0:
   c=N[0]//N[3]+1

   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d>c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]
if not N[0]%N[3]==0:
   c=N[0]//N[3]+1

   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d>=c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]

if not N[0]%N[3]==0:
   c=N[0]//N[3]+1

   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d>=c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
if N[0]/2=>N[1]:
    print("safe")
else:
   print("unsafe")
Problem p02729 (python)

Fixed submission:
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N=[int(x) for x in input().split()]
if N[1]==1 or N[1]==0:
  sum1=0
else:
  sum1 = comb(N[1], 2)
if N[0]==1 or N[0]==0:
  sum2=0
else:
    sum2 = comb(N[0], 2)
print(sum1+sum2)

Buggy submission (verdict: Runtime Error):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N=[int(x) for x in input().split()]
if N[1]==1:
  sum1=0
else:
  sum1 = comb(N[1], 2)
if N[0]==1:
  sum2=0
else:
    sum2 = comb(N[0], 2)
print(sum1+sum2)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
N=[int(x) for x in input().split()]
if N[1]==1:
  sum1=0
else:
  sum1 = comb(N[1], 2, exact=True)
if N[0]==1:
  sum2=0
else:
    sum2 = comb(N[0], 2, exact=True)
print(sum1+sum2)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
N=[int(x) for x in input().split()]
if N[1]==1:
  sum1=0
else:
  sum1 = comb(N[1], 2, exact=True)
if N[0]==1:
  sum2=0
else:
    sum2 = comb(N[0], 2, exact=True)
print(sum1+sum2)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
N=[int(x) for x in input().split()]
if N[1]==1:
  sum1=0
else:
  sum1 = comb(N[1], 2, exact=True)
if N[0]==1:
  sum2=0
else:
    sum2 = comb(N[0], 2, exact=True)
print(sum1+sum2)
Problem p02771 (python)

Fixed submission:
A = list(map(str, input().split()))
m=set(A)
s=len(m)
if s==2:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(str, input().split()))
B=[]
C=[]
l=[]
m=[]
i=0
for a in range(int(N)):
    if int(A[a])%2==0:
       B.append(A[a])
       i=i+1
for a in range(int(i)):
    if not int(B[a])%3==0 or int(B[a])%5==0:
       C=1
    else:
       C=0
if C==1:
   print("DENIED")
else:
   print("APPROVED")
Problem p02847 (python)

Fixed submission:
N = str(input())
if N=="SAT":
  print("1")
elif N=="FRI":
  print("2")
elif N=="THU":
  print("3")
elif N=="WED":
  print("4")
elif N=="TUE":
  print("5")
elif N=="MON":
  print("6")
else:
  print("7")

Buggy submission (verdict: Runtime Error):
N = str(input())
if N=="SAT":
  print("1")
if N=="FRY":
  print("2")
if N=="THU":
  print("3")
if N=="WED":
  print("4")
if N=="TUE":
  print("5")
if N=="MON":
  print("6")
if N=="SUN":
  print("7")
Problem p02859 (python)

Fixed submission:
N = int(input())
print(N*N)

Buggy submission (verdict: Runtime Error):
N = input()
S = input()
T = S[0:N/2]
Q=T+T
if S in Q:
    print("Yes")
else:
    print("No")
Problem p02623 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
# def dp(init, i, j): return [[init]*i for i2 in range(j)]
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #A = [0]+list(accumulate(A))
import bisect #bisect.bisect_left(B, a), bisect.bisect_right(B,a)

n,m,k = line_to_each_int()
A = line_to_list()
B = line_to_list()

a, b = [0], [0]
a = [0]+list(accumulate(A))
b = [0]+list(accumulate(B))

ans, j = 0, m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
line = input().split()
n, m, k = int(line[0]), int(line[1]), int(line[2])
line = input().split()
a = [None] * n
for i in range(n):
    a[i] = int(line[i])
line = input().split()
b = [None] * m
for i in range(m):
    b[i] = int(line[i])

time = [[0 for j in range(n+1)] for i in range(m+1)]
for i in range(1,n+1):
    time[0][i] = time[0][i-1] + a[i-1]
for j in range(1,m+1):
    time[j][0] = time[j-1][0] + b[j-1]
ans = 0
for i in range(1,n+1):
    for j in range(1,m+1):
        if time[j-1][i-1] + a[i-1] > k or time[j-1][i-1] + b[i-1] > k or time[j-1][i-1] + a[i-1] + b[j-1] > k:
            break
        else:
            time[j][i] = time[j-1][i-1] + a[i-1] + b[j-1]
            ans = max(ans, i+j)
print(ans)
Problem p03013 (python)

Fixed submission:
from sys import stdin
data = stdin.readline().split()
N, M = int(data[0]), int(data[1])
a = [None] * M
fib = [None] * N
if N == 1:
    print(1)
    exit()
for i in range(M):
    a[i] = int(stdin.readline().rstrip())
    fib[a[i] - 1] = 0
    if i > 0 and a[i] - a[i-1] == 1:
        print(0)
        exit()
if not 1 in a:
    fib[0] = 1
    if not 2 in a:
        fib[1] = 2
    else:
        fib[1] = 0
else:
    fib[0] = 0
    fib[1] = 1
for i in range(2,N):
    if fib[i] == 0:
        continue
    else:
        fib[i] = fib[i-1] + fib[i-2]
# print(fib)
print(fib[N-1] % 1000000007)

Buggy submission (verdict: Runtime Error):
from sys import stdin
data = stdin.readline().split()
N, M = int(data[0]), int(data[1])
a = [None] * M
fib = [None] * N
for i in range(M):
    a[i] = int(stdin.readline().rstrip())
    fib[a[i] - 1] = 0
    if i > 0 and a[i] - a[i-1] == 1:
        print(0)
        exit()
if not 1 in a:
    fib[0] = 1
    if not 2 in a:
        fib[1] = 2
    else:
        fib[1] = 0
else:
    fib[0] = 0
    fib[1] = 1
for i in range(2,N):
    if fib[i] == 0:
        continue
    else:
        fib[i] = fib[i-1] + fib[i-2]
# print(fib)
print(fib[N-1] % 1000000007)

Buggy submission (verdict: Runtime Error):
from sys import stdin
data = stdin.readline().split()
N, M = int(data[0]), int(data[1])
a = [None] * M
for i in range(M):
    a[i] = int(stdin.readline().rstrip())
    if i > 0 and a[i] - a[i-1] == 1:
        print(0)
        exit()
fib = [None] * N
if not 1 in a:
    fib[0] = 1
    if not 2 in a:
        fib[1] = 2
    else:
        fib[1] = 0
else:
    fib[0] = 0
    fib[1] = 1
for i in range(2,N):
    if not i + 1 in a:
        fib[i] = fib[i-1] + fib[i-2]
    else:
        fib[i] = 0
# print(fib)
print(fib[N-1] % 1000000007)
Problem p03327 (python)

Fixed submission:
n = int(input())
if n<1000:
    print('ABC')
else:
    print('ABD')

Buggy submission (verdict: Runtime Error):
    a,b = [int(i) for i in input().split()]
     
    souwa = 0
    n = b - a
    for i in range(n):
        souwa += i
         
    x = souwa - b
         
    print(x)

Buggy submission (verdict: Runtime Error):
a,b = [int(i) for i in input().split()]

souwa = 0
n = b - a
for i in range(n):
    souwa += i
     
x = souwa - b
     
print(x)

Buggy submission (verdict: Runtime Error):
a, b  = [int(i) for i in input().split()]
     
souwa = 0
n = b - a
for i in range(n):
    souwa += i
     
x = souwa - b
     
print(x)
Problem p02627 (python)

Fixed submission:
import re

input_str = input()
if re.match(r'[A-Z]', input_str):
    print('A')
else:
    print('a')

Buggy submission (verdict: Runtime Error):
N = int(input())
alpha = [-1]
alpha.extend([chr(ord('a') + i) for i in range(26)])
q = N
mod = N
ans = ''
while q >= 27:
    q, mod = divmod(q, 26)
    ans = alpha[mod] + ans
if mod != 0:
    ans = alpha[q] + ans
print(ans)
Problem p02629 (python)

Fixed submission:
# 自力では解けなかった(2020.7.6)

alpha = ['Z']
alpha.extend([chr(ord('a') + i) for i in range(26)])
N = int(input())
q = N
ans = ''
while True:
    if q <= 26:
        ans += str(alpha[q])
        break
    else:
        q, mod = divmod(q, 26)
        if mod == 0:
            q -= 1
            mod = 26
        ans += str(alpha[mod])

print(ans[::-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
alpha = ['z']
alpha.extend([chr(ord('a') + i) for i in range(25)])
# print(alpha)
q = N
mod = N
ans = ''
while q >= 27:
    q, mod = divmod(q, 26)
    # print(alpha[mod])
    ans = alpha[mod] + ans
if mod != 0:
    ans = alpha[q] + ans
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
alpha = [-1]
alpha.extend([chr(ord('a') + i) for i in range(26)])
q = N
mod = N
ans = ''
while q >= 27:
    q, mod = divmod(q, 26)
    ans = alpha[mod] + ans
if mod != 0:
    ans = alpha[q] + ans
print(ans)

Buggy submission (verdict: Runtime Error):
alpha = [-1]
alpha.extend([chr(ord('a') + i) for i in range(26)])
q = N
mod = N
ans = ''
while q >= 27:
    q, mod = divmod(q, 26)
    ans = alpha[mod] + ans
if mod != 0:
    ans = alpha[q] + ans
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
alpha = [chr(ord('a') + i) for i in range(26)]
q = N
ans = ''
while q >= 26:
    q, mod = divmod(q, 26)
    ans = alpha[mod-1] + ans
if mod != 0:
    ans = alpha[q-1] + ans
print(ans)
Problem p02819 (python)

Fixed submission:
import math

#引数nが素数かどうかを判定
def is_prime(n):
    for i in range(2, int(math.sqrt(n))+1):
        if n%i == 0:
            return False
    return True

x = int(input())
boolean = True
while boolean:
    if is_prime(x):
        print(x)
        break
    x += 1

Buggy submission (verdict: Runtime Error):
from sympy import sieve

x = int(input())
boolean = True
while boolean:
    if x in sieve:
        print(x)
        break
    x += 1
Problem p02723 (python)

Fixed submission:


def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。
    # ref = random.choice(arr)
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right


if __name__ == "__main__":
    s = input()
    if s[2]==s[3] and s[4]==s[5]:
        print('Yes')
    else:
        print('No')
            



      
# for i in range(10):
#     print(i)
#     if i%5==4:
#         break

Buggy submission (verdict: Runtime Error):
import requests
import math
import random

def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。
    # ref = random.choice(arr)
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right


if __name__ == "__main__":
    s = input()
    if s[2]==s[3] and s[4]==s[5]:
        print('Yes')
    else:
        print('No')
            



      
# for i in range(10):
#     print(i)
#     if i%5==4:
#         break