Problem:
 Score : 200 points    Problem Statement Let us define the FizzBuzz sequence  a_1,a_2,... as follows:   If both 3 and 5 divides i , a_i=\mbox{FizzBuzz} .  If the above does not hold but 3 divides i , a_i=\mbox{Fizz} .  If none of the above holds but 5 divides i , a_i=\mbox{Buzz} .  If none of the above holds, a_i=i .   Find the sum of all numbers among the first N terms of the FizzBuzz sequence.      Constraints  1 \leq N \leq 10^6         Input Input is given from Standard Input in the following format:  N       Output Print the sum of all numbers among the first N terms of the FizzBuzz sequence.        Sample Input 1 15      Sample Output 1 60  The first 15 terms of the FizzBuzz sequence are:  1,2,\mbox{Fizz},4,\mbox{Buzz},\mbox{Fizz},7,8,\mbox{Fizz},\mbox{Buzz},11,\mbox{Fizz},13,14,\mbox{FizzBuzz}  Among them, numbers are 1,2,4,7,8,11,13,14 , and the sum of them is 60 .       Sample Input 2 1000000      Sample Output 2 266666333332  Watch out for overflow.

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N+1):
    if (i%3 != 0):
        if i%5 != 0:
            ans+=i
print(ans)

Solution (Python):
n=input()
n=int(n)
sum=n *(n+1)//2
x=n//3
y=n//5
z=n//15
xsum= 3 *x*(x+1)//2
ysum= 5 *y*(y+1)//2
zsum= 15 *z*(z+1)//2

ans=sum-xsum-ysum+zsum
print(ans)

Solution (Python):
N = int(input())
xx= 0
for i in range(1,N+1):
    if((i%3!=0)&(i%5!=0)):
        xx += i
print(xx)

Solution (Python):
N=int(input())
retu=[]
ans=0
for i in range(N+1):
  if i%3==0:
    continue
  elif i%5==0:
    continue
  else:
    retu.append(i)
for i in retu:
  ans+=i
print(ans)

Solution (Python):
a = int(input())
print(sum([i for i in range(1, a+1) if (i%3) != 0 and (i%5) != 0]))

Solution (Python):
def check(q):
    if q % 15 == 0:
        return 0
    elif q %5 == 0:
        return 0
    elif q % 3 == 0:
        return 0
    else:
        return q

a = int(input())
b = 0

if a <= 10000000 and a >= 1:

    for i in range(a+1):
        b += check(i)
        
print(b)

Solution (Python):
a=int(input())
List=[]
for i in range(1,a+1):
    
    if not(i%3==0 or i%5==0):

        List += [i]
    else:
        continue
print(sum(List))

Solution (Python):
N = int(input())
out = 0
for i in range(1,N+1):
    if i%3 == 0 and i%5 == 0 or i%3==0 or i%5==0:
       continue
    out += i
print(out)

Solution (Python):
s=int(input())

nn=[]
for i in range(s):
  if (i+1)%3==0 or (i+1)%5==0:
    continue
  else:
    nn.append(i+1)
    
print(sum(nn))

Solution (Python):
print(sum(i for i in range(int(input())+1) if i%3 and i%5))

Solution (Python):
n = int(input())
s = 0
for i in range(1,n+1,1):
    if(i%3==0 or i%5==0):
        continue
    s = s+i
print(s)

Solution (Python):
N = int(input())
r = 0
for i in range(1, N+1):
    if i%3 == 0 or i%5==0:
        continue
    r += i
print(r)

Solution (Python):
n = int(input())
list = []
for a in range(1,n+1):
    if a % 3 == 0 or a % 5 == 0:
        pass
    else:
        list.append(a)
print(sum(list))

Solution (Python):
n = int(input())

sum = 0
for i in range(1, n+1):
  if i % 3 != 0 and i % 5 != 0:
    sum += i

print(sum)

Solution (Python):
n = int(input())
ans = 0
for i in range(n + 1):
    
    
    if i % 15 == 0:
        
        continue;
    elif i % 5 == 0:
        
        continue;
    elif i % 3 == 0:
        
        continue;
    
        
    else:
        
        ans += i

        
    
print(ans)

Solution (Python):
n = int(input())
m = n + 1
sum = 0
if m <= 3:
  for x in range(m):
    sum = sum + x
else:
  for x in range(m):
    if x%3 == 0 or x%5 == 0:
      pass
    else:
      sum = sum + x
print(sum)

Solution (Python):
num = int(input())

