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

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):
n = int(input())
A = list(range(1, n+1))
B = list()
for i in range(1, n+1):
    if i % 5 == 0 or i % 3 == 0:
        B.append(i)
ans = list(set(A) - set(B))
print(sum(ans))

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

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

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

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

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

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

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

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

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

if __name__ == "__main__":
    main()

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

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

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

fizzbuzz = []

for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        fizzbuzz.append('0')
    else:
        fizzbuzz.append(str(i))

num = [int(s) for s in fizzbuzz]
print(sum(num))

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

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

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):
s=lambda x:x*(x+1)//2;print(s(n:=int(input()))-s(n//3)*3-s(n//5)*5+s(n//15)*15)

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())
f = n//3
s_f = 3*f*(f+1)/2
b = n//5
s_b = 5*b*(b+1)/2
fb = n//15
s_fb = 15*fb*(fb+1)/2
print(int(n*(n+1)/2-s_f-s_b+s_fb))

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

print(sum)

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

Solution (Python):
import numpy as np
a = np.array([i for i in range(1, int(input())+1)])
print(a[np.where((a % 3 != 0) & (a % 5 !=0))].sum())

Solution (Python):

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

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

Sum = (1+N)*N/2
Fizz = ((1+N//3)*(N//3))/2*3
Buzz = ((1+N//5)*(N//5))/2*5
FizzBuzz = ((1+N//15)*(N//15))/2*15
print (int(Sum-Fizz-Buzz+FizzBuzz))

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

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

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

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

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

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

Solution (Python):
n=int(input())
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())
a=n//3
b=n//5
c=n//15
A=3*a*(a+1)//2+5*b*(b+1)//2-15*c*(c+1)//2
print(n*(n+1)//2-A)

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

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

s = set(range(1,n+1))
s3 = {i for i in range(1,n+1) if i % 3 == 0}
s5 = {i for i in range(1,n+1) if i % 5 == 0}

diff = s.difference(s3,s5)
print(sum(diff))

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

Solution (Python):
def main(n):
    res = 0
    for i in range(1,n+1):
        if i % 3 != 0 and i % 5 != 0:
            res += i
    return res

n = int(input())
print(main(n))

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

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

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

Solution (Python):
n=int(input())
an=[a for a in range(1,n+1)]
o=[]
def ass(an):
    for c in an:
        if c%3==0 or c%5==0:
             continue
        else:
            o.append(c)
    return sum(o)
print(ass(an))

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

Solution (Python):

def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def sums(a, N): 
    ans = ((N//a)*((N//a)+1)//2)*a
    return ans 


def solve():
    N = read_int()
    return N*(N+1)//2-(sums(3, N)+sums(5, N)-sums(15, N)) 


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

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

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

Solution (Python):
import numpy as np
N = int(input())
if N >= 2 :
    An = np.zeros(N+2, dtype=np.int)
    
    
    for s in range(1,N+1) :
        
        if s%3 != 0 and s%5 != 0 :
            An[s] = int(s) 
            
            
    ans = np.sum(An)

else:
    ans = int(1)

print (int(ans))

Solution (Python):
N = int(input())
all = []
n = []

for i in range(1,N+1):
    if i%3==0 and i%5==0:
        all.append('FizzBuzz')
    elif i%3==0:
        all.append('Fizz')
    elif i%5==0:
        all.append('Buzz')
    else:
        n.append(i)

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

print(ans)

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

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

ans = 0

for i in N_list:
    if not (i % 3 == 0 or i % 5 == 0):
        ans += i
print(ans)

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

x = 0

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

Solution (Python):
a = int(input())
d = 1
D = 0
for I in range(a):
    if d%3 == 0:
        d += 1
    
    elif d%5 == 0:
        d += 1
        
    else:
        D = D + d
        d += 1
print(D)

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

sum = (1+n)*n/2
sum3 =(3+ 3*(n//3))*(n//3)/2
sum5 =(5+ 5*(n//5))*(n//5)/2
sum15 =(15+ 15*(n//15))*(n//15)/2

print(int(sum-sum3-sum5+sum15))

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

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

print(output)

Solution (Python):
import numpy as np


n = int(input())


def multiples_3(matrix):
    
    m_de = np.delete(fizzbuzz_list,2, axis=1)
    
    f_list = np.zeros(j).reshape(-1, 1)
    
    result = np.concatenate([m_de, f_list], 1)
    return result


j = -(-n // 3)


fizzbuzz_list = np.arange(1,n+1)

before_size = fizzbuzz_list.size

fizzbuzz_list.resize((j,3))


fizzbuzz_list = multiples_3(fizzbuzz_list)


n_b_1 = np.arange(3,j,5)
n_b_2 = np.arange(1,j,5)

fizzbuzz_list[n_b_1,0] = 0
fizzbuzz_list[n_b_2,1] = 0


n_fb = np.arange(4,j,5)
fizzbuzz_list[n_fb,2] = 0

print(int(np.sum(fizzbuzz_list)))

Solution (Python):
import numpy as np


n = int(input())


def multiples_3(matrix):
    
    m_de = np.delete(fizzbuzz_list,2, axis=1)
    
    f_list = np.zeros(j).reshape(-1, 1)
    
    result = np.concatenate([m_de, f_list], 1)
    return result


j = -(-n // 3)


fizzbuzz_list = np.arange(1,n+1)

before_size = fizzbuzz_list.size

fizzbuzz_list.resize((j,3))


fizzbuzz_list = multiples_3(fizzbuzz_list)


n_b_1 = np.arange(3,j,5)
n_b_2 = np.arange(1,j,5)

fizzbuzz_list[n_b_1,0] = 0
fizzbuzz_list[n_b_2,1] = 0


n_fb = np.arange(4,j,5)
fizzbuzz_list[n_fb,2] = 0

sum = 0
sum = np.sum(fizzbuzz_list)
print(int(sum))

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

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

print(sum(S))

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

n3 = n - n%3
n5 = n - n%5
n15 = n - n%15


sum = n * (n+1) /2
sum3 = n3 * (n3 + 3) /6
sum5 = n5 * (n5 + 5) /10
sum15 = n15 * (n15 +15) /30

print(round(sum-sum3-sum5+sum15))

Solution (Python):
import sys
N = int(sys.stdin.readline())
ans = 0
for i in range(N + 1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
if __name__ == '__main__':
	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 or i % 5 == 0 or i % 15 == 0:
        pass
    else:
        sum += i

print(sum)

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

s = n*(n+1) / 2

f = n // 3
b = n // 5
fb = n // 15

a = int(s - 3 *f*(f+1)//2 - 5 *b*(b+1)//2 + 15 *fb*(fb+1)//2)
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())
s = 0
for i in range(1,n+1):
    if i%3!=0 and i%5!=0:
        s += i
print(s)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
import numpy as np

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

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

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

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

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

print(sum)

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

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

print(sum)

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

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

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):
print(sum(map(lambda i: 0 if i%3 == 0 or i%5 == 0 else i,map(lambda i: i+1,list(range(int(input())))))))

Solution (Python):
def is_not_fizzbuzz(i):
    if i%3 == 0 or i%5 == 0:
        return 0
    else:
        return i
print(sum(map(is_not_fizzbuzz,map(lambda i: i+1,list(range(int(input())))))))

Solution (Python):
N=int(input())
sum=0
for i in range(N+1):
	if i%15==0:
		sum+=i
	elif i%3==0:
		sum+=i
	elif i%5==0:
		sum+=i
print(int(N*(N+1)*0.5)-sum)

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

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

print(ans)

Solution (Python):

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

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

s = n*(n+1)/2
s3 = (3/2)*(n//3)*(1+(n//3))
s5 = (5/2)*(n//5)*(1+(n//5))
s15 = (15/2)*(n//15)*(1+(n//15))

ans = int(s-s3-s5+s15)

print(ans)

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

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

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 n in range(N):
    
    i = n+1
    if i%3 == 0 or i%5 == 0 or (i%3 == 0 and i%5 == 0):
        continue
    else:
        SUM += i
print("{}".format(SUM))

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())
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_N = N*(N+1)//2
sum_3 = 3*(N//3)*(N//3+1)//2
sum_5 = 5*(N//5)*(N//5+1)//2
sum_15 = 15*(N//15)*(N//15+1)//2
print(sum_N-sum_3-sum_5+sum_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):
def main():
    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)
main()

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

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

print(fizz_buzz_sum)

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

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

print(soma)

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

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

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

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())
List=[]
a=0
while a<N:
  a=a+1
  if (a%3)!=0 and (a%5)!=0:
    List.append(a)
print(sum(List))

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=1
b=0
while True:
	if a%3!=0 and a%5!=0:
		b+=a
	if a==n:
		break
	a+=1
print(b)

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

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

Solution (Python):
N=int(input())
U=0
a=0
b=0
c=0
for i in range(0,N+1):
  U+=i
for i in range(0,N+1,3):
  a+=i
for i in range(0,N+1,5):
  b+=i
for i in range(0,N+1,15):
  c+=i
S=U-a-b+c
print(S)

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

Solution (Python):
n = int(input())
e = []
m = []
for i in range(n+1):
    if i % 15 == 0:
        e.append(i)
    elif i % 3 == 0:
        e.append(i)
    elif i % 5 == 0:
        e.append(i)
    else:
        m.append(i)
print(sum(m))

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

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

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

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

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

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

if __name__ == "__main__":
    main()

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())
t = []

for i in range(1,n+1):
    if i % 3 == 0 or i % 5 == 0 or i % 15 == 0:
        pass
    else:
        t.append(i)

print(sum(t))

Solution (Python):
from collections import deque
import math; floor,ceil = math.floor,math.ceil
import sys; input = lambda: sys.stdin.readline().rstrip()
aint = lambda: int(input()); ints = lambda: list(map(int, input().split()))
Yes = lambda boolean: print('Yes') if boolean else print('No')
YES = lambda boolean: print('YES') if boolean else print('NO')
is_even = lambda x: True if x%2==0 else False
s = lambda x: int(x*(x+1)*0.5)

def main():
    n = aint()
    print(s(n)-3*s(int(n/3))-5*s(int(n/5))+15*s(int(n/15)))

if __name__ == '__main__':
    main()

Solution (Python):
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())
A = [0]*(N)

def solution(N,A):
    for i in range(1,N+1):
        A[i-1] = i
    
        if A[i-1]%3==0 or A[i-1]%5==0:
            A[i-1] =0
    print(sum(A))

solution(N,A)

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

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

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

a=[]
s=[]

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

    if i % 15 == 0:

        a.append("FizzBuzz")

    elif i % 3 == 0:

        a.append("Fizz")

    elif i % 5 == 0:

        a.append("Buzz")

    else: s.append(i)

print(sum(s))

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

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


sum = 0
for i in range(1, n + 1):
	sum = sum + i


i3 = n // 3
for i in range(1, i3 + 1):
	sum = sum - 3 * i


i5 = n // 5
for i in range(1, i5 + 1):
	if (i % 3 != 0):
		sum = sum - 5 * i

print(sum)

Solution (Python):
n=int(input())
a=list(range(1,n+1))


af=list(filter(lambda x: (x%3!=0 and x%5!=0),a))

print(sum(af))

Solution (Python):
A = list(range(int(input())))
B = list(map(lambda x:x+1,A))

C = filter(lambda x:x%3 and x%5,B)
print(sum(list(C)))

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):
B=map(lambda x: x+1, list(range(int(input()))))

A=[i for i in list(B) if not(i%3==0 or i%5==0)]

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

print(a)

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

print(sum(filter(lambda x : (x%3 != 0) and (x%5 !=0), range(N+1))))

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 % 15 != 0 and i % 3 != 0 and i % 5 != 0:
        ans += i

print(ans)

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

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

print(sum)

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

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
assert 1 <= N <= 10**6
total = 0
for i in range(1, N+1):
    if i % 3 and i % 5:
        total += i
print(total)

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

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


a = []
for i in num_list:
    if ((i%3==0 and i%5==0) or i%3 == 0 or i%5 == 0)==0:
       a.append(i)
print(sum(a))

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

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

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

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

print(count)

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

Solution (Python):



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

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

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

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

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

Solution (Python):
f = 3
b = 5
fb = f * b

n = int(input())
fbCols = list(range(1, n + 1))
sum = 0
for item in fbCols:
    if item % f == 0 or item % b == 0:
        continue
    sum += item

print(sum)

Solution (Python):


import math

def S(n):
    return ((n*n+n)>>1)

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

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

Solution (Python):






import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr


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





N = inputI()

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

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

Solution (Python):
n = input()
kei = 0

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

print(kei)

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

def judge(x):
  if x % 15 == 0:
    return 0
  elif x % 3 == 0:
    return 0
  elif x % 5 == 0:
    return 0
  else:
    return x

l =[]
for i in range(1,N+1):
  l.append(judge(i))
  
print(sum(l))

Solution (Python):

N = int(input())
list = [0] * N

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

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

Solution (Python):
def judge(x):
    y = 0
    if x%3==0 or x%5==0:
        y = 1

    return y

n = int(input())
ans = 0

for i in range(n):
    num = i+1

    if judge(num)==0:
        ans += num

print(ans)

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

for num in range(1,x+1):
    sum = sum + num
    if  num%3 == 0 or num%5 == 0:
        sum = sum - num 
     
       
    

print(sum)

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

print(sum)

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

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

print(sum(target_list))

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

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

print(ans)

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

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

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

print(int(N*(N+1)/2 - sum(fizzbuzz)))

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

print(S)

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

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

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

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

print(sum)

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

print(sum(B))

Solution (Python):

N = int(input())
Fizz = int(N // 3)
Buzz = int(N // 5)
FBzz = int(N // 15)

sFizz = (3 + 3 * Fizz) * Fizz //2
sBuzz = (5 + 5 * Buzz) * Buzz //2
sFBzz = (15 + 15 * FBzz) * FBzz //2
print(N * (N + 1) // 2 - (sFizz + sBuzz) + sFBzz)

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

print(N)

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

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

Solution (Python):
ans = 0

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

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