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

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    N = Scanner.int()

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


def main():
    
    solve()


if __name__ == "__main__":
    main()

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

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

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

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

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

Solution (Python):
A=int(input())
three=int(A/3)
five=int(A/5)
fif=int(A/15)
count=0
for i in range(A+1):
    count+=i

if A>=15:
    final=int(count-(1/2*three*(3+three*3))-(1/2*five*(5+five*5))+(1/2*fif*(15+fif*15)))
    print(final)

elif 5<=A<15:
    final=int(count-(1/2*three*(3+three*3))-(1/2*five*(5+five*5)))
    print(final)

elif 3<=A<5:
    final=int(count-(1/2*three*(3+three*3)))
    print(final)

else:
    print(count)

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

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

Solution (Python):
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:input()

"""========main code==============="""

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

Solution (Python):
import sys
from collections import Counter

sys.setrecursionlimit(10 ** 6)


def input(): return sys.stdin.readline().rstrip()


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

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

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

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

digit = 0
for i in range(x):
    x = i + 1

    if x % 3 == 0 and x % 5 == 0:
        continue
    elif x % 3 == 0 and x % 5 != 0:
        continue
    elif x % 3 != 0 and x % 5 == 0:
        continue
    else:
        digit += x



print(digit)

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

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

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

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

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

n15 = n // 15
n5 = n // 5
n3 = n // 3

ans = n*(n+1)//2 - 5*n5*(n5+1)//2 - 3*n3*(n3+1)//2 + 15*n15*(n15+1)//2

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):
import numpy as np
N = int(input())

row = np.arange(1, N+1)

FizzBuzz = row[row%15==0]
Fizz = row[row%3==0]
Buzz = row[row%5==0]

print(np.sum(row) - (np.sum(Fizz) + np.sum(Buzz) - np.sum(FizzBuzz)))

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


N = int(input())

