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())
 
s = 0
for n in range(1, N+1):
    if n % 3 != 0 and n % 5 != 0:
        s += n
print(s)

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):
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())
ans = 0
for a in range(1, N+1):
    if a % 3 != 0 and a % 5 != 0:
        ans += a

print(ans)

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

Solution (Python):

import sys
N=input()
N=int(N)
a=int(N/3)
b=int(N/5)
c=int(N/15)
S=N*(N+1)/2 - 3*a*(a+1)/2 - 5*b*(b+1)/2 + 15*c*(c+1)/2
print(int(S))

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

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

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

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

print(ans)

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

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

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

Solution (Python):
import numpy as np
N=input()
a=np.arange(np.float(N))+1
a=np.where(a%3==0.,0,a)
a=np.where(a%5==0.,0,a)
print(int(sum(a)))

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())
i = 1
result = 0
while i <= N:
    if i % 3 != 0 and i % 5 != 0:
        result += i
    i += 1
print(result)

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):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

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

    sum += i

print(sum)

Solution (Python):
N = int(input())
sequence = list(range(1, N + 1))
for i in range(len(sequence)):
    num = sequence[i]
    if num % 3 == 0 and num % 5 == 0:
        sequence[i] = "FizzBuzz"
    elif num % 3 == 0:
        sequence[i] = "Fizz"
    elif num % 5 == 0:
        sequence[i] = "Buzz"
total = 0
for i in sequence:
    if isinstance(i, int):
        total += i
print(total)

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

print(FBSum)

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

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

f  = int(N/3)
b  = int(N/5)
fb = int(N/15)

sum = int(N*(N+1)/2)

for i in range(1, f+1):
    sum -= i*3
for i in range(1, b+1):
    sum -= i*5
for i in range(1, fb+1):
    sum += i*15
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())
List = []
for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        List.append(i)
print(sum(List))

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

print(sum([x for x in range(1, N+1) if x % 3 and x % 5]))

Solution (Python):

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

q2()

Solution (Python):
a = input()
aList = []
for i in range(1,int(a)+1):
    if i%3 == 0 and i%5 == 0:
        pass
        
    elif i%3 == 0:
        pass
        
    elif i%5 == 0:
        pass
        
    else:
        aList.append(i)
        
ans = 0
for _,b in enumerate(aList):
    ans = ans + b
print(ans)

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

a = 0

for i in range(1, n + 1):
    unko1 = i % 3 == 0
    unko2 = i % 5 == 0
    unko3 = i % 15 == 0

    if unko3 or unko2 or unko1:
        a += 0
    else:
        a += i

print(a)

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

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

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):
import itertools

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())

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

print(a-b-c+d)

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):
n=int(input())
ans=0
for i in range(1+n):
    if i%5==0:
        continue
    if i%3==0:
        continue
    ans+=i
print(ans)

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

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

def FB(n):
  if n%3 != 0 and n%5 !=0:
    return n
  else:
    return False

ans = 0
for i in range(N+1):
  ans += FB(i)

print(ans)

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

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

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

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

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

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

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

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

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

print(ans)

Solution (Python):
n=int(input())
li=[]
for i in range(n+1):
    if i%3!=0:
        if i%5!=0:
            li.append(i)
s=sum(li)
print(s)

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

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

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

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

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

print(cnt)

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

main()

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())

_sum = N * (1+N)/2

