Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
if (n % 2 == 1):
  print("No")
else:
  if (s[:n/2+1] = s[n/2+1:]):
    print("Yes")
  else:
    print("No")

Fixed submission:
N = int(input())
S = input()
print("Yes" if S[:N//2] == S[N//2:] else "No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
if (n % 2 == 0):
    if (s[:n/2] = s[n/2:]):
      print("Yes")
    else:
     print("No")
else:
  print("No")


Fixed submission:
N = int(input())
S = input()
print("Yes" if S[:N//2] == S[N//2:] else "No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
if (s[:n/2] = s[n/2:]):
  print("Yes")
else:
  print("No")


Fixed submission:
N = int(input())
S = input()
print("Yes" if S[:N//2] == S[N//2:] else "No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
if (s[:n] * 2  = s):
  print("Yes")
else:
  print("No")


Fixed submission:
N = int(input())
S = input()
print("Yes" if S[:N//2] == S[N//2:] else "No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
if (s[:n] = s[n:]):
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
S = input()
print("Yes" if S[:N//2] == S[N//2:] else "No")
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
mod=10**9+7
S=0
M=0
for i in A:
    S+=i
for i in A:
    S-=i
    M+=(S*i)%mod
print(M%mod)

Fixed submission:
D,T,S=map(int,input().split())
if T>=D/S:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
mod=10**9+7
S=0
for i in range(N):
    for j in range(i):
        S+=(A[i]*A[j])%mod
print(S%mod)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
mod=10**9+7
S=0
M=0
for i in A:
    S+=i
for i in A:
    S-=i
    M+=(S*i)%mod
print(M%mod)
Buggy python submission (verdict: Runtime Error):
import copy
H,W,K=map(int,input().split())
L=[list(map(int,input().split())) for i in range(H)]
ans=0
for i in range(2**H):
    for j in range(2**W):
        C=copy.deepcopy(L)
        for k range(H):
            if (i>>k&1):
                C[k]=["r"]*W
        for l range(W):
            if (j>>l&1):
                for m range(H):
                    C[l][m]="r"
        count=0
        for i in range(H):
            for j in range(W):
                if C[i][j]=="#":
                    count+=1
        if count==K:
            ans+=1
print(ans)


Fixed submission:
import copy
H,W,K=map(int,input().split())
L=[[x for x in input()] for i in range(H)]
ans=0
for i in range(2**H):
    for j in range(2**W):
        C=copy.deepcopy(L)
        for k in range(H):
            if (i>>k&1):
                C[k]=["r"]*W
        for l in range(W):
            if (j>>l&1):
                for m in range(H):
                    C[m][l]="r"
        count=0
        for p in range(H):
            for q in range(W):
                if C[p][q]=="#":
                    count+=1
        if count==K:
            ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
H,W,K=map(int,input().split())
L=[list(map(int,input().split())) for i in range(H)]
ans=0
for i in range(2**H):
    for j in range(2**W):
        C=deepcopy.(L)
        for k range(H):
            if (i>>k&1):
                C[k]=["r"]*W
        for l range(W):
            if (j>>l&1):
                for m range(H):
                    C[l][m]="r"
        count=0
        for i in range(H):
            for j in range(W):
                if C[i][j]=="#":
                    count+=1
        if count==K:
            ans+=1
print(ans)


Fixed submission:
import copy
H,W,K=map(int,input().split())
L=[[x for x in input()] for i in range(H)]
ans=0
for i in range(2**H):
    for j in range(2**W):
        C=copy.deepcopy(L)
        for k in range(H):
            if (i>>k&1):
                C[k]=["r"]*W
        for l in range(W):
            if (j>>l&1):
                for m in range(H):
                    C[m][l]="r"
        count=0
        for p in range(H):
            for q in range(W):
                if C[p][q]=="#":
                    count+=1
        if count==K:
            ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*10**5+1
for i in A:
    S+=i
    B[i]+=1  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]+=B[C[i][0]]
    B[C[i][0]]=0
    print(S)


Fixed submission:
N=int(input())-1
L=[]
S=[]
A=[chr(i) for i in range(97,123)]
X=""
while N>=0:
  if N==0:
    L.append(N%26)
    N=N//26
    break
  elif N!=0:
    L.append(N%26)
    N=N//26-1
S=list(reversed(L))
for i in range(len(S)):
  X+=A[S[i]]
print(str(X))
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*10**5
for i in A:
    S+=i
    B[i]+=1  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]+=B[C[i][0]]
    B[C[i][0]]=0
    print(S)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*(10**5+1)
for i in A:
    S+=i
    B[i]+=1  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]=B[C[i][0]]+B[C[i][1]]
    B[C[i][0]]=0
    print(S)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*10**5
for i in A:
    S+=i
    B[i]+=1  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]=B[C[i][0]]+B[C[i][1]]
    B[C[i][0]]=0
    print(S)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*(10**5+1)
for i in A:
    S+=i
    B[i]+=1  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]=B[C[i][0]]+B[C[i][1]]
    B[C[i][0]]=0
    print(S)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*10**5
for i in A:
    S+=i
    B[i]=A.count(i)  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]=B[C[i][0]]+B[C[i][1]]
    B[C[i][0]]=0
    print(S)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*(10**5+1)
for i in A:
    S+=i
    B[i]+=1  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]=B[C[i][0]]+B[C[i][1]]
    B[C[i][0]]=0
    print(S)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
pro=1
for i in range(N):
  pro=pro*L[i]
maxi=1
for i in range(18):
  maxi=maxi*10
if maxi<pro:
  print(-1)
else:
  print(pro)

Fixed submission:
N=int(input())
K=list(map(int,input().split()))
L=sorted(K)
maxi=1
for i in range(18):
  maxi=maxi*10
pro=1
for i in range(N):
  pro=pro*L[i]
  if maxi<pro:
    print(-1)
    break
if maxi>=pro:
  print(pro)
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
def gcd(p,q):
    if p%q==0:
        return q
    return gcd(q,p%q)
S=0
for i in range(K):
    for j in range(K):
        for k in range(K):
            S+=gcd(i+1,gcd(j+1,k+1))
print(S)

Fixed submission:
K=int(input())
def gcd(p,q):
    if p%q==0:
        return q
    return gcd(q,p%q)
S=0
for i in range(K):
    for j in range(K):
        for k in range(K):
            S+=gcd(i+1,gcd(j+1,k+1))
print(S)

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
S=0
import math
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      S+=math.gcd(i,math.gcd(j,k))
print(S)

Fixed submission:
K=int(input())
def gcd(p,q):
    if p%q==0:
        return q
    return gcd(q,p%q)
S=0
for i in range(K):
    for j in range(K):
        for k in range(K):
            S+=gcd(i+1,gcd(j+1,k+1))
print(S)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
c=0
for i in range(N):
    for j in range(i):
        for k in range(j):
            if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i] and j-i!=k-j:
                c+=1
print(c)

Fixed submission:
import itertools
N=int(input())
S=input()
ans=S.count("R")*S.count("G")*S.count("B")
c=list(itertools.permutations(["R","B","G"],3))
for j in range(1,N):
    for i in range(N-j*2):
        if (S[i],S[i+j],S[i+j*2]) in c:
            ans-=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
c=0
for i in range(N):
    for j in range(i):
        for k in range(j):
            if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i] and j-i!=k-j:
                c+=1
print(c)

Fixed submission:
import itertools
N=int(input())
S=input()
ans=S.count("R")*S.count("G")*S.count("B")
c=list(itertools.permutations(["R","B","G"],3))
for j in range(1,N):
    for i in range(N-j*2):
        if (S[i],S[i+j],S[i+j*2]) in c:
            ans-=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N+1)
