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












































global FLAG_LOG
FLAG_LOG = False


def log(value):
    
    
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    
    N = int(lines[0])
    
    
    
    
    
    
    
    
    

    q, mod = divmod(N, 15)
    log(f'q=[{q}], mod=[{mod}]')

    
    s1 = (q*15+1)*(q*15)/2*1
    s3 = (q*5+1)*(q*5)/2*3
    s5 = (q*3+1)*(q*3)/2*5
    s15 = (q*1+1)*(q*1)/2*15
    result = s1 - s3 - s5 + s15
    log(f's1=[{s1}], s3=[{s3}], s5=[{s5}], s15=[{s15}]')

    for m in range(1, mod+1):
        if m % 3 == 0:
            pass
        elif m % 5 == 0:
            pass
        else:
            result += q*15 + m
            log(f'log=[{result}]')

    return [int(result)]



def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines



def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['15']
        lines_export = [60]
    if pattern == 2:
        lines_input = ['1000000']
        lines_export = [266666333332]
    if pattern == 3:
        lines_input = ['7']
        lines_export = [14]
    return lines_input, lines_export



def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode



def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    
    
    
    
    
    
    
    
    
    
    



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 and i%15!=0:
        ans+=i
print(ans)

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

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

Solution (Python):


from typing import *
import collections
import itertools
import math
import sys

INF = float('inf')


def solve(N: int):
    return sum([i for i in range(N+1) if i % 3 * i % 5])


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    print(f'{solve(N)}')


if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np

N = int(input())

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

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

Solution (Python):
import sys

N = int(input())
array = [ a for a in range(1,N+1) if a % 3 != 0 ]
array = [ b for b in array if b % 5 != 0 ]

if not ( 1 <= N <= 10**6 ): sys.exit()
print(sum(array))

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

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

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

