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

Fixed submission:
q,h,s,d = list(map(int, input().strip().split()))
n = int(input())

h = min(h, q*2)
s = min(s, h*2)
d = min(d, s*2)

d_num, s_num = n//2, n%2
cost = d_num*d + s_num*s
print(cost)

Buggy submission (verdict: Runtime Error):
q,h,s,d = int(input().strip().split())
n = int(input())

h = min(h, q*2)
s = min(s, h*2)
d = min(d, s*2)

d_num, s_num = n//2, n%2
cost = d_num*d + s_num*s
print(cost)
Problem p03834 (python)

Fixed submission:
S = input();
S = S.replace(",", " ");
print(S);

Buggy submission (verdict: Runtime Error):
S = raw_input();
S = S.replace(",", " ");
print(S);
Problem p03307 (python)

Fixed submission:
a = int(input())

if a % 2 == 0:
    print(a)
else:
    print(2*a)

Buggy submission (verdict: Runtime Error):

a = int(input())
ans = 2 * a // math.gcd(2, a)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

a = int(input())

print(2 * a // math.gcd(2, a))

Buggy submission (verdict: Runtime Error):
import math

a = list(map(int, input().split()))
a.append(2)
ans = a[0]
N = len(a)
for i in range(1, N):
    ans = ans * a[i] // math.gcd(ans, a[i])
print(ans)
Problem p03835 (python)

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

cnt = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0 <= z and z <= k:
            cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input()  .split())
candidate = list(range(N+1))
comb = list(itertools.product(candidate, repeat=3))
l = [c for c in comb if sum(c) == K]

print(len(l))
Problem p03307 (python)

Fixed submission:
a = int(input())

if a % 2 == 0:
  print(a)
else:
  print(a * 2)

Buggy submission (verdict: Runtime Error):
a = int(input())
items = input().split(" ")
nums = []
for i in range(a):
  nums.append(int(items[i]))
max_num = max(nums)
min_num = min(nums)
print(max_num - min_num)
Problem p03307 (python)

Fixed submission:
n=int(input())
if n%2==0:
  print(n)
else:
  print(2*n)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n%2=0:
  print(n)
else:
  print(2*n)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n%2=0:
  print(n)
else:
  print(2n)
Problem p03307 (python)

Fixed submission:
N = int(input())

if N % 2 != 0:
    answer = N * 2
    print(answer)
else:
    print(N)

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

if N % 2 != 0:
    answer = N * 2
    print(answer)
else:
    print(N)
Problem p03307 (python)

Fixed submission:
n = int(input())
if n % 2 == 0:
    print(n)
else:
    print(n*2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().rstrip().split(" ")))

t = list(0 for i in range(n+1))
for i in range(1, n+1):
    t[i] = t[i-1] + a[i-1]

def sum_a(i, j):
    return t[j]-t[i]

min_dif = sum_a(0, n)

for i in range(2, n-1):
    j0 = 0
    j1 = i
    u = sum_a(0, i) // 2
    while j1 - j0 > 1:
        j = (j0+j1) // 2
        if 2*sum_a(0, j) <= u: 
            j0 = j
        else:
            j1 = j
    if abs(sum_a(0, j0)-sum_a(j0, i)) < abs(sum_a(0, j1) - sum_a(j1, i)): 
        p = sum_a(0, j0)
        q = sum_a(j0, i)
    else:
        p = sum_a(0, j1)
        q = sum_a(j1, i)

    j0 = i
    j1 = n
    u = sum_a(i, n) // 2
    while j1 - j0 > 1:
        j = (j0+j1) // 2
        if sum_a(i, j) <= u: 
            j0 = j
        else:
            j1 = j
    if abs(sum_a(i, j0)-sum_a(j0, n)) < abs(sum_a(i, j1) - sum_a(j1, n)): 
        r = sum_a(i, j0)
        s = sum_a(j0, n)
    else:
        r = sum_a(i, j1)
        s = sum_a(j1, n)

    min_dif = min(min_dif, max(p, q, r, s)-min(p, q, r, s))