C=0
for i in A:
    B[i-1]+=1
for i in B:
    C+=len(list(itertools.combinations(range(i),2)))
for i in A:
    print(C-B[i-1]+1)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N+1)
C=0
for i in A:
    B[i-1]+=1
for i in B:
    if i>=2:
        C+=i*(i-1)//2
for i in A:
    print(C-B[i-1]+1)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N+1)
C=0
for i in A:
    B[i-1]+=1
for i in B:
    C+=len(list(itertools.combinations(range(i),2)))
for i in A:
    print(C-B[i-1]+1)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N+1)
C=0
for i in A:
    B[i-1]+=1
for i in B:
    if i>=2:
        C+=i*(i-1)//2
for i in A:
    print(C-B[i-1]+1)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
import copy
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
for i in A:
   B[i-1]+=1 
def X (k):
    c=0
    C=copy.deepcopy(B)
    C[k-1]-=1
    for i in range(N):
        if C[i-1]>=2:
            c+=len(list(combinations(range(C[i-1]),2)))
    return c
for j in A:
    print(X(j))

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N+1)
C=0
for i in A:
    B[i-1]+=1
for i in B:
    if i>=2:
        C+=i*(i-1)//2
for i in A:
    print(C-B[i-1]+1)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
Q=int(input())
A=[list(input().split()) for i in range(Q)]
c=0
for i in range(Q):
    if A[i][0]=="1":
        c+=1
        continue
    if c%2==1 and A[i][0]=="2":
        if A[i][1]=="1":
            S=S+A[i][2]
        elif A[i][1]=="2":
            S=A[i][2]+S
    elif c%2==0 and A[i][0]=="2":
        if A[i][1]=="1":
            S=A[i][2]+S
        elif A[i][1]=="2":
            S=S+A[i][2]