Solution (Python):
N = int(input())
answer = 0
for i in range(1, N + 1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    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):
a = int(input())
print((1+a)*a//2-((3 + a//3*3)*(a//3)//2 + (5 + a//5*5)*(a//5)//2 - (15 + a//15*15)*(a//15)//2))

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

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

print(summation)

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

amount = 0

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

    if not is_fizzbuzz:
        amount += i

print(amount)

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

amount = 0

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

print(amount)

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

for i in range(1,n+1):

	if i % 15 != 0 and 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:
    ans += i
print(ans)

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

goukei=n*(n+1)*(1/2)
a=n//3
goukei-=3*(a)+3*a*(a-1)*(1/2)
b=n//5
goukei-=5*(b)+5*b*(b-1)*(1/2)
c=n//15
goukei+=15*(c)+15*c*(c-1)*(1/2)

print(int(goukei))

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

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

result = FizzBuzz_sum()
print(result)

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

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

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

print(ans)

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

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

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

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

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

print(ans)

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

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

Solution (Python):
print(sum(i**4%15%2*i for i in range(int(input())+1)))

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

print(sumfiz)

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

print(sumfiz)

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

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

Solution (Python):
n = int(input())
m = 0
a = n // 3
b = n // 5
c = n // 15
for i in range(1,n+1):
    m = m+i
for j in range(1,a+1):
    m = m-(3*j)
for k in range(1,b+1):
    m = m-(5*k)
for l in range(1,c+1):
    m = m+(15*l)
print(m)

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

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

n = int(input())

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

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

    print(ans)
    return


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

Solution (Python):
def main():
  n = int(input())
  l = []
  a,b = 0,1
  for x in range(n+1):
    if x%15==0:
      pass
     
    elif x%5==0:
      pass
     
    elif x%3==0:
      pass
     
    else:
      l.append(x)
      
  print(sum(l))    


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

Solution (Python):
def is_fizz(n):
  return True if (n % 3 == 0) else False

def is_buzz(n):
  return True if (n % 5 == 0) else False

def is_fizzbuzz(n):
  return True if (n % 3 == 0 and n % 5 == 0) else False

N = int(input())
sum = 0
for n in range(1, N + 1):
  if not is_fizz(n) and not is_buzz(n) and not is_fizzbuzz(n):
    sum += n
print(sum)

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

A = list(range(1,N+1))

i = 1
while 3*i <= N:
    A[i * 3-1] = 0
    i += 1

i = 1
while 5*i <= N:
    A[i * 5-1] = 0
    i += 1

print(sum(A))

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

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

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

for i in range(n+1):
  """
  if i % 3 == 0 and i % 5 == 0:
    ret.append('FizzBuzz')
  elif i % 3 == 0:
    ret.append('Fizz')
  elif i % 5 == 0:
    ret.append('Buzz')
 
  else:
  """
  if  i % 3 != 0 and i % 5 != 0:
    ret += i
print(ret)

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

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

out = 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:
        out += i

print(out)

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

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

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

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

Solution (Python):

"""
Created on Sat Jul 11 15:58:15 2020

@author: Aruto Hosaka
"""


N = int(input())
n15 = (N-1)//15
d15 = (N-1)%15
A = [1,2,0,4,0,0,7,8,0,0,11,0,13,14,0]
d = sum(A) - sum(A[d15+1:])
n = (n15-1)*n15//2*120+n15*60
ans = d+n
for a in A[:d15+1]:
    if a != 0:
        ans += n15*15
print(ans)

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

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

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

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

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

Solution (Python):
def main():
    n = int(input())
    a, b = n // 15, n % 15

    fbeg = [i for i in range(1, 16) if i % 3 != 0 and i % 5 != 0]
    fend = [i for i in range(a * 15, n + 1) if i % 3 != 0 and i % 5 != 0]

    ne = len(fbeg)
    fbs = sum(fbeg) 
    fes = sum(fend)
    step = 15 * ne
    first = fbs
    last = fbs + (a-1) * step

    tot = (first + last) * a // 2 + fes

    print(tot)

main()

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

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

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

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

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

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

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

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

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

print(sum)

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

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

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
  else:
    continue
print(ans)

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

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

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

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

print(sum_num)

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

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

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

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

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

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

print(p)

Solution (Python):
import sys
import numpy as np


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    a = np.arange(n+1, dtype=int)
    a[3:n+1:3] = 0
    a[5:n+1:5] = 0
    print(np.sum(a))


if __name__ == '__main__':
    main()

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=[]
for i in range(N+2):
    A.append(i)
for i in range(N//3+1):
    A[i*3]=0
for i in range(N//5+1):
    A[i*5]=0
ans=0
for i in range(N+1):
    ans+=A[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())
l = [i for i in range(1, N + 1) if i % 3 != 0 and i % 5 != 0]
print(sum(l))

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

Solution (Python):
n = int(input())
l = [0]*n
answer = []
for i in range(n):
  l[i]=i+1
  if not((i+1)%3==0 or (i+1)%5==0):
    answer.append(l[i])
print(sum(answer))

Solution (Python):
import sys 
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
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())
result = 0
for i in range(1,N+1):
    if i % 3 != 0 and i % 5 != 0:
        result += i
print(result)

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

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

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

sum = 0

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

print(sum)

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

sum = 0

for i in range(N+1):
    if not (i%3 == 0 or 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):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return 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)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')







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

if __name__ == '__main__':
    solve()

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

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

print(sum)

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

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

print(sum(lst))

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

ans = [0] * (N+1)

for i in range(N+1):
    if i % 3 != 0 and i % 5 != 0 and i % 15 != 0:
        ans[i] = ans[i-1] + i
    else:
        ans[i] = ans[i-1]
print(ans[-1])

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

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

a=[0]*n

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

print(sum(a))

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

lfb=[]
l=[]

for i in range(1,n+1):
    if i%3==0:
        lfb.append(i)
    elif i%5==0:
        lfb.append(i)
    elif i%15==0:
        lfb.append(i)
    else:
        l.append(i)
print(sum(l))

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

print(r)

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

print(cnt)

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

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

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

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

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

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


def souwa(n):
    syo, jyoyo = divmod(n, 2)
    return (n + 1) * syo + (n + 1) // 2 * jyoyo


print(souwa(n) - souwa(n//3)*3 - souwa(n//5)*5 + souwa(n//15)*15)

Solution (Python):



n=int(input())

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

Solution (Python):

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


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


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


def main():
    solve()


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
i=N//3
j=N//5
k=N//15

sum3=3*i*(1+i)//2
sum5=5*j*(1+j)//2
sum15=15*k*(1+k)//2
sumall=N*(1+N)//2

ans = sumall-(sum3+sum5-sum15)
print(ans)

Solution (Python):

n = int(input())


def e(k):
    m = n // k
    print
    return (m + 1) * m // 2 * k


print(e(1) - e(3) - e(5) + e(15))

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

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

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)

def main():
    N = I()

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

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

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
    return ans


if __name__ == '__main__':
    print(main())

Solution (Python):
N=int(input())
A=0
B=0
C=0
D=0

for i in range(N+1):
  A+=i

for i in range(N+1):
  if i % 3 == 0:
    B+=i
    
for i in range(N+1):
  if i % 5 == 0:
    C+=i
    
for i in range(N+1):
  if i % 15 == 0:
    D+=i
    
print(A-B-C+D)

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

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

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

def sum_seq(d):
    return 0.5*(n//d)*(2*d+(n//d-1)*d)

print(int(sum_seq(1) - sum_seq(3) - sum_seq(5) + sum_seq(15)))

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

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

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

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

print(sum)

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%5 == 0 or i%3 ==0:
    continue
  else:
    ans += i

print(ans)

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

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

print(ans)

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

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

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

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

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