print(min_dif)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().rstrip().split(" ")))

sm = 0
for i in range(0, n):
    sm = sm + a[i]

min_dif = sm

p = 0
for i in range(n-3):
    p = p + a[i]
    if 4*p < sm:
        next
    q = 0
    for j in range(i+1, n-2):
        q = q + a[j]
        if 3*q < sm - p:
            next
        r = 0
        for k in range(j+1, n-1):
            r = r + a[k]
            if 2*r < sm - p - q:
                next
            s = 0
            for l in range(k+1, n):
                s = s + a[l]
            d = max([p, q, r, s])-min([p, q, r, s])
            min_dif = min([d, min_dif])

p = 0
for i in range(n-3):
    p = p + a[i]
    if 4*p <= sm - 3*min_dif or 4*p >= sm + 3*min_dif:
        next
    q = 0
    for j in range(i+1, n-2):
        q = q + a[j]
        if abs(p-q) >= min_dif or 4*q <= sm - 3*min_dif or 4*q >= sm + 3*min_dif:
            next
        r = 0
        for k in range(j+1, n-1):
            r = r + a[k]
            if abs(p-r) >= min_dif or abs(q-r) >= min_dif or 4*r <= sm - 3*min_dif or 4*r >= sm + 3*min_dif:
                next
            s = 0
            for l in range(k+1, n):
                s = s + a[l]
            d = max([p, q, r, s])-min([p, q, r, s])
            min_dif = min([d, min_dif])

print(min_dif)
Problem p03307 (python)

Fixed submission:
import math
n = int(input())
print([n, 2*n][n % 2 > 0])

Buggy submission (verdict: Runtime Error):
import math

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

print(lcm(int(input())))

Buggy submission (verdict: Runtime Error):
import math

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

print(lcm(int(input())))
Problem p03307 (python)

Fixed submission:
a=int(input())
b=int(a/2)
if b*2==a:
  print(a)
else:
  print(a*2)

Buggy submission (verdict: Runtime Error):
a=input()
b=a/2

Buggy submission (verdict: Runtime Error):
a=input()
b=int(a/2)

Buggy submission (verdict: Runtime Error):
N=input()
n=int(N/2)
if N==n*2:
  print(N)
else:
  print(N*2)

Buggy submission (verdict: Runtime Error):
a=input()
if a=0:
  print(a)
else:
  print(a*2)

Buggy submission (verdict: Runtime Error):
a=input()
if int(a/2)*2==a:
  print(a)
#else:
  #print(a*2)

Buggy submission (verdict: Runtime Error):
a=input()
if int(a/2)*2==a:
  print(a)
else:
  print(a*2)

Buggy submission (verdict: Runtime Error):
a=input()
if int(a/2)*2==a:
  print(a)
else:
  print(a*2)
Problem p03307 (python)

Fixed submission:
# -*- coding: utf-8 -*-
 
N=int(input())
ans=0
if N%2==0:
   ans=N
else:
   ans=N*2
 
print(ans)

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

N=int(input())
ans=0
if(N%2==0)
   ans=N
else
   ans=N*2

print(ans)
Problem p03315 (python)

Fixed submission:
S = list(str(input()))
result = 0
for s in S:
    if s == '+':
        result += 1
    else:
        result -= 1
print(result)

Buggy submission (verdict: Runtime Error):

S = list(input())
result = 0
for s in S:
    if s == ‘+’:
        result += 1
    else:
        result -= 1
print(result)
Problem p03307 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
    print(N)
else:
    print(N * 2)

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

N = int(input())
tmp = input().split(' ')

A = []
for i in range(N):
    A.append(int(tmp[i]))

A = np.asarray(A)

z = np.asarray([x for x in range(N)])
A = A - z

b_ceil = np.ceil(np.median(A)).astype(np.int32)
b_floor = np.floor(np.median(A)).astype(np.int32)