if c%2==1:
    S=S[::-1]
print(S)

Fixed submission:
S=input()
Q=int(input())
A=[list(input().split()) for i in range(Q)]
c=0
R=""
L=""
for i in range(Q):
    if A[i][0]=="1":
        c+=1
        continue
    if c%2==1 and A[i][0]=="2":
        if A[i][1]=="1":
            R=R+A[i][2]
        elif A[i][1]=="2":
            L=A[i][2]+L
    elif c%2==0 and A[i][0]=="2":
        if A[i][1]=="1":
            L=A[i][2]+L
        elif A[i][1]=="2":
            R=R+A[i][2]
S=L+S+R
if c%2==1:
    S=S[::-1]
print(S)

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
Q=int(input())
A=[list(input().split()) for i in range(Q)]
c=0
for i in range(Q):
    if A[i][0]=="1":
        c+=1
        continue
    if c%2==1 and A[i][0]=="2":
        if A[i][1]=="1":
            S=S+A[i][2]
        elif A[i][1]=="2":
            S=A[i][2]+S
    elif c%2==0 and A[i][0]=="2":
        if A[i][1]=="1":
            S=A[i][2]+S
        elif A[i][1]=="2":
            S=S+A[i][2]
if c%2==1:
    S=S[::-1]
print(S)

Fixed submission:
S=input()
Q=int(input())
A=[list(input().split()) for i in range(Q)]
c=0
R=""
L=""
for i in range(Q):
    if A[i][0]=="1":
        c+=1
        continue
    if c%2==1 and A[i][0]=="2":
        if A[i][1]=="1":
            R=R+A[i][2]
        elif A[i][1]=="2":
            L=A[i][2]+L
    elif c%2==0 and A[i][0]=="2":
        if A[i][1]=="1":
            L=A[i][2]+L
        elif A[i][1]=="2":
            R=R+A[i][2]
S=L+S+R
if c%2==1:
    S=S[::-1]
print(S)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(input() for i in range(N))
M=sorted(set(L))
S=[]
for i in M:
  c=0
  for j in range(N):
    if L[j]==i:
      c+=1
  S.append(c)
maxs=0
for i in range(len(S)):
  if S[i]>maxs:
    maxl=[]
    maxl.append(i)
    maxs=S[i]
  elif S[i]==maxs:
    maxl.append(i)
for i in maxl:
  print(M[i])

Fixed submission:
N=int(input())
L=list(input() for i in range(N))
L=sorted(L)
X=L[0]
c=0
d=0
e=[]
for i in range(N):
  if L[i]==X:
    c+=1
    if i==N-1 and c>d:
      e=[X]
    elif i==N-1 and c==d:
      e.append(X)
  elif L[i]!=X and d<c:
    d=c
    c=0
    e=[]
    e.append(X)
    X=L[i]
    c+=1
  elif L[i]!=X and d==c:
    c=1
    e.append(X)
    X=L[i]
    if i==N-1:
      e.append(X)
  elif L[i]!=X and d>c:
    c=0
    X=L[i]
    c+=1
for i in e:
  print(i)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(input())
A=list(map(int,input().split()))
c=0
for i in range(1,N+1):
    for j in range(N):
        if A[j]!=i:
            c+=1
        elif A[j]==i:
            break
    if c+i==N:
        print(c)
        sys.exit()
    continue
print(-1)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
c=1
for i in range(N):
    if A[i]==c:
        c+=1
if c==1:
    print(-1)
else:
    print(N-c+1)
Buggy python submission (verdict: Time Limit Exceeded):
s=0
for i in range(1,int(input())):
    s+=i
print(s)

