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

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

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

print(ans)

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

for i in range(1,N+1):
  if i%15 == 0:
    i = 0
  elif i%3 == 0:
    i = 0
  elif i%5 == 0:
    i = 0
  else:
    i = i
  line.append(i)
ans = sum(line)

print(ans)

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

result = 0

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

print(result)

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

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

Solution (Python):
def extract(seq):
    arr = []
    for i in seq:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            arr.append(i)
    return sum(arr)


n = int(input())
print(extract(range(1, n + 1)))

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

print(ans)

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

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

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

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

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())
sum = (n+1)*n/2
for i in range(1,n+1):
    if i%3 == 0 or i%5 == 0:
        sum-=i
print(int(sum))

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

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

cnt = 0

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

print(cnt)

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

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

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

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


resolve()

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

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

if __name__ == '__main__':
    main()

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

s = (n//15)*60 + (n//15)*(n//15 - 1)*60

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

print(s)

Solution (Python):
N = int(input())
A = list(range(1 ,(N+1)))

S = [a for a in A if a % 3 != 0]
M = [s for s in S if s % 5 != 0]

print(sum(M))

Solution (Python):
n = int(input())
fg = list(range(n+1))
fg.pop(0)
total = 0
for i in range(n):
    if fg[i] % 15 == 0:
        fg[i] = 'FizzBuzz'
    elif fg[i] % 3 == 0:
        fg[i] ='Fizz'
    elif fg[i] % 5 == 0:
       fg[i] = 'Buzz'

for i in range(n):
    if not (fg[i] == 'FizzBuzz' or fg[i] == 'Fizz' or fg[i] == 'Buzz'):
        total += fg[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 = []
for i in range(1, N+1):
    if i % 15 == 0:
        continue

    elif i % 3 == 0:
        continue

    elif i % 5 == 0:
        continue

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

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

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

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

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

sm = 0

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

print(sm)

Solution (Python):
import sys

n = int(input())
  
f = sum(range(0, n+1, 3))
b = sum(range(0, n+1, 5))
fb = sum(range(0, n+1, 15))
total = (n * (n + 1)) / 2



print(int(total - f -b + fb))

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

Solution (Python):
n = input()

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

print ans

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

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

print(ans)

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

Solution (Python):
fizz = []
buzz = []
fizzbuzz = []
other = []
n = int(input())
for i in range(n):
    temp = i+1
    if (temp % 3 != 0) & (temp % 5 != 0):
        other.append(temp)

b = sum(other)

print(b)

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

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

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

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


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

print(ans)

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

Solution (Python):
N  = int(input())
num3 = N//3
sum3 = 3*num3*(num3+1)//2
num5 = N//5
sum5 = 5*num5*(num5+1)//2
num15 = N//15
sum15 = 15*num15*(num15+1)//2

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

print(_sum-sum3-sum5+sum15)

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

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

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

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

print(ans)

Solution (Python):


N = int(input())
result = 0

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

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

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

b = 0

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

print(b)

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

Solution (Python):


input_num = int(input())

answer = 0

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

print(answer)

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())
a = [i for i in range(n+1) if i%3!=0]
b = [j for j in a if j%5!=0]
c = [k for k in b if k%15!=0]
print(sum(c))

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

Solution (Python):
n = int(input())
f = n//3
b = n//5
fb = n//15
def sum_as(num):
  return num*(num+1)//2
print(sum_as(n)-3*sum_as(f)-5*sum_as(b)+15*sum_as(fb))

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

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

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


while N>0:
  ai=N
  if (ai % 3 == 0) and (ai % 5 ==0):
   ai = 'FizzBuzz'
  elif (ai % 3 == 0):
   ai = 'Fizz'
  elif (ai % 5 == 0):
   ai = 'Buzz'
  else:
   sum=sum+ai
  N=N-1

print(sum)

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

Solution (Python):
def main():
    N = int(input()) + 1
    intSum = 0
    for num in range(N):
        if (num % 3 != 0) and (num % 5 != 0):
            intSum += int(num)

    print(intSum)


if __name__ == '__main__':
    main()

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

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

s_all = sum(range(N+1))
fizz = sum(list(range(3,N+1,3)))
buzz = sum(list(range(5,N+1,5)))

fb = sum(list(range(15,N+1,15)))

print(s_all-fizz-buzz+fb)

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

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

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

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

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

print(ans)

Solution (Python):
n = int(input())
a = []
n_sum = (n/2) * (n+1)
for i in range(1,n+1):
    if i % 3 == 0:
        a.append(i)
    elif i % 5 == 0:
        a.append(i)
    elif i % 15 == 0:
        a.append(i)
print(int(n_sum-sum(a)))

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

print(count)

Solution (Python):
N = int(input())
ns = set(range(1,N+1))
n3 = set(range(0,N+1,3))
n5 = set(range(0,N+1,5))
print(sum(ns-n3-n5))

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

res = 0

n = int(input())

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

Solution (Python):
n = int(input())
list = []
list1 = []
for i in range(1, n+1):
    if i%5==0 and i%3==0:
        list.append('FizzBuzz')
    elif i%3==0:
        list.append('Fizz')
    elif i%5==0:
        list.append('Buzz')
    else:
        list.append(i)
for j in list:
    if isinstance(j, int):
        list1.append(j)
print(sum(list1))

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

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

print(ans)

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

a = []
b = 0
for i in range(1, n+1):
    if i % 3 == 0 and i % 5 == 0:
        a.append("FizzBuzz")
    elif i % 3 == 0:
        a.append("Fizz")
    elif i % 5 == 0:
        a.append("Buzz")
    else:
        b += i
        
print(b)

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

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

total = 0

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

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

A=N//3
B=N//5
AanB=N//15
Ssum=(1+N)*N*(1/2)
Asum=(1+A)*A*(1/2)*3
Bsum=(1+B)*B*(1/2)*5
AanBsum=(1+AanB)*AanB*(1/2)*15
print(int(Ssum-Asum-Bsum+AanBsum))

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

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

cnt_3 = 0
i = 1
for i in range(n+1) :
    if i%3 == 0:
    	cnt_3 = cnt_3 + i

cnt_5 = 0
h = 1
for h in range(n+1) :
    if h%5 == 0:
    	cnt_5 = cnt_5 + h

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

print(int((1+n)*n/2 - (cnt_3 + cnt_5 - cnt_35)))

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

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

if __name__ == "__main__":
    main()

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

Solution (Python):
N=int(input())
sum_all=N*(N+1)//2
sum_Fizz=3*(N//3)*(N//3+1)//2
sum_Buzz=5*(N//5)*(N//5+1)//2
sum_FizzBuzz=15*(N//15)*(N//15+1)//2
print(sum_all-sum_Fizz-sum_Buzz+sum_FizzBuzz)

Solution (Python):


def main(a=''):
    
    a = int(input())
    
    
    
    

    
    
    
    
    sum = 0
    for i in range(a+1):
        if i % 3 == 0:
            continue
        elif i % 5 == 0:
            continue
        else:
            sum += i
    print(sum)


if __name__ == '__main__':
    
    
    
    main()

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

allsum=0
for i in range(input_line+1):
  if i%3 != 0 and i%5 != 0 and i%15 != 0:
    allsum += i

print(allsum)

Solution (Python):
import itertools
N = int(input())
N_list = [i+1 for i in range(N)]
cumsum = list(itertools.accumulate(N_list))
aa = cumsum[-1]
t_list = [i for i in N_list if i%3 == 0 or i%5 == 0]
if len(t_list) != 0:
    acumsum = list(itertools.accumulate(t_list))[-1]
else:
    acumsum = 0
print(aa - acumsum)

Solution (Python):
import numpy as np 
N = int(input())
sequen = np.arange(1,N+1)
sequen = sequen[(sequen%3!=0) & (sequen%5!=0)]
print(sum(sequen))

Solution (Python):
if __name__ == "__main__":
    n = input()
    n = int(n)

    x = n * (n + 1) / 2

    ny = n // 3
    y = 3 * ny * (ny + 1) / 2

    nz =  n // 5
    z = 5 * nz * (nz + 1) / 2

    nw = n // 15
    w = 15 * nw * (nw + 1) / 2

    ans = x - y - z + w
    ans = int(ans)
    print(ans)

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

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

print(sum(A))

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

Solution (Python):
n = eval(input(""))
j = 0
for i in range(n+1):
    if i%3 == 0 or i%5 == 0:
        continue
    j = i+ j
print(j)

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

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

ans = 0

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

print(sum(a))

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

Solution (Python):
def sum_1_to_k(k):
  return k * (k + 1) // 2


def main():
  n = int(input().rstrip())
  
  sum_to_n = sum_1_to_k(n)
  sum_of_3 = 3 * sum_1_to_k(n // 3)
  sum_of_5 = 5 * sum_1_to_k(n // 5)
  sum_of_15 = 15 * sum_1_to_k(n // 15)
  
  print(sum_to_n - sum_of_3 - sum_of_5 + sum_of_15)
  

if __name__ == "__main__":
  main()

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

sum=0

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

    if (i%3 == 0) or  (i%5 == 0):
        continue
    else:
        sum=sum+i;
print(sum)

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

Solution (Python):
import math
import sys
import collections
N=int(input())
K=N*(N+1)//2-3*(N//3)*((N//3)+1)//2-5*(N//5)*((N//5)+1)//2+15*(N//15)*((N//15)+1)//2
print(K)

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

print(sum(list_))

Solution (Python):


def main():
    N = list(map(int, open(0).read().split()))
    N = N[0]
    print(sum([i for i in range (1, N + 1) if not (i % 3 == 0 or i % 5 == 0)]))

main()

Solution (Python):
import sys, os

if __name__ == '__main__':
    N = int(input())
    s = 0
    for i in range(1, N+1):
        if i % 3 ==0 or i % 5 ==0:
            continue
        else:
            s += i
    print(s)

Solution (Python):
A=int(input())
Sum= A*(A+1)/2
B=(A//3)
C=(A//5)
D=(A//15)

E=B*(6+(B-1)*3)/2
F=C*(10+(C-1)*5)/2
G=D*(30+(D-1)*15)/2

print(int(Sum-E-F+G))

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

for j in range(N):

    if num[j] % 3 == 0 and num[j]  % 5 == 0 :
        num[j] = 'FizzBuzz'
    elif num[j] % 3 == 0:
        num[j] = 'Fizz'
    elif num[j] % 5 == 0:
        num[j] = 'Buzz'

sum = 0

for k in range(N):
    if num [k] == 'FizzBuzz' or num[k] == 'Fizz' or num[k] =='Buzz':
        sum = sum
    else:
        sum = sum + num[k]

print(sum)

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

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

syou = N//15
amari = N%15
answer = 0
def fizzbuzzSum(syou,amari):
  start = 15*syou
  end = start + amari
  ans = 0
  for i in range(start,end+1):
    if(i%3==0 or i%5==0):
      continue
    ans += i
  return ans
if syou == 0:
  answer = fizzbuzzSum(syou,amari)
else:
  answer = fizzbuzzSum(syou,amari)
  answer += 60 *(syou**2) 

print(answer)

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

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

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

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

print(ans)

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

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

Solution (Python):
user = int(input())
sum = 0
for i in range(1,user+1):
    if i%3==0 or i%5==0:
        i = "Fizzbuzz"
    elif(i%3==0):
        i = "Fizz"
    elif(i%5==0):
        i = "Buzz"
    elif(i%3!=0 or i%5!=0):
        sum = 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):
N = int(input())
result = 0

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

print(result)

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


if __name__ == "__main__":
    main()

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

Solution (Python):
import math
import sys
def getN():
    return int(input())

def getIntList():
    return list(map(int, input().split()))

def main():
    
    N = getN()

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

    return

if __name__ == "__main__":
    main()

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


print(sum([i+1 for i in range(S) if not ((i+1)%3==0 or (i+1)%5==0 )]))

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

Solution (Python):

import sys


def solve(N: int):
    ans = []
    for i in range(1, N+1):
        if i % 3 == 0 or i % 5 == 0:
            continue
        ans.append(i)
    print(sum(ans))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

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

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

if __name__ == '__main__':
    main()

Solution (Python):
def fizz_buzz(n):
    total = 0
    for i in range(1,n+1):
        if i % 15 == 0:
            continue
        elif i % 3 == 0:
            continue
        elif i % 5 == 0:
            continue
        else:
            total += i
    return total


if __name__ == "__main__":
    n = int(input())
    print(fizz_buzz(n))

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

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

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

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

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

print(ans)

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

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

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

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

sums = 0

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

print(sums)

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

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

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


print(int(s))

Solution (Python):
N = int(input())
i = 1
total = 0
while i <= N:
    if i % 3 != 0 and i % 5 != 0:
        total += i
    i += 1
print(total)

Solution (Python):


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

Solution (Python):
N,=map(int, input().split())  
sum=0
for i in range(1,N+1):
    if (i % 3==0 or i% 5==0):
        continue
    sum=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
import math
import bisect

def main():
    n = int(input())
    ans = n * (n + 1) // 2
    num_3 = n // 3
    num_5 = n // 5
    num_15 = n // 15
    ans -= num_3 * (num_3 + 1) // 2 * 3
    ans -= num_5 * (num_5 + 1) // 2 * 5
    ans += num_15 * (num_15 + 1) // 2 * 15
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
def fizzbuzz_sum(n):
    if n % 3 == 0 and n % 5 == 0:
        return 0
    elif n % 3 == 0:
        return 0
    elif n % 5 == 0:
        return 0
    else:
        return n


if __name__ == '__main__':
    n = int(input())
    sum = 0

    for i in range(1, n+1):
        sum += fizzbuzz_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())

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

print(fb)

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

res=0

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

print(res)

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

all = int((n+1)*(n/2))
fizz = int(3*((n//3 + 1)*((n//3)/2)))
buzz = int(5*((n//5 + 1)*((n//5)/2)))
fizzbuzz = int(15*((n//15 + 1)*((n//15)/2)))

result =  all - fizz - buzz + fizzbuzz
print(result)

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

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

Solution (Python):
import numpy as np
n = int(input())
na = np.arange(n) + 1
na2 = []
for i in na:
    if i % 3 != 0 and i % 5 != 0:
        na2.append(i)
print(sum(na2))

Solution (Python):
i = input()

i = int(i)

sum = 0

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

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

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

print(total)