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

Fixed submission:
a1, a2, a3 = map(int, input().split())
if a1 + a2 + a3 <= 21:
  print("win")
else:
  print("bust")

Buggy submission (verdict: Runtime Error):
a1, a2, a3 = map(int, input().split())
if a1 + a2 + a3 <= 21:
  print("win)
else:
        print("bust")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = a + b
if c + d <= 21:
  print("win")
else:
  print("bust")
Problem p02688 (python)

Fixed submission:
n, k = map(int,input().split())
sn = [0 for x in range(n)]
for kind in range(k):
    d = int(input())
    a_lis = list(map(int,input().split()))
    for a in a_lis:
        sn[a-1] += 1
print(sn.count(0))

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
d = int(input())
for x in range(k + 1):
    map(int,input().split())
print(n-d)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
d = int(input())
for x in range(k + 1):
    input()
print(n-d)
Problem p03041 (python)

Fixed submission:
N,K=map(int,input().split())
s=input()
S=s.lower()
print(s[:K-1]+S[K-1:K]+s[K:])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
xyz = [list(map(int,input().split())) for x in range(m)]

checked = [x for x in range(1,n+1)] #checked = 0
xyz.sort()
ans=n
for i in xyz:
    x,y,z = i
    if x in checked and y in checked:
        checked[x-1]=0
        checked[y-1]=0
        ans-=1 #no check
    elif x in checked or y in checked:
        checked[x-1]=0
        checked[y-1]=0
        ans-=1 #one check
    else:
        pass
print(ans)
Problem p03107 (python)

Fixed submission:
S = input()
r = S.count('0')
b = S.count('1')
print(min(r,b)*2)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
for _ in range(N//2):
    S = S.replace('01','').replace('10','')S.replace('01','').replace('10','')S.replace('01','').replace('10','')S.replace('01','').replace('10','')S.replace('01','').replace('10','')
    if S.count('01') == 0 and S.count('10') == 0:
        break
print(N - len(S))
Problem p03137 (python)

Fixed submission:
N,M = map(int,input().split())
X = list(map(int,input().split()))
if N > M :
    print(0)
else:
    X.sort()
    x_next = X[0]
    flag = [X[_] - X[_-1] for _ in range(1,M)]
    flag.sort()
    flag = flag[:M-N:]
    print(sum(flag))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
X = list(map(int,input().split()))
if N > M :
    print(0)
else:
    flag = [0 for fl in range(M)]
    X.sort()
    for _ in range(1,M+1):
        flag[_] += X[_] - X[_-1]
    for lp in range(len(flag)):
      	ff = flag.index(max(flag))
        flag.pop(ff)
        print(sum(flag))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
X = list(map(int,input().split()))
if N > M :
    print(0)
else:
    flag = [0 for fl in range(M)]
    X.sort()
    for _ in range(1,M):
        flag[_] += X[_] - X[_-1]
   for lp in range(N-1):
        flag.pop(flag.index(max(flag)))
        print(sum(flag))
Problem p03208 (python)

Fixed submission:
N,K = map(int,input().split())
lis = [int(input()) for x in range(N)]
lis.sort()
print(min(lis[i+K-1] - lis[i] for i in range(N-K+1)))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
lis = [int(input()) for x in range(N)]
lis.sort()
print(min(lis[i+K-1] - lis[i] for x in range(N-K+1)))
Problem p03221 (python)

Fixed submission:
N,M = map(int,input().split())
lis  = [list(map(int,input().split())) for _ in range(M)]
ans_lis = [0] * M
lis_sort = sorted(lis,key =lambda x:(x[0],x[1]))
flag = lis_sort[0][0]
i = 1
for x in lis_sort:
    if x[0] != flag:
        flag = x[0]
        i=1
    x[1] = '0'*(6-len(str(i)))+str(i)
    i+=1
for x in lis:
    print('0'*(6-len(str(x[0]))),str(x[0]),x[1],sep='')

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
lis  = [list(map(int,input().split())) for _ in range(M)]
ans_lis = [0] * M
lis_sort = sorted(lis)
i = 1
flag = 0
for _ in range(len(lis_sort)):
    if flag != lis_sort[_][0]:
        flag = lis_sort[_][0]
        i = 1
    ans_lis[lis.index(lis_sort[_])] = str(i)
    i += 1
for x,y in zip(lis,ans_beh_lis):
    print('0'*(6-len(str(x[0]))),x[0],'0'*(6-len(y)),y,sep='')
Problem p03250 (python)

Fixed submission:
a = list(map(int,input().split()))
a.sort(reverse=True)
print(int(str(a[0])+str(a[1])) + a[2])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input()))
a.sort(reverse=True)
print(int(str(a[0])+str(a[1])) + a[2])
Problem p02912 (python)

