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())
total = 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:
        total += i
    

print(total)

Solution (Python):
import sys
N=int(sys.stdin.readline()[:-1])
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())
res = 0
for i in range(1, n+1):
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        res += i
print(res)

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

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

print(sum(fizzbuzz))

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

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

Solution (Python):

n = int(input())
count = 0
sum = 0
while count <= n:
    if count % 3 != 0 and count % 5 != 0:
        sum += count
    count += 1
print(sum)

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

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


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

print(c)

Solution (Python):
N=int(input())
M3,M5,M15=N//3,N//5,N//15
print((N*-~N-3*M3*-~M3-5*M5*-~M5+15*M15*-~M15)//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):
def main():
    N = int(input())
    res = 0
    for i in range(1, N+1):
        if i % 3 != 0 and i % 5 != 0:
            res += i
    print(res)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    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)


if __name__ == "__main__":
    main()

Solution (Python):
from sys import stdin


def __sum(n):
    return n*(n+1)//2


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0]) 
    
    cnt = __sum(N)-3*__sum(N//3)-5*__sum(N//5)+15*__sum(N//15)
    
    print(cnt)

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

for i in range(1,N+1):
  if i%3 != 0 and i%5 != 0:
    FB.append(i)
  else:
    FB.append(0)
    
for i in FB:
  ans += i
  
print(ans)

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

result = 0

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

print(result)

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

main()

Solution (Python):
n = int(input())
sum = 0
for i in range(n+1):
  if i%3 == 0 or i%5 == 0:
    sum += 0
  else:
    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())
P=0
for i in range(N+1):
    if i%3!=0 and i%5!=0:
        P+=i
print(P)

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

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

Solution (Python):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]


def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

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

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

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

N = int(input())
ans = 0
for i in range(1,N+1):
  ans += isFizzBuzz(i)

print(ans)

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

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

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

ans = 0

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

print(ans)

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

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

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

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

def calc(a, n_=n):
    nn = n_ // a
    l = nn * a
    return (a + l) * nn // 2 

s = calc(1)
fizz = calc(3)
buzz = calc(5)
fb = calc(15)
ans =  s - fizz - buzz + fb
print(ans)

Solution (Python):

N = int(input())


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

print(answer)

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

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

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

Solution (Python):
a = int(input())
three = int(a/3)
def tot(s, t):
    if t % 2 == 0:
        return s*(1 + t)*(t/2)
    elif t == 1:
        return s
    else:
        return s*(1 + t)*int(t/2) +s*(t+1)/2
three = int(a/3)
five = int(a/5)
one_five = int(a/15)
ans = tot(1, a) - tot(3, three) - tot(5, five) + tot(15, one_five)
print(int(ans))

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

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):
n=int(input())
l=[]
for i in range(n+1):
    if i%3==0:
        pass
    elif i%5==0:
        pass
    elif i%15==0:
        pass
    else:
        l.append(i)

        
print(sum(l))

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

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())
m = 0
for i in range(N+1):
  if not (i % 3 == 0 or i % 5 == 0):
    m += i
 
print (m)

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

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


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

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

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

sum = (1 / 2 * num * (num + 1))

t = num // 3
f = num // 5
c = num // 15

three = (t * ((t * 3) + 3) / 2)
five = (f * ((f * 5) + 5) / 2)
com = (c * ((c * 15) + 15) / 2)

print(int(sum - three - five + com))

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

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

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

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 and 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:
        continue
    elif i%3 == 0:
        continue
    elif i%5 == 0:
        continue
    else:
        ans += i
        
print(ans)

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

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):
n = int(input())
ans = 0

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

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

Solution (Python):
N = int(input())
ans = sum([i for i in range(N+1) if i%3!=0 and i%5!=0])
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())
count = 0
for n in range(N+1):
  if n%3!=0 and n%5!=0:
    count += n       
print(count)

Solution (Python):
N = input()
l = []
sum = 0
for i in range(int(N)+1):
  if (not i%3 == 0) and (not i%5) == 0:
    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())

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

print(ans)

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

a = []


for x in range(1,n+1):
	if x % 5 != 0 and x % 3 != 0:
		a.append(x)

print(sum(a))

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

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

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

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

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

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

p = N//3
q = N//5
r = N//15

pp = p*(p+1)*3/2
qq = q*(q+1)*5/2
rr = r*(r+1)*15/2

print(int(s-pp-qq+rr))

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 or i % 5 == 0:
        continue
    ans += i
print(ans)

Solution (Python):
n = int(input())
Sum = 0.5 * n * (1 + n)