if N >= 3:
  _min = 3
  _max = 3 * (N // 3)
  num = (_max - _min) / 3 + 1
  _sum -= num*(_min+_max)/2

if N >= 5:
  _min = 5
  _max = 5 * (N // 5)
  num = (_max - _min) / 5 + 1
  _sum -= num*(_min+_max)/2

if N >= 15:
  _min = 15
  _max = 15 * (N // 15)
  num = (_max - _min) / 15 + 1
  _sum += num*(_min+_max)/2

print(int(_sum))

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

ans = 0

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


print(ans)

Solution (Python):
import sys
input = sys.stdin.readline  

n = int(input().replace("\n",""))

anslist = []

for i in range(1, n+1):
    
    if i % 15 == 0:
        continue
        
    elif i % 3 == 0:
        continue
        
    elif i % 5 == 0:
        continue
        
    else:
        anslist.append(i)
        

print(sum(anslist))

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

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

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

print(sum(fizzbuzz))

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

A = 0

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

print(A)

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

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

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

sum = 0

for i in range(N):
    if not (i+1) % 3 == 0:
        if not (i+1) % 5 == 0:
            sum += i+1
    
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())
ans=0
for i in range(1,n+1):
	if i%3!=0 and i%5!=0:
		ans+=i
print(ans)

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

result = 0
for num in range(1, a+1):
  if (num%3 != 0) & (num%5 != 0):
    result += num
    
print(result)

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())
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())
ans = 0

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

Solution (Python):


num = int(input())
sumnum = []


for i in range(1, num+1):
    if i % 3 == 0:
        ifThree = True
    else:
        ifThree = False
        
    if i % 5 == 0:
        ifFive = True
    else:
        ifFive = False
    
    if (ifThree == False and ifFive == False):
        sumnum.append(i)

print(sum(sumnum))

Solution (Python):
def sum(i):
    return (i * (i + 1)) // 2

n = int(input())
fizz_num = n // 3
buzz_num = n // 5
fizzbuzz_num = n // 15
ans = sum(n) - 3 * sum(fizz_num) - 5 * sum(buzz_num) + 15 * sum(fizzbuzz_num)
print(ans)

Solution (Python):
a = int(input())
  
set3 = set(range(0, a+1, 3))
set5 = set(range(0, a+1, 5))
seta = set(range(0, a+1))
 
print(sum(seta-set3-set5))

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

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

print(sum_num)

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

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

Solution (Python):
inputbox=int(input())
sum=0
for i in range (inputbox+1):
  if (i%3==0 or i%5==0):
    pass
  else:
    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())

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

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

num_set = set(i for i in range(1, range_num+1))

ex_set = set(i for i in range(1, range_num+1) if i%3 == 0 or i%5==0)
ans_set = num_set - ex_set

print(sum(ans_set))

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

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())
s1, s2, s3, s4 = 0, 0, 0, 0
for i in range(1, n+1):
  s1 += i
  if i % 3 == 0:
    s2 += i
  if i % 5 == 0:
    s3 += i
  if i % 15 == 0:
    s4 += i
print(s1 - (s2 + s3 - s4))

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())

sum = 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
    sum += i
print(sum)

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

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

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

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

print(sum)

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

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

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

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

print(sum(FB))

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):
import sys
 
X = int(input())
count = 0
for num in range(1, X+1):
  if num % 3 == 0 or num % 5 == 0:
    continue
  else:
    count = count + num
print(count)

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

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):
import sys
import numpy as np

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




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())

a=0
for i in range(1,N+1):
    if i%3 == 0:
        b = 0
    elif i%5 == 0:
        b = 0
    else:
        b = i
    a = a + b
        
print(a)

Solution (Python):

import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

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

if __name__ == '__main__':
    main()

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

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

Solution (Python):
from sys import stdin



N = int(stdin.readline().rstrip().split()[0])
Sum = 0

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

print(Sum)

Solution (Python):



N = int(input())

ans = 0

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

print(ans)

Solution (Python):



n = int(input())
ans = 0

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

print(ans)

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):
s = int(input())
count = 0
for i in range(s+1):
    if i%3 == 0:
        continue
    elif i % 5 == 0:
        continue
    else:
        count += i
    
print(count)

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())
import numpy as np
narray=np.array(range(n+1))
tempsum=[]
for i in narray:
    if i%3!=0 and i%5!=0:
        tempsum.append(i)
        
print(np.sum(tempsum))

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