A_ceil = A - b_ceil
A_ceil = np.absolute(A_ceil)
A_floor = A - b_floor
A_floor = np.absolute(A_floor)

#pdb.set_trace()
print(np.min((A_ceil.sum(), A_floor.sum())).astype(np.uint32))

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

N = int(input())
tmp = input().split(' ')

A = []
for i in range(N):
    A.append(int(tmp[i]))

A = np.asarray(A)

z = np.asarray([x for x in range(N)])
A = A - z

b = np.median(A)
A = A - b
A = np.abs(A)
print(A.sum().astype(np.uint8))

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

N = int(input())
tmp = input().split(' ')

A = []
for i in range(N):
    A.append(int(tmp[i]))

A = np.asarray(A)
print(A.max() - A.min())

Buggy submission (verdict: Runtime Error):
N = input()
if N % 2 == 0:
    print(N)
else:
    print(N * 2)
Problem p03315 (python)

Fixed submission:
num = 0
s = input()
for op in s:
  if op == '+':
    num += 1
  else:
    num -= 1
print(num)

Buggy submission (verdict: Runtime Error):
N = input()
s = 0
for n in N:
  s += int(n)
res = int(N) % s
if res == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
sum = 0
for n in N:
  sum += int(n)
res = int(N) % sum
if res == 0:
  print("Yes")
else:
  print("No")
Problem p03775 (python)

Fixed submission:
import math

N = int(input())
min_f = 10
for n in range(1, int(math.sqrt(N)) + 1):
    a = n
    if N % n != 0:
        continue
    b = int(N / n)
    f = max(len(str(a)), len(str(b)))
    min_f = min(min_f, f)
print(min_f)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
min_f = 10
for n in range(1, math.sqrt(N)):
    a = n
    if N % n != 0:
        continue
    b = N / n
    f = max(len(str(a)), len(str(b)))
    min_f = min(min_f, f)
print(min_f)
Problem p03631 (python)