total = 0
for i in range(1, num+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        total += i
print(total)

Solution (Python):
n = int(input())
j = 0
for i in range(n+1):
    if i % 3 == 0 or i%5 == 0:
        j += 0
    else:
        j += i
print(j)

Solution (Python):
N = int(input())
a = []
for i in range(1,N+1):
    if i%3==0 and i%5==0:
        b = 'FizzBuzz'
    elif i%5==0:
        b = 'Buzz'
    elif i%3==0:
        b = 'Fizz'
    else:
        b = i
    a.append(b)
list_2 = [num for num in a if isinstance(num, (int, float))]
print(sum(list_2))

Solution (Python):
n = int(input())
l = [i for i in range(1,n+1)]
l = list(filter(lambda x: x%3 != 0,l))
l = list(filter(lambda x: x%5 != 0,l))
print(sum(l))

Solution (Python):
N = list(range(1,int(input())+1))

result = 0

for i in N:
    if (i%3!=0) and (i%5!=0):
        result += i

print(result)

Solution (Python):
N = int(input())
S = []
ans = 0

for i in range(N+1):
    S.append(i)

for i in range(N+1):
    if S[i] % 3 > 0 and S[i] % 5 > 0:
        ans += S[i]

print(ans)

Solution (Python):
N = int(input())

s = (1+N)*N // 2
s1 = 0
s2 = 0
s3 = 0
if N >= 3:
    s1 = ((3 + (N//3)*3) * (N//3)) // 2
if N >= 5:
    s2 = ((5 + (N//5)*5) * (N//5)) // 2
if N >= 15:
    s3 = ((15 + (N//15)*15) * (N//15)) // 2
print(s + s3 - s1 - s2)

Solution (Python):
n = int(input())
print(sum(filter(lambda x: not (x % 3 == 0 or x % 5 == 0), [x for x in range(1, n+1)])))

Solution (Python):
n = int(input())

sum = 0.5 * n * (n + 1)

sum3 = 0
sum5 = 0
sum15 = 0
i = 1
flag3 = 1
flag5 = 1
flag15 = 1

while 1:
    if 3 * i <= n:
        sum3 += 3 * i
    else : 
        break
    if 5 * i <= n:
        sum5 += 5 * i
    if 15 * i <= n:
        sum15 += 15 * i
    i += 1

print(int(sum - sum3 - sum5 + sum15))

Solution (Python):

from typing import *

def solve(n: int) -> int:
    nums = [i for i in range(15) if i % 3 != 0 and i % 5 != 0]
    k = (n + 1) // 15
    ans = k * sum(nums) + k * (k - 1) // 2 * len(nums) * 15
    for i in range((n + 1) // 15 * 15, n + 1):
        if i % 3 != 0 and i % 5 != 0:
            ans += i
    return ans



def main():
    N = int(input())
    ans = solve(N)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ans = 0
for i in range(1,n+1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
n=int(input())
c=0
for i in range(1,n+1):
  if((i%3==0)and(i%5==0)):
    continue
  elif(i%3==0):
    continue
  elif((i%5==0)):
    continue
  else:
    c+=i
print(c)

Solution (Python):

"""
Created on Sun Apr 12 20:58:59 2020

@author: H_Hoshigi
"""

N = int(input())

FizzBuzz_sum_list = [0,1,3,3,7,7,7,14,22,22,22,33,33,46,60]
FizzBuzz_num_list = [0,1,2,2,3,3,3,4,5,5,5,6,6,7,8]

answer = 60*pow(N//15, 2) + FizzBuzz_sum_list[N%15] + 15*(N//15)*FizzBuzz_num_list[N%15]

print(answer)

Solution (Python):




N=int(input())

H=[]
for i in range(1,N+1):
    
    if i%15!=0 and i%5!=0 and i%3!=0:
        H.append(i)
        
print(sum(H))

Solution (Python):


N = int(input())
S = 0
for i in range(1, N+1):
    if i%3==0 or i%5==0 or (i%3==0 and i%5==0):
        continue
    S+=i
print(S)

Solution (Python):
import re

n=int(input())

a=0

for i in range(n):
    j=i+1
    if j%3!=0 and j%5!=0:
        a+=j

print(a)

Solution (Python):
num = int(input())
num_range = range(1,num + 1)
num_list1 = [x for x in list(num_range) if not x % 3 == 0]
num_list2 = [x for x in num_list1 if not x % 5 == 0]
print(sum(num_list2))

Solution (Python):
n=int(input())
answer=0
for i in range(1,n+1):
    if(i%3!=0 and i%5!=0):
        answer+=i
print(answer)

Solution (Python):
n = int(input())
total = 0
for i in range(n+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        total += i

print(total)

Solution (Python):
n=int(input())

sum=0

for i in range(n):
    j=i+1
    if j % 3 != 0 and j % 5 != 0:
        sum+=j

print(sum)

Solution (Python):
N = int(input())
list = []
 
for i in range(N):
  if (i+1) % 3 == 0:
    pass
  elif (i+1) % 5 == 0:
    pass
  else:
    list.append(i+1)
    
print(sum(list))

Solution (Python):
N = int(input())
  
ans = 0
for i in range(1,N+1):
    if i % 3 == 0 or i%5 == 0:
        pass
    else:
        ans += i

print(ans)

Solution (Python):
n = int(input())
list = []
for a in range(1,n+1):
    if a % 3 == 0 or a % 5 == 0:
        pass
    else:
        list.append(a)
print(sum(list))

Solution (Python):
N = int(input())
ans = 0
for i in range(N+1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
N = int(input())
list = []
for i in range(1,N+1):
    list.append(i)
for i in range(1,(N+3)//3):
    list[3*i-1] = 0
for i in range(1,(N+5)//5):
    list[5*i-1] = 0
print(sum(list))

Solution (Python):
N = int(input())
total = 0

for i in range(N + 1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        total += i

print(total)

Solution (Python):
n = int(input())
r = 0
for i in range(1, n+1):
	if i % 3 == 0:
		continue
	if i % 5 == 0:
		continue
	r += i
print(r)

Solution (Python):
N = int(input())

FB = []
for i in range(N+1):
    if i % 3 == 0 or i % 5 == 0:
        FB.append(0)
    else:
        FB.append(i)
    i = i + 1

S = sum(FB)
print(S)

Solution (Python):
N = int(input())
ans = 0
for i in range(N + 1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        ans += i
print(ans)

Solution (Python):
n = int(input())

s = 0

for i in range(1, n+1):
    if (i % 3 != 0 and i % 5 != 0):
        s += i
    else:
        continue
    
print(s)

Solution (Python):
import numpy as np
N = int(input())

a = np.arange(1, N+1)
a = a[a%3!=0]
a = a[a%5!=0]
print(np.sum(a))

Solution (Python):
N=int(input())
count,i,ans=0,0,0
for i in range(N):
  num=i+1
  if(num%3!=0 and num%5!=0):
    ans+=num
print(ans)

Solution (Python):
n = int(input())

terms = 0
i = 1
s = 0
while terms < n:

    if i % 3 and i % 5:
        s += i

    i += 1
    terms += 1

print(s)

Solution (Python):
n=int(input())
a=n//15
b=n%15
c=0
for i in range(a*15,n+1):
  if (i%3!=0 and i%5!=0):
    c=c+i
c=c+(60+120*(a-1)+60)*a/2
print(int(c))

Solution (Python):
N = int(input())

k15 = N // 15
m = N - (15 * k15)

k3 = m // 3
k5 = m // 5

def sigma(n):
  ans = (n * (n + 1)) / 2
  return ans

sum = (3 * sigma((5 * k15) + k3)) + (5 * sigma((3 * k15) + k5)) - (15 * sigma(k15))
an = sigma(N) - sum
print(int(an))

Solution (Python):
def main():
    N = int(input())
    sum_fizzbuzz = 0
    for i in range(N+1):
        if i % 3 != 0 and i % 5 != 0:
            sum_fizzbuzz += i           
    print(sum_fizzbuzz)
if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())

sum = 0
for i in range(n):
    if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:
        sum = sum + i + 1

print(sum)

Solution (Python):
n = int(input())
box = []
for i in range(1,n+1):
  if i % 15 == 0:
    box.append(0)
  elif i % 3 == 0:
    box.append(0)
  elif i % 5 == 0:
    box.append(0)
  else:
    box.append(i)
print(sum(box))

Solution (Python):
N = int(input())
 
org_sum = 1 * N * (N+1) // 2
div3 = N // 3
sum3 = 3 * div3 * (div3+1) //2
div5 = N // 5
sum5 = 5 * div5 * (div5+1) // 2
div15 = N // 15
sum15 = 15 * div15 * (div15+1) // 2
 
print(org_sum - sum3 - sum5 + sum15)

Solution (Python):
n=int(input())
x=n//3
y=n//5
z=n//15
if n<3:
  X=0
elif 3<=n<=5:
  X=3
else:
  X=int((3+3*x)*x/2)
if n<5:
  Y=0
elif 5<=n<=9:
  Y=5
else:
  Y=int((5+5*y)*y/2)
if n<15:
  Z=0
elif 15<=n<30:
  Z=15
else:
  Z=int((15+15*z)*z/2)
  
S=[0]*(n+1)
  
for i in range(n+1):
  S[i]=i

print(sum(S)-X-Y+Z)

Solution (Python):
n = int(input())

ans = 0

for i in range(1, n+1):
  if i%5==0 or i%3==0:
    continue
  ans += i
  
print(ans)

Solution (Python):


int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solve():
    n = II()

    ans = 0
    for i in range(1, n+1):
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            ans = ans + i
    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):
ans=0
K=int(input())
for a in range(1,K+1):
  if not(a%3==0 or a%5==0):
    ans+=a
print(ans)

Solution (Python):
import sys
from decimal import *
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        if i % 3 == 0:
            continue
        if i % 5 == 0:
            continue
        ans += i
    print(ans)


main()

Solution (Python):
line = input()
n = int(line)
ans = 0

for i in range(n+1):
    if i%3 != 0 and i%5 != 0:
        ans = ans + i
print(ans)

Solution (Python):

n = int(input())

arr = [i for i in range(1, n + 1)]
three = list(filter(lambda x:x%3!=0, arr))
five = list(filter(lambda x:x%5!=0, three))
print(sum(list(five)))

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    ans += i
print(ans)

Solution (Python):

N = int(input())
sum = 0

for i in range(1,N+1):
    if i % 15 == 0:
        sum += 0
    elif i % 3 == 0:
        sum += 0
    elif i % 5 == 0:
        sum += 0
    else:
        sum += i

print(sum)

Solution (Python):
s=int(input())
list1=[]
h=0
for i in range(1,s+1):
    if i%3!=0 and i%5!=0:
        list1.append(i)
for j in list1:
    h=h+j
print(h)

Solution (Python):
n = int(input())
fizz = 0
buzz = 0
fizzbuzz = 0
num_sum = 0
for num in range(1,n+1):
    if(num%3 == 0):
        fizz += num
    if(num%5 == 0):
        buzz += num
    if(num%3 == 0 and num%5==0):
        fizzbuzz += num
    num_sum += num
ans = num_sum - fizz - buzz + fizzbuzz
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(N+1):
    if i%3 != 0 and i%5 != 0:
        ans += i
print(ans)

Solution (Python):
n = int(input())
 
sum = (1+n)*n/2
 
n3 = n//3
n5 = n//5
n15 = n//15
 
sum3 = (1+n3)*n3/2 * 3
sum5 = (1+n5)*n5/2 * 5
sum15 = (1+n15)*n15/2 * 15
 
sum = sum + sum15 -sum3 -sum5
 
print(int(sum))

Solution (Python):
N = input()
a = list()
for i in range(1,int(N)+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        a.append(i)
print(sum(a))

Solution (Python):
n=int(input())
ans=0

for i in range(1,n+1):
  ans+=i
  
  if i%3==0 or i%5==0:
    ans-=i
    
print(ans)

Solution (Python):
N=int(input())

S=0
for n in range(N+1):
    if n%3==0 or n%5==0:
        pass
    else:
        S+=n

print(S)

Solution (Python):


n = int(input())
s = 0
for i in range(1,n+1):
    
    if i % 3 != 0 and i % 5 != 0:
        s += i
    
print(s)

Solution (Python):

n=int(input())

ans = 0

for i in range(n+1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i

print(int(ans))

Solution (Python):
n = int(input())

ans = 0
for i in range(n+1):
    if i%3 !=0 and i%5!=0:
        ans += i
print(ans)

Solution (Python):
def fizzbuzz_sum(n):
    result = 0
    for num in range(n):
        rn = num+1
        if rn % 3 != 0 and rn % 5 != 0:
            result += rn
    return result

n = int(input())
print(fizzbuzz_sum(n))

Solution (Python):
import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log
from collections import Counter, defaultdict, deque
from operator import itemgetter
INF = float('inf'); MOD = 10**9+7
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
def LIR(n): return [LI() for i in range(n)]
def IS(): return input().rstrip()

def main():
    N = I()
    l = []
    for i in range(N+1):
        if i % 3 == 0: pass
        elif i % 5 == 0: pass
        else: l.append(i)
    print(sum(l))
    
if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
res = 0
for i in range(1, n+1):
    if i%3==0 or i%5==0 or (i%3==0 and i%5==0):
        continue
    res += i
print(res)

Solution (Python):
N = int(input())
i = 1
List_str = []
List_int = []

for x in range(N):
    if i % 3 == 0 and i % 5 == 0 :
        x = 'FizzBuzz'
        List_str.append(x)
        i = i + 1
    elif i % 3 == 0 and i % 5 != 0 :
        x = 'Fizz'
        List_str.append(x)
        i = i + 1
    elif i % 5 == 0 and i % 3 != 0 :
        x = 'Buzz'
        List_str.append(x)
        i = i + 1
    else :
        List_int.append(i)
        i = i + 1

V = sum(List_int)
print(V)

Solution (Python):
N = int(input())

ans = 0
for n in range(1,N+1):
    if n%3 != 0 and n%5 != 0:
        ans += n

print(ans)

Solution (Python):
N = int(input())+1


 
cnt = 0
cnt1 = 0
 






 
sum=0
for i in range(N):
    if (i % 3) != 0 and (i % 5) != 0:
        sum = sum + i
        
 



 
print(sum)

Solution (Python):
n = int(input())

ans = 0

for i in range(1,n+1):
    if (i % 3 != 0) and (i % 5 != 0):
        ans += i
print(ans)

Solution (Python):
N = int(input())
 
L = []
for i in range(1, N+1):
    if i % 15 == 0:
        continue
    elif i % 3 == 0:
        continue
        L.append(i)
    elif i % 5 == 0:
        continue
    else:
        L.append(i)
 
print(sum(L))

Solution (Python):
n = int(input())

sum = 0
for i in range(1,n+1):
  if not (i % 3 == 0 or i % 5 ==0):
    sum += i
print(sum)

Solution (Python):
N=int(input())
sum=0
for i in range(N+1):
  if i%3!=0 and i%5!=0:
    sum+=i
print(sum)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

N = int(read())
x = np.arange(N + 1, dtype=np.int64)
x[::3] = 0
x[::5] = 0
print(x.sum())

Solution (Python):
N = int(input())

print(
    sum(
        filter(
            lambda x: bool(x % 3) and bool(x % 5),
            range(1, N+1)
        )
    )
)

Solution (Python):


def main():
    N = list(map(int, open(0).read().split()))
    N = N[0]
    print(sum([i for i in range (1, N + 1) if not (i % 3 == 0 or i % 5 == 0)]))

main()

Solution (Python):
n = int(input())
tot = sum(range(1, n + 1))
a = 0
b = 0
c = 0
for i in range(1, n // 3 + 1):
    a += 3 * i
for i in range(1, n // 5 + 1):
    b += 5 * i
for i in range(1, n // 15 + 1):
    c += 15 * i
ans = tot - (a + b) + c
print(ans)

Solution (Python):
n = int(input())

a = n//15
b = n//3
c = n//5
d,e,f,g = 0,0,0,0

for i in range(n+1):
    d = d+i
for j in range(a+1):
    e = e+j
for k in range(b+1):
    f = f+k
for l in range(c+1):
    g = g+l

h = d-(f*3)-(g*5)+(e*15)
print(int(h))

Solution (Python):
N = int(input())

ans = 0
for i  in range(N):
  if (i+1)%3 != 0 and (i+1)%5 != 0:
    ans = ans + (i + 1)


print(ans)

Solution (Python):
N = int(input())

ans = 0
for n in range(1,N+1):
    if n%3 != 0 and n%5 != 0:
        ans += n

print(ans)

Solution (Python):
n = int(input())
ans = []
for i in range(1, n+1):
    if i%3 == 0 or i%5 == 0 or i%15 == 0 :
        ans.append(0)
    else:
        ans.append(i)

print(sum(ans))

Solution (Python):
N = int(input())
list_a = []

for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        list_a.append(int(i))

print(sum(list_a))

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n + 1):
  if i % 3 != 0 and i % 5 != 0:
    ans = ans + i
print(ans)

Solution (Python):
import numpy as np

if __name__ == "__main__":
    N = int(input())
    num_ls = np.arange(1, N+1)
    n = num_ls[(num_ls % 5 != 0) & (num_ls % 3 != 0) & (num_ls % 15 != 0)].astype(np.float64)
    ret = 0
    ret = sum(n)
    print(int(ret))

Solution (Python):
n = int(input())
sum = 0
 
for i in range(n+1):
    if not(((i % 3 == 0) and (i % 5 == 0)) or (i % 3 == 0) or(i % 5 == 0)):
        sum += i
    
print(sum)

Solution (Python):
list = []
i = int(input())
for j in range(1,i+1):
    if j%3 == 0 or j%5 == 0:
        list.append(0)
    else:
        list.append(j)
print(sum(list))

Solution (Python):
def main():
    N = int(input())

    def fizzbuzz(i):
        if i % 3 == 0 and i % 5 == 0:
            return 'FizzBuzz'
        elif i % 3 == 0:
            return 'Fizz'
        elif i % 5 == 0:
            return 'Buzz'
        else:
            return i
    def is_int(v):
        return isinstance(v, int)
    ans = 0
    for k in range(1,N+1):
        if is_int(fizzbuzz(k)):
            ans += fizzbuzz(k)
    print(ans)
    return

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
print(sum([i for i in range(1, N + 1) if (i % 3) != 0 and (i % 5) != 0]))

Solution (Python):
n = int(input() )
 
sum=0
for i in range(n):

    j=i+1
    if j%3 != 0 and j%5 != 0:
        sum+=j
        

print(sum)

Solution (Python):
N = int(input())

ans = []
ans_num = 0
for i in range(N):
    s = i+1
    if(s%3 == 0 and s%5 == 0):
        ans.append("FizzBuzz")
    elif(s%3 == 0):
        ans.append("Buzz")
    elif(s%5 == 0):
        ans.append("Buzz")
    else:
        ans.append(s) 
        ans_num += s

print(ans_num)

Solution (Python):
N=int(input())
Fi=N//3
Bu=N//5
FiBu=N//15
def ans(x):
    return x*(x+1)//2
print(ans(N)-ans(Fi)*3-ans(Bu)*5+ans(FiBu)*15)

Solution (Python):
N = int(input())
result = 0
for i in range(N):
  a = i + 1
  if a%3 == 0:
    continue
  elif a%5 == 0:
    continue
  else:
    result += a
print(result)

Solution (Python):
N = int(input())
list_ = []
for n in range(1, N+1):
    if n % 3 != 0 and n % 5 != 0:
        list_.append(n)
print(sum(list_))

Solution (Python):
n=int(input())
n3=n//3
s3=(n3*3)*(n3+1)//2
n5=n//5
s5=((n5)*5)*(n5+1)//2
n15=n//15
s15=((n15)*15)*(n15+1)//2
 
s=n*(n+1)//2
s=s-s3-s5+s15
print(s)

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())

def LI(): return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number): return [LI() for _ in range(rows_number)]

n = int(input())
count = 0
for i in range(1, n+1):
    if i%3!=0 and i%5!=0:
        count+=i
print(count)

Solution (Python):
N = input()

fizz = []
buzz = []
fizzbuzz = []
x = 0

for n in range(1, int(N)+1):
  x += n
  if n % 3 == 0:
    fizz.append(n)
  if n % 5 == 0:
    buzz.append(n)
  if n % 15 == 0:
    fizzbuzz.append(n)

fizz = sum(fizz)
buzz = sum(buzz)
fizzbuzz = sum(fizzbuzz)
y = x - fizz - buzz + fizzbuzz
print(y)

Solution (Python):
N = int(input())

A=[]
for i in range(1,N+1):
    if  i % 3 != 0 and i % 5 != 0:
        A.append(i)

print(sum(A))

Solution (Python):
N = int(input())

x = 0

for i in range(N+1):
    
    if i % 15 == 0:
        
        pass
    elif i % 3 == 0:
        
        pass
    elif i % 5 == 0:
        
        pass
    else:
        x += i

print(x)

Solution (Python):
import sys
n = int(sys.stdin.readline())
t = 0
for i in range(n+1):
  if i%3 != 0 and i%5 != 0:
    t += i
print(t)

Solution (Python):
N = int(input())
FizzBizz = []
Fizz = []
Bizz = []
a = 0


for i in range(1 ,N+1):
    if i % 3 == 0 and i % 5 == 0:
        FizzBizz.append(i)
    elif i % 3 == 0:
        Fizz.append(i)
    elif i % 5 == 0:
        Bizz.append(i)
    else:
        a += i

print(a)

Solution (Python):
import sys, re
import math
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
 

 

 
n = INT()
sum = 0
 
for x in range(0, n + 1):
    if x % 3 != 0 and x % 5 != 0:
        sum += x
 
print(sum)

Solution (Python):


import sys

N = int(sys.stdin.readline())

nfizz = N // 3
nbuzz = N // 5
nfizzbuzz = N // 15

tot = (1 + N) * N // 2
tot_fizz = 3 * (1 + nfizz) * nfizz // 2
tot_buzz = 5 * (1 + nbuzz) * nbuzz // 2
tot_fizzbuzz = 15 * (1 + nfizzbuzz) * nfizzbuzz // 2

tot = tot - (tot_fizz + tot_buzz - tot_fizzbuzz)

print(tot)

Solution (Python):
N=int(input())

a=N//5
b=N//3
c=N//15

sum=N*(N+1)/2-5*a*(a+1)/2-3*b*(b+1)/2+15*c*(c+1)/2

print(int(sum))

Solution (Python):
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



N = I()
ans = 0
for i in range(1,N+1):
    if i%3 != 0 and i%5 != 0:
        ans += i

print(ans)

Solution (Python):
N=int(input())
i=0
k=0
ans=0
nums =[]
while(i<N+1):
    if(i%3!=0) and (i%5!=0):
        nums.append(i)
        k+=1
    i+=1
for k in range(0,k):
    ans+=nums[k]
print(ans)

Solution (Python):
N = int(input())

Not_Fizzbuzz = []

for i in range(1,N+1):
    if i % 15 == 0:
        pass
    elif i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        Not_Fizzbuzz.append(i)


print(sum(Not_Fizzbuzz))

Solution (Python):
n = int(input())
a = 0
for n1 in range(1, n+1):
    if n1%3 !=0 and n1%5!=0:
        a+=n1
print(a)

Solution (Python):
n=int(input())
ai = 0
s = 0
for i in range(n+1):
  ai = i
  if(i % 3 == 0 or i % 5 == 0):
    ai = 0
  s += ai

print(s)

Solution (Python):
N=int(input())
n=N//15
ans=60*(n**2)
if N%15==1:
	ans+=(1+15*(n))
elif N%15==2 or N%15==3:
	ans+=(3+30*(n))
elif N%15==4 or N%15==5 or N%15==6:
	ans+=(7+45*(n))
elif N%15==7:
	ans+=(14+60*(n))
elif N%15==8 or N%15==9 or N%15==10:
	ans+=(22+75*(n))
elif N%15==11 or N%15==12:
	ans+=(33+90*(n))
elif N%15==13:
	ans+=(46+105*(n))
elif N%15==14:
	ans+=(60+120*(n))
print(ans)

Solution (Python):

N=int(input())
fizz_buzz=list()
for i in range(1,N+1):
	if i%3==0 and i%5==0:
		fizz_buzz.append(0)
	elif i%3==0:
		fizz_buzz.append(0)
	elif i%5==0:
		fizz_buzz.append(0)
	else:
		fizz_buzz.append(i)

print(sum(fizz_buzz))

Solution (Python):


N = int(input())
S = 0
for i in range(1, N+1):
    if i%3==0 or i%5==0 or (i%3==0 and i%5==0):
        continue
    S+=i
print(S)

Solution (Python):
n = int(input())
sum = 0

i=1
while(i<n+1):
  if i%3==0 or i%5==0:
    pass
  else:
    sum+=i
  i+=1
    
print(sum)

Solution (Python):
n = int(input())
lst = list(range(n+1))

ans = 0
for i in range(len(lst)):
    if lst[i] % 3 != 0 and lst[i] % 5 != 0:
        ans += lst[i]

print(ans)

Solution (Python):
N = int(input())
sum = 0
for i in range(N+1):
    if i%3 ==0 or i%5==0:
        continue
    sum += i
print(sum)

Solution (Python):
n = input()

ans = 0
for i in range(0, int(n) + 1):
    r3 = i % 3
    r5 = i % 5

    if not (((r3 == 0) and (r5 == 0)) or (r3 == 0) or (r5 == 0)):
        ans += i

print(ans)

Solution (Python):
N = int(input())
count = 0

for i in range(1, N+1):
    if i%3 == 0:
        if i%5 == 0:
            pass
        pass
    elif i%5 == 0:
        pass
    else:
        count += i

print(count)

Solution (Python):
N = int(input())
sum = 0

for i in range(1,N+1):
    if not (i % 3  == 0) and not (i % 5 == 0):
        sum += i

print(sum)

Solution (Python):
def result(N):
    answer=0
    for i in range(N+1):
        if(i%3!=0):
            if(i%5!=0):
                answer+=i
    return answer

N = int(input())
print(result(N))

Solution (Python):
a = input()
sum = 0
for name in  range(int(a)+1):
    if name % 5 !=0 and name % 3 != 0:
        sum += name

print(sum)

Solution (Python):
i = int(input())
t1=i*(i+1)/2

i3=int(i/3)
t3=i3*(i3+1)/2*3

i5=int(i/5)
t5=i5*(i5+1)/2*5

i15=int(i/15)
t15=i15*(i15+1)/2*15

ans=int(t1-t3-t5+t15)
print(ans)

Solution (Python):
i = int(input())
a = []
for x in range(1, i+1):
    a.append(x)
x = 0
while x < len(a):
    if a[x] % 3 == 0:
        a[x] = 'Fizz'
    elif a[x] % 5 == 0:
        a[x] = "Buff"
    elif a[x] % 3 == a[x] % 5 == 0 :
        a[x] = 'FizzBuzz'
    x = x + 1
fil = [e for e in a if isinstance(e, int)]
print(sum(fil))

Solution (Python):
N=int(input())
count=0
for i in range(0,N+1):
    if i%3!=0 and i%5!=0:
        count=count+i
print(count)

Solution (Python):
N=int(input())
G=N//15
E=N%15
P=60*G*G
if E==0:
  k=0
elif E<=1:
  k=1+15*G
elif E<=3:
  k=3+30*G
elif E<=6:
  k=7+45*G
elif E<=7:
  k=14+60*G
elif E<=10:
  k=22+75*G
elif E<=12:
  k=33+90*G
elif E<=13:
  k=46+105*G
elif E<=14:
  k=60+120*G

print(P+k)

Solution (Python):
N = input()
N = int(N)
num = 0
 
for i in range(1,N+1):
    if i % 5 != 0 and i % 3 != 0 and i % 15 != 0:
        num += i
        
        
print(num)

Solution (Python):
N = int(input())
 
total = sum([i for i in range(1,N+1) if i%3!=0 and i%5!=0])
print(total)

Solution (Python):
N=int(input())+1
sum=0
for i in range(1,N):
  if(i%3==0 or i%5==0):
    continue
  else:
    sum+=i
print(sum)

Solution (Python):
N = int(input())
a = list()

for i in range(1,N+1):
    
    if i % 3 == 0:
        continue
    if i % 5 == 0:
        continue
    else:
        a.append(i)

print(sum(a))

Solution (Python):
n = int(input())

FB_list = []
FB_all = 0

for i in range(1,n+1):
    FB_all += i
    if (i % 3 == 0 and i % 5 == 0) or (i % 3 != 0 and i % 5 == 0) or (i % 3 == 0 and i % 5 != 0):
        FB_list.append(0)
    else:
        FB_list.append(i)
FB_non = sum(FB_list)
print(FB_non)

Solution (Python):
n=int(input())
ans=0
for i in range(1,n+1):
  if i%15==0:
    pass
  elif i%3==0:
    pass
  elif i%5==0:
    pass
  else:
    ans+=i
print(ans)

Solution (Python):

N = int(input())

total = 0

for i in range(N):

    if (i+1) % 15 == 0:
        pass
    elif (i+1) % 3 == 0:
        pass
    elif (i+1) % 5 == 0:
        pass
    else:
        total += (i+1)
        
print(total)

Solution (Python):
N = int(input())
n_list = [0 if (n % 15 == 0 or n % 3 == 0 or n % 5 == 0) else n for n in range(1,N+1)]
print(sum(n_list))

Solution (Python):
n = int(input())
count = 0
for i in range(1, n+1):
    if i % 3 != 0 and i % 5 != 0:
        count += i
print(count)

Solution (Python):
N=int(input())
i=1
sum=0
while(i<=N):
    if (i%3!=0) and (i%5!=0):
        sum+=i
    i=i+1

print(sum)

Solution (Python):
S=int(input())
a=int(S/15)
b=S%15
c=int(b/3)
d=int(b/5)
alls=(1+S)*S/2
print(int(alls-(60*a)-(105*a*(a-1)/2)-((1+c)*c*3/2)-((1+d)*d*5/2)-(c+d)*15*a))

Solution (Python):
def main():
    N = int(input())
    sum = 0
    for i in range(N+1):
        if i % 3 == 0:
            continue
        if i % 5 == 0:
            continue
        else:
            sum += i

    print(sum)
    
main()

Solution (Python):
N = int(input())
n3=N//3
n5=N//5
n15=N//15
S3 = 0.5*n3*(2*3+(n3-1)*3)
S5 = 0.5*n5*(2*5+(n5-1)*5)
S15 = 0.5*n15*(2*15+(n15-1)*15)
S=(N+1)*N/2
print(int(S-S3-S5+S15))

Solution (Python):
N = int(input())
a = [i+1 for i in range(N)]

S = 0
for x in range(1, N+1):
    if x % 15 == 0:
        a[x-1] = "FizzBazz"
    elif x % 3 == 0:
        a[x-1] = "Fizz"
    elif x % 5 == 0:
        a[x-1] = "Bazz"
    else:
        a[x-1] = x
        S += x
print(S)

Solution (Python):
n=int(input())
k=0
for i in range(n+1):
    if i%3!=0 and i%5!=0:
        k=k+i
print(k)

Solution (Python):
def main():
    N = int(input())
 
    def judge(n):
        if n % 15 == 0 or n % 3 == 0 or n % 5 == 0:
            return 0
        else:
            return n
 
    result = [judge(x) for x in range(N + 1)]
    print(sum(result))
 
if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=0
for i in range(1,n+1):
  if i%3!=0 and i%5!=0:
    a=a+i
print(a)

Solution (Python):
N = int(input())

fizzbuzz = N//15
fizz = N//3
buzz = N//5

ans = N*(N+1)/2 - 3*fizz*(fizz+1)/2 - 5*buzz*(buzz+1)/2 + 15*fizzbuzz*(fizzbuzz+1)/2
print(int(ans))

Solution (Python):
x = int(input())
ans = 0

for i in range(x+1):
  if i % 15 == 0 :
    pass
  elif i % 3 == 0:
    pass
  elif i % 5 == 0:
    pass
  else:
    ans += i

print(ans)

Solution (Python):
N = int(input())
last_fizz = (N // 3) * 3
last_buzz = (N // 5) * 5
last_fibu = (N // 15) * 15

N_sum = N * (N + 1) / 2
if N >= 3:
  fizz_sum = (N // 3) * (3 + last_fizz) / 2
  N_sum -= fizz_sum
if N >= 5:
  buzz_sum = (N // 5) * (5 + last_buzz) / 2
  N_sum -= buzz_sum
if N >= 15:
  fibu_sum = (N // 15) * (15 + last_fibu) / 2
  N_sum += fibu_sum
print(int(N_sum))

Solution (Python):
n=int(input())+1
sum=0
for i in range(1,n):
    if (i%3!=0 and i%5!=0):
        sum+=i
print(sum)