Solution (Python):
N = int(input())
sum15 = 0
sum3 = 0
sum5 = 0
"""
a = []
for i in range(1,N+1):
    if i%15==0:
        pass
        
    elif i%5==0:
        pass
        
    elif i%3==0:
        pass
        
    else:
        
        sum += i
"""
sumA = int(N*(N+1)/2)

for i in range(3,N+1,3):
    
    sum3 += i

for i in range(5,N+1,5):
    
    sum5 += i

for i in range(15,N+1,15):
    
    sum15 += i

suma = int(sumA - sum3 - sum5 + sum15)
print(suma)

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())
sequence=list(range(1,N+1))
for i in range(len(sequence)) :
    num=sequence[i]
    if num %3==0 and num%5==0:
        sequence[i]="FizzBuzz"
    elif num%3==0:
        sequence[i]="Fizz"
    elif num%5==0:
        sequence[i]="Buzz"
total=0
for i in sequence:
    if isinstance(i,int):
        total+=i
print(total)

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())
a = 0
for i in range(N):
  x =i+1
  if x%3!=0 and x%5!=0:
    a+=x
print(a)

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

    print(sum)




if __name__ == "__main__":
    main()

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())

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

print(sum)

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

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

count = 0
for i in range(int(N)+1):
    if i % 15 == 0:
        continue
    elif i % 5 ==0:
        continue
    elif i % 3 ==0:
        continue
    else:
        count += i
print(count)

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

Nlist = list(range(N+1))


sumList = []
for i in Nlist:
    if(i % 3 != 0 and i % 5 != 0 and i % 15 != 0):
        sumList.append(i)
print(sum(sumList))

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

print(cnt)

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

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

print(s)

Solution (Python):
n=int(input())
print((n*(n+1)//2)-(n//3*(n//3+1)//2)*3-(n//5*(n//5+1)//2)*5+(n//15*(n//15+1)//2)*15)

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):
num = int(input())
result = 0
for fizzbuzz in range(1, num+1):
    if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0:
        continue
    elif fizzbuzz % 3 == 0:
        continue
    elif fizzbuzz % 5 == 0:
        continue
    
    result += fizzbuzz

print(result)

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):
line = int(input())

num = range(1,line + 1)

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

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

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

Solution (Python):
def func_sum_(fast, N):
    last = fast * int(N / fast)
    return int((fast + last) / 2. * (last / fast))
    
def main():
    args = input().rstrip().split(' ')
    N = int(args[0])
    sum_ = int((N+1) * N / 2)
    print(sum_ - (func_sum_(3, N) + func_sum_(5, N) - func_sum_(15, N)))
    
if __name__ == "__main__":
    main()

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

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

Solution (Python):

n=int(input())

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

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

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

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

Solution (Python):
N=int(input())
a=N*(N+1)//2
for i in range(1,N+1):
  if(i%3==0 or i%5==0):
    a-=i
print(a)

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())

ans = 0

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

print(ans)

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

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

s = 0

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

print(s)

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

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

print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(N+1):
    if i%15 != 0 and 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:
    c += i
print(c)

Solution (Python):
import sys
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))

def main():
    n = getN()
    ans = 0

    for i in range(n + 1):
        if (i % 3) != 0 and (i % 5) != 0:
            ans += i
    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())
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())
s = 0
for i in range(1, n + 1):
    if not (i % 3 == 0 or i % 5 == 0):
        s += i
print(s)

Solution (Python):
N = int(input())
     
def FizzBuzz(n):
  if n % 3 == 0 or n % 5 == 0:
    return 0
  else:
    return n
     
ans = sum(list(map(FizzBuzz, range(1, N+1))))
print(ans)

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

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

Solution (Python):
N=int(input())
import math
ans=(N+1)*N//2