Fixed submission:
str=input()
if str[0]==str[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
d=input()
fast=max(int(a),int(c))
last=min(int(b),int(d))
print max(0,int(last-fast))

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
d=input()
if a<c:
    fast=c
else:
    fast=a
if b<d:
    last=b
else:
    last=d

if b<c:
    print("0")
else:
    print(last-fast)
Problem p03307 (python)

Fixed submission:
n = int(input())
if n % 2 == 0:
    print(n)
else:
    print(n*2)

Buggy submission (verdict: Runtime Error):
n = input()
if n % 2 == 0:
    print(n)
else:
    print(n*2)
Problem p03307 (python)

Fixed submission:
n = int(input())
if n%2 == 0:
  print(n)
else :
  print(n*2)

Buggy submission (verdict: Runtime Error):
n = int(input())
n_list = list(map(int,input().split()))
n_list.sort()
print(n_list[-1] - n_list[0])

Buggy submission (verdict: Runtime Error):
n = input()
if n%2 == 0:
  print(n)
else :
  print(n*2)
Problem p03315 (python)

Fixed submission:
n = str(input())
num = []
from functools import reduce
num = [str(x) for x in list(str(n))]
x = 0
for i in num:
  if i == "+":
    x = x + 1
  else:
    x = x - 1
print(x)

Buggy submission (verdict: Runtime Error):
n = str(input())
num = []
from functools import reduce
num = [str(x) for x in list(str(n))]
x = o
for i in num:
  if i == "+":
    x = x + 1
  else:
    x = x - 1
print(x)
Problem p03307 (python)

Fixed submission:
# -*- coding: utf-8 -*-
def gcd(x, y):
    while x % y:
        x, y = y, x % y
    return y

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

# 整数の入力
n = int(input())
print(lcm(2, n))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 桁数の入力
a = int(input())
# スペース区切りの整数の入力
b = input().split()
b.sort()
min = b[0]
b.reverse()
max = b[0]
print(int(max)-int(min))
Problem p03315 (python)

Fixed submission:
str=input()
list=list(str)
a=0
for i in range(4):
	if list[i]=="+":
		a=a+1
	else:
		a=a-1
print(a)

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

if n==k:
	print(1)
elif n//(k-1)=1:
	print(2)
else:
	print(n//(k-1))

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

print(n//(k-1))
Problem p03317 (python)

Fixed submission:
import math
N, K = map(int, input().split())
nums = input()
print(math.ceil((N - 1) / (K - 1)))

Buggy submission (verdict: Runtime Error):
from math import ceil
N, K = map(int, input().split)
nums = list(map(int, input().split))
index = nums.index(1)
print(ceil(index / (K - 1)) + ceil((N - index - 1) / (K - 1)))
Problem p03327 (python)

Fixed submission:
N = int(input())

if N <= 999:
	print('ABC')

if N > 999:
	print('ABD')

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

sa = b - a
east = (1 + sa) * sa / 2
snow = int(east - b)
print(snow)
Problem p03327 (python)

Fixed submission:
word = input()
number = int(word)
if number <= 999:
  print("ABC")
if number > 999:
  print("ABD")

Buggy submission (verdict: Runtime Error):
word = input()
number = int(word)
if number <= 999:
  print(ABC)
if number > 999:
  print(ABD)
Problem p03307 (python)

Fixed submission:
N = int(input())
if N%2 == 0:
    ans = N
else:
    ans = N*2
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
from statistics import median
N = int(input())
A = list(map(lambda x:int(x),input().split(" ")))
npA = np.array(A)
B = npA-(1+np.arange(len(npA)))
opt_b = median(B)
print(int(np.sum(np.abs(B-opt_b))))
Problem p03307 (python)

Fixed submission:
#! /usr/bin/env python
# coding: UTF-8

def gcd(m, n):
    if n == 0:
        return m
    else:
        return gcd(n, m%n)

def main():
    n = int(input())

    print(int(n*2/gcd(n,2)))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python
# coding: UTF-8


def sad(list, b):
    value = 0
    n = 1
    for a in list:
        value += abs(a - (b+n))
        n += 1
    return value


def main():
    mn = 1000000
    n = (int)(input())
    lst = list(int(i) for i in input().split())
    mx = max(lst)
    for i in range(mx):
        if(sad(lst, i) < mn):
            mn = sad(lst, i)
    print(mn)

if __name__ == '__main__':
    main()
Problem p03307 (python)

Fixed submission:
N=int(input())

if N%2==0:
  print(N)
else:
  print(N*2)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
print(abs(max(a)-min(a)))

Buggy submission (verdict: Runtime Error):
N=int(input())
lst=input().split()
lst_i=[int(i) for i in lst]
a=max(lst_i)
b=min(lst_i)
print(abs(a-b))
Problem p03327 (python)

Fixed submission:
N = int(input())
if N >= 1000:
    print('ABD')
else:
    print('ABC')

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

if N < 1000:
    print('ABC'+str(N)
else:
    print('ABD'+str(N-1000))
Problem p03307 (python)

Fixed submission:
n = int(input())

if(n % 2 == 0):
    print(n)
else:
    print(n*2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(_) for _ in input().split()]

sub_num = [0]*(2*10**6)

for i in range(1, n+1):
#    print(abs(int(a[i-1]-i)))
    sub_num[abs(int(a[i-1]-i))] += 1

b = -sub_num.index(max(sub_num))
#print(b)

result = 0
for i in range(1, n+1):
    result += abs(a[i-1] - (b + i))

print(result)
Problem p03307 (python)

Fixed submission:
import numpy as np
N=int(input())
def gcd(a,b):
    c=int(np.floor(a/b))
    return a-b*c
if gcd(N,2)==0:
    print(N)
else:
    print(2*N)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
def gcd(N,2):
  c=int(np.floor(N%2))
  return N-2*c
if gcd(N,2)==0:
  print(N)
else:
  print(2*N)
Problem p03315 (python)

Fixed submission:
num = 0
S = input()
S_list = list(S)
for i, S_list in enumerate(list(S)):
    if S_list == '+':
        num = num + 1
    else:
        num = num - 1
print(num)

Buggy submission (verdict: Runtime Error):
# http://interaction.hatenadiary.jp/entry/2018/03/25/124153
N = input()

sumN = sum(list(map(int,list(N))))

# print(N)
# print(sumN)
if int(N) % sumN == 0:
    print('Yes')
else:
    print('No')
Problem p03307 (python)

Fixed submission:

def gcd(a, b):
    """Calculate the Greatest Common Divisor of a and b.

    Unless b==0, the result will have the same sign as b (so that when
    b is divided by it, the result comes out positive).
    """
    while b:
        a, b = b, a%b
    return a



n = int(input())

print((2*n)//gcd(2,n))

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

print((2*n)//math.gcd(2,n))
Problem p03327 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
c = int(b - a)
d =int( c * (c - 1) // 2 + c  -b)
print(d)
Problem p03327 (python)

Fixed submission:
#!/usr/bin/env python

N = int(input())

print "ABD" if N >= 1000 else "ABC"

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python

N = int(input())

print "ABD" if N >= 1000 else "ABC"
Problem p03803 (python)

Fixed submission:
import sys
 
for line in sys.stdin:
    card = line.split(" ")
    alice = int(card[0])
    bob = int(card[1])
    if alice == 1:
        alice += 13
    if bob == 1:
        bob += 13
        
    if alice > bob:
        print("Alice")
    elif alice < bob:
        print("Bob")
    else:
        print("Draw")

Buggy submission (verdict: Runtime Error):
for line in sys.stdin:
    card = line.split(" ")
    alice = int(card[0])
    bob = int(card[1])
    if alice == 1:
        alice += 13
    if bob == 1:
        bob += 13
        
    if alice > bob:
        print("Alice")
    elif alice < bob:
        print("Bob")
    else:
        print("Draw")

Buggy submission (verdict: Runtime Error):
!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
 import sys
 
 for line in sys.stdin:
     card = line.split(" ")
 
     if card[0] > card[1]:
        print("Alice")
    elif card[0] < card[1]:
        print("Bob")
    else:
        print("Draw")
Problem p03804 (python)

Fixed submission:
import sys

count = 0
N_list = []
M_list = []
for line in sys.stdin:
    line = line.rstrip("\n")
    if count == 0:
        line = line.split(" ")
        N = int(line[0])
        M = int(line[1])
    elif count <= N:
        N_list.append(line)
    else:
        M_list.append(line)
    count+=1
    
    
def judge_match(N_l, M_l):
    slide_count = len(N_l[0]) - len(M_l[0]) + 1
    count = 0
    for j in range(slide_count):
        count = 0
        for i in range(len(N_l)):
            if N_l[i][j:j+len(M_l[0])] == M_l[i]:
                count += 1
                if count == len(M_l):
                    return count
    return count

m_count = 0
for i in range(len(N_list)):
    m_count = judge_match(N_list[i:i+len(M_list)], M_list)
    if m_count == len(M_list):
        print("Yes")
        exit(0)
print("No")

Buggy submission (verdict: Runtime Error):
#include <string>
#include <iostream>

using namespace std;

const int nmax = 50;
const int mmax = 50;
char N_sq[nmax][nmax], M_sq[mmax][mmax];


bool judge_match(int x, int y, int M){
	for(int i=0;i<M;i++){
		for(int j=0;j<M;j++){
			if(N_sq[y+i][x+j] != M_sq[y+i][x+j]) return false;
		}
	}
	return true;
}


int main(void){
	int N,M;

	cin >> N >> M;
	bool exist = false;

	for(int y=0;y < N;y++){
		for(int x;x < N;x++){
			cin >> N_sq[y][x];
		}
	}

	for(int y=0;y < M;y++){
		for(int x;x < M;x++){
			cin >> M_sq[y][x];
		}
	}

	for(int y=0;y <= N - M;y++){
		for(int x=0;x <= N - M;x++){
			if(judge_match(x, y, M)) exist=true;
		}
	}

	if(exist)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;

}
Problem p03835 (python)

Fixed submission:
k,s = map(int,input().split())
f = 0
for i in range(k+1):
    for j in range(k+1):
        l = s-i-j
        if 0 <= l <=k:
            f+=1
print(f)

Buggy submission (verdict: Runtime Error):
k,s = map(int,input().split())
f = 0
for i in range(k):
    for j in range(k):
        for l in range(k):
            if sum(i,j,l)==s:
                f+=1
print(f)

Buggy submission (verdict: Runtime Error):
k,s = map(int,input().split())
f = 0
for i in range(k):
    for j in range(k):
        for l in range(k):
            if sum(i,j,k)==s:
                f+=1
print(f)
Problem p03315 (python)

Fixed submission:
S = list(input())

ans =0
for i in S:
    if i == "+" : ans += 1
    else: ans -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
NB = list(N)
NN = int(N)

SN = 0
for i in N:
    SN += int(i)

if NB%SN == 0:
    print("Yes")
else:
    print("No")
Problem p03835 (python)

Fixed submission:
ans = 0
k, s = map(int, input().split())
for x in range(k+1):
  for y in range(k+1):
    z = s - x - y
    if 0 <= z and z <= k:
      ans += 1
 
 
 
print(ans)

Buggy submission (verdict: Runtime Error):
ans = 0
k, s = map(int, input().split())
for x in range(k):
  for y in range(k):
    int z = s - x - y
    if 0 <= z and z <= k:
      ans += 1



print(ans)

Buggy submission (verdict: Runtime Error):
def comb(n, r):
  if r == 0  or n == r: return 1
  else: return comb(n-1, r) + comb(n-1, r-1)
 
k, s = map(int, input().split())
if s <= k: print(comb(s+2, 2))
elif s <= 2*k: print(3*comb(s-k+2, 2))
else: print(3*comb(s-2*k+2,2))

Buggy submission (verdict: Runtime Error):
def comb(n, r):
  if r == 0  or n == r: return 1
  else: return comb(n-1, r) + comb(n-1, r-1)
 
k, s = map(int, input().split())
if s <= k: print(comb(s+2, 2))
elif s <= 2*k: print(3*comb(s-k+2, 2))
else: print(3*comb(s-2k+2,2))

Buggy submission (verdict: Runtime Error):
def comb(n, r):
  if r == 0  or n == r: return 1
  else: return comb(n-1, r) + comb(n-1, r-1)
 
k, s = map(int, input().split())
if s < k: print(comb(s+2, 2))
elif s < 2*k: print(3*comb(s-k+2, 2))
else: print(3*comb(s-2k+2,2))

Buggy submission (verdict: Runtime Error):
def comb(n, r):
  if r == 0  or n == r: return 1
  else: return comb(n-1, r) + comb(n-1, r-1)

k, s = map(int, input().split())
if s < k: print(comb(s+2, 2))
elif s < 2k: print(3*comb(s-k+2, 2))
else: print(3*comb(s-2k+2,2))

Buggy submission (verdict: Runtime Error):
def comb(n, r):
  if r == 0  or n == r: return 1
  else: return comb(n-1, r) + comb(n-1, r-1)

k, s = map(int, input().split())
print(comb(s-3k+2, 2))

Buggy submission (verdict: Runtime Error):
def comb(n, r):
  if r == 0  or n == r: return 1
  else: return comb(n-1, r) + comb(n-1, r-1)
 
k, s = map(int, input().split())
print(comb(s-3k+2, 2))

Buggy submission (verdict: Runtime Error):
def comb(n, r):
  if r == 0  or n == k: return 1
  else: return comb(n-1, r) + comb(n-1, r-1)
 
k, s = map(int, input().split())
print(comb(s-3k+2, 2))

Buggy submission (verdict: Runtime Error):
def comb(n, k):
  if k == 0  or n == k: return 1
  else: return comb(n-1, k) + comb(n-1, k-1)

k, s = map(int, input().split())
print(comb(n-3k+2, 2))
Problem p03315 (python)

Fixed submission:
x=input()
c=0
for i in range(len(x)):
  if x[i]=='-':
  	c-=1
  else:
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
x=input()
c=0
for i in range(len(x)):
  c+=ord(x[i])-ord('0')
x=int(x)
if x%c==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x=input()
c=0
for i in range(len(x)):
  if x[i]=='-'
  	c-=1
  else:
    c+=1
print(c)
Problem p03326 (python)

Fixed submission:
import numpy as np
m,n=map(int,input().split())
x=[]
for i in range(m):
  a=list(map(int,input().split()))
  x.append(a)
y=[]
for i in range(m):
  z=[0,0,0,0,0,0,0,0]
  z[0]=x[i][0]+x[i][1]+x[i][2]
  z[1]=x[i][0]+x[i][1]-x[i][2]
  z[2]=x[i][0]-x[i][1]+x[i][2]
  z[3]=x[i][0]-x[i][1]-x[i][2]
  z[4]=-x[i][0]+x[i][1]+x[i][2]
  z[5]=-x[i][0]+x[i][1]-x[i][2]
  z[6]=-x[i][0]-x[i][1]+x[i][2]
  z[7]=-x[i][0]-x[i][1]-x[i][2]
  y.append(z)
p=np.array(y)
sidx = p.argsort(axis=0)
p=p[sidx, np.arange(sidx.shape[1])]
z=[0,0,0,0,0,0,0,0]
for i in range(m-1,m-n-1,-1):
  for j in range(8):
  	z[j]+=p[i][j]
print(max(z))

Buggy submission (verdict: Runtime Error):
m,n=map(int,input().split())
x=[]
for i in range(m):
  a=list(map(int,input().split()))
  x.append(a)
y=[]
for i in range(m):
  z=[0,0,0,0,0,0,0,0]
  z[0]=x[i][0]+x[i][1]+x[i][2]
  z[1]=x[i][0]+x[i][1]-x[i][2]
  z[2]=x[i][0]-x[i][1]+x[i][2]
  z[3]=x[i][0]-x[i][1]-x[i][2]
  z[4]=-x[i][0]+x[i][1]+x[i][2]
  z[5]=-x[i][0]+x[i][1]-x[i][2]
  z[6]=-x[i][0]-x[i][1]+x[i][2]
  z[7]=-x[i][0]-x[i][1]-x[i][2]
  y.append(z)
sort(y,axis=0)
z=[0,0,0,0,0,0,0,0]
for i in range(m-1,m-n-1):
  for j in range(8):
  	z[j]+=y[i][j]
sort(z)
print(z[7])

Buggy submission (verdict: Runtime Error):
m,n=map(int,input().split())
x=[]
for i in range(m):
  a=list(map(int,input().split()))
  x.append(a)
y=[]
for i in range(m):
  z=[0,0,0,0,0,0,0,0]
  z[0]=x[i][0]+x[i][1]+x[i][2]
  z[1]=x[i][0]+x[i][1]-x[i][2]
  z[2]=x[i][0]-x[i][1]+x[i][2]
  z[3]=x[i][0]-x[i][1]-x[i][2]
  z[4]=-x[i][0]+x[i][1]+x[i][2]
  z[5]=-x[i][0]+x[i][1]-x[i][2]
  z[6]=-x[i][0]-x[i][1]+x[i][2]
  z[7]=-x[i][0]-x[i][1]-x[i][2]
  y.append(z)
sort(y,axis=0)
z=[0,0,0,0,0,0,0,0]
for i in range(m-1,m-n-1):
  z+=y[i]
sort(z)
print(z[7])