Fixed submission:
s=0
for i in range(1,int(input())):
    s+=i
print(s)
Buggy python submission (verdict: Runtime Error):
import itertools as it
def X (n):
    if n%2==0:
        r=n//2
    else:
        r=(n-1)//2
    S=1
    C=1
    for j in range(1,r+1):
        C=len(list(it.combinations(range(n-j),j)))
        S+=C
    return int(S)

N,M=map(int,input().split())
L=[]
a=0
for i in range(M):
    b=int(input())
    L.append(b-a-1)
    a=b
L.append(N-b-1)
A=1
mod=10**9+7
for i in range(len(L)):
    A*=(X(L[i])%mod)
    if L[i]==0 and i>0:
        A=0
        break
print(A%mod)

Fixed submission:
N,M=map(int,input().split())
mod=1000000007
a=[0]*(10**5+1)
dp=[0]*(10**5+1)
for i in range(M):
    b=int(input())
    a[b]=1
dp[0]=1
for i in range(1,N+1):
    if a[i]==1:
        continue
    dp[i]+=dp[i-1]
    if i>1:
        dp[i]+=dp[i-2]
    dp[i]=dp[i]%mod
print(dp[N]%mod)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
X=[0]*N
c=0
for i in range(M):
    L,R=map(int,input().split())
    for j in range(L-1,R):
        X[j]+=1
for i in X:
    if i==M:
        c+=1
print(c)

Fixed submission:
N,M=map(int,input().split())
L=[list(map(int,input().split()))for i in range(M)]
r=N
l=0
for i in range(M):
    l=max(l,L[i][0])
    r=min(r,L[i][1])
if r-l+1<0:
    print(0)
else:
    print(r-l+1)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
X=[0]*N
c=0
for i in range(M):
    L,R=map(int,input().split())
    for j in range(L-1,R):
        X[j]+=1
for i in X:
    if i==M:
        c+=1
print(c)

Fixed submission:
N,M=map(int,input().split())
L=[list(map(int,input().split()))for i in range(M)]
r=N
l=0
for i in range(M):
    l=max(l,L[i][0])
    r=min(r,L[i][1])
if r-l+1<0:
    print(0)
else:
    print(r-l+1)
Buggy python submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
L=[]
R=[]
C=[0]*N
c=0
for i in range(Q):
    A=list(map(int,input().split()))
    L.append(A[0])
    R.append(A[1])
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        c+=1
        C[i]=c
    else:
        C[i]=c
C[N-1]=c
for i in range(Q):
    p=0
    if S[R[i]-1]=="A" and S[R[i]]=="C":
        p=C[R[i]-1]-C[L[i]-1]-1
    else:
        p=C[R[i]-1]-C[L[i]-1]
    if S[L[i]-1]=="A" and S[L[i]]=="C":
        p+=1
    print(p)


Fixed submission:
N,Q=map(int,input().split())
S=input()
L=[]
R=[]
C=[0]*N
c=0
for i in range(Q):
    A=list(map(int,input().split()))
    L.append(A[0])
    R.append(A[1])
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        c+=1
        C[i]=c
    else:
        C[i]=c
C[N-1]=c
S+="X"
for i in range(Q):
    p=0
    if S[R[i]-1]=="A" and S[R[i]]=="C":
        p=C[R[i]-1]-C[L[i]-1]-1
    else:
        p=C[R[i]-1]-C[L[i]-1]
    if S[L[i]-1]=="A" and S[L[i]]=="C":
        p+=1
    print(p)

Buggy python submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
L=[]
R=[]
C=[0]*N
c=0
for i in range(Q):
    A=list(map(int,input().split()))
    L.append(A[0])
    R.append(A[1])
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        c+=1
        C[i]=c
    else:
        C[i]=c
C[N-1]=c
for i in range(Q):
    if S[R[i]-1]=="A" and S[R[i]]=="C":
        print(C[R[i]-1]-C[L[i]-1]-1)
    else:
        print(C[R[i]-1]-C[L[i]-1]+1)
print(C)

Fixed submission:
N,Q=map(int,input().split())
S=input()
L=[]
R=[]
C=[0]*N
c=0
for i in range(Q):
    A=list(map(int,input().split()))
    L.append(A[0])
    R.append(A[1])
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        c+=1
        C[i]=c
    else:
        C[i]=c
