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

Fixed submission:
O = input()
E = input()
o = []
e=[]
ans = []

for i in range(len(O)):
  o.append(O[i])
  
for j in range(len(E)):
  e.append(E[j])
  
if len(o) == len(e):
  for k in range(len(o)):
    ans.append(o[k])
    ans.append(e[k])
    
  print("".join(ans))
  exit()
  
if len(o) != len(e):
  for l in range(len(e)):
    ans.append(o[l])
    ans.append(e[l])
    
  ans.append(o[-1])
  print("".join(ans))
  exit()

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
ans = []

for i in range(len(o)):
  o.append(o[i])
  
for j in range(len(e)):
  e.append(e[j])
  
if len(o) == len(e):
  for k in range(len(o)):
    ans.append(o[k])
    ans.append(e[k])
    
  print("".join(ans))
  exit()
  
if len(o) != len(e):
  for l in range(len(e)):
    ans.append(o[l])
    ans.append(e[l])
    
  ans.append(o[-1])
  exit()
Problem p03778 (python)

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

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

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

if a < b:
  if b-(a+w) >0:
    print(b-(a+w))
  else:
    print(0)
    
elif a==b:
  print(0)
  
eif a>b:
  if a-(b+w) >0:
    print(a-(b+w))
  else:
    print(0)
Problem p03814 (python)

Fixed submission:
s = input()

id_a = len(s)
id_z = 0
for i in range(len(s)):
  if s[i] == 'A':
    id_a = min(id_a, i)
  if s[i] == 'Z':
    id_z = max(id_z, i)
    
print(id_z - id_a + 1)

Buggy submission (verdict: Runtime Error):
s =input()
A=0
Z=0

for i in range(len(s)):
  s[i] =="A":
    A +=i+1
    break

    
for j in range(len(s)):
  s[-(j+1)] =="Z":
    Z +=len(s)-j
    break
    
print(Z-A+1)

Buggy submission (verdict: Runtime Error):
s =input()
A=0
Z=0

for i in range(len(s)):
  s[i] =="A":
    A=i+1
    break

    
for j in range(len(s)):
  s[-(j+1)] =="Z":
    Z=len(s)-j
    break
    
print(Z-A+1)
Problem p03854 (python)

Fixed submission:
import re

s = input()
s = re.sub("eraser","",s)
s = re.sub("erase","",s)
s = re.sub("dreamer","",s)
s = re.sub("dream","",s)

if len(s) == 0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
import re

s = ainpu()
s = re.sub("eraser","",s)
s = re.sub("erase","",s)
s = re.sub("dreamer","",s)
s = re.sub("dream","",s)
print("Yes" if len(s) ==0 else "No")
Problem p03861 (python)

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


ans = b//x - (a-1)//x
print(ans)

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

ans = 0
for i in range(a,b+1):
  if i % x==0 :ans. +=1
    
print(ans)
Problem p03862 (python)

Fixed submission:
N,x =map(int,input().split())
a=[int(i) for i in input().split()]
ans=0
if a[0] >x:
  ans += (a[0]-x) 
  a[0] -= (a[0]-x) 
  

for i in range(N-1):
  if a[i]+a[i+1] >x:
    ans += ((a[i]+a[i+1])-x)
    a[i+1] -= ((a[i]+a[i+1])-x)
    
  else: continue
    
print(ans)

Buggy submission (verdict: Runtime Error):
A=list(map(int,input().split())) +[0]
ans =0
for i in range(N):
  eated =max(0,A[i]+A[i-1]-x)
  ans +=eated
  A[i]-=eated
  
print(ans)
Problem p03963 (python)

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

print(k*((k-1)**(n-1)))

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