print(wa(N) - wa(N//3) * 3 - wa(N // 5) * 5 + wa(N // 15) * 15)

Solution (Python):

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

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

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

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

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

ans = 0

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

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

amount = (N+1) * N // 2
three = N // 3
three = (three + 1) * 3 * three // 2 if three > 0 else 0
five = N // 5
five = (five + 1) * 5 * five // 2 if five > 0 else 0
fifteen = N // 15
fifteen = (fifteen + 1) * 15 * fifteen // 2 if fifteen > 0 else 0
print(amount-three-five+fifteen)

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

SUM=0
for i in range(N+1):
  SUM+=i
  
Ans=SUM-FB
print(Ans)

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

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

Solution (Python):
from sys import stdin
input=lambda : stdin.readline().strip()
from math import ceil,sqrt,factorial,gcd,log
su=0
for i in range(1,int(input())+1):
	if i%3!=0 and i%5!=0:
		su+=i
print(su)

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

Solution (Python):
def fizz_buzz_sum(N):
  not_fizz_buzz = [i for i in range(1, N+1) if (i%3 != 0) and (i%5 != 0)]
  return sum(not_fizz_buzz)

print(fizz_buzz_sum(int(input())))

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

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

Solution (Python):
def sum(N):
    return N * (N + 1) // 2


N = int(input())
print(sum(N) - sum(N // 3) * 3 - sum(N // 5) * 5 + sum(N // 15) * 15)

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

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

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

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

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

numbers = list(range(1,N+1))
int_numbers = [int(x) for x in numbers]


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

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

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

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

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

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

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

print(sum)

Solution (Python):
N = int(input())
n3 = N // 3
n5 = N // 5
n15 = N // 15
sum3 = 3*n3*(n3+1)//2
sum5 = 5*n5*(n5+1)//2
sum15 = 15*n15*(n15+1)//2
print(N*(N+1)//2 - sum3 - sum5 + sum15)

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

Solution (Python):
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(n+1):
    if i%3 != 0 and i%5 != 0:
        ans += i

print(ans)

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

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

a=1
sum_a=0
while a<=N:
	sum_a=sum_a+a
	a=a+1

b=1
sum_b=0
while b<=N//3:
	sum_b=sum_b+b
	b=b+1
	
c=1
sum_c=0
while c<=N//5:
	sum_c=sum_c+c
	c=c+1
	
d=1
sum_d=0
while d<=N//15:
	sum_d=sum_d+d
	d=d+1
	

print(sum_a+15*sum_d-3*sum_b-5*sum_c)

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())

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

    print(res)


if __name__ == '__main__':
    resolve()

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

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

Solution (Python):
import sys
import numpy as np

N=int(input())
A=np.arange(N+1)
count = 0

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

Solution (Python):
import sys
import numpy as np

N=int(input())
A=np.arange(N+1)
count = 0

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

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

print(fizz_buzz_sum)

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

n_loop, reminder = divmod(num, 15)
total = 0
i = -1
for i in range(n_loop):
	total += i *15 *  8 + sum([1, 2, 4, 7, 8, 11, 13, 14])
remaining_nums = [num for num in range(1, reminder+1) if num % 3 and num % 5]
total += sum(remaining_nums) + (i + 1) * 15 * len(remaining_nums)

print(total)

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):
num = int(input())
fizzBuzz = 0

while(num > 0):
  if(num % 15 == 0):
    num -= 1
    continue
  elif(num % 3 == 0):
    num -= 1
    continue
  elif(num % 5 == 0):
    num -= 1
    continue
  else:
    fizzBuzz += num
    num -= 1

print(fizzBuzz)

Solution (Python):
n = int(input())
l = []
add = 0
for i in range(1,n+1):
    if i%3 == 0 and i%5 == 0:
        l.append("fizzBuzz")
    elif i%3 == 0:
        l.append("Fizz")
    elif i%5 == 0:
        l.append("Buzz")
    else:
        l.append(i)
        add = add + i
print(add)

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())
l = [i for i in range(1, n + 1)]
nl = []

for a in l:
    if (a % 5 != 0) and (a % 3 != 0):
        nl.append(a)

print(sum(nl))

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

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

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

Solution (Python):
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):
    if(i%5):
      s+=i
    
print(s)

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

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

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

print(s)

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

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

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

total=0

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

print(total)

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

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

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

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

cnt = 0

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

print(cnt)

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

sho3 = N // 3
wa3 = 3 * sho3 * (sho3 + 1) / 2


sho5 = N // 5
wa5 = 5 * sho5 * (sho5 + 1) / 2


sho15 = N // 15
wa15 = 15 * sho15 * (sho15 + 1) / 2

wa = N * (N + 1) / 2
sum =int(wa - (wa3 + wa5 - wa15))
print(sum)

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

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

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

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

print(sum_c)

Solution (Python):
N=int(input())
N3=N//3
N5=N//5
N15=N//15
def s(x):
    return x*(x+1)//2
print(s(N)-3*s(N3)-5*s(N5)+15*s(N15))

Solution (Python):
N = input()

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

print(summation)

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


import sys



















def main():
    mod = 1000000007                  
    inf = float('inf')
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    n = ii()
    ans = 0
    for i in range(1, n+1):
        if i % 3 != 0 and i % 5 != 0:
            ans += i
    print(ans)

if __name__ == "__main__":
    main()

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

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

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

ans = 0

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

print(ans)

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

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(1,N+1):
  if(i%3==0 and i%5==0):
    pass
  elif(i%3==0):
    pass
  elif(i%5==0):
    pass
  else:
    a.append(i)
print(sum(a))

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

Solution (Python):
a = int(input())
list1 = []
list2 = []
for i in range(a):
	list1.append(i+1)
	i+=1
for x in list1:
	if not ((x%3 == 0) or (x%5==0)):
		list2.append(x)
print(sum(list2))

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

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

Solution (Python):
N=int(input())
N3=N//3
N5=N//5
N15=N//15
def s(x):
  return x*(x+1)//2
print(s(N)-3*s(N3)-5*s(N5)+15*s(N15))

Solution (Python):
from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:from __builtin__ import xrange as range;from future_builtins import ascii, filter, hex, map, oct, zip 

BUFSIZE = 8192;
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3: 
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n");ii = lambda: int(input());ll = lambda: list(map(int , input().split()));vv = lambda: map(int , input().split());pr = print
pl = lambda l: pr(" ".join(list(map(str,l))))
import math
def fun(n):
    tot = n * (n+1)
    tot//=2
    return tot

n = ii()
print(fun(n) - 3*fun(n//3) -5*fun(n//5) + 15*fun(n//15))

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

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

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

print(s)

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

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):
from sys import stdin
N = int(stdin.readline().rstrip())
print(sum([i for i in range(1, N+1) if not i % 3 == 0 and not i % 5 == 0]))

Solution (Python):


import sys
import math
import collections
import itertools
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def lcm(x, y) : return (x * y) // math.gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

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

n3 = 0
n5 = 0
n15 = 0


for i in range(N // 3):
  n3 += 3 * (i+1)

for i in range(N // 5):
  n5 += 5 * (i+1)

for i in range(N // 15):
  n15 += 15 * (i+1)
  
print(N * (N + 1) // 2 - n3 - n5 + n15)

Solution (Python):
n = int(input())
f = sum([3*(i+1) for i in range(n//3)])
b = sum([5*(i+1) for i in range(n//5)])
fb = sum([15*(i+1) for i in range(n//15)])
print(n*(n+1)//2 - f - b + fb)

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())
total=n*(n+1)//2
a=n//15
b=n//3
c=n//5

fb=15*a*(a+1)//2
f=3*b*(b+1)//2
b=5*c*(c+1)//2

print(total-f-b+fb)

Solution (Python):
n = int(input()) + 1
answar = 0

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

print(answar)

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

Solution (Python):
n = int(input())
num = 1
sum = 0
while num <= n:
  mod=num%3
  if(mod==0):
    num += 1
    continue
  mod=num%5
  if(mod==0):
    num += 1
    continue
  sum += num
  num += 1
print(sum)

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

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

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

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

print(sum(a))

Solution (Python):
N = int(input())
F = 0
B = 0
X = 0
S = 0
for i in range (N+1):
    if i%3==0:
        F = F + i
for j in range (N+1):
    if j%5==0:
        B = B + j
for k in range (N+1):
    if k%15==0:
        X = X + k
for l in range(N+1):
    S = S + l
print(S-F-B+X)

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

row=n//15
total=row*row*60
for i in range(1+row*15,n+1):
  if i%3 != 0:
    if i%5 != 0:
      total+=i
print(total)

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

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

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

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

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

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

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

print(sum)

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

for i in range(1,a+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())

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

print(sum)

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

def sig(n):
  return int(n*(n+1)*0.5)

ans = sig(n) - 3*sig(n//3) - 5*sig(n//5) + 15*sig(n//15)

print(ans)

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

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

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

res=0
k=0
for i in range(A):
  if (i+1) % 3 == 0:
    k=0
  elif (i+1) % 5 == 0:
    k=0
  else:
    res+= (i+1)
    
print(res)

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

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

print(sum)

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

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

print(res)

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

Solution (Python):
print(sum(list(i for i in range(int(input())+1) if i%3 > 0 < i%5)))

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

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

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

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

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

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

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

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

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

print(sum)