qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())

G = [[] for i in range(N + 1)]
for i in range(1, N + 1):
    for j in range(i, N + 1):
        if N % 2 == 1:
            if i + j != N and i != j:
                G[i].append(j)
        else:
            if i + j != N + 1 and i != j:
                G[i].append(j)
                
for i in range(1, N + 1):
    for g in G[i]:
        print(i, g)

Fixed code:
N = int(input())

cnt = 0
G = [[] for i in range(N + 1)]
for i in range(1, N + 1):
    for j in range(i, N + 1):
        if N % 2 == 1:
            if i + j != N and i != j:
                G[i].append(j)
                cnt += 1
        else:
            if i + j != N + 1 and i != j:
                G[i].append(j)
                cnt += 1

print(cnt)

for i in range(1, N + 1):
    for g in G[i]:
        print(i, g)
Buggy code:
N = int(input())
ans = []
for i in range(1,N):   
    for j in range(i+1,N+1):
        if i+j != (N//2)*2 + 1
            ans.append([i,j])
            
print(len(ans))
for a,b in ans:
    print(a,b)


Fixed code:
N = int(input())
ans = []
for i in range(1,N):
    for j in range(i+1,N+1):
        if i+j!=(N//2)*2+1:       
            ans.append([i,j])

print(len(ans))
for a,b in ans:
    print(a,b)
Buggy code:
N = int(input())
ans = []
M = n + 1 * (N % 2 == 0)
for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        if i + j == M:
            continue
        ans.append('{} {}'.format(i, j))
print(len(ans))
print('\n'.join(ans))

Fixed code:
N = int(input())
ans = []
M = N + 1 * (N % 2 == 0)
for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        if i + j == M:
            continue
        ans.append('{} {}'.format(i, j))
print(len(ans))
print('\n'.join(ans))
Buggy code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    E = []
    
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            if N % 2 == 0 and i+j == N+1:
                continue
            if N % 2 == 1 and i+j == N:
                continue
            E.append((i, j))

    return E


def main():
    N = read_int()
    for e in slv(N):
        print('%d %d' % e)


if __name__ == '__main__':
    main()


Fixed code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    E = []
    
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            if N % 2 == 0 and i+j == N+1:
                continue
            if N % 2 == 1 and i+j == N:
                continue
            E.append((i, j))

    return E


def main():
    N = read_int()
    E = slv(N)
    print(len(E))
    for e in E:
        print('%d %d' % e)


if __name__ == '__main__':
    main()
Buggy code:
import sys
N = int(sys.stdin.readline())

ans = ["%d\n" % (N*(N-1)//2 - N//2)]
K = N+(N&1)^1
for i in range(1, N+1):
    for j in range(i+1, N+1):
        if i + j != K:
            ans.append("%d %d\n" % (i, j))
sys.stdout.writelines(ans)

Fixed code:
import sys
N = int(sys.stdin.readline())

ans = ["%d\n" % (N*(N-1)//2 - N//2)]
K = N+((N&1)^1)
for i in range(1, N+1):
    for j in range(i+1, N+1):
        if i + j != K:
            ans.append("%d %d\n" % (i, j))
sys.stdout.writelines(ans)
Buggy code:
N = int(input())
S = 0
for i in range(1, N):
    S += i

Ans = []

if N % 2 == 1:
    Ans.append((i, N) for i in range(1, N))
    for i in range(1, N):
        for j in range(i, N):
            if j != N-i:
                Ans.append((i, j))


print(len(Ans))
for a in Ans:
    print(" ".join(map(str, a)))



Fixed code:
N = int(input())
S = 0
for i in range(1, N):
    S += i

Ans = []

if N % 2 == 1:
    for i in range(1, N):
        Ans.append((i, N))
    for i in range(1, N):
        for j in range(i+1, N):
            if j != N-i:
                Ans.append((i, j))
else:
    for i in range(1, N):
        for j in range(i+1, N+1):
            if j != N - i + 1:
                Ans.append((i, j))


print(len(Ans))
for a in Ans:
    print(" ".join(map(str, a)))
Buggy code:
n= int(input())
s = n + (0 if n%2 == 1 else 1)
ans = []
for i in range(n-1):
  for j in range(i+1,n):
    if i+j+2 != s:
      ans.append(str(i+1)+" "+str(j+1))
for t in ans:
  print(t)

Fixed code:
n= int(input())
s = n + (0 if n%2 == 1 else 1)
ans = []
for i in range(n-1):
  for j in range(i+1,n):
    if i+j+2 != s:
      ans.append(str(i+1)+" "+str(j+1))
print(len(ans))
for t in ans:
  print(t)
Buggy code:
n = int(input())

if n%2==0:
    lis=[[i,n+1-i] for i in range(1,int(n/2)+1)]
else:
    lis=[[i,n-i] for i in range(1,int((n-1)/2)+1)] + [[n]]

connect_lis=[]

for i in lis:
    for j in i:
        for k in lis:
            if k!=i:
                for p in k:
                    if j < p:
                        connect_lis.append([j,p])
        

for i in connect_lis:
    print(i[0],'',i[1])

Fixed code:
n = int(input())

if n%2==0:
    lis=[[i,n+1-i] for i in range(1,int(n/2)+1)]
else:
    lis=[[i,n-i] for i in range(1,int((n-1)/2)+1)] + [[n]]

connect_lis=[]

for i in lis:
    for j in i:
        for k in lis:
            if k!=i:
                for p in k:
                    if j < p:
                        connect_lis.append([j,p])
        
print(len(connect_lis))
for i in connect_lis:
    print(i[0],i[1])
Buggy code:
#AGC031-B
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n=I()
if n%2==0:
    for i in range(n):
        for j in range(n):
            if i<j and i+j+2!=1+n:
                print(i+1,j+1)
else:
    print(-1)

Fixed code:
#AGC031-B
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n=I()
if n%2==0:
    print(n*(n-2)//2)
    for i in range(n):
        for j in range(n):
            if i<j and i+j+2!=1+n:
                print(i+1,j+1)
else:
    print((n-1)*(n-3)//2+n-1)
    for i in range(n-1):
        for j in range(n-1):
            if i<j and i+j+2!=1+n-1:
                print(i+1,j+1)
    for i in range(n-1):
        print(i+1,n)
Buggy code:
n=int(input())
if n%2==0:
    s=n+1
    res=[]
    for i in range(1,n//2+1):
        res.append([i,s-i])
    #print(res)
    for i in range(len(res)-1):
        for j in range(i+1,len(res)):
            for x in range(2):
                for y in range(2):
                    print(min(res[i][x],res[j][y]),max(res[i][x],res[j][y]))
else:
    s=n
    res=[]
    for i in range(1,n//2+1):
        res.append([i,s-i])
    #print(res)
    for i in range(len(res)-1):
        for j in range(i+1,len(res)):
            for x in range(2):
                for y in range(2):
                    print(min(res[i][x],res[j][y]),max(res[i][x],res[j][y]))
    for i in range(1,n):
        print(i,n)

Fixed code:
n=int(input())
if n%2==0:
    s=n+1
    res=[]
    for i in range(1,n//2+1):
        res.append([i,s-i])
    z=[]
    for i in range(len(res)-1):
        for j in range(i+1,len(res)):
            for x in range(2):
                for y in range(2):
                    z.append([min(res[i][x],res[j][y]),max(res[i][x],res[j][y])])
    print(len(z))
    for t in z:
        print(t[0],t[1])
else:
    s=n
    res=[]
    for i in range(1,n//2+1):
        res.append([i,s-i])
    z=[]
    for i in range(len(res)-1):
        for j in range(i+1,len(res)):
            for x in range(2):
                for y in range(2):
                    z.append([min(res[i][x],res[j][y]),max(res[i][x],res[j][y])])
    for i in range(1,n):
        z.append([i,n])
    print(len(z))
    for t in z:
        print(t[0],t[1])
Buggy code:
n=int(input())
a=[]
m=n if n&1 else n+1
i=1
while(i<=n):
    j=i+1
    while(j<=n):
        if j!=m-i:
            a+=[(i,j)]
        j+=1
    i+=1

for x in a:
    print(*x)

Fixed code:
n=int(input())
a=[]
m=n if n&1 else n+1
i=1
while(i<=n):
    j=i+1
    while(j<=n):
        if j!=m-i:
            a+=[(i,j)]
        j+=1
    i+=1
print(len(a))
for x in a:
    print(*x)
Buggy code:
import sys
input = sys.stdin.readline

N=int(input())

EDGE=[[1]*(N+1) for i in range(N+1)]
for i in range(N+1):
    EDGE[i][i]=0
    EDGE[0][i]=EDGE[i][0]=0

SUM=[N*(N+1)//2]
for i in range(N):
    SUM.append(SUM[-1]-1)

SUM[0]=0

if N%2==0:
    ANSSUM=N*(N+1)//2-1-N
else:
    ANSSUM=N*(N+1)//2-1-(N-1)

#print(ANSSUM)

for i in range(1,N+1):
    x=SUM[i]-ANSSUM
    EDGE[i][x]=EDGE[x][i]=0

for i in range(1,N+1):
    for j in range(1,N+1):
        if EDGE[i][j]==1:
            print(i,j)
            EDGE[i][j]=EDGE[j][i]=0
    


Fixed code:
import sys
input = sys.stdin.readline

N=int(input())

EDGE=[[1]*(N+1) for i in range(N+1)]
for i in range(N+1):
    EDGE[i][i]=0
    EDGE[0][i]=EDGE[i][0]=0

SUM=[N*(N+1)//2]
for i in range(N):
    SUM.append(SUM[-1]-1)

SUM[0]=0

if N%2==0:
    ANSSUM=N*(N+1)//2-1-N
else:
    ANSSUM=N*(N+1)//2-1-(N-1)

#print(ANSSUM)

for i in range(1,N+1):
    x=SUM[i]-ANSSUM
    EDGE[i][x]=EDGE[x][i]=0

ANS=[]
ANSCOUNT=0
for i in range(1,N+1):
    for j in range(1,N+1):
        if EDGE[i][j]==1:
            ANS.append([i,j])
            ANSCOUNT+=1
            EDGE[i][j]=EDGE[j][i]=0

print(ANSCOUNT)
for ans in ANS:
    print(*ans)
Buggy code:
#import collections as c
#ip = lambda : map(int, input().split())

#################
N = int(input())
S = N*(N+1)/2
a = []
b = []

f = 1
for i in range(N,0,-1):
    if f%4==1 or f%4==0:
        a.append(i)
        f += 1
    else:
        b.append(i)
        f += 1
print(len(a)*len(b))
for ia in a:
    for ib in b:
        print(ia,ib)

Fixed code:
#import collections as c
#ip = lambda : map(int, input().split())

#################
N = int(input())
if N%2==0:
    print(N*(N-1)//2-N//2)
    S = N + 1
    for i in range(1,N):
        for j in range(i+1,N+1):
            if i!=j and i+j!=S:
                print(i,j)

elif N%2==1:
    print(N*(N-1)//2-(N-1)//2)
    S = N
    for i in range(1,N):
        for j in range(i+1,N+1):
            if i!=j and i+j!=S:
                print(i,j)

# a = []
# b = []



# f = 1
# for i in range(N,0,-1):
#     if f%4==1 or f%4==0:
#         a.append(i)
#         f += 1
#     else:
#         b.append(i)
#         f += 1
# print(len(a)*len(b))
# for ia in a:
#     for ib in b:
#         print(ia,ib)
Buggy code:
n = int(input())

if n % 2 == 0:
  print(n*(n-2)//2)
  for i in range(n):
    for j in range(i+1,n+1):
      if i + j != n:
        print(i,j)
else:
  print(n*(n-2)//2 + 1)
  for i in range(n):
    for j in range(i+1,n+1):
      if i + j != n + 1:
        print(i,j)

Fixed code:
n=int(input())
if n==3:
    print(2)
    print(1,3)
    print(2,3)
elif n%2==0:
    print(n*(n-2)//2)
    for i in range(1,n):
        for j in range(i+1,n+1):
            if i+j!=1+n:
                print(i,j)
else:
    print((n-1)*(n-3)//2+n-1)
    for i in range(n-1):
        print(i+1,n)
    n-=1
    for i in range(1,n):
        for j in range(i+1,n+1):
            if i+j!=1+n:
                print(i,j)
Buggy code:
n = int(input())
if n%2 ==0:
  print(n*(n+1)//2-n-1)
else:
  print((n-1)*n//2)

if n%2 ==1:
  for i in range(n-1):
    print(i+1,n)
  n = n-1

if n%2 ==0:
  wa = n+1
  for i in range(n):
    for j in range(i+1,n):
      if wa != i+j+2:
        print(i+1,j+1)

Fixed code:
n = int(input())
if n%2 == 0:
    print(n*(n-1)//2 - n//2)
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            if i + j != n+1:
                print(i,j)
else:
    print(n*(n-1)//2 - (n-1)//2)
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            if i + j != n:
                print(i,j)
Buggy code:
n=int(input())
a=[]
for i in range(n-1):
    for j in range(i+1,n):
        a.append([i+1,j+1])
for i in a:
    if n%2==1:
        if sum(i)!=n:
            print(i[0],i[1])
    else:
        if sum(i)!=n+1:
            print(i[0],i[1])

Fixed code:
n=int(input())
a=[]
for i in range(n-1):
    for j in range(i+1,n):
        a.append([i+1,j+1])
print((n*(n-1)//2)-n//2)
for i in a:
    if n%2==1:
        if sum(i)!=n:
            print(i[0],i[1])
    else:
        if sum(i)!=n+1:
            print(i[0],i[1])
Buggy code:
n = int(input())

if n%2 == 0:
    su = n+1
    print((n*(n-1)//2)-n//2)
    for i in range(1,n+1):
        for k in range(1,n+1):
            if i+k != su and i < k:
                print(i,k)
if n%2 == 1:
    su = n+1
    print((n*(n-1)//2)-(n-1)//2)
    for i in range(1,n+1):
        for k in range(1,n+1):
            if i+k != su and i < k:
                print(i,k)


Fixed code:
n = int(input())

if n%2 == 0:
    su = n+1
    print((n*(n-1)//2)-n//2)
    for i in range(1,n+1):
        for k in range(1,n+1):
            if i+k != su and i < k:
                print(i,k)
if n%2 == 1:
    su = n
    print((n*(n-1)//2)-(n-1)//2)
    for i in range(1,n+1):
        for k in range(1,n+1):
            if i+k != su and i < k:
                print(i,k)
Buggy code:
n=int(input())
if n%2==0:
  m=(n**2-2*n)//2
  print(m)
  for i in range(1,n+1):
    for j in range(i,n+1):
      if j == i or j== n+1-i:continue
      print(i,j)
else:
  m=n+((n-1)**2-(n-1)*2)//2
  print(m)
  for i in range(1,n):
    for j in range(i+1,n+1):
      if j == n-i: continue
      print(i,j)

Fixed code:
n = int(input())
print(n*(n-1)//2-n//2)
if n%2:
  m = n
else:
  m = n+1
for i in range(1,n):
  for j in range(i+1,n+1):
    if i+j == m:
      continue
    print(i,j)
Buggy code:
N=int(input())
if N%2==0:
  print(N*(N-2)//2)
  for i in range(1,N+1):
    for j in range(i+1,N+1):
      if i+j!=N+1:
      	print(i,j)
else:
  print(((N-1)*(N-2))//2+N-1)
  for i in range(1,N+1):
    for j in range(i+1,N+1):
      if i+j!=N:
        print(i,j)

Fixed code:
N = int(input())
print((N * (N - 1)) // 2 - N // 2)
for i in range(1, N):
  for j in range(i + 1, N + 1):
    if i + j + (N % 2) != N + 1:
      print(i, j)
Buggy code:
n = int(input())
ans = []

if n % 2 == 0:
    temp = n + 1
else:
    temp = n

for i in range(1, n):
    for j in range(i+1, n+1):
        if i + 1 != temp:
            ans.append((i, j))

print(len(ans))
for a in ans:
    print(a[0], a[1])

Fixed code:
n = int(input())
ans = []
if n % 2 == 0:
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            if j != n-i+1:
                ans.append([i,j])
else:
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            if j != n-i:
                ans.append([i,j])
print(len(ans))
for i, j in ans:
    print(i,j)
Buggy code:
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]

L = [0]*26

v = 0
ans = [0]*D
import copy
for i in range(1, D+1):
    max_score = -float('inf')
    max_idx = 0
    for j in range(26):
        temp = v
        temp += S[i-1][j]
        L_ = copy.copy(L)
        L_[j] = i
        for k in range(26):
            temp -= C[k]*(i-L_[k])
        if temp >= max_score:
            max_score = temp
            max_idx = j
    v = max_score
    L[max_idx] = i
    ans[i-1] = max_idx+1
print(L)
print(*ans, sep='\n')


Fixed code:
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]

L = [0]*26

import copy
MAX_SCORE = -float('inf')
MAX_ANS = -1
for K in range(26):
    v = 0
    ans = [0]*D
    for i in range(1, D+1):
        max_score = -float('inf')
        max_idx = 0
        for j in range(26):
            temp = v
            temp += S[i-1][j]
            L_ = copy.copy(L)
            L_[j] = i
            for k in range(26):
                for l in range(i, min(i+K, D+1)):
                    temp -= C[k]*(i-L_[k])
            if temp >= max_score:
                max_score = temp
                max_idx = j
        v = max_score
        L[max_idx] = i
        ans[i-1] = max_idx+1
    if v >= MAX_SCORE:
        MAX_SCORE = v
        MAX_ANS = ans
print(*MAX_ANS, sep='\n')
Buggy code:
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    D = NI()
    C = NLI()
    S = [NLI() for _ in range(D)]
    #T = [NI() - 1 for _ in range(D)]
    T = []
    last = [0]*26
    conf = 0
    for i in range(D):
        idx, s = argmax(S[i])
        T.append(idx)
        conf += s
        last[idx] = i+1
        for a in range(26):
            conf -= C[a] * (i+1 - last[a])
        print(conf)


def argmax(A):
    A = [[i, a] for i, a in enumerate(A)]
    A.sort(key=lambda x: x[1], reverse=True)
    return A[0]


if __name__ == "__main__":
    main()

Fixed code:
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    D = NI()
    C = NLI()
    S = [NLI() for _ in range(D)]
    #T = [NI() - 1 for _ in range(D)]
    T = []
    last = [0]*26
    conf = 0
    for i in range(D):
        idx, s = argmax(S[i])
        T.append(idx)
        conf += s
        last[idx] = i+1
        for a in range(26):
            conf -= C[a] * (i+1 - last[a])
        print(idx+1)


def argmax(A):
    A = [[i, a] for i, a in enumerate(A)]
    A.sort(key=lambda x: x[1], reverse=True)
    return A[0]


if __name__ == "__main__":
    main()
Buggy code:
import numpy as np
import sys
read = sys.stdin.read
 

D = int(input())
CS = np.array(read().split(), np.int32)
C = CS[:26]
S = CS[26:].reshape((-1, 26))
del CS
 
last = np.zeros((26, ))


def getContestType_at_d(d, k):
    s = -10000000
    for i in range(26):
        mask = np.ones((26, ))
        mask[i] = 0
        score = S[d][i] - np.sum(C * (d + 1 - last) * mask)
        score -= np.sum(C * (min(365, d + k) + 1 - last))
        if s < score:
            s = score
            t = i
 
    last[t] = d + 1
 
    return t + 1, s

max_score = -1
for k in range(26):
    score = 0
    ans = []
    for d in range(D):
        t, s = getContestType_at_d(d, k)
        ans.append(t)
        #ans.append(getContestType_at_d(d, k))
        score += s
    #print('score:', score)
    score = min(0, score)
    if max_score < score:
        max_score = score
        ANS = ans
    

print('\n'.join(map(str, ANS)))

Fixed code:
import numpy as np
import sys
read = sys.stdin.read
 

D = int(input())
CS = np.array(read().split(), np.int32)
C = CS[:26]
S = CS[26:].reshape((-1, 26))
del CS
 
last = np.zeros((26, ))


def getContestType_at_d(d, k):
    s = -10000000
    for i in range(26):
        mask = np.ones((26, ))
        mask[i] = 0
        #ps = S[d][i] - np.sum(C * (d + 1 - last) * mask)
        score =S[d][i] - np.sum(C * (min(365, d + k) + 1 - last))
        if s < score:
            s = score
            t = i
 
    last[t] = d + 1
 
    return t + 1, s


#score = 0
#pscore = 0
ans = []
for d in range(D):
    t, s = getContestType_at_d(d, 10)
    ans.append(t)
    #ans.append(getContestType_at_d(d, k))
    #score += s
    #pscore += ps

#print('pscore:', pscore)
#print('score:', score)

 
print('\n'.join(map(str, ans)))
Buggy code:
# coding: utf-8
# Your code here!
import numpy as np
d= int(input())

C = list(map(int,input().split()))
CB = [0 for i in range(len(C))]

c = sum(C)

total = 0

#print(c,C,CB)
L = []

for i in range(d):
    L.append(list(map(int,input().split())))

#print(L)


#print(T)

def cnt(CB,t):
    for i in range(len(CB)):
        if i != t:
            CB[i] += 1
        else:
            CB[i] = 0
    
    return CB

def sumA(C,CB):
    a = 0
    for i in range(len(CB)):
        a += CB[i]*C[i]
    return a

for i in range(d):
    ind = np.argmax(L[i])
    CB = cnt(CB,ind)
    total += L[i][ind] - sumA(C,CB)
    print(total)





Fixed code:
# coding: utf-8
# Your code here!
import numpy as np
d= int(input())

C = list(map(int,input().split()))
CB = [0 for i in range(len(C))]

c = sum(C)

total = 0

#print(c,C,CB)
L = []

for i in range(d):
    L.append(list(map(int,input().split())))

#print(L)


#print(T)

def cnt(CB,t):
    for i in range(len(CB)):
        if i != t:
            CB[i] += 1
        else:
            CB[i] = 0
    
    return CB

def sumA(C,CB):
    a = 0
    for i in range(len(CB)):
        a += CB[i]*C[i]
    return a

for i in range(d):
    ind = np.argmax(L[i])
    CB = cnt(CB,ind)
    total += L[i][ind] - sumA(C,CB)
    print(ind+1)
Buggy code:
import random
d = int(input())
c = list(map(int, input().split()))
s = []
for i in range(d):
  s = list(map(int, input().split()))
  print(1+s.index(max(x)))

Fixed code:
import random
d = int(input())
c = list(map(int, input().split()))
s = []
for i in range(d):
  s = list(map(int, input().split()))
  print(1+s.index(max(s)))
Buggy code:
D = int(input())
c = list(map(int,input().split()))
s = []
for i in range(D):
    s.append(list(map(int,input().split())))

def last(d,la):
    s = 0
    for i in range(26):
        s += c[i] * (d - la[i])
    return s

lastday = [0]*26
a = 0

for d in range(D):

    eff = s[d][0] - last(d+1,lastday)
    for t in range(26):
        bef = lastday[t]
        lastday[t] = d+1

        now = s[d][t] - last(d+1,lastday)
        if eff < now:
            eff = now 
            ret = t

        lastday[t] = bef
        
    lastday[ret] = d+1
    a += eff
    print(ret+1)

Fixed code:
D = int(input())
c = list(map(int,input().split()))
s = []
for i in range(D):
    s.append(list(map(int,input().split())))

def last(d,la):
    s = 0

    for i in range(26):
        if la[i] == 0 and  i == d:
            s += c[i] * (d - la[i]-1)
        else:
            s += c[i] * (d - la[i])
    return s

lastday = [0]*26
a = 0

for d in range(D):

    eff = s[d][0] - last(d+1,lastday)
    ret = 0
    for t in range(26):
        bef = lastday[t]
        #lastday[t] = d+1
        
        now = s[d][t] - last(d+1,lastday)
        if eff < now:
            eff = now 
            ret = t

        lastday[t] = bef
        
    lastday[ret] = d+1
    a += eff
    print(ret+1)