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

Fixed submission:
from itertools import *
from bisect import *
from operator import *
import math

def comb(n, r):
    return math.factorial(n) / (math.factorial(r) * math.factorial(n-r))

n = int(input())
a = list(map(int, input().split()))

a_item = sorted(a)
a_max = a_item[-1]
a_item = a_item[:-1]
bisect_l_item = bisect_left(a_item, a_max//2)
#import pdb; pdb.set_trace()
if bisect_l_item >= n - 1:
    bisect_l = a_item[bisect_l_item - 1]
else:
    bisect_l = a_item[bisect_l_item]

bisect_r = a_item[bisect_l_item - 1]
if abs(bisect_r - a_max/2) <= abs(bisect_l - a_max/2):
    print(a_max, bisect_r)
else:
    print(a_max, bisect_l)
#print(bisect_l_item, bisect_l, bisect_r)
#idea_l = comb(a_max, bisect_l)
#idea_r = comb(a_max, bisect_r)

Buggy submission (verdict: Runtime Error):
from itertools import *
from bisect import *
from operator import *

n = int(input())
a = list(map(int, input().split()))

a_item = sorted(a)
a_max = a_item[-1]
a_item = a_item[:-1]
bisect_l_item = bisect_left(a_item, a_max//2)
#import pdb; pdb.set_trace()
bisect_r = a_item[bisect_l_item - 1]
if bisect_l_item < n - 1:
    bisect_l = a_item[bisect_l_item]
else:
    bisect_l = bisect_r
#print(bisect_l_item, bisect_l, bisect_r)
idea_l = len(list(combinations(range(a_max), bisect_l)))
idea_r = len(list(combinations(range(a_max), bisect_r)))

if idea_l >= idea_r:
    print(a_max, bisect_l)
else:
    print(a_max, bisect_r)

Buggy submission (verdict: Runtime Error):
from itertools import *
from bisect import *
from operator import *

n = int(input())
a = list(map(int, input().split()))

a_item = sorted(a)
a_max = a_item[-1]
#a_item = a_item[:-1]
bisect_l_item = bisect_left(a_item, a_max//2)
#import pdb; pdb.set_trace()
bisect_l = a_item[bisect_l_item]
bisect_r = a_item[bisect_l_item - 1]
#print(bisect_l_item, bisect_l, bisect_r)
idea_l = len(list(combinations(range(a_max), bisect_l)))
idea_r = len(list(combinations(range(a_max), bisect_r)))

if idea_l >= idea_r:
    print(a_max, bisect_l)
else:
    print(a_max, bisect_r)
Problem p03415 (python)

Fixed submission:
a = ""
for i in range(3):
  a += input()[i]

print(a)

Buggy submission (verdict: Runtime Error):
def solve(n,k):
  counter = 0
  for i in range(n,k,-1):
    theValue = n//i * (i-k) + max(n%i-k+1,0)
    counter += theValue
  return counter

c = list(map(int, input().split()))
print(solve(c[0], c[1]))

Buggy submission (verdict: Runtime Error):
def solve(n,k):
  counter = 0
  for i in range(n,k,-1):
    theValue = n//i * (i-k) + max(n%i-k+1,0)
    counter += theValue
  return counter

c = list(map(int, input().split()))
print(solve(c[0], c[1])
Problem p03418 (python)

Fixed submission:
def solve(n,k):
  counter = 0
  for i in range(n,k,-1):
    theValue = n//i * (i-k) + max(n%i-k+1,0)
    if (k == 0):
      theValue = max(theValue-1, 0)
    counter += theValue
  return counter

c = list(map(int, input().split()))
print(solve(c[0], c[1]))

Buggy submission (verdict: Runtime Error):
def solve(n,k):
  counter = 0
  for i in range(n,k,-1):
    theValue = n//i * (i-k) + max(n%i-k , 0)
    counter += theValue
  return counter

c = list(map(int, input().split(' ')))
def(c[0], c[1])
Problem p03109 (python)

Fixed submission:
x = input()
yyyy, mm, dd = x.split("/")
if int(mm) <= 4:
  print("Heisei")
else:
  print("TBD")

Buggy submission (verdict: Runtime Error):
x = input()
yyyy, mm, dd = x.split("/")
if mm <= 4:
  print("Heisei")
else:
  print("TBD")
exit(0)

Buggy submission (verdict: Runtime Error):
x = input()
yyyy, mm, dd = x.split("/")
if mm <= 4:
  print("Heisei")
else:
  print("TBD")
Problem p03047 (python)

Fixed submission:
n = list(map(int, input().split()))
a =[]
c = 1
b = []

for i in range(1, n[0]+1):
    b.append(i)

for j in range(1, n[1]+1):
    a.append(j)

for k in range(b[-1]):
    if b[-1] == a[-1]:
        print(c)
        break
    else:
        a[-1] += 1
        c += 1

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
z =0

for i in range(1, n+1, 2):
    b = n//i
    c = n%i
    if b==c:
        a.append(i)
print(sum(a))

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
r = a[0]
g = a[1]
b = a[2]
n = a[3]
c = 0

for i in range(n+1):
    for j in range(n+1):
        k = (n - (r*i + g*j))//b
        if k >= 0:
            if n == r*i + g*j + b*k:
                c += 1
print(c)
Problem p03047 (python)

Fixed submission:
a = raw_input().split()
print(int(a[0])-int(a[1])+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
stlist = []
bf = 0
al = 0
ab = 0
ba = 0
for i in range(N):
    tmp = input()
    ab += tmp.count("AB")
    if tmp[0] == 'B' and tmp[-1] == 'A':
        ba += 1
    elif tmp[0] =='B':
        bf+=1
    elif tmp[-1] =='A':
        al+=1
if al == 0 and bf ==0:
    print(ba-1+ab)
elif al * bf ==0:
    print(min(al-1, bf-1, 0) + ba + ab)
else:
    print(min(al-1, bf-1, 0) + ba +1 + ab)

Buggy submission (verdict: Runtime Error):
a = raw_input().split()
print(int(a[0])-int(a[1])+1)

Buggy submission (verdict: Runtime Error):
a = raw_input().split()
print(a[0]-a[1]+1)
Problem p03047 (python)

Fixed submission:
t = input()
l = t.split(" ")
N = int(l[0])
K = int(l[1])
count = 0
numbers = list(range(1, N+1))
while True:
    if len(numbers) >= K:
        numbers.pop(0)
        count = count + 1
    else:
        print(count)
        break

Buggy submission (verdict: Runtime Error):
l = raw_input().split()
N = int(l[0])
K = int(l[1])
count = 0
numbers = list(range(1, N+1))
while True:
    if len(numbers) >= K:
        numbers.pop(0)
        count = count + 1
    else:
        print(count)
        break

Buggy submission (verdict: Runtime Error):
from pip._vendor.distlib.compat import raw_input

l = raw_input().split()
N = int(l[0])
K = int(l[1])
count = 0
numbers = list(range(1, N+1))
while True:
    if len(numbers) >= K:
        numbers.pop(0)
        count = count + 1
    else:
        print(count)
        break

Buggy submission (verdict: Runtime Error):
import sys

N = int(sys.argv[1])
K = int(sys.argv[2])
count = 0
numbers = list(range(1, N+1))
while True:
    if len(numbers) >= K:
        numbers.pop(0)
        count = count + 1
    else:
        print(count)
        break

Buggy submission (verdict: Runtime Error):
import sys

if __name__ == "__main__":
    N = int(sys.argv[1])
    K = int(sys.argv[2])
    count = 0
    numbers = list(range(1, N+1))
    while True:
        if len(numbers) >= K:
            numbers.pop(0)
            count = count + 1
        else:
            print(count)
            break

Buggy submission (verdict: Runtime Error):
return 1
Problem p03047 (python)

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

print(N+1-K)

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

print(N+1-k)
Problem p03067 (python)

Fixed submission:
import sys
a, b, c = map(int, input().split())
 
if a > b:
  for i in range(b, a):
    if i == c:
      print('Yes')
      sys.exit(0)
else:
  for i in range(a, b):
    if i == c:
      print('Yes')
      sys.exit(0)

print('No')

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

if a > b:
  for i in range(a, b):
    if i == c:
      print('Yes')
      break
  print('No')
else:
  for i in range(b, a):
    if i == c:
      print('Yes')
      break
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split)
if a < c < b:
  print('Yes')
else:
  print('No')
Problem p03068 (python)

Fixed submission:
_  = input()
s = input()
index = int(input())-1

result = ''

t = s[index]

for i in s:
  if i != t:
    result += '*'
  else:
    result += i
print(result)

Buggy submission (verdict: Runtime Error):
x = int(input())
s = input()
i = int(input())

si = s[i]

s = s.replace('si', '*')
print(s)
Problem p03047 (python)

Fixed submission:
N,K = map(int,input().split())
print(N-K+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
print(N-K+1)
Problem p03060 (python)

Fixed submission:
from sys import stdin

N = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(2)]

profit = [0] * N
sum_profit = 0

for i in range(N):
    profit[i] = int(data[0][i]) - int(data[1][i])
    if profit[i] > 0:
        sum_profit += profit[i]

print(sum_profit)

Buggy submission (verdict: Runtime Error):
from sys import stdin

N = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(N)]

profit = [0] * N
sum_profit = 0

for i in range(N):
    profit[i] = int(data[0][i]) - int(data[1][i])
    if profit[i] > 0:
        sum_profit += profit[i]

print(sum_profit)

Buggy submission (verdict: Runtime Error):
from sys import stdin

N = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(N)]

profit = []
sum_profit = 0

for i in N:
    profit[i] = data[0][i] - data[1][i]
    if profit[i] > 0:
        sum_profit += profit[i]

print(sum_profit)

Buggy submission (verdict: Runtime Error):
from sys import stdin

N = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(N)]

profit = []
sum_profit = 0

for i in N:
    profit[i] = data[1][i] - data[2][i]
    if profit[i] > 0:
        sum_profit += profit[i]

print(sum_profit)
Problem p03059 (python)

Fixed submission:
A, B, T = [int(i) for i in input().split()]
b = ((T+0.5) // A) * B
print(int(b))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.array([int(i) for i in input().split()])

# cm = np.prod(A)
# max_gcd = 0
# for i in range(len(A)):
#     Am = A.copy()
#     Am[i] = cm
#     gcd = np.gcd.reduce(Am)
#     if gcd > max_gcd:
#         max_gcd = gcd
print(sum(A))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.array([int(i) for i in input().split()])

cm = np.prod(A)
max_gcd = 0
# for i in range(len(A)):
#     Am = A.copy()
#     Am[i] = cm
#     gcd = np.gcd.reduce(Am)
#     if gcd > max_gcd:
#         max_gcd = gcd
print(max_gcd)
Problem p03079 (python)

Fixed submission:
A, B, C  = [int(a) for a in input().split()]
if A == B == C:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N, Q  = [int(a) for a in input().split()]
s = input()
s_dict = {c:[] for c in set('ABCDEFGHIJKLMNOPQRSTUVWXYZ')}
for i, c in enumerate(s):
    s_dict[c].append(i+1)
g = [1] * (N+2)

for _ in range(Q):
    row = input()
    c, lr = row.split()
    for i in s_dict[c]:
        mover = g[i]
        g[i] -= mover
        if lr == 'L':
            g[i-1] += mover
        else:
            g[i+1] += mover

print(sum(g[1:-1]))
Problem p03106 (python)

Fixed submission:
def get_div(num):
    if num == 1:
        return [1]
    else:
        return [i for i in range(1,num+1) if num%i==0]

A, B, K  = [int(a) for a in input().split()]
cat = get_div(A) + get_div(B)
dup = sorted([x for x in set(cat) if cat.count(x) > 1])
dup.reverse()
print(dup[K-1])

Buggy submission (verdict: Runtime Error):
def get_div(num):
    if num == 1:
        return [1]
    else:
        return [i for i in range(1,num) if num%i==0]

A, B, K  = [int(a) for a in input().split()]
cat = get_div(A) + get_div(B)
dup = [x for x in set(cat) if cat.count(x) > 1]
dup = sorted(dup)
print(dup[K-1])

Buggy submission (verdict: Runtime Error):
def get_div(num):
    if num == 1:
        return [1]
    else:
        return [i for i in range(1,num) if num%i==0]

A, B, K  = [int(a) for a in input().split()]
cat = get_div(A) + get_div(B)
dup = [x for x in set(cat) if cat.count(x) > 1]
dup = sorted(dup)
print(dup[K-1])
Problem p03597 (python)

Fixed submission:
N = int(input())
A = int(input())
print(N**2 - A)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
x = [int(i) for i in input().split()]

ans = 0
for xi in x:
    if xi < K/2:
        ans += xi*2
    else:
        ans += (K-xi)*2
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
x = [int(i) for i in input().split()]

ans = 0
if K == 1:
    print(2*N)
else:
    for xi in x:
        if xi < K//2:
            ans += xi*2
        else:
            ans += (K-xi)*2
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
x = [int(i) for i in input().split()]

ans = 0
for xi in x:
    if xi < K//2:
        ans += xi*2
    else:
        ans += (K-xi)*2
print(ans)
Problem p03047 (python)

Fixed submission:
N,K = map(int,input().split())
print(N - K + 1)

Buggy submission (verdict: Runtime Error):
N = 
K = 
print(N-K+1)
Problem p03061 (python)

Fixed submission:
from fractions import gcd

N = int(input())
A = [int(i) for i in input().split()]

gcd_l = [0]
gcd_r = [0]
for i in range(N):
    gcd_l.append(gcd(gcd_l[i], A[i]))
    gcd_r.append(gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))

Buggy submission (verdict: Runtime Error):
from fractions import gcd

N = int(input())
Num_list = [int(i) for i in input().split()]

odd_list = []
even_list = []

for i in range(N):
    
    if Num_list[i] % 2 == 0:
        even_list.append(Num_list[i])
        
    else:
        odd_list.append(Num_list[i])
        
even_max = max(even_list)
even_min = min(even_list)
odd_max = max(odd_list)
odd_min = min(odd_list)

if len(even_list) < 2:
    even_max = 1
    
elif len(odd_list) < 2:
    odd_max = 1

frac_1 = gcd(even_max,even_min)
frac_2 = gcd(odd_max, odd_min)
frac_3 = gcd(even_max, odd_min)
frac_4 = gcd(odd_max, even_min)

max_frac = max([frac_1, frac_2, frac_3, frac_4])

print(max_frac)
Problem p03047 (python)

Fixed submission:
N,K=map(int, input().split())
x = N - K +1
print(x)

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

x = 0
for i in range(N//R+1):
    k = N - (i*R)
    for j in range(k//G+1):
        l = k - (j*G)
        if l % B == 0:
            x += 1
        else:
            x += 0

print(x)
Problem p03071 (python)

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

if A >= B+2:
    n = 2*A - 1
elif A <= B-2:
    n = 2*B - 1
else:
    n = A+B
    
print(n)

Buggy submission (verdict: Runtime Error):
if A >= B+2:
    n = 2*A - 1
elif A <= B-2:
    n = 2*B - 1
else:
    n = A+B
    
print(n)
Problem p03155 (python)

Fixed submission:
N = int(input())
H = int(input())
W = int(input())
print((N-H+1)*(N-W+1))

Buggy submission (verdict: Runtime Error):
N = int(input())
A,B = map(int,input().split())
P=list(map(int,input().split()))
a = sum(x<=A for x in P)
b = sum(x<=B and x>A for x in P) 
c = sum(x>B for x in P)

print(min(a,b,c))
Problem p03079 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A == B and B == C and C == A:
    print("Yes")
elif A!=B or B!=C or C!=A:
    print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A == B and B == C and C == A:
    print(Yes)
print(No)

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A == B and B == C:
    print(Yes)
elif A!=B or B!=C or C!=A:
    print(No)

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A == B and B == C:
    print(Yes)
else:
    print(No)
Problem p03106 (python)

Fixed submission:
A,B,K=map(int,input().split())
L=[]
for i in range(1,101):
  if A%(i)==0 and B%(i)==0 :
    L.append(i)
L.sort(reverse=True)
print(L[K-1])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
d = []
m = 0
for i in range(1,101):
    if A % i == 0 and B % i == 0:
        d.append(i)
m.sort(reverse=True)
m = d[K-1]
print(m)

Buggy submission (verdict: Runtime Error):
A B K = map(int,input().split())
d = []
m = 0
for i in range(1,101):
    if A % i == 0 and B % i == 0:
        d.append(i)
m.sort(reverse=True)
m = d[K-1]
print(m)

Buggy submission (verdict: Runtime Error):
A B K = map(int,input().split())
d = []
m = 0
for i in range(1,101):
    if A % i == 0 and B % i == 0:
        d.append(i)
m = d[K-1]
print(m)

Buggy submission (verdict: Runtime Error):
A B K = int(input().split())
d = []
m = 0
for i in range(max(A, B)):
    if A % i == 0 and B % i == 0:
        d[i] = d[i].append(i)
m = d[-K]
print(m)
Problem p03633 (python)

Fixed submission:
def gcd(a, b):
  v0 = a
  v1 = b
  v2 = a % b
  while v2 > 0:
    v0 = v1
    v1 = v2
    v2 = v0 %v1
  return v1

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

N = int(input())
tmp = 1
for i in range(N):
  T = int(input())
  ans = lcm(T, tmp)
  tmp = ans
print(int(ans))

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
  if(b == 0):
    return a
  
  return gcd(b, a % b)

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

N = int(input())
T = [int(input()) for i in range(N)]
ans = max(T)

for i in range(N):
  if ans % T[i] != 0:
    ans = lcm(ans, T[i])

print(int(ans))
Problem p03591 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 23 20:49:53 2017

@author: thvinmei
"""

if __name__ == '__main__':
    S=input()
    
    if (S[0:4]=="YAKI"):
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 23 20:49:53 2017

@author: thvinmei
"""

import numpy as np

if __name__ == '__main__':
    answer = False
    N,M,K=map(int,input().split())

    tile = np.zeros((N,M))
    
    if( K > N*M):
        print("No")
        
    for j in range(M):
        for i in range(N):
            tile[i,j] = 1

        if np.sum(tile)==K:
            answer = True
    
        if (np.sum(tile)>K):
            for i in range(N):
                tile[i,j] = 0
            break
    
    for i in range(N):
        for j in range(M):
            if tile[i,j] == 0:
                tile[i,j] = 1
            else:
                tile[i,j] = 0
        
        if np.sum(tile)==K:
            answer = True
            break

    if answer == True:
        print("Yes")
    else:
        print("No")
Problem p03059 (python)

Fixed submission:
A, B, T = map(int, input().split())
# A, B, T = 20, 20, 19


def count_total_biscuit(A, B, T):
    return (T // A) * B


print(count_total_biscuit(A, B, T))

Buggy submission (verdict: Runtime Error):
# import math
import fractions
import numpy as np
from itertools import accumulate, chain, islice, starmap
N = int(input())
numbers = list(map(int, input().split()))
# numbers = [2, 4, 8, 8]
# N = len(numbers)


def calculate_maximum_subgcd_with_np_ufunc(numbers):
    gcd = np.frompyfunc(fractions.gcd, 2, 1)
    cumgcds = gcd.accumulate(numbers, dtype=np.object).astype(np.int)
    sub_cumgcds = np.roll(cumgcds, 1)
    sub_cumgcds[0] = 0
    reverse_cumgcds = gcd.accumulate(
        numbers[::-1], dtype=np.object).astype(np.int)
    sub_reverse_cumgcds = np.roll(reverse_cumgcds, 1)
    sub_reverse_cumgcds[0] = 0
    return np.max(gcd(sub_cumgcds, sub_reverse_cumgcds[::-1]))


def calculate_maximum_subgcd_with_func(numbers):
    operation = fractions.gcd
    cumgcds = accumulate(numbers, operation)
    sub_cumgcds = islice(chain([0], cumgcds), len(numbers))
    reverse_cumgcds = accumulate(numbers[::-1], operation)
    sub_reverse_cumgcds = islice(chain([0], reverse_cumgcds), len(numbers))
    sub_gcds = starmap(operation, zip(sub_cumgcds, list(sub_reverse_cumgcds)[::-1]))
    return max(sub_gcds)


calculate_maximum_subgcd = calculate_maximum_subgcd_with_np_ufunc
# calculate_maximum_subgcd = calculate_maximum_subgcd_with_func

print(calculate_maximum_subgcd(numbers))
Problem p03060 (python)

Fixed submission:
N = map(int, input().split())
values = list(map(int, input().split()))
costs = list(map(int, input().split()))
# N = 3
# values = [10, 2, 5]
# costs = [6, 3, 4]
# N = 4
# values = [13, 21, 6, 19]
# costs = [11, 30, 6, 15]
# N = 1
# values = [1,]
# costs = [50,]


def calculate_maximum_gain(values, costs):
    gain = 0
    for value, cost in zip(values, costs):
        if value - cost > 0:
            gain = gain + value - cost
    
    return gain


print(calculate_maximum_gain(values, costs))

Buggy submission (verdict: Runtime Error):
N = map(int, input().split())
values = [int(input()) for _ in range(N)]
costs = [int(input()) for _ in range(N)]
# N = 3
# values = [10, 2, 5]
# costs = [6, 3, 4]
# N = 4
# values = [13, 21, 6, 19]
# costs = [11, 30, 6, 15]
# N = 1
# values = [1,]
# costs = [50,]


def calculate_maximum_gain(values, costs):
    gain = 0
    for value, cost in zip(values, costs):
        if value - cost > 0:
            gain = gain + value - cost
    
    return gain


print(calculate_maximum_gain(values, costs))
Problem p03353 (python)

Fixed submission:
# -*- coding: utf-8 -*-
s = input()
K = int(input())


def substring(s, K):
    substrings = []
    length = len(s)
    for i in range(length):
        for j in range(1, K+1):
            if i + j > length:
                break
            substrings.append(s[i:i + j])
    unique_substrings = list(set(substrings))
    unique_substrings.sort()
    return unique_substrings[K - 1]


print(substring(s, K))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
s = input()
K = int(input())


def substring(s, K):
    substrings = []
    length = len(s)
    for i in range(length):
        for j in range(K+1):
            if i + j >= length:
                break
            substrings.append(s[i:i + j])
    unique_substrings = list(set(substrings))
    unique_substrings.sort()
    return substrings[K]


print(substring(s, K))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
s = input()
K = int(input())


def substring(s, K):
    substrings = []
    length = len(s)
    for i in range(length):
        for j in range(K+1):
            if i + j >= length:
                break
            substrings.append(s[i:i+j])
    return substrings[K]


print(substring(s, K))
Problem p03363 (python)

Fixed submission:
# -*- coding: utf-8 -*-
from scipy.misc import comb
import collections

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


def countSubZeroRange(numbers):
    Sums = [0]
    for number in numbers:
        Sums.append(Sums[-1] + number)
    zeroSumCounts = 0
    for key, value in collections.Counter(Sums).items():
        zeroSumCounts += comb(value, 2, 1)
    return zeroSumCounts


print(countSubZeroRange(numbers))

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

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


def countSubZeroRange(numbers):
    partialSum = 0
    histogram = {}
    for number in numbers:
        partialSum += number
        histogram[partialSum] += 1
    
    zeroSumCounts = 0
    for column in histogram:
        zeroSumCounts += column - 1
    
    return zeroSumCounts


print(countSubZeroRange(numbers))
Problem p03062 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
new_a = []
sum = 0
minus_count = 0
zero_flag = 0
min_a = 0

for i in range(n):
	new_a.append(abs(a[i]))

for i in range(n):
	if a[i] < 0:
		minus_count += 1
	if a[i] == 0:
		zero_flag = 1

if zero_flag == 1:
	for i in range(n):
		sum += abs(a[i])
elif minus_count % 2 == 0:
	for i in range(n):
		sum += abs(a[i])
else:
	for i in range(n):
		sum += new_a[i]
	sum = sum - min(new_a) * 2

print(sum)

Buggy submission (verdict: Runtime Error):
#1行に1つと
#1行に複数行の読み込み方

n = int(input())
a = list(map(int, input().split()))
sum = 0
minus_count = 0
zero_flag = 0
min_ind = 0

for i in range(n):
	if a[i] < 0:
		minus_count += 1
	if a[i] == 0:
		zero_flag = 1

if zero_flag ==1:
	for i in range(n):
		sum += abs(a[i])
elif minus_count % 2 == 0:
	for i in range(n):
		sum += abs(a[i])
else:
	for i in range(n):
	min_ind = a[a.index(min(a))]
		sum += abs(a[i])
		sum -= abs(a[min_ind])

print(sum)
Problem p03079 (python)

Fixed submission:
l = []
l= list(map(int,input().split()))
a = l[0]
b = l[1]
c = l[2]

if a == b and a == c:
	print("Yes")
else:
  	print("No")

Buggy submission (verdict: Runtime Error):
l = []
l= list(map(int,input().split()))

if a == b and a == c
	print("Yes")
else:
  	print("No")