Fixed submission:
import heapq

N,M = map(int, input().split())
A_list = list(map(int, input().split()))
for i in range(N):
    A_list[i] *= -1

heapq.heapify(A_list)

for i in range(M):
    heapq.heappush(A_list, ((heapq.heappop(A_list) * -1 )// 2) * -1)

print(sum(A_list) * -1)

Buggy submission (verdict: Runtime Error):
import bisect

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

A_list = sorted(A_list)
#print(A_list)

for i in range(M):
    val = A_list.pop()//2
    bisect.insort_left(A_list, val, lo=(N-M) + i )

print(sum(A_list))
Problem p02948 (python)

Fixed submission:
import heapq

N,M = map(int, input().split())
a_b_list = []
for i in range(N):
    a,b = map(int, input().split())
    a_b_list.append([a,b])

a_b_list.sort()
task_list = [0] * (M+1)

heap = []
index = 0
for day in range(1, M+1):
    while index < N:
        if a_b_list[index][0] == day:
            heapq.heappush(heap, a_b_list[index][1] * -1)
            index += 1
        else:
            break
    if len(heap) != 0:
        task_list[day] = heapq.heappop(heap)

#print(task_list)
print(sum(task_list) * -1)


# for a,b in a_b_list:
# #    print(a, b)
#     if task_list[a] == 0:
# #        print("append")
#         task_list[a] = b
#     else:
# #        print("NOT append")
#         index = a + 1
#         while index <= M:
#             if task_list[index] == 0:
#                 task_list[index] = b
#                 break
#             index += 1
# print(sum(task_list))
# #print(task_list)

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

a_b_list.sort(key=lambda x:(x[1],x[0]))
a_b_list.reverse()
#print(a_b_list)
task_list = [0] * (M+1)


for a,b in a_b_list:
#    print(a, b)
    if task_list[a] == 0:
#        print("append")
        task_list[a] = b
    else:
#        print("NOT append")
        index = a + 1
        while index <= M:
            if task_list[index] == 0:
                task_list[index] = b
                break
            index += 1
print(sum(task_list))
#print(task_list)
Problem p02989 (python)

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

n1 = N//2
print(d_list[n1] - d_list[n1 - 1])

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

n1 = d_list[N//2]
print(d_list[n1 + 1] - d_list[n1])
Problem p03041 (python)

Fixed submission:
N,K = map(int, input().split())
S = input()
ret = ""
for i in range(len(S)):
    if i == K-1:
        ret += S[i].lower()
    else:
        ret += S[i]
print(ret)

Buggy submission (verdict: Runtime Error):
S = input()
ret = ""
for i in range(len(S)):
    if i == K-1:
        ret += S[i].lower()
    else:
        ret += S[i]
print(ret)
Problem p02699 (python)

Fixed submission:
S, W = map(int, input().split())
 
if S <= W:
  print('unsafe')
else:
  print('safe')

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

ans = 0

## 4桁
for i in range(0, len(S)-3):
  for j in range(i+3, len(S)):
    #print(S[i:j+1])
    if int(S[i:j+1]) % 2019 == 0:
      ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
S, W = map(int, intput().split())

if S <= W:
  print('unsafe')
else:
  print('safe')
Problem p03705 (python)

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

min_sum = a * (n - 1) + b
max_sum = b * (n - 1) + a

print(max(max_sum - min_sum + 1, 0))

Buggy submission (verdict: Runtime Error):
N=input()
A=input()
B=input()
print((2-N)(A-B))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if n>1 and b>=a or n==1 and a==b: 
    print ((n-2)*(b-a)+1);
else:
    print ("0");
Problem p02833 (python)

Fixed submission:
from math import log
N = int(input())

if (N % 2 != 0) or N == 0: print(0)
else:
    k = N//2
    ans = 0
    for i in range(1,int(log(k,5)+1)):
        ans += k//(5**i)
    print(ans)

Buggy submission (verdict: Runtime Error):
from math import factorial, log, floor
N = int(input())

if N % 2 != 0: print(0)
else:
    k = N//2
    ans = 0
    for i in range(1,int(log(k,5))+1):
        ans += floor(k/5**i)
    print(ans)
Problem p02990 (python)

Fixed submission:
from math import factorial
def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

div = 10**9+7

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

for i in range(1,K+1):
    if N-K+1 < i:
        print(0)
        continue
    ans = combinations_count(N-K+1,i) % div
    ans = ans * combinations_count(K-1,i-1) % div
    print(ans)

Buggy submission (verdict: Runtime Error):
from math import factorial
def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

def combinations_with_replacement_count(n, r):
    return combinations_count(n + r - 1, r)

div = 10**9+7

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

for i in range(1,K+1):
    ans = combinations_count(N-K+1,i) % div
    ans = ans * combinations_count(K-1,i-1) % div
    print(ans)
Problem p03038 (python)

Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
BC = []
for i in range(M):
    b,c = map(int,input().split())
    BC.append([b,c])
BC.sort(key=lambda x:x[1], reverse=True)
# print(BC)

A.sort()

i = 0
j = 0
while i < N and j < M and BC[j][1] > A[i]:
    if BC[j][0] < 1:
        j += 1
        continue
    A[i] = BC[j][1]
    BC[j][0] -= 1
    i += 1

print(sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = list(map(int,input().split()))
BC = []
for i in range(M):
    b,c = map(int,input().split())
    BC.append([b,c])
BC.sort(key=lambda x:x[1], reverse=True)
# print(BC)

A.sort()

i = 0
j = 0
while BC[j][1] > A[i] and i < N and j < M:
    if BC[j][0] < 1:
        j += 1
        continue
    A[i] = BC[j][1]
    BC[j][0] -= 1
    i += 1

print(sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = list(map(int,input().split()))
BC = []
for i in range(M):
    b,c = map(int,input().split())
    BC.append([b,c])
BC.sort(key=lambda x:x[1], reverse=True)

A.sort()

i = 0
j = 0
while i < N and j < M:
    while BC[j][1] > A[i]:
        if BC[j][0] < 1:
            j += 1
            continue
        A[i] = BC[j][1]
        BC[j][0] -= 1
        i += 1
    break

print(sum(A))
Problem p03127 (python)

Fixed submission:
from fractions import gcd
N = int(input())
li = set(map(int,input().split()))
li = list(li)

ans = li[0]
for i in range(1,len(li)):
    ans = gcd(ans,li[i])
    if ans == 1: break

print(ans)

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

li.sort()
while len(li) > 1:
    a = li.pop()
    b = li.pop()
    if a % b == 1:
        li[0] = 1
        break
    if a % b != 0:
        li.append(a % b)
    li.append(b)
    li.sort()
print(li[0])

Buggy submission (verdict: Runtime Error):
from heapq import heappush
N = int(input())
li = list(map(int,input().split()))

li.sort()
while len(li) > 1:
    a = li.pop()
    b = li.pop()
    if a % b != 0: heappush(li,a % b)
print(li[0])
Problem p03250 (python)

Fixed submission:
l = sorted(map(int,input().split()),reverse=True)
print(eval(''.join(map(str,l[:2]))+'+'+str(l[2])))

Buggy submission (verdict: Runtime Error):
l = sorted(map(int,input().split()),reversed=True)
print(eval(''.join(l[:2])+'+'+str(l[2])))
Problem p03745 (python)

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

dif = [0] * (N-1)
for i in range(1,N): dif[i-1] = A[i] - A[i-1]

ans = 1
t = 0
i = 0
for d in dif:
    if t == 0:
        t = d
    elif d*t < 0:
        ans += 1
        t = 0
print(ans)

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

dif = [0] * (N-1)
for i in range(1,N): dif[i-1] = A[i] - A[i-1]

ans = 1
t = dif[0]
for i in range(N-1):
    if dif[i]*t < 0:
        ans += 1
        if i < N-2:
            t = dif[i+1]
print(ans)
Problem p02933 (python)

Fixed submission:
a=int(input())
s=input()
if a>=3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(2*10**5)
n,q=map(int,input().split())
graph=[[] for _ in range(n)]
for _ in range(n-1):
  a,b=map(int,input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
counter=[0]*n
for _ in range(q):
  p,x=map(int,input().split())
  counter[p-1]+=x
score=[0]*(n+1)
stack=[(0,-1)]
while stack!=[]:
  node,prev=stack.pop()
  score[node]=score[prev]+counter[node]
  for i in graph[node]:
    if i!=prev:
      stack.append((i,node))
print(*score[:-1])
Problem p02948 (python)

Fixed submission:
import heapq
Heappop=heapq.heappop
Heappush=heapq.heappush
N,M=map(int,input().split())
L=[]
for _ in range(N):
    a,b=map(int,input().split())
    L.append([a,-b])
L.sort()
q=[0]*10**5
ans=0
d=1
memo=0
while d<=M:
    while memo<=N-1:
        a,b=L[memo]
        if d<a:
            break
        else:
            Heappush(q,b)
            memo+=1
    ans-=Heappop(q)
    d+=1
print(ans)

Buggy submission (verdict: Runtime Error):
from Lib import heapq
Heappop=heapq.heappop
Heappush=heapq.heappush
N,M=map(int,input().split())
L=[]
for _ in range(N):
    a,b=map(int,input().split())
    L.append([a,-b])
L.sort()
q=[0]*10**5
ans=0
d=1
memo=0
while d<=M:
    while memo<=N-1:
        a,b=L[memo]
        if d<a:
            break
        else:
            Heappush(q,b)
            memo+=1
    ans-=Heappop(q)
    d+=1
print(ans)
Problem p02990 (python)

Fixed submission:
from math import factorial
def C(a,b):
    return (factorial(a)//factorial(b))//factorial(a-b)
N,K=map(int,input().split())
MOD=10**9+7
for i in range(1,K+1):
    if N-K+1>=i:print((C(N-K+1,i)*(C(K-1,i-1)))%MOD)
    else:print(0)

Buggy submission (verdict: Runtime Error):
from math import factorial
def C(a,b):
    return (factorial(a)//factorial(b))//factorial(a-b)
N,K=map(int,input().split())
MOD=10**9+7
for i in range(1,K+1):
    print((C(N-K+1,i)*(C(K-1,i-1)))%MOD)
Problem p03042 (python)

Fixed submission:
S=input()
L=["01","02","03","04","05","06","07","08","09","10","11","12"]

if S[:2] in L:
    if S[2:] in L:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if S[2:] in L:
        print("YYMM")
    else:
        print("NA")

Buggy submission (verdict: Runtime Error):
=input()
L=["01","02","03","04","05","06","07","08","09","10","11","12"]

if S[:2] in L:
    if S[2:] in L:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if S[2:] in L:
        print("YYMM")
    else:
        print("NA")
Problem p02831 (python)

Fixed submission:
import fractions as fr
A,B = map(int,input().split())
 
def lcd(x,y):
  return (x*y)//fr.gcd(x,y)
 
print(lcd(A,B))

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

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

print(lcd(A,B))
Problem p02897 (python)

Fixed submission:
n = int(input())
e = n//2
o = n-e
print(o/n)

Buggy submission (verdict: Runtime Error):
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import fractions
from functools import reduce
from operator import mul
import bisect
import sys
import logging
import heapq
import itertools

logging.basicConfig(level=logging.ERROR)

input = sys.stdin.readline

setrecursionlimit(1000000)


def main():
	a,b = map(int,input().split())
	g = gcd([a,b])
	l = factorization(g)
	print(len(l)+1 if len(l) != 1 else 1)

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 cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(numbers):
	return reduce(fractions.gcd, numbers)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

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

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

class PriorityQueue():
	def __init__(self):
		self.queue = []
	def push(self,i):
		heapq.heappush(self.queue,-i)
	def pop(self):
		return -1 * heapq.heappop(self.queue)
	def sum(self):
		return -sum(self.queue)

main()
Problem p03705 (python)

Fixed submission:
n, a, b = map(int, raw_input().split())
print max(a - b + (b - a) * max(n - 1, 0) + 1, 0)

Buggy submission (verdict: Runtime Error):
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	unsigned long long a,b,c,d,e,n;
	cin>>n>>a>>b;
	e=(a+b)*n/2;
	cout<<e;
	return 0;
}

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if n>1 and b>=a or n==1 and a==b: 
    print ((n-2)*(b-a)+1);
else:
    print ("0");
Problem p03221 (python)

Fixed submission:
from sys import stdin
import numpy as np

s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()
N, M = ds_in()
info_list = []
for _ in range(M):
    info_list.append(ds_in())
info_list = np.array(info_list)
ordered = np.argsort(info_list[:, 1])
pref_count = np.zeros(N)
ans_list = ['' for _ in range(M)]
for i in ordered:
    pref = info_list[i, 0]
    pref_count[pref - 1] += 1
    ans_list[i] = '%06d%06d' % (pref, pref_count[pref - 1])
for a in ans_list:
    print(a)

Buggy submission (verdict: Runtime Error):
import numpy as np
from sys import stdin
s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()
N, M = ds_in()
info_list = []
for _ in range(M):
    info_list.append(ds_in())
info_list = np.array(info_list)
ordered = np.argsort(info_list[:, 1])
pref_count = np.zeros(N)
ans_list = ['' for _ in range(M)]
for i in ordered:
    pref = info_list[i, 0]
    pref_count[pref - 1] += 1
    ans_list[i] = '%06d%06d' % (pref, pref_count[pref - 1])
for a in ans_list:
    print(a)
Problem p02729 (python)

Fixed submission:
import sys
from math import factorial

def comb(n,r):
    a = factorial(n) / factorial(r) / factorial(n - r)
    return int(a)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


N, M = map(int, read().split())

a = comb(N, 2) if N>=2 else 0
b = comb(M, 2) if M >=2 else 0
ans = N * (N-1) // 2 + M * (M-1) //2
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from math import factorial

def comb(n,r):
    a = factorial(n) / factorial(r) / factorial(n - r)
    return int(a)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


N, M = map(int, read().split())

ans = comb(N, 2) + comb(M, 2)

print(ans)
Problem p03631 (python)

Fixed submission:
N = input()
M = N[2] + N[1] + N[0]
if N == M:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
M = N[2] + N[1] + N[0]
if N == M:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
N = input()
M = N[2] + N[1] + N[0]
if N == M:
Problem p03775 (python)

Fixed submission:
import math
N=int(input())
nmax = math.ceil(math.sqrt(N))
i = 1
Bdigimin = 10
while ( i <= nmax):
	if N % i == 0:
		Bdigi = math.floor(math.log10(N/i))
		if Bdigimin > Bdigi:
			Bdigimin = Bdigi
	i += 1
print(int(Bdigimin+1))

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
if N==1:
	print(1)
else:
	nmax = math.ceil(math.sqrt(N))
	Bdigimin = 10
	for i in range(nmax):
		if N % (i+1) == 0:
			Bdigi = math.floor(math.log10(N/i))
			if Bdigimin > Bdigi:
				Bdigimin = Bdigi
	print(int(Bdigimin+1))
Problem p02915 (python)

Fixed submission:
n=int(input())
print(n**3)

Buggy submission (verdict: Runtime Error):
print(2**int(input))
Problem p03207 (python)

Fixed submission:
# coding: utf-8

itemCount = int(input())

itemList = sorted([ int(input()) for i in range(itemCount)])
itemList.reverse()

ans = sum(itemList) - int(itemList[0] / 2)
print(ans)

Buggy submission (verdict: Runtime Error):


fun main(args:Array<String>) {
    val itemCount = readLine()!!.toInt()
    val items = (1..itemCount).map { readLine()!!.toInt() }.sortedDescending()
    val ans = items[0] / 2 + items.drop(1).sum()
    println(ans)
}
Problem p03767 (python)

Fixed submission:
# coding: utf-8

n = int(input().rstrip())

numbers = list(reversed(sorted(map(int, input().rstrip().split(" ")))))

ans = 0
for i in range(n):
    ans += numbers[i*2+1]

print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

n = int(input().rstrip())

numbers = list(reversed(sorted(map(int, input().rstrip().split(" ")))))

ans = 0
for i in range(n):
    ans += numbers[n*i+1]

print(ans)
Problem p02693 (python)

Fixed submission:
N = int(input())
A, B = map(int, input().split())
for i in range(A, B+1):
  if i % N == 0:
    print('OK')
    break
else:
  print('NG')

Buggy submission (verdict: Runtime Error):
import math
A, B, N = map(int,input().split())
ans = 0
for i in range(1,min(N,B)):
  X = math.floor(A*i//B)-A*math.floor(i//B)
  if(X>=ans):
    ans = X
print(ans)

Buggy submission (verdict: Runtime Error):
K = int(input())
A, B = map(int,input().spilt())
if(A<=(B//K)*K){
  print("OK")
}
else{
  print("NG")
}

Buggy submission (verdict: Runtime Error):
K = int(input())
A, B = map(int,input().spilt())
if(A<=B/K*K){
  print("OK")
}
else{
  print("NG")
}

Buggy submission (verdict: Runtime Error):
K = int(input())
A, B = map(int,input.spilt())
if(A<=B/K*K){
  print("OK")
}
else{
  print("NG")
}

Buggy submission (verdict: Runtime Error):
N = int(input())
A, B = map(int,input.split())
if(A<=B/K*K){
  print("OK")
}
else{
  print("NG")
}
Problem p02693 (python)

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

flag=False
for i in range(b,c+1):
   if i%a==0:
    flag=True
    break
print("OK" if flag else "NG")

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

flag=False
for i in range(a,b+1):
   if i%a==0:
   flag=True
   break
print("OK" if flag else "NG")