Sum3_5 = 0.5*(int(n/3)*(3+3*int(n/3))+int(n/5)*(5 + 5*int(n/5)))
Sum15 = 0.5 * (int(n / 15) * (15 + int(n / 15) * 15))

print(int(Sum-Sum3_5+Sum15))

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

Solution (Python):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    t = 0
    for i in range(n + 1):
        if i % 3 != 0 and i % 5 != 0:
            t += i
    print(t)


if __name__ == '__main__':
    solve()

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

l = [i for i in range(n+1) if i % 3 != 0 and i % 5 != 0]

print(sum(l))

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

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    res = 0
    for i in range(1, n + 1):
        if i % 3 and i % 5:
            res += i
    print(res)
resolve()

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

ans = [i for i in range(1, N + 1) if i % 3 != 0 and i % 5 != 0]
print(sum(ans))

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

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

m15=int(N//15)
T15=(1+m15)*m15/2*15


m5=int(N//5)
T5=(1+m5)*m5/2*5


m3=int(N//3)
T3=(1+m3)*m3/2*3


print(int(Total-T3-T5+T15))

Solution (Python):
N = int(input())
s3 = ((N//3-1)*3+6)*(N//3)//2
s5 = ((N//5-1)*5+10)*(N//5)//2
s15= ((N//15-1)*15+30)*(N//15)//2
st = (N+1)*N//2

ans= st-s3-s5+s15
print(ans)

Solution (Python):

def gauss(n):
    return n * (n+1) // 2

n = int(input())
ans =  gauss(n) - gauss(n//3) * 3 - gauss(n//5) * 5 + gauss(n//15) * 15

print(ans)

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

def inputlist(): return [int(k) for k in input().split()]

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

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

N += 1
total = 0

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

print(total)

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

ans = 0

for i in range(0, n + 1):
    if (i % 3 and i % 5):
        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):
from math import gcd


def lcm(a, b):
    return a * b // gcd(a, b)


def total(x):
    return x * (n // x) * (n // x + 1) // 2


n = int(input())

a, b = 3, 5

print(total(1) - total(a) - total(b) + total(lcm(a, b)))

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

Solution (Python):


N=int(input())



def pront(*n):
    if debug==1:
        print(n)
        
debug=1


x=0

x+=N*(N+1)//2


Z=N//3
x-=3*Z*(Z+1)//2


Z=N//5
x-=5*Z*(Z+1)//2


Z=N//15
x+=15*Z*(Z+1)//2

print(x)

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

Solution (Python):
N = int(input())
Fizz = int(N / 3)
Buzz = int(N / 5)
FizzBuzz = int(N / 15)
Answer =  int((N * ( N + 1) / 2)
              - (3 * Fizz * (Fizz + 1) / 2)
              - (5 * Buzz * (Buzz + 1) / 2)
              + (15 * FizzBuzz * (FizzBuzz + 1) / 2))
print(Answer)

Solution (Python):
n=int(input())
ans=0
q=n//15
for i in range(q):
  ans+=1+15*i
  ans+=2+15*i
  ans+=4+15*i
  ans+=7+15*i
  ans+=8+15*i
  ans+=11+15*i
  ans+=13+15*i
  ans+=14+15*i
p=n%15
a=p//3
b=p//5
for i in range(1,p+1):
  ans+=i+15*q
for i in range(1,a+1):
  ans-=3*i+15*q
for i in range(1,b+1):
  ans-=5*i+15*q
print(ans)

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

Solution (Python):
import numpy as np
n=int(input())
a=np.arange(n+1,dtype=np.int64)
a[::3]=0
a[::5]=0
print(a.sum())

Solution (Python):
n = int(input())
s = 0
for i in range(1, 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())
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())

t=0

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

print(t)

Solution (Python):



import sys
input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

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

cnt = 1
sum,sum_result = 0,0

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

Solution (Python):
def main():
    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)

if __name__ == "__main__":
    main()

Solution (Python):



import sys
input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

Solution (Python):
N = input()
lit_N = []
for i in range(int(N)+1):
  if i % 5 == 0 and i % 3 == 0:
    lit_N.append("FizzBuzz")
  elif i % 3 == 0:
    lit_N.append("Fizz")
  elif i % 5 == 0:
  	lit_N.append("Buzz")
  else:
    lit_N.append(i)
print(sum(list(filter(lambda x: isinstance(x,int), lit_N))))

Solution (Python):
import math
N = int(input())
S = int(N*(N+1)/2)
S -= 3*int(math.floor(N/3)*(math.floor(N/3)+1)/2)
S -= 5*int(math.floor(N/5)*(math.floor(N/5)+1)/2)
S += 15*int(math.floor(N/15)*(math.floor(N/15)+1)/2)
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):
ans=0
for i in range(1,int(input())+1):
  if i%3>0 and i%5>0:
    ans += i
print(ans)

Solution (Python):
a = int(input())
ans =0
for i in range(a+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):
import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
import numpy as np

INF = float('inf')
NIL = - 1


def main():
    N = int(input())
    arr = np.arange(N + 1)
    arr[::3] = 0
    arr[::5] = 0
    print(sum(arr))

    
    
    
    
    
    
    
    
    
    
    


if __name__ == '__main__':
    main()

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())
def t(k):
  return k*(k+1)//2
print(t(n)-3*(t(n//3))-5*(t(n//5))+15*(t(n//15)))

Solution (Python):
def solve():

    N = int(input())

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

    print(ans)


if __name__ == "__main__":
    solve()

Solution (Python):
def S(n):
  return n*(n+1)//2

N = int(input())
print(S(N)-S(N//3)*3-S(N//5)*5+S(N//15)*15)
15

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

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

print(ans)

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

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

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

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

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

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

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

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


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

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):
x = int(input())
total = 0
for i in range(1, x+1):
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        total += i
print(total)

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 i%3!=0 and i%5!=0:
        s=s+i
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
    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):
def nsum(n):
	return (n * (n + 1)) // 2

def contains(s):
	ans = nsum(s) - nsum(s // 3) * 3 - nsum(s // 5) * 5 + nsum(n // 15) * 15
	return ans


n = int(input())
print(contains(n))

Solution (Python):

def main():
    N = int(input())
    is_fizzbuzz = [False] * (N + 1)
    is_fizzbuzz[::3] = [True] * (N // 3 + 1)
    is_fizzbuzz[::5] = [True] * (N // 5 + 1)
    ans = sum(i for i, b in enumerate(is_fizzbuzz) if not b)
    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):
k = 0
def fizz(n,k):
    for ele in range(n+1):
        if ele%15==0:
            continue
        elif ele%3 == 0:
            continue
        elif ele%5 == 0:
            continue
        else:
            k += ele
    return k
n = int(input())
print(fizz(n,0))

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

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

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

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

Solution (Python):


import sys
from itertools import accumulate

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()

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

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

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

print(total)

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

Solution (Python):
print(sum(i%3>0<i%5and i 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:
        pass 
    elif i%3==0:
        pass 
    elif i%5==0:
        pass 
    else:
        sum+=i 
print(sum)

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

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

print(result)

Solution (Python):

import sys


def solve(N: int):
    ans = []
    for i in range(1, N+1):
        if i % 3 == 0 or i % 5 == 0:
            continue
        ans.append(i)
    print(sum(ans))
    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())
sum = 0
for i in range(1, n+1):
    if i%3!=0 and i%5!=0:
        sum += i

print(sum)

Solution (Python):
import sys

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

def main():
    ans = sum([x for x in range(1, n + 1) if x % 3 and x % 5])
    print(ans)

if __name__ ==  '__main__':
    main()

Solution (Python):
print(sum(filter(lambda x:(x%3!=0 and x%5!=0),range(1,int(input())+1))))

Solution (Python):

import sys


def solve(N: int):
    ans = []
    for i in range(1, N+1):
        if i % 3 == 0 or i % 5 == 0:
            continue
        ans.append(i)
    print(sum(ans))
    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())
sumval = 0
for i in range(N + 1):
    if i % 3 != 0 and i % 5 != 0:
        sumval += i
print(sumval)

Solution (Python):
from functools import lru_cache

N = int(input())
 
@lru_cache(maxsize=1000)
def main(K):
    ans = 0
    for i in range(1, N+1):
        if i % 15 != 0 and i % 3 != 0 and i % 5 != 0:
            ans = ans + i
    return(ans)
 
print(main(N))

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

Solution (Python):
def f(n):
    if n % 3 == 0 or n % 5 == 0:
        return 0
    return n


N = int(input())
ans = 0
for n in range(1, 1 + N):
    ans += f(n)
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):
n = int(input())


def sum(a, b):
    return int((a+1)*a/2*b)


fizz_num = n//3
buzz_num = n//5
fizzbuzz_num = n//15


print(sum(n, 1)-sum(fizz_num, 3)-sum(buzz_num, 5)+sum(fizzbuzz_num, 15))

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

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

print(sum(A))