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

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

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

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

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

sum = 0

def summation(a, d, n):
    return (n * a) + int(((n * d) * (n - 1)) / 2)

all = summation(1, 1, N)
fizzbuzz = summation(15, 15, int(N / 15))
fizz = summation(3, 3, int(N / 3))
buzz = summation(5, 5, int(N / 5))

print(all + fizzbuzz - fizz - buzz)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
s =int(readline().rstrip().decode())
res = 0
for i in range(s):
    if (i+1)%3!= 0 and (i+1)%5!=0:
        res += (i+1)
print(res)

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

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

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

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

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

A = a * (3 + 3*a) / 2
B = b * (5 + 5*b) / 2
C = (c * 15 * (c+1)) / 2

ans = int(Sum + C - (A+B))
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())
l = [1,2,0,4,0,0,7,8,0,0,11,0,13,14,0]
full = n // len(l)
part = n % len(l)

out = sum(l) * full + 15 * 8 * (full * (full - 1))//2
for i in range(part):
    if l[i] > 0:
        out += l[i] + 15 * full
print(out)

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

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

Solution (Python):
N = int(input())
n = N//15
a = n*(120+(n-1)*120)/2
b = N%15
c = 0
if b == 1:
    c = 15*n+1
elif b == 2 or b == 3:
    c = 15*n*2+3
elif b == 4 or b == 5 or b == 6:
    c = 15*n*3+7
elif b == 7:
    c = 15*n*4+14
elif b == 8 or b == 9 or b == 10:
    c = 15*n*5+22
elif b == 11 or b == 12:
    c = 15*n*6+33
elif b == 13:
    c = 15*n*7+46
elif b == 14:
    c =15*n*8+60
print(int(a+c))

Solution (Python):
"""
i が 3 でも 5 でも割り切れるなら、ai=FizzBuzz
そうではなく i
が 3 で割り切れるなら、ai=Fizz
そうではなく i
が 5 で割り切れるなら、ai=Buzz
そうではないなら、ai=i
"""
n=int(input())
r=0
for ii in range(n):
  if (ii+1)%3!=0 and (ii+1)%5!=0:
    r+=(ii+1)
print(r)

Solution (Python):
n = int(input())
d3 = n // 3
d5 = n // 5
d15 = n // 15

print(int(n*(n+1)/2 + 15*d15*(d15+1)/2 - 3*d3*(d3+1)/2 - 5*d5*(d5+1)/2))

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

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

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

def sumup(k):
    return k*(k+1)//2

ans = sumup(N) - 3*sumup(N//3) - 5*sumup(N//5) + 15*sumup(N//15)

print(ans)

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

Sum_1 = N * (N + 1) // 2
Sum_3 = (N // 3) * (N // 3 + 1) // 2 * 3
Sum_5 = (N // 5) * (N // 5 + 1) // 2 * 5
Sum_15 = (N // 15) * (N // 15 + 1) // 2 * 15

print(Sum_1 - Sum_3 - Sum_5 + Sum_15)

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

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

fizzbuzz_sum = 0

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

print(fizzbuzz_sum)

Solution (Python):
import numpy as np
from sys import stdin


def get_result(data):
    N = data[0]
    ans = []
    for i in range(N):
        val = i + 1
        _, q_3 = divmod(val, 3)
        _, q_5 = divmod(val, 5)
        if q_3 != 0 and q_5 != 0:
            ans.append(val)
    ans = np.array(ans)
    return sum(ans[ans <= N])


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)

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

def fizzbuzz(n):
    text = ''
    text += 'Fizz' if n%3==0 else ''
    text += 'Buzz' if n%5==0 else ''
    text += f"{n}" if text == '' else ''
    return text

fizzbuzzs = [i for i in range(1,n+1) if fizzbuzz(i) not in ['Fizz','Buzz','FizzBuzz']]
print(sum(fizzbuzzs))

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

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

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

Solution (Python):
N = int(input())
x = []
y = 0
for i in range(N+1):
    if i % 3 == 0 and i % 5 == 0:
        x.append("FizzBizz")
    elif i % 3 == 0:
        x.append("Fizz")
    elif i % 5 == 0:
        x.append("Bizz")
    else:
        x.append(i)
        y += i
print(y)

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

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

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

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

N3 = N//3
N5 = N//5
N15 = N//15

print(N*(N + 1)//2 - 3*N3*(N3 + 1)//2 - 5*N5*(N5 + 1)//2 + 15*N15*(N15 + 1)//2)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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

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

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

print(ans)

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

num3 = N//3
num5 = N//5
num15 = N//15

ans = 1/2*N*(N+1) - 1/2*num3*(num3+1)*3 - 1/2*num5*(num5+1)*5 + 1/2*num15*(num15+1)*15
print(int(ans))

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

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

def f(N,a):
    return (N//a)*(a+(N//a)*a)//2

print(N*(N+1)//2 -f(N,3) -f(N,5) +f(N,15))

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

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

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

print(result)

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

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

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())
array = list([x+1 for x in range(n)])
sum = 0
for i in range(len(array)):
    if array[i]%15==0:
        array[i] = 'fizzbuzz'
    elif array[i]%3==0:
        array[i] = 'fizz'
    elif array[i]%5==0:
        array[i] = 'buzz'
    else:
        sum += array[i]


print(sum)

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

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

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

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

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())
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):
  if not ((i+1)%3 ==0 or (i+1)%5 == 0):
    a.append(i+1)
print(sum(a))

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

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

print(res)

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

print(cnt)

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

Solution (Python):


def solve():
    N = int(input())
    ans = 0
    for i in range(1, N+1):
        if i%15 == 0:
            continue
        elif i%3 == 0:
            continue
        elif i%5 == 0:
            continue
        ans += i
    print(ans)


if __name__ == "__main__":
    solve()

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

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

print(sum(l))

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

Solution (Python):
from sys import stdin
import math
import fractions

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












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

print(cnt)

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

a0 = N*(N+1)/2


b1 = N//3
a1 = (3*b1+3)*b1/2

b2 = N//5
a2 = (5*b2+5)*b2/2

b3 = N//15
a3 = (15*b3+15)*b3/2

ans = a0 - a1 - a2 + a3
print(int(ans))

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


def sums(t,i):
    return int(0.5 * (n // i) * (i * 2 + i * ((n // i) -1)))

print(sums(n,1) - sums(n,3) -sums(n,5) + sums(n,15))

Solution (Python):


n = int(input())

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

print(sum(ans))

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

total = 0
for i in range(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+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
    else:
        ans += i

print(ans)

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

ans=(60+(60+120*((N//15)-1)))*(N//15)/2

if N%15==0: print(int(ans))
if N%15==1: print(int(ans+1+15*(N//15)))
if N%15==2 or N%15==3: print(int(ans+1+2+30*(N//15)))
if N%15>=4 and N%15<=6: print(int(ans+1+2+4+45*(N//15)))
if N%15==7: print(int(ans+1+2+4+7+60*(N//15)))
if N%15>=8 and N%15<=10: print(int(ans+1+2+4+7+8+75*(N//15)))
if N%15==11 or N%15==12: print(int(ans+1+2+4+7+8+11+90*(N//15)))
if N%15==13: print(int(ans+1+2+4+7+8+11+13+105*(N//15)))
if N%15==14: print(int(ans+1+2+4+7+8+11+13+14+120*(N//15)))

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

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

ans = sum(arr)

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())
n3 = N//3
n5 = N//5
n15 = N//15
sum3 = n3/2*(2*3+(n3-1)*3)
sum5 = n5/2*(2*5+(n5-1)*5)
sum15 = n15/2*(2*15+(n15-1)*15)
sumall = (1+N)*N/2
print(int(sumall-sum3-sum5+sum15))

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

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

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


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

print(fizzbuzz_sum(N))

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

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

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

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

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

Solution (Python):
N=int(input())
X=N*(1+N)//2
a=N//3
S3=a*(3+3*a)//2
b=N//5
S5=b*(5+5*b)//2
c=N//15
S15=c*(15+15*c)//2
print(X-S3-S5+S15)

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

print(s)

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

Solution (Python):
a = int(input())
lis = []
for i in range(1, a+1):
    lis.append(i)
for j in range(len(lis)):
    b = lis[j]
    if b % 3 ==0:
        lis[j] = 0
    if b % 5 ==0:
        lis[j] = 0
print(sum(lis))

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

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

N=N+1

total=0

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

    
print(total)

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

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

print(sum(l))

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


if __name__ == "__main__":
    main()

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

print(count)

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

n = int(input())
s = 0

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

print(s)

Solution (Python):
n = int(input())
ret= 0
def get_n(i):
    if i%3 == 0:
        return 0
    if i%5 == 0:
        return 0
    return i
for i in range(n+1):
    ret += get_n(i)
print(ret)

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())
total = N * (N + 1) / 2
N_3, N_5, N_15 = [N // i for i in [3, 5, 15] ] 
fizz = 3 / 2 * N_3 * (N_3 + 1)
buzz = 5 / 2 * N_5 * (N_5 + 1)
fizz_buzz = 15 / 2 * N_15 * (N_15 + 1)
print( int(total - fizz - buzz + fizz_buzz))

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

Solution (Python):
n = int(input())
a = n // 15

b = a * 60 + (a * (a - 1) / 2 * 120)

i = a * 15 + 1
while i <= n:
    if i % 3 != 0 and i % 5 != 0:
        b = b + i
    
    i = i + 1
b = int(b)
print(b)

Solution (Python):

import sys


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

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

print(a)

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

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

print(Sum)

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

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

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

total = 0

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

print(total)

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

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

print(ans)

Solution (Python):
n = int(input())
tot = sum(range(1, n + 1))
n_3 = n // 3
n_5 = n // 5
n_15 = n // 15
print(tot - sum(range(3, int(3 * n_3) + 1, 3)) -
      sum(range(5, int(5 * n_5) + 1, 5)) +
      sum(range(15, int(15 * n_15) + 1, 15)))

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

Solution (Python):
import sys
import math
 
from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))
 
 
n = load()
s = 0
for i in range(1, n+1):
    if i % 3 == 0 or 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 or i % 5 == 0:
        continue
    else:
        ans += i
print(ans)

Solution (Python):
import math
n = int(input())
n_3 = math.floor(n/3)
n_5 = math.floor(n/5)
n_15 = math.floor(n/15)
s_all = n*(n+1)/2
s_3  = 3*n_3*(n_3+1)/2
s_5  = 5*n_5*(n_5+1)/2
s_15 = 15*n_15*(n_15+1)/2
print(int(s_all-(s_3+s_5-s_15)))

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

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

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

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

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

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

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

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

n_list = []

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

print(sum(n_list))

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

print(count)

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

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

print(total)

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

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


    else :
        j=j+i

print(j)

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

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

Solution (Python):


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

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

Solution (Python):

import re

N = int(input())

l = list(i+1 for i in range(N))

for i in l:
    if(i % 3 == 0 and i % 5 != 0):
        l[i-1] = "Fizz"
    elif(i % 3 != 0 and i % 5 == 0):
        l[i-1] = "Buzz"
    elif(i % 3 == 0 and i % 5 == 0): 
        l[i-1] = "FizzBuzz"
    else:
        l[i-1] = l[i-1]

a = []
for k in l:
    if isinstance(k, int):
        a.append(int(k))
    else:
        pass
print(sum(a))

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

sum = 0

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

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

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

for i in range(N):
  if ln[i] % 3 == 0:
    ln[i] = 0
  elif ln[i] % 5 == 0:
    ln[i] = 0
  elif ln[i] % 15 == 0:
    ln[i] = 0
print(sum(ln))

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

ans = sum(range(1, n+1)) - sum(range(3, n+1, 3)) - sum(range(5, n+1, 5)) + sum(range(15, n+1, 15))

print(ans)

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

ans = N*(N+1)*0.5

fizz = int(N/3)
buzz = int(N/5)
fizzbuzz = int(N/15)

fizzsum = 3*0.5*fizz*(fizz+1)
buzzsum = 5*0.5*buzz*(buzz+1)
fizzbuzzsum = 15*0.5*fizzbuzz*(fizzbuzz+1)

ans = ans - fizzsum - buzzsum + fizzbuzzsum

print(int(ans))

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

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

Solution (Python):
import os

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


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

Solution (Python):
import heapq
import math
from collections import defaultdict
from itertools import permutations,combinations,combinations_with_replacement

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

print(res)

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

print(ans)

Solution (Python):
n = 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
s1,s2=0,0
for i in range(1,n+1):
    if i%3==0:
        s1+=i 
    elif i%5==0:
        s2+=i 
print((n*(n+1))//2-s1-s2)

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 = 0

def format_input(filename = None):
	global n
	if filename == None:
		n = int(input())

	elif filename == '__random__':
		from random import randint as rng
		n = rng(1, 10**6)
		print(n)

def get_answer():
	fizzbuzz = ((n // 15) * (n // 15 + 1)) // 2 * 15
	fizz = ((n // 3) * (n // 3 + 1)) // 2 * 3 - fizzbuzz
	buzz = ((n // 5) * (n // 5 + 1)) // 2 * 5 - fizzbuzz
	answer = (n * (n + 1)) // 2 - fizz - buzz - fizzbuzz
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)

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

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

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

anslist = []

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:
        anslist.append(i)
        

print(sum(anslist))

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

print(ans)

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

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):
def Main(N):
    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
    return ans
    

def main():
    N = int(input())
    print(Main(N))

if __name__ == '__main__':
    main()

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

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

a = n//3
b = n//5
c = n//15
ans = n*(n+1) // 2 - 3*a*(a+1)//2 - 5*b*(b+1)//2 + 15*c*(c+1)//2
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 = input("")
N = int(N)
SUM = 0
for i in range(N):
    a = i+1
    if (i+1)%3 != 0:
        if (i+1)%5 != 0:
            SUM = SUM + i+1

print(SUM)

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

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

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