ans-=(N//3)*(N//3*3+min(3,N//3*3))//2
ans-=(N//5)*(N//5*5+min(5,N//5*5))//2
ans+=(N//15)*(N//15*15+min(15,N//15*15))//2
print(ans)

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

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
for i in range(n + 1):
  if i % 3 != 0 and i % 5 != 0:
    sum += i

print(sum)

Solution (Python):
n = int(input())
A = list(range(1,n+1))
S = sum (A)

a = n//3
b = sum(list(range(1,a+1)))
c = n//5
d = sum(list(range(1,c+1)))
e = n//15
f = sum(list(range(1,e+1)))

print(S-3*b-5*d+15*f)

Solution (Python):
n = int(input())
m = n//15
l = n%15
x = 60*(m**2)
y = [0,1,2,0,4,0,0,7,8,0,0,11,0,13,14,0]
for i in range(1,l+1):
    if(y[i] != 0):
        x += y[i]+m*15
print(x)

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

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())
fizzbuzz = []
for i in range(1,N+1):
    if i % 5 != 0 and i % 3 != 0:
        fizzbuzz.append(i)

print(sum(fizzbuzz))

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())
count = []
for i in range(1, N+1):
    if ((i % 3) == 0) and ((i % 5) == 0):
        pass
    elif (i % 3) == 0:
        pass
    elif (i % 5) == 0:
        pass
    else:
        count.append(i)
print(sum(count))

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

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

print(R)

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

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):

import sys


def solve(N: int):
    sum = 0
    for i in range(1, N+ 1):
        if i % 5 != 0 and i % 3 != 0:
            sum += i
    print(sum)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
l = 1
li = []
while l < n+1:
  if l % 3 == 0 and l % 5 == 0 or l % 3 == 0 or l % 5 == 0:
    l+=1
  else:
    li.append(l)
    l+=1

print(sum(li))

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

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

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())
sum_n=0
for i in range(n+1):
    if i%3==0:
        pass
    elif i%5==0:
        pass
    else:
        sum_n+=i
print(sum_n)

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

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

print(Sum)

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

for i in range(1, a+1):
    if i % 15 == 0:
        continue
    if i % 5 == 0:
        continue
    if i % 3 == 0:
        continue
    n += i

print(n)

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

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())
A=N//3
B=N//5
C=N//15
print(N*(N+1)//2-A*(A+1)//2*3-B*(B+1)//2*5+C*(C+1)//2*15)

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

all=0

for i in range(1,N+1):
    all+=i

S=0

for i in range(1,N+1):
    if i%3==0:
        S+=i
    elif i%5==0:
        S+=i
    elif i%15==0:
        S-=i
        
print(all-S)

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):
import sys
import numpy as np
import math


from collections import deque 
from functools import reduce
 

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

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

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

Solution (Python):
n = int(input())
s = int(n*(n+1)/2)

n3 = n//3
l3 = n-n%3
s3 = int(n3*(3+l3)/2) if n>=6 else 3

n5 = n//5
l5 = n-n%5
s5 = int(n5*(5+l5)/2) if n>=10 else 5

n15 = n//15
l15 = n-n%15
s15 = int(n15*(15+l15)/2) if n>=30 else 15

if n<3:
  print(s)
elif n<5:
  print(s-s3)
elif n<15:
  print(s-s3-s5)
else:
  print(s-s3-s5+s15)

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

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

x = 0

for i in range(1,N+1):
    if i % 3 == 0:
        continue

    if i % 5 == 0:
        continue

    x += i


print(x)

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

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

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

print(sum)

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

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

print(ans)

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

N_fi = N//3
N_bu = N//5
N_fb = N//15

Sn = N*(1+N)/2
S_fi_n = N_fi/2*(2*3 + (N_fi - 1)*3)
S_bu_n = N_bu/2*(2*5 + (N_bu - 1)*5)
S_fb_n = N_fb/2*(2*15 + (N_fb - 1)*15)

print(int(Sn - S_fi_n - S_bu_n + S_fb_n))

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

Solution (Python):




N = int(input())
M = 1
answer = 0
while M <= N:
    if (M % 3 != 0) & (M % 5 != 0):
        answer += M
        M = M + 1
    else:
        M = M + 1
print(answer)