print(k*((k-1)**(n-1))

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

print(k*((k-1)*(n-1))
Problem p02995 (python)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A,B,C,D = map(int,input().split())
A -= 1

E = lcm(C,D)

print(B - B // C - B // D + B // E - (A - A // C - A // D + A // E))

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B,C,D = map(int,input().split())
A -= 1

E = lcm(C,D)

print(B - B // C - B // D + B // E - (A - A // C - A // D + A // E))
Problem p03074 (python)

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

A = [0]
B = [0]
for s in S:
  if s == '1':
    A[-1] += 1
  elif A[-1] != 0:
    A.append(0)
  if s == '0':
    B[-1] += 1
  elif B[-1] != 0:
    B.append(0)

ans = 0
c,d,e,f = 0,0,0,0

for i in range(min(len(A),len(B))):
  a = 0
  if i == 0:
    if S[0] == '1':
      c,d = sum(A[i:min(i + K + 1,len(A))]),sum(B[i:min(i + K,len(B))])
      a = c + d
    else:
      c,d = sum(A[i:min(i + K,len(A))]) , sum(B[i:min(i + K,len(B))])
      a = c + d
  else:
    if S[0] == '1':
      if i + K < len(A):
        c += A[min(i + K,len(A) - 1)] - A[i - 1]
        d += B[min(i + K - 1,len(B) - 1)] - B[i - 1]
        a = c + d
    else:
      if i + K <= len(A):
        c += A[min(i + K - 1,len(A) - 1)] - (0 if i == 1 else A[i - 2])
        d += B[min(i + K - 1,len(B) - 1)] - B[i - 1]
        a = c + d
  ans = max(ans,a)
print(ans)

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

A = [0]
B = [0]
for s in S:
  if s == '1':
    A[-1] += 1
  elif A[-1] != 0:
    A.append(0)
  if s == '0':
    B[-1] += 1
  elif B[-1] != 0:
    B.append(0)

ans = 0

c,d,e,f = 0,0,0,0

for i in range(min(len(A),len(B))):
  a = 0
  if i == 0:
    if S[0] == '1':
      c,d = sum(A[i:min(i + K + 1,len(A))]),sum(B[i:min(i + K,len(B))])
      a = c + d
    else:
      c,d = sum(A[i:min(i + K,len(A))]) , sum(B[i:min(i + K,len(B))])
      a = c + d
  else:
    if S[0] == '1':
      if i + K <= len(A):
        c += A[min(i + K,len(A) - 1)] - A[i - 1]
        d += B[min(i + K - 1,len(A) - 1)] - B[i - 1]
        a = c + d
    else:
      if i + K <= len(A):
        c += A[min(i + K - 1,len(A) - 1)] - (0 if i == 1 else A[i - 2])
        d += B[min(i + K - 1,len(A) - 1)] - B[i - 1]
        a = c + d
  ans = max(ans,a)
print(ans)

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

A = [0]
B = [0]
for s in S:
  if s == '1':
    A[-1] += 1
  elif A[-1] != 0:
    A.append(0)
  if s == '0':
    B[-1] += 1
  elif B[-1] != 0:
    B.append(0)

ans = 0

c,d,e,f = 0,0,0,0

for i in range(min(len(A),len(B))):
  a = 0
  if i == 0:
    if S[0] == '1':
      c,d = sum(A[i:min(i + K + 1,len(A))]),sum(B[i:min(i + K,len(B))])
      a = c + d
    else:
      c,d = sum(A[i:min(i + K,len(A))]) , sum(B[i:min(i + K,len(B))])
      a = c + d
  else:
    if S[0] == '1':
      if i + K <= len(A):
        c += A[min(i + K,len(A) - 1)] - A[i - 1]
        d += B[min(i + K - 1,len(A) - 1)] - B[i - 1]
        a = c + d
    else:
      a = sum(A[i - 1:min(i + K,len(A))]) + sum(B[i:min(i + K,len(B))])
      if i + K <= len(A):
        c += A[min(i + K,len(A) - 1)] - (0 if i == 1 else A[i - 2])
        d += B[min(i + K - 1,len(A) - 1)] - B[i - 1]
        a = c + d
      
  ans = max(ans,a)
print(ans)
Problem p03206 (python)

Fixed submission:
N = int(input())
print("Christmas","Eve " * (25 - N))

Buggy submission (verdict: Runtime Error):
N = int(input())
print("Christmas",["Eve "] * 25 - N)
Problem p03211 (python)

Fixed submission:
S = input()
ans = 9999
for i in range(0,len(S) - 1):
  n = int(S[i:i + 3])
  ans = min(ans,abs(753 - n))
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
ans = 9999
for i in range(0,7):
  n = int(S[i:i + 3])
  ans = min(ans,abs(753 - n))
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
ans = 99999
for i in range(7):
  n = int(S[i:i + 2])
  ans = min(ans,abs(n - 754))
print(ans)
Problem p03778 (python)

Fixed submission:
import numpy as np

def main():

  W, A, B = map(int, input().split())
  
  A_ = A + W
  B_ = B + W
  
  if (A <= B and B <= A_) or (A <= B_ and B_ <= A_):
    print(0)
    return

  print(min(abs(A_ - B), abs(A - B_)))

main()

Buggy submission (verdict: Runtime Error):
import numpy as np

def main():

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

  su = np.sum(A)
  av = su // N
  if su % N != 0:
    print(-1)
    return

  ans = N - 1
  b = 0
  c = 0

  for a in A[0: -1]:
    b += a
    c += 1
    if b == (c * av):
      ans -= 1
      b = 0
      c = 0

  print(ans)

main()
Problem p02696 (python)

Fixed submission:
a , b , n = map(int , input().split())
l = 0
r = n
ans = 0
while (l < r) :
    mid = (l + r + 1) // 2
    if  (a * mid) // b - a * (mid // b) >= ans :
         ans =  (a * mid) // b - a * (mid // b)
         l = mid
    else :
        r = mid - 1
print((a * r) // b - a * (r // b))

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <stack>
#pragma GCC optimize(3 , "Ofast" , "inline")
using namespace std ;
typedef long long ll ;
const double esp = 1e-6 , pi = acos(-1) ;
typedef pair<int , int> PII ;
const int N = 1e5 + 10 , INF = 0x3f3f3f3f , mod = 1e9 + 7;
ll in()
{
  ll x = 0 , f = 1 ;
  char ch = getchar() ;
  while(!isdigit(ch)) {if(ch == '-') f = -1 ; ch = getchar() ;}
  while(isdigit(ch)) x = x * 10 + ch - 48 , ch = getchar() ;
  return x * f ;
}
int main()
{
  ll a = in() , b = in() , n = in() ;
  ll l = 0 , r = n , ans = 0 ;
  while(l < r)
   {
     ll mid = l + r + 1 >> 1 ;
     if((a * mid) / b - a * (mid / b) >= ans) l = mid ;
     else r = mid - 1 ;
   }
  cout << (a * r) / b - a * (r / b) << endl ;
  return 0 ;
}
/*
*/
Problem p02700 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
while True:
    c-=b
    if c <= 0:
        print('Yes')
        break
    a-= d
    if a <= 0:
        print('No')
        break

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
while True:
    c - = b
    if c <= 0:
        print('No')
        break
    a - = d
    if a <= 0:
        print('Yes')
        break
Problem p02705 (python)

Fixed submission:
import math
r = int(input())
p = math.pi
a = p * (r * 2)
print(a)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l1 = []
for i in range (m):
    ai = int(input())
    l1.append(ai)
s = sum(l1)
r = (n - s)
if r >= 0:
    print(r)
else:
    print("-1")

Buggy submission (verdict: Runtime Error):
n, m = input().split()
ni = int(n)
mi = int(m)
l1 = []
for i in range (mi):
    ai = int(input())
    l1.append(ai)
s = sum(l1)
r = (ni - s)
if r >= 0:
    print(r)
else:
    print("-1")
Problem p02706 (python)

Fixed submission:
n, m = map(int, input().split())
ai = map(int, input().split())
li = map(int, list(ai))
s = sum(li)
r = (n - s)
if r >= 0:
    print(r)
else:
    print("-1")

Buggy submission (verdict: Runtime Error):
n = int(input())
m = int(input())
l1 = []
for i in range (m):
    ai = int(input())
    l1.append(ai)
s = sum(l1)
r = (n - s)
if r >= 0:
    print(r)
else:
    print("-1")

Buggy submission (verdict: Runtime Error):
n = int(input())
m = int(input())
l1 = []
for i in range (m):
    a1 = int(input())
    l1.append(a1)
s = sum(l1)
r = n - s
if r >= 0:
    print(r)
else:
    print("-1")

Buggy submission (verdict: Runtime Error):
n = int(input())
m = int(input())
l1 = []
for i in range (m):
    a1 = int(input())
    l1.append(a1)
s = sum(l1)
r = n - s
print(r)

Buggy submission (verdict: Runtime Error):
n = int(input())
m = int(input())
l1 = []
for i in range (m):
    a1 = int(input())
    l1.append(a1)
s = sum(l1)
result = n - s
print(result)
Problem p02717 (python)

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

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

Buggy submission (verdict: Runtime Error):
a, b, c = input().split()
print(f'{c},{a},{b}')

Buggy submission (verdict: Runtime Error):
a, b, c = input().split()
print(f'{c},{a},{b}')
Problem p02630 (python)

Fixed submission:
import collections
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for i in range(Q):
    input_q = list(map(int, input().split()))
    B.append(input_q[0])
    C.append(input_q[1])
    
A_sum = sum(A)
CONST_MAX = 100001
count_list = [0] * CONST_MAX

c = collections.Counter(A)
for k, v in c.items():
    # print(k, v)
    count_list[k] = v


for i in range(Q):
    count_list[C[i]] += count_list[B[i]]
    A_sum += (C[i] - B[i]) * count_list[B[i]]
    count_list[B[i]] = 0
    # print(count_list)

    print(A_sum)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for i in range(Q):
    input_q = list(map(int, input().split()))
    B.append(input_q[0])
    C.append(input_q[1])
    
A_sum = sum(A)
CONST_MAX = 100000
count_list = [0] * CONST_MAX

# for i in range(CONST_MAX):
#     count_list[i] = A.count(i)
c = collections.Counter(A)
for k, v in c.items():
    # print(k, v)
    count_list[k] = v


for i in range(Q):
    count_list[C[i]] += count_list[B[i]]
    A_sum += (C[i] - B[i]) * count_list[B[i]]
    count_list[B[i]] = 0
    # print(count_list)

    print(A_sum)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for i in range(Q):
    input_q = list(map(int, input().split()))
    B.append(input_q[0])
    C.append(input_q[1])
    
A_sum = sum(A)
CONST_MAX = 100000
count_list = [0] * CONST_MAX

for i in range(CONST_MAX):
    count_list[i] = A.count(i)

for i in range(Q):
    count_list[C[i]] += count_list[B[i]]
    A_sum += (C[i] - B[i]) * count_list[B[i]]
    count_list[B[i]] = 0

    print(A_sum)
Problem p02947 (python)

Fixed submission:
import collections  

n = int(input())

s = []
for i in range(n):
    s.append(str(sorted(input())))

cnt = 0
for (c, m) in collections.Counter(s).items():
    cnt += m * (m - 1) // 2
    
print(cnt)

Buggy submission (verdict: Runtime Error):
import collections  

n = int(input())

s = []
for i in range(n):
    s.append(str(sorted(input())))

cnt = 0
for (c, m) in collections.Counter(s).items():
    ccnt += m * (m - 1) / 2
    
print(cnt)

Buggy submission (verdict: Runtime Error):
import collections  

n = int(input())

s = []
for i in range(n):
    s.append(str(sorted(input())))

def f(a):
    if a == 0:
        return 1
    else:
        return a * f(a - 1)

cnt = 0
for (c, m) in collections.Counter(s).items():
    if 1 < m:
        combi = f(m - 1)
        cnt += combi
    
print(cnt)

Buggy submission (verdict: Runtime Error):
import collections  

n = int(input())

s = []
for i in range(n):
    s.append(str(sorted(input())))

def f(a):
    if a == 0:
        return 1
    else:
        return a * f(a - 1)
  
cnt = 0
for (c, m) in collections.Counter(s):
	combi = f(m - 1)
    if combi != 1:
        cnt += combi
    
print(cnt)

Buggy submission (verdict: Runtime Error):
import collections  

n = int(input())

s = []
for i in range(n):
s.append(str(sorted(input())))

def f(a):
  if a == 0:
    return 1
  else:
    return a * f(a - 1)
  
cnt = 0
for (c, m) in collections.Counter(s):
	combi = f(m - 1)
    if combi != 1:
      cnt += combi
    
print(cnt)

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

s = []
for i in range(n):
  s.append(sorted(input()))

print(n - len(set(s)))

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

s = []
for i in range(n):
  s.append(sorted(input())

print(n - len(set(s)))
Problem p02608 (python)

Fixed submission:
from math import sqrt

n = int(input())
lim_n = int(sqrt(n*2))
result = [0] * n

for i in range(2, lim_n+1):
    for j in range(2, i+1):
        for k in range(2, j+1):
            p = i**2+j**2+k**2
            if p > 2*n:
                break
            if p % 2 == 1:
                continue
            if (j + k) - i < 2:
                continue
            if i == j and j == k:
                if i  % 2 ==1:
                    continue
                result[p//2-1] += 1
            elif i != j and j != k:
                result[p//2-1] += 6
            else:
                result[p//2-1] += 3

for item in result:
    print(item)

Buggy submission (verdict: Runtime Error):
from math import sqrt

def func(num):
    for i in range(2, lim_n+1):
        for j in range(2, i+1):
            for k in range(2, j+1):
                if i**2 + j ** 2 + k ** 2 == 2 * num:
                    if (j + k) - i != 0 and ((j + k) - i) % 2 == 0:
                        if i == j and j == k:
                            if i  % 2 ==1:
                                break
                            return 1
                        elif i != j and j != k:
                            return 6
                        else:
                            return 3
    return 0

n = int(input())
for i in range(1, n+1):
    print(func(i))

Buggy submission (verdict: Runtime Error):
from math import sqrt

n = int(input())
lim_n = int(sqrt(n * 2))
for i in range(1, i+1):
  print(func(i))

def func(num):
  for i in range(2, lim_n+1):
    for j in range(2, i+1):
      for k in range(2, j+1):
        if i**2 + j ** 2 + k ** 2 == 2 * n:
          if i == j and j == k:
            return 1
          elif i != j and j != k:
            return 6
          else:
            return 3
  return 0
Problem p02678 (python)

Fixed submission:
import sys
from collections import deque
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M = map(int, readline().split())
 
G = [[] for _ in range(N + 1)]
m = map(int, read().split())
for a, b in zip(m, m):
    G[a].append(b)
    G[b].append(a)
 
par = [0] * (N + 1)
visited = [0] * (N + 1)
root = 1
visited[root] = 1
q = deque([root])
while q:
    v = q.popleft()
    for w in G[v]:
        if visited[w]:
            continue
        visited[w] = 1
        par[w] = v
        q.append(w)
 
print('Yes')
print(*par[2:], sep='\n')

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M = map(int, input().split())
m = [list(map(int, input().split())) for _ in range(M)]
 
G = [[] for _ in range(N + 1)]
for a, b in zip(m, m):
    G[a].append(b)
    G[b].append(a)
 
par = [0] * (N + 1)
visited = [0] * (N + 1)
root = 1
visited[root] = 1
q = deque([root])
while q:
    v = q.popleft()
    for w in G[v]:
        if visited[w]:
            continue
        visited[w] = 1
        par[w] = v
        q.append(w)
 
print('Yes')
print(*par[2:], sep='\n')

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, input().split())
m = [list(map(int, input().split())) for _ in range(m)]
 
G = [[] for _ in range(N + 1)]
for a, b in zip(m, m):
    G[a].append(b)
    G[b].append(a)
 
par = [0] * (N + 1)
visited = [0] * (N + 1)
root = 1
visited[root] = 1
q = deque([root])
while q:
    v = q.popleft()
    for w in G[v]:
        if visited[w]:
            continue
        visited[w] = 1
        par[w] = v
        q.append(w)
 
print('Yes')
print(*par[2:], sep='\n')
Problem p02922 (python)

Fixed submission:

a, b = map(int, input().split())
i = 0
count = 1
while True:
    if b <= count:
        break
    count = count + a - 1
    i += 1
print(i)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
i = 0
count = 1
while true:
  if b <= count:
    break
  count = count + a - 1
  i += 1
print(i)
Problem p03001 (python)

Fixed submission:
w,h,x,y = map(int, input().split())
if w//2==x and h//2==y and w%2==0 and h%2==0:
	print(w*h/2., 1)
else:
	print(w*h/2., 0)

Buggy submission (verdict: Runtime Error):
w,h,x,y = map(int, input().split())
if w//2==x and h//2==y and w%2==0 and h%2==0:
	print(w*h/2., 1)
else*
	print(w*h/2., 0)

Buggy submission (verdict: Runtime Error):
w,h,x,y = map(int, input().split())
if w//2==x and h//2==y:
	print(w*h/2, 1)
else*
	print(w*h/2, 0)
Problem p02657 (python)

Fixed submission:
def product(a,b):
    return a*b
    
a,b=map(int,input().split())
print(product(a,b))

Buggy submission (verdict: Runtime Error):
def product(a,b):
    return a*b
    
a=int(input())
b=int(input())
print(product(a,b))
Problem p02553 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
e = []
for i in [a, b]:
    for j in [c, d]:
        e += [i * j]

print(max(e))

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
e = []
for i in list[a, b]:
    for j in list[c, d]:
        e += [i * j]

print(max(e))

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
a = []
for i in range(a, b + 1):
    for j in range(c, d + 1):
        a += i * j
max(a)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
for i in range(a, b + 1):
    for j in range(c, d + 1):
        print(max(i * j))
Problem p02713 (python)

Fixed submission:
import numpy as np
import math
K = int(input())
memo = np.zeros((K,K),int)
s = 0
for i in range(K):
  for j in range(i,K):
    for k in range(j,K):
      if i == j and j == k:
        rate = 1
      elif i == j or j == k or i == k:
        rate = 3
      else:
        rate = 6
      s += math.gcd(math.gcd(i+1,j+1),k+1) * rate
print(s)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
K = int(input())
memo = np.zeros((K,K),int)
s = 0
for i in range(K):
  for j in range(i,K+1):
    for k in range(j,K+1):
      if memo[i][j] != 0:
        if memo[memo[i][j]-1][k] != 0:
          s += memo[memo[i][j]-1][k]
        else:
          memo[memo[i][j]-1][k] = math.gcd(memo[i][j],k+1)
          memo[k][memo[i][j]-1] = memo[memo[i][j]-1][k]
          s += memo[k][memo[i][j]-1]
      else:
        
        memo[i][j] = math.gcd(i+1,j+1)
        memo[j][i] = memo[i][j]
        if memo[memo[i][j]-1][k] != 0:
          s += memo[memo[i][j]-1][k]
        else:
          memo[memo[i][j]-1][k] = math.gcd(memo[i][j],k+1)
          memo[k][memo[i][j]-1] = memo[memo[i][j]-1][k]
          s += memo[k][memo[i][j]-1]
print(s)
Problem p02717 (python)

Fixed submission:
X, Y, Z = map(int, input().split(' '))
print(Z,X,Y)

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split(' '))
x = N % K
x1 = K - x
if x > x1:
  print(x1)
else:
  print(x)

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split(' '))
x = N % K
x1 = K - x
if x > x1:
  print(x1)
else:
  print(x)
Problem p02720 (python)

Fixed submission:
import queue
K = int(input())
q = queue.Queue()
for i in range(1,10):
  q.put(i)
    
    
for i in range(K-1):
  x = q.get()
  if x%10 != 0:
    q.put(10*x + (x%10 -1) )
  q.put(10*x+x%10)
  if x%10 != 9:
    q.put(10*x + (x %10 + 1) )
print(q.get())

Buggy submission (verdict: Runtime Error):
for i in range(K-1):
  x = q.get()
  if x%10 != 0:
    q.put(10*x + (x%10 -1) )
  q.put(10*x+x%10)
  if x%10 != 9:
    q.put(10*x + (x %10 + 1) )
print(q.get())

Buggy submission (verdict: Runtime Error):
for i in range(K-1):
  x = q.get()
  print(x)
  if x%10 != 0:
    q.put(10*x + (x%10 -1) )
  q.put(10*x+x%10)
  if x%10 != 9:
    q.put(10*x + (x %10 + 1) )
print(q.get())
Problem p02741 (python)

Fixed submission:
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int (input())
 
print(l[k-1])

Buggy submission (verdict: Runtime Error):
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int (input())
 
print(l[k+1])

Buggy submission (verdict: Runtime Error):
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int (input())

print(l[k])

Buggy submission (verdict: Runtime Error):
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = input()
println(l[k])
Problem p02888 (python)

Fixed submission:
import bisect
N = int(input())
L = [int(i) for i in input().split(' ')]
L.sort()

sum = 0
for i,k in enumerate(L):
  for j in range(i+1, N):
    sum += bisect.bisect_left(L,L[j] + k) - j - 1


print(sum)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
L = [int(i) for i in input().split(' ')]
L.sort()

sum = 0
for i,k in enumerate(L):
  for j in range(i+1, N):
    for l in range(j+1, N):
      if L[l] < L[j] + k:
     　 print(bisect.bisect_right(L,L[j] + k))
        
        sum += 1
      else:
        break;
print(sum)