C[N-1]=c
S+="X"
for i in range(Q):
    p=0
    if S[R[i]-1]=="A" and S[R[i]]=="C":
        p=C[R[i]-1]-C[L[i]-1]-1
    else:
        p=C[R[i]-1]-C[L[i]-1]
    if S[L[i]-1]=="A" and S[L[i]]=="C":
        p+=1
    print(p)

Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
S=input()
L=[]
R=[]
for i in range(Q):
    A=list(map(int,input().split()))
    L.append(A[0])
    R.append(A[1])
def X(l,r):
    c=0
    T=S[l-1:r]
    for i in range(r-l):
        if T[i]=="A" and T[i+1]=="C":
            c+=1
    print(c)
for k in range(Q):
    X(L[k],R[k])

Fixed submission:
N,Q=map(int,input().split())
S=input()
L=[]
R=[]
C=[0]*N
c=0
for i in range(Q):
    A=list(map(int,input().split()))
    L.append(A[0])
    R.append(A[1])
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        c+=1
        C[i]=c
    else:
        C[i]=c
C[N-1]=c
S+="X"
for i in range(Q):
    p=0
    if S[R[i]-1]=="A" and S[R[i]]=="C":
        p=C[R[i]-1]-C[L[i]-1]-1
    else:
        p=C[R[i]-1]-C[L[i]-1]
    if S[L[i]-1]=="A" and S[L[i]]=="C":
        p+=1
    print(p)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int(input().split()))

print(max(a*c, a*d, b*c, b*d))

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

print(max(a*c, a*d, b*c, b*d))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

hyouten = 1
for i in range(K):
    hyouten *= A[i]
    
for i in range(K, N):
    hyouten2 = hyouten // A[i-K] * A[i]
    if hyouten2 > hyouten:
        print("Yes")
    else:
        print("No")
    hyouten = hyouten2

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
    
for i in range(K, N):
    if A[i] > A[i-K]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())

for i in range(1, N+1):
    count = 0
    for x in range(1, int(math.sqrt(N))+1):
        for y in range(1, int(math.sqrt(N))+1):
            tmp = 4*i - 3*x*x - 3*y*y - 2*x*y
            if tmp > 0:
                z = (math.sqrt(tmp) - x - y)
                if z >= 2 and z%2==0 and z.is_integer() == True:
                    count += 1
    print(count)

Fixed submission:
import math

N = int(input())

ans = [0 for i in range(N)]
for x in range(1, int(math.sqrt(N))+1):
    for y in range(1, int(math.sqrt(N))+1):
        for z in range(1, int(math.sqrt(N))+1):
            tmp = x*x+y*y+z*z+x*y+y*z+z*x
            if tmp <= N:
                ans[tmp-1] += 1

for i in range(N):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
import math

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

nocontest = [2 for i in range(26)]

for i in range(D):
    s = S[i]
    contest = [0 for j in range(26)]
    for j in range(26):
        contest[j] = c[j] * nocontest[j] * s[j]
    #print(contest)
    max_contest = max(contest)
    ans = contest.index(max_contest)
    print(ans + 1)
    
    for j in range(26):
        if j == ans:
            nocontest[j] = 2
        else:
            nocontest[j] = nocontest[j] * (nocontest[j]+1) // 2
    #print(nocontest)

Fixed submission:
D = int(input())

for i in range(D):
    print(1)

Buggy python submission (verdict: Time Limit Exceeded):
D = int(input())
c = list(map(int, input().split()))
S = []
for i in range(D):
    S.append(list(map(int, input().split())))

nocontest = [1 for i in range(26)]

for i in range(D):
    s = S[i]
    contest = [0 for j in range(26)]
    for j in range(26):
        contest[j] = c * nocontest[j] * s[j]
    max_contest = max(contest)
    ans = contest.index(max_contest)
    print(ans + 1)
    
    for i in range(26):
        if i == ans:
            nocontest[i] = 1
        else:
            nocontest[i] += 1
    #print(nocontest)

Fixed submission:
D = int(input())

for i in range(D):
    print(1)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = map(int, input().split())

ans = 0
for i in range(N+1):
    tmp = ((A*i)//B) - (A*(i//B))
    if tmp >= ans:
        ans = tmp
    else:
        break
        
print(ans)


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

ans = 0
i = 1
while True:
    i += max(1, (B-1)//A+1)
    if i > N:
        break
    tmp = ((A*i)//B) - (A*(i//B))
    if tmp > ans:
        ans = tmp
    else:
        break
        
print(ans)