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

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

Solution (Python):
import itertools
import math
import fractions
import functools
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().rstrip())
result = 0
for i in range(1, N + 1):
    if i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        result = result + i

print(result)

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

r = sum(filter(lambda x: x % 3 != 0 and x % 5 != 0, [i for i in range(1, N+1)]))

print(r)

Solution (Python):
n = int(input())
suma = 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):
        suma = i + suma
    
print(suma)

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

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

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

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

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

list = [i for i in range(1, N+1) if not (i % 3 == 0 or i % 5 ==0)]

print(sum(list))

Solution (Python):
N=int(input())
A=[]
for i in range(N):
    A.append(i+1)
s=1
while 3*s<=N:
    A[3*s-1]=0
    s=s+1
s=1
while 5*s<=N:
    A[5*s-1]=0
    s=s+1
sum=0
for i in range(N):
    sum+=A[i]
print(sum)

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

list = [i for i in range(1, N+1) if not (i % 3 == 0 or i % 5 ==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 or i%15==0:
        total+=0
    else:
        total+=i
print(total)

Solution (Python):
K = int(input())
x = (K+1) * K//2
num_devisible_three = (3+3*(K//3))*(K//3)//2
num_devisible_five = (5+5*(K//5))*(K//5)//2
num_devisible_fifteen = (15+15*(K//15))*(K//15)//2
print(x-num_devisible_three-num_devisible_five+num_devisible_fifteen)

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

print(c)

Solution (Python):
k = int(input())
a = (1 + k) * k // 2
three = (3+3*(k//3)) * (k // 3) // 2
five = (5+5*(k//5)) * (k // 5) // 2
fifteen = (15+15*(k//15)) * (k // 15) // 2
print(a-three-five+fifteen)

Solution (Python):


from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

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

Solution (Python):
i=int(input())
a=0
while i>0:
    if i%3==0 and i%5==0:
        pass
    elif i%3==0:
        pass
    elif i%5==0:
        pass
    else:
        a+=i
    i-=1
print(a)

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


from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

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

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

print(answer)

Solution (Python):



import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf



import math

import bisect


if __name__ == '__main__':
    n = int(input())
    s = 0
    for v in range(n + 1):
        if v % 3 == 0 or v % 5 == 0:
            continue
        s += v
    
    print(s)

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

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

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

Solution (Python):
N = int(input())
sum = 0
for i in range(1, N+1):
  sum = sum + i
for j in range(0, N+1, 3):
  sum = sum - j
for k in range(0, N+1, 5):
  sum = sum - k
for l in range(0, N+1, 15):
  sum = sum + l
print(sum)

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

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

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

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

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

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

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

print(ans)

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

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

print(cnt)

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

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

Solution (Python):

n = int(input())
f = n - n % 3
b = n - n % 5
fb = n - n % 15

ans = n*(n+1)/2 - f*(f+3)/6 - b*(b+5)/10 + fb*(fb+15)/30
print(int(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())

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

print(num)

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

print(count)

Solution (Python):
if __name__ == "__main__":
    N = int(input())
    total = 0
    for idx in range(1, N+1):
        if idx % 3 > 0 and idx % 5 > 0:
            total += idx
    print(total)

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

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

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
import os
import bisect, collections, copy, itertools, math, string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int, input().split()))
def LS(): return list(input().split())

def solve():
	N = I()

	def fizzBuzz(i):
		if i % 15 == 0:
			return 0
		elif i % 3 == 0:
			return 0
		elif i% 5 == 0:
			return 0
		else:
			return i

	a = 0
	for i in range(1, N+1):
		a += fizzBuzz(i)

	print(a)

if __name__ == '__main__':
	solve()

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

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

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

print(ans)

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

a = [i for i in range(1, n + 1) if not i % 3 == 0]
ans = list(filter(lambda x: not x % 5 == 0, a))

print(sum(ans))

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

print(counter)

Solution (Python):
N=int(input())
print(sum(range(N+1))-3*sum(range((N//3)+1))-5*sum(range((N//5)+1))+15*sum(range((N//15)+1)))

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):
def fb(n):
    if n % 5 == 0 & n % 3 == 0:
        return 0
    elif n % 3 == 0:
        return 0
    elif n % 5 == 0:
        return 0
    else:
        return n


n = int(input())
l = []
for i in range(n + 1):
    l.append(fb(i))
print(sum(l))

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = lambda: sys.stdin.readline().strip()

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

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

Solution (Python):
import numpy as np


def main():
    n = int(input())
    ns = np.array(list(range(1, n+1)))
    ans = np.sum(ns[np.where((ns % 3 != 0) & (ns % 5 != 0))])
    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):

n = int(input())
t = [0]*(n+1)

for i in range(n+1):
    if i%15 == 0 or i%5 == 0 or i%3 == 0:
        t[i] = 0
    else:
        t[i] = i
print(sum(t))

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

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

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

s = n*(n+1)//2

n3 = n//3
s3 = n3*(n3*3+3)//2
n5 = n//5
s5 = n5*(n5*5+5)//2
n15 = n//15
s15 = n15*(n15*15+15)//2

print(s-s3-s5+s15)

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

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

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

Solution (Python):
from sys import stdin


def main():
    n = int(stdin.readline())
    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())

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

Solution (Python):
N = int(input())
FizzBuzz = []
Fizz = []
Buzz = []
ano = []
plus = 0
for i in range(N+1):
    if i % 3 == 0 and i % 5 == 0:
        FizzBuzz.append(i)
    elif i % 3 == 0:
        Fizz.append(i)
    elif i % 5 == 0:
        Buzz.append(i)
    else:
        ano.append(i)
for a in ano:
    plus += a

print(plus)

Solution (Python):
import math

n=int(input())
z15=math.floor(n/15)
p15=n%15

base=int(z15*60+z15*(z15-1)*60)

z=z15*15
for x in range(z+1,n+1):
  if not (x%3==0 or x%5==0):
    base+=x
    
print(base)

Solution (Python):
import sys

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

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


n = int(input())
print(int(calc(n) - (calc(n // 3) * 3 + calc(n // 5) * 5 - calc(n // 15) * 15)))

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(N+1):
  if i%5==0 or i%3==0:
    pass
  else:
    a+=i
print(a)

Solution (Python):


N = int(input())

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

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

Solution (Python):
array_length = int(input())
array_sum = 0
fizzbuzz_list = [3,5,15]

for i in range(array_length):
    loop_num = i + 1
    flag = 0
    for n in fizzbuzz_list:
        if loop_num % n == 0:
            flag = 1
    if flag == 0:
        array_sum = array_sum + loop_num

print(array_sum)

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

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

Solution (Python):

"""
Created on Wed May  6 01:07:46 2020

@author: shinba
"""
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%5!=0 and i%3!=0:
    a=a+i
print(a)

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

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

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

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



def main():
    N = int(input())
    ans = 0

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

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

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

print(str(su))

Solution (Python):
n = int(input())
a = []

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

Solution (Python):
n = int(input()) + 1
a = set(range(0, n))
fs = set(range(0, n, 3))
bs = set(range(0, n, 5))
print(sum(a - fs - bs))

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

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

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

if n == 1:
    print('1')
    exit(0)

sum_n = int((1 + n) / 2 * n)
n3 = n // 3
n5 = n // 5
n15 = n // 15

sum_n3 = int((1 + n3) / 2 * n3) * 3
sum_n5 = int((1 + n5) / 2 * n5) * 5
sum_n15 = int((1 + n15) / 2 * n15) * 15

res = sum_n - sum_n3 - sum_n5 + sum_n15
print(res)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    r = sum(i for i in range(1, n+1) if i % 3 > 0 and i % 5 > 0)

    return r


print(main())

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

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

count = 0

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

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

Solution (Python):
n = int(input())
l = list(range(1,n+1))
fz = list(range(3,n+1,3))
bz = list(range(5,n+1,5))
fzbz = list(range(15,n+1,15))
a = sum(l)-sum(fz)-sum(bz)+sum(fzbz)
print(a)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

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 LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    n = II()
    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)

if __name__ == '__main__':
    solve()

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

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

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

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 = [0]*n
for i in range(1,n+1):
  if (i%3==0 and i%5==0) or i%3==0 or i%5==0:
    continue
  else:
    a[i-1] += i

print(sum(a))

Solution (Python):
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=q
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)

N = readInt()
ans = 0

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

print(ans)

Solution (Python):
N=1
a=int(input())
ans=0
while N<=a :
  if N%3==0 and N%5==0 :
    pass
  elif N%3==0 :
    pass
  elif N%5==0 :
    pass
  else :
    ans+=N
  N+=1
print(ans)

Solution (Python):
i=1
a = int(input())
ans = 0
while i <= a:
  if i % 3 == 0 and i % 5 == 0:
    pass
  elif i % 3 == 0:
    pass
  elif i % 5 == 0:
    pass
  else:
    ans += i
  i += 1
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
N = int(readline())

def sum(l, r, d):
    return (l+r)*((r-l)//d+1)//2

print(sum(1,N,1) - sum(3,N-N%3,3) - sum(5,N-N%5,5) + sum(15,N-N%15,15))

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

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

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

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

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

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):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
from math import sqrt, ceil, floor
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  
def Is(): return map(int, input().split())  
def LI(): return list(map(int, input().split()))  
def TI(): return tuple(map(int, input().split()))  
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  
def LS(): return list(input())  
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

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())
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())
a = list(range(1,N+1))
N_3 = N//3
N_5 = N//5
for i in range(1,N_3+1):
    a[3*i-1] = 0
for i in range(1,N_5+1):
    a[5*i-1] = 0
print(sum(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):
nums = 0
for i in range(1,int(input())+1):
    if(i % 3 != 0 and i%5 !=0):
        nums += i
print(nums)

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

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

Solution (Python):
def fizzbuzz_sum(n: int) -> int:
    return sum(i if i % 3 != 0 and i % 5 != 0 else 0 for i in range(1, n + 1))

N = int(input())
print(fizzbuzz_sum(N))

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


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

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

print(x)

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

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

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

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

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

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

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

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

sum=0
for i in l:
        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):
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())

list = []

count = 1

for i in range(n):
  if count % 3 != 0 and count % 5 != 0:
    list.append(count)
  count += 1
    
print(sum(list))

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n=ii()
    cnt=0
    for i in range(n+1):
        if i%3!=0 and i%5!=0:cnt+=i
    print(cnt)


if __name__ == "__main__":
    main()

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

Solution (Python):
n=int(input())
a=[0]*n
sa=0
for i in range(1,n+1):
    if i%15==0:
        a[i-1]="FizzBuzz"
    elif i%3==0:
        a[i-1]="Fizz"
    elif i%5==0:
        a[i-1]="Buzz"
    else:
        a[i-1]=str(i)
        sa+=i
print(sa)

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(N):
    i += 1
    if i % 3 == 0:
        continue
    elif i % 5 == 0:
        continue
    else:
        sum += i

print(sum)

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

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

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

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

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

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

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

array = [i + 1 for i in range(N)]
res_array = []

for i in range(N):
  if array[i] % 3 != 0 and array[i] % 5 != 0:
    res_array.append(array[i])

print(sum(res_array))

Solution (Python):

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

Solution (Python):

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

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):
def main():
    N = int(input())
    l=[]
    for i in range(1, N+1):
        if not(i%5==0 or i%3==0):
            l.append(i)
    x = 0
    for i in l:
        x = x + i
    print(x)
main()

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())
a = list(range(N+1))
ans = sum(a)

for i in range(N+1):
  y = a[i]
  if y%3 == 0 or y%5 == 0:
    ans -= y